From 1b5102a1417f4d867a17ebda61c0727602b184af Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sat, 10 Nov 2018 17:31:30 -0500 Subject: remove the pass menu and my wrappers i use browserpass for most things now, and pass itself has gained the ability to use the clipboard and search for things since i wrote this --- bin/hush/pass | 88 ----------------------------------------------------------- xbindkeysrc | 6 ---- 2 files changed, 94 deletions(-) delete mode 100755 bin/hush/pass diff --git a/bin/hush/pass b/bin/hush/pass deleted file mode 100755 index fd4a9aa..0000000 --- a/bin/hush/pass +++ /dev/null @@ -1,88 +0,0 @@ -#!/usr/bin/env perl -use strict; -use warnings; - -my $PASS = '/usr/bin/pass'; - -my $cmd = $ARGV[0]; - -if ($cmd && $cmd eq 'search') { - shift @ARGV; - - chdir "$ENV{HOME}/.password-store" - or die "password store not initialized"; - - require Path::Class; - - my $pat_str = pop @ARGV; - my $pattern = qr/$pat_str/; - - my $username = grep { $_ eq '-u' } @ARGV; - @ARGV = grep { $_ ne '-u' } @ARGV; - - my $clipboard = grep { $_ eq '-c' || $_ eq '--clip' } @ARGV; - - my @found = Path::Class::Dir->new('.')->traverse(sub { - my ($file, $c) = @_; - return if $file eq '.git'; - return ( - $c->(), - ((-f $file && $file =~ s/\.gpg$// && $file =~ $pattern) - ? ($file) - : ()), - ); - }); - - if (@found < 1) { - die "No passwords found matching '$pat_str'\n"; - } - elsif (@found > 1) { - die "Ambiguous pattern '$pat_str': could match any of @found\n"; - } - else { - if (my $pass = `$PASS show '$found[0]'`) { - if ($username) { - if ($found[0] =~ m{^[^/]*/[^/]*/([^/]*)$}) { - my $user = $1; - if ($clipboard) { - clip($user); - } - else { - print "$user\n"; - } - } - else { - die "$found[0] has no username"; - } - } - - if ($clipboard) { - $pass =~ s/\n.*//s; - clip($pass); - } - else { - print $pass; - } - } - } -} -else { - exec { $PASS } $PASS, @ARGV -} - -sub clip { - my ($text) = @_; - my @pids; - for my $selection (qw(primary clipboard)) { - my $pid = fork; - if (!$pid) { - open my $fh, '|-', "timeout 1m xclip -loops 1 -quiet -selection $selection 2> /dev/null" - or die "couldn't run xclip"; - $fh->write("$text\n"); - $fh->close; - exit; - } - push @pids, $pid; - } - waitpid($_, 0) for @pids; -} diff --git a/xbindkeysrc b/xbindkeysrc index c47bdeb..b9dbffb 100644 --- a/xbindkeysrc +++ b/xbindkeysrc @@ -7,12 +7,6 @@ "xclip -o | xargs xdg-open" Mod4 + p -"dmenu -fn 'Misc Fixed:pixelsize=14' -p 'pass search' < /dev/null | xargs -I{} pass search -c {}" - Mod4 + i - -"dmenu -fn 'Misc Fixed:pixelsize=14' -p 'pass search -u' < /dev/null | xargs -I{} pass search -u -c {}" - Shift+Mod4 + i - "dmenu_run -fn 'Misc Fixed:pixelsize=14'" Mod4 + r -- cgit v1.2.3-54-g00ecf