Sample Header Ad - 728x90

Moving floating windows around with keyboard shortcuts

1 vote
0 answers
54 views
I'm currently using a Linux Mint 22 Cinnamon 6.2.9 installation that is a couple days old and I want to use some features I had on a previous tiling window manager with XFCE. In particular, I want to move floating windows around with shortcuts. In order to do that I made this brief Bash script:
#!/bin/sh
win_id=xdotool getactivewindow

u=xwininfo -id $win_id | grep 'Absolute upper-left X' | cut -c27-35
v=xwininfo -id $win_id | grep 'Absolute upper-left Y' | cut -c27-35

(( u+=150, v=$v-86 ))

xdotool getactivewindow windowmove $u $v
It intends to move a floating window 150 px along the X-axis only (the 86 pixels that I subtract from the Y-axis are the window's upper decoration which is considered by xwininfo but not by windowmove. When I execute it in the terminal, it works fine, but when I try to bind it to some keyboard shortcut (e.g., Super + G), the selected window moves only +86 px on the Y-axis. Can anyone replicate this? What could be the cause of this inconsistency? I already have verified that other kind of key-bind scripts executes well (like open other programs).
Asked by Absl Lidenbrock (11 rep)
Dec 30, 2024, 03:22 AM
Last activity: Dec 30, 2024, 03:29 AM