slitaz-dev-tools annotate baba-scripts/yaff @ rev 301
tazwikiss: replaced blank in curdate() in index.sh by T to display filenames properly in history
author | Hans-G?nter Theisgen |
---|---|
date | Fri Apr 28 14:08:02 2017 +0100 (2017-04-28) |
parents | 67c4b0e53072 |
children |
rev | line source |
---|---|
postmaster@96 | 1 #!/bin/sh |
postmaster@96 | 2 BIN=`which firefox` |
postmaster@96 | 3 PROFILE_DIR=$HOME/.mozilla/firefox |
postmaster@96 | 4 CONFDIR=$HOME/.yaff |
postmaster@96 | 5 VERCONF=$CONFDIR/versions.conf |
postmaster@96 | 6 PROFCONF=$CONFDIR/profiles.conf |
postmaster@96 | 7 INSTANCES=`ps | grep firefox-bin | grep -v 'grep firefox-bin' | grep -v /bin/sh | wc -l` |
postmaster@96 | 8 [ $INSTANCES -gt 0 ] && NOREMOTE='-no-remote' || NOREMOTE='' |
postmaster@96 | 9 FIREFOX='3.5.7#/usr/bin/firefox 3.6#/home/gg/apps/firefox-3.6/firefox 4#/home/gg/apps/firefox-4/firefox#Firefox-4b' |
postmaster@96 | 10 PROFILES="" |
babaorum@134 | 11 REMOTE="-no-remote" |
postmaster@96 | 12 |
postmaster@96 | 13 add_new_versions() { |
postmaster@96 | 14 local tmp=`mktemp -t -p $CONFDIR` |
postmaster@96 | 15 ADD_VERSIONS=' |
postmaster@96 | 16 <window title="Yaff - Add new versions"> |
postmaster@96 | 17 <vbox> |
postmaster@96 | 18 <hbox> |
postmaster@96 | 19 <text width-request="100"><label>Version number</label></text> |
postmaster@96 | 20 <entry width-request="20"><variable>VERNUMBER</variable></entry> |
postmaster@96 | 21 </hbox> |
postmaster@96 | 22 <button ok></button> |
postmaster@96 | 23 </vbox> |
postmaster@96 | 24 </window>' |
postmaster@96 | 25 export ADD_VERSIONS |
postmaster@96 | 26 gtkdialog --program=ADD_VERSIONS &> $tmp |
postmaster@96 | 27 cat $tmp |
postmaster@96 | 28 [ -f "$tmp" ] && rm -f $tmp |
postmaster@96 | 29 } |
postmaster@96 | 30 |
postmaster@96 | 31 [ ! -d "$CONFDIR" ] && mkdir -p $CONFDIR |
postmaster@96 | 32 #~ [ ! -f "$VERCONF" -o `stat -c %s $VERCONF` -eq 0 ] && add_new_versions |
postmaster@96 | 33 [ ! -f "$VERCONF" -o `stat -c %s $VERCONF` -eq 0 ] |
postmaster@96 | 34 |
postmaster@96 | 35 [ ! -f "$PROFCONF" ] && touch $PROFCONF; echo -n "" > $PROFCONF |
postmaster@96 | 36 for firefox in $FIREFOX |
postmaster@96 | 37 do |
postmaster@96 | 38 version=`echo $firefox | cut -d '#' -f 1` |
postmaster@96 | 39 exec=`echo $firefox | cut -d '#' -f 2` |
postmaster@96 | 40 profile=`echo $firefox | cut -d '#' -f 3` |
postmaster@96 | 41 echo "$profile|$version" >> $PROFCONF |
postmaster@96 | 42 [ -n "$profile" -a "$profile" != "" ] && echo "$version|$profile" >> $PROFCONF |
postmaster@96 | 43 done |
postmaster@96 | 44 |
postmaster@96 | 45 |
postmaster@96 | 46 MAIN_DIALOG=' |
postmaster@96 | 47 <window title="Yet Another Firefox" window_position="1"> |
postmaster@96 | 48 <vbox> |
Babaorum@101 | 49 <notebook labels="Choose a profile|Information"> |
postmaster@96 | 50 <vbox> |
postmaster@96 | 51 <list selection-mode="2"> |
postmaster@96 | 52 <variable>PROFIL</variable>' |
postmaster@96 | 53 [ ! -d $PROFILE_DIR ] && echo "Directory $PROFILE_DIR not found" >&2 && exit 1 |
postmaster@96 | 54 cd $PROFILE_DIR |
postmaster@96 | 55 for dir in $(ls -F $PROFILE_DIR | grep -iv "Crash" | grep -iv "reports" | grep \/$ | grep -v "~/$") |
postmaster@96 | 56 #~ for dir in $(echo "$PROFILES") |
postmaster@96 | 57 do |
postmaster@96 | 58 [ ! -d $dir -o ! -r $dir ] && continue |
postmaster@96 | 59 dir=${dir#*.} |
postmaster@96 | 60 MAIN_DIALOG=${MAIN_DIALOG}'<item>'${dir%%/}'</item>' |
postmaster@96 | 61 done |
postmaster@96 | 62 MAIN_DIALOG=$MAIN_DIALOG' |
postmaster@96 | 63 </list> |
postmaster@96 | 64 <text> |
postmaster@96 | 65 <label>'$INSTANCES' running instance(s) of Firefox detected.</label> |
postmaster@96 | 66 </text> |
postmaster@96 | 67 <hbox homogeneous="true">' |
postmaster@96 | 68 for firefox in $FIREFOX |
postmaster@96 | 69 do |
postmaster@96 | 70 version=`echo $firefox | cut -d '#' -f 1` |
postmaster@96 | 71 exec=`echo $firefox | cut -d '#' -f 2` |
postmaster@96 | 72 profile=`echo $firefox | cut -d '#' -f 3` |
postmaster@96 | 73 radio='<radiobutton><label>'$version'</label><variable>F'${version//./_}'</variable></radiobutton>' |
postmaster@96 | 74 #echo $radio |
postmaster@96 | 75 MAIN_DIALOG=$MAIN_DIALOG$radio |
postmaster@96 | 76 done |
postmaster@96 | 77 MAIN_DIALOG=$MAIN_DIALOG' |
postmaster@96 | 78 </hbox> |
postmaster@96 | 79 <hbox> |
postmaster@96 | 80 <button> |
postmaster@96 | 81 <input file>/usr/share/pixmaps/mozicon16.png</input> |
postmaster@96 | 82 <label>Launch Firefox</label> |
postmaster@96 | 83 <action>Exit:OK</action> |
postmaster@96 | 84 </button> |
postmaster@96 | 85 <button> |
postmaster@96 | 86 <input file icon="gtk-quit"></input> |
postmaster@96 | 87 <label>Quit</label> |
postmaster@96 | 88 <action type="CloseWindow">MAIN_DIALOG</action> |
postmaster@96 | 89 </button> |
postmaster@96 | 90 </hbox> |
postmaster@96 | 91 </vbox> |
postmaster@96 | 92 |
postmaster@96 | 93 </vbox> |
postmaster@96 | 94 |
postmaster@96 | 95 <vbox> |
postmaster@96 | 96 <frame> |
postmaster@96 | 97 <text use-markup="true" width-chars="30" height-request="50"> |
postmaster@96 | 98 <label>"<i>Copyleft [^c] 2010 Babaorum</i>"</label> |
postmaster@96 | 99 </text> |
postmaster@96 | 100 <text use-markup="true" width-chars="30"> |
postmaster@96 | 101 <label>"<b>YAFF (Yet Another Firefox)</b>"</label> |
postmaster@96 | 102 </text> |
postmaster@96 | 103 <text> |
postmaster@96 | 104 <label>lets you launch many instances of Firefox in different versions with different profiles.</label> |
postmaster@96 | 105 </text> |
postmaster@96 | 106 </frame> |
postmaster@96 | 107 <hbox> |
postmaster@96 | 108 <button> |
postmaster@96 | 109 <input file icon="gtk-quit"></input> |
postmaster@96 | 110 <label>Quit</label> |
postmaster@96 | 111 <action type="CloseWindow">MAIN_DIALOG</action> |
postmaster@96 | 112 </button> |
postmaster@96 | 113 </hbox> |
postmaster@96 | 114 </vbox> |
postmaster@96 | 115 </notebook> |
postmaster@96 | 116 </vbox> |
postmaster@96 | 117 </window>' |
postmaster@96 | 118 export MAIN_DIALOG |
postmaster@96 | 119 VARIABLES=$(gtkdialog --program=MAIN_DIALOG) |
postmaster@96 | 120 eval $VARIABLES |
postmaster@96 | 121 for firefox in $FIREFOX |
postmaster@96 | 122 do |
postmaster@96 | 123 version=`echo $firefox | cut -d '#' -f 1` |
postmaster@96 | 124 bin=`echo $firefox | cut -d '#' -f 2` |
postmaster@96 | 125 profile=`echo $firefox | cut -d '#' -f 3` |
postmaster@96 | 126 name_var="F${version}" |
postmaster@96 | 127 name_var=${name_var//./_} |
postmaster@96 | 128 eval "version_var=\$$name_var" |
postmaster@96 | 129 if [ "$version_var" = "true" ] |
postmaster@96 | 130 then |
postmaster@96 | 131 BIN=$bin |
postmaster@96 | 132 if [ -n $profile -a "$profile" != "" -a "$PROFIL" = "" ]; then |
postmaster@96 | 133 PROFIL=$profile |
postmaster@96 | 134 export ALERT_DIALOG=' |
postmaster@96 | 135 <window title="CAUTION !" window_position="1"> |
postmaster@96 | 136 <vbox> |
postmaster@96 | 137 <text use-markup="true"><label>"Profile for this version will be locked on: <b>'$PROFIL'</b>"</label></text> |
postmaster@96 | 138 <button ok></button> |
postmaster@96 | 139 </vbox> |
postmaster@96 | 140 </window>' |
postmaster@96 | 141 gtkdialog --program=ALERT_DIALOG |
postmaster@96 | 142 fi |
postmaster@96 | 143 break |
postmaster@96 | 144 fi |
postmaster@96 | 145 done |
postmaster@96 | 146 if [ $EXIT = "OK" -a "$PROFIL" != "" ] |
postmaster@96 | 147 then |
postmaster@96 | 148 echo "$BIN $NOREMOTE -P \"$PROFIL\" 1>/dev/null 2>&1" |
postmaster@96 | 149 $BIN $NOREMOTE -P "$PROFIL" 1>/dev/null 2>&1 |
postmaster@96 | 150 fi |