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