You are not logged in.

#1 2020-02-27 10:48:30

clusterF
Member
Registered: 2019-05-07
Posts: 539

rofi + dmenu wallpaper background setting command

Hi, just wanted to share something i discovered today after setting up rofi for the first time. Ive created a command that lists the wallpaper background directory and has feh setting the background. The reason for this is i am going to set this to a  hotkey which will make it easier when i download a new image to set as a background wallpaper instead of typing out the command  in the terminal.

ls $HOME/walls/* | rofi -dmenu | xargs feh --bg-scale

So the wallpaper directory is being globbed as i understand it, just wanted to know how i would go about having rofi only show the difference between the below examples?

example of what shows up currently.

/home/me/walls/wallpaper.jpg

example of how i would like it to show up in rofi -dmenu, just having the file name showing, not showing the expanded directory ?

wallpaper.jpg

Last edited by clusterF (2020-02-27 10:49:22)

Offline

#2 2020-02-27 11:32:56

misko_2083
Member
Registered: 2016-05-24
Posts: 335

Re: rofi + dmenu wallpaper background setting command

Like this:

ls $HOME/walls | rofi -dmenu | xargs -I{} feh --bg-scale $HOME/walls/{}

Xargs -I option replaces string {} in the path

Last edited by misko_2083 (2020-02-27 13:39:18)


Што ни оштровиди ум сагледати не може - љубав превазилази.

Offline

#3 2020-02-27 11:35:51

clusterF
Member
Registered: 2019-05-07
Posts: 539

Re: rofi + dmenu wallpaper background setting command

Thankyou misko.

Offline

#4 2020-02-29 09:10:17

ohnonot
...again
Registered: 2015-09-29
Posts: 4,410
Website

Re: rofi + dmenu wallpaper background setting command

dmenu itself doesn't come into it - rofi just calls it "dmenu compatible mode" or some such.

Also, don't parse ls.

Offline

#5 2020-02-29 12:03:21

clusterF
Member
Registered: 2019-05-07
Posts: 539

Re: rofi + dmenu wallpaper background setting command

Yes it is called dmenu compatible mode so dmenu does come into dont you think? Could rofi do this without the compatibility of dmenu? Im new to rofi, just asking questions.

Unaware of the issue surrounding ls, maybe find might be a better command to use?

Last edited by clusterF (2020-02-29 12:04:11)

Offline

#6 2020-02-29 12:16:56

clusterF
Member
Registered: 2019-05-07
Posts: 539

Re: rofi + dmenu wallpaper background setting command

ok find works as well but directory expansion hack misko mentions wont work with find?

find $HOME/walls -name '*.jpg' -o -name '*.png' | rofi -dmenu | xargs -I{} feh --bg-scale $HOME/walls/{}

This works below, above does not.

find $HOME/walls -name '*.jpg' -o -name '*.png' | rofi -dmenu | xargs feh --bg-scale

Edit: From reading that link you posted ohnot, it seems the issue is when file names have new lines in them, ive not come across that sort of file yet or if i have then i wonder what sort of file have more than one line in the filename?

Last edited by clusterF (2020-02-29 12:31:01)

Offline

#7 2020-03-01 12:17:39

vasa1
Member
Registered: 2015-09-29
Posts: 180

Re: rofi + dmenu wallpaper background setting command

clusterF wrote:

Yes it is called dmenu compatible mode so dmenu does come into dont you think? Could rofi do this without the compatibility of dmenu? Im new to rofi, just asking questions. ...

Rofi can emulate dmenu if run with -dmenu.

rofi  is  an X11 pop-up window switcher, run dialog, dmenu replacement, and more. It focuses on being fast to use and have minimal distraction. It supports keyboard and mouse navigation, type to filter, tokenized search and more.

I like rofi a lot! https://github.com/davatorium/rofi/wiki/User-scripts is worth a look.

And here's a neat theme (light and dark): https://github.com/MonsieurBedard/rofi-breeze-theme


Using the Openbox (3.5.2) session of Lubuntu 14.04 LTS but very interested in BL :)

Offline

Board footer

Powered by FluxBB