Skip to content

Instantly share code, notes, and snippets.

Created February 28, 2018 10:18

Revisions

  1. @invalid-email-address Anonymous created this gist Feb 28, 2018.
    24 changes: 24 additions & 0 deletions rofi-bookmarks.nix
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,24 @@
    { 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
    ''
    13 changes: 13 additions & 0 deletions rofi-pass.nix
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    { 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"
    ''