Switch to wayland.

This commit is contained in:
Bartek Stalewski 2023-02-09 23:16:17 +01:00
parent 9ddbe48503
commit 6257330dcc
11 changed files with 99 additions and 125 deletions

View file

@ -1,20 +1,27 @@
import os
import psutil
import subprocess
from libqtile import bar, extension, hook, layout, widget
from libqtile.config import Click, Drag, DropDown, Group, Key, Match, ScratchPad, Screen
from libqtile.dgroups import simple_key_binder
from libqtile import bar, extension, hook, layout
from libqtile.lazy import lazy
from libqtile.config import Click, Drag, DropDown, Group, Key, Match, ScratchPad, Screen
from libqtile.backend.wayland import InputConfig
from qtile_extras import widget
wl_input_rules = {
"type:pointer": InputConfig(natural_scroll=True),
"type:touchpad": InputConfig(tap=True,natural_scroll=True),
"type:keyboard": InputConfig(kb_layout="pl",kb_repeat_delay=280,kb_repeat_rate=30),
}
@hook.subscribe.startup_once
def autostart():
home = os.path.expanduser('~/.config/qtile/autostart.sh')
subprocess.Popen([home])
mod = "mod4"
groups = [
Group("1", label="\uf292"),
Group("2", label="\uf738", matches=[Match(wm_class=["firefox"])]),
Group("3", label="\uf70d", matches=[Match(wm_class=["Ferdium", "discord", "Signal"])]),
Group("2", label="\uf738"),
Group("3", label="\uf70d", matches=[Match(wm_class=["ferdium", "discord", "Signal"])]),
Group("4", label="\uf7aa", matches=[Match(wm_class=["mutt"])]),
Group("5", label="\uf120"),
Group("6", label="\uf120"),
@ -32,7 +39,7 @@ groups = [
y=0.25,
),
DropDown(
"spwork", "sh -c 'terminal_profile=work BROWSER=workfx st'",
"spwork", "sh -c 'terminal_profile=work foot -o url.launch=workfx\ \${url}'",
on_focus_lost_hide=False,
width=0.40,
height=0.50,
@ -42,7 +49,6 @@ groups = [
]),
]
mod = "mod4"
keys = [
# switch between windows
Key([mod], "h", lazy.layout.left()),
@ -61,25 +67,25 @@ keys = [
Key([mod, "shift"], "k", lazy.layout.grow_up()),
Key([mod, "shift", "control"], "0", lazy.layout.normalize()),
# app binds
Key([mod], "Return", lazy.spawn("sh -c 'BROWSER=firefox st'")),
Key([mod], "Return", lazy.spawn("foot")),
Key([mod], "space", lazy.spawncmd()),
Key([mod], "a", lazy.spawn("authenticator")),
Key([mod], "e", lazy.group["scratchpad"].dropdown_toggle('spterm')),
Key([mod], "i", lazy.spawn("scrot -f -s 'scrot_%Y-%m-%d_%H-%M-%S_%s.png'")),
Key([mod], "m", lazy.spawn("sh -c 'pgrep -x neomutt > /dev/null || BROWSER=firefox st -n mutt -e neomutt'")),
Key([mod], "i", lazy.spawn("sh -c 'grim -g \"$(slurp)\"'")),
Key([mod], "m", lazy.spawn("sh -c 'pgrep -x neomutt > /dev/null || foot -a mutt -o bold-text-in-bright=yes neomutt'")),
Key([mod, "shift"], "e", lazy.group["scratchpad"].dropdown_toggle('spwork')),
Key([mod, "shift"], "i", lazy.spawn("scrot -f 'scrot_%Y-%m-%d_%H-%M-%S_%s.png'")),
Key([mod, "shift"], "Return", lazy.spawn("sh -c 'terminal_profile=work BROWSER=workfx st'")),
Key([mod, "shift"], "i", lazy.spawn("grim")),
Key([mod, "shift"], "Return", lazy.spawn("sh -c 'terminal_profile=work foot -o url.launch=workfx\ \${url}'")),
Key([mod, "control"], "a", lazy.spawn("dmenu-audio")),
Key([mod, "control"], "b", lazy.spawn("dmenu-bluetooth")),
Key([mod, "control"], "e", lazy.spawn("dmenu-emoji")),
Key([mod, "control"], "d", lazy.spawn("dmenu-display")),
Key([mod, "control"], "e", lazy.spawn("dmenu-chars")),
# WM control
Key([mod], "f", lazy.window.toggle_floating()),
Key([mod], "q", lazy.window.kill()),
Key([mod, "control", "shift"], "l", lazy.spawn("physlock")),
Key([mod, "control", "shift"], "q", lazy.shutdown()),
Key([mod, "control", "shift"], "r", lazy.reload_config()),
Key([mod], "r", lazy.reload_config()),
# media keys
Key([], "XF86AudioMute", lazy.spawn("pactl set-sink-mute @DEFAULT_SINK@ toggle")),
Key([], "XF86AudioMicMute", lazy.spawn("key-micmute")),
@ -89,8 +95,22 @@ keys = [
Key([], "XF86MonBrightnessDown", lazy.spawn("xbacklight -dec 10")),
]
dgroups_key_binder = simple_key_binder(mod)
dgroups_app_rules = [] # type: list
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)
),
]
)
layouts = [
layout.Columns(
@ -104,10 +124,10 @@ layouts = [
]
widget_defaults = dict(
foreground='#c7c7c7',
background='#272822',
font="RobotoMono Nerd Font Medium",
fontsize=14,
foreground='#c7c7c7',
)
extension_defaults = widget_defaults.copy()
@ -128,6 +148,7 @@ screens = [
urgent_border='#770000',
),
widget.Prompt(
bell_style=None,
prompt='open: ',
record_history=False,
),
@ -174,12 +195,14 @@ screens = [
widget.Clock(
format='[%d] %H:%M:%S',
),
widget.Systray(),
widget.StatusNotifier(
icon_size=18,
),
],
24,
margin=[5, 5, 0, 5]
),
wallpaper='~/.local/share/wallpaper.jpg',
wallpaper=os.environ['XDG_CONFIG_HOME'] + '/qtile/wallpaper.img',
wallpaper_mode='fill',
),
]
@ -193,39 +216,19 @@ mouse = [
floating_layout = layout.Floating(
float_rules=[
*layout.Floating.default_float_rules,
Match(wm_class='Authenticator'),
Match(wm_class='authenticator'),
Match(title="Open File"),
Match(title="Open file"),
Match(title="Open Files"),
Match(title="Firefox — Sharing Indicator"),
],
border_focus='#feffff',
border_focus='#005577',
border_normal="#272822",
border_width=2,
border_width=5,
)
@hook.subscribe.client_new
def _swallow(window):
pid = window.window.get_net_wm_pid()
ppid = psutil.Process(pid).ppid()
cpids = {c.window.get_net_wm_pid(): wid for wid, c in window.qtile.windows_map.items()}
for i in range(5):
if not ppid:
return
if ppid in cpids:
parent = window.qtile.windows_map.get(cpids[ppid])
if parent.window.get_wm_class()[0] != "xterm-256color":
return
parent.minimized = True
window.parent = parent
return
ppid = psutil.Process(ppid).ppid()
@hook.subscribe.client_killed
def _unswallow(window):
if hasattr(window, 'parent'):
window.parent.minimized = False
auto_fullscreen = True
auto_fullscreen = False
auto_minimize = True
bring_front_click = False
cursor_warp = False
focus_on_window_activation = "smart"
focus_on_window_activation = 'smart'
follow_mouse_focus = True
reconfigure_screens = True