Add treatAllMatchedAsFocused property, update handlerGroups
This commit is contained in:
parent
49b613f480
commit
5f6f929eb0
|
@ -1,7 +1,13 @@
|
|||
handlerGroups = { # The first group that takes control of a process has priority
|
||||
"firefox": {
|
||||
"idents": ["binSimple:firefox","binSimple:firefox-esr","binSimple:palemoon"],
|
||||
"unhookUnmatchedChildren": True,
|
||||
"browser": {
|
||||
"idents": [
|
||||
"binSimple:firefox",
|
||||
"binSimple:firefox-esr",
|
||||
"binSimple:palemoon",
|
||||
"binSimple:python*;cmdlineSimple:*gawk.py",
|
||||
"binSimple:WebKitWebProcess"
|
||||
],
|
||||
"treatAllMatchedAsFocused": True,
|
||||
"propsFocused": {
|
||||
"memory.high": "256M"
|
||||
},
|
||||
|
@ -9,6 +15,72 @@ handlerGroups = { # The first group that takes control of a process has priority
|
|||
"memory.high": "256M",
|
||||
"cpu.weight": "1"
|
||||
}
|
||||
},
|
||||
"telegram": {
|
||||
"idents": ["binSimple:telegram-desktop"],
|
||||
"propsFocused": {
|
||||
"memory.high": "64M"
|
||||
},
|
||||
"propsUnfocused": {
|
||||
"memory.high": "64M",
|
||||
"cpu.weight": "10"
|
||||
}
|
||||
},
|
||||
"chocolate-doom": {
|
||||
"idents": ["binSimple:chocolate-doom"],
|
||||
"propsFocused": {
|
||||
},
|
||||
"propsUnfocused": {
|
||||
"cpu.weight": "10"
|
||||
}
|
||||
},
|
||||
"firealpaca": {
|
||||
"idents": ["binSimple:wine"],
|
||||
"propsFocused": {
|
||||
"memory.high": "256M"
|
||||
},
|
||||
"propsUnfocused": {
|
||||
"memory.high": "256M",
|
||||
"cpu.weight": "1"
|
||||
}
|
||||
},
|
||||
"vlc": {
|
||||
"idents": ["binSimple:vlc"],
|
||||
"propsFocused": {
|
||||
},
|
||||
"propsUnfocused": {
|
||||
"cpu.weight": "25"
|
||||
}
|
||||
},
|
||||
"low-priority": {
|
||||
"idents": [
|
||||
"binSimple:python*;cmdlineSimple:*zram-collector",
|
||||
"binSimple:python*;cmdlineSimple:*window-cg",
|
||||
],
|
||||
"propsFocused": {
|
||||
"cpu.weight": "1"
|
||||
},
|
||||
"propsUnfocused": {
|
||||
"cpu.weight": "1"
|
||||
}
|
||||
},
|
||||
"high-priority": {
|
||||
"idents": ["binSimple:Xorg","binSimple:pulseaudio"],
|
||||
"propsFocused": {
|
||||
"cpu.weight": "1000"
|
||||
},
|
||||
"propsUnfocused": {
|
||||
"cpu.weight": "1000"
|
||||
}
|
||||
},
|
||||
"all": {
|
||||
"idents": ["binSimple:*"],
|
||||
"propsFocused": {
|
||||
"cpu.weight": "100"
|
||||
},
|
||||
"propsUnfocused": {
|
||||
"cpu.weight": "10"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,6 +127,9 @@ def windowChanged(window):
|
|||
procs = _g.proc.getList()
|
||||
focusedGroup = None
|
||||
|
||||
if pid in procs:
|
||||
print("Process: " +str(procs[pid]))
|
||||
|
||||
for group in handlerGroups:
|
||||
try:
|
||||
if doesProcMatch(procs[pid],handlerGroups[group]):
|
||||
|
@ -90,7 +165,10 @@ def windowChanged(window):
|
|||
del procs[proc]
|
||||
|
||||
if focusedGroup == group:
|
||||
_g.cgroup.setGroup(pproc["pid"],"window-cg/" + group + ".focused")
|
||||
if handlerGroups[group].get("treatAllMatchedAsFocused",False):
|
||||
_g.cgroup.setGroup(pproc["pid"],"window-cg/" + group + ".focused")
|
||||
elif pproc["pid"] == pid:
|
||||
_g.cgroup.setGroup(pproc["pid"],"window-cg/" + group + ".focused")
|
||||
else:
|
||||
_g.cgroup.setGroup(pproc["pid"],"window-cg/" + group + ".unfocused")
|
||||
except Exception:
|
||||
|
|
Loading…
Reference in New Issue