mattydebie/bitwarden-rofi

Accept all options that rofi accepts

fnune opened this issue · 9 comments

fnune commented

Currently I have the issue that when I open bwmenu all the sites for which I have a password are visible. This is a privacy issue for me and I don't want others to be able to see it. My idea was to use the -lines option rofi enables, but I can't pass rofi options to bwmenu.

bwmenu could parse all arguments rofi accepts and pass them to the rofi call.

If I have some time I'll gladly work on implementing this, but I'd like to get an approval from the project maintainers first.

Hi @brainlessdeveloper thanks for the interest in bitwarden-rofi!
I can understand why you'd want to limit the amount of lines shown, so that's a go for sure.

You could try and send all the options bwmenu does not know to rofi. This way we won't have to add new rofi flags to bwmenu every time.. What's your take on this?

# example
bwmenu -c 5 -lines 2 
# above would show a notification for 5 seconds and call rofi with args '-lines 2'
fnune commented

Exactly, my suggestion was to have bwmenu extend the arguments rofi accepts by just passing them over just like you mentioned.

fnune commented

And of course to avoid needing to implement extra stuff on bwmenu, apart from the option fall-through.

I'd be interested in a patch like this 😁

fnune commented

I'll take a look at it during the weekend :) I'm quite busy nowadays.

Thanks for the tool btw!

Mange commented

Another common convention is --.

bwmenu [OPTIONS] -- [ROFI_OPTIONS]

Example:

bwmenu --seconds 10 -- -lines 2

I think this is a working implementation of that:

rofi_menu() {
  rofi -dmenu -p 'Name' \
    -i -no-custom \
    -mesg ' <b>Alt+r</b>: sync | <b>Alt+u</b>: urls | <b>Alt+n</b>: names | <b>Alt+c</b>: folders' \
    -kb-custom-1 alt+r \
    -kb-custom-2 alt+n \
    -kb-custom-3 alt+u \
    -kb-custom-4 alt+c \
     "$@"
}

I think this is indeed the correct way to do this.

fnune commented

yarn used to follow that convention:

yarn my-script-from-package-json -yarn-arg-1 -yarn-arg-2 -- -arg-for-my-script

They later switched to the same thing but without the --. I like the -- version too, anyway.

fnune commented

Another common convention is --.

bwmenu [OPTIONS] -- [ROFI_OPTIONS]

Example:

bwmenu --seconds 10 -- -lines 2

I think this is a working implementation of that:

rofi_menu() {
  rofi -dmenu -p 'Name' \
    -i -no-custom \
    -mesg ' <b>Alt+r</b>: sync | <b>Alt+u</b>: urls | <b>Alt+n</b>: names | <b>Alt+c</b>: folders' \
    -kb-custom-1 alt+r \
    -kb-custom-2 alt+n \
    -kb-custom-3 alt+u \
    -kb-custom-4 alt+c \
     "$@"
}

I tried your implementation and apparently it gets passed over character by character:

getopt: invalid option -- 'l'
getopt: invalid option -- 'i'
getopt: invalid option -- 'n'
getopt: invalid option -- 'e'
getopt: invalid option -- 's'

I don't know how to use getopt to do this though.