Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // disable_effects.sh
- #!/usr/bin/env bash
- # 1. Changes resolution to 1920x1080@60 and scale to 75% and minimizes all windows.
- kscreen-doctor output.HDMI-A-1.mode.1920x1080@60 output.HDMI-A-1.scale.0.75
- for window_id in $(kdotool search ".*"); do
- kdotool windowminimize "$window_id"
- done
- # This fixes 'missing library' problem because the host uses its own libs.
- if [ -f /.flatpak-info ]; then
- HOST_CMD="flatpak-spawn --host"
- else
- HOST_CMD=""
- fi
- # Configuration
- CONFIG_FILE="$HOME/.config/kwinrulesrc"
- TARGET_CLASS="steam"
- TARGET_NAME="Steam"
- WAIT_TIME=5
- # 2. Update Opacity Rules
- if $HOST_CMD test -f "$CONFIG_FILE"; then
- $HOST_CMD sed -i 's/^\s*opacityactive=.*/opacityactive=100/' "$CONFIG_FILE"
- $HOST_CMD sed -i 's/^\s*opacityinactive=.*/opacityinactive=100/' "$CONFIG_FILE"
- fi
- # 3. Wait for Stabilization
- sleep $WAIT_TIME
- # 4. Close Steam window
- window_uuid=$($HOST_CMD kdotool search --class "$TARGET_CLASS" 2>/dev/null | head -n 1)
- if [ -n "$window_uuid" ]; then
- $HOST_CMD kdotool windowclose "$window_uuid"
- else
- # Fallback on Name
- window_uuid=$($HOST_CMD kdotool search --name "$TARGET_NAME" 2>/dev/null | head -n 1)
- if [ -n "$window_uuid" ]; then
- $HOST_CMD kdotool windowclose "$window_uuid"
- fi
- fi
- # 5. Reconfigures KWin to apply kwinrulesrc changes
- $HOST_CMD qdbus6 org.kde.KWin /KWin reconfigure
- # 6. Unloads the Blur Effect
- $HOST_CMD qdbus6 org.kde.KWin /Effects org.kde.kwin.Effects.unloadEffect glass
- exit 0
- // enable_effects.sh
- #!/usr/bin/env bash
- # 1. Changes resolution to 3840x2160@60 and scale to 125% and restarts PlasmaShell for it to function correctly.
- kscreen-doctor output.HDMI-A-1.mode.3840x2160@60 output.HDMI-A-1.scale.1.25 &
- systemctl --user restart plasma-plasmashell.service
- # This fixes 'missing library' problem because the host uses its own libs.
- if [ -f /.flatpak-info ]; then
- HOST_CMD="flatpak-spawn --host"
- else
- HOST_CMD=""
- fi
- # 2. Update Opacity Rules (Only works if keys already exist in a rule block)
- # Ensure you have a rule block in kwinrulesrc containing these keys
- FILE=~/.config/kwinrulesrc
- sed -i 's/^\s*opacityactive=.*/opacityactive=75/' "$FILE"
- sed -i 's/^\s*opacityinactive=.*/opacityinactive=75/' "$FILE"
- # 3. Reconfigures KWin to apply kwinrulesrc changes
- $HOST_CMD qdbus6 org.kde.KWin /KWin reconfigure
- # 4. Loads the Blur Effect
- $HOST_CMD qdbus6 org.kde.KWin /Effects org.kde.kwin.Effects.loadEffect glass
- exit
Advertisement
Add Comment
Please, Sign In to add comment