diff options
Diffstat (limited to '.local/bin')
-rwxr-xr-x | .local/bin/dmapps | 6 | ||||
-rwxr-xr-x | .local/bin/dmlog | 6 | ||||
-rwxr-xr-x | .local/bin/dmpass | 12 | ||||
-rwxr-xr-x | .local/bin/dmrun | 6 | ||||
-rwxr-xr-x | .local/bin/linkview | 12 | ||||
-rwxr-xr-x | .local/bin/setwp | 42 |
6 files changed, 62 insertions, 22 deletions
diff --git a/.local/bin/dmapps b/.local/bin/dmapps index af0c26d..ccefc76 100755 --- a/.local/bin/dmapps +++ b/.local/bin/dmapps @@ -146,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/dmlog b/.local/bin/dmlog index d209ee5..7264d75 100755 --- a/.local/bin/dmlog +++ b/.local/bin/dmlog @@ -93,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'); } @@ -112,7 +112,7 @@ sub action exec(LOGINCTL_PATH, 'reboot'); } elsif (HOSTNAME eq 'po-rbo') { - exec('systemctl', 'reboot'); + exec('doas', 'systemctl', 'reboot'); } system( NOTIF_PATH, @@ -138,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'); } diff --git a/.local/bin/dmpass b/.local/bin/dmpass index affe65b..475b96e 100755 --- a/.local/bin/dmpass +++ b/.local/bin/dmpass @@ -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 ec928a4..d276634 100755 --- a/.local/bin/linkview +++ b/.local/bin/linkview @@ -388,9 +388,15 @@ sub open_link $pid = fork(); if (not $pid) { setsid(); - capture { - exec(COPYQ_PATH, "copy", $url); - }; + if (defined $ENV{WAYLAND_DISPLAY}) { + system("echo -n " . $url . " | wl-copy"); + exit(0); + } + else { + capture { + exec(COPYQ_PATH, "copy", $url); + }; + } } } return; 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; } |