summaryrefslogtreecommitdiffstats
path: root/.local
diff options
context:
space:
mode:
Diffstat (limited to '.local')
-rwxr-xr-x.local/bin/dmpass31
-rwxr-xr-x.local/bin/dmpc4
-rwxr-xr-x.local/bin/dmscrot3
3 files changed, 36 insertions, 2 deletions
diff --git a/.local/bin/dmpass b/.local/bin/dmpass
new file mode 100755
index 0000000..8fd3568
--- /dev/null
+++ b/.local/bin/dmpass
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+typeit=0
+if [ "$1" = "--type" ]; then
+ typeit=1
+ shift
+fi
+
+if [ -n "$WAYLAND_DISPLAY" ]; then
+ dmenu=dmenu-wl
+ xdotool="ydotool type --file -"
+elif [ -n "$DISPLAY" ]; then
+ dmenu=dmenu
+ xdotool="xdotool type --delay 25 --clearmodifiers --file -"
+else
+ echo "Error: No Wayland or X11 display detected" >&2
+ exit 1
+fi
+
+prefix=${PASSWORD_STORE_DIR-~/.local/share/pass}
+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 -m 0)
+
+[ -n "$password" ] || exit
+
+if [ $typeit -eq 0 ]; then
+ pass show -c "$password" >/dev/null 2>&1
+else
+ pass show "$password" | { IFS= read -r pass; printf %s "$pass"; } | $xdotool
+fi
diff --git a/.local/bin/dmpc b/.local/bin/dmpc
index 782d76e..b22e678 100755
--- a/.local/bin/dmpc
+++ b/.local/bin/dmpc
@@ -10,7 +10,7 @@ sub main
my $prompt;
my $queued;
- $current = `mpc -h localhost current`;
+ $current = `mpc current`;
if (not $current) {
$current = 'Current: Stopped';
}
@@ -28,7 +28,7 @@ sub main
chomp $queued;
$prompt = "toggle\nnext\nprev\nplay\nstop\nclear\nrepeat\nrandom\n\n$current\n$queued\n";
$action = `printf "$prompt" | dmenu -i -l 11 -m 0`;
- system("mpc -h localhost " . $action);
+ system("mpc " . $action);
return;
}
diff --git a/.local/bin/dmscrot b/.local/bin/dmscrot
index 6029256..d35ea4e 100755
--- a/.local/bin/dmscrot
+++ b/.local/bin/dmscrot
@@ -113,6 +113,9 @@ sub action
'-a', '1920,180,1440,900'
);
}
+ else {
+ return;
+ }
show_img($file_name);
notify_img($file_name);
clip_img($file_name);