diff --git a/.gitmodules b/.gitmodules index 56a22a2..556ba0b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "repo"] path = repo url = git@stvnliu.me:steven/ebuild-lithium +[submodule "exec"] + path = exec + url = git@stvnliu.me:steven/util-scripts diff --git a/Makefile b/Makefile deleted file mode 100644 index 58fac63..0000000 --- a/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -PREFIX ?= /usr/local -BINDIR ?= $(PREFIX)/bin -SRCDIR ?= exec - -SCRIPTS := $(wildcard $(SRCDIR)/*.sh) - -install: - @mkdir -p $(BINDIR) - for f in $(SCRIPTS); do \ - install -m 755 "$$f" "$(BINDIR)/$$(basename $$f .sh)"; \ - done - -uninstall: - for f in $(SCRIPTS); do \ - rm -f "$(BINDIR)/$$(basename $$f .sh)"; \ - done diff --git a/exec b/exec new file mode 160000 index 0000000..96d0182 --- /dev/null +++ b/exec @@ -0,0 +1 @@ +Subproject commit 96d01820c1311de7703a80446b228e33b65eab7c diff --git a/exec/batman.sh b/exec/batman.sh deleted file mode 100755 index 1440ac5..0000000 --- a/exec/batman.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/bash -echo $(wcalc -q "round($(cat /sys/class/power_supply/BAT1/charge_now)/$(cat /sys/class/power_supply/BAT1/charge_full) * 100)")% diff --git a/exec/docked-setup.sh b/exec/docked-setup.sh deleted file mode 100755 index 9501045..0000000 --- a/exec/docked-setup.sh +++ /dev/null @@ -1,2 +0,0 @@ -sleep 5 -wlr-randr --output "HDMI-A-1" --on --mode "2560x1440@144.001007" --scale 1 diff --git a/exec/mem.sh b/exec/mem.sh deleted file mode 100755 index 95a402b..0000000 --- a/exec/mem.sh +++ /dev/null @@ -1 +0,0 @@ -free -g | awk 'NR==2 {printf "%dG/%dG\n", $3, $2}' diff --git a/exec/screenshot-file.sh b/exec/screenshot-file.sh deleted file mode 100755 index 46d9a73..0000000 --- a/exec/screenshot-file.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/sh -IFS="" -file="$HOME/Screenshots/$(date '+%Y-%m-%d-%H-%M-%S.png')" -echo $file -slurp | grim -g - $file diff --git a/exec/screenshot.sh b/exec/screenshot.sh deleted file mode 100755 index 2cb8d22..0000000 --- a/exec/screenshot.sh +++ /dev/null @@ -1 +0,0 @@ -slurp | grim -g - - | wl-copy diff --git a/exec/stats.sh b/exec/stats.sh deleted file mode 100755 index 51f0ab0..0000000 --- a/exec/stats.sh +++ /dev/null @@ -1 +0,0 @@ -echo "<$(hostname)@$(uname -r)> [BAT: $(batman)] [MEM: $(mem)]" diff --git a/exec/vol.sh b/exec/vol.sh deleted file mode 100755 index e12df6d..0000000 --- a/exec/vol.sh +++ /dev/null @@ -1,115 +0,0 @@ -#!/usr/bin/env bash -# -# volume-notify.sh — adjust volume via wpctl + show notification via dunstify -# -# Usage: -# volume-notify.sh up → raise volume -# volume-notify.sh down → lower volume -# volume-notify.sh mute → toggle mute -# -# Adjust the step size and icons as desired. - -# Which sink to use — default audio sink -SINK="@DEFAULT_SINK@" - -# Step percent (use percentage step) -STEP="5%" - -# Notification stack tag (so dunst replaces same notification) -STACK_TAG="volume-notify" - -# Icons (set your paths or icon names) -ICON_HIGH="audio-volume-high" -ICON_MED="audio-volume-medium" -ICON_LOW="audio-volume-low" -ICON_MUTED="audio-volume-muted" - -# Increase volume -vol_up() { - wpctl set-volume $SINK $STEP+ -l 1 -} - -# Decrease volume -vol_down() { - wpctl set-volume $SINK $STEP- -l 1 -} - -# Toggle mute -vol_mute() { - wpctl set-mute $SINK toggle -} - -# Get current volume (floating between 0.0-∞, where 1.0 = 100%) and compute percent -get_volume_percent() { - # Example output: “Volume: 0.50” or “Volume: 0.50 [50%]” - local raw - raw=$(wpctl get-volume $SINK 2>/dev/null | awk '/Volume:/ {print $2}') - # convert to percent - # float *100 - local pct - pct=$(awk "BEGIN { printf \"%d\", ($raw * 100) }") - echo "$pct" -} - -# Get mute state (yes/no) -get_mute_state() { - local m - m=$(wpctl get-volume $SINK 2>/dev/null | awk '/Mute:/ {print $2}') - echo "$m" -} - -# Send the notification -send_notification() { - local pct mute icon bar - pct=$(get_volume_percent) - mute=$(get_mute_state) - - if [[ "$mute" == "yes" ]]; then - icon="$ICON_MUTED" - # we can treat volume as 0 - pct=0 - else - # pick icon based on level - if (( pct >= 66 )); then - icon="$ICON_HIGH" - elif (( pct >= 33 )); then - icon="$ICON_MED" - else - icon="$ICON_LOW" - fi - fi - - # Optional: build a simple textual bar (e.g., █ or ░) - # e.g., length 20, filled proportionally - local barlen=20 - local filled=$(( (pct * barlen) / 100 )) - bar=$(printf '%*s' "$filled" '' | tr ' ' '█') - bar+=$(printf '%*s' "$((barlen - filled))" '' | tr ' ' '░') - - # Send notification: use value hint for progress bar - dunstify -i "$icon" \ - -u normal \ - -h string:x-dunst-stack-tag:$STACK_TAG \ - -h int:value:$pct "Volume: ${pct}%" -} - -# Main logic -case "$1" in - up) - vol_up - send_notification - ;; - down) - vol_down - send_notification - ;; - mute) - vol_mute - send_notification - ;; - *) - echo "Usage: $0 {up|down|mute}" - exit 1 - ;; -esac -