Skip to content

Instantly share code, notes, and snippets.

Created February 28, 2018 10:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/2a6b422ff1994d535d5f4a2a5b22cb1e to your computer and use it in GitHub Desktop.
Save anonymous/2a6b422ff1994d535d5f4a2a5b22cb1e to your computer and use it in GitHub Desktop.
{ lib, writeScriptBin, rofi }:
writeScriptBin "rofi-bookmarks" ''
BOOKMARKS_FILE="$XDG_DATA_HOME/bookmarks"
read_bookmarks() {
sort -k1,1 -t '|' < "''${BOOKMARKS_FILE}" | column -t -s '|'
}
show_bookmarks() {
read_bookmarks | rofi -dmenu -i -p "Bookmarks: "
}
parse_url() {
awk '{print $NF}'
}
open_bookmark() {
''${BROWSER:-xdg-open} "$(show_bookmarks | parse_url)"
}
open_bookmark
''
{ lib, writeScriptBin, rofi, pass, xclip }:
writeScriptBin "rofi-pass" ''
#!/bin/sh
export PATH=${lib.makeBinPath [ rofi pass xclip ]}:$PATH
shopt -s nullglob globstar
password_files=(~/.data/pass/**/*.gpg)
password_files=("''${password_files[@]##*/.data/pass/}")
password_files=("''${password_files[@]%.gpg}")
password=$(printf '%s\n' "''${password_files[@]}" | rofi -dmenu -p "Search password: " "$@")
env > /tmp/1
PASSWORD_STORE_DIR=$XDG_DATA_HOME/pass PASSWORD_STORE_X_SELECTION=clipboard pass -c "$password"
''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment