I love the i3 window manager, but it’s missing specific features. This is my attempt to make it perfect.
I’ve found that combining Mate and i3 gives me the best of all worlds - a simple but fully featured desktop with the amazing window management of i3. It’s really easy to set up and the process is covered in this blog post.
i3 supports moving windows to center of the screen, but not to the edges. This requires calculating the screen dimensions and the window dimensions.
This script will move the active floating window to one of the screen edges (the only parameter it requires). Note that it needs the xdotool
utility.
Put it somewhere in your PATH (or give the full path to it in the i3 config file).
And here is a config example:
bindsym $mod+Shift+h move left; exec i3_floating_to_edges.sh left
bindsym $mod+Shift+j move down; exec i3_floating_to_edges.sh down
bindsym $mod+Shift+k move up; exec i3_floating_to_edges.sh up
bindsym $mod+Shift+l move right; exec i3_floating_to_edges.sh right
(The ‘move direction;’ statements at the beginning are for simultaneously still allow moving of non-floating windows)
Sometimes you’d might want to move all the floating windows out of the way.
For this, I wrote another script (it’s using the one in the previous section, so you’ll need both of them).
Notice that the script will resize the width of the windows to 50%. This is convenient to me because I always have two panes of windows side-by-side. If you don’t need that, remove the section in lines 13-15 (if - export - fi).
An example configuration:
bindsym $mod+Ctrl+h exec i3_all_floating_to_edges.sh left
bindsym $mod+Ctrl+j exec i3_all_floating_to_edges.sh down
bindsym $mod+Ctrl+k exec i3_all_floating_to_edges.sh up
bindsym $mod+Ctrl+l exec i3_all_floating_to_edges.sh right
bindsym $mod+Ctrl+c exec i3_all_floating_to_edges.sh center
Whenever I’m hopping around workspaces and windows, I’ve found it more convenient to expect the mouse pointer to always be in the center of the active window. To achieve this, we need to set a variable with script in it and call it whenever there is a switch.
So first set the variable:
set $movemouse "bash -c 'eval `xdotool getactivewindow getwindowgeometry --shell`; [ x$X != x ] && xdotool mousemove $((X+WIDTH/2)) $((Y+HEIGHT/2))'"
And then call it every time you need, for example:
bindsym $mod+1 workspace $ws1; exec $movemouse
Feel free to drop me a mail if you have any thoughts or ideas.