summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/system/graphical-startup2
-rwxr-xr-xscripts/system/idle-sleep20
-rwxr-xr-xscripts/system/lock-computer2
-rwxr-xr-xscripts/system/sysinfo31
4 files changed, 43 insertions, 12 deletions
diff --git a/scripts/system/graphical-startup b/scripts/system/graphical-startup
index b78de30..2b46050 100755
--- a/scripts/system/graphical-startup
+++ b/scripts/system/graphical-startup
@@ -4,7 +4,7 @@
pipewire &
dunst &
swaybg -i $HOME/dotfiles/files/wallpapers/mill.png &
-swayidle timeout 300 sleep-computer &
+idle-sleep &
monitor-battery &
# restartemacs >/dev/null &
diff --git a/scripts/system/idle-sleep b/scripts/system/idle-sleep
new file mode 100755
index 0000000..3d1dbd9
--- /dev/null
+++ b/scripts/system/idle-sleep
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+sway_idle() {
+ swayidle timeout 300 sleep-computer
+}
+
+if [ -n "$1" ] && [ $1 = "-t" ]; then
+ # toggle
+ if pgrep --quiet swayidle; then
+ notify-send "Idle Disabled" "Computer will not sleep when idle"
+ pkill swayidle
+ else
+ notify-send "Idle Enabled" "Computer will sleep when idle"
+ sway_idle
+ fi
+else
+ # start
+ sway_idle
+fi
+
diff --git a/scripts/system/lock-computer b/scripts/system/lock-computer
index 0abb3a2..c09d034 100755
--- a/scripts/system/lock-computer
+++ b/scripts/system/lock-computer
@@ -1,4 +1,4 @@
#!/bin/sh
-if not pgrep swaylock; then
+if ! pgrep swaylock; then
swaylock
fi
diff --git a/scripts/system/sysinfo b/scripts/system/sysinfo
index 5cb2d07..34f23b4 100755
--- a/scripts/system/sysinfo
+++ b/scripts/system/sysinfo
@@ -17,21 +17,32 @@ get_message() {
# Network Info
net_device=$(ip a | grep "state UP" | awk -F': ' '{ printf($2) }')
- case "${net_device}" in
- wlan*)
- connected_network=$(iwctl station ${net_device} show | grep 'Connected network' \
- | awk -F' ' '{ printf($3) }')
- ;;
- eth*)
- ;;
- esac
- echo "${net_device}: ${connected_network}"
+ if ! [ -z $net_device ]; then
+ case "${net_device}" in
+ wlan*)
+ connected_network=$(iwctl station ${net_device} show | grep 'Connected network' \
+ | awk -F' ' '{ printf($3) }')
+ ;;
+ eth*)
+ ;;
+ esac
+ echo "${net_device}: ${connected_network}"
+ else
+ echo "Network: DOWN"
+ fi
+
+ echo ""
+
+ # Idle monitor status
+ pgrep --quiet swayidle && echo "Idle Sleep: Enabled" || echo "Idle Sleep: Disabled"
}
message=$(get_message)
if [ "$TERM" = "linux" ]; then
- notify-send "System Info" "$message"
+ replace_id=$(cat $XDG_RUNTIME_DIR/sysinfoid)
+ [ ! -z $replace_id ] && replace_arg="-r $replace_id"
+ notify-send $replace_arg -p "System Info" "$message" > $XDG_RUNTIME_DIR/sysinfoid
else
echo "$message"
fi