Xfce Forum

Sub domains
 

You are not logged in.

#1 2023-02-19 01:13:14

deuce
Member
Registered: 2023-02-19
Posts: 4

[SOLVED] Shortcut to Show/Hide File/launcher icons

I would like to be able to place a shortcut in my panel that would toggle Desktop Settings -from  File/launcher icons to None.  Is this possible?
Another way that would work if possible would be to show/hide desktop icons only on a selected workspace?  For example, if I have two workspaces can I show File/launcher icons on one and show None on the other?
I've searched through the posts here using show/hide  as the search criteria but did not find an answer.  Thanks for any help of suggestions.

Last edited by deuce (2023-02-19 21:36:14)

Offline

#2 2023-02-19 01:37:43

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,485

Re: [SOLVED] Shortcut to Show/Hide File/launcher icons

Hello and welcome.

I would like to be able to place a shortcut in my panel that would toggle Desktop Settings -from  File/launcher icons to None.  Is this possible?

You can accomplish this with xfce4-genmon-plugin.

First, create a script with the following content:

#!/bin/bash

STATE=$(xfconf-query -c xfce4-desktop -p /desktop-icons/style)

if [ $STATE -eq 0 ]; then
	xfconf-query -c xfce4-desktop -p /desktop-icons/style -s 2
elif [ $STATE -eq 2 ]; then
	xfconf-query -c xfce4-desktop -p /desktop-icons/style -s 0
fi

...and make the script executable.

Then add the xfce4-genmon-plugin to the panel and set the following:

  • Command = echo "<icon>preferences-desktop-icons</icon><iconclick>/path/to/script</iconclick><tool>Toggle desktop icons</tool>"
    ...where /path/to/script is the full path to the script from above (+feel free to change the icon)

  • Label = unchecked

  • Period = 86400

...and click save. Then give it a try.

Note: this depends on xfce4-genmon version 4.1. If you have an older version, we can tweak it to use images instead of icons.

Edit: you can also do this with a regular launcher - I just jumped to genmon by default. Muscle memory.

Last edited by ToZ (2023-02-19 01:39:22)


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#3 2023-02-19 17:24:00

deuce
Member
Registered: 2023-02-19
Posts: 4

Re: [SOLVED] Shortcut to Show/Hide File/launcher icons

Thank you ToZ.  I have some questions about the mechanics of how to do what you suggested.  So here goes.

I made the script you provided:
sudo mousepad /usr/bin/toggle_desktop_icons.sh
saved and made it executeable

I ran the script and it works!

I added a launcher from the Panel app and entered the path to the script and now I have an icon that turns the desktop file/launcher icons on and off.  Thanks so much for the script and the information.

I never did get the generic monitor app to work and I don't know why.  Here is what I tried:

I added the xfce4-genmon-plugin to the panel. But when I attempt to enter the Command, it is truncated like so -

Command = echo "<icon>preferences-desktop-icons</icon><iconclick>/usr/bin/toggle_desktop_icons.sh</iconclick><tool>Toggle deskto

To try to get around this, I made a directory in my home directory called scripts - mkdir /home/deuce/scripts, then added a text file to it - sudo mousepad /home/deuce/scripts/Toggle_desktop_icons.txt, entered the full command string and saved it. But doing it this way returns permission denied.
The answer must be something I'm overlooking, but can't see what it is.    As I said above, the launcher works and is just what I need, but I would like to know what I did wrong on the genmon setup.
Thank you.

Last edited by deuce (2023-02-19 19:28:04)

Offline

#4 2023-02-19 20:50:16

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,485

Re: [SOLVED] Shortcut to Show/Hide File/launcher icons

deuce wrote:

Thank you ToZ.  I have some questions about the mechanics of how to do what you suggested.  So here goes.

I made the script you provided:
sudo mousepad /usr/bin/toggle_desktop_icons.sh
saved and made it executeable

I ran the script and it works!

I added a launcher from the Panel app and entered the path to the script and now I have an icon that turns the desktop file/launcher icons on and off.  Thanks so much for the script and the information.

Good to hear.

I never did get the generic monitor app to work and I don't know why.  Here is what I tried:

I added the xfce4-genmon-plugin to the panel. But when I attempt to enter the Command, it is truncated like so - echo "<icon>preferences-desktop-icons</icon><iconclick>/path/to/script</iconclick><tool>Toggle desktop icons</tool>"

Command = echo "<icon>preferences-desktop-icons</icon><iconclick>/usr/bin/toggle_desktop_icons.sh</iconclick><tool>Toggle desktop

The command field should only have the following content:

echo "<icon>preferences-desktop-icons</icon><iconclick>/usr/bin/toggle_desktop_icons.sh</iconclick><tool>Toggle desktop icons</tool>"

...Its not clear whether you are adding the "Command =" part. You should not and my apologies for not being clearer.

You can always review the ~/.xsession-errors log file if a command in genmon doesn't work for potential error messages.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#5 2023-02-19 21:33:55

deuce
Member
Registered: 2023-02-19
Posts: 4

Re: [SOLVED] Shortcut to Show/Hide File/launcher icons

Thank you ToZ.  I was including Command=.  So that solves the mystery.  I appreciate the help and the information.  I will mark the thread  as [SOLVED].

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.008 seconds, 7 queries executed - Memory usage: 545.16 KiB (Peak: 546 KiB) ]