327 lines
12 KiB
Python
327 lines
12 KiB
Python
# Copyright (c) 2010 Aldo Cortesi
|
|
# Copyright (c) 2010, 2014 dequis
|
|
# Copyright (c) 2012 Randall Ma
|
|
# Copyright (c) 2012-2014 Tycho Andersen
|
|
# Copyright (c) 2012 Craig Barnes
|
|
# Copyright (c) 2013 horsik
|
|
# Copyright (c) 2013 Tao Sauvage
|
|
#
|
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
# of this software and associated documentation files (the "Software"), to deal
|
|
# in the Software without restriction, including without limitation the rights
|
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
# copies of the Software, and to permit persons to whom the Software is
|
|
# furnished to do so, subject to the following conditions:
|
|
#
|
|
# The above copyright notice and this permission notice shall be included in
|
|
# all copies or substantial portions of the Software.
|
|
#
|
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
# SOFTWARE.
|
|
|
|
from libqtile import bar, hook, layout, qtile
|
|
from libqtile.config import Group, Key, Match, Screen
|
|
from libqtile.lazy import lazy
|
|
# Make sure 'qtile-extras' is installed or this config will not work.
|
|
from qtile_extras import widget
|
|
from qtile_extras.widget.decorations import BorderDecoration
|
|
from libqtile.backend.wayland import InputConfig
|
|
from keybindings import mod, keys, terminal
|
|
from mouse import mouse
|
|
import colors
|
|
import os
|
|
import subprocess
|
|
|
|
groups = []
|
|
group_names = ["1", "2", "3", "4", "5", "6", "7", "8", "9",]
|
|
group_labels = ["1", "2", "3", "4", "5", "6", "7", "8", "9",]
|
|
|
|
group_layouts = ["monadtall", "monadtall", "monadtall", "monadtall", "monadtall", "monadtall", "monadtall", "monadtall", "monadtall"]
|
|
|
|
for i in range(len(group_names)):
|
|
groups.append(
|
|
Group(
|
|
name=group_names[i],
|
|
layout=group_layouts[i].lower(),
|
|
label=group_labels[i],
|
|
))
|
|
|
|
|
|
for i in groups:
|
|
keys.extend(
|
|
[
|
|
# mod1 + letter of group = switch to group
|
|
Key(
|
|
[mod],
|
|
i.name,
|
|
lazy.group[i.name].toscreen(),
|
|
desc="Switch to group {}".format(i.name),
|
|
),
|
|
# mod1 + shift + letter of group = move focused window to group
|
|
Key(
|
|
[mod, "shift"],
|
|
i.name,
|
|
lazy.window.togroup(i.name, switch_group=False),
|
|
desc="Move focused window to group {}".format(i.name),
|
|
),
|
|
]
|
|
)
|
|
|
|
colors = colors.Macchiato
|
|
|
|
# Common settings for all layouts
|
|
layout_theme = {"border_width": 2,
|
|
"margin": 8,
|
|
"border_focus": colors[11],
|
|
"border_normal": colors[15]
|
|
}
|
|
|
|
layouts = [
|
|
layout.Columns(**layout_theme),
|
|
layout.Max(border_width = 0, margin = 0),
|
|
layout.Stack(**layout_theme, num_stacks=2),
|
|
# layout.Bsp(),
|
|
# layout.Matrix(),
|
|
layout.MonadTall(**layout_theme),
|
|
# layout.MonadWide(),
|
|
# layout.RatioTile(),
|
|
# layout.Tile(),
|
|
# layout.TreeTab(),
|
|
# layout.VerticalTile(),
|
|
layout.Zoomy(**layout_theme),
|
|
]
|
|
|
|
# Common settings for all widgets
|
|
widget_defaults = dict(
|
|
font="Noto Sans",
|
|
fontsize=14,
|
|
padding=0,
|
|
background=colors[22]
|
|
)
|
|
|
|
extension_defaults = widget_defaults.copy()
|
|
|
|
screens = [
|
|
Screen(
|
|
top=bar.Bar(
|
|
[
|
|
widget.Image(
|
|
filename="~/.config/qtile/icons/logo.png",
|
|
margin = 3,
|
|
mouse_callbacks={'Button1': lambda: qtile.cmd_spawn('nwg-drawer')}
|
|
),
|
|
widget.GroupBox(
|
|
fontsize = 14,
|
|
margin_y = 3,
|
|
margin_x = 4,
|
|
padding_y = 2,
|
|
padding_x = 3,
|
|
borderwidth = 3,
|
|
active = colors[13],
|
|
inactive = colors[13],
|
|
rounded = False,
|
|
highlight_color = colors[21],
|
|
highlight_method = "line",
|
|
urgent_border = colors[4],
|
|
urgent_text = colors[4],
|
|
this_current_screen_border = colors[10],
|
|
),
|
|
widget.Sep(
|
|
linewidth=1,
|
|
padding=10,
|
|
foreground=colors[13],
|
|
background=colors[22]
|
|
),
|
|
widget.CurrentLayoutIcon(
|
|
custom_icon_paths=[os.path.expanduser("~/.config/qtile/icons")],
|
|
foreground=colors[13],
|
|
background=colors[22],
|
|
padding=0,
|
|
scale=0.7
|
|
),
|
|
widget.CurrentLayout(
|
|
foreground = colors[13],
|
|
padding = 5
|
|
),
|
|
widget.Sep(
|
|
linewidth=1,
|
|
padding=10,
|
|
foreground=colors[13],
|
|
background=colors[22]
|
|
),
|
|
widget.Spacer(length = 8),
|
|
widget.Prompt(),
|
|
widget.WindowName(
|
|
foreground = colors[13],
|
|
max_chars = 40,
|
|
),
|
|
widget.Spacer(length = 8),
|
|
widget.StatusNotifier(
|
|
decorations=[
|
|
BorderDecoration(
|
|
colour = colors[5],
|
|
border_width = [0, 0, 2, 0],
|
|
)
|
|
],
|
|
),
|
|
widget.Spacer(length = 8),
|
|
widget.Mpris2(
|
|
playing_text = "",
|
|
stop_pause_text = "",
|
|
foreground = colors[6],
|
|
decorations=[
|
|
BorderDecoration(
|
|
colour = colors[6],
|
|
border_width = [0, 0, 2, 0],
|
|
)
|
|
],
|
|
),
|
|
widget.Spacer(length = 8),
|
|
widget.KeyboardLayout(
|
|
configured_keyboards = [
|
|
"us"
|
|
],
|
|
font = "Noto Sans",
|
|
fontsize = "14",
|
|
fmt = '⌨ {}',
|
|
foreground = colors[7],
|
|
decorations=[
|
|
BorderDecoration(
|
|
colour = colors[7],
|
|
border_width = [0, 0, 2, 0],
|
|
)
|
|
],
|
|
),
|
|
widget.Spacer(length = 8),
|
|
widget.CPU(
|
|
format = ' {load_percent:.1f}%',
|
|
foreground = colors[8],
|
|
decorations=[
|
|
BorderDecoration(
|
|
colour = colors[8],
|
|
border_width = [0, 0, 2, 0],
|
|
)
|
|
],
|
|
mouse_callbacks={'Button1': lambda: qtile.cmd_spawn(terminal + '-e btop')}
|
|
),
|
|
widget.Spacer(length = 8),
|
|
widget.Memory(
|
|
format = " {MemUsed:.1f}/{MemTotal:.1f} GiB",
|
|
measure_mem='G',
|
|
foreground = colors[9],
|
|
decorations=[
|
|
BorderDecoration(
|
|
colour = colors[9],
|
|
border_width = [0, 0, 2, 0],
|
|
)
|
|
],
|
|
mouse_callbacks={'Button1': lambda: qtile.cmd_spawn(terminal + '-e btop')}
|
|
),
|
|
widget.Spacer(length = 8),
|
|
widget.Net(
|
|
prefix="M",
|
|
format=' {down:.0f}{down_suffix} ↓↑ {up:.0f}{up_suffix}',
|
|
foreground = colors[10],
|
|
decorations=[
|
|
BorderDecoration(
|
|
colour = colors[10],
|
|
border_width = [0, 0, 2, 0],
|
|
)
|
|
],
|
|
mouse_callbacks={'Button1': lambda: qtile.cmd_spawn(terminal + '-e nmtui')}
|
|
),
|
|
widget.Spacer(length = 8),
|
|
widget.Volume(
|
|
foreground = colors[11],
|
|
fmt = '🔉 {}',
|
|
decorations=[
|
|
BorderDecoration(
|
|
colour = colors[11],
|
|
border_width = [0, 0, 2, 0],
|
|
)
|
|
],
|
|
mouse_callbacks={'Button3': lambda: qtile.cmd_spawn('pavucontrol')}
|
|
),
|
|
widget.Spacer(length = 8),
|
|
widget.Clock(
|
|
format="%d %b %H:%M",
|
|
foreground = colors[12],
|
|
decorations=[
|
|
BorderDecoration(
|
|
colour = colors[12],
|
|
border_width = [0, 0, 2, 0],
|
|
)
|
|
],
|
|
mouse_callbacks={'Button1': lambda: qtile.cmd_spawn(terminal + '-e calcurse')}
|
|
),
|
|
widget.Spacer(length = 8),
|
|
widget.Image(
|
|
filename = "/usr/share/icons/Papirus-Dark/symbolic/actions/system-shutdown-symbolic.svg",
|
|
margin = 6,
|
|
decorations=[
|
|
BorderDecoration(
|
|
colour = colors[13],
|
|
border_width = [0, 0, 2, 0],
|
|
)
|
|
],
|
|
mouse_callbacks={'Button1': lambda: qtile.cmd_spawn('nwg-bar')}
|
|
),
|
|
widget.Spacer(length = 8),
|
|
],
|
|
30,
|
|
),
|
|
),
|
|
]
|
|
|
|
dgroups_key_binder = None
|
|
dgroups_app_rules = [] # type: list
|
|
follow_mouse_focus = True
|
|
bring_front_click = False
|
|
floats_kept_above = True
|
|
cursor_warp = False
|
|
floating_layout = layout.Floating(
|
|
border_width=2,
|
|
border_focus=colors[11],
|
|
border_normal=colors[15],
|
|
float_rules=[
|
|
# Run the utility of `xprop` to see the wm class and name of an X client.
|
|
*layout.Floating.default_float_rules,
|
|
Match(wm_class="confirmreset"), # gitk
|
|
Match(wm_class="makebranch"), # gitk
|
|
Match(wm_class="maketag"), # gitk
|
|
Match(wm_class="ssh-askpass"), # ssh-askpass
|
|
Match(title="branchdialog"), # gitk
|
|
Match(title="pinentry"), # GPG key password entry
|
|
]
|
|
)
|
|
auto_fullscreen = True
|
|
focus_on_window_activation = "smart"
|
|
reconfigure_screens = True
|
|
|
|
# If things like steam games want to auto-minimize themselves when losing
|
|
# focus, should we respect this or not?
|
|
auto_minimize = True
|
|
|
|
# When using the Wayland backend, this can be used to configure input devices.
|
|
wl_input_rules = None
|
|
|
|
#@hook.subscribe.startup_once
|
|
#def start_once():
|
|
# home = os.path.expanduser('~')
|
|
# subprocess.call([home + '/.config/qtile/autostart.sh'])
|
|
|
|
|
|
# XXX: Gasp! We're lying here. In fact, nobody really uses or cares about this
|
|
# string besides java UI toolkits; you can see several discussions on the
|
|
# mailing lists, GitHub issues, and other WM documentation that suggest setting
|
|
# this string if your java app doesn't work correctly. We may as well just lie
|
|
# and say that we're a working one by default.
|
|
#
|
|
# We choose LG3D to maximize irony: it is a 3D non-reparenting WM written in
|
|
# java that happens to be on java's whitelist.
|
|
wmname = "LG3D"
|