summaryrefslogtreecommitdiff
path: root/scripts/system
diff options
context:
space:
mode:
authorJack Jamison <jackqjamison@gmail.com>2026-05-15 22:36:21 -0400
committerJack Jamison <jackqjamison@gmail.com>2026-05-15 22:36:21 -0400
commit1c58ccb7855719483490abe1982afa12b0488f24 (patch)
treed6d6f95477c743c1e2e8f4a64095d50cb491338c /scripts/system
parentfbe17d51cc2d52261721a46ee54d5dc8f32db3eb (diff)
refactor and battery notifier
Diffstat (limited to 'scripts/system')
-rwxr-xr-xscripts/system/git-ps19
-rwxr-xr-xscripts/system/graphical-startup7
-rwxr-xr-xscripts/system/lock-computer4
-rwxr-xr-xscripts/system/monitor-battery30
-rwxr-xr-xscripts/system/screenshot20
-rwxr-xr-xscripts/system/sleep-computer3
-rwxr-xr-xscripts/system/sysinfo37
7 files changed, 110 insertions, 0 deletions
diff --git a/scripts/system/git-ps1 b/scripts/system/git-ps1
new file mode 100755
index 0000000..0b860cd
--- /dev/null
+++ b/scripts/system/git-ps1
@@ -0,0 +1,9 @@
+#!/bin/sh
+out=$(git branch --show-current 2>/dev/null)
+if [ -z "$out" ] ; then
+ out=""
+else
+ out="($out) "
+fi
+echo -n "$out"
+
diff --git a/scripts/system/graphical-startup b/scripts/system/graphical-startup
new file mode 100755
index 0000000..52bbb8b
--- /dev/null
+++ b/scripts/system/graphical-startup
@@ -0,0 +1,7 @@
+#!/bin/sh
+# pipewire &
+dunst &
+swaybg -i $HOME/dotfiles/files/wallpapers/mill.png &
+swayidle timeout 300 sleep-computer &
+monitor-battery &
+# restartemacs >/dev/null &
diff --git a/scripts/system/lock-computer b/scripts/system/lock-computer
new file mode 100755
index 0000000..0abb3a2
--- /dev/null
+++ b/scripts/system/lock-computer
@@ -0,0 +1,4 @@
+#!/bin/sh
+if not pgrep swaylock; then
+ swaylock
+fi
diff --git a/scripts/system/monitor-battery b/scripts/system/monitor-battery
new file mode 100755
index 0000000..94b7365
--- /dev/null
+++ b/scripts/system/monitor-battery
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+threshold=20
+very_low_threshold=10
+
+amount="low"
+prev_cap=100
+
+while true; do
+ cap=$(cat /sys/class/power_supply/BAT0/capacity)
+ status=$(cat /sys/class/power_supply/BAT0/status)
+
+ # when capacity changes
+ if [ $cap -ne $prev_cap ]; then
+
+ # notify when drop under threshold
+ if [ $cap -lt $threshold ] && [ $prev_cap -ge $threshold ]; then
+ notify-send "Plug In" "Battery has fallen under $threshold%"
+ fi
+
+ # notify every percent if very low
+ if [ $cap -le $very_low_threshold ] && [ $status -ne "Charging" ]; then
+ notify-send "BATTERY LOW" "Battery is at $bat%"
+ fi
+
+ fi
+
+ prev_cap=$cap
+ sleep 10
+done
diff --git a/scripts/system/screenshot b/scripts/system/screenshot
new file mode 100755
index 0000000..b599be2
--- /dev/null
+++ b/scripts/system/screenshot
@@ -0,0 +1,20 @@
+#!/bin/bash
+echo $1
+echo $2
+
+if [[ $1 == "-full" ]];
+then
+ if [[ $2 == "-save" ]];
+ then
+ grim -o eDP-1 ~/Pictures/Screenshots/$(date +'%s_grim.png')
+ else
+ grim -o eDP-1 - | wl-copy
+ fi
+else
+ if [[ $1 == "-save" ]];
+ then
+ grim -g "$(slurp)" ~/Pictures/Screenshots/$(date +'%s_grim.png')
+ else
+ grim -g "$(slurp)" - | wl-copy
+ fi
+fi
diff --git a/scripts/system/sleep-computer b/scripts/system/sleep-computer
new file mode 100755
index 0000000..e7768d8
--- /dev/null
+++ b/scripts/system/sleep-computer
@@ -0,0 +1,3 @@
+#!/bin/sh
+echo "mem" | doas tee /sys/power/state
+lock-computer
diff --git a/scripts/system/sysinfo b/scripts/system/sysinfo
new file mode 100755
index 0000000..5cb2d07
--- /dev/null
+++ b/scripts/system/sysinfo
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+get_message() {
+
+ # Date
+ echo "Date: $(date +"%a %b %d")"
+ echo "Time: $(date +"%I:%M:%S")"
+
+ # Volume
+ echo "$(wpctl get-volume @DEFAULT_SINK@ | awk -F' ' '{ printf "%s %s%% %s", $1, ($2 * 100), $3; }')"
+
+ # Brightness
+ echo "Brightness: $(brightnessctl -m | cut -d, -f 4)"
+
+ # Battery
+ echo "$(cat /sys/class/power_supply/BAT0/status): $(cat /sys/class/power_supply/BAT0/capacity)%"
+
+ # 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}"
+}
+
+message=$(get_message)
+
+if [ "$TERM" = "linux" ]; then
+ notify-send "System Info" "$message"
+else
+ echo "$message"
+fi