dotfiles/_gui/_configs/qtile/config.py

208 lines
7.2 KiB
Python
Raw Normal View History

from common import *
2023-07-27 21:59:12 +02:00
os.environ["MOZ_ENABLE_WAYLAND"] = "1"
os.environ["MOZ_DBUS_REMOTE"] = "1"
2023-09-28 00:51:30 +02:00
os.environ["XDG_CURRENT_DESKTOP"] = "qtile:wlroots"
2023-07-27 21:59:12 +02:00
widget_defaults = dict(
background='#272822',
font='Roboto Mono Medium',
fontsize=14,
foreground='#feffff',
)
extension_defaults = widget_defaults.copy()
# see examples/custom.py for example custom file
custom_file=os.getenv('XDG_CONFIG_HOME') + '/qtile/custom.py'
if os.path.exists(custom_file):
from custom import groups, keys, screens, wl_input_rules
else:
terminal = guess_terminal()
keys = [
# app binds
Key([mod], "Return", lazy.spawn(terminal)),
Key([mod], "space", lazy.spawncmd()),
Key([mod], "e", lazy.spawn("selector-chars")),
Key([mod, "control"], "a", lazy.spawn("selector-audio")),
Key([mod, "control"], "b", lazy.spawn("selector-bluetooth")),
# media keys
Key([], "XF86AudioMute", lazy.spawn("pactl set-sink-mute @DEFAULT_SINK@ toggle")),
Key([], "XF86AudioMicMute", lazy.spawn("sb-volume micmute")),
Key([], "XF86AudioRaiseVolume", lazy.spawn("sb-volume inc")),
Key([], "XF86AudioLowerVolume", lazy.spawn("sb-volume dec")),
Key([], "XF86MonBrightnessUp", lazy.spawn("doas xbacklight -inc 10")),
Key([], "XF86MonBrightnessDown", lazy.spawn("doas xbacklight -dec 10")),
]
groups = [
Group("1", label="1"),
Group("2", label="2"),
Group("3", label="3"),
Group("4", label="4"),
Group("5", label="5"),
Group("6", label="6"),
Group("7", label="7"),
Group("8", label="8"),
Group("9", label="9"),
Group("0", label="10"),
]
screens = [
Screen(
top=bar.Bar(
[
widget.GroupBox(
active='#feffff',
disable_drag=True,
font="Font Awesome 6 Free",
highlight_color='#272822',
highlight_method='block',
mouse_callbacks={"Button1": lambda: None},
rounded=False,
this_current_screen_border='#005577',
urgent_alert_method='block',
urgent_border='#770000',
use_mouse_wheel=False,
),
widget.Prompt(
bell_style=None,
prompt='open: ',
record_history=False,
),
widget.Spacer(),
widget.Notify(
foreground='#000000',
background='#e8b923',
foreground_low='#c7c7c7',
background_low='#272822',
foreground_urgent='#feffff',
background_urgent='#770000',
),
widget.GenPollCommand(
foreground='#feffff',
background='#770000',
update_interval=1,
cmd="sb-volume",
),
widget.GenPollCommand(
foreground='#feffff',
background='#770000',
update_interval=1,
cmd="sb-wireguard",
),
widget.Wlan(
foreground='#feffff',
background='#770000',
format='',
disconnected_message="no wifi",
),
widget.GenPollCommand(
update_interval=1,
cmd="sb-battery",
),
widget.Clock(
format='[%d] %H:%M:%S',
),
widget.StatusNotifier(),
],
24,
margin=[5, 5, 0, 5]
),
wallpaper=os.getenv('XDG_CONFIG_HOME') + '/qtile/wallpaper.img',
wallpaper_mode='fill',
),
]
wl_input_rules = {}
2022-07-29 15:49:27 +02:00
@hook.subscribe.startup_once
def autostart():
2023-11-15 15:45:37 +01:00
# see examples/autostart.sh
autostart=os.getenv('XDG_CONFIG_HOME') + '/qtile/autostart.sh'
2023-10-15 13:47:14 +02:00
subprocess.run([autostart])
@hook.subscribe.shutdown
def autostop():
2023-11-15 15:45:37 +01:00
# see examples/autostop.sh
autostop=os.getenv('XDG_CONFIG_HOME') + '/qtile/autostop.sh'
2023-10-15 13:47:14 +02:00
subprocess.run([autostop])
keys.extend([
2022-07-29 15:49:27 +02:00
# 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
# WM control
Key([mod], "f", lazy.window.toggle_floating()),
2022-07-29 15:49:27 +02:00
Key([mod], "q", lazy.window.kill()),
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
2023-02-09 23:16:17 +01:00
for i in groups[:10]:
keys.extend([
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),
desc="move focused window to group {}".format(i.name)
),
])
2022-07-29 15:49:27 +02:00
if qtile.core.name == "wayland":
for i in range(1,2):
2023-10-20 23:42:00 +02:00
keys.extend([
Key(["control", "mod1"], f"f{i}", lazy.core.change_vt(i), desc=f"Switch to VT{i}")
])
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",
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]
),
]
floating_layout = layout.Floating(
float_rules=[
*layout.Floating.default_float_rules,
2023-07-27 21:59:12 +02:00
Match(title="File Upload"),
Match(title="Open File"),
Match(title="Open file"),
Match(title="Open Files"),
Match(title="Firefox — Sharing Indicator"),
Match(title="Enter name of file to save to…"),
Match(title="Save Image"),
2022-07-29 15:49:27 +02:00
],
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
)
2023-08-13 02:20:13 +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()),
]
2023-09-30 01:06:25 +02:00
focus_on_window_activation = "urgent"
2023-07-11 00:57:37 +02:00
wmname = "qtile"