fix: add KWin dock force-hide workaround

This commit is contained in:
droid
2026-03-23 17:31:06 +08:00
parent f0ced79af7
commit 58cdc7a04f
7 changed files with 317 additions and 2 deletions

View File

@@ -64,6 +64,35 @@ print(json.dumps(sorted(items, key=lambda x: (x['containment'], x['applet']))))
PY
}
get_bottom_taskmanagers() {
python - <<'PY'
import configparser, json, os, pathlib, re
cfg = pathlib.Path(os.path.expanduser('~/.config/plasma-org.kde.plasma.desktop-appletsrc'))
cp = configparser.RawConfigParser(interpolation=None)
cp.optionxform = str
cp.read(cfg)
items = []
for sec in cp.sections():
m = re.fullmatch(r'Containments\]\[(\d+)', sec)
if not m:
continue
cid = int(m.group(1))
if cp.get(sec, 'plugin', fallback='') != 'org.kde.panel':
continue
if cp.get(sec, 'location', fallback='') not in ('4', 'bottom'):
continue
for asec in cp.sections():
am = re.fullmatch(rf'Containments\]\[{cid}\]\[Applets\]\[(\d+)', asec)
if not am:
continue
if cp.get(asec, 'plugin', fallback='') != 'org.kde.plasma.icontasks':
continue
aid = int(am.group(1))
items.append({'containment': cid, 'applet': aid})
print(json.dumps(sorted(items, key=lambda x: (x['containment'], x['applet']))))
PY
}
ensure_bottom_panels() {
local screen_count="$1"
local targets
@@ -108,6 +137,27 @@ for (var i = 0; i < targetScreens.length; ++i) {
"
}
apply_taskmanager_behavior() {
local json
json="$(get_bottom_taskmanagers)"
[[ -z "$json" || "$json" == "[]" ]] && return 0
python - <<'PY' "$json" "$CONFIG_FILE"
import json, subprocess, sys
pairs = json.loads(sys.argv[1])
config_file = sys.argv[2]
for item in pairs:
cid = item['containment']
aid = item['applet']
subprocess.call([
'kwriteconfig6', '--file', config_file,
'--group', 'Containments', '--group', str(cid),
'--group', 'Applets', '--group', str(aid),
'--group', 'Configuration', '--group', 'General',
'--key', 'unhideOnAttention', 'false'
], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
PY
}
apply_colorizer_preset() {
local json
json="$(get_bottom_colorizers)"
@@ -142,6 +192,7 @@ main() {
local screen_count
screen_count="$(get_screen_count)"
ensure_bottom_panels "$screen_count"
apply_taskmanager_behavior
apply_colorizer_preset
}