mirror of
https://github.com/GRFreire/dotfiles.git
synced 2026-01-10 20:39:39 +00:00
wm should handle window swallowing
This commit is contained in:
parent
a0d0a1cc50
commit
7c6f0b614e
@ -8,6 +8,7 @@
|
|||||||
import time
|
import time
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import psutil
|
||||||
from typing import List # noqa: F401
|
from typing import List # noqa: F401
|
||||||
|
|
||||||
from libqtile import bar, layout, widget, qtile, hook
|
from libqtile import bar, layout, widget, qtile, hook
|
||||||
@ -379,6 +380,26 @@ def autostart():
|
|||||||
subprocess.call([autostart_script])
|
subprocess.call([autostart_script])
|
||||||
|
|
||||||
|
|
||||||
|
@hook.subscribe.client_new
|
||||||
|
def swallow(window):
|
||||||
|
pid = window.window.get_net_wm_pid() # Window PID
|
||||||
|
ppid = psutil.Process(pid).ppid() # Parent Window PID
|
||||||
|
cpids = {c.window.get_net_wm_pid(): wid for wid, c in window.qtile.windows_map.items()} # All Windows PIDs
|
||||||
|
for _ in range(len(cpids)):
|
||||||
|
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_killed
|
||||||
|
def unswallow(window):
|
||||||
|
if hasattr(window, 'parent'):
|
||||||
|
window.parent.minimized = False
|
||||||
|
|
||||||
@hook.subscribe.client_new
|
@hook.subscribe.client_new
|
||||||
def try_regroup_window(client):
|
def try_regroup_window(client):
|
||||||
time.sleep(0.01)
|
time.sleep(0.01)
|
||||||
|
|||||||
@ -1,2 +0,0 @@
|
|||||||
mime ^video|^audio, has mpv, X, flag f = devour mpv -- "$@"
|
|
||||||
mime ^image, has sxiv,X, flag f = devour sxiv -- "$@"
|
|
||||||
4
.zshrc
4
.zshrc
@ -52,10 +52,6 @@ alias ls="exa --color=always --group-directories-first"
|
|||||||
# Alias to nvim instead of vim
|
# Alias to nvim instead of vim
|
||||||
alias vim="nvim"
|
alias vim="nvim"
|
||||||
|
|
||||||
# Window swallowing with devour
|
|
||||||
alias mpv="devour mpv"
|
|
||||||
alias sxiv="devour sxiv"
|
|
||||||
|
|
||||||
export EDITOR=nvim
|
export EDITOR=nvim
|
||||||
|
|
||||||
# This loads nvm
|
# This loads nvm
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user