Compare commits
6 Commits
fcf2b91b7b
...
7a10a72476
Author | SHA1 | Date |
---|---|---|
John Mertz | 7a10a72476 | |
John Mertz | 6ef42310f1 | |
John Mertz | 2be287ef9f | |
John Mertz | 672daf8889 | |
John Mertz | db048cfe82 | |
John Mertz | 636be47198 |
|
@ -2,24 +2,25 @@
|
||||||
|
|
||||||
# Passwordless sudo required
|
# 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'
|
/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
|
sudo /usr/bin/systemctl stop openvpn-client@mailcleaner
|
||||||
/usr/bin/systemctl --user restart wg-quick@wg0
|
/usr/bin/systemctl --user restart wg-quick@wg0
|
||||||
elif [ $res = "MailCleaner" ]; then
|
elif [[ $res = "MailCleaner" ]]; then
|
||||||
/usr/bin/systemctl --user stop wg-quick@wg0
|
/usr/bin/systemctl --user stop wg-quick@wg0
|
||||||
sudo /usr/bin/systemctl restart openvpn-client@mailcleaner
|
sudo /usr/bin/systemctl restart openvpn-client@mailcleaner
|
||||||
elif [ $res = "Disconnect" ]; then
|
elif [[ $res = "Disconnect" ]]; then
|
||||||
sudo /usr/bin/systemctl stop openvpn-client@mailcleaner
|
sudo /usr/bin/systemctl stop openvpn-client@mailcleaner
|
||||||
/usr/bin/systemctl --user stop wg-quick@wg0
|
/usr/bin/systemctl --user stop wg-quick@wg0
|
||||||
elif [ $res = "Restart" ]; then
|
elif [[ $res = "Restart" ]]; then
|
||||||
if [ "`ip addr show wg0 2> /dev/null`" != "" ]; then
|
if [[ "`ip addr show wg0 2> /dev/null`" != "" ]]; then
|
||||||
/usr/bin/systemctl --user restart wg-quick@wg0
|
/usr/bin/systemctl --user restart wg-quick@wg0
|
||||||
fi
|
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
|
sudo /usr/bin/systemctl restart openvpn-client@mailcleaner
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
|
|
@ -11,7 +11,7 @@ OPFILE="$HOME/.spool/active_outputs"
|
||||||
IDLEMODE=$(cat $HOME/.spool/idle_mode)
|
IDLEMODE=$(cat $HOME/.spool/idle_mode)
|
||||||
if [[ -n $2 ]]; then
|
if [[ -n $2 ]]; then
|
||||||
if [[ $2 == '--ignore_mode' ]]; then
|
if [[ $2 == '--ignore_mode' ]]; then
|
||||||
$IDLEMODE='hibernate'
|
IDLEMODE='hibernate'
|
||||||
else
|
else
|
||||||
echo "Unknown mode $IDLEMODE"
|
echo "Unknown mode $IDLEMODE"
|
||||||
exit
|
exit
|
||||||
|
@ -128,6 +128,9 @@ elif [[ $1 == "sleep" ]]; then
|
||||||
elif [[ $1 == "unsleep" ]]; then
|
elif [[ $1 == "unsleep" ]]; then
|
||||||
for i in $(cat $OPFILE); do swaymsg "output $i dpms on"; done
|
for i in $(cat $OPFILE); do swaymsg "output $i dpms on"; done
|
||||||
#$HOME/scripts/sway/displays.pl
|
#$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
|
elif [[ $1 == "hibernate" ]]; then
|
||||||
if [[ $IDLEMODE -gt 4 ]]; then
|
if [[ $IDLEMODE -gt 4 ]]; then
|
||||||
sudo systemctl suspend-then-hibernate.target
|
sudo systemctl suspend-then-hibernate.target
|
||||||
|
|
|
@ -19,6 +19,8 @@ def on_window_focus(opacity, ipc, event):
|
||||||
return
|
return
|
||||||
global prev_focused
|
global prev_focused
|
||||||
global prev_workspace
|
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()
|
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
|
if focused.id != prev_focused.id: # https://github.com/swaywm/sway/issues/2859
|
||||||
focused.command("opacity 1")
|
focused.command("opacity 1")
|
||||||
if workspace == prev_workspace:
|
if workspace == prev_workspace and not prev_focused.sticky:
|
||||||
prev_focused.command("opacity " + opacity)
|
prev_focused.command("opacity " + opacity)
|
||||||
prev_focused = focused
|
prev_focused = focused
|
||||||
prev_workspace = workspace
|
prev_workspace = workspace
|
||||||
|
@ -81,11 +83,14 @@ def remove_opacity(ipc):
|
||||||
|
|
||||||
def set_all(ipc,opacity):
|
def set_all(ipc,opacity):
|
||||||
for window in ipc.get_tree():
|
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"
|
flag = os.environ["HOME"]+"/.spool/sway-hidden"
|
||||||
pid = os.environ["HOME"]+"/.spool/sway-transparency"
|
pid = os.environ["HOME"]+"/.spool/sway-transparency"
|
||||||
opacity = "0.9"
|
opacity = "0.85"
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
f = open(pid, "w")
|
f = open(pid, "w")
|
||||||
|
@ -115,6 +120,8 @@ if __name__ == "__main__":
|
||||||
for window in ipc.get_tree():
|
for window in ipc.get_tree():
|
||||||
if window.focused:
|
if window.focused:
|
||||||
prev_focused = window
|
prev_focused = window
|
||||||
|
elif window.sticky:
|
||||||
|
continue
|
||||||
else:
|
else:
|
||||||
window.command("opacity " + args.opacity)
|
window.command("opacity " + args.opacity)
|
||||||
for sig in [signal.SIGINT, signal.SIGTERM]:
|
for sig in [signal.SIGINT, signal.SIGTERM]:
|
||||||
|
|
Loading…
Reference in New Issue