How to use rofi plugins with rofr.sh?

#1

How to use rofi plugins with the rofr.sh script?

#2

Can you show us the script ? If as I suppose you’re talking about rofi_run it should be like this for launching apps

rofr.sh -r

or for windows view

rofr.sh -w

etc…

2 Likes
#3

and

[don@don-pc ~]$ rofr.sh -h

 USAGE:   rofr.sh [OPTIONS]

 OPTIONS:

     -h,--help          Display this message

     -v,--version       Display script version

     -w,--window        Switch between open windows

     -r,--run           Program launcher & run dialog

     -q,--qalculate     Persistant calculator dialog (requires libqalculate)

     -c,--clipboard     Select previous clipboard entries (requires greenclip)

     -b,--browser       Browser search by keyword (requires surfraw)

     -l,--logout        Session logout dialog

     Without any options -r,--run will be opened.

[don@don-pc ~]$ 
1 Like
#4

Thank you both for your reply.
I already knew all options of rofr.sh script.
I wanted to know how to use rofi plugin scripts. Now i know.
Now i have a new problem.
When i launch this ebook search rofi plugin script , I can’t exit from it by pressing ESC. i have to open a book to exit from it.

#5

Edit it

1 Like
#6

i dont know bash scripting :worried:

#7

Create a new script, make it executable and try something like this:

#!/bin/sh
locate /home/alOoOz/Books | rofi -threads 0 -width 50 -dmenu -nb ‘#1C2023’ -sf ‘#1C2023’ -sb ‘#00EFFF’ -nf ‘#9B9081’ -i -p “Books:” | xargs -r -0 xdg-open

Of course you need locate as dependency, install it

sudo pacman -S mlocate && sudo updatedb

First database update is a bit long (few seconds) but this works fine for me.
Keep It Simple Stupid

1 Like
#8

That’s because that script uses -only-match

I suggest at the very least

man rofi

to learn the flags and what they do.

That script is also fairly poorly written, something like what @archus provided is a better option.

find ~/Books -name '*.pdf' | rofi -dmenu -i -p 'Books' | xargs -r -0 xdg-open

Everyone starts somewhere, you type commands in a terminal? It’s no different.

Read the SHELL GRAMMAR section

man bash
3 Likes
#9

@natemaia much more KISS philosophy than my solution :wink:

1 Like
#10

Thanks.
Removing the -only-match part solves the problem :smile:
I tried your simple solution.
Why does the list shows full path of the books rather than only the name of the books?

#11

Because it’s easier.

Done from my phone so can’t garunteed it works, just play around with it

find ~/Books -name '*.pdf' | awk -F'/' '{print $NF}' | rofi -dmenu -i -p 'Books' | awk '{print '"$HOME/Books/"'$0}' | xargs -r -0 xdg-open
2 Likes
#12

Thanks a lot for your help. Works like a charm

#13

The final script for other’s future use.

#14

@archus thanks a lot for your help

#15

Glad that you got it to work @al0o0z

Thx to @natemaia

#16

You should edit that awk command to use your $BOOK_DIR instead of $HOME/Books that I used above or it won’t work properly.

Remove the xdg-open end to see the output.

#17

oops, didn’t see it.
But hey it’s showing correct without changing the awk command :confused:
And just now i’ve found out that the script doesn’t open the selected book :confused:
I just tried to open a book that was already opened by that long script so i thought this is working :slightly_frowning_face:
The selected book is not opening.

#18

Think about what it’s doing, run each individually.