hikarin522 / GlassIt-VSC

VS Code Extension to set window to transparent on Windows platform.
https://marketplace.visualstudio.com/items?itemName=s-nlf-fh.glassit
MIT License
203 stars 21 forks source link

not working on pop!_os 20.10 #20

Open xenorio opened 3 years ago

xenorio commented 3 years ago

image

As you can see, nothing is going transparent.

I am using the Xorg display server and xprop is installed.

VS Code System Information

timestamp: 2020-11-02T00:02:37.127Z

Information Provider

key value
id wraith13.sysinfo-vscode
name sysinfo-vscode
displayName System Information
version 2.4.1

options

key value
categories ["basic","extensions"]
withSensitiveData false
withInternalExtensions false

OS Information

key value
arch x64
platform linux
type Linux
release 5.8.0-7625-generic
EOL "\n"
endianness LE

Process Information

key value
arch x64

versions

key value
node 12.14.1
v8 8.3.110.13-electron.0
uv 1.33.1
zlib 1.2.11
brotli 1.0.7
ares 1.15.0
modules 80
nghttp2 1.40.0
napi 5
llhttp 2.0.1
http_parser 2.8.0
openssl 1.1.0
cldr 36.0
icu 65.1
tz 2020a
unicode 12.1
electron 9.2.1

env

key value
LANG en_US.UTF-8

VS Code Information

key value
version 1.50.1

env

key value
appName Visual Studio Code
language en

extensions

JavaScript Debugger

key value
id ms-vscode.js-debug
isActive true
name js-debug
version 1.50.2
displayName JavaScript Debugger
description An extension for debugging Node.js programs and Chrome.
publisher ms-vscode
categories ["Debuggers"]

JavaScript Debugger Companion Extension

key value
id ms-vscode.js-debug-companion
isActive false
name js-debug-companion
version 1.0.8
displayName JavaScript Debugger Companion Extension
description Companion extension to js-debug that provides capability for remote debugging
publisher ms-vscode
categories ["Other"]

Node Debug (legacy)

key value
id ms-vscode.node-debug
isActive false
name node-debug
version 1.44.14
displayName Node Debug (legacy)
description Node.js debugging support (versions < 8.0)
publisher ms-vscode
categories ["Debuggers"]

Node Debug

key value
id ms-vscode.node-debug2
isActive false
name node-debug2
version 1.42.5
displayName Node Debug
description Node.js debugging support
publisher ms-vscode
categories ["Debuggers"]

Reference Search View

key value
id ms-vscode.references-view
isActive false
name references-view
version 0.0.68
displayName Reference Search View
description Reference Search results as separate, stable view in the sidebar
publisher ms-vscode
categories ["Programming Languages"]

vscode-js-profile-table

key value
id ms-vscode.vscode-js-profile-table
isActive false
name vscode-js-profile-table
version 0.0.11
description Text visualizer for profiles taken from the JavaScript debugger
publisher ms-vscode

CSS Formatter

key value
id aeschli.vscode-css-formatter
isActive true
name vscode-css-formatter
version 1.0.1
displayName CSS Formatter
description Formatter for CSS
publisher aeschli
categories ["Formatters"]

GlassIt-VSC

key value
id s-nlf-fh.glassit
isActive true
name glassit
version 0.2.2
displayName GlassIt-VSC
description VS Code Extension to set window to transparent on Windows and Linux platforms.
publisher s-nlf-fh
categories ["Themes","Other"]

System Information

key value
id wraith13.sysinfo-vscode
isActive true
name sysinfo-vscode
version 2.4.1
displayName System Information
description Show system information ( includes extensions list ) by markdown or JSON for VS Code
publisher wraith13
categories ["Other"]
hikarin522 commented 3 years ago

Can you post the output of below command.

xprop -root | grep '_NET_CLIENT_LIST(WINDOW)'

16

https://github.com/hikarin522/GlassIt-VSC/blob/v0.2.2/extension.js#L51

xenorio commented 3 years ago
_NET_CLIENT_LIST(WINDOW): window id # 0x1e00019, 0x1e0009e, 0x1e00092, 0x1e00042, 0x1c00009, 0x3800001, 0x3c00006, 0x3c022d3, 0x5400006, 0x1800006, 0x580000e
hikarin522 commented 3 years ago

Start code and run the following shell script.

#!/bin/bash

codeIds=(`pgrep 'code'`)

echo "codeIds: ${codeIds[@]}"

IFS=', '
windowIds=`xprop -root  |  grep '_NET_CLIENT_LIST(WINDOW)'`
windowIds=(${windowIds#*#})
echo "windowIds : ${windowIds[@]}"

pids=()
targets=()
for wid in  ${windowIds[@]}; do
  pid=`xprop -id ${wid} _NET_WM_PID`
  pid=${pid#*= }
  pids+=($pid)
  for code in ${codeIds[@]}; do
    if [[ $pid == $code ]]; then
      targets+=($wid)
    fi
  done
done

echo "pids : ${pids[@]}"

echo "targets : ${targets[@]}"
xenorio commented 3 years ago
codeIds: 58859 58863 58864 58891 58901 59000 72684 72722 72738 72799 101539
pids : 1861 46254 58859 2861 2861 77271 _NET_WM_PID: not found. 61661 48961 62568
targets : 58859
xenorio commented 3 years ago

since it's saying that it's not finding a wm pid (i guess it means the window manager), i just wanna say that i'm using i3-gaps as my wm. maybe that helps.

hikarin522 commented 3 years ago

If the window does not become translucent after running this script, i3 may not support _NET_WM_WINDOW_OPACITY.

#!/bin/bash

codeIds=(`pgrep 'code'`)

echo "codeIds: ${codeIds[@]}"

IFS=', '
windowIds=`xprop -root  |  grep '_NET_CLIENT_LIST(WINDOW)'`
windowIds=(${windowIds#*#})
echo "windowIds : ${windowIds[@]}"

pids=()
targets=()
for wid in  ${windowIds[@]}; do
  pid=`xprop -id ${wid} _NET_WM_PID`
  pid=${pid#*= }
  pids+=($pid)
  for code in ${codeIds[@]}; do
    if [[ $pid == $code ]]; then
      targets+=($wid)
    fi
  done
done

echo "pids : ${pids[@]}"

echo "targets : ${targets[@]}"

xprop -id ${targets[0]}  -f _NET_WM_WINDOW_OPACITY 32c -set _NET_WM_WINDOW_OPACITY $(( 0xffffffff * 200 / 256 ))

https://github.com/hikarin522/GlassIt-VSC/blob/v0.2.2/extension.js#L80

xenorio commented 3 years ago

it did not change anything.

no idea what _NET_WM_WINDOW_OPACITY means exactly, but transparency definitely works with other applications such as terminals or discord. i just needed to install compton for that.

if this really is a compatibility issue with i3, is there any chance for a patch in the future?

hikarin522 commented 3 years ago

I'm not familiar with i3 so I don't know, but if I find a solution, I'll fix it.

xenorio commented 3 years ago

sounds good. thanks for your time!

ChillerDragon commented 2 years ago

If the window does not become translucent after running this script, i3 may not support _NET_WM_WINDOW_OPACITY.

#!/bin/bash

codeIds=(`pgrep 'code'`)

echo "codeIds: ${codeIds[@]}"

IFS=', '
windowIds=`xprop -root  |  grep '_NET_CLIENT_LIST(WINDOW)'`
windowIds=(${windowIds#*#})
echo "windowIds : ${windowIds[@]}"

pids=()
targets=()
for wid in  ${windowIds[@]}; do
  pid=`xprop -id ${wid} _NET_WM_PID`
  pid=${pid#*= }
  pids+=($pid)
  for code in ${codeIds[@]}; do
    if [[ $pid == $code ]]; then
      targets+=($wid)
    fi
  done
done

echo "pids : ${pids[@]}"

echo "targets : ${targets[@]}"

xprop -id ${targets[0]}  -f _NET_WM_WINDOW_OPACITY 32c -set _NET_WM_WINDOW_OPACITY $(( 0xffffffff * 200 / 256 ))

https://github.com/hikarin522/GlassIt-VSC/blob/v0.2.2/extension.js#L80

Cool that works for me thanks! But the extension it self does not seem to have any effect. I am on archlinux X11 and gnome btw.

Calandiel commented 1 year ago

If the window does not become translucent after running this script, i3 may not support _NET_WM_WINDOW_OPACITY.

#!/bin/bash

codeIds=(`pgrep 'code'`)

echo "codeIds: ${codeIds[@]}"

IFS=', '
windowIds=`xprop -root  |  grep '_NET_CLIENT_LIST(WINDOW)'`
windowIds=(${windowIds#*#})
echo "windowIds : ${windowIds[@]}"

pids=()
targets=()
for wid in  ${windowIds[@]}; do
  pid=`xprop -id ${wid} _NET_WM_PID`
  pid=${pid#*= }
  pids+=($pid)
  for code in ${codeIds[@]}; do
    if [[ $pid == $code ]]; then
      targets+=($wid)
    fi
  done
done

echo "pids : ${pids[@]}"

echo "targets : ${targets[@]}"

xprop -id ${targets[0]}  -f _NET_WM_WINDOW_OPACITY 32c -set _NET_WM_WINDOW_OPACITY $(( 0xffffffff * 200 / 256 ))

https://github.com/hikarin522/GlassIt-VSC/blob/v0.2.2/extension.js#L80

I think its worth adding that the first line (codeIds=(pgrep 'code')) stores the executables name. Some distribution of VSCode (such as VSCodium) use a different name. The above script didn't work for me until I changed code to codium

sanihaq commented 1 year ago

Does not work with i3wm

Sergij-SApcPro commented 1 year ago

If the window does not become translucent after running this script, i3 may not support _NET_WM_WINDOW_OPACITY.

#!/bin/bash

codeIds=(`pgrep 'code'`)

echo "codeIds: ${codeIds[@]}"

IFS=', '
windowIds=`xprop -root  |  grep '_NET_CLIENT_LIST(WINDOW)'`
windowIds=(${windowIds#*#})
echo "windowIds : ${windowIds[@]}"

pids=()
targets=()
for wid in  ${windowIds[@]}; do
  pid=`xprop -id ${wid} _NET_WM_PID`
  pid=${pid#*= }
  pids+=($pid)
  for code in ${codeIds[@]}; do
    if [[ $pid == $code ]]; then
      targets+=($wid)
    fi
  done
done

echo "pids : ${pids[@]}"

echo "targets : ${targets[@]}"

xprop -id ${targets[0]}  -f _NET_WM_WINDOW_OPACITY 32c -set _NET_WM_WINDOW_OPACITY $(( 0xffffffff * 200 / 256 ))

https://github.com/hikarin522/GlassIt-VSC/blob/v0.2.2/extension.js#L80

I think its worth adding that the first line (codeIds=(pgrep 'code')) stores the executables name. Some distribution of VSCode (such as VSCodium) use a different name. The above script didn't work for me until I changed code to codium

Thanks that fixed it for me. I also had to install the kwin script force blur and set it to blur all windows, for background blur to work, since I'm on KDE Plasma. And also to fix the extension you need to edit the extension.js file in the extension folder: ~/.vscode-oss(OR .vscode)/extensions/s-nlf-fh.glassit-{THE VERSION}-universal/, and change "code" on line 46 to "codium". Hope that helped.