summaryrefslogtreecommitdiffstats
path: root/.local/bin/dmpc
blob: cb741beac25bd4f335eaa0756369c724dfbdf589 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env perl

use strict;
use warnings;

sub main
{
	my $action;
	my $current;
	my $prompt;
	my $queued;
	my $color;

	$color = '#cc241d';
	if (@ARGV == 1) {
		$color = $ARGV[0];
	}
	$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 {
		$queued = 'Next: ' . $queued;
	}
	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 -sb '$color' -shb '$color'`;
	system("mpc " . $action);
	return;
}

main();

__END__