diff options
Diffstat (limited to '.local/bin')
-rwxr-xr-x | .local/bin/dmapps | 215 | ||||
-rwxr-xr-x | .local/bin/dmbookm | 5 | ||||
-rwxr-xr-x | .local/bin/dmlog | 40 | ||||
-rwxr-xr-x | .local/bin/dmotp | 8 | ||||
-rwxr-xr-x | .local/bin/dmpass | 20 | ||||
-rwxr-xr-x | .local/bin/dmrun | 6 | ||||
-rwxr-xr-x | .local/bin/linkview | 25 | ||||
-rwxr-xr-x | .local/bin/setwp | 42 |
8 files changed, 165 insertions, 196 deletions
diff --git a/.local/bin/dmapps b/.local/bin/dmapps index 51b0625..ccefc76 100755 --- a/.local/bin/dmapps +++ b/.local/bin/dmapps @@ -2,9 +2,9 @@ use strict; use warnings; +use feature qw/switch/; use Data::Dump qw(dump); use POSIX qw(setsid); -use Switch; use Sys::Hostname qw(hostname); use constant PROG_LIST => "" . @@ -23,6 +23,7 @@ use constant PROG_LIST => "" . "Stellarium" . "\n" . "Google Earth" . "\n" . "DBeaver" . "\n" . +"OnlyOffice" . "\n" . "--- Editors ---" . "\n" . "NeoVim" . "\n" . "Emacs" . "\n" . @@ -77,161 +78,57 @@ sub run $pid = fork(); exit if $pid; setsid(); - switch ($action) { - case "Terminal" { - exec("alacritty"); - } - case "File manager" { - exec("pcmanfm"); - } - case "Web browser" { - exec("firefox"); - } - case "Mail client" { - exec("thunderbird"); - } - case "Arduino" { - exec("arduino-ide"); - } - case "cool-retro-term" { - exec("cool-retro-term"); - } - case "Qalculate!" { - exec("qalculate-gtk"); - } - case "Kleopatra" { - exec("kleopatra"); - } - case "Transmission" { - exec("transmission-gtk"); - } - case "Wireshark" { - exec("doas", "wireshark"); - } - case "MKVToolNix" { - exec("mkvtoolnix-gui"); - } - case "Stellarium" { - exec("stellarium"); - } - case "Google Earth" { - exec("google-earth-pro"); - } - case "NeoVim" { - exec("alacritty", "-e", "nvim"); - } - case "Emacs" { - exec("emacs"); - } - case "Emacs-NoX" { - exec("alacritty", "-e", "emacs-nw"); - } - case "GIMP - GNU Image Manipulation Program" { - exec("gimp"); - } - case "Inkscape" { - exec("inkscape"); - } - case "LibreWolf" { - exec("librewolf"); - } - case "Firefox" { - exec("firefox"); - } - case "Iridium" { - exec("iridium", "--force-dark-mode"); - } - case "Chromium" { - exec("chromium"); - } - case "Discord" { - exec("discord"); - } - case "Signal" { - exec("signal-desktop"); - } - case "Liferea" { - exec("liferea"); - } - case "HexChat" { - exec("hexchat"); - } - case "REAPER" { - exec("reaper"); - } - case "Audacity" { - exec("audacity"); - } - case "Pulse Control Panel" { - exec("pavucontrol"); - } - case "JACK Audio Connection Kit" { - exec("qjackctl"); - } - case "Ario" { - exec("ario"); - } - case "Kdenlive" { - exec("kdenlive"); - } - case "OBS Studio" { - exec("obs"); - } - case "Steam" { - exec("steam"); - } - case "Lutris" { - exec("lutris"); - } - case "GZDoom" { - exec("gzdoom"); - } - case "DOSBox" { - exec("dosbox"); - } - case "Mupen64Plus" { - exec("mupen64plus-qt"); - } - case "Cemu" { - exec("cemu"); - } - case "PCSX2" { - exec("pcsx2"); - } - case "RPCS3" { - exec("rpcs3"); - } - case "Remmina" { - exec("remmina"); - } - case "Rclone Browser" { - exec("rclone-browser"); - } - case "Insomnia" { - exec("insomnia"); - } - case "VMware" { - exec("vmware"); - } - case "DBeaver" { - exec("dbeaver"); - } - case "MongoDB Compass" { - exec("nixGL", "mongodb-compass"); - } - case "Miro" { - exec("miro"); - } - case "FortiClient VPN" { - exec("/opt/forticlient/gui/FortiClient-linux-x64/FortiClient"); - } - case "Teams" { - exec("nixGL", "teams-for-linux"); - } - else { - return; - } - } + exec("alacritty") if $action =~ "Terminal"; + exec("pcmanfm") if $action =~ "File manager"; + exec("firefox") if $action =~ "Web browser"; + exec("thunderbird") if $action =~ "Mail client"; + exec("arduino-ide") if $action =~ "Arduino"; + exec("cool-retro-term") if $action =~ "cool-retro-term"; + exec("qalculate-gtk") if $action =~ "Qalculate!"; + exec("kleopatra") if $action =~ "Kleopatra"; + exec("transmission-gtk") if $action =~ "Transmission"; + exec("doas", "wireshark") if $action =~ "Wireshark"; + exec("mkvtoolnix-gui") if $action =~ "MKVToolNix"; + exec("stellarium") if $action =~ "Stellarium"; + exec("google-earth-pro") if $action =~ "Google Earth"; + exec("alacritty", "-e", "nvim") if $action =~ "NeoVim"; + exec("emacs") if $action =~ "Emacs"; + exec("alacritty", "-e", "emacs-nw") if $action =~ "Emacs-NoX"; + exec("gimp") if $action =~ "GIMP - GNU Image Manipulation Program"; + exec("inkscape") if $action =~ "Inkscape"; + exec("librewolf") if $action =~ "LibreWolf"; + exec("firefox") if $action =~ "Firefox"; + exec("iridium", "--force-dark-mode") if $action =~ "Iridium"; + exec("chromium") if $action =~ "Chromium"; + exec("discord") if $action =~ "Discord"; + exec("signal-desktop") if $action =~ "Signal"; + exec("liferea") if $action =~ "Liferea"; + exec("hexchat") if $action =~ "HexChat"; + exec("reaper") if $action =~ "REAPER"; + exec("audacity") if $action =~ "Audacity"; + exec("pavucontrol") if $action =~ "Pulse Control Panel"; + exec("qjackctl") if $action =~ "JACK Audio Connection Kit"; + exec("ario") if $action =~ "Ario"; + exec("kdenlive") if $action =~ "Kdenlive"; + exec("obs") if $action =~ "OBS Studio"; + exec("steam") if $action =~ "Steam"; + exec("lutris") if $action =~ "Lutris"; + exec("gzdoom") if $action =~ "GZDoom"; + exec("dosbox") if $action =~ "DOSBox"; + exec("mupen64plus-qt") if $action =~ "Mupen64Plus"; + exec("cemu") if $action =~ "Cemu"; + exec("pcsx2") if $action =~ "PCSX2"; + exec("rpcs3") if $action =~ "RPCS3"; + exec("remmina") if $action =~ "Remmina"; + exec("rclone-browser") if $action =~ "Rclone Browser"; + exec("insomnia") if $action =~ "Insomnia"; + exec("vmware") if $action =~ "VMware"; + exec("dbeaver") if $action =~ "DBeaver"; + exec("onlyoffice-desktopeditors") if $action =~ "OnlyOffice"; + exec("nixGL", "mongodb-compass") if $action =~ "MongoDB Compass"; + exec("miro") if $action =~ "Miro"; + exec("/opt/forticlient/gui/FortiClient-linux-x64/FortiClient") if $action =~ "FortiClient VPN"; + exec("nixGL", "teams-for-linux") if $action =~ "Teams"; return; } @@ -249,7 +146,11 @@ sub main if (hostname() eq "po-rbo.ln.ysosecure.com") { $prompt .= WORK_LIST; } - $action = `dmenu -i -l 100 -sb '$color' -shb '$color' <<LIST + my $menu = "dmenu -sb '$color' -shb '$color'"; + if (defined $ENV{WAYLAND_DISPLAY}) { + $menu = "wmenu -S '$color'"; + } + $action = `$menu -i -l 100 <<LIST $prompt LIST`; if (not $action) { diff --git a/.local/bin/dmbookm b/.local/bin/dmbookm index 90b7c74..22a9e52 100755 --- a/.local/bin/dmbookm +++ b/.local/bin/dmbookm @@ -15,6 +15,7 @@ use constant { use constant LIST => { graf => 'http://graf.joe.town/', zhinu => 'https://zhinu.jozan.org/', + claude => 'https://claude.ai', perplexity => 'https://perplexity.ai/', chatgpt => 'https://chatgpt.com/', discord => 'https://discord.com/', @@ -24,6 +25,7 @@ use constant LIST => { nua_gr_restops => 'https://grafana.nuabee.fr/d/Mz11bd07k/vue-d-ensemble-machines-atelier', nua_gr_alertops => 'https://grafana.nuabee.fr/d/WojOgXTmk/ops-alerts', nua_git => 'https://gitlab.int.ysosecure.com/', + nua_pipes => 'https://gitlab.int.ysosecure.com/ops/NuaProv/-/pipelines', nua_mbs => 'https://mbs.nuabee.com/', nua_hedgedoc => 'http://hedgedoc.int.ysosecure.com/', nua_doc => 'https://doc.int.ysosecure.com/', @@ -31,9 +33,10 @@ use constant LIST => { nua_zammad => 'https://support.nuabee.fr/', nua_atlas => 'https://atlas.nuabee.fr/', nua_share => 'https://share.nuabee.fr/', + nua_windmill => 'https://windmill.nuabee.fr/', nua_aether => 'https://aether.int.ysosecure.com/ui', nua_gaia => 'https://gaia.int.ysosecure.com/', - nua_cert => 'https://orca1.int.ysosecure.com/certsrv', + nua_certsrv => 'https://orca1.int.ysosecure.com/certsrv', }; sub main diff --git a/.local/bin/dmlog b/.local/bin/dmlog index 756d9b9..7264d75 100755 --- a/.local/bin/dmlog +++ b/.local/bin/dmlog @@ -36,8 +36,13 @@ sub confirm for (@{+CONFIRM}) { $list .= $_ . "\n"; } + + my $menu = "dmenu -sb '$color' -shb '$color'"; + if (defined $ENV{WAYLAND_DISPLAY}) { + $menu = "wmenu -S '$color'"; + } $choice = `printf "%s" "$list" | \ - dmenu -i -p "$var?" -sb '$color' -shb '$color'`; + $menu -i -p "$var?"`; chomp $choice; if ($choice eq ${+CONFIRM}[1]) { return (1); @@ -52,12 +57,28 @@ sub action chomp $var; if ($var eq ${+LIST}[0]) { - exec(XSCREENSAVER_PATH, '-lock'); + if (defined $ENV{WAYLAND_DISPLAY}) { + exec("waylock", + "-init-color", "0x1d2021", + "-input-color", "0xd79921", + "-fail-color", "0xcc241d"); + } + else { + exec(XSCREENSAVER_PATH, '-lock'); + } } elsif ($var eq ${+LIST}[1]) { $pid = fork(); if (not $pid) { - exec(XSCREENSAVER_PATH, '-lock'); + if (defined $ENV{WAYLAND_DISPLAY}) { + exec("waylock", + "-init-color", "0x1d2021", + "-input-color", "0xd79921", + "-fail-color", "0xcc241d"); + } + else { + exec(XSCREENSAVER_PATH, '-lock'); + } } else { system( @@ -72,7 +93,7 @@ sub action exec(LOGINCTL_PATH, 'suspend'); } elsif (HOSTNAME eq 'po-rbo') { - exec('systemctl', 'suspend'); + exec('doas', 'systemctl', 'suspend'); } exec(ACPI_PATH, '-s', '3'); } @@ -91,7 +112,7 @@ sub action exec(LOGINCTL_PATH, 'reboot'); } elsif (HOSTNAME eq 'po-rbo') { - exec('systemctl', 'reboot'); + exec('doas', 'systemctl', 'reboot'); } system( NOTIF_PATH, @@ -117,7 +138,7 @@ sub action exec(LOGINCTL_PATH, 'poweroff'); } elsif (HOSTNAME eq 'po-rbo') { - exec('systemctl', 'poweroff'); + exec('doas', 'systemctl', 'poweroff'); } exec(SHUTDOWN_PATH, '-p', 'now'); } @@ -138,7 +159,12 @@ sub main for (@{+LIST}) { $list .= $_ . "\n"; } - $choice = `printf "%s" "$list" | dmenu -i -sb '$color' -shb '$color'`; + + my $menu = "dmenu -sb '$color' -shb '$color'"; + if (defined $ENV{WAYLAND_DISPLAY}) { + $menu = "wmenu -S '$color'"; + } + $choice = `printf "%s" "$list" | $menu -i`; action($choice, $color); return (0); } diff --git a/.local/bin/dmotp b/.local/bin/dmotp index 97f015f..243f48c 100755 --- a/.local/bin/dmotp +++ b/.local/bin/dmotp @@ -6,10 +6,10 @@ if echo "$1" | grep '^#' 2>&1; then fi if [ -n "$WAYLAND_DISPLAY" ]; then - dmenu=dmenu-wl - xdotool="ydotool type --file -" + dmenu="wmenu -i -l 15 -S $color" + xdotool="ydotool type --delay 15 --file -" elif [ -n "$DISPLAY" ]; then - dmenu=dmenu + dmenu="dmenu -i -l 15 -sb $color -shb $color" xdotool="xdotool type --delay 15 --clearmodifiers --file -" else echo "Error: No Wayland or X11 display detected" >&2 @@ -19,7 +19,7 @@ fi prefix=${PASSWORD_STORE_DIR-~/.local/share/pass}/otp rprefix=$(printf "%s" $prefix | sed 's/\//\\\//g') password_files=$(ls "$prefix"/*.gpg | sed 's/^'${rprefix}'\///g' | sed 's/\.gpg//g') -password=$(printf "%s\n" "${password_files}" | "$dmenu" -i -l 15 -sb "$color" -shb "$color") +password=$(printf "%s\n" "${password_files}" | $dmenu) [ -n "$password" ] || exit diff --git a/.local/bin/dmpass b/.local/bin/dmpass index d5b0494..475b96e 100755 --- a/.local/bin/dmpass +++ b/.local/bin/dmpass @@ -13,10 +13,10 @@ fi if [ -n "$WAYLAND_DISPLAY" ]; then - dmenu=dmenu-wl - xdotool="ydotool type --file -" + dmenu="wmenu -i -l 15 -S $color" + xdotool="ydotool type --delay 15 --file -" elif [ -n "$DISPLAY" ]; then - dmenu=dmenu + dmenu="dmenu -i -l 15 -sb $color -shb $color" xdotool="xdotool type --delay 15 --clearmodifiers --file -" else echo "Error: No Wayland or X11 display detected" >&2 @@ -26,7 +26,7 @@ fi prefix=${PASSWORD_STORE_DIR-~/.local/share/pass} rprefix=$(printf "%s" $prefix | sed 's/\//\\\//g') password_files=$(ls "$prefix"/*.gpg "$prefix"/*/*.gpg | sed 's/^'${rprefix}'\///g' | sed 's/\.gpg//g') -password=$(printf "%s\n" "${password_files}" | "$dmenu" -i -l 15 -sb "$color" -shb "$color") +password=$(printf "%s\n" "${password_files}" | $dmenu) [ -n "$password" ] || exit @@ -35,9 +35,17 @@ p="$(pass show "$password")" if [ $full -eq 1 ]; then id=$(printf "%s" "$password" | sed 's/.*___//') printf "%s\n" $id | { IFS= read -r pass; printf %s "$id"; } | $xdotool - xdotool key Tab + if [ -n "$WAYLAND_DISPLAY" ]; then + ydotool key 15:1 15:0 + else + xdotool key Tab + fi printf "%s\n" "$p" | { IFS= read -r pass; printf %s "$pass"; } | $xdotool - xdotool key Return + if [ -n "$WAYLAND_DISPLAY" ]; then + ydotool key 28:1 28:0 + else + xdotool key Return + fi exit fi diff --git a/.local/bin/dmrun b/.local/bin/dmrun index f47c232..41c0e0e 100755 --- a/.local/bin/dmrun +++ b/.local/bin/dmrun @@ -11,7 +11,11 @@ sub main if (@ARGV == 1) { $color = $ARGV[0]; } - return exec("dmenu_run -i -sb '$color' -shb '$color'"); + my $menu = "dmenu_run -sb '$color' -shb '$color'"; + if (defined $ENV{WAYLAND_DISPLAY}) { + $menu = "wmenu-run -S '$color'"; + } + return exec("$menu -i"); } main(); diff --git a/.local/bin/linkview b/.local/bin/linkview index 1523e33..ec928a4 100755 --- a/.local/bin/linkview +++ b/.local/bin/linkview @@ -14,13 +14,20 @@ use POSIX qw(setsid); use feature qw(switch); no warnings qw(experimental::smartmatch); +my $menu = "dmenu"; +my $IMGVIEW_PATH = 'nsxiv -b -a'; + +if (defined $ENV{WAYLAND_DISPLAY}) { + $menu = "wmenu"; + $IMGVIEW_PATH = 'imv'; +} + use constant { TERMINAL_PATH => $TERMINAL, MPV_PATH => 'mpv', YTDL_PATH => 'yt-dlp', FETCH_PATH => 'fetch', CURL_PATH => 'curl', - IMGVIEW_PATH => 'nsxiv', ZATHURA_PATH => 'zathura', W3M_PATH => 'w3m', BROWSER_PATH => $BROWSER, @@ -34,7 +41,7 @@ use constant PROG_LIST => "" . "ytdl" . "\n" . "ytdl thumbnail" . "\n" . "fetch" . "\n" . -"nsxiv" . "\n" . +"img" . "\n" . "zathura" . "\n" . "w3m" . "\n" . "browser" . "\n" . @@ -88,7 +95,7 @@ sub open_link $ret = -1; if ($a eq "ytdl") { $list = QUAL_LIST; - $quality = `printf "$list" | dmenu -i -l 8`; + $quality = `printf "$list" | $menu -l 8`; if (not $quality) { exit 0; } @@ -328,12 +335,14 @@ sub open_link $file_name = $tmp; $file_name =~ s/.+\///g; chomp $file_name; - system(IMGVIEW_PATH, '-b', '-a', $file_name); + system("magick", $file_name, $file_name . ".jpg"); + system($IMGVIEW_PATH . " " . $file_name . ".jpg"); unlink($file_name); + unlink($file_name . ".jpg"); exit 0; } } - elsif ($a eq "nsxiv" || $a eq "zathura") { + elsif ($a eq "img" || $a eq "zathura") { $pid = fork(); if (not $pid) { setsid(); @@ -355,8 +364,8 @@ sub open_link system(FETCH_PATH, '-q', $url); } } - if ($a eq "nsxiv") { - exec(IMGVIEW_PATH, '-b', '-a', $file_name); + if ($a eq "img") { + exec($IMGVIEW_PATH . " " . $file_name); } else { exec(ZATHURA_PATH, $file_name); @@ -393,7 +402,7 @@ sub dmenu_prompt my $answer; my $list = PROG_LIST; - $answer = `printf "$list\nURL: $url\n" | dmenu -i`; + $answer = `printf "$list\nURL: $url\n" | $menu -i`; chomp $answer; return $answer; } diff --git a/.local/bin/setwp b/.local/bin/setwp index e5fce65..5340138 100755 --- a/.local/bin/setwp +++ b/.local/bin/setwp @@ -5,6 +5,7 @@ use warnings; use File::HomeDir qw(home); use File::Copy; use File::Find; +use POSIX qw(setsid); use constant { WP_POOL => home() . '/pics/wp/' @@ -37,20 +38,37 @@ sub choose_wp sub set_wp { my ($wp) = @_; + my $pid; + my $old_pid; return 1 if !(-r $wp) || !(-f $wp); - system( - FEH_PATH, - '--no-fehbg', - '--image-bg', - '#1d2021', - '--bg-fill', - $wp, - '--bg-fill', - $wp, - '--bg-fill', - $wp - ); + + if (defined $ENV{WAYLAND_DISPLAY}) { + $old_pid = `pidof swaybg`; + chomp $old_pid; + $pid = fork(); + if (not $pid) { + setsid(); + exec("swaybg", "--image", $wp); + } else { + sleep(1); + exec("kill", $old_pid); + } + } + else { + system( + FEH_PATH, + '--no-fehbg', + '--image-bg', + '#1d2021', + '--bg-fill', + $wp, + '--bg-fill', + $wp, + '--bg-fill', + $wp + ); + } return 0; } |