/
ptheme_roxpin
executable file
·144 lines (132 loc) · 5.56 KB
/
ptheme_roxpin
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
#!/bin/sh
#ptheme_roxpin - change rox pinboard icons
#Copyright - GPL 2014,2015,2016
#Sigmund Berglund
[ -z $ROX_DESKTOP ] && pidof ROX-Filer &>/dev/null && export ROX_DESKTOP=yes
if [ ! "$ROX_DESKTOP" ] ; then
exit
fi
export TEXTDOMAIN=ptheme
export OUTPUT_CHARSET=UTF-8
export WORKDIR=$HOME/.ptheme/tmp/ptheme
[ ! -d $WORKDIR ] && mkdir -p $WORKDIR
find /usr/share/ptheme/rox_pinboard -mindepth 1 -maxdepth 1 -type f -printf "%f\n" | sort > $WORKDIR/ptheme_roxpins
apply_roxpin (){
[ "`grep -F 'pwidgets' <<< $(ps -eo pid,command)`" ] && UPDATE_PWIDGETS=true
TMP_BACKDROP="`grep -F '<backdrop ' $HOME/Choices/ROX-Filer/PuppyPin`"
TMP_DRIVEICONS="`grep -F '.pup_event' $HOME/Choices/ROX-Filer/PuppyPin`"
TMP_MYICONS="`grep -F '<icon' $HOME/Choices/ROX-Filer/PuppyPin | grep -vE ".pup_event|default|/local/apps|wizardwizard|urxvt|pmount|puppyhelp|rox|dotpup"`"
echo -e '<?xml version="1.0"?>\n<pinboard>' > $WORKDIR/tmp_puppypin
echo "$TMP_BACKDROP" >> $WORKDIR/tmp_puppypin
cat /usr/share/ptheme/rox_pinboard/"$ROXPIN" >> $WORKDIR/tmp_puppypin
echo "$TMP_MYICONS" >> $WORKDIR/tmp_puppypin
echo "$TMP_DRIVEICONS" >> $WORKDIR/tmp_puppypin
echo '</pinboard>' >> $WORKDIR/tmp_puppypin
mv $WORKDIR/tmp_puppypin $HOME/Choices/ROX-Filer/PuppyPin
PID=`grep '/bin/ash.*/sbin/pup_event_frontend_d' <<< $(ps -eo pid,command) | awk '{print $1}'`
kill -9 $PID
echo 'ICONWIPE' > /tmp/pup_event_icon_change_flag
/sbin/clean_desk_icons
roxfiler -p "$HOME/Choices/ROX-Filer/PuppyPin"
kill $(pidof pup_event_frontend_d)
pup_event_frontend_d &
[ "UPDATE_PWIDGETS" ] && fixwidgets
}
save_roxpin (){
export savebox='
<window title="pTheme - '$(gettext 'Save')'" icon-name="gtk-save" resizable="false">
<vbox>
<frame Save>
<hbox>
<text><label>'$(gettext 'Template name')'</label></text>
<comboboxentry width-request="300">
<variable>SAVEFILE</variable>
<input file>'$WORKDIR'/ptheme_roxpins</input>
</comboboxentry>
</hbox>
</frame>
<hbox space-expand="false" space-fill="false">
<button>
'"`/usr/lib/gtkdialog/xml_button-icon cancel`"'
<label>'$(gettext 'Cancel')'</label>
<action type="exit">cancel</action>
</button>
<button can-default="true" has-default="true" use-stock="true">
'"`/usr/lib/gtkdialog/xml_button-icon save`"'
<label>'$(gettext 'Save')'</label>
<action type="exit">save</action>
</button>
</hbox>
</vbox>
</window>'
for STATEMENTS in "$(gtkdialog -p savebox --center)"; do
eval $STATEMENTS 2> /dev/null
done
if [ "$EXIT" = "save" ]; then
if [ -f "/usr/share/ptheme/rox_pinboard/$SAVEFILE" ]; then
. /usr/lib/gtkdialog/box_yesno "pTheme" "$(gettext 'Theme already exist.')" "<b>$(gettext 'Do you want to overwrite?')</b>"
[ $EXIT = "no" ] && exit
fi
grep -Fv '<.pup_event ' $HOME/Choices/ROX-Filer/PuppyPin | grep -F '<icon ' > "/usr/share/ptheme/rox_pinboard/$SAVEFILE"
ls -1A /usr/share/ptheme/rox_pinboard > $WORKDIR/ptheme_roxpins #update list in gui
fi
}
export -f apply_roxpin save_roxpin
export pThemeRoxPin='
<window title="'$(gettext 'Desktop icons')'" icon-name="gtk-preferences">
<vbox space-expand="true" space-fill="true">
'"`/usr/lib/gtkdialog/xml_info fixed "puppy_theme.svg" 60 "<b>$(gettext 'Desktop icons')</b>" "$(gettext 'What icons should be placed on the desktop. Choose a template or save existing icons setup to a new one.')"`"'
<frame '$(gettext 'Desktop icons templates')'>
<tree rules_hint="true" space-expand="true" space-fill="true">
<label>'$(gettext 'Themes')'</label>
<variable>ROXPIN</variable>
<height>200</height><width>50</width>
<input file>'$WORKDIR'/ptheme_roxpins</input>
<action>apply_roxpin</action>
</tree>
<hbox space-expand="true" space-fill="true">
<button space-expand="false" space-fill="false">
'"`/usr/lib/gtkdialog/xml_button-icon harddisk.svg`"'
<action>eventmanager desktop &</action>
</button>
<text xalign="0" space-expand="true" space-fill="true"><label>'$(gettext 'Manage drive icons')'</label></text>
</hbox>
<hbox space-expand="true" space-fill="true">
<button space-expand="false" space-fill="false">
'"`/usr/lib/gtkdialog/xml_button-icon desktop_icons.svg`"'
<action>icon_switcher &</action>
</button>
<text xalign="0" space-expand="true" space-fill="true"><label>'$(gettext 'Icons theme')'</label></text>
</hbox>
<hbox space-expand="true" space-fill="true">
<button space-expand="false" space-fill="false">
'"`/usr/lib/gtkdialog/xml_button-icon puppy_theme.svg`"'
<action>ptheme &</action>
</button>
<text xalign="0" space-expand="true" space-fill="true"><label>'$(gettext 'Global theming')'</label></text>
</hbox>
</frame>
<hbox space-expand="false" space-fill="false">
<text space-expand="true" space-fill="true"><label>""</label></text>
<button>
'"`/usr/lib/gtkdialog/xml_button-icon save`"'
<label>'$(gettext 'Save my icon setup')'</label>
<action>save_roxpin</action>
<action>refresh:SAVE</action>
</button>
<button>
'"`/usr/lib/gtkdialog/xml_button-icon apply`"'
<label>'$(gettext 'Apply')'</label>
<action>apply_roxpin</action>
</button>
<button>
'"`/usr/lib/gtkdialog/xml_button-icon quit`"'
<label>'$(gettext 'Quit')'</label>
<action>EXIT:exit</action>
</button>
'"`/usr/lib/gtkdialog/xml_scalegrip`"'
</hbox>
</vbox>
</window>'
. /usr/lib/gtkdialog/xml_info gtk #build bg_pixmap for gtk-theme
gtkdialog -p pThemeRoxPin 2> /dev/null