summaryrefslogtreecommitdiffstats
path: root/.local/bin/dmapps
blob: f3cc78df90073b86b7d328e5a56c0d4044265857 (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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/usr/bin/env perl

use strict;
use warnings;
use Data::Dump qw(dump);
use POSIX qw(setsid);
use Sys::Hostname;

use constant PROG_LIST	=> "" .
"Terminal"				. "\n" .
"File manager"			. "\n" .
"Web browser"			. "\n" .
"--- Accessories ---"	. "\n" .
"Qualculate!"			. "\n" .
"Kleopatra"				. "\n" .
"Transmission"			. "\n" .
"Wireshark"				. "\n" .
"MKVToolNix"			. "\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");
	}
	# --- Accessories ---
	# Qualculate!
	elsif ($action eq "Qualculate!") {
		$pid = fork();
		exit if $pid;
		setsid();
		exec("qualculate-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");
	}
	return;
}

sub main
{
	my $action;
	my $prompt;

	$prompt = PROG_LIST;
	$action = `printf "$prompt" | dmenu -i -l 25 -m 0`;
	if (not $action) {
		return;
	}
	run($action);
	return;
}

main();

__END__