Tweaks to qtile config.

This commit is contained in:
Bartek Stalewski 2023-02-11 02:35:08 +01:00
parent d7e521fb88
commit c88e516616

View File

@ -1,16 +1,15 @@
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.lazy import lazy
from libqtile.config import Click, Drag, DropDown, Group, Key, Match, ScratchPad, Screen
@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"])]),
@ -42,7 +41,6 @@ groups = [
]),
]
mod = "mod4"
keys = [
# switch between windows
Key([mod], "h", lazy.layout.left()),
@ -80,6 +78,7 @@ keys = [
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 +88,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 +117,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 +141,7 @@ screens = [
urgent_border='#770000',
),
widget.Prompt(
bell_style=None,
prompt='open: ',
record_history=False,
),
@ -195,37 +209,13 @@ floating_layout = layout.Floating(
*layout.Floating.default_float_rules,
Match(wm_class='Authenticator'),
],
border_focus='#feffff',
border_focus='#f005577',
border_normal="#272822",
border_width=2,
)
@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"
follow_mouse_focus = True
reconfigure_screens = True