I am trying to write a script that moves the active window to the next higher workspace, which I will then assign to a key. I am using xdotool to find the active window, then wmctrl to list the active windows, and want to use grep to find the active window in the list of windows to find out which workspace it's on, so that I can then increment that by 1 and move the window to that workspace if it exists.
As you can see, searching for that value as a variable ACTWIND or as a value 0x5a00004 (and variations in single or double quotes, with and without beginning of line) results in no lines found, but when I search for LXTerminal which is on the same line, it is found. In my script I will need it to either work using a variable or by substituting in the xdotool call where the variable would be.
ACTWIND=$( printf 0x%x $(xdotool getactivewindow) ) $ echo “123 $ACTWIND 456” 123 0x5a00004 456 $ wmctrl -l 0x03600001 0 hpdv9917d Conky (hpdv9917d) 0x02800010 0 hpdv9917d YiPs Wiki (i powered) – Search – Mozilla Firefox 0x02800027 0 hpdv9917d Print all variables in a class? – Python – Stack Overflow – Mozilla Firefox 0x02800038 0 hpdv9917d (5) antiX (and MX) frugal installs (with grub entry) – YouTube – Mozilla Firefox 0x05a00004 0 hpdv9917d LXTerminal 0x02000002 0 hpdv9917d mrxvt-mini 0x02800043 0 hpdv9917d how to shift applications from workspace 1 to 2 using command – Ask Ubuntu – Mozilla Firefox 0x02600003 0 hpdv9917d *untitled – Geany 0x03200003 0 hpdv9917d antiX Control Center 0x03e00002 0 hpdv9917d alsamixer 0x01000008 0 hpdv9917d /home/bobc/Downloads/work $ wmctrl -d 0 * DG: 1440×900 VP: 0,0 WA: 0,0 1440×875 N/A 1 – DG: 1440×900 VP: 0,0 WA: 0,0 1440×875 N/A $ wmctrl -l | grep $ACTWIND $ wmctrl -l | grep 0x5a00004 $ wmctrl -l | grep "0x5a00004" $ wmctrl -l | grep '0x5a00004' $ wmctrl -l | grep '^0x5a00004' $ wmctrl -l | grep "^0x5a00004" $ wmctrl -l | grep LXTerminal 0x05a00004 0 hpdv9917d LXTerminal