Xfce Forum

Sub domains
 

You are not logged in.

#1 2014-02-05 17:15:02

pandageek
Member
Registered: 2014-02-05
Posts: 3

how to make a script to modify xfce4 panel?

Hello!

I want to know how to modify the panel (or create another one if it's easier), setting launchers and options, in command line.

I found the xfconf-query command but i've no idea how to use it and i don't understand the documentation  http://docs.xfce.org/xfce/xfconf/xfconf-query

I hope you can help me!

Thanks

Offline

#2 2014-02-06 13:18:28

wtsch
Member
Registered: 2010-06-09
Posts: 27

Re: how to make a script to modify xfce4 panel?

Why? Different settings for different users?

Offline

#3 2014-02-06 13:54:12

ToZ
Moderator
From: Toronto, Canada
Registered: 2011-06-02
Posts: 2,697

Re: how to make a script to modify xfce4 panel?

Setting options is easy. You can either look at the Settings Editor to see a graphic display of the configuration tree, or for xfce4-panels:

To view the panel IDs:

xfconf-query -c xfce4-panel -p /panels

To view the settings for a specific ID (in my case. panel-1):

xfconf-query -c xfce4-panel -p /panels/panel-1 -lv

To change one of the non-array settings (ie enable autohide):

xfconf-query -c xfce4-panel -p /panels/panel-1/autohide -s true

...and to disable it again:

xfconf-query -c xfce4-panel -p /panels/panel-1/autohide -s false

Working with array values is tougher because I don't think xfconf allows you to manipulate individual elements of the array. And since creating a new panel or a launcher requires array manipulation, it may not be possible. You might be able to create a wrapper function to read, store and re-write the array values (as a complete set), but I've never tested this.


How To Ask For Help           Xfce FAQ                            Xfce Release Information
The Xfce Community          Xfce Tips and Tricks

Offline

#4 2014-02-06 16:57:34

pandageek
Member
Registered: 2014-02-05
Posts: 3

Re: how to make a script to modify xfce4 panel?

thanks it works great!

where can i find the list of option to modify (like height, width, color, shortcurts,...)?

Offline

#5 2014-02-06 18:36:10

ToZ
Moderator
From: Toronto, Canada
Registered: 2011-06-02
Posts: 2,697

Re: how to make a script to modify xfce4 panel?

pandageek wrote:

thanks it works great!

where can i find the list of option to modify (like height, width, color, shortcurts,...)?

I'm not sure I understand, but if you're asking which properties are available for modification, look at the Settings Editor (found in the Settings Manager or by running "xfce4-settings-editor").


How To Ask For Help           Xfce FAQ                            Xfce Release Information
The Xfce Community          Xfce Tips and Tricks

Offline

#6 2014-02-06 20:07:55

pandageek
Member
Registered: 2014-02-05
Posts: 3

Re: how to make a script to modify xfce4 panel?

Thanks!
i can modify what i want exept one thing :
How can i add a launcher?

Last edited by pandageek (2014-02-06 20:25:50)

Offline

#7 2014-02-06 20:43:52

ToZ
Moderator
From: Toronto, Canada
Registered: 2011-06-02
Posts: 2,697

Re: how to make a script to modify xfce4 panel?

As I explained earlier, it won't be easy (impossible?) because you need to manipulate array values (see panel-1/plugin-ids) and as far as I know, xfconf-query can't manipulate individual elements of an array (I might be wrong, but I can't find any info on how to do this). Thinking out loud, you may be able to create a wrapper function to read, store and re-write the array as a complete set, but these are uncharted waters (don't know if its possible).

As for what needs to be done, I would guess an array element would need to be added to /panel-Y/plugin-ids that corresponds to an entry in /plugins/plugin-XX of which the items array property points a desktop file in ~/.config/xfce4/panel/launcher-XX (where Y is a panel ID and where XX is a unique numeric value).


How To Ask For Help           Xfce FAQ                            Xfce Release Information
The Xfce Community          Xfce Tips and Tricks

Offline

#8 2014-02-07 02:20:45

MountainDewManiac
Member
From: USA police-state welfare-state
Registered: 2013-03-24
Posts: 706

Re: how to make a script to modify xfce4 panel?

It's not a "command line" solution, but can't you just find the app you want in your desktop menu, drag (a representation of) it from there to the desktop, and then on to the panel you wish to place the launcher on?

Regards,
MDM


Mountain Dew Maniac

How to Ask for Help <=== Click on this link

Offline

#9 2014-02-07 17:10:56

ToZ
Moderator
From: Toronto, Canada
Registered: 2011-06-02
Posts: 2,697

Re: how to make a script to modify xfce4 panel?

DISCLAIMER: Be very careful with this code. If possible, test on spare system or in a vm. This works on my test system (in this case fedora), but I can't vouch for others. You have been warned.

Here are some steps for manually adding the abiword launcher to the bottom panel.

Informational

# list all panel properties

xfconf-query -c xfce4-panel -p /panels -lv

# list panel IDs

xfconf-query -c xfce4-panel -p /panels | grep -v "Value is an\|^$"

# list all panel plugins info (going to model after existing launcher plugin)

xfconf-query -c xfce4-panel -p /plugins -lv

Add launcher to panel-2

# 1. determine launcher id number to use - must be unique. (using 16). Determine the id of the panel to add to - must exist (using 2).

# 2. create the launcher directory (~/.config/xfce4/panel/launcher-xx)

mkdir ~/.config/xfce4/panel/launcher-16

# 3. copy launcher's .desktop file into that folder

cp /usr/share/applications/abiword.desktop ~/.config/xfce4/panel/launcher-16

# 4. create the plugin xfconf entry
# 4a. create the plugin group

xfconf-query -c xfce4-panel -p /plugins/plugin-16 -t string -s "launcher" --create

# 4b. create the plugin items property

xfconf-query -c xfce4-panel -p /plugins/plugin-16/items -t string -s "abiword.desktop" -a --create

# 5. add the new plugin ID to the existing panel array of plugins
# 5a. list the current contents of the array (make note of results for future use)

xfconf-query -c xfce4-panel -p /panels/panel-2/plugin-ids| grep -v "Value is an\|^$"

# 5b. delete the plugin-ids array

xfconf-query -c xfce4-panel -p /panels/panel-2/plugin-ids -rR

# 5c. re-create the array using the old existing ids + the new id, placing them in the order they are to be displayed (inserting 16)

xfconf-query -c xfce4-panel -p /panels/panel-2/plugin-ids -t int -s 7 -t int -s 8 -t int -s 9 -t int -s 16 -t int -s 10 -t int -s 11 -t int -s 12 -t int -s 13 -t int -s 14 --create

# 6. restart xfce4-panel

xfce4-panel -r

How To Ask For Help           Xfce FAQ                            Xfce Release Information
The Xfce Community          Xfce Tips and Tricks

Offline

Board footer

Powered by FluxBB