#!/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__