aboutsummaryrefslogtreecommitdiff
path: root/bin/.local
diff options
context:
space:
mode:
authorBardofSprites <[email protected]>2024-10-28 23:25:28 -0400
committerBardofSprites <[email protected]>2024-10-28 23:25:28 -0400
commit20c736a0d13dd3d4e0ebeb2bc75682ef4ea1d3d5 (patch)
tree0cc18dea3b99a77678eb915961de97baede7242d /bin/.local
parent6d66f2c88e66a8cd6d315ebcb5b801f9c3afd367 (diff)
new music and clock scripts for dwmblocks
Diffstat (limited to 'bin/.local')
-rwxr-xr-xbin/.local/bin/scripts/status/music42
-rwxr-xr-xbin/.local/bin/scripts/status/time-clock28
2 files changed, 70 insertions, 0 deletions
diff --git a/bin/.local/bin/scripts/status/music b/bin/.local/bin/scripts/status/music
new file mode 100755
index 0000000..f59da89
--- /dev/null
+++ b/bin/.local/bin/scripts/status/music
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+# Music module script for dwmblocks
+
+truncate() {
+ echo "$1" | cut -c1-20
+}
+
+# Handle mouse events based on button clicks
+case $BLOCK_BUTTON in
+ 1) # Left click to pause/play
+ playerctl play-pause
+ pkill -RTMIN+10 "${STATUSBAR:-dwmblocks}" ;;
+ 2) # Middle click to open the music player
+ # Replace `your-music-player` with your actual music player command
+ emacs-launcher "music" & ;;
+ 3) # Right click to show notification
+ notify-send "🎵 Music Module
+- Left click to play/pause.
+- Middle click to open music player.
+- Right click to show current track." ;;
+ 4) # Scroll up to go back
+ playerctl previous
+ pkill -RTMIN+10 "${STATUSBAR:-dwmblocks}" ;;
+ 5) # Scroll down to skip
+ playerctl next
+ pkill -RTMIN+10 "${STATUSBAR:-dwmblocks}" ;;
+esac
+
+# Get current track info
+artist="$(playerctl metadata artist 2>/dev/null || echo "Unknown Artist")"
+title="$(playerctl metadata title 2>/dev/null || echo "No Track")"
+
+# Truncate artist and title to 15 characters
+truncated_artist=$(truncate "$artist")
+truncated_title=$(truncate "$title")
+
+# Format the output as "artist - title"
+current_track="$truncated_artist - $truncated_title"
+
+# Print the current track
+echo "$current_track"
diff --git a/bin/.local/bin/scripts/status/time-clock b/bin/.local/bin/scripts/status/time-clock
new file mode 100755
index 0000000..317683a
--- /dev/null
+++ b/bin/.local/bin/scripts/status/time-clock
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+clock=$(date '+%I')
+
+case "$clock" in
+ "00") icon="🕛" ;;
+ "01") icon="🕐" ;;
+ "02") icon="🕑" ;;
+ "03") icon="🕒" ;;
+ "04") icon="🕓" ;;
+ "05") icon="🕔" ;;
+ "06") icon="🕕" ;;
+ "07") icon="🕖" ;;
+ "08") icon="🕗" ;;
+ "09") icon="🕘" ;;
+ "10") icon="🕙" ;;
+ "11") icon="🕚" ;;
+ "12") icon="🕛" ;;
+esac
+
+case $BLOCK_BUTTON in
+ 1) emacs-launcher "agenda" ;;
+ 2) emacs-launcher "calendar" ;;
+ 3) notify-send "📅 Time/date module" "\- Left click to show Emacs agenda for the next
+- Middle click opens Emacs calendar" ;;
+esac
+
+date "+%Y %m %d (%a) | $icon %R:%S %p "