#!/usr/bin/env perl use strict; use warnings; use Data::Dump qw(dump); use Env qw(TERMINAL); use POSIX qw(setsid); use Sys::Hostname qw(hostname); use constant PROG_LIST => "" . "Terminal" . "\n" . "File manager" . "\n" . "Web browser" . "\n" . "Mail client" . "\n" . "--- Accessories ---" . "\n" . "Qalculate!" . "\n" . "Kleopatra" . "\n" . "Transmission" . "\n" . "Wireshark" . "\n" . "MKVToolNix" . "\n" . "Google Earth" . "\n" . "--- Editors ---" . "\n" . "NeoVim" . "\n" . "Emacs" . "\n" . "Emacs-NoX" . "\n" . "" ; use constant WORK_LIST => "" . "--- Work ---" . "\n" . "Remmina" . "\n" . "Insomnia" . "\n" . "VMware" . "\n" . "miro" . "\n"; sub run { my ($action) = @_; my $pid; chomp($action); # Terminal if ($action eq "Terminal") { $pid = fork(); exit if $pid; setsid(); exec("alacritty"); } # File manager elsif ($action eq "File manager") { $pid = fork(); exit if $pid; setsid(); exec("pcmanfm"); } # Web browser elsif ($action eq "Web browser") { $pid = fork(); exit if $pid; setsid(); exec("librewolf"); } # Mail client elsif ($action eq "Mail client") { $pid = fork(); exit if $pid; setsid(); exec("thunderbird"); } # --- Accessories --- # Qalculate! elsif ($action eq "Qalculate!") { $pid = fork(); exit if $pid; setsid(); exec("qalculate-gtk"); } # Kleopatra elsif ($action eq "Kleopatra") { $pid = fork(); exit if $pid; setsid(); exec("kleopatra"); } # Transmission elsif ($action eq "Transmission") { $pid = fork(); exit if $pid; setsid(); exec("transmission-gtk"); } # Wireshark elsif ($action eq "Wireshark") { $pid = fork(); exit if $pid; setsid(); exec("doas", "wireshark"); } # MKVToolNix elsif ($action eq "MKVToolNix") { $pid = fork(); exit if $pid; setsid(); exec("mkvtoolnix-gui"); } # Google Earth elsif ($action eq "Google Earth") { $pid = fork(); exit if $pid; setsid(); exec("google-earth-pro"); } # --- Editors --- # NeoVim elsif ($action eq "NeoVim") { $pid = fork(); exit if $pid; setsid(); exec("alacritty", "-e", "nvim"); } # Emacs elsif ($action eq "Emacs") { $pid = fork(); exit if $pid; setsid(); exec("emacs"); } # Emacs-NoX elsif ($action eq "Emacs-NoX") { $pid = fork(); exit if $pid; setsid(); exec("alacritty", "-e", "emacs-nw"); } return; } sub main { my $action; my $prompt; $prompt = PROG_LIST; if (hostname() eq "po-rbo.ln.ysosecure.com") { $prompt .= WORK_LIST; } $action = `dmenu -i -l 25 -m 0 <