DEV Community

Gabriel Alejandro López López
Gabriel Alejandro López López

Posted on • Edited on • Originally published at glpzzz.dev

Simple way to set wallpaper on Linux

I don't use any major desktop environment on Linux. Most of these takes care of managing the wallpaper of your session by some functionality in the specific file manager. So, the desktop is treated as another directory by Nautius, Dolphin, Thunar, and others.

This is not the way I do things. I'm more into window managers that regularly don't know anything about wallpaper.

In my case, I use hsetroot, a very small utility, that can be installed on my Ubuntu setup with:

sudo apt install hsetroot
Enter fullscreen mode Exit fullscreen mode

And I just use hsetroot for two very specific actions

Setup a solid color as background

hsetroot -solid "#000000"
Enter fullscreen mode Exit fullscreen mode

Will set black as the solid color background.

Setup an image as wallpaper covering all the screen

hsetroot -cover /path/to/image.jpg
Enter fullscreen mode Exit fullscreen mode

Will expand and/or crop the image to fully cover the screen by respecting its aspect ratio.

Remember between sessions...

hsetroot doesn't store any settings. So, then session is restarted it will not remember the last color/image set. How to fix this? Call hsetroot on session start. I personally do it in my ~/.xsessionrc and with an specific path.

hsetroot -cover ~/.wallpaper.jpg
Enter fullscreen mode Exit fullscreen mode

When I want to set a new wallpaper I replace this file, in the next session that will be the default.

Conclusion

There are more comfortable ways to change your wallpaper, specially for those who do it very frequent. But, for me, who changes it once in months (maybe), hsetroot is perfect:

  • it does just one thing
  • it doesn't have a GUI
  • it's very simple to call in scripts.

And finally, yes, there are other utilities to do the same. feh and xsetroot for example. But, for some reason I have been using hsetroot for a couple of years. It just works!

Top comments (2)

Collapse
 
anirudhrowjee profile image
Anirudh Rowjee

I would suggest using Nitrogen! It's extremely easy to use, and has a GUI.

Collapse
 
glpzzz profile image
Gabriel Alejandro López López • Edited

Yes, I know nitrogen and it have everything I don't want. the GUI and store the last wallpaper setting. I was looking for something simpler.