|
1 | 1 | #!/bin/bash |
| 2 | +ulimit -c 0 |
2 | 3 |
|
3 | | -# Disable compositing and screen lock |
| 4 | +# Disable compositing and screen locking |
4 | 5 | if [ ! -f $HOME/.config/kwinrc ]; then |
5 | | - kwriteconfig5 --file $HOME/.config/kwinrc --group Compositing --key Enabled false |
| 6 | + kwriteconfig6 --file $HOME/.config/kwinrc --group Compositing --key Enabled false |
6 | 7 | fi |
7 | 8 | if [ ! -f $HOME/.config/kscreenlockerrc ]; then |
8 | | - kwriteconfig5 --file $HOME/.config/kscreenlockerrc --group Daemon --key Autolock false |
| 9 | + kwriteconfig6 --file $HOME/.config/kscreenlockerrc --group Daemon --key Autolock false |
9 | 10 | fi |
10 | 11 |
|
11 | 12 | # Power related |
12 | 13 | setterm blank 0 |
13 | 14 | setterm powerdown 0 |
14 | 15 |
|
| 16 | +# Setup permissive clipboard rules |
| 17 | +KWIN_RULES_FILE="$HOME/.config/kwinrulesrc" |
| 18 | +RULE_DESC="wl-clipboard support" |
| 19 | +if ! grep -q "$RULE_DESC" "$KWIN_RULES_FILE" 2>/dev/null; then |
| 20 | + echo "Applying KWin clipboard rule..." |
| 21 | + if command -v uuidgen &> /dev/null; then |
| 22 | + RULE_ID=$(uuidgen) |
| 23 | + else |
| 24 | + RULE_ID=$(cat /proc/sys/kernel/random/uuid) |
| 25 | + fi |
| 26 | + count=$(kreadconfig6 --file "$KWIN_RULES_FILE" --group General --key count --default 0) |
| 27 | + new_count=$((count + 1)) |
| 28 | + kwriteconfig6 --file "$KWIN_RULES_FILE" --group General --key count "$new_count" |
| 29 | + existing_rules=$(kreadconfig6 --file "$KWIN_RULES_FILE" --group General --key rules) |
| 30 | + if [ -z "$existing_rules" ]; then |
| 31 | + kwriteconfig6 --file "$KWIN_RULES_FILE" --group General --key rules "$RULE_ID" |
| 32 | + else |
| 33 | + kwriteconfig6 --file "$KWIN_RULES_FILE" --group General --key rules "$existing_rules,$RULE_ID" |
| 34 | + fi |
| 35 | + kwriteconfig6 --file "$KWIN_RULES_FILE" --group "$RULE_ID" --key Description "$RULE_DESC" |
| 36 | + kwriteconfig6 --file "$KWIN_RULES_FILE" --group "$RULE_ID" --key wmclass "wl-(copy|paste)" |
| 37 | + kwriteconfig6 --file "$KWIN_RULES_FILE" --group "$RULE_ID" --key wmclassmatch 3 |
| 38 | + kwriteconfig6 --file "$KWIN_RULES_FILE" --group "$RULE_ID" --key skiptaskbar --type bool "true" |
| 39 | + kwriteconfig6 --file "$KWIN_RULES_FILE" --group "$RULE_ID" --key skiptaskbarrule 2 |
| 40 | + kwriteconfig6 --file "$KWIN_RULES_FILE" --group "$RULE_ID" --key skipswitcher --type bool "true" |
| 41 | + kwriteconfig6 --file "$KWIN_RULES_FILE" --group "$RULE_ID" --key skipswitcherrule 2 |
| 42 | + kwriteconfig6 --file "$KWIN_RULES_FILE" --group "$RULE_ID" --key fsplevel 3 |
| 43 | + kwriteconfig6 --file "$KWIN_RULES_FILE" --group "$RULE_ID" --key fsplevelrule 2 |
| 44 | + kwriteconfig6 --file "$KWIN_RULES_FILE" --group "$RULE_ID" --key noborder --type bool "true" |
| 45 | + kwriteconfig6 --file "$KWIN_RULES_FILE" --group "$RULE_ID" --key noborderrule 2 |
| 46 | +fi |
| 47 | + |
15 | 48 | # Directories |
16 | 49 | sudo rm -f /usr/share/dbus-1/system-services/org.freedesktop.UDisks2.service |
17 | 50 | mkdir -p "${HOME}/.config/autostart" "${HOME}/.XDG" "${HOME}/.local/share/" |
@@ -42,7 +75,29 @@ if [ ! -f "${STARTUP_FILE}" ]; then |
42 | 75 | chmod +x $STARTUP_FILE |
43 | 76 | fi |
44 | 77 |
|
45 | | -# Start DE |
46 | | -WAYLAND_DISPLAY=wayland-1 Xwayland :1 & |
47 | | -sleep 2 |
48 | | -exec dbus-launch --exit-with-session /usr/bin/startplasma-x11 > /dev/null 2>&1 |
| 78 | +# Setup application DB |
| 79 | +if [ ! -f "/etc/xdg/menus/applications.menu" ]; then |
| 80 | + sudo mv \ |
| 81 | + /etc/xdg/menus/plasma-applications.menu \ |
| 82 | + /etc/xdg/menus/applications.menu |
| 83 | +fi |
| 84 | +kbuildsycoca6 |
| 85 | + |
| 86 | +# Export variables globally so all children inherit them |
| 87 | +export QT_QPA_PLATFORM=wayland |
| 88 | +export XDG_CURRENT_DESKTOP=KDE |
| 89 | +export XDG_SESSION_TYPE=wayland |
| 90 | +export KDE_SESSION_VERSION=6 |
| 91 | +unset DISPLAY |
| 92 | +dbus-run-session bash -c ' |
| 93 | + WAYLAND_DISPLAY=wayland-1 kwin_wayland --no-lockscreen & |
| 94 | + KWIN_PID=$! |
| 95 | + sleep 2 |
| 96 | + if [ -f /usr/lib/libexec/polkit-kde-authentication-agent-1 ]; then |
| 97 | + /usr/lib/libexec/polkit-kde-authentication-agent-1 & |
| 98 | + elif [ -f /usr/libexec/polkit-kde-authentication-agent-1 ]; then |
| 99 | + /usr/libexec/polkit-kde-authentication-agent-1 |
| 100 | + fi |
| 101 | + WAYLAND_DISPLAY=wayland-0 plasmashell |
| 102 | + kill $KWIN_PID |
| 103 | +' > /dev/null 2>&1 |
0 commit comments