diff options
Diffstat (limited to '')
-rwxr-xr-x | .local/bin/dmapps | 95 | ||||
-rwxr-xr-x | .local/bin/status/sb-cpu | 2 | ||||
-rwxr-xr-x | .local/bin/status/sb-mpd | 1 | ||||
-rwxr-xr-x | .local/bin/status/sb-volume | 2 |
4 files changed, 99 insertions, 1 deletions
diff --git a/.local/bin/dmapps b/.local/bin/dmapps new file mode 100755 index 0000000..f3cc78d --- /dev/null +++ b/.local/bin/dmapps @@ -0,0 +1,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__ diff --git a/.local/bin/status/sb-cpu b/.local/bin/status/sb-cpu index 3eba1cb..169b24d 100755 --- a/.local/bin/status/sb-cpu +++ b/.local/bin/status/sb-cpu @@ -12,7 +12,7 @@ printf " " case $(hostname -s) in mother|po-rbo) stats=$(uptime | head -n1) - printf "%s " "$(echo "$stats" | sed 's/.*average: *//;s/,.*//')" + printf "%s" "$(echo "$stats" | sed 's/.*average: *//;s/,.*//')" return ;; mars) diff --git a/.local/bin/status/sb-mpd b/.local/bin/status/sb-mpd index e5f6745..21bf2c7 100755 --- a/.local/bin/status/sb-mpd +++ b/.local/bin/status/sb-mpd @@ -1,5 +1,6 @@ #!/bin/sh +return mp=$(mpc status) icon=$(echo "$mp" | sed -n 2p | sed -E 's/(^|\])[^[]*($|\[)//g') case $icon in diff --git a/.local/bin/status/sb-volume b/.local/bin/status/sb-volume index 402431d..bc1ca97 100755 --- a/.local/bin/status/sb-volume +++ b/.local/bin/status/sb-volume @@ -1,5 +1,7 @@ #!/bin/sh +[ $(hostname -s) = "mars" ] || return + vol="$(mixer vol | awk '{print $7}' | cut -d ':' -f1)" if [ "$vol" -gt "0" ]; then |