This approach to swallowing works.

This commit is contained in:
Bartek Stalewski 2022-08-01 01:21:30 +02:00
parent 8230063ad2
commit 6c4240ad22
2 changed files with 22 additions and 19 deletions

View File

@ -1,3 +1,3 @@
#!/bin/sh
mkdir -p $XDG_CONFIG_HOME/firefox
[ -n "$1" ] && HOME=$XDG_CONFIG_HOME/firefox /usr/bin/firefox "$*" || HOME=$XDG_CONFIG_HOME/firefox /usr/bin/firefox
[ -n "$1" ] && HOME=$XDG_CONFIG_HOME/firefox /usr/bin/firefox "$*" || HOME=$XDG_CONFIG_HOME/firefox /usr/bin/firefox &

View File

@ -1,3 +1,4 @@
import psutil
import subprocess
from libqtile import bar, extension, hook, layout, widget
from libqtile.config import Click, Drag, DropDown, Group, Key, Match, ScratchPad, Screen
@ -166,25 +167,27 @@ floating_layout = layout.Floating(
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])
# parent.minimized = True
# window.parent = parent
# return
# ppid = psutil.Process(ppid).ppid()
@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
@hook.subscribe.client_killed
def _unswallow(window):
if hasattr(window, 'parent'):
window.parent.minimized = False
auto_fullscreen = True
auto_minimize = True