Screens¶
The screens
configuration variable is where the physical screens, their
associated bars
, and the widgets
contained within the bars are defined.
See Built-in Widgets for a listing of available widgets.
Example¶
Tying together screens, bars and widgets, we get something like this:
from libqtile.config import Screen
from libqtile import bar, widget
screens = [
Screen(
bottom=bar.Bar([
widget.GroupBox(),
widget.WindowName()
], 30),
),
Screen(
bottom=bar.Bar([
widget.GroupBox(),
widget.WindowName()
], 30),
)
]
Bars support both solid background colors and gradients by supplying a list of
colors that make up a linear gradient. For example, bar.Bar(...,
background="#000000")
will give you a black back ground (the default), while
bar.Bar(..., background=["#000000", "#FFFFFF"])
will give you a
background that fades from black to white.
Fake Screens¶
instead of using the variable screens the variable fake_screens can be used to set split a physical monitor into multiple screens. They can be used like this:
from libqtile.config import Screen
from libqtile import bar, widget
# screens look like this
# 600 300
# |-------------|-----|
# | 480| |580
# | A | B |
# |----------|--| |
# | 400|--|-----|
# | C | |400
# |----------| D |
# 500 |--------|
# 400
#
# Notice there is a hole in the middle
# also D goes down below the others
fake_screens = [
Screen(
bottom=bar.Bar(
[
widget.Prompt(),
widget.Sep(),
widget.WindowName(),
widget.Sep(),
widget.Systray(),
widget.Sep(),
widget.Clock(format='%H:%M:%S %d.%m.%Y')
],
24,
background="#555555"
),
x=0,
y=0,
width=600,
height=480
),
Screen(
top=bar.Bar(
[
widget.GroupBox(),
widget.WindowName(),
widget.Clock()
],
30,
),
x=600,
y=0,
width=300,
height=580
),
Screen(
top=bar.Bar(
[
widget.GroupBox(),
widget.WindowName(),
widget.Clock()
],
30,
),
x=0,
y=480,
width=500,
height=400
),
Screen(
top=bar.Bar(
[
widget.GroupBox(),
widget.WindowName(),
widget.Clock()
],
30,
),
x=500,
y=580,
width=400,
height=400
),
]
Third-party bars¶
There might be some reasons to use third-party bars. For instance you can come from another window manager and you have already configured dzen2, xmobar, or something else. They definitely can be used with Qtile too. In fact, any additional configurations aren’t needed. Just run the bar and qtile will adapt.
Reference¶
Screen¶
-
class
libqtile.config.
Screen
(top: Union[libqtile.bar.Bar, libqtile.bar.Gap, None] = None, bottom: Union[libqtile.bar.Bar, libqtile.bar.Gap, None] = None, left: Union[libqtile.bar.Bar, libqtile.bar.Gap, None] = None, right: Union[libqtile.bar.Bar, libqtile.bar.Gap, None] = None, wallpaper: Optional[str] = None, wallpaper_mode: Optional[str] = None, x: Optional[int] = None, y: Optional[int] = None, width: Optional[int] = None, height: Optional[int] = None)[source]¶ A physical screen, and its associated paraphernalia.
Define a screen with a given set of Bars of a specific geometry. Note that bar.Bar objects can only be placed at the top or the bottom of the screen (bar.Gap objects can be placed anywhere). Also,
x
,y
,width
, andheight
aren’t specified usually unless you are using ‘fake screens’.The
wallpaper
parameter, if given, should be a path to an image file. How this image is painted to the screen is specified by thewallpaper_mode
parameter. By default, the image will be placed at the screens origin and retain its own dimensions. If the mode is ‘fill’, the image will be centred on the screen and resized to fill it. If the mode is ‘stretch’, the image is stretched to fit all of it into the screen.
Bar¶
-
class
libqtile.bar.
Bar
(widgets, size, **config)[source]¶ A bar, which can contain widgets
Parameters: - widgets :
A list of widget objects.
- size :
The “thickness” of the bar, i.e. the height of a horizontal bar, or the width of a vertical bar.
key default description background
'#000000'
‘Background colour.’ margin
0
‘Space around bar as int or list of ints [N E S W].’ opacity
1
‘Bar window opacity.’
Gap¶
-
class
libqtile.bar.
Gap
(size)[source]¶ A gap placed along one of the edges of the screen
If a gap has been defined, Qtile will avoid covering it with windows. The most probable reason for configuring a gap is to make space for a third-party bar or other static window.
Parameters: - size :
The “thickness” of the gap, i.e. the height of a horizontal gap, or the width of a vertical gap.