Add new opacity script to set any window's opacity
This commit is contained in:
parent
89fd721632
commit
d0ac7076d0
1 changed files with 11 additions and 3 deletions
14
bin/opacity
14
bin/opacity
|
@ -1,6 +1,14 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ "$TERM" = "xterm-kitty" ]
|
||||
then
|
||||
kitty @ set-background-opacity $1
|
||||
id=$(xdotool selectwindow)
|
||||
|
||||
before=$(xprop -id $id 32c _NET_WM_WINDOW_OPACITY | lua -e 'print(tonumber(io.read():match("= .*$"):sub(2)))')
|
||||
initial=$(xprop -id $id 32c _NET_WM_WINDOW_OPACITY | lua -e 'print(math.floor(tonumber(io.read():match("= .*$"):sub(2)) / 0xffffffff * 100 + 0.5))')
|
||||
|
||||
((zenity --scale --title "Opacity" --value=$initial --print-partial; echo $? >&3) \
|
||||
| lua -e 'for line in io.lines() do print(string.format("0x%08x", math.floor(tonumber(line) / 100 * 0xffffffff + 0.5))) end' \
|
||||
| xargs -I{} xprop -id $id -f _NET_WM_WINDOW_OPACITY 32c -set _NET_WM_WINDOW_OPACITY {}) 3>&1 | (read xs; exit $xs)
|
||||
|
||||
if [ $? -ne 0 ]
|
||||
then xprop -id $id -f _NET_WM_WINDOW_OPACITY 32c -set _NET_WM_WINDOW_OPACITY $before
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue