3
# Theme creator for Cairo-Dock
5
# Copyright : (C) 2008 by Fabounet
6
# E-mail : fabounet@glx-dock.org
9
# This program is free software; you can redistribute it and/or
10
# modify it under the terms of the GNU General Public License
11
# as published by the Free Software Foundation; either version 2
12
# of the License, or (at your option) any later version.
14
# This program is distributed in the hope that it will be useful,
15
# but WITHOUT ANY WARRANTY; without even the implied warranty of
16
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
# GNU General Public License for more details.
18
# http://www.gnu.org/licenses/licenses.html#GPL
21
# Contact : nochka85@glx-dock.org
25
# 05/07/08 : Ajout catégorie drive_internet ET specific_vlc_icon
26
# 05/07/08 : Refonte totale du scipt + Ajout de fonctionnalités (choix des catégories dans une liste coché ou décoché)... ;-)
27
# 02/07/08 : Ajout de l'option --test - 1ere mise en ligne sur le FTP ;-)
28
# 01/07/08 : Ajout des catégories specific_firefox_icon, specific_thunderbird_icon, specific_inkscape_icon, specific_gimp_icon, launcher, settings, gohome ET system_search
29
# 30/06/08 : Ajout de catégories + Ajout d'icônes spécifiques + Ajout options --relink --[category] --help
30
# 29/06/08 : Ajout detection format + répertoire source + amelioration diverse
31
# 29/06/08 : Ebauche du programme
34
DEBUG=0 # Attention, ne pas oublier de remettre a 0 pour une MAJ du script ... quand ce sera dispo ;-)
36
# ICONS_DIR="/home/$USER/cairo-dock_theme-creator/" ## Pour moi ;-)
37
ICONS_DIR="/home/$USER/.cairo-dock/icons_themes/"
39
# MAIN_CAT="web_browser mail_reader video_messenger video_player" # Encore pour moi :-)
40
MAIN_CAT="web_browser file_browser mail_reader image_reader audio_player video_player writer bittorrent downloader cd_burner settings gohome system_search launcher image_editor text_messenger video_messenger terminal packages system_monitor calculator virtual_machine remote_control logo_distribution home_folder default_folder desktop computer webcam irc"
42
DRIVES_CAT="drive_usb_mounted drive_usb_unmounted network_folder harddrive drive_optical floppy_unmounted drive_internet"
44
#SPECIFICS_CAT="specific_firefox_icon" # Encore pour moi :-)
45
SPECIFICS_CAT="googleearth specific_skype_icon specific_amsn_icon specific_gaim_icon specific_oowriter_icon specific_oodraw_icon specific_oocalc_icon specific_ooimpress_icon specific_oobase_icon specific_oomath_icon specific_update_manager specific_firefox_icon specific_thunderbird_icon specific_inkscape_icon specific_gimp_icon specific_vlc_icon"
49
## Catégories MAIN_CAT :
50
LINKS_WEB_BROWSER="firefox firefox-3.0 opera epiphany"
51
LINKS_FILE_BROWSER="nautilus konqueror thunar pcmanfm"
52
LINKS_MAIL_READER="thunderbird kmail evolution"
53
LINKS_IMAGE_READER="eog gqview gwenview f-spot"
54
LINKS_AUDIO_PLAYER="rhythmbox exaile xmms listen audacious beep-media-player bmp amarok"
55
LINKS_VIDEO_PLAYER="totem mplayer vlc xine kaffeine smplayer"
56
LINKS_WRITER="gedit kate oowriter ooo-writer abiword emacs mousepad"
57
LINKS_BITTORRENT="transmission deluge bittornado gnome-btdownload ktorrent"
58
LINKS_DOWNLOADER="amule emule filezilla"
59
LINKS_CD_BURNER="nautilus-burner graveman k3b brasero gnomebaker"
60
LINKS_SETTINGS="gnome-settings"
62
LINKS_SYSTEM_SEARCH="system-search tracker-search-tool"
63
LINKS_LAUNCHER="gnome-panel-launcher"
64
LINKS_IMAGE_EDITOR="gimp inkscape krita"
65
LINKS_TEXT_MESSENGER="gaim pidgin kopete emessene"
66
LINKS_VIDEO_MESSENGER="skype ekiga amsn"
67
LINKS_TERMINAL="gnome-terminal konsole xfce4-terminal"
68
LINKS_PACKAGES="synaptic adept pacman-g2 update-manager"
69
LINKS_SYSTEM_MONITOR="ksysguard gnome-system-monitor utilities-system-monitor conky"
70
LINKS_CALCULATOR="gnome-calculator accessories-calculator gcalctool crunch"
71
LINKS_VIRTUAL_MACHINE="VBox vmware-server"
72
LINKS_REMOTE_CONTROL="tsclient"
73
LINKS_LOGO_DISTRIBUTION="distributor-logo gnome-main-menu start-here"
74
LINKS_HOME_FOLDER="user-home gnome-fs-home folder_home"
75
LINKS_DEFAULT_FOLDER="folder gnome-fs-directory"
76
LINKS_DESKTOP="desktop"
77
LINKS_COMPUTER="computer"
79
LINKS_IRC="xchat konversation kvirc"
81
## Catégories DRIVES_CAT :
82
LINKS_DRIVE_USB_MOUNTED="drive-harddisk-usb"
83
LINKS_DRIVE_USB_UNMOUNTED="drive-removable-media-usb"
84
LINKS_NETWORK_FOLDER="network folder-remote"
85
LINKS_HARDDRIVE="gnome-dev-harddisk drive-harddisk"
86
LINKS_DRIVE_OPTICAL="drive-optical"
87
LINKS_FLOPPY_UNMOUNTED="drive-removable-media"
88
LINKS_DRIVE_INTERNET="applications-internet gnome-globe package_network redhat-internet stock_internet xfce-internet"
90
## Catégories SPECIFICS_CAT :
91
LINKS_GOOGLEEARTH="googleearth"
92
LINKS_SPECIFIC_SKYPE_ICON="skype"
93
LINKS_SPECIFIC_AMSN_ICON="amsn"
94
LINKS_SPECIFIC_GAIM_ICON="gaim"
95
LINKS_SPECIFIC_OOWRITER_ICON="oowriter ooo-writer"
96
LINKS_SPECIFIC_OODRAW_ICON="oodraw ooo-draw"
97
LINKS_SPECIFIC_OOCALC_ICON="oocalc ooo-calc"
98
LINKS_SPECIFIC_OOIMPRESS_ICON="ooimpress ooo-impress"
99
LINKS_SPECIFIC_OOBASE_ICON="oobase ooo-base"
100
LINKS_SPECIFIC_OOMATH_ICON="oomath ooo-math"
101
LINKS_SPECIFIC_UPDATE_MANAGER="update-manager"
102
LINKS_SPECIFIC_FIREFOX_ICON="firefox firefox-3.0"
103
LINKS_SPECIFIC_THUNDERBIRD_ICON="thunderbird"
104
LINKS_SPECIFIC_INKSCAPE_ICON="inkscape"
105
LINKS_SPECIFIC_GIMP_ICON="gimp"
106
LINKS_SPECIFIC_VLC_ICON="vlc"
114
SCRIPT="cairo-dock_theme-creator.sh" #OK
115
SCRIPT_SAVE="cairo-dock_theme-creator.sh.save" #OK
116
SCRIPT_NEW="cairo-dock_theme-creator.sh.new" #OK
117
HOST="http://theme_creator.glx-dock.org" #OK
130
START_DIR="/home/$USER/" #OK
137
TEST_FILE="test_links.log" #OK
147
#############################################################################################################
149
## Catégories MAIN_CAT :
150
if [ $current_category = "web_browser" ]; then LINKS=$LINKS_WEB_BROWSER;
151
elif [ $current_category = "file_browser" ]; then LINKS=$LINKS_FILE_BROWSER;
152
elif [ $current_category = "mail_reader" ]; then LINKS=$LINKS_MAIL_READER;
153
elif [ $current_category = "image_reader" ]; then LINKS=$LINKS_IMAGE_READER;
154
elif [ $current_category = "audio_player" ]; then LINKS=$LINKS_AUDIO_PLAYER;
155
elif [ $current_category = "video_player" ]; then LINKS=$LINKS_VIDEO_PLAYER;
156
elif [ $current_category = "writer" ]; then LINKS=$LINKS_WRITER;
157
elif [ $current_category = "bittorrent" ]; then LINKS=$LINKS_BITTORRENT;
158
elif [ $current_category = "downloader" ]; then LINKS=$LINKS_DOWNLOADER;
159
elif [ $current_category = "cd_burner" ]; then LINKS=$LINKS_CD_BURNER;
160
elif [ $current_category = "settings" ]; then LINKS=$LINKS_SETTINGS;
161
elif [ $current_category = "gohome" ]; then LINKS=$LINKS_GOHOME;
162
elif [ $current_category = "system_search" ]; then LINKS=$LINKS_SYSTEM_SEARCH;
163
elif [ $current_category = "launcher" ]; then LINKS=$LINKS_LAUNCHER;
164
elif [ $current_category = "image_editor" ]; then LINKS=$LINKS_IMAGE_EDITOR;
165
elif [ $current_category = "text_messenger" ]; then LINKS=$LINKS_TEXT_MESSENGER;
166
elif [ $current_category = "video_messenger" ]; then LINKS=$LINKS_VIDEO_MESSENGER;
167
elif [ $current_category = "terminal" ]; then LINKS=$LINKS_TERMINAL;
168
elif [ $current_category = "packages" ]; then LINKS=$LINKS_PACKAGES;
169
elif [ $current_category = "system_monitor" ]; then LINKS=$LINKS_SYSTEM_MONITOR;
170
elif [ $current_category = "calculator" ]; then LINKS=$LINKS_CALCULATOR;
171
elif [ $current_category = "virtual_machine" ]; then LINKS=$LINKS_VIRTUAL_MACHINE;
172
elif [ $current_category = "remote_control" ]; then LINKS=$LINKS_REMOTE_CONTROL;
173
elif [ $current_category = "logo_distribution" ]; then LINKS=$LINKS_LOGO_DISTRIBUTION;
174
elif [ $current_category = "home_folder" ]; then LINKS=$LINKS_HOME_FOLDER;
175
elif [ $current_category = "default_folder" ]; then LINKS=$LINKS_DEFAULT_FOLDER;
176
elif [ $current_category = "desktop" ]; then LINKS=$LINKS_DESKTOP;
177
elif [ $current_category = "computer" ]; then LINKS=$LINKS_COMPUTER;
178
elif [ $current_category = "webcam" ]; then LINKS=$LINKS_WEBCAM;
179
elif [ $current_category = "irc" ]; then LINKS=$LINKS_IRC;
182
## Catégories DRIVES_CAT :
183
elif [ $current_category = "drive_usb_mounted" ]; then LINKS=$LINKS_DRIVE_USB_MOUNTED;
184
elif [ $current_category = "drive_usb_unmounted" ]; then LINKS=$LINKS_DRIVE_USB_UNMOUNTED;
185
elif [ $current_category = "network_folder" ]; then LINKS=$LINKS_NETWORK_FOLDER;
186
elif [ $current_category = "harddrive" ]; then LINKS=$LINKS_HARDDRIVE;
187
elif [ $current_category = "drive_optical" ]; then LINKS=$LINKS_DRIVE_OPTICAL;
188
elif [ $current_category = "floppy_unmounted" ]; then LINKS=$LINKS_FLOPPY_UNMOUNTED;
189
elif [ $current_category = "drive_internet" ]; then LINKS=$LINKS_DRIVE_INTERNET;
191
## Catégories SPECIFICS_CAT :
192
elif [ $current_category = "googleearth" ]; then LINKS=$LINKS_GOOGLEEARTH;
193
elif [ $current_category = "specific_skype_icon" ]; then LINKS=$LINKS_SPECIFIC_SKYPE_ICON;
194
elif [ $current_category = "specific_amsn_icon" ]; then LINKS=$LINKS_SPECIFIC_AMSN_ICON;
195
elif [ $current_category = "specific_gaim_icon" ]; then LINKS=$LINKS_SPECIFIC_GAIM_ICON;
196
elif [ $current_category = "specific_oowriter_icon" ]; then LINKS=$LINKS_SPECIFIC_OOWRITER_ICON;
197
elif [ $current_category = "specific_oodraw_icon" ]; then LINKS=$LINKS_SPECIFIC_OODRAW_ICON;
198
elif [ $current_category = "specific_oocalc_icon" ]; then LINKS=$LINKS_SPECIFIC_OOCALC_ICON;
199
elif [ $current_category = "specific_ooimpress_icon" ]; then LINKS=$LINKS_SPECIFIC_OOIMPRESS_ICON;
200
elif [ $current_category = "specific_oobase_icon" ]; then LINKS=$LINKS_SPECIFIC_OOBASE_ICON;
201
elif [ $current_category = "specific_oomath_icon" ]; then LINKS=$LINKS_SPECIFIC_OOMATH_ICON;
202
elif [ $current_category = "specific_update_manager" ]; then LINKS=$LINKS_SPECIFIC_UPDATE_MANAGER;
203
elif [ $current_category = "specific_firefox_icon" ]; then LINKS=$LINKS_SPECIFIC_FIREFOX_ICON;
204
elif [ $current_category = "specific_thunderbird_icon" ]; then LINKS=$LINKS_SPECIFIC_THUNDERBIRD_ICON;
205
elif [ $current_category = "specific_inkscape_icon" ]; then LINKS=$LINKS_SPECIFIC_INKSCAPE_ICON;
206
elif [ $current_category = "specific_gimp_icon" ]; then LINKS=$LINKS_SPECIFIC_GIMP_ICON;
207
elif [ $current_category = "specific_vlc_icon" ]; then LINKS=$LINKS_SPECIFIC_VLC_ICON;
212
#############################################################################################################
214
cp $SCRIPT $SCRIPT_SAVE #pour moi :)
216
echo "Vérification de la disponibilité d'un nouveau script"
217
wget $HOST/$SCRIPT -q -O $SCRIPT_NEW
218
diff $SCRIPT $SCRIPT_NEW >/dev/null
219
if [ $? -eq 1 ]; then
221
echo "Veuillez relancer le script, une mise à jour a été téléchargée"
223
mv $SCRIPT_NEW $SCRIPT
225
zenity --info --title="Cairo-Dock Theme Creator" --text="Une mise à jour a été téléchargée. Cliquez sur Ok pour fermer le terminal."
229
echo -e "$VERT""Vous possédez la dernière version du script de Nochka85"
236
#############################################################################################################
238
# Remise à zéro des variables:
247
START_DIR="/home/$USER/" #OK
260
START_MENU=$(zenity --width=800 --height=400 --list --separator " " --column="Choix" --column="Action" --column="Observation" --radiolist --text="Choisissez l'action à effectuer (Cliquez sur "Annuler" pour quitter) :" --title="CD Theme Creator" \
261
true "NOUVEAU THEME D'ICÔNES" "Créez un nouveau thème d'icônes standard pour Cairo-dock" \
262
false "Re-créer les liens d'un thème d'icônes standard" "A effectuer en cas de liens cassés et/ou manquants dans un thème d'icônes créé avec ce script" \
263
false "Sélectionner les catégories dans une liste" "Sélectionnez vous même les catégories à traiter dans une liste (TOUT DECOCHE par défaut)" \
264
false "Désélectionner les catégories dans une liste" "Sélectionnez vous même les catégories à traiter dans une liste (TOUT COCHE par défaut)" \
265
false "Tester ou contrôler un thème d'icônes existant" "Retrouvez facilement les catégories et les liens qu'il manque à votre thème d'icônes")
268
if [ "$START_MENU" = "" ]; then
272
for temp in $START_MENU
275
if [ $temp = "NOUVEAU THEME D'ICÔNES" ]; then
279
elif [ $temp = "Re-créer les liens d'un thème d'icônes standard" ]; then
283
elif [ $temp = "Sélectionner les catégories dans une liste" ]; then
287
elif [ $temp = "Désélectionner les catégories dans une liste" ]; then
291
elif [ $temp = "Tester ou contrôler un thème d'icônes existant" ]; then
301
#############################################################################################################
303
choose_category # Definition de $TODO_FINAL
304
working_directory # Definition du nom du répertoire $WORK_DIR
305
new_directory # Création du nouveau répertoire
307
REDO_DIR="$START_DIR"
308
copy_categories # Copie des icônes des différentes catégories
309
relink_icons # Création des liens
310
zenity --info --title="CD Theme Creator" --text="Votre thème a été créé dans le répertoire:\n$WORK_DIR"
313
#############################################################################################################
315
tempo_text="Spécifier le répertoire dans lequel re-créer les liens"
318
zenity --info --title="CD Theme Creator" --text="Tous les liens ont été re-créés dans :\n$WORK_DIR\n\nCliquer sur Valider pour revenir au menu principal..."
321
#############################################################################################################
327
#############################################################################################################
333
#############################################################################################################
334
select_true_false() {
336
detail_list # Definition de $TODO_FINAL et $WORK_DIR
338
REDO_DIR="$START_DIR"
339
copy_categories # Copie des icônes des différentes catégories
340
relink_icons # Création des liens
341
zenity --info --title="CD Theme Creator" --text="Toutes les catégories sélectionnées ont été créés dans le répertoire:\n$WORK_DIR"
345
#############################################################################################################
348
TODO_LIST=$(zenity --width=750 --height=400 --list --column="Choix" --column="Catégories" --column="Observation" --checklist --text="Choisissez les catégories d'icônes à traiter\n\nATTENTION : Les icônes génériques sont OBLIGATOIRES\n" --title="CD Theme Creator" \
349
true "Icônes génériques" "Ce sont les icônes OBLIGATOIRES pour un thème standard cairo-dock" \
350
false "Icônes des VOLUMES" "Conseillés pour certaines applets de cairo-dock" \
351
false "Icônes spécifiques" "Permettent de "surcharger" les icônes génériques pour certaines applications (exemple : Firefox, Thunderbird,etc...)")
353
if [ "$TODO_LIST" = "" ]; then start_menu
357
for temp in $TODO_LIST
360
if [ $temp = "Icônes génériques" ]; then
361
for categorie in $MAIN_CAT
363
TODO_FINAL="$TODO_FINAL$categorie "
366
elif [ $temp = "Icônes des VOLUMES" ]; then
367
for categorie in $DRIVES_CAT
369
TODO_FINAL="$TODO_FINAL$categorie "
372
elif [ $temp = "Icônes spécifiques" ]; then
373
for categorie in $SPECIFICS_CAT
375
TODO_FINAL="$TODO_FINAL$categorie "
384
#############################################################################################################
385
working_directory() {
386
THEME_NAME=$(zenity --entry --title="CD Theme Creator" --text="Entrez le nom de votre thème d'icônes (il sera placé dans $ICONS_DIR)")
387
if [ "$THEME_NAME" = "" ]; then
388
zenity --error --text "Aucun nom n'a été rentré ou l'opération a été annulée..."
392
WORK_DIR="$ICONS_DIR$THEME_NAME"/
397
#############################################################################################################
399
if test -e $ICONS_DIR$THEME_NAME; then
400
zenity --error --text "Le répertoire $THEME_NAME existe déjà dans \n $ICONS_DIR\nVeuillez entrer un autre nom pour votre thème d'icônes..."
408
#############################################################################################################
410
for current_category in $TODO_FINAL
413
if [ "$CURRENT_ICON" != "" ]; then
414
rm -f $WORK_DIR.$current_category.*
415
cp -f $CURRENT_ICON $WORK_DIR.$current_category.$FORMAT
421
#############################################################################################################
423
zenity --info --title="CD Theme Creator" --text="Choisissez une image pour "$current_category"\n\nAnnuler pour passer\n"
424
CURRENT_ICON=$(zenity --file-selection --filename $REDO_DIR --title="CD Theme Creator - Image "$current_category)
425
if [ "$CURRENT_ICON" != "" ]; then
426
REDO_DIR=`dirname $CURRENT_ICON`/ # Répertoire de l'icône
427
GLOBAL_NAME=`basename $CURRENT_ICON` # Nom de l'image avec son extension
428
FILENAME=${GLOBAL_NAME%.*} # Nom du fichier SANS extension
429
FORMAT=${GLOBAL_NAME##*.} # Extension SEULE
434
#############################################################################################################
437
for categorie in $MAIN_CAT
439
TODO_FINAL="$TODO_FINAL$categorie "
442
for categorie in $DRIVES_CAT
444
TODO_FINAL="$TODO_FINAL$categorie "
447
for categorie in $SPECIFICS_CAT
449
TODO_FINAL="$TODO_FINAL$categorie "
452
zenity --info --title="CD Theme Creator" --text="$tempo_text"
453
WORK_DIR=$(zenity --file-selection --filename $ICONS_DIR --directory --title="CD Theme Creator")/
455
if [ "$WORK_DIR" = "/" ]; then
456
zenity --error --text "L'opération a été annulée..."
464
#############################################################################################################
467
for current_category in $TODO_FINAL
469
for FORMAT in "svg" "png"
471
if test -e $WORK_DIR.$current_category.$FORMAT; then
477
ln -s -f .$current_category.$FORMAT $links.$FORMAT
486
#############################################################################################################
489
for current_category in $TODO_FINAL
498
DETAIL_LIST="$DETAIL_LIST$TRUE_FALSE $current_category $temp "
502
TODO_FINAL=$(zenity --width=750 --height=400 --list --column="Choix" --column="Catégories" --column="Liste des applications concernées" --checklist --text="Choisissez les catégories d'icônes à traiter\n\nATTENTION : Les icônes génériques sont OBLIGATOIRES\n" --title="CD Theme Creator" $DETAIL_LIST)
503
DETAIL_LIST="$TODO_FINAL"
506
for temp in $DETAIL_LIST
508
TODO_FINAL="$TODO_FINAL$temp "
512
if [ "$TODO_FINAL" = "" ]; then
513
zenity --error --text "Aucune catégorie n'a été sélectionnée ou l'opération a été annulée..."
520
zenity --info --title="CD Theme Creator" --text="Spécifier le répertoire dans lequel (re-)créer les liens"
521
WORK_DIR=$(zenity --file-selection --filename $ICONS_DIR --directory --title="CD Theme Creator")/
524
if [ "$WORK_DIR" = "/" ]; then
525
zenity --error --text "Aucun répertoire n'a été spécifié ou l'opération a été annulée..."
534
#############################################################################################################
536
tempo_text="Spécifier le répertoire où tester les liens"
537
todo_relink # Definition $TODO_FINAL et $WORK_DIR
542
for current_category in $TODO_FINAL
544
for FORMAT in "png" "svg"
546
if test -e .$current_category.$FORMAT; then
547
echo "OK : La categorie $current_category EXISTE au format $FORMAT">>$TEST_FILE
548
CURRENT=.$current_category.$FORMAT
552
if test -e $links.$FORMAT; then
555
echo " ATTENTION : le lien $links.$FORMAT est absent de la categorie $current_category">>$TEST_FILE
559
echo "La categorie $current_category n'a pas ete creee en $FORMAT">>$TEST_FILE
566
zenity --info --title="CD Theme Creator" --text="Un fichier de rapport $TEST_FILE a été créé dans $WORK_DIR\nCliquer sur Valider pour continuer"
567
cat $TEST_FILE | zenity --text-info --title="CD Theme Creator - $TEST_FILE" --width 550 --height=700
573
#############################################################################################################
575
#############################################################################################################
578
if [ $DEBUG -ne 1 ]; then
586
echo -e "$VERT""Usage:"
587
echo -e "$NORMAL""$0""$VERT"" Créer un nouveau thème"
588
echo -e "$NORMAL""$0 --relink""$VERT"" Re-créer les liens dans un répertoire avec des liens cassés"
589
echo -e "$NORMAL""$0 --choose_all""$VERT"" Specifier la (ou les) catégorie(s) à traiter (Tout coché par défaut)"
590
echo -e "$NORMAL""$0 --choose_none""$VERT"" Specifier la (ou les) catégorie(s) à traiter (Tout décoché par défaut)"
591
echo -e "$NORMAL""$0 --test""$VERT"" Vérifier qu'un thème est complet"
592
echo -e "$NORMAL""$0 --help""$VERT"" Afficher ce menu d'aide "
595
echo -e "$NORMAL""Auteur : Nochka85"
596
echo -e "$NORMAL""Contact : nochka85@glx-dock.org"