diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-11-06 18:57:20 +0100 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-11-06 18:57:20 +0100 |
commit | de192f1db36948a59994350bf3b03d1859e0a01c (patch) | |
tree | e739eba345e39cf11c19937f8f0a85c9a920ed95 /.local | |
parent | dmpc done (diff) | |
download | dotfiles-bsd-de192f1db36948a59994350bf3b03d1859e0a01c.tar.gz dotfiles-bsd-de192f1db36948a59994350bf3b03d1859e0a01c.tar.bz2 dotfiles-bsd-de192f1db36948a59994350bf3b03d1859e0a01c.tar.xz dotfiles-bsd-de192f1db36948a59994350bf3b03d1859e0a01c.tar.zst dotfiles-bsd-de192f1db36948a59994350bf3b03d1859e0a01c.zip |
dmpc is good
Diffstat (limited to '')
-rwxr-xr-x | .local/bin/dmpc | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/.local/bin/dmpc b/.local/bin/dmpc index 0e3f826..311a30d 100755 --- a/.local/bin/dmpc +++ b/.local/bin/dmpc @@ -1,21 +1,33 @@ #!/usr/local/bin/perl +use strict; +use warnings; + sub main { my $action; my $current; my $prompt; + my $queued; - $current = `mpc`; - if ($current =~ /volume: n\/a/) { - $current = "Current: Stopped"; + $current = `mpc current`; + if (not $current) { + $current = 'Current: Stopped'; + } + else { + $current = 'Current: ' . $current; + } + $queued = `mpc queued`; + if ($current eq 'Current: Stopped' || not $queued) { + $queued = 'Next: None'; } else { - $current =~ /$\.+/d; - $current = "Current: " . $current; + $queued = 'Next: ' . $queued; } - $prompt = "toggle\nstop\nnext\nprev\n$current\n"; - $action = `printf '$prompt' | dmenu`; + chomp $current; + chomp $queued; + $prompt = "toggle\nnext\nprev\nplay\nstop\nclear\nrepeat\nrandom\n\n$current\n$queued\n"; + $action = `printf '$prompt' | dmenu -i -l 11 -m 0`; system("mpc " . $action); return; } |