summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.config/sxhkd/sxhkdrc3
-rwxr-xr-x.local/bin/dmpc26
2 files changed, 22 insertions, 7 deletions
diff --git a/.config/sxhkd/sxhkdrc b/.config/sxhkd/sxhkdrc
index 8ccc417..db696df 100644
--- a/.config/sxhkd/sxhkdrc
+++ b/.config/sxhkd/sxhkdrc
@@ -106,6 +106,9 @@ super + 3
super + 4
/usr/local/bin/st -e /usr/local/bin/w3m https://start.duckduckgo.com/
+super + 0
+ /usr/home/jozan/.local/bin/dmpc >/dev/null 2>&1
+
{XF86AudioRaiseVolume}
/usr/home/jozan/.local/bin/mixer-set raise >/dev/null 2>&1
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;
}