From b32ca1104280a1cc5ff39e2ea39071f4c29a7fde Mon Sep 17 00:00:00 2001 From: Andrew Date: Thu, 19 Dec 2024 17:51:22 +0000 Subject: [PATCH] [music_dmenu.sh]: Add music_dmenu.sh --- README.md | 1 + music_dmenu.sh | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100755 music_dmenu.sh diff --git a/README.md b/README.md index 4cfe1ba..5c640ec 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ - `hugo_post.sh`: simple script to create a new Hugo post with the directory structure `/content/blog/Post Title/index.md` instead of the default `/content/blog/Post Title.md` created when you run the command `hugo new content`. - `list_manual_pkgs.sh`: one-line script to list only the names of packages manually installed with the xbps package manager (the default Void package manager). + - `music_dmenu.sh`: script to play a specific artist, album, or track selected with dmenu - `play_music.sh`: simple script to play music albums based off the supplied artist & album name. - `qutebrowser_search.sh`: script that finds all the search engines defined in the qutebrowser `config.py` configuration file and makes them available for searching via dmenu, i.e. allow web searching with qutebrowser without having to wait for it to start up before you start your search. diff --git a/music_dmenu.sh b/music_dmenu.sh new file mode 100755 index 0000000..fb565e9 --- /dev/null +++ b/music_dmenu.sh @@ -0,0 +1,21 @@ +#!/bin/sh +# Script to play a specific artist, album, or track selected with dmenu + +music_dir="$HOME/media/music" + +answer="$(printf "Artist\nAlbum\nTrack" | dmenu -p "Play music by:")" + +artist="$(ls "$music_dir" | dmenu -p "Artist:")" + +if [ "$answer" = "Artist" ]; then + setsid umpv "$music_dir/$artist" & +else + album="$(ls "$music_dir/$artist" | dmenu -p "Album:")" + + if [ "$answer" = "Album" ]; then + setsid umpv "$music_dir/$artist/$album" & + else + track="$(ls "$music_dir/$artist/$album" | dmenu -p "Track:")" + setsid umpv "$music_dir/$artist/$album/$track" & + fi +fi