add my own script and config

This commit is contained in:
lucy 2026-06-29 23:32:15 +02:00
commit e365e295f3
4 changed files with 32 additions and 13 deletions

View file

@ -49,6 +49,8 @@ clean:
install: $(BUILD_DIR)/$(BIN) install: $(BUILD_DIR)/$(BIN)
$(PRINTF) "INSTALL" $(INSTALL_DIR)/$(BIN) $(PRINTF) "INSTALL" $(INSTALL_DIR)/$(BIN)
$Qinstall -D -m 755 $< $(INSTALL_DIR)/$(BIN) $Qinstall -D -m 755 $< $(INSTALL_DIR)/$(BIN)
cp ./bat.sh /usr/local/bin
cp ./wp.sh /usr/local/bin
uninstall: uninstall:
$(PRINTF) "RM" $(INSTALL_DIR)/$(BIN) $(PRINTF) "RM" $(INSTALL_DIR)/$(BIN)

14
bat.sh Executable file
View file

@ -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

View file

@ -8,7 +8,7 @@
#define MAX_BLOCK_OUTPUT_LENGTH 45 #define MAX_BLOCK_OUTPUT_LENGTH 45
// Control whether blocks are clickable. // Control whether blocks are clickable.
#define CLICKABLE_BLOCKS 1 #define CLICKABLE_BLOCKS 0
// Control whether a leading delimiter should be prepended to the status. // Control whether a leading delimiter should be prepended to the status.
#define LEADING_DELIMITER 0 #define LEADING_DELIMITER 0
@ -18,16 +18,8 @@
// Define blocks for the status feed as X(icon, cmd, interval, signal). // Define blocks for the status feed as X(icon, cmd, interval, signal).
#define BLOCKS(X) \ #define BLOCKS(X) \
X("", "sb-mail", 600, 1) \ X(" ", "date +%H:%M:%S", 1, 1) \
X("", "sb-music", 0, 2) \ X(" ", "bat.sh", 1, 1) \
X("", "sb-disk", 1800, 3) \ X(" ", "wp.sh", 1, 1)
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)
#endif // CONFIG_H #endif // CONFIG_H

11
wp.sh Executable file
View file

@ -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%