Der eigentliche Befehl, den Sie wollen, ist so etwas wie
wmctrl -r :ACTIVE: -b add,maximized_vert &&
wmctrl -r :ACTIVE: -e 0,0,0,$HALF,-1
Dadurch nimmt das aktuelle Fenster die Hälfte des Bildschirms ein (ändern Sie $HALFdie Abmessungen Ihres Bildschirms) und rastet auf der linken Seite ein. Zum Einrasten nach rechts verwenden Sie
wmctrl -r :ACTIVE: -b add,maximized_vert &&
wmctrl -r :ACTIVE: -e 0,$HALF,0,$HALF,-1
Sie können auch damit spielen wmctrl, um die ID der Fenster zu ermitteln, an denen Sie interessiert sind, anstatt sie zu verwenden :ACTIVE:. Ich kann da allerdings nicht helfen, da das von den jeweiligen Fenstern abhängt. Schauen Sie sich man wmctrlnach mehr um.
Ich habe ein Skript dafür geschrieben. Ich verwende Unity nicht und kann daher nicht garantieren, dass es damit funktioniert, aber ich sehe keinen Grund, warum nicht. Es muss wmctrl, xdpyinfound disperinstalliert werden:
sudo apt-get install wmctrl x11-utils disper
Speichern Sie dann das unten stehende Skript als ~/bin/snap_windows.sh, machen Sie es mit ausführbar chmod a+x ~/bin/snap_windows.shund Sie können es ausführen
snap_windows.sh r
Rechts einrasten. Verwendenl für die linke Seite keine Argumente, um das Fenster zu maximieren. Beachten Sie, dass es im aktuellen Fenster ausgeführt wird, sodass Sie ihm eine Verknüpfung zuweisen müssen, wenn es auf einem anderen Computer als dem Terminal ausgeführt werden soll.
Das Skript ist etwas komplizierter als gewünscht, da ich es sowohl für Einzel- als auch für Doppelmonitor-Setups geschrieben habe.
#!/usr/bin/env bash
## If no side has been given, maximize the current window and exit
if [ ! $1 ]
then
wmctrl -r :ACTIVE: -b toggle,maximized_vert,maximized_horz
exit
fi
## If a side has been given, continue
side=$1;
## How many screens are there?
screens=`disper -l | grep -c display`
## Get screen dimensions
WIDTH=`xdpyinfo | grep 'dimensions:' | cut -f 2 -d ':' | cut -f 1 -d 'x'`;
HALF=$(($WIDTH/2));
## If we are running on one screen, snap to edge of screen
if [ $screens == '1' ]
then
## Snap to the left hand side
if [ $side == 'l' ]
then
## wmctrl format: gravity,posx,posy,width,height
wmctrl -r :ACTIVE: -b add,maximized_vert && wmctrl -r :ACTIVE: -e 0,0,0,$HALF,-1
## Snap to the right hand side
else
wmctrl -r :ACTIVE: -b add,maximized_vert && wmctrl -r :ACTIVE: -e 0,$HALF,0,$HALF,-1
fi
## If we are running on two screens, snap to edge of right hand screen
## I use 1600 because I know it is the size of my laptop display
## and that it is not the same as that of my 2nd monitor.
else
LAPTOP=1600; ## Change this as approrpiate for your setup.
let "WIDTH-=LAPTOP";
SCREEN=$LAPTOP;
HALF=$(($WIDTH/2));
if [ $side == 'l' ]
then
wmctrl -r :ACTIVE: -b add,maximized_vert && wmctrl -r :ACTIVE: -e 0,$LAPTOP,0,$HALF,-1
else
let "SCREEN += HALF+2";
wmctrl -r :ACTIVE: -b add,maximized_vert && wmctrl -r :ACTIVE: -e 0,$SCREEN,0,$HALF,-1;
fi
fi