Question: How do I change the desktop background wallpaper in fluxbox window manager?
Answer: We discussed fluxbox earlier in an introduction to the fluxbox window manager and how to shutdown the system from fluxbox window manager.
In this article we’ll see how to change the wallpaper in fluxbox by using a bash script or by editing the menu file.
We use a BASH script to aid us and it will be stored in ~/bin so it is readily accessible. Make sure that your $PATH is set correctly. Do this by adding the following line to your ~/.bashrc.
PATH=$PATH:~/bin
Install feh for fluxbox wallpaper
First step is to install feh. In Ubuntu and Debian you use the following:
sudo apt-get install feh
Whereas on FreeBSD you use the following:
sudo pkg_add -r feh
Write a bash script to set the fluxbox wallpaper
The next step is to write a script which I’ve already taken the liberty of writing.
#!/usr/bin/env bash
BG_TILE="--bg-tile"
BG_CEN="--bg-center"
BG_SCA="--bg-scale"
USAGE="Setting background:\n-t tiled\n-c center\n-s scaled\nsecond arg should be a pic"
#
if [ "$1" = "-t" ]
then feh $BG_TILE $2
elif [ "$1" = "-c" ]
then feh $BG_CEN $2
elif [ "$1" = "-s" ]
then feh $BG_SCA $2
else
echo -e $USAGE
fi
if [ ! -e "$2" ] # Check if file exists.
then
echo "Are you sure you typed the filename correctly?"
fi
What this script does is execute certain commands based on certain conditions. The first part says if $1 (the first argument) is equal to “-t” then execute feh $BG_TILE $2, where $2 is the second argument, i.e. the path of the fluxbox wallpaper.
Set wallpaper by editing fluxbox menu
Another and even simpler way to set the fluxbox wallpaper is by editing the menu file. You can add something like the following somewhere in your menu file and you’ll get a list of all your fluxbox wallpapers (bear in mind that it won’t read subdirectories).
[wallpapers] (/path/to/wallpapers/) {command}
The “{command}” will be executed upon clicking. By default it uses fbsetbg which is simply a wrapper. It will in turn use feh to set the background.
In closing, Fluxbox is an excellent window manager who’s functionality can be extended given some creative scripting, time, and patience. In addition, it being lightweight makes it ideal for low resource systems.
Linux provides several powerful administrative tools and utilities which will help you to manage your systems effectively. If you don’t know what these tools are and how to use them, you could be spending lot of time trying to perform even the basic administrative tasks. The focus of this course is to help you understand system administration tools, which will help you to become an effective Linux system administrator.Get the Linux Sysadmin Course Now!
If you enjoyed this article, you might also like..
|
|
|
|







My name is Ramesh Natarajan. I will be posting instruction guides, how-to, troubleshooting tips and tricks on Linux, database, hardware, security and web. My focus is to write articles that will either teach you or help you resolve a problem. Read more about
{ 1 comment… read it below or add one }
What benefit does the script give you. It does thing feh does by itself…