Xfce Forum

Sub domains
 

You are not logged in.

#1 2018-12-02 10:22:18

uid3s1gn3r
Member
Registered: 2018-12-02
Posts: 9

How to remove a panel item/launcher through terminal?

Hi fellows. This is my first post here. I just installed xfce DE and i just loved it. As a UI/UX designer i m trying to create a new theme and a modern/fresh look and feel for this awesome desktop.

My first task is to beautify the panel...
And here is my first question in the community: How we can remove a launcher or an item from the panel through terminal?
Right now i can add new programmes launchers like that:

xfce4-panel --add=launcher gimp.desktop

but how can i remove the above launcher again through the terminal ?

I tried

xfce4-panel --remove=launcher gimp.desktop

but didn't work at all. Could you help me ? Thanks in advance.

Offline

#2 2018-12-02 11:20:22

alcornoqui
Member
Registered: 2014-07-28
Posts: 320

Re: How to remove a panel item/launcher through terminal?

Hello and welcome to the forum.

I don't know how to do it myself, but I did a search and found this long, detailed thread. Excerpt:

Deleting Properties from the “Xfconf” Configuration Storage System

If you created a third panel, as discussed above, and subsequently updated the “/panels” array to remove the new panel again, then any of its properties will remain present in the Xfconf system—as the following command will demonstrate:

$ xfconf-query --channel 'xfce4-panel' --property '/panels/panel-3' --list

Unless you made any modifications to its setup, only the “/panels/panel-3/position” property will be listed.

To delete the value of a property, you can run the xfconf-query command with the “--reset” option—e.g.:

$ xfconf-query --channel 'xfce4-panel' --property '/panels/panel-3/position' --reset

Additionally, if you want to delete a property, and all properties beneath it, then you can add the “--recursive” option to the command:

$ xfconf-query --channel 'xfce4-panel' --property '/panels/panel-3' --reset --recursive

Hope it helps!

Offline

#3 2018-12-02 11:48:54

uid3s1gn3r
Member
Registered: 2018-12-02
Posts: 9

Re: How to remove a panel item/launcher through terminal?

Thank you. i will try it soon. Feel so excited with xfce DE wink

Last edited by uid3s1gn3r (2018-12-02 12:05:48)

Offline

#4 2018-12-02 14:33:24

ToZ
Moderator
From: Canada
Registered: 2011-06-02
Posts: 4,860

Re: How to remove a panel item/launcher through terminal?

As @alcornoqui points out, there is no easy way to do this. xfce4-panel does not provide the interface (feel free to create an enhancement request at the bug tracker).

A while ago I started writing a bash script to automate this but never finished it. Dusted it off and got it work only with launcher plugins. Basically, save the following bash script somewhere and make it executable. When you run it, pass it 2 parameters:

  1. The plugin type - must be "launcher"

  2. the name of the desktop file associated with the launcher

...(e.g.) "xfdel launcher gimp.desktop"

Anyways, here is the script. Use at your own risk. I only tested it on my system.

#!/bin/bash
### currently only removes launchers

### $1 = plugin type
### $2 = desktop file

if [ $# -ne 2 ]
then
	echo "Usage: $0 PLUGIN_TYPE DESKTOP_FILE"
	exit 1	
fi

if [ $1 != "launcher" ]
then
	echo "Error: only the 'launcher' plugin type is currently supported"
	exit 1
fi

TYPE=$1

### i are all $1 plugin type instances
### j are all the plugin $i-associated panel desktop files
### k is the plugin number

for i in $(xfconf-query -c xfce4-panel -lv | grep $TYPE | awk '{print $1}')
do
	for j in $(xfconf-query -c xfce4-panel -p $i/items | tail -1)
	do
		k=$(echo $i | sed -e 's/.*plugin//g')
		if [ $(cat ~/.config/xfce4/panel/$1$k/$j | grep X-XFCE-Source | sed -e 's/.*\///g') == "$2" ]
		then
			xfconf-query -c xfce4-panel -p /plugins/plugin$k -rR
			# just restart the panel. The proper way would be to read the panel's plugin-ids array and
			#		remove the id ($k) from the array list. Unfortunately, xfconf-query does not provide
			#		array manipulation routines so you will need some extra bash-foo to get it done. 			
			xfce4-panel -r
		fi
	done
done

Offline

Board footer

Powered by FluxBB