Xfce Forum

Sub domains
 

You are not logged in.

#1 2014-08-24 03:17:15

inukaze
Member
Registered: 2014-07-31
Posts: 46

I wanna make a Scripts for Themes.

Hi there , i wanna make a Scripts for

1 - Save my Current Theme : If possible you can help me with : Xfce & Mate

For Save the "theme name" inside varible on the script , the follows things used.

A) Engine / Style Name
B) Icons Theme Name
C ) Font Name
D ) Cursor Theme Name
E ) Wallpaper(s) Full Path(s)

and that export to a new script for later Restore if i dont wanna the new theme apply . with the script.

we can found that forgotten files in https://sites.google.com/site/phrankdac … tu/xpgnome

2 - Someone can help me to adapt the old XPGnome , to Xfce , but for Xfce & Mate ???

for save the Restores Configurations , i saw the important lines inside the Script are :


#!/bin/sh
#
# XpGnome Script
# Written by PhrankDaChicken
# http://ubunutu.online02.com/xpgnome
#
# Last Update: 1/7/09
#


echo "# Saving Settings..."

RESTOREDIR=$(date +%b_%d_%Y,%H-%M-%S)
RESTOREDIR="RestoreSettings_$RESTOREDIR"
mkdir $RESTOREDIR
echo "#!/bin/sh" > /tmp/Restore_Settings.sh
echo "gconftool-2 --set \"/desktop/gnome/interface/icon_theme\" --type string" \"$(gconftool-2 --get "/desktop/gnome/interface/icon_theme")\" >> /tmp/Restore_Settings.sh
echo "gconftool-2 --set \"/desktop/gnome/peripherals/mouse/cursor_theme\" --type string" \"$(gconftool-2 --get "/desktop/gnome/peripherals/mouse/cursor_theme")\" >> /tmp/Restore_Settings.sh
echo "gconftool-2 --set \"/desktop/gnome/interface/gtk_theme\" --type string" \"$(gconftool-2 --get "/desktop/gnome/interface/gtk_theme")\" >> /tmp/Restore_Settings.sh
echo "gconftool-2 --set \"/apps/metacity/general/theme\" --type string" \"$(gconftool-2 --get "/apps/metacity/general/theme")\" >> /tmp/Restore_Settings.sh
echo "gconftool-2 --set \"/desktop/gnome/interface/toolbar_style\" --type string" \"$(gconftool-2 --get "/desktop/gnome/interface/toolbar_style")\" >> /tmp/Restore_Settings.sh
echo "gconftool-2 --set \"/apps/nautilus/preferences/side_pane_view\" --type string" \"$(gconftool-2 --get "/apps/nautilus/preferences/side_pane_view")\" >> /tmp/Restore_Settings.sh 
echo "gconftool-2 --set \"/apps/nautilus/sidebar_panels/tree/show_only_directories\" --type bool" $(gconftool-2 --get "/apps/nautilus/sidebar_panels/tree/show_only_directories") >> /tmp/Restore_Settings.sh
echo "gconftool-2 --set \"/apps/nautilus/desktop/computer_icon_visible\" --type bool" $(gconftool-2 --get "/apps/nautilus/desktop/computer_icon_visible") >> /tmp/Restore_Settings.sh
echo "gconftool-2 --set \"/apps/nautilus/desktop/computer_icon_name\" --type string " \"$(gconftool-2 --get "/apps/nautilus/desktop/computer_icon_name")\" >> /tmp/Restore_Settings.sh  
echo "gconftool-2 --set \"/apps/nautilus/desktop/home_icon_visible\" --type bool" $(gconftool-2 --get "/apps/nautilus/desktop/home_icon_visible") >> /tmp/Restore_Settings.sh 
echo "gconftool-2 --set \"/apps/nautilus/desktop/home_icon_name\" --type string" \"$(gconftool-2 --get "/apps/nautilus/desktop/home_icon_name")\" >> /tmp/Restore_Settings.sh 
echo "gconftool-2 --set \"/apps/nautilus/desktop/network_icon_visible\" --type bool" $(gconftool-2 --get "/apps/nautilus/desktop/network_icon_visible") >> /tmp/Restore_Settings.sh  
echo "gconftool-2 --set \"/apps/nautilus/desktop/network_icon_name\" --type string" \"$(gconftool-2 --get "/apps/nautilus/desktop/network_icon_name")\" >> /tmp/Restore_Settings.sh 
echo "gconftool-2 --set \"/apps/nautilus/desktop/trash_icon_visible\" --type bool" $(gconftool-2 --get "/apps/nautilus/desktop/trash_icon_visible") >> /tmp/Restore_Settings.sh 
echo "gconftool-2 --set \"/apps/nautilus/desktop/trash_icon_name\" --type string" \"$(gconftool-2 --get "/apps/nautilus/desktop/trash_icon_name")\" >> /tmp/Restore_Settings.sh 
echo "gconftool-2 --set \"/apps/nautilus/desktop/volumes_visible\" --type bool" $(gconftool-2 --get "/apps/nautilus/desktop/volumes_visible") >> /tmp/Restore_Settings.sh 
echo "gconftool-2 --set \"/apps/gnome-session/options/show_splash_screen\" --type bool" $(gconftool-2 --get "/apps/gnome-session/options/show_splash_screen") >> /tmp/Restore_Settings.sh 
echo "gconftool-2 --set \"/apps/gnome-session/options/splash_image\" --type string" \"$(gconftool-2 --get "/apps/gnome-session/options/splash_image")\" >> /tmp/Restore_Settings.sh 
echo "gconftool-2 --set \"/desktop/gnome/background/picture_filename\" --type string" \"$(gconftool-2 --get "/desktop/gnome/background/picture_filename")\" >> /tmp/Restore_Settings.sh 
echo "gconftool-2 --set \"/desktop/gnome/background/picture_options\" --type string" \"$(gconftool-2 --get "/desktop/gnome/background/picture_options")\" >> /tmp/Restore_Settings.sh 
echo "gconftool-2 --set \"/apps/metacity/general/num_workspaces\" --type int" $(gconftool-2 --get "/apps/metacity/general/num_workspaces") >> /tmp/Restore_Settings.sh 
echo "rm -r $HOME/.icons/GnomeXP" >> /tmp/Restore_Settings.sh
echo "rm -r $HOME/.icons/xp" >> /tmp/Restore_Settings.sh
echo "rm -r $HOME/.themes/XPLuna" >> /tmp/Restore_Settings.sh
echo "gconftool-2 --load Panel_Settings.xml" >> /tmp/Restore_Settings.sh
echo "killall gnome-panel" >> /tmp/Restore_Settings.sh
echo "gksudo -m \"Enter your password to remove and change the XP GDM/Login theme\" \"rm -r /usr/share/gdm/themes/XP_Ubuntu\"" >> /tmp/Restore_Settings.sh
echo "gksudo gdmsetup" >> /tmp/Restore_Settings.sh
echo "zenity --info --no-wrap --title \"XpGnome\" --text \"Settings restored!\"" >> /tmp/Restore_Settings.sh
chmod a+x /tmp/Restore_Settings.sh
mv /tmp/Restore_Settings.sh "$DIR/$RESTOREDIR/" # Restore_Settings.sh
gconftool-2 --dump /apps/panel > $DIR/$RESTOREDIR/Panel_Settings.xml 
#cp /etc/gdm/gdm.conf-custom $DIR/$RESTOREDIR/

Well the principal thing , i need know how replace "gconftool-2" in Xfce & Mate

and how to use , that for save the "varibles" values , inside a new script , for restore later

i can write something to try detect the Desktop in use , for example

#!/bin/sh
#!/bin/bash
#
# Autor	:	Inukaze ( Venezuela )
# Sitio		:	http://inukaze.wordpResolucions.com
# Correo-E	:	inukaze.otaku@gmail.com
# Licensia	:	GPL 3
#
# Acerca de este Script	:
#
# Es para cambiar con mayor comodidad tu
# Tema de Escritorio , me refiero a cambiar :
#
# Motor(es) / Controles / Botones
# Cursores
# Iconos
# Fuentes
# Papel Tapiz / Fondo de Pantalla
#
# Primero que nada guardando un respaldo
# de tu tema actual en uso , en caso de que
# no te guste , puedas restaurarlo comodamente
#
#

# Detectar Escritorio en uso :
DIR=(pwd)

MATE=$(ps -A		        |	grep mate-session		|	awk '{print $4}')
XFCE=$(ps -A			|	grep xfce-session		|	awk '{print $4}')
XFCE4=$(ps -A			|	grep xfce4-session		|	awk '{print $4}')

# Guardar la Resolución En caso de querer Aplicar
# un Fondo de Pantalla para para la resolución Actual
# en caso de tener varios

# Guardar - Resolución :
echo `xrandr --current | grep current | awk '{print $8}'` >> Resolucion1
echo `xrandr --current | grep current | awk '{print $10}'` >> Resolucion2
cat Resolucion2 | sed -i 's/,//g' Resolucion2
P1Resolucion=$(cat Resolucion1)
P2Resolucion=$(cat Resolucion2)
rm Resolucion1 Resolucion2
echo "$P1Resolucion"'x'"$P2Resolucion" >> Resolucion
Resolucion=$(cat Resolucion)
rm Resolucion
# Guardar - Resolución .

Well i need just a few help to adapt the Script to save actual values of variables

Style Name
Icon Theme Name
Font Name
Cursors Theme Name
Wallpaper(s) full path


for Xfce & Mate .

Thank you big_smile

Offline

#2 2014-08-24 13:21:06

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 10,948

Re: I wanna make a Scripts for Themes.

For Xfce, you would use xfconf-query to set the new values. All of these channels and properties can be viewed in the Settings Editor (Settings Manager >> Settings Editor). Specific to what you have requested above:

1. Style Name
Xfce has 2 different styles, the GTK style and xfwm4 style:

GTK style:

xfconf-query -c xsettings -p /Net/ThemeName -s <GTK_STYLE_NAME>

Xfwm4 style:

xfconf-query -c xfwm4 -p /general/theme -s <XFWM4_STYLE_NAME>

The theme-required engines need to be pre-installed. There is no setting for them.

2. Icon Theme

xfconf-query -c xsettings -p /Net/IconThemeName -s <ICON_THEME_NAME>

3. Font Name

xfconf-query -c xsettings -p /Gtk/FontName -s "<FONT_NAME>"

4. Mouse Cursor Theme

xfconf-query -c xsettings -p /Gtk/CursorName -s "<CURSOR_NAME>"
xfconf-query -c xsettings -p /Gtk/CursorThemeSize -s <CURSOR_SIZE>

5. Wallpaper
There are a number of settings that can be set for wallpapers. It gets further complicated by the fact that the xfdesktop module changed significantly between 4.10 and 4.11 (where in 4.11 you can now have individual wallpapers per workspace). Add to this the fact that it will not be easy as you need to identify the active screen, monitor and the associated workspaces (for 4.11). To see all of the settings, look at the xfce4-desktop channel in the settings editor. On a basic laptop system, one screen...

To set the wallpaper (4.10):

xfconf-query -c xfce4-desktop -p /backdrop/<SCREEN>/<MONITOR>/image-path -s <PATH_TO_IMAGE>

...you can also adjust values such as brightness, saturation image-style (Auto=0, Centered=1, Tiled=2, Stretched=3, Scaled=4, Zoomed=5). Example:

xfconf-query -c xfce4-desktop -p /backdrop/<SCREEN>/<MONITOR>/brightness -s <BRIGHTNESS_VALUE>
xfconf-query -c xfce4-desktop -p /backdrop/<SCREEN>/<MONITOR>/saturation -s <SATURATION_VALUE>
xfconf-query -c xfce4-desktop -p /backdrop/<SCREEN>/<MONITOR>/image-style -s <IMAGE_STYLE_VALUE>

To set the wallpaper (4.11):

xfconf-query -c xfce4-desktop -p /backdrop/<SCREEN>/<MONITOR>/WORKSPACE>/image-path -s <PATH_TO_IMAGE>

...you can also adjust values such as brightness, saturation image-style (Auto=0, Centered=1, Tiled=2, Stretched=3, Scaled=4, Zoomed=5). Example:

xfconf-query -c xfce4-desktop -p /backdrop/<SCREEN>/<MONITOR>/WORKSPACE>/brightness -s <BRIGHTNESS_VALUE>
xfconf-query -c xfce4-desktop -p /backdrop/<SCREEN>/<MONITOR>/WORKSPACE>/saturation -s <SATURATION_VALUE>
xfconf-query -c xfce4-desktop -p /backdrop/<SCREEN>/<MONITOR>/WORKSPACE>/image-style -s <IMAGE_STYLE_VALUE>

...You'll need to do this for each workspace. To enable/disable wallpaper/workspace:

xfconf-query -c xfce4-desktop -p /backdrop/single-workspace-mode -s <TRUE_OR_FALSE>

The most difficult part will be pre-identifying which screen/monitor/workspace values to use.


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 2014-08-24 14:46:33

inukaze
Member
Registered: 2014-07-31
Posts: 46

Re: I wanna make a Scripts for Themes.

And how to save first , the current values in a file ????

Its for restore , after the chance , if the user , dont like the Theme Change.

Offline

#4 2014-08-24 16:17:00

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 10,948

Re: I wanna make a Scripts for Themes.

That is really a bash question more than an Xfce question. You might get more mileage asking in a bash-related forum.

From my knowledge of bash, you can use > & >> to redirect variables to files and "source" to read them back in again. For example, consider the following possible variables in your script:

GTK_THEME=Greybird
XFWM4_THEME=Greybird
ICON_THEME=elementary
MOUSE_CURSOR_THEME=default
MOUSE_CURSOR_SIZE=24
WALLPAPER=/home/toz/Pictures/wall.jpg

You could save them to a file via:

echo GTK_THEME=$GTK_THEME > /home/$USER/myconfig.cfg
echo XFWM4_THEME=$XFWM4_THEME >> /home/$USER/myconfig.cfg
echo ICON_THEME=$ICON_THEME >> /home/$USER/myconfig.cfg
echo MOUSE_CURSOR_THEME=$MOUSE_CURSOR_THEME >> /home/$USER/myconfig.cfg
echo MOUSE_CURSOR_SIZE=$MOUSE_CURSOR_SIZE >> /home/$USER/myconfig.cfg
echo WALLPAPER=$WALLPAPER >> /home/$USER/myconfig.cfg

Then you can read them back in simply by sourcing the file:

source /home/$USER/myconfig.cfg

Here is a sample proof of concept code:

#!/bin/bash

show_values ()
{
echo "Here are the current values......"
echo GTK_THEME=$GTK_THEME
echo XFWM$_THEME=$XFWM4_THEME
echo ICON_THEME=$ICON_THEME
echo MOUSE_CURSOR_THEME=$MOUSE_CURSOR_THEME
echo MOUSE_CURSOR_SIZE=$MOUSE_CURSOR_SIZE
echo WALLPAPER=$WALLPAPER
echo 
}

show_values

# Set some values:
echo "Setting values...."
GTK_THEME=Greybird
XFWM4_THEME=Greybird
ICON_THEME=elementary
MOUSE_CURSOR_THEME=default
MOUSE_CURSOR_SIZE=24
WALLPAPER=/home/toz/Pictures/wall.jpg
echo

show_values

# Save the values to a file:
echo "Saving values to a file....."
echo GTK_THEME=$GTK_THEME > /home/$USER/myconfig.cfg
echo XFWM4_THEME=$XFWM4_THEME >> /home/$USER/myconfig.cfg
echo ICON_THEME=$ICON_THEME >> /home/$USER/myconfig.cfg
echo MOUSE_CURSOR_THEME=$MOUSE_CURSOR_THEME >> /home/$USER/myconfig.cfg
echo MOUSE_CURSOR_SIZE=$MOUSE_CURSOR_SIZE >> /home/$USER/myconfig.cfg
echo WALLPAPER=$WALLPAPER >> /home/$USER/myconfig.cfg
echo

# clear the values:
echo "Clearing values....."
GTK_THEME=
XFWM4_THEME=
ICON_THEME=
MOUSE_CURSOR_THEME=
MOUSE_CURSOR_SIZE=
WALLPAPER=
echo

show_values

# read values back in from file
echo "Reading values back in from file...."
source /home/$USER/myconfig.cfg
echo

show_values

exit 0

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 2014-08-24 19:47:41

inukaze
Member
Registered: 2014-07-31
Posts: 46

Re: I wanna make a Scripts for Themes.

I know how to make scripts in bash , but i dont know if the xfce4 , have a tool to get that values directly from Xfce4 env variables XD.

Offline

#6 2014-08-24 19:56:19

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 10,948

Re: I wanna make a Scripts for Themes.

Yes, xfconf-query.


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

#7 2014-08-25 23:42:47

inukaze
Member
Registered: 2014-07-31
Posts: 46

Re: I wanna make a Scripts for Themes.

Thank you , for the information , when i finish the Script , i post here , just its someone can give me some suggestions to make it better.

Offline

#8 2014-10-01 02:50:40

inukaze
Member
Registered: 2014-07-31
Posts: 46

Re: I wanna make a Scripts for Themes.

the plugin-ids , are needed???

$ xfconf-query -c xfce4-panel -p /panels/panel-1/plugin-ids -l -v
/panels/panel-1/plugin-ids  <<UNSUPPORTED>>

or

$ xfconf-query -c xfce4-panel -p /panels/panel-1/plugin-ids -v
El valor es un vector con 6 elementos:

1
34
15
24
27
2

Ok im trying to save in "TESTVAR=$(xfconf-query -c xfce4-panel -p /panels/panel-1/plugin-ids -v)"

$ echo $TESTVAR
El valor es un vector con 6 elementos: 1 34 15 24 27 2

how i can set from cli ???

Last edited by inukaze (2014-10-01 03:00:16)

Offline

#9 2014-10-01 10:26:17

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 10,948

Re: I wanna make a Scripts for Themes.

According to the xfconf-query document linked above, it would be:

xfconf-query -c xfce4-panel -p /panels/panel-1/plugin-ids  -t int -t int -t int -t int -t int -t int -s 1 -s 34 -s 15 -s 24 -s 27 -s 2

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

#10 2014-10-01 13:19:23

inukaze
Member
Registered: 2014-07-31
Posts: 46

Re: I wanna make a Scripts for Themes.

ok , but its for my script , i question too , in -> http://stackoverflow.com/questions/2613 … tore-theme

Well , its for the script , you know well i try to think in something to solve this XD for my Script

Offline

Board footer

Powered by FluxBB