From b878661252e164e7c668943964453bff9879c621 Mon Sep 17 00:00:00 2001 From: Adrian Amaglio Date: Thu, 10 Feb 2022 09:05:07 +0100 Subject: [PATCH] init --- lock_and_suspend | 3 +++ switch-vpn | 6 ++++++ switch-wifi | 8 ++++++++ toggle_suspend | 8 ++++++++ 4 files changed, 25 insertions(+) create mode 100755 lock_and_suspend create mode 100755 switch-vpn create mode 100755 switch-wifi create mode 100755 toggle_suspend diff --git a/lock_and_suspend b/lock_and_suspend new file mode 100755 index 0000000..953ebad --- /dev/null +++ b/lock_and_suspend @@ -0,0 +1,3 @@ +#!/bin/sh +# Lock screen and suspend if enabled in config file +DISPLAY=:0 i3lock -e -c 000000 -u && [ -z "$(grep off "/run/user/1000/enable_suspend")" ] && systemctl suspend diff --git a/switch-vpn b/switch-vpn new file mode 100755 index 0000000..edaabcb --- /dev/null +++ b/switch-vpn @@ -0,0 +1,6 @@ +#!/bin/sh +if [ -n "$(nmcli connection show rezine_vpn37_udp | grep activated)" ] ; then + nmcli connection down rezine_vpn37_udp +else + nmcli connection up rezine_vpn37_udp +fi diff --git a/switch-wifi b/switch-wifi new file mode 100755 index 0000000..9511304 --- /dev/null +++ b/switch-wifi @@ -0,0 +1,8 @@ +#!/bin/sh +if [[ "$(nmcli radio wifi)" = "enabled" ]] ; then + nmcli radio wifi off + notify-send "Wifi is now" off +else + nmcli radio wifi on + notify-send "Wifi is now" on +fi diff --git a/toggle_suspend b/toggle_suspend new file mode 100755 index 0000000..c6a0897 --- /dev/null +++ b/toggle_suspend @@ -0,0 +1,8 @@ +#!/bin/sh +if [ -z "$(grep off "/run/user/1000/enable_suspend")" ] ; then + echo off > "$XDG_RUNTIME_DIR/enable_suspend" + notify-send "Sleep mode is now" "off" +else + echo on > "$XDG_RUNTIME_DIR/enable_suspend" + notify-send "Sleep mode is now" "on" +fi