From e365e295f38000d32589f3fa0e8e502d89646801 Mon Sep 17 00:00:00 2001 From: lucy Date: Mon, 29 Jun 2026 23:32:15 +0200 Subject: [PATCH] add my own script and config --- Makefile | 2 ++ bat.sh | 14 ++++++++++++++ config.h | 18 +++++------------- wp.sh | 11 +++++++++++ 4 files changed, 32 insertions(+), 13 deletions(-) create mode 100755 bat.sh create mode 100755 wp.sh diff --git a/Makefile b/Makefile index 635673e..a70bdb6 100644 --- a/Makefile +++ b/Makefile @@ -49,6 +49,8 @@ clean: install: $(BUILD_DIR)/$(BIN) $(PRINTF) "INSTALL" $(INSTALL_DIR)/$(BIN) $Qinstall -D -m 755 $< $(INSTALL_DIR)/$(BIN) + cp ./bat.sh /usr/local/bin + cp ./wp.sh /usr/local/bin uninstall: $(PRINTF) "RM" $(INSTALL_DIR)/$(BIN) diff --git a/bat.sh b/bat.sh new file mode 100755 index 0000000..1e01ab5 --- /dev/null +++ b/bat.sh @@ -0,0 +1,14 @@ +status=$(cat /sys/class/power_supply/BAT0/status) +level=$(cat /sys/class/power_supply/BAT0/capacity) + +case $status in + Full) + echo $level%o + ;; + Charging) + echo $level%+ + ;; + Discharging) + echo $level%- + ;; +esac diff --git a/config.h b/config.h index 0dbb2b0..781907b 100644 --- a/config.h +++ b/config.h @@ -2,13 +2,13 @@ #define CONFIG_H // String used to delimit block outputs in the status. -#define DELIMITER " " +#define DELIMITER " " // Maximum number of Unicode characters that a block can output. #define MAX_BLOCK_OUTPUT_LENGTH 45 // Control whether blocks are clickable. -#define CLICKABLE_BLOCKS 1 +#define CLICKABLE_BLOCKS 0 // Control whether a leading delimiter should be prepended to the status. #define LEADING_DELIMITER 0 @@ -18,16 +18,8 @@ // Define blocks for the status feed as X(icon, cmd, interval, signal). #define BLOCKS(X) \ - X("", "sb-mail", 600, 1) \ - X("", "sb-music", 0, 2) \ - X("", "sb-disk", 1800, 3) \ - X("", "sb-memory", 10, 4) \ - X("", "sb-swap", 10, 0) \ - X("", "sb-loadavg", 5, 5) \ - X("", "sb-mic", 0, 6) \ - X("", "sb-record", 0, 7) \ - X("", "sb-volume", 0, 8) \ - X("", "sb-battery", 5, 9) \ - X("", "sb-date", 1, 10) + X(" ", "date +%H:%M:%S", 1, 1) \ + X(" ", "bat.sh", 1, 1) \ + X(" ", "wp.sh", 1, 1) #endif // CONFIG_H diff --git a/wp.sh b/wp.sh new file mode 100755 index 0000000..a141182 --- /dev/null +++ b/wp.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +vol=$(echo "$(wpctl get-volume @DEFAULT_AUDIO_SINK@ | awk -F' ' '{print $2}') * 100" | bc) +status=$(wpctl get-volume @DEFAULT_AUDIO_SINK@ | grep -q "[MUTED]") + +if wpctl get-volume @DEFAULT_AUDIO_SINK@| grep -q "[MUTED]"; then + echo "mut": $vol% + exit +fi + +echo vol: $vol%