Switch desktop wallpaper and layout with mirage

Here is where you can post tips and tricks to share with other users of MX. Do not ask for help in this Forum.
Post Reply
Message
Author
User avatar
rich
Posts: 180
Joined: Sat Mar 31, 2018 6:39 pm

Switch desktop wallpaper and layout with mirage

#1 Post by rich »

This is a guide on how to use the mirage image viewer to set the wallpaper and change layout.

Image

MX Linux's default image viewer is nomacs, which is a great program. Mirage can be installed alongside nomacs with no problem.

Mirage is a simple image viewer with a few editing tools but one very nice option of specifying custom commands. Using this we can set hotkeys to set desktop wallpaper and change wallpaper layout.

The mirage package in Debian's repository contains a minor few bugs, specifically, arrow keys don't work to scroll images and the help website link is broke. If you'd like to repackage with a newer source, I've included optional instructions. Otherwise skip to Part 2.

Part 1. Optional - repackage mirage.

Disclaimer - This is not an official way to build a package, it's just for fun. However, it does work.

The process I follow and packages required for backporting are laid out here: https://wiki.debian.org/SimpleBackportCreation. The packages needed in general are

Code: Select all

packaging-dev debian-keyring devscripts equivs libdistro-info-perl
First we can grab Debian package as we'll simply modify it to reflect the new source rather than create a whole new package. I use a ~/build directory for these things.

Code: Select all

cd ~/build
mkdir mirage
cd mirage
dget -u http://http.debian.net/debian/pool/main/m/mirage/mirage_0.9.5.2-1.dsc
Now we've got the ingredients to build the mirage package in the debian archive. Let's grab the new source we're going to add.

Code: Select all

cd ~/build
mkdir mirage2
cd mirage2
git clone https://github.com/dead-beef/mirage.git
cd mirage
We've got everything we need! Now, just to put it together. We're going to take the debian package and put the new mirage.py into it, add new two icons we'll need, and let the install instruction for the debian package know about the changes.

Code: Select all

cp {mirage.py,stock_fit-height.png,stock_fit-width.png} ~/build/mirage2/mirage-0.9.5.2
cd ~/build/mirage2/mirage-0.9.5.2
Use text editor to open setup.py (in current directory ~/build/mirage2/mirage-0.9.5.2) and change line #63 from

Code: Select all

data_files=[('share/mirage', ['README', 'COPYING', 'CHANGELOG', 'TODO', 'TRANSLATORS', 'stock_shuffle.png', 'stock_leave-fullscreen.png', 'stock_fullscreen.png', 'mirage_blank.png']),
to

Code: Select all

 data_files=[('share/mirage', ['README', 'COPYING', 'CHANGELOG', 'TODO', 'TRANSLATORS', 'stock_shuffle.png', 'stock_leave-fullscreen.png', 'stock_fullscreen.png', 'mirage_blank.png', 'stock_fit-height.png', 'stock_fit-width.png']),
(Basically just add the names of the two new icons to the list.)

Okay, now we're ready to build! The following is taken from the Debian wiki page referenced above.

Code: Select all

sudo mk-build-deps --install --remove
dch --local mod --distribution stretch-backports "Rebuild with new source"
fakeroot debian/rules binary
dpkg-source --commit
(Go ahead and name the patch, your choice. An editor will open displaying the patch, ctrl+x to close by default)

Code: Select all

dpkg-buildpackage -us -uc
sudo apt install mirage
sudo dpkg -i ../*.deb
Remove the build dependencies if you'd like.

Code: Select all

sudo apt purge mirage-build-deps && sudo apt autoremove --purge
Alright! Mirage is rebuilt and installed. Now for the fun stuff.

Part 2. Custom commands

The two commands we'll use are as follows:

Set wallpaper

Code: Select all

xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/workspace0/last-image -s %F
Switch wallpaper layout

Code: Select all

current=$(xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/workspace0/image-style) ; if [ $current = 5 ]; then new=1 ; else new=$(( $current + 1 )); fi; xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/workspace0/image-style -s $new
Note- these commands are for a single laptop screen. They may be different for multiple monitors, etc.

The first simply tells xfce to use the image displayed in mirage as the desktop wallpaper, and the second scrolls through the layout options in a loop.

Custom commands are set through Edit>Custom Actions>Configure. In the example gif above, I have Ctrl+Alt+W for set wallpaper and Ctrl+Alt+E for switch layout.

Okay, there you have it! I just thought this was a cool trick and wanted to share. Any feedback welcome.

Post Reply

Return to “Tips & Tricks by users”