You can use xdotool
to get the window at the current mouse location (getmouselocation
) and then the commands windowminimize
or windowactivate
+ key
.
I made a little script ~/bin/xdowindow
(and made it executable using chmod +x
):
#!/bin/sh
[ "$1" = "Maximize" ] && set -- Up
eval $(xdotool getmouselocation --shell)
case $1 in
Minimize)
xdotool windowminimize "$WINDOW"
;;
Left|Right|Up)
xdotool windowactivate "$WINDOW" key --clearmodifiers super+$1
;;
*)
exit 1
;;
esac
Set custom keyboard shortcuts:

And then use them in logiops
setup:
{
direction: "Right";
mode: "OnRelease";
action = {
type: "Keypress";
keys: [ "KEY_LEFTALT", "KEY_M" ]; // snap window to right
}
},
Note:
xdotool
won't work together with wayland
, maybe ydotool
can be used then. I will test once I use wayland
myself or someone else may jump in and translate the tool.
key
actions ofxdotool
definitely will not work on Wayland. Might be good to add a note as next month, the new LTS will default to using Wayland. – vanadium Apr 04 '22 at 12:14ydotool
can issue keyboard strokes and mouse clicks, but lacks window management features. A more severe Wayland problem: there is no uniform way to obtain information about the running windows: it is the compositor that implements that, so methods to achieve that are different between, Gnome Shell, Plasma and Sway. – vanadium Apr 04 '22 at 13:13