2

In gnome 3.28 on ubuntu 18.04

SUPER+← snaps a window to the left
SUPER+→ snaps a window to the right

These actions are called "View split on Left" or "View Split on Right" in the list of Gnome keyboard shortcuts in Settings. Once windows have been snapped, one can then drag the location of the split (which defaults to center) to the left or right, giving more room to one window and less to the other (and any subsequently snapped windows obey this new split location). IMO it is a beautiful and polished implementation.

My question is how to move the default split location away from center. I love having an 80 character wide terminal window on the right (which takes up less than half my 16:9 screen's width) and giving the wider, remaining space to a browser window on the left. Basically, I want to avoid manually dragging the left/right snap boundary after a reboot. Here is a screenshot of split windows with my preferred boundary location:

Screenshot

Note how the the snapped windows no longer have rounded edges, but take up the entire rectangular area on either side of the split.

Since the split location can be altered with a mouse drag, perhaps this variable can be programmatically set on boot? Perhaps, though, the variable is reset upon an initial window snap and there is no way to force this... Perhaps I should just switch to a tiled wm like dwm xD but gnome is otherwise fine for me.

2
  • I don't think you can do it (I'd love to be proven wrong though...). Both dbus communications and dconf database are silent while doing the operations you describe above so I suspect it's hardcoded (e.g. it splits to smth like get_current_value which, if unset, defaults to 1/2 of screen width). You might as well try the ShellTile extension, see if it can do what you want... – don_crissti Sep 9 '18 at 17:43
  • That is great info, thanks for doing those checks @don_crissti. To get the behavior I want I have stopped using Mutter's split sceen for now. Instead I simply set default window dimensions and placement values for xterm and then rely on firefox's session management, which resets the window dimensions perfectly on it's own, in order to avoid dragging windows around every reboot. – courtyardz Sep 9 '18 at 22:33
1

Alternatively you can create a script to do what you want and map a shortcut to it. The following bash script will set it to one third or two thirds of the screen:

screenWidth=$(xrandr --current | grep '*' | uniq | awk '{print $1}' | cut -d 'x' -f1)
windowWidth=$(xwininfo -id $(xprop -root _NET_ACTIVE_WINDOW | cut -d ' ' -f 5) | grep Width | cut -d ' ' -f 4)

numberRegex='^[0-9]+$'

if  ! [[ $windowWidth =~ $numberRegex ]] ; then
   echo "error: windowWith not a number: '$windowWidth'" >> tile-plus.log; exit 1
fi


if  ! [[ $screenWidth =~ $numberRegex ]] ; then
   echo "error: screenWidth not a number: '$screenWidth'" >> tile-plus.log; exit 1
fi

doubleWidth=$((2*windowWidth))

parameter=$1

echo "Comparing screenWidth $screenWidth and double of width $doubleWidth" >> tile-plus.log
if [[ doubleWidth -gt screenWidth ]] ; then
   echo "Detected big size" >> tile-plus.log
   nextWidth=$((screenWidth / 3))
else
   echo "Detected small size" >> tile-plus.log
   nextWidth=$((screenWidth * 2 / 3))
fi

case $parameter in
right)
   echo "Received right parameter" >> tile-plus.log
   nextOffset=$((screenWidth - nextWidth))
   ;;
*)
  echo "Received $parameter defaulting to left" >> tile-plus.log
  parameter="left"
  nextOffset=0
esac


echo Width will be set to $nextWidth and offset to $nextOffset >> tile-plus.log

wmctrl -r :ACTIVE: -b add,maximized_vert
wmctrl -r :ACTIVE: -e 1,$nextOffset,0,$nextWidth,600

If you save this in say '~/.keyboard-shortcuts/tile-plus.h', then you can create a binding to <Super><Alt>Right that executes bash .keyboard-shortcuts/tile-plus.h right and a shortcut to <Super><Alt>Left that executes bash .keyboard-shortcuts/tile-plus.h left.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.