slitaz-dev-tools view baba-scripts/yaff @ rev 310

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