In search of a desktop-agnostic shortcut solution

Hi,
I am very keyboard driven. I start all my applications via shortcuts and also do I do “manual window tiling”, in KDE for example: “upper left, lower left, upper right, etc…”.
My 2nd DE of choice is XFCE, and I am super happy that their shortcuts for example “upper right” is already “9” on the NumBlock…

But as I often do distro and desktop testing I was looking for a solution that is simple and could be used under all desktops. So I found the super cool tool “sxhkd” which is very easy to use.

For example, these apps:

Now I am wondering: is it possible to move, snap and tile windows kind of “desktop environment agnostic”? Are the “commands” that move a window to the “upper left” or just right or so? Or that do : move window to the next monitor or so… how could I do that? If this would be possible with commands, I could and would use them in my sxhkdrc file.

I would be super happy if someone would have an idea.

Kind regards

Joe

1 Like

Sounds like you want xdotool.

Man page: xdotool(1) — xdotool — Debian testing — Debian Manpages
Git: Releases · jordansissel/xdotool · GitHub
Main Site: xdotool - fake keyboard/mouse input, window management, and more - semicomplete

Platform Install Method
Debian and Ubuntu apt install xdotool
FreeBSD pkg install xdotool
Fedora dnf install xdotool
OSX brew install xdotool
OpenSUSE zypper install xdotool

Basic example: This command takes the first instance of “Mozilla Firefox” and tiles it to the top right corner:

xdotool search --limit 1 “Mozilla Firefox” windowmove %@ 50% 0 windowsize %@ 50% 50%

1 Like

Learned about wmctrl recently…

Destination Linux 50:37 Tip of the Week: wmctrl to manage windows
https://youtu.be/VnSzYx18bg4?t=3038

Man page: https://linux.die.net/man/1/wmctrl
Main Site: http://tripie.sweb.cz/utils/wmctrl/
Excellent usage guide: wmctrl

Platform Install Method
Debian and Ubuntu apt install wmctrl
Redhat yum install wmctrl

Same example, tiling top right corner for a 1080p screen:

wmctrl -r “Mozilla Firefox” -e 0,960,0,960,540

xdotool has a ton more features (like native % handling, keyboard/mouse jacking, ect) but wmctrl appears to be a lot easier to use if you’re just moving/resizing windows.