EYHN / vscode-vibrancy

Enable Acrylic/Glass effect for your VS Code.
MIT License
561 stars 37 forks source link

Just a note on Linux users (Kwin/Plasma) #139

Open Mistreaper opened 2 years ago

Mistreaper commented 2 years ago

I saw issue #20 wanting Linux support, so here we go. Note that this only works on Plasma/Kwin, I'll probably find a solution for WM users (i3)

Source: https://www.sainnhe.dev/post/plasma-blur/

First, get the script:

sudo wget https://gist.githubusercontent.com/Mistreaper/36683647519f7e661aa6de8143c17e43/raw/a10fee4fa1a047ac9b873f757549be33f492520d/plasma-blur -O /usr/bin/plasma-blur

Make sure permissions are set correctly:

sudo chmod 755 /usr/bin/plasma-blur

Now, here is the command to launch VSCode with blur:

/usr/bin/plasma-blur 'code' 'Code' 3

As you can see, '3' is our transparency level. You can set this value to any number you like. You can also edit the shortcut in the application menu to launch with that command so that you have code with transparency! image

Editing /bin/code to make it look transparent (system wide, tested on archlinux):

#!/bin/bash

XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-~/.config}

# Allow users to override command-line options
if [[ -f $XDG_CONFIG_HOME/code-flags.conf ]]; then
   CODE_USER_FLAGS="$(sed 's/#.*//' $XDG_CONFIG_HOME/code-flags.conf | tr '\n' ' ')"
fi

# Launch
#exec /opt/visual-studio-code/bin/code $CODE_USER_FLAGS "$@" &
# Run in background
eval "/opt/visual-studio-code/bin/code $CODE_USER_FLAGS "$@" &"

# Blur
i=0
while [ "$i" -lt 18 ]; do
        if [[ "$i" -lt 6 ]]; then
                sleep 0.1s
        else
                sleep 0.2s
        fi
        xdotool search -classname "Code" | xargs -I{} xprop -f _KDE_NET_WM_BLUR_BEHIND_REGION 32c -set _KDE_NET_WM_BLUR_BEHIND_REGION 0 -id {}                                                                                                                                                                                   
        i=$((i + 1))                                                                                                                                                                                                  
done                                                                                                                                                                                                                  

# Transparent                                                                                                                                                                                                         
i=0                                                                                                                                                                                                                   
while [ "$i" -lt "3" ]; do                                                                                                                                                                                            
        qdbus org.kde.kglobalaccel /component/kwin org.kde.kglobalaccel.Component.invokeShortcut "Decrease Opacity"                                                                                                                                                                                                              
        i=$((i + 1))                                                                                                                                                                                                  
done      
dement6d commented 2 years ago

transparency and blur seem to work (ignore the messy blur, its because im running this in a VM) but, is there a way we could keep the foreground at max opacity in vscode?, things like text and icons image

hrqmonteiro commented 2 years ago

This is kinda useless, since it makes the whole window transparent, not just the background. So, it becomes really messy (and ugly).

So, not a solution at all.