Difference between revisions of "Qtile"
(→Keys) |
(→Starting: style) |
||
(27 intermediate revisions by 8 users not shown) | |||
Line 1: | Line 1: | ||
[[Category:Tiling WMs]] | [[Category:Tiling WMs]] | ||
+ | [[fr:Qtile]] | ||
[[ja:Qtile]] | [[ja:Qtile]] | ||
+ | [[zh-hans:Qtile]] | ||
+ | {{Related articles start}} | ||
+ | {{Related|Comparison of tiling window managers}} | ||
+ | {{Related|Window manager}} | ||
+ | {{Related articles end}} | ||
+ | |||
From [http://qtile.org/ Qtile web site]: | From [http://qtile.org/ Qtile web site]: | ||
− | : | + | :Qtile is a full-featured, hackable tiling window manager written in Python. Qtile is simple, small, and extensible. It's easy to write your own layouts, widgets, and built-in commands.It is written and configured entirely in Python, which means you can leverage the full power and flexibility of the language to make it fit your needs. |
== Installing == | == Installing == | ||
− | |||
− | + | [[Install]] one of the following packages: | |
− | + | ||
− | + | * {{Pkg|qtile}} for the latest official release, running on Python 3. | |
+ | * {{AUR|qtile-python2}} for the latest official release, running on Python 2. | ||
+ | * {{AUR|qtile-python3-git}} for the latest git commit, running on Python 3. | ||
+ | * {{AUR|qtile-git}} for the latest git commit, running on Python 2. | ||
− | + | == Starting == | |
− | + | Run {{ic|qtile}} with [[xinit]]. | |
− | |||
− | + | The [http://docs.qtile.org/en/latest/manual/config/default.html#key-bindings default configuration] includes the shortcut {{ic|Super+Enter}} to open a new ''xterm'' terminal, and {{ic|Super+Ctrl+q}} to quit Qtile. | |
− | |||
== Configuration == | == Configuration == | ||
+ | |||
{{Note|This chapter only explains the basics of the configuration of Qtile. For more complete information, look at the [http://docs.qtile.org/en/latest/ official documentation].}} | {{Note|This chapter only explains the basics of the configuration of Qtile. For more complete information, look at the [http://docs.qtile.org/en/latest/ official documentation].}} | ||
− | + | As described in [http://docs.qtile.org/en/latest/manual/config/default.html#configuration-lookup Configuration Lookup], Qtile provides a default configuration file that will be used in absence of user-defined ones. In order to start customizing Qtile, copy it to {{ic|~/.config/qtile/config.py}}: | |
+ | |||
+ | $ mkdir -p ~/.config/qtile/ | ||
+ | $ cp /usr/share/doc/''qtile_dir''/default_config.py ~/.config/qtile/config.py | ||
+ | |||
+ | Where {{ic|''qtile_dir''}} is the name of the AUR package you [[#Installing|installed]]. | ||
+ | |||
+ | Alternatively, the most recent default configuration file can be downloaded from the git repository at [https://github.com/qtile/qtile/blob/develop/libqtile/resources/default_config.py libqtile/resources/default_config.py]. | ||
+ | |||
+ | Several more complete configuration file examples can be found in the [https://github.com/qtile/qtile-examples qtile-examples] repository. | ||
+ | |||
+ | The configuration is fully done in Python: for a ''very'' quick introduction to the language you can read [https://developers.google.com/edu/python/introduction this tutorial]. | ||
+ | |||
+ | Before restarting Qtile you can test your configuration file for syntax errors using the command: | ||
− | |||
$ python2 -m py_compile ~/.config/qtile/config.py | $ python2 -m py_compile ~/.config/qtile/config.py | ||
+ | |||
If the command gives no output, your script is correct. | If the command gives no output, your script is correct. | ||
=== Groups === | === Groups === | ||
+ | |||
In Qtile, the workspaces (or views) are called '''Groups'''. They can be defined as following: | In Qtile, the workspaces (or views) are called '''Groups'''. They can be defined as following: | ||
+ | |||
{{bc|<nowiki> | {{bc|<nowiki> | ||
from libqtile.config import Group, Match | from libqtile.config import Group, Match | ||
Line 42: | Line 65: | ||
=== Keys === | === Keys === | ||
+ | |||
You can configure your shortcuts with the '''Key''' class. | You can configure your shortcuts with the '''Key''' class. | ||
− | Here is an example of the shortcut {{ | + | Here is an example of the shortcut {{ic|Alt+Shift+q}} to quit the window manager. |
+ | |||
{{bc|<nowiki> | {{bc|<nowiki> | ||
from libqtile.config import Key | from libqtile.config import Key | ||
Line 55: | Line 80: | ||
...</nowiki> | ...</nowiki> | ||
}} | }} | ||
+ | |||
You can find out which {{ic|modX}} corresponds to which key with the command [[Xmodmap]]. | You can find out which {{ic|modX}} corresponds to which key with the command [[Xmodmap]]. | ||
− | === Screens | + | ==== Sound ==== |
+ | |||
+ | You can add shortcuts to easily control the sound volume and state by [[Users and groups#Group_management|adding a user]] to the '''audio''' group and using the {{ic|alsamixer}} command-line interface. | ||
+ | |||
+ | {{bc|<nowiki> | ||
+ | keys= [ | ||
+ | ... | ||
+ | # Sound | ||
+ | Key([], "XF86AudioMute", lazy.spawn("amixer -q set Master toggle")), | ||
+ | Key([], "XF86AudioLowerVolume", lazy.spawn("amixer -c 0 sset Master 1- unmute")), | ||
+ | Key([], "XF86AudioRaiseVolume", lazy.spawn("amixer -c 0 sset Master 1+ unmute")) | ||
+ | ]</nowiki> | ||
+ | }} | ||
+ | |||
+ | === Screens === | ||
+ | |||
Create one '''Screen''' class for every monitor you have. The bars of Qtile are configured in the '''Screen''' class as in the following example: | Create one '''Screen''' class for every monitor you have. The bars of Qtile are configured in the '''Screen''' class as in the following example: | ||
+ | |||
{{bc|<nowiki> | {{bc|<nowiki> | ||
from libqtile.config import Screen | from libqtile.config import Screen | ||
Line 73: | Line 115: | ||
}} | }} | ||
− | === | + | ==== Bars and widgets ==== |
+ | |||
You can find a list of all the built-in widgets in [http://docs.qtile.org/en/latest/manual/ref/widgets.html the official documentation]. | You can find a list of all the built-in widgets in [http://docs.qtile.org/en/latest/manual/ref/widgets.html the official documentation]. | ||
If you want to add a widget to your bar, just add it like in the example above (for the {{ic|WindowName}} widget). For example, if we want | If you want to add a widget to your bar, just add it like in the example above (for the {{ic|WindowName}} widget). For example, if we want | ||
to add a battery notification, we can use the {{ic|Battery}} widget: | to add a battery notification, we can use the {{ic|Battery}} widget: | ||
+ | |||
{{bc|<nowiki> | {{bc|<nowiki> | ||
from libqtile.config import Screen | from libqtile.config import Screen | ||
Line 92: | Line 136: | ||
=== Startup === | === Startup === | ||
+ | |||
You can start up applications using '''hooks''', specifically the {{ic|startup}} hook. For a list of available hooks see [http://docs.qtile.org/en/latest/manual/ref/hooks.html the documentation]. | You can start up applications using '''hooks''', specifically the {{ic|startup}} hook. For a list of available hooks see [http://docs.qtile.org/en/latest/manual/ref/hooks.html the documentation]. | ||
Here is an example where an application starts only once: | Here is an example where an application starts only once: | ||
+ | |||
{{bc|<nowiki> | {{bc|<nowiki> | ||
− | import | + | import os |
− | + | import subprocess | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | @hook.subscribe.startup_once | |
− | + | def autostart(): | |
− | + | home = os.path.expanduser('~') | |
− | + | subprocess.call([home + '/.config/qtile/autostart.sh'])</nowiki> | |
− | |||
− | @hook.subscribe. | ||
− | def | ||
− | |||
− | |||
− | |||
− | |||
}} | }} | ||
− | === | + | == Debugging == |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
If you want to locate the source of a problem, you can execute the following line in your terminal: | If you want to locate the source of a problem, you can execute the following line in your terminal: | ||
+ | |||
echo "exec qtile" > /tmp/.start_qtile ; xinit /tmp/.start_qtile -- :2 | echo "exec qtile" > /tmp/.start_qtile ; xinit /tmp/.start_qtile -- :2 | ||
− | == See | + | == See also == |
+ | |||
* [http://qtile.org/ Qtile website] | * [http://qtile.org/ Qtile website] | ||
* [http://docs.qtile.org/en/latest/ The official documentation] | * [http://docs.qtile.org/en/latest/ The official documentation] | ||
− | * [ | + | * [https://github.com/tailhook/tilenol tilenol] - A window manager inspired by Qtile. |
− |
Latest revision as of 19:17, 27 March 2018
From Qtile web site:
- Qtile is a full-featured, hackable tiling window manager written in Python. Qtile is simple, small, and extensible. It's easy to write your own layouts, widgets, and built-in commands.It is written and configured entirely in Python, which means you can leverage the full power and flexibility of the language to make it fit your needs.
Contents
Installing
Install one of the following packages:
- qtile for the latest official release, running on Python 3.
- qtile-python2AUR for the latest official release, running on Python 2.
- qtile-python3-gitAUR for the latest git commit, running on Python 3.
- qtile-gitAUR for the latest git commit, running on Python 2.
Starting
Run qtile
with xinit.
The default configuration includes the shortcut Super+Enter
to open a new xterm terminal, and Super+Ctrl+q
to quit Qtile.
Configuration
As described in Configuration Lookup, Qtile provides a default configuration file that will be used in absence of user-defined ones. In order to start customizing Qtile, copy it to ~/.config/qtile/config.py
:
$ mkdir -p ~/.config/qtile/ $ cp /usr/share/doc/qtile_dir/default_config.py ~/.config/qtile/config.py
Where qtile_dir
is the name of the AUR package you installed.
Alternatively, the most recent default configuration file can be downloaded from the git repository at libqtile/resources/default_config.py.
Several more complete configuration file examples can be found in the qtile-examples repository.
The configuration is fully done in Python: for a very quick introduction to the language you can read this tutorial.
Before restarting Qtile you can test your configuration file for syntax errors using the command:
$ python2 -m py_compile ~/.config/qtile/config.py
If the command gives no output, your script is correct.
Groups
In Qtile, the workspaces (or views) are called Groups. They can be defined as following:
from libqtile.config import Group, Match ... groups = [ Group("term"), Group("irc"), Group("web", match=Match(title=["Firefox"])), ] ...
Keys
You can configure your shortcuts with the Key class.
Here is an example of the shortcut Alt+Shift+q
to quit the window manager.
from libqtile.config import Key from libqtile.command import lazy ... keys = [ Key( ["mod1", "shift"], "q", lazy.shutdown()) ] ...
You can find out which modX
corresponds to which key with the command Xmodmap.
Sound
You can add shortcuts to easily control the sound volume and state by adding a user to the audio group and using the alsamixer
command-line interface.
keys= [ ... # Sound Key([], "XF86AudioMute", lazy.spawn("amixer -q set Master toggle")), Key([], "XF86AudioLowerVolume", lazy.spawn("amixer -c 0 sset Master 1- unmute")), Key([], "XF86AudioRaiseVolume", lazy.spawn("amixer -c 0 sset Master 1+ unmute")) ]
Screens
Create one Screen class for every monitor you have. The bars of Qtile are configured in the Screen class as in the following example:
from libqtile.config import Screen from libqtile import bar, widget ... screens = [ Screen( bottom=bar.Bar([ # add a bar to the bottom of the screen widget.GroupBox(), # display the current Group widget.WindowName() # display the name of the window that currently has focus ], 30)) ] ...
Bars and widgets
You can find a list of all the built-in widgets in the official documentation.
If you want to add a widget to your bar, just add it like in the example above (for the WindowName
widget). For example, if we want
to add a battery notification, we can use the Battery
widget:
from libqtile.config import Screen from libqtile import bar, widget ... screens = [ Screen(top=bar.Bar([ widget.GroupBox(), # display the current Group widget.Battery() # display the battery state ], 30)) ] ...
Startup
You can start up applications using hooks, specifically the startup
hook. For a list of available hooks see the documentation.
Here is an example where an application starts only once:
import os import subprocess @hook.subscribe.startup_once def autostart(): home = os.path.expanduser('~') subprocess.call([home + '/.config/qtile/autostart.sh'])
Debugging
If you want to locate the source of a problem, you can execute the following line in your terminal:
echo "exec qtile" > /tmp/.start_qtile ; xinit /tmp/.start_qtile -- :2
See also
- Qtile website
- The official documentation
- tilenol - A window manager inspired by Qtile.