diff options
| -rw-r--r-- | ChangeLog.md | 2 | ||||
| -rwxr-xr-x | kvmx | 23 | 
2 files changed, 14 insertions, 11 deletions
diff --git a/ChangeLog.md b/ChangeLog.md index 668816c..68b066e 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -10,7 +10,7 @@    * Inotify action for watching a folder in the host and issuing commands in the      guest upon change. -  * Notification on Awesome VM when a Spice session is triggered. +  * Notification on Awesome VM when a Spice session taking too long to open.  ## 0.2.0 - 2024-07-02 @@ -265,11 +265,6 @@ function kvmx_spice {      exit 1    fi -  # UX -  if which awesome-client &> /dev/null; then -    echo "naughty.notify({title = \"KVMX:\", text =\"Starting GUI session for $VM\", timeout = 2})" | awesome-client -  fi -    local spicestring    if [ "$spice_client" == "spicy" ] && which spicy &> /dev/null; then @@ -307,14 +302,11 @@ function kvmx_spice {      local spicewait="0"      local windowid      local windowpid +    local notify="0"      # Wait for the spice window to show up. This might take a while and we'll      # wait only a few times -    while (( $spicewait <= 5 )); do -      # Wait a bit -      sleep 2 -      let spicewait++ - +    while (( $spicewait <= 10 )); do        windowid="`xdotool search --name "$spicestring" 2> /dev/null`"        if [ ! -z "$windowid" ]; then @@ -328,6 +320,17 @@ function kvmx_spice {            windowpid=""          fi        fi + +      # It's waiting too long, notify the user +      if which awesome-client &> /dev/null && [ "$notify" == "0" ]; then +        notify="1" + +        echo "naughty.notify({title = \"KVMX:\", text =\"Starting GUI session for $VM\", timeout = 2})" | awesome-client +      fi + +      # Wait a bit and try again +      sleep 1 +      let spicewait++      done      # Set window position  | 
