From 43b9abf927b1fc99d18d1c30f588768b03cc8233 Mon Sep 17 00:00:00 2001 From: Ian Adam Naval Date: Sat, 28 Mar 2015 02:00:50 -0400 Subject: [PATCH] Replace lpass with pass --- dwb/dwb.configdir/userscripts/lastpass.js | 73 ----------------------- i3/i3.dotfile/config | 6 +- 2 files changed, 4 insertions(+), 75 deletions(-) delete mode 100644 dwb/dwb.configdir/userscripts/lastpass.js diff --git a/dwb/dwb.configdir/userscripts/lastpass.js b/dwb/dwb.configdir/userscripts/lastpass.js deleted file mode 100644 index d49f691..0000000 --- a/dwb/dwb.configdir/userscripts/lastpass.js +++ /dev/null @@ -1,73 +0,0 @@ -//!javascript - -Signal.connect("documentLoaded", function(wv, frame) { - autofillForm(frame.document); -}); - -function fillUsername(doc, name, username) { - var box = doc.querySelector('input[name="' + name + '"]'); - if (!box) { - box = doc.querySelector("input[name*=user]"); - } - if (!box) { - box = doc.querySelector("input[name*=email]"); - } - if (!box) { - box = doc.querySelector("input[name*=account]"); - } - if (!box) { - box = doc.querySelector("input[type=email]"); - } - if (box) { - box.value = username; - } -} - -function fillPassword(doc, name, password) { - var box = doc.querySelector('input[name="' + name + '"]'); - if (!box) { - box = doc.querySelector("input[type=password]"); - } - if (box) { - box.value = password; - } -} - -function lastPassFind(url, callbacks) { - var cmd = "lpass find " + url; - system.spawn(cmd, { - onStdout: function(line) { - if (line.indexOf("Username: ") == 0) { - callbacks.onGetUsername(line.substr(10)); - } else if (line.indexOf("Password: ") == 0) { - callbacks.onGetPassword(line.substr(10)); - } else if (line.indexOf(': ') > -1) { - var name = line.substring(0, line.indexOf(': ')); - callbacks.onGetFieldName(line, name); - } - }, - }); -} - -function autofillForm(doc) { - var username, password; - lastPassFind(tabs.current.uri, { - onGetUsername: function (val) { - username = val; - fillUsername(doc, "", val); - }, - onGetPassword: function (val) { - password = val; - fillPassword(doc, "", val); - }, - onGetFieldName: function (line, name) { - if (username && line.indexOf(username) > -1) { - fillUsername(doc, name, username); - } - if (password && line.indexOf(password) > -1) { - fillPassword(doc, name, password); - } - } - }); -} - diff --git a/i3/i3.dotfile/config b/i3/i3.dotfile/config index ebc7a7f..ec7efa6 100644 --- a/i3/i3.dotfile/config +++ b/i3/i3.dotfile/config @@ -32,8 +32,10 @@ bindsym $mod+Shift+Return exec terminator bindsym $mod+q kill # start dmenu (a program launcher) #bindsym $mod+d exec dmenu_run -sb "#880000" -bindsym $mod+d exec --no-startup-id j4-dmenu-desktop --dmenu="dmenu -i -sb '#800' -nb '#252525' -fn 'Meslo LG S DZ-8' -hist ~/.dmenu_history -h 24" -bindsym $mod+Shift+d exec --no-startup-id dmenu_run -i -sb '#800' -nb '#252525' -fn 'Meslo LG S DZ-8' -hist ~/.dmenu_history -h 24 +bindsym $mod+d exec --no-startup-id j4-dmenu-desktop --dmenu="dmenu -i -sb '#800' -nb '#252525' -fn 'Meslo LG S DZ-8' -hist ~/.dmenu_history -h 22" +bindsym $mod+Shift+d exec --no-startup-id dmenu_run -i -sb '#800' -nb '#252525' -fn 'Meslo LG S DZ-8' -hist ~/.dmenu_history -h 22 +bindsym $mod+p exec --no-startup-id ~/.i3/passmenu --type -i -sb '#800' -nb '#252525' -fn 'Meslo LG S DZ-8' -hist ~/.passmenu_history --h 22 +bindsym $mod+Shift+p exec --no-startup-id ~/.i3/passmenu -i -sb '#800' -nb '#252525' -fn 'Meslo LG S DZ-8' -hist ~/.passmenu_history --h 22 # There also is the (new) i3-dmenu-desktop which only displays applications # shipping a .desktop file. It is a wrapper around dmenu, so you need that # installed.