New 'fade' action as first step to 'idle'
Will take ~1-2s to fade all windows (depending on number of windows. Allows for fullscreen wallpaper for a couple of minutes before next steps.
This commit is contained in:
parent
419aebd384
commit
4bdd817ae1
|
@ -46,9 +46,13 @@ elif [ $1 == "start" ]; then
|
||||||
elif [ $1 == "stop" ]; then
|
elif [ $1 == "stop" ]; then
|
||||||
pkill swayidle
|
pkill swayidle
|
||||||
elif [ $1 == "fade" ]; then
|
elif [ $1 == "fade" ]; then
|
||||||
$HOME/scripts/sway/fade.pl start
|
if [ ! -e $HOME/.spool/sway-hidden ]; then
|
||||||
|
kill -USR2 `cat $HOME/.spool/sway-transparency`
|
||||||
|
fi
|
||||||
elif [ $1 == "unfade" ]; then
|
elif [ $1 == "unfade" ]; then
|
||||||
$HOME/scripts/sway/fade.pl stop
|
if [ -e $HOME/.spool/sway-hidden ]; then
|
||||||
|
kill -USR2 `cat $HOME/.spool/sway-transparency`
|
||||||
|
fi
|
||||||
elif [ $1 == "dim" ]; then
|
elif [ $1 == "dim" ]; then
|
||||||
echo $($HOME/scripts/thinkpad/blc.pl %) > $BLFILE
|
echo $($HOME/scripts/thinkpad/blc.pl %) > $BLFILE
|
||||||
$HOME/scripts/thinkpad/blc.pl = 1 &>-
|
$HOME/scripts/thinkpad/blc.pl = 1 &>-
|
||||||
|
|
|
@ -10,6 +10,7 @@ import i3ipc
|
||||||
import signal
|
import signal
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
import time
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
|
||||||
|
@ -48,6 +49,21 @@ def show_hide(ipc, opacity):
|
||||||
else:
|
else:
|
||||||
w.command("opacity "+str(opacity))
|
w.command("opacity "+str(opacity))
|
||||||
|
|
||||||
|
def fade(ipc, opacity):
|
||||||
|
global flag
|
||||||
|
if os.path.exists(flag):
|
||||||
|
show_hide(ipc, opacity)
|
||||||
|
return
|
||||||
|
for i in range(1,100):
|
||||||
|
for workspace in ipc.get_tree().workspaces():
|
||||||
|
for w in workspace:
|
||||||
|
if w.focused:
|
||||||
|
w.command("opacity "+str(1-(i/100)))
|
||||||
|
elif float(opacity) >= (i/100):
|
||||||
|
w.command("opacity "+str(float(opacity)-(i/100)))
|
||||||
|
time.sleep(0.005)
|
||||||
|
Path(flag).touch()
|
||||||
|
|
||||||
def remove_opacity(ipc):
|
def remove_opacity(ipc):
|
||||||
global pid
|
global pid
|
||||||
global flag
|
global flag
|
||||||
|
@ -101,6 +117,7 @@ if __name__ == "__main__":
|
||||||
for sig in [signal.SIGINT, signal.SIGTERM]:
|
for sig in [signal.SIGINT, signal.SIGTERM]:
|
||||||
signal.signal(sig, lambda signal, frame: remove_opacity(ipc))
|
signal.signal(sig, lambda signal, frame: remove_opacity(ipc))
|
||||||
signal.signal(signal.SIGUSR1, lambda signal, frame: show_hide(ipc, opacity))
|
signal.signal(signal.SIGUSR1, lambda signal, frame: show_hide(ipc, opacity))
|
||||||
|
signal.signal(signal.SIGUSR2, lambda signal, frame: fade(ipc, opacity))
|
||||||
ipc.on("window::focus", partial(on_window_focus, args.opacity))
|
ipc.on("window::focus", partial(on_window_focus, args.opacity))
|
||||||
ipc.main()
|
ipc.main()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue