diff options
Diffstat (limited to 'scripts/system')
| -rwxr-xr-x | scripts/system/git-ps1 | 9 | ||||
| -rwxr-xr-x | scripts/system/graphical-startup | 7 | ||||
| -rwxr-xr-x | scripts/system/lock-computer | 4 | ||||
| -rwxr-xr-x | scripts/system/monitor-battery | 30 | ||||
| -rwxr-xr-x | scripts/system/screenshot | 20 | ||||
| -rwxr-xr-x | scripts/system/sleep-computer | 3 | ||||
| -rwxr-xr-x | scripts/system/sysinfo | 37 |
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 |
