Flitter makes launching apps and switching between windows as fast and easy as possible:
Compared to using the mouse or traditional fast window switching shortcuts (like Alt-Tab), with Flitter:
Repeatedly hitting F1 to cycle through Firefox windows doesn't scale well if you have dozens of Firefox windows open. But personally I usually have just one, and never more than three or four, windows per app (and then sometimes several tabs within each window) and Flitter works great for me (focusing the most recently used windows first makes a big difference).
Binding each function key to an app doesn't scale when you have more apps than
function keys. You can just fall back on Alt-Tab for apps outside of your top
12, but flitter --others
(see below) gives you a key for cycling through
windows that don't belong to any of your bound apps. I find this lets me avoid
Alt-Tab entirely.
Flitter requires Python 2.7, wmctrl and works with any WMH/NetWM compatible X Window Manager (Gnome, Unity, Openbox...)
It doesn't work on Windows, OS X, or non-WMH/NetWM linux environments yet, although porting should be possible (just replace wmctrl.py with something capable of interacting with your desktop's windows).
First install wmctrl. On Debian or Ubuntu, just:
$ sudo apt-get install wmctrl
Then install Flitter:
$ pip install flitter
You should now be able to run the flitter
command in your shell.
Run flitter -h
for help.
Copy the default configuration file
to ~/.flitter.json
. This is a JSON file containing a list
of window specs. Window specs are how Flitter knows which windows belong to
which app. Each spec has a name, such as Firefox
, and a number of properties
that are matched against the properties of your open windows to decide whether
each window is a Firefox window or not. For example:
"Firefox": {
"wm_class": ".Firefox",
"command": "firefox"
},
This window spec will match all windows whose WM_CLASS property contains the string ".Firefox" (in other words, all Firefox windows).
To have Flitter raise a Firefox window or launch Firefox, run it with the spec's name as the command-line argument:
$ flitter firefox
Flitter doesn't have built-in support for keyboard shortcuts. You just use whatever mechanism your window manager provides to bind keyboard shortcuts to flitter commands.
To see a list of all your open windows and their properties so you can write
window specs for them, run wmctrl -lxp
(see man wmctrl
for more info).
The "command"
part of the spec is the command that Flitter will run to launch
Firefox, if it finds no Firefox windows.
This way of identifying windows is quite flexible. You can go beyond the simple one app per keyboard shortcut model, for example:
The full set of attributes that you can include in a window spec is:
window_id
The unique ID of an open window, e.g. 0x0180000b
desktop
The desktop that the window is on, e.g. 1
pid
The process ID of the window, e.g. 3384
wm_class
The WM_CLASS of the window, e.g. Navigator.Firefox
machine
The client machine that the window belongs to
title
The window title
To install Flitter in a virtual environment for development first install virtualenv, on Debian or Ubuntu do:
$ sudo apt-get install python-virtualenv
Then create and activate a Python virtual environment and install Flitter into it:
$ virtualenv flitter
$ . flitter/bin/activate
$ cd flitter
$ pip install -e 'git+https://github.com/seanh/flitter.git#egg=flitter'
which flitter
should now report the flitter binary in your virtualenv.
To run the tests do:
$ cd src/flitter
$ pip install -r dev-requirements.txt
$ nosetests
To run the tests and produce a test coverage report, do:
$ nosetests --with-coverage --cover-inclusive --cover-erase --cover-tests
To upload a new release of Flitter to PyPI ans GitHub:
python setup.py sdist
python setup.py sdist upload
git commit setup.py -m "Release version X.Y.Z"
git tag X.Y.Z
git push
git push --tags