Preparation to merge.

This commit is contained in:
Bartek Stalewski 2023-02-21 11:52:58 +01:00
parent d88cb48855
commit 9ddbe48503
9 changed files with 104 additions and 69 deletions

View file

@ -1,15 +1,16 @@
import os
import psutil
import subprocess
from libqtile import bar, extension, hook, layout, widget
from libqtile.lazy import lazy
from libqtile.config import Click, Drag, DropDown, Group, Key, Match, ScratchPad, Screen
from libqtile.dgroups import simple_key_binder
from libqtile.lazy import lazy
@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"])]),
@ -41,6 +42,7 @@ groups = [
]),
]
mod = "mod4"
keys = [
# switch between windows
Key([mod], "h", lazy.layout.left()),
@ -70,7 +72,7 @@ keys = [
Key([mod, "shift"], "Return", lazy.spawn("sh -c 'terminal_profile=work BROWSER=workfx st'")),
Key([mod, "control"], "a", lazy.spawn("dmenu-audio")),
Key([mod, "control"], "b", lazy.spawn("dmenu-bluetooth")),
Key([mod, "control"], "e", lazy.spawn("dmenu-chars")),
Key([mod, "control"], "e", lazy.spawn("dmenu-emoji")),
Key([mod, "control"], "d", lazy.spawn("dmenu-display")),
# WM control
Key([mod], "f", lazy.window.toggle_floating()),
@ -78,7 +80,6 @@ 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")),
@ -88,22 +89,8 @@ keys = [
Key([], "XF86MonBrightnessDown", lazy.spawn("xbacklight -dec 10")),
]
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)
),
]
)
dgroups_key_binder = simple_key_binder(mod)
dgroups_app_rules = [] # type: list
layouts = [
layout.Columns(
@ -117,10 +104,10 @@ layouts = [
]
widget_defaults = dict(
foreground='#c7c7c7',
background='#272822',
font="RobotoMono Nerd Font Medium",
fontsize=14,
foreground='#c7c7c7',
)
extension_defaults = widget_defaults.copy()
@ -141,7 +128,6 @@ screens = [
urgent_border='#770000',
),
widget.Prompt(
bell_style=None,
prompt='open: ',
record_history=False,
),
@ -193,7 +179,7 @@ screens = [
24,
margin=[5, 5, 0, 5]
),
wallpaper=os.environ['XDG_CONFIG_HOME'] + '/qtile/wallpaper.img',
wallpaper='~/.local/share/wallpaper.jpg',
wallpaper_mode='fill',
),
]
@ -209,14 +195,37 @@ floating_layout = layout.Floating(
*layout.Floating.default_float_rules,
Match(wm_class='Authenticator'),
],
border_focus='#005577',
border_focus='#feffff',
border_normal="#272822",
border_width=2,
)
auto_fullscreen = False
@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_minimize = True
bring_front_click = False
cursor_warp = False
focus_on_window_activation = "smart"
follow_mouse_focus = True
reconfigure_screens = True
wmname = "LG3D"