Keyboard-driven Window Tiling for your existing X11 window manager
As of QuickTile 0.3.0, the installation process has changed.
This was necessary to allow QuickTile to be split across multiple files so I could get past some mental blocks and start to clean up the code and implement new features.
- An X11-based desktop (The code expects NETWM hints and X11-style window decorations)
- Python 2.7
- PyGTK
python-wnck
python-setuptools
python-xlib
(optional, required for key-binding)dbus-python
(optional, required for D-Bus service)
As PyGTK was never ported to Python 3.x and porting to GTK+ 3.x wouldn't bring any significant benefits for a utility that is fundamentally incompatible with Wayland's security model, these requirements are unlikely to change.
Depending on the distro you are using, you may be able to use one of the following commands to easily install them:
Debian and derivatives (Ubuntu, Mint, etc.):
sudo apt-get install python python-gtk2 python-xlib python-dbus python-wnck python-setuptools
Fedora 22 and above:
sudo dnf install python pygtk2 pygobject2 dbus-python gnome-python2-libwnck
Fedora 21 and below:
sudo yum install python pygtk2 pygobject2 dbus-python gnome-python2-libwnck
After you have installed the above requirements (including python-xlib
)
via your system package manager, you can install QuickTile using either of the
following methods:
- If you have
pip2
installed, just run this:
sudo pip2 install https://github.com/ssokolow/quicktile/archive/master.zipNOTE: If you attempt to use the
--upgrade
option and it fails to properly ignore system-provided dependencies, just use these commands instead:sudo pip2 uninstall quicktile sudo rm /usr/local/bin/quicktile /usr/local/bin/quicktile.py sudo pip2 install https://github.com/ssokolow/quicktile/archive/master.zip
- Without
pip2
, download and unpack the zip file and run the following:
cd /path/to/local/copy ./install.sh
Technically speaking, an ordinary
sudo python2 setup.py install
will also work, butinstall.sh
has three advantages:
- It runs the
setup.py build
step without root privileges to avoid leaving root-owned cruft around.- It will attempt to remove old QuickTile files which might cause a newer install to break.
- It saves you the trouble of setting QuickTile to run on startup. (
setup.py
can't do this because it has no mechanism for adding files to/etc
.)
- Without
pip2
, if you don't want a system-wide install:
- Download and unpack the zip file.
- Copy the
quicktile
folder and thequicktile.sh
script into a folder of your choice.- Make sure
quicktile.sh
is marked executable.NOTE: If you'd rather roll your own, the
quicktile.sh
shell script is just three simple lines.
AFTER INSTALLING:
Run
quicktile
once to generate your configuration fileNOTE: If the
quicktile
command dies with aNo module named __main__
error, you probably have an oldquicktile.py
file in/usr/local/bin
that needs to be deleted. If that doesn't fix the problem, you should still be able to run QuickTile aspython2 -m quicktile
instead.Edit
~/.config/quicktile.cfg
to customize your keybindsNote: Customizing the available window shapes currently requires editing the source code (though it's quite simple). This will be remedied when I have time to decide between extending the standard Python rcfile parser and replacing
quicktile.cfg
withquicktile.json
.Set your desktop to run
quicktile --daemonize
if you didn't useinstall.sh
.
- If you are running a desktop which uses Compiz (such as Unity), make sure you've used CCSM to disable the grid plugin or the fight between it and QuickTile for the same type of functionality may cause unpredictable problems.
- Some systems may not provide a Python 2.x binary under the name
python2
. If this is the case on yours,install.sh
must be edited if you choose to use it. - You can list your current keybindings by running
quicktile --show-bindings
- You can get a list of valid actions for the configuration file by running
quicktile --show-actions
- Focus the window you want to tile
- Hold the modifiers defined in
ModMask
(Ctrl+Alt
by default). - Repeatedly press one of the defined keybindings to cycle through window sizes available at the desired location on the screen.
The default keybindings are:
1
through9
on the numeric keypad represent regions of your screen0
on the numeric keypad will fully maximize the active window.H
andV
will maximize a window horizontally or vertically.Enter
on the numeric keypad will cycle the active window to the next monitor.
This works best when combined with functionality your existing window manager
provides (eg. Alt+Tab
) to minimize the need to switch your hand between your
keyboard and your mouse.
Both the ModMask
field and the [keys]
section use GTK+ accelerator
syntax and you can use modifier keys in both places. (ModMask
is prepended
to each [keys]
value before parsing it.)
GTK+ modifier syntax looks like this:
<Ctrl><Alt>Delete
The important things to keep in mind for using it are:
- Do not put any spaces inside your keybind string.
- Modifier names and non-modifier key names are not the same thing.
- Modifier names are case-insensitive.
- Key names like
Down
are case-sensitive. (Don't let the letter keys fool you. Those work the way they do becauseA
anda
are two separate names for the same key.)
GTK+ key names are just X11 key symbols so the simplest way to identify the
name for a key is to use the xev
command. Just run it in a terminal and
press the key you want. It will print out something like this:
The part I've bolded is the name QuickTile expects.
Troubleshooting xev:
- If nothing happens, make sure the
xev
window (and not the terminal) has focus. - If pressing the key triggers some messages but you do not see one which says
KeyPress event
, it's likely that some other program has already grabbed that key combination.
Also, in my testing, QuickTile currently fails to bind keys like Super_L
(left Windows key) when they've been configured as modifiers. I'll look into
this as time permits.
I haven't found a comprehensive document listing the modifier names
gtk.accelerator_parse()
accepts, but here are the names I'm aware of with
consistent mappings:
- Mappings that should be consistent across pretty much any system:
- Control:
<Control>
,<Ctrl>
,<Ctl>
,<Primary>
- Shift:
<Shift>
,<Shft>
- Alt:
<Alt>
,<Mod1>
- Control:
- Mappings which worked for me but I can't make any guarantees for:
- Windows Key:
<Mod4>
- AltGr:
<Mod5>
- Windows Key:
- Mappings which are possible but need to be manually set up using
setxkbmap
andxmodmap
:<Mod3>
(I redefined Caps Lock asHyper_L
and bound it to this)
- Modifiers which cause QuickTile to error out deep in
python-xlib
because GTK+ maps them to integers beyond the limits of the X11 wire protocol:<Meta>
<Super>
<Hyper>
- If you want to trigger QuickTile from another application in an efficient
manner, make sure you have
dbus-python
installed and read up on how to send D-Bus messages using either your language's D-Bus bindings or thedbus-send
orqdbus
commands. - If, for some reason, you want scripted tiling without D-Bus, you can also
run commands like
quicktile top-left
but it may be slower as quicktile has to start, perform an action, and then quit every time you call it.
As with the built-in keybinding, requesting the same action more than once
in a row will cycle through the available window sizes. For further details,
see --help
.
- libwnck tries to flood the logging output with
Unhandled action type _OB_WM_ACTION_UNDECORATE\n\n
messages, which is a bug, and PyGTK doesn't expose the function needed to filter them away. As a result, the best QuickTile can do is pipe its output through grep, leaving a flood of blank lines since grep is finicky about matching them. pip2 uninstall
doesn't remove thequicktile
and/orquicktile.py
files from/usr/local/bin
, which can cause subsequent installs to break.
Thanks to Thomas Vander Stichele for some of the documentation cleanups.