NeoJolt

KWIN Scripts

Oct 1st, 2026
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.47 KB | Gaming | 0 0
  1. // disable_effects.sh
  2. #!/usr/bin/env bash
  3.  
  4. # 1. Changes resolution to 1920x1080@60 and scale to 75% and minimizes all windows.
  5. kscreen-doctor output.HDMI-A-1.mode.1920x1080@60 output.HDMI-A-1.scale.0.75
  6. for window_id in $(kdotool search ".*"); do
  7.     kdotool windowminimize "$window_id"
  8. done
  9.  
  10. # This fixes 'missing library' problem because the host uses its own libs.
  11. if [ -f /.flatpak-info ]; then
  12.     HOST_CMD="flatpak-spawn --host"
  13. else
  14.     HOST_CMD=""
  15. fi
  16.  
  17. # Configuration
  18. CONFIG_FILE="$HOME/.config/kwinrulesrc"
  19. TARGET_CLASS="steam"
  20. TARGET_NAME="Steam"
  21. WAIT_TIME=5
  22.  
  23. # 2. Update Opacity Rules
  24.  
  25. if $HOST_CMD test -f "$CONFIG_FILE"; then
  26.     $HOST_CMD sed -i 's/^\s*opacityactive=.*/opacityactive=100/' "$CONFIG_FILE"
  27.     $HOST_CMD sed -i 's/^\s*opacityinactive=.*/opacityinactive=100/' "$CONFIG_FILE"
  28. fi
  29.  
  30.  
  31. # 3. Wait for Stabilization
  32. sleep $WAIT_TIME
  33.  
  34. # 4. Close Steam window
  35.  
  36. window_uuid=$($HOST_CMD kdotool search --class "$TARGET_CLASS" 2>/dev/null | head -n 1)
  37.  
  38. if [ -n "$window_uuid" ]; then
  39.     $HOST_CMD kdotool windowclose "$window_uuid"
  40. else
  41.     # Fallback on Name
  42.     window_uuid=$($HOST_CMD kdotool search --name "$TARGET_NAME" 2>/dev/null | head -n 1)
  43.     if [ -n "$window_uuid" ]; then
  44.         $HOST_CMD kdotool windowclose "$window_uuid"
  45.     fi
  46. fi
  47.  
  48. # 5. Reconfigures KWin to apply kwinrulesrc changes
  49. $HOST_CMD qdbus6 org.kde.KWin /KWin reconfigure
  50.  
  51.  
  52. # 6. Unloads the Blur Effect
  53. $HOST_CMD qdbus6 org.kde.KWin /Effects org.kde.kwin.Effects.unloadEffect glass
  54.  
  55. exit 0
  56.  
  57. // enable_effects.sh
  58. #!/usr/bin/env bash
  59.  
  60.  
  61. # 1. Changes resolution to 3840x2160@60 and scale to 125% and restarts PlasmaShell for it to function correctly.
  62. kscreen-doctor output.HDMI-A-1.mode.3840x2160@60 output.HDMI-A-1.scale.1.25 &
  63. systemctl --user restart plasma-plasmashell.service
  64.  
  65. # This fixes 'missing library' problem because the host uses its own libs.
  66. if [ -f /.flatpak-info ]; then
  67.     HOST_CMD="flatpak-spawn --host"
  68. else
  69.     HOST_CMD=""
  70. fi
  71.  
  72. # 2. Update Opacity Rules (Only works if keys already exist in a rule block)
  73. # Ensure you have a rule block in kwinrulesrc containing these keys
  74. FILE=~/.config/kwinrulesrc
  75. sed -i 's/^\s*opacityactive=.*/opacityactive=75/' "$FILE"
  76. sed -i 's/^\s*opacityinactive=.*/opacityinactive=75/' "$FILE"
  77.  
  78. # 3. Reconfigures KWin to apply kwinrulesrc changes
  79. $HOST_CMD qdbus6 org.kde.KWin /KWin reconfigure
  80.  
  81. # 4. Loads the Blur Effect
  82. $HOST_CMD qdbus6 org.kde.KWin /Effects org.kde.kwin.Effects.loadEffect glass
  83.  
  84. exit
  85.  
Advertisement
Add Comment
Please, Sign In to add comment