2022-10-18 17:13:21 +02:00
|
|
|
import os
|
2022-07-30 01:02:25 +02:00
|
|
|
import subprocess
|
2023-04-20 01:09:43 +02:00
|
|
|
from libqtile import bar, extension, hook, layout, widget
|
2023-02-21 11:52:58 +01:00
|
|
|
from libqtile.lazy import lazy
|
2023-02-09 23:16:17 +01:00
|
|
|
from libqtile.config import Click, Drag, DropDown, Group, Key, Match, ScratchPad, Screen
|
2022-07-29 15:49:27 +02:00
|
|
|
|
2022-10-18 17:13:21 +02:00
|
|
|
@hook.subscribe.startup_once
|
|
|
|
def autostart():
|
|
|
|
home = os.path.expanduser('~/.config/qtile/autostart.sh')
|
|
|
|
subprocess.Popen([home])
|
|
|
|
|
2023-02-09 23:16:17 +01:00
|
|
|
mod = "mod4"
|
2022-07-29 15:49:27 +02:00
|
|
|
groups = [
|
|
|
|
Group("1", label="\uf292"),
|
2023-04-20 01:09:43 +02:00
|
|
|
Group("2", label="\uf738", matches=[Match(wm_class=["firefox"])]),
|
|
|
|
Group("3", label="\uf70d", matches=[Match(wm_class=["Ferdium", "discord", "Signal"])]),
|
2022-07-29 15:49:27 +02:00
|
|
|
Group("4", label="\uf7aa", matches=[Match(wm_class=["mutt"])]),
|
|
|
|
Group("5", label="\uf120"),
|
|
|
|
Group("6", label="\uf120"),
|
2023-03-01 14:53:05 +01:00
|
|
|
Group("7", label="\uf09c", matches=[Match(wm_class=["1Password"])]),
|
2023-03-01 14:26:05 +01:00
|
|
|
Group("8", label="\uf198", matches=[Match(wm_class=["Slack"])]),
|
2022-07-29 15:49:27 +02:00
|
|
|
Group("9", label="\uf296"),
|
|
|
|
Group("0", label="\uf2bb", matches=[Match(wm_class=["workfx"])]),
|
|
|
|
]
|
|
|
|
|
|
|
|
keys = [
|
|
|
|
# switch between windows
|
|
|
|
Key([mod], "h", lazy.layout.left()),
|
|
|
|
Key([mod], "l", lazy.layout.right()),
|
|
|
|
Key([mod], "j", lazy.layout.down()),
|
|
|
|
Key([mod], "k", lazy.layout.up()),
|
2023-03-05 19:38:14 +01:00
|
|
|
Key([mod], "Left", lazy.layout.left()),
|
|
|
|
Key([mod], "Right", lazy.layout.right()),
|
|
|
|
Key([mod], "Down", lazy.layout.down()),
|
|
|
|
Key([mod], "Up", lazy.layout.up()),
|
2022-07-29 15:49:27 +02:00
|
|
|
# move windows
|
|
|
|
Key([mod, "control"], "h", lazy.layout.shuffle_left()),
|
|
|
|
Key([mod, "control"], "l", lazy.layout.shuffle_right()),
|
|
|
|
Key([mod, "control"], "j", lazy.layout.shuffle_down()),
|
|
|
|
Key([mod, "control"], "k", lazy.layout.shuffle_up()),
|
|
|
|
# resize windows
|
|
|
|
Key([mod, "shift"], "h", lazy.layout.grow_left()),
|
|
|
|
Key([mod, "shift"], "l", lazy.layout.grow_right()),
|
|
|
|
Key([mod, "shift"], "j", lazy.layout.grow_down()),
|
|
|
|
Key([mod, "shift"], "k", lazy.layout.grow_up()),
|
2022-08-05 23:07:59 +02:00
|
|
|
Key([mod, "shift", "control"], "0", lazy.layout.normalize()),
|
2022-07-29 15:49:27 +02:00
|
|
|
# app binds
|
2023-06-27 00:24:44 +02:00
|
|
|
Key([mod], "Return", lazy.spawn("sh -c 'BROWSER=firefox st'")),
|
2022-07-29 15:49:27 +02:00
|
|
|
Key([mod], "space", lazy.spawncmd()),
|
2022-10-14 16:18:58 +02:00
|
|
|
Key([mod], "a", lazy.spawn("authenticator")),
|
2023-03-15 16:17:36 +01:00
|
|
|
Key([mod], "e", lazy.spawn("selector-chars")),
|
2023-04-24 09:14:17 +02:00
|
|
|
Key([mod], "i", lazy.spawn("scrot -f -s 'scrot_%Y-%m-%d_%H-%M-%S_%s.png'")),
|
2023-07-02 14:50:48 +02:00
|
|
|
Key([mod], "m", lazy.spawn("sh -c 'pgrep -x neomutt > /dev/null || BROWSER=firefox st -n mutt -e neomutt'")),
|
2023-04-20 01:09:43 +02:00
|
|
|
Key([mod, "shift"], "i", lazy.spawn("scrot -f 'scrot_%Y-%m-%d_%H-%M-%S_%s.png'")),
|
2023-05-28 23:09:13 +02:00
|
|
|
Key([mod, "shift"], "Return", lazy.spawn("sh -c 'terminal_profile=work BROWSER=workfx st'")),
|
2023-02-22 16:19:33 +01:00
|
|
|
Key([mod, "control"], "a", lazy.spawn("selector-audio")),
|
|
|
|
Key([mod, "control"], "b", lazy.spawn("selector-bluetooth")),
|
2022-07-29 15:49:27 +02:00
|
|
|
# WM control
|
2022-11-18 17:17:32 +01:00
|
|
|
Key([mod], "f", lazy.window.toggle_floating()),
|
2022-07-29 15:49:27 +02:00
|
|
|
Key([mod], "q", lazy.window.kill()),
|
2022-10-12 17:21:51 +02:00
|
|
|
Key([mod, "control", "shift"], "l", lazy.spawn("physlock")),
|
2022-07-29 15:49:27 +02:00
|
|
|
Key([mod, "control", "shift"], "q", lazy.shutdown()),
|
|
|
|
Key([mod, "control", "shift"], "r", lazy.reload_config()),
|
2023-02-09 23:16:17 +01:00
|
|
|
Key([mod], "r", lazy.reload_config()),
|
2022-07-29 15:49:27 +02:00
|
|
|
# media keys
|
|
|
|
Key([], "XF86AudioMute", lazy.spawn("pactl set-sink-mute @DEFAULT_SINK@ toggle")),
|
2023-03-15 00:48:54 +01:00
|
|
|
Key([], "XF86AudioMicMute", lazy.spawn("sb-volume key")),
|
2022-09-26 19:59:29 +02:00
|
|
|
Key([], "XF86AudioRaiseVolume", lazy.spawn("sb-volume inc")),
|
|
|
|
Key([], "XF86AudioLowerVolume", lazy.spawn("sb-volume dec")),
|
2022-07-29 15:49:27 +02:00
|
|
|
Key([], "XF86MonBrightnessUp", lazy.spawn("xbacklight -inc 10")),
|
|
|
|
Key([], "XF86MonBrightnessDown", lazy.spawn("xbacklight -dec 10")),
|
|
|
|
]
|
|
|
|
|
2023-02-09 23:16:17 +01:00
|
|
|
for i in groups[:10]:
|
|
|
|
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),
|
|
|
|
),
|
|
|
|
# Key( [mod, "shift"], i.name, lazy.window.togroup(i.name, switch_group=True),
|
|
|
|
# desc="Switch to & move focused window to group {}".format(i.name),
|
|
|
|
# ),
|
|
|
|
Key([mod, "shift"], i.name, lazy.window.togroup(i.name),
|
|
|
|
desc="move focused window to group {}".format(i.name)
|
|
|
|
),
|
|
|
|
]
|
|
|
|
)
|
2022-07-29 15:49:27 +02:00
|
|
|
|
|
|
|
layouts = [
|
|
|
|
layout.Columns(
|
2023-01-27 17:21:48 +01:00
|
|
|
border_focus='#0094d8',
|
2023-01-27 17:04:59 +01:00
|
|
|
border_normal="#272822",
|
2022-09-18 12:57:25 +02:00
|
|
|
border_on_single = False,
|
2023-01-27 17:04:59 +01:00
|
|
|
border_width=5,
|
2022-07-29 15:49:27 +02:00
|
|
|
insert_position=1,
|
|
|
|
margin=[5, 5, 5, 5]
|
|
|
|
),
|
|
|
|
]
|
|
|
|
|
|
|
|
widget_defaults = dict(
|
2023-04-05 01:29:37 +02:00
|
|
|
background='#272822',
|
2022-11-04 02:46:17 +01:00
|
|
|
font="RobotoMono Nerd Font Medium",
|
2023-03-01 15:38:06 +01:00
|
|
|
fontsize=14,
|
2023-03-09 00:09:32 +01:00
|
|
|
foreground='#feffff',
|
2022-07-29 15:49:27 +02:00
|
|
|
)
|
|
|
|
extension_defaults = widget_defaults.copy()
|
|
|
|
|
2022-11-07 13:49:33 +01:00
|
|
|
def yubikey_replace(text):
|
2023-01-30 11:55:21 +01:00
|
|
|
return text.replace('YubiKey is waiting for a touch', 'Touch the Yubikey')
|
2022-11-07 13:49:33 +01:00
|
|
|
|
2022-07-29 15:49:27 +02:00
|
|
|
screens = [
|
|
|
|
Screen(
|
|
|
|
top=bar.Bar(
|
|
|
|
[
|
|
|
|
widget.GroupBox(
|
2023-02-09 01:42:43 +01:00
|
|
|
active='#feffff',
|
2022-07-29 15:49:27 +02:00
|
|
|
disable_drag=True,
|
2023-03-05 19:30:29 +01:00
|
|
|
fontsize=18,
|
2022-11-06 00:01:52 +01:00
|
|
|
highlight_method='block',
|
2022-07-29 15:49:27 +02:00
|
|
|
rounded=False,
|
2023-02-09 01:36:36 +01:00
|
|
|
this_current_screen_border='#005577',
|
2022-10-30 13:53:34 +01:00
|
|
|
urgent_alert_method='block',
|
2022-11-06 00:01:52 +01:00
|
|
|
urgent_border='#770000',
|
2022-07-29 15:49:27 +02:00
|
|
|
),
|
|
|
|
widget.Prompt(
|
2023-02-09 23:16:17 +01:00
|
|
|
bell_style=None,
|
2022-07-29 15:49:27 +02:00
|
|
|
prompt='open: ',
|
|
|
|
record_history=False,
|
|
|
|
),
|
|
|
|
widget.Spacer(),
|
2022-11-07 00:05:36 +01:00
|
|
|
widget.Notify(
|
2022-11-04 02:46:17 +01:00
|
|
|
background='#e8b923',
|
2023-01-31 22:14:25 +01:00
|
|
|
background_low='#272822',
|
2022-11-07 00:57:41 +01:00
|
|
|
background_urgent='#770000',
|
2022-11-04 02:46:17 +01:00
|
|
|
foreground='#000000',
|
2023-02-09 01:42:43 +01:00
|
|
|
foreground_low='#c7c7c7',
|
|
|
|
foreground_urgent='#feffff',
|
2022-11-04 02:46:17 +01:00
|
|
|
font='RobotoMono Nerd Font Bold',
|
2022-11-07 13:49:33 +01:00
|
|
|
parse_text=yubikey_replace,
|
2022-11-06 16:27:52 +01:00
|
|
|
),
|
2022-11-06 16:00:39 +01:00
|
|
|
widget.GenPollCommand(
|
2023-02-09 01:36:36 +01:00
|
|
|
background='#005577',
|
2023-02-09 01:42:43 +01:00
|
|
|
foreground='#feffff',
|
2022-08-23 00:19:44 +02:00
|
|
|
update_interval=1,
|
2022-11-06 16:00:39 +01:00
|
|
|
cmd="sb-mail",
|
2022-07-29 15:49:27 +02:00
|
|
|
),
|
2022-11-06 16:00:39 +01:00
|
|
|
widget.GenPollCommand(
|
2022-11-06 00:01:52 +01:00
|
|
|
background='#770000',
|
2023-02-09 01:42:43 +01:00
|
|
|
foreground='#feffff',
|
2022-11-03 17:31:27 +01:00
|
|
|
update_interval=1,
|
2022-11-06 16:00:39 +01:00
|
|
|
cmd="sb-volume",
|
2022-11-03 17:31:27 +01:00
|
|
|
),
|
2023-02-09 01:23:49 +01:00
|
|
|
widget.GenPollCommand(
|
|
|
|
background='#770000',
|
2023-02-09 01:42:43 +01:00
|
|
|
foreground='#feffff',
|
2023-02-09 01:23:49 +01:00
|
|
|
update_interval=1,
|
|
|
|
cmd="sb-network",
|
2022-12-17 00:47:11 +01:00
|
|
|
),
|
2023-04-13 23:52:59 +02:00
|
|
|
widget.GenPollCommand(
|
2022-08-23 00:19:44 +02:00
|
|
|
update_interval=1,
|
2023-04-13 23:52:59 +02:00
|
|
|
cmd="sb-battery",
|
2022-07-29 15:49:27 +02:00
|
|
|
),
|
|
|
|
widget.Clock(
|
2022-11-07 13:49:33 +01:00
|
|
|
format='[%d] %H:%M:%S',
|
2022-07-29 15:49:27 +02:00
|
|
|
),
|
2023-04-20 01:09:43 +02:00
|
|
|
widget.Systray(),
|
2022-07-29 15:49:27 +02:00
|
|
|
],
|
|
|
|
24,
|
2022-11-06 13:32:50 +01:00
|
|
|
margin=[5, 5, 0, 5]
|
2022-07-29 15:49:27 +02:00
|
|
|
),
|
2023-02-09 23:16:17 +01:00
|
|
|
wallpaper=os.environ['XDG_CONFIG_HOME'] + '/qtile/wallpaper.img',
|
2022-11-08 17:43:49 +01:00
|
|
|
wallpaper_mode='fill',
|
2022-07-29 15:49:27 +02:00
|
|
|
),
|
|
|
|
]
|
|
|
|
|
|
|
|
mouse = [
|
|
|
|
Drag([mod], "Button1", lazy.window.set_position_floating(), start=lazy.window.get_position()),
|
|
|
|
Drag([mod], "Button3", lazy.window.set_size_floating(), start=lazy.window.get_size()),
|
|
|
|
Click([mod], "Button2", lazy.window.bring_to_front()),
|
|
|
|
]
|
|
|
|
|
|
|
|
floating_layout = layout.Floating(
|
|
|
|
float_rules=[
|
|
|
|
*layout.Floating.default_float_rules,
|
|
|
|
],
|
2023-02-09 23:16:17 +01:00
|
|
|
border_focus='#005577',
|
2022-07-29 15:49:27 +02:00
|
|
|
border_normal="#272822",
|
2023-02-09 23:16:17 +01:00
|
|
|
border_width=5,
|
2022-07-29 15:49:27 +02:00
|
|
|
)
|