Skip to content

Commit

Permalink
Merge pull request #9 from Mange/rofi-options
Browse files Browse the repository at this point in the history
Support passing options to rofi
  • Loading branch information
mattydebie authored Feb 19, 2019
2 parents 61c76a2 + 0d6516a commit 9229c40
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ You can either execute the script from a terminal or by binding it to a key
combination in your window manager.

```
bwmenu 0.1
bwmenu 0.2
Usage:
bwmenu [options]
bwmenu [options] -- [rofi options]
Options:
--help
Expand Down Expand Up @@ -55,6 +55,9 @@ Examples:
# XDG-compatible state location
bwmenu --state-path=${XDG_RUNTIME_DIR}/bwmenu-state
# Place rofi on top of screen, like a Quake console
bwmenu -- -location 2
```


Expand Down
16 changes: 12 additions & 4 deletions bwmenu
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
# Rofi extension for BitWarden-cli
NAME="$(basename "$0")"
VERSION="0.1"
VERSION="0.2"
DEFAULT_CLEAR=5

# Options
Expand All @@ -15,6 +15,9 @@ ITEMS=
# Stores which command will be used to deal with clipboards
CLIPBOARD_MODE=

# Populated in parse_cli_arguments
ROFI_OPTIONS=()

# source the hash file to gain access to the BitWarden CLI
# Pre fetch all the items
load_items() {
Expand Down Expand Up @@ -47,8 +50,8 @@ rofi_menu() {
-kb-custom-1 alt+r \
-kb-custom-2 alt+n \
-kb-custom-3 alt+u \
-kb-custom-4 alt+c

-kb-custom-4 alt+c \
"${ROFI_OPTIONS[@]}"
}

# Show items in a rofi menu by name of the item
Expand Down Expand Up @@ -217,7 +220,7 @@ parse_cli_arguments() {
$NAME $VERSION
Usage:
$NAME [options]
$NAME [options] -- [rofi options]
Options:
--help
Expand Down Expand Up @@ -256,6 +259,9 @@ Examples:
# XDG-compatible state location
$NAME --state-path=\${XDG_RUNTIME_DIR}/bwmenu-state
# Place rofi on top of screen, like a Quake console
$NAME -- -location 2
USAGE
shift
exit 0
Expand All @@ -282,6 +288,8 @@ USAGE
shift 2
;;
-- )
shift
ROFI_OPTIONS=("$@")
break
;;
* )
Expand Down

0 comments on commit 9229c40

Please sign in to comment.