Search code examples
linuxshelllinux-mintzenity

Calling wmctrl after zenity in shellscript does not work


I have this very simple shellscript, I need to move one dialog created with zenity

#!/bin/bash
zenity --progress --title="Progress" --auto-close --no-cancel --text="Updating..."
wmctrl -r "Progress" -e 0,0,0,-1,-1

But it does not work, if you try the commands in other shell works properly, but not in the script.


Solution

  • The way your script is written suggests that 1. zenity is executed and displays a window, bash waits for it to finish 2. next, wmctrl is executed, and is unable to find zenity since its window is already closed

    You should add an ampersand ("&" symbol) to the end of your zenity line (and perhaps sleep for a while to let zenity create the window) before you can call wmctrl.