-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtoggle_karousel.sh
More file actions
executable file
·37 lines (32 loc) · 1.06 KB
/
Copy pathtoggle_karousel.sh
File metadata and controls
executable file
·37 lines (32 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
# Detect if we are on Plasma 6 or 5
if command -v qdbus6 >/dev/null 2>&1; then
DBUS="qdbus6"
READ="kreadconfig6"
WRITE="kwriteconfig6"
else
DBUS="qdbus"
READ="kreadconfig5"
WRITE="kwriteconfig5"
fi
# 1. Get current status
STATUS=$($READ --file kwinrc --group Plugins --key karouselEnabled)
if [ "$STATUS" == "true" ]; then
# DISABLE MODE
$WRITE --file kwinrc --group Plugins --key karouselEnabled false
# Explicitly kill the script in KWin's memory
$DBUS org.kde.KWin /Scripting unloadScript karousel
notify-send "Karousel: DISABLED" -i dialog-error
else
# ENABLE MODE
$WRITE --file kwinrc --group Plugins --key karouselEnabled true
notify-send "Karousel: ENABLED" -i dialog-ok
fi
# 2. Force KWin to reload everything (This is the "Smarter" part)
$DBUS org.kde.KWin /KWin reconfigure
$DBUS org.kde.KWin /Scripting start
# 3. Clean up windows (Optional: forces windows to realize tiling is gone)
if [ "$STATUS" == "true" ]; then
# This triggers a refresh of the layout
$DBUS org.kde.KWin /KWin reconfigure
fi