added bitwarden support
This commit is contained in:
parent
0831ed6931
commit
3055ce0516
22
.scripts/bw-unlock
Executable file
22
.scripts/bw-unlock
Executable file
@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
##
|
||||||
|
# Depends: zenity
|
||||||
|
#
|
||||||
|
# Generates bw session key and saves it in tmp file where only current user has permissions
|
||||||
|
#
|
||||||
|
# By Solomon Laing (solomonlaing@pm.me)
|
||||||
|
# Date 2020-03-26
|
||||||
|
##
|
||||||
|
|
||||||
|
password=$(zenity --password)
|
||||||
|
|
||||||
|
session=$(bw unlock "$password" | awk 'NF{last=$NF} END{print last}')
|
||||||
|
|
||||||
|
loc="/tmp/bw-session"
|
||||||
|
|
||||||
|
touch $loc -f
|
||||||
|
|
||||||
|
chmod 600 $loc
|
||||||
|
|
||||||
|
echo "$session" > /tmp/bw-session
|
||||||
40
.scripts/passwords
Executable file
40
.scripts/passwords
Executable file
@ -0,0 +1,40 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
##
|
||||||
|
# Depends bw (bitwarden-cli), bw-unlock (personal script), xclip
|
||||||
|
#
|
||||||
|
# Processes bw to allow for searching of passwords by website (and if multple logins per website, by account).
|
||||||
|
#
|
||||||
|
# By Solomon Laing (solomonlaing@pm.me)
|
||||||
|
# Date 2020-03-26
|
||||||
|
##
|
||||||
|
|
||||||
|
# get bw-session, will only work if owned by current user
|
||||||
|
if ! session=$(cat /tmp/bw-session)
|
||||||
|
then
|
||||||
|
/home/solomon/.scripts/bw-unlock
|
||||||
|
session=$(cat /tmp/bw-session)
|
||||||
|
fi
|
||||||
|
|
||||||
|
items=$(bw list items --session "$session")
|
||||||
|
options=$(echo "$items" | jq ".[].name" | sed 's/"//g')
|
||||||
|
|
||||||
|
entry=$(echo "$options" | dmenu -i -p "Which entry?" $1)
|
||||||
|
|
||||||
|
if ! password=$(bw get password "$entry" --session "$session")
|
||||||
|
then
|
||||||
|
|
||||||
|
user_options=$(bw list items --search "$entry" --session "$session")
|
||||||
|
|
||||||
|
# does not return array, not sure why yet
|
||||||
|
# user_options=$(echo "$items" | jq '.[] | select(.name == "'"$entry"'") | .')
|
||||||
|
|
||||||
|
user=$(echo "$user_options" | jq '.[].login.username' | dmenu -i -p "Which account?" $1 | sed 's/"//g')
|
||||||
|
|
||||||
|
pass=$(echo "$user_options" | jq '.[] | select(.login.username == "'"$user"'") | .login.password' | sed 's/"//g')
|
||||||
|
|
||||||
|
echo "$pass" | xclip -sel clip
|
||||||
|
|
||||||
|
else
|
||||||
|
echo "$password" | xclip -sel clip
|
||||||
|
fi
|
||||||
@ -136,97 +136,112 @@ clickable ws = "<action=xdotool key super+"++show i++">"++ws++"</action>"
|
|||||||
|
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
-- Key bindings. Add, modify or remove key bindings here.
|
-- Key bindings. Add, modify or remove key bindings here.
|
||||||
|
-- These are general keybindings custom script bindings are not included.
|
||||||
myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
|
myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
|
||||||
|
|
||||||
-- launch a terminal
|
[
|
||||||
[ ((modm .|. shiftMask, xK_Return), spawn $ XMonad.terminal conf)
|
-- launch a terminal
|
||||||
|
((modm .|. shiftMask, xK_Return), spawn $ XMonad.terminal conf)
|
||||||
|
|
||||||
-- launch rofi
|
-- launch rofi
|
||||||
, ((modm, xK_a ), spawn "rofi -show run")
|
, ((modm, xK_a ), spawn "rofi -show run")
|
||||||
|
|
||||||
-- launch dmenu
|
-- launch dmenu
|
||||||
, ((modm, xK_o ), spawn "dmenu_run")
|
, ((modm, xK_o ), spawn "dmenu_run")
|
||||||
|
|
||||||
-- prompt computer shutdown
|
-- launch rofi ssh
|
||||||
, ((modm .|. shiftMask, xK_s ), spawn "/home/solomon/.scripts/prompt \"Are you sure you want to Shutdown?\" \"shutdown now\"")
|
, ((modm .|. shiftMask, xK_a ), spawn "rofi -show ssh")
|
||||||
|
|
||||||
-- prompt computer reboot
|
-- launch my file manager
|
||||||
, ((modm .|. shiftMask, xK_r ), spawn "/home/solomon/.scripts/prompt \"Are you sure you want to Restart?\" \"reboot\"")
|
, ((modm, xK_l ), spawn myFileManager)
|
||||||
|
|
||||||
-- prompt computer lock
|
-- close focused window
|
||||||
, ((modm .|. shiftMask, xK_l ), spawn "/home/solomon/.scripts/prompt \"Are you sure you want to lock?\" \"slock\"")
|
, ((modm .|. shiftMask, xK_j ), kill)
|
||||||
|
|
||||||
-- launch rofi ssh
|
-- Rotate through the available layout algorithms
|
||||||
, ((modm .|. shiftMask, xK_a ), spawn "rofi -show ssh")
|
, ((modm, xK_space ), sendMessage NextLayout)
|
||||||
|
|
||||||
-- launch my file manager
|
-- Reset the layouts on the current workspace to default
|
||||||
, ((modm, xK_l ), spawn myFileManager)
|
, ((modm .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook conf)
|
||||||
|
|
||||||
-- close focused window
|
-- Resize viewed windows to the correct size
|
||||||
, ((modm .|. shiftMask, xK_j ), kill)
|
, ((modm, xK_b ), refresh)
|
||||||
|
|
||||||
-- Rotate through the available layout algorithms
|
-- Move focus to the next window
|
||||||
, ((modm, xK_space ), sendMessage NextLayout)
|
, ((modm, xK_Tab ), windows W.focusDown)
|
||||||
|
|
||||||
-- Reset the layouts on the current workspace to default
|
-- Move focus to the next window
|
||||||
, ((modm .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook conf)
|
, ((modm .|. shiftMask, xK_Tab ), windows W.focusUp)
|
||||||
|
|
||||||
-- Resize viewed windows to the correct size
|
-- Move focus to the next window
|
||||||
, ((modm, xK_b ), refresh)
|
, ((modm, xK_h ), windows W.focusDown)
|
||||||
|
|
||||||
-- Move focus to the next window
|
-- Move focus to the previous window
|
||||||
, ((modm, xK_Tab ), windows W.focusDown)
|
, ((modm, xK_t ), windows W.focusUp )
|
||||||
|
|
||||||
-- Move focus to the next window
|
-- Move focus to the master window
|
||||||
, ((modm .|. shiftMask, xK_Tab ), windows W.focusUp)
|
, ((modm, xK_m ), windows W.focusMaster )
|
||||||
|
|
||||||
-- Move focus to the next window
|
-- Swap the focused window and the master window
|
||||||
, ((modm, xK_h ), windows W.focusDown)
|
, ((modm, xK_Return), windows W.swapMaster)
|
||||||
|
|
||||||
-- Move focus to the previous window
|
-- Swap the focused window with the next window
|
||||||
, ((modm, xK_t ), windows W.focusUp )
|
, ((modm .|. shiftMask, xK_Down ), windows W.swapDown )
|
||||||
|
|
||||||
-- Move focus to the master window
|
-- Swap the focused window with the previous window
|
||||||
, ((modm, xK_m ), windows W.focusMaster )
|
, ((modm .|. shiftMask, xK_Up ), windows W.swapUp )
|
||||||
|
|
||||||
-- Swap the focused window and the master window
|
-- Shrink the master area
|
||||||
, ((modm, xK_Return), windows W.swapMaster)
|
, ((modm, xK_Left ), sendMessage Shrink)
|
||||||
|
|
||||||
-- Swap the focused window with the next window
|
-- Expand the master area
|
||||||
, ((modm .|. shiftMask, xK_Down ), windows W.swapDown )
|
, ((modm, xK_Right ), sendMessage Expand)
|
||||||
|
|
||||||
-- Swap the focused window with the previous window
|
-- Push window back into tiling
|
||||||
, ((modm .|. shiftMask, xK_Up ), windows W.swapUp )
|
, ((modm, xK_y ), withFocused $ windows . W.sink)
|
||||||
|
|
||||||
-- Shrink the master area
|
-- Increment the number of windows in the master area
|
||||||
, ((modm, xK_Left ), sendMessage Shrink)
|
, ((modm , xK_w ), sendMessage (IncMasterN 1))
|
||||||
|
|
||||||
-- Expand the master area
|
-- Deincrement the number of windows in the master area
|
||||||
, ((modm, xK_Right ), sendMessage Expand)
|
, ((modm , xK_v), sendMessage (IncMasterN (-1)))
|
||||||
|
|
||||||
-- Push window back into tiling
|
-- Toggle the status bar gap
|
||||||
, ((modm, xK_y ), withFocused $ windows . W.sink)
|
-- Use this binding with avoidStruts from Hooks.ManageDocks.
|
||||||
|
-- See also the statusBar function from Hooks.DynamicLog.
|
||||||
|
--
|
||||||
|
, ((modm , xK_b ), sendMessage ToggleStruts)
|
||||||
|
|
||||||
-- Increment the number of windows in the master area
|
-- Quit xmonad
|
||||||
, ((modm , xK_w ), sendMessage (IncMasterN 1))
|
, ((modm .|. shiftMask, xK_apostrophe ), io (exitWith ExitSuccess))
|
||||||
|
|
||||||
-- Deincrement the number of windows in the master area
|
-- Restart xmonad
|
||||||
, ((modm , xK_v), sendMessage (IncMasterN (-1)))
|
, ((modm , xK_apostrophe ), spawn "xmonad --recompile; xmonad --restart")
|
||||||
|
|
||||||
|
-- Run xmessage with a summary of the default keybindings (useful for beginners)
|
||||||
|
, ((modm .|. shiftMask, xK_z ), spawn ("echo \"" ++ help ++ "\" | xmessage -file -"))
|
||||||
|
]
|
||||||
|
++
|
||||||
|
|
||||||
-- Toggle the status bar gap
|
|
||||||
-- Use this binding with avoidStruts from Hooks.ManageDocks.
|
|
||||||
-- See also the statusBar function from Hooks.DynamicLog.
|
|
||||||
--
|
--
|
||||||
, ((modm , xK_b ), sendMessage ToggleStruts)
|
-- these are my general custom bindings and scripts
|
||||||
|
--
|
||||||
|
[
|
||||||
|
-- prompt computer shutdown
|
||||||
|
, ((modm .|. shiftMask, xK_s ), spawn "/home/solomon/.scripts/prompt \"Are you sure you want to Shutdown?\" \"shutdown now\"")
|
||||||
|
|
||||||
-- Quit xmonad
|
-- prompt computer reboot
|
||||||
, ((modm .|. shiftMask, xK_apostrophe ), io (exitWith ExitSuccess))
|
, ((modm .|. shiftMask, xK_r ), spawn "/home/solomon/.scripts/prompt \"Are you sure you want to Restart?\" \"reboot\"")
|
||||||
|
|
||||||
-- Restart xmonad
|
-- prompt computer lock
|
||||||
, ((modm , xK_apostrophe ), spawn "xmonad --recompile; xmonad --restart")
|
, ((modm .|. shiftMask, xK_l ), spawn "/home/solomon/.scripts/prompt \"Are you sure you want to lock?\" \"slock\"")
|
||||||
|
|
||||||
|
-- unlock bitwarden cli and store session key
|
||||||
|
, ((modm .|. shiftMask, xK_t ), spawn "/home/solomon/.scripts/bw-unlock")
|
||||||
|
|
||||||
|
-- search for password using bitwarden cli through dmenu
|
||||||
|
, ((modm, xK_t ), spawn "/home/solomon/.scripts/passwords")
|
||||||
|
|
||||||
-- Run xmessage with a summary of the default keybindings (useful for beginners)
|
|
||||||
, ((modm .|. shiftMask, xK_z ), spawn ("echo \"" ++ help ++ "\" | xmessage -file -"))
|
|
||||||
]
|
]
|
||||||
++
|
++
|
||||||
|
|
||||||
@ -267,8 +282,8 @@ myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
|
|||||||
-- increase backlight by 10 with mod+f9
|
-- increase backlight by 10 with mod+f9
|
||||||
((modm, xK_F9), spawn "backlight_control +5")
|
((modm, xK_F9), spawn "backlight_control +5")
|
||||||
|
|
||||||
-- decrese backlight by 10 with mod+f8x
|
-- decrese backlight by 10 with mod+f8x
|
||||||
,((modm, xK_F8), spawn "backlight_control -5")
|
,((modm, xK_F8), spawn "backlight_control -5")
|
||||||
]
|
]
|
||||||
++
|
++
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user