#!/bin/perl use strict; use warnings; my $message="System (l) lock, (e) logout, (r) reboot, (s) shutdown"; my $screen_height=1080; my $message_height=34; my %actions; $actions{"l"} = "i3lock --ignore-empty-password --color 000000"; $actions{"e"} = "pkill leftwm"; $actions{"r"} = "systemctl reboot"; $actions{"s"} = "systemctl poweroff"; my @dzen_actions; while ((my $key, my $action) = each (%actions)){ push @dzen_actions, "key_$key=exit,exec:$action"; } my $joined_actions = join(";", @dzen_actions); print "$joined_actions"; `echo "$message" | dzen2 -h $message_height -p -y $screen_height -e "onstart=grabkeys;key_Escape=exit;key_Return=exit;button1=exit;$joined_actions"`;