Compare commits

...

6 Commits

3 changed files with 23 additions and 12 deletions

View File

@ -2,24 +2,25 @@
# Passwordless sudo required
res=$(echo "Connection|John.Me.tz|MailCleaner|Disconnect|Restart" | rofi -sep "|" -dmenu -i -p 'P ' "" -columns 9 -width 45 -l 1 -config /home/jpm/.config/rofi/config.rasi -theme /home/jpm/.config/rofi/sidebar -hide-scrollbar -eh 1 -location 0 -auto-select -no-fullscreen)
res=$(echo "John.Me.tz|MailCleaner|Disconnect|Restart" | rofi -sep "|" -dmenu -i -p 'P ' "" -columns 9 -width 45 -l 1 -config /home/jpm/.config/rofi/config.rasi -theme /home/jpm/.config/rofi/sidebar -hide-scrollbar -eh 1 -location 0 -auto-select -no-fullscreen)
if [ $res = "Connection" ]; then
# First option is disabled in favour of nm-applet
if [[ $res = "Connection" ]]; then
/usr/bin/uxterm -e 'sudo /usr/bin/nmtui'
elif [ $res = "John.Me.tz" ]; then
elif [[ $res = "John.Me.tz" ]]; then
sudo /usr/bin/systemctl stop openvpn-client@mailcleaner
/usr/bin/systemctl --user restart wg-quick@wg0
elif [ $res = "MailCleaner" ]; then
elif [[ $res = "MailCleaner" ]]; then
/usr/bin/systemctl --user stop wg-quick@wg0
sudo /usr/bin/systemctl restart openvpn-client@mailcleaner
elif [ $res = "Disconnect" ]; then
elif [[ $res = "Disconnect" ]]; then
sudo /usr/bin/systemctl stop openvpn-client@mailcleaner
/usr/bin/systemctl --user stop wg-quick@wg0
elif [ $res = "Restart" ]; then
if [ "`ip addr show wg0 2> /dev/null`" != "" ]; then
elif [[ $res = "Restart" ]]; then
if [[ "`ip addr show wg0 2> /dev/null`" != "" ]]; then
/usr/bin/systemctl --user restart wg-quick@wg0
fi
if [ "`ip addr show tun0 2> /dev/null`" != "" ]; then
if [[ "`ip addr show tun0 2> /dev/null`" != "" ]]; then
sudo /usr/bin/systemctl restart openvpn-client@mailcleaner
fi
else

View File

@ -11,7 +11,7 @@ OPFILE="$HOME/.spool/active_outputs"
IDLEMODE=$(cat $HOME/.spool/idle_mode)
if [[ -n $2 ]]; then
if [[ $2 == '--ignore_mode' ]]; then
$IDLEMODE='hibernate'
IDLEMODE='hibernate'
else
echo "Unknown mode $IDLEMODE"
exit
@ -128,6 +128,9 @@ elif [[ $1 == "sleep" ]]; then
elif [[ $1 == "unsleep" ]]; then
for i in $(cat $OPFILE); do swaymsg "output $i dpms on"; done
#$HOME/scripts/sway/displays.pl
cd $HOME/scripts/sway
source $HOME/.dotfiles/bash/plenv-path.sh
$HOME/scripts/sway/displays.pl 2>&1 >$HOME/.spool/display_unsleep
elif [[ $1 == "hibernate" ]]; then
if [[ $IDLEMODE -gt 4 ]]; then
sudo systemctl suspend-then-hibernate.target

View File

@ -19,6 +19,8 @@ def on_window_focus(opacity, ipc, event):
return
global prev_focused
global prev_workspace
# Refresh previous window in case it changed while in focus
prev_focused = ipc.get_tree().find_by_id(prev_focused.id)
focused_workspace = ipc.get_tree().find_focused()
@ -30,7 +32,7 @@ def on_window_focus(opacity, ipc, event):
if focused.id != prev_focused.id: # https://github.com/swaywm/sway/issues/2859
focused.command("opacity 1")
if workspace == prev_workspace:
if workspace == prev_workspace and not prev_focused.sticky:
prev_focused.command("opacity " + opacity)
prev_focused = focused
prev_workspace = workspace
@ -81,11 +83,14 @@ def remove_opacity(ipc):
def set_all(ipc,opacity):
for window in ipc.get_tree():
window.command("opacity " + opacity)
if prev_focused.sticky:
window.command("opacity 1")
else:
window.command("opacity " + opacity)
flag = os.environ["HOME"]+"/.spool/sway-hidden"
pid = os.environ["HOME"]+"/.spool/sway-transparency"
opacity = "0.9"
opacity = "0.85"
if __name__ == "__main__":
f = open(pid, "w")
@ -115,6 +120,8 @@ if __name__ == "__main__":
for window in ipc.get_tree():
if window.focused:
prev_focused = window
elif window.sticky:
continue
else:
window.command("opacity " + args.opacity)
for sig in [signal.SIGINT, signal.SIGTERM]: