summaryrefslogtreecommitdiffstats
path: root/.local/bin/dmpc
blob: b22e678c9701818378c7c720ed56dba5ece77e17 (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
#!/usr/local/bin/perl

use strict;
use warnings;

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

	$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 -m 0`;
	system("mpc " . $action);
	return;
}

main();

__END__