slitaz-tools rev 178 2.2
Add: desktopbox - Multi-call GTKdialog for Freedesktop
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Fri May 09 17:42:13 2008 +0200 (2008-05-09) |
parents | fc51bbbcac62 |
children | 0cd1a5abbc1b |
files | rootfs/usr/share/pixmaps/tazpkg.png stuff/desktop-files/desktopbox-icons.desktop stuff/desktop-files/tazkeymap.desktop tinyutils/desktopbox |
line diff
1.1 Binary file rootfs/usr/share/pixmaps/tazpkg.png has changed
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/stuff/desktop-files/desktopbox-icons.desktop Fri May 09 17:42:13 2008 +0200 2.3 @@ -0,0 +1,7 @@ 2.4 +[Desktop Entry] 2.5 +Encoding=UTF-8 2.6 +Name=Desktop icons 2.7 +Icon=document-new 2.8 +Exec=desktopbox add-icons 2.9 +Type=Application 2.10 +Categories=Settings;DesktopSettings;GTK;
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/stuff/desktop-files/tazkeymap.desktop Fri May 09 17:42:13 2008 +0200 3.3 @@ -0,0 +1,9 @@ 3.4 +[Desktop Entry] 3.5 +Encoding=UTF-8 3.6 +Name=Keyboard mapping 3.7 +Name[fr]=Mappage du clavier 3.8 +Exec=subox 'xterm -e tazkeymap' 3.9 +Icon=/usr/share/icons/Tango/16x16/apps/accessories-character-map.png 3.10 +Terminal=true 3.11 +Type=Application 3.12 +Categories=Settings;DesktopSettings;
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/tinyutils/desktopbox Fri May 09 17:42:13 2008 +0200 4.3 @@ -0,0 +1,184 @@ 4.4 +#! /bin/sh 4.5 +# 4.6 +# Multi-call script provinding GTK boxes to manage a desktop following 4.7 +# Freedesktop standars. 4.8 +# 4.9 +# (C) GNU gpl v3 - SliTaz GNU/Linux 2008. 4.10 +# 4.11 +VERSION=20080509 4.12 + 4.13 +# Standards directories. 4.14 +mkdir -p $HOME/Desktop $HOME/.local/share/applications 4.15 + 4.16 +# Get the active locale (default to English). 4.17 +case $LANG in 4.18 + es*) 4.19 + lang="es" 4.20 + NEW_FOLDER_LABEL="Creat a new folder on the desktop:" 4.21 + FOLDER_ENTRY_MSG="dirname" 4.22 + NEW_FILE_LABEL="Creat a new file on the desktop:" 4.23 + FILE_ENTRY_MSG="filename" 4.24 + ADD_ICON_LABEL="Add some desktop icons" ;; 4.25 + fr*) 4.26 + lang="fr" 4.27 + NEW_FOLDER_LABEL="Créer un nouveau dossier sur le bureau:" 4.28 + FOLDER_ENTRY_MSG="dossier" 4.29 + NEW_FILE_LABEL="Créer un nouveau fichier sur le bureau:" 4.30 + FILE_ENTRY_MSG="fichier" 4.31 + ADD_ICON_LABEL="Ajouter des icons de bureau" ;; 4.32 + *) 4.33 + lang="" 4.34 + NEW_FOLDER_LABEL="Creat a new folder on the desktop:" 4.35 + FOLDER_ENTRY_MSG="dirname" 4.36 + NEW_FILE_LABEL="Creat a new file on the desktop:" 4.37 + FILE_ENTRY_MSG="filename" 4.38 + ADD_ICON_LABEL="Add some desktop icons" ;; 4.39 +esac 4.40 + 4.41 +# Command line usage. 4.42 +usage() 4.43 +{ 4.44 + echo -e "\nSliTaz Freedesktop Box - Version: $VERSION\n 4.45 +\033[1mUsage: \033[0m `basename $0` command 4.46 +\033[1mCommands: \033[0m\n 4.47 + new-folder Creat a new folder on the desktop with mkdir. 4.48 + new-file Creat a new empty file or SHell script on the desktop. 4.49 + add-icons Add a system icon on the desktop.\n" 4.50 +} 4.51 + 4.52 +# Box commands. 4.53 +case $1 in 4.54 + new-folder) 4.55 + # Creat a directory on the ~/desktop. 4.56 + # 4.57 + DESKTOP_DIALOG=" 4.58 +<window title=\"Desktopbox - mkdir\" icon-name=\"folder-new\"> 4.59 +<vbox> 4.60 + 4.61 + <text use-markup=\"true\" width-chars=\"40\"> 4.62 + <label>\" 4.63 +<b>$NEW_FOLDER_LABEL</b>\" 4.64 + </label> 4.65 + </text> 4.66 + 4.67 + <hbox> 4.68 + <entry> 4.69 + <default>$FOLDER_ENTRY_MSG</default> 4.70 + <variable>DIR</variable> 4.71 + </entry> 4.72 + </hbox>" 4.73 + ACTIONS=' 4.74 + <hbox> 4.75 + <button> 4.76 + <label>Mkdir</label> 4.77 + <input file icon="folder-new"></input> 4.78 + <action>mkdir -p "$HOME/Desktop/$DIR"</action> 4.79 + <action type="exit">Exit</action> 4.80 + </button> 4.81 + <button cancel> 4.82 + <action type="exit">Exit</action> 4.83 + </button> 4.84 + </hbox> 4.85 + 4.86 +</vbox> 4.87 +</window>' 4.88 + export DESKTOP_DIALOG="${DESKTOP_DIALOG}${ACTIONS}" ;; 4.89 + new-file) 4.90 + # Creat a file on the ~/desktop. 4.91 + # 4.92 + DESKTOP_DIALOG=" 4.93 +<window title=\"Desktopbox - touch/cat\" icon-name=\"document-new\"> 4.94 +<vbox> 4.95 + <text use-markup=\"true\" width-chars=\"40\"> 4.96 + <label>\" 4.97 +<b>$NEW_FILE_LABEL</b>\" 4.98 + </label> 4.99 + </text> 4.100 + 4.101 + <hbox> 4.102 + <entry> 4.103 + <default>$FILE_ENTRY_MSG</default> 4.104 + <variable>FILE</variable> 4.105 + </entry> 4.106 + </hbox>" 4.107 + ACTIONS=' 4.108 + <hbox> 4.109 + <button> 4.110 + <label>SH script</label> 4.111 + <input file icon="document-new"></input> 4.112 + <action>echo "#!/bin/sh" > "$HOME/Desktop/$FILE"</action> 4.113 + <action>echo "#" >> "$HOME/Desktop/$FILE"</action> 4.114 + <action>chmod +x "$HOME/Desktop/$FILE"</action> 4.115 + <action type="exit">Exit</action> 4.116 + </button> 4.117 + <button> 4.118 + <label>Empty</label> 4.119 + <input file icon="document-new"></input> 4.120 + <action>touch "$HOME/Desktop/$FILE"</action> 4.121 + <action type="exit">Exit</action> 4.122 + </button> 4.123 + <button cancel> 4.124 + <action type="exit">Exit</action> 4.125 + </button> 4.126 + </hbox> 4.127 +</vbox> 4.128 +</window>' 4.129 + export DESKTOP_DIALOG="${DESKTOP_DIALOG}${ACTIONS}" ;; 4.130 + add-icons) 4.131 + # Add a new icons on the ~/desktop from /usr/share/applications. 4.132 + # 4.133 + DESKTOP_DIALOG=" 4.134 +<window title=\"$ADD_ICON_LABEL\" icon-name=\"document-new\"> 4.135 +<vbox> 4.136 + <text use-markup=\"true\" width-chars=\"40\"> 4.137 + <label>\" 4.138 +<b>$ADD_ICON_LABEL</b> 4.139 +\" 4.140 + </label> 4.141 + </text> 4.142 + <tree headers_visible=\"false\"> 4.143 + <width>420</width><height>200</height> 4.144 + <variable>ICON</variable> 4.145 + <label>Filename|Application</label>" 4.146 + # Get application name and icon. 4.147 + cd /usr/share/applications 4.148 + for file in *.desktop 4.149 + do 4.150 + # Try to get the name in the right locale. 4.151 + NAME=`grep ^Name $file | grep $lang || grep ^Name= $file` 4.152 + NAME=`echo $NAME | cut -d "=" -f 2` 4.153 + ICON=`grep ^Icon= $file | cut -d "=" -f 2` 4.154 + ICON=`basename $ICON` 4.155 + ICON=${ICON%.*} 4.156 + FILE=${file%.desktop} 4.157 + ITEM="<item icon=\"$ICON\">$FILE | $NAME</item>" 4.158 + DESKTOP_DIALOG="${DESKTOP_DIALOG}${ITEM}" 4.159 + done 4.160 + ACTIONS='<action>cp /usr/share/applications/$ICON.desktop ~/Desktop</action> 4.161 + </tree> 4.162 + <hbox> 4.163 + <button> 4.164 + <label>Add</label> 4.165 + <input file icon="gtk-add"></input> 4.166 + <action>cp /usr/share/applications/$ICON.desktop ~/Desktop</action> 4.167 + </button> 4.168 + <button> 4.169 + <label>Exit</label> 4.170 + <input file icon="exit"></input> 4.171 + <action type="exit">Exit</action> 4.172 + </button> 4.173 + </hbox> 4.174 +</vbox> 4.175 +</window> 4.176 +' 4.177 + export DESKTOP_DIALOG="${DESKTOP_DIALOG}${ACTIONS}" ;; 4.178 + *) 4.179 + # Usage if executet from cmdline. 4.180 + # 4.181 + usage 4.182 + exit 0 ;; 4.183 +esac 4.184 + 4.185 +gtkdialog --center --program=DESKTOP_DIALOG >/dev/null 4.186 + 4.187 +exit 0