diff options
| -rwxr-xr-x | bin/.local/bin/scripts/status/music | 42 | ||||
| -rwxr-xr-x | bin/.local/bin/scripts/status/time-clock | 28 |
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 " |
