The time now is Sun 19 May 2013, 17:06
All times are UTC - 4 |
| Author |
Message |
technosaurus

Joined: 18 May 2008 Posts: 3843
|
Posted: Tue 19 Feb 2013, 12:45 Post subject:
|
|
for readability, not for posix compliance. If you want it to work in a posix sh or possibly with bash in posix mode, you need to use backticks as they work in all posix compliant shells. That being said, most shells currently in wide use do recognize $(...) ... using backticks is kind of like writing a current web page to support ie6 and netscape ... or just to save 1 byte in an obfuscated shell contest if they had those.
As we have kinda gotten off topic anyways, there was a topic on slashdot recently on what software the open source community needs, and immediately a presentation tool came to mind.
Is anyone up for taking the game framework and making it into a lightweight presentation tool? SVG already has 99% of the capability and since the flow control is separate the rest (audio and video) could use external apps like aplay and mplayer (or equivalents)... if so start a separate thread and I'll help out as much as I can.
_________________ Puppy Web Desktop Now with pet packages - Pet Packaging 100 & 101
|
|
Back to top
|
|
 |
seaside
Joined: 11 Apr 2007 Posts: 832
|
Posted: Tue 19 Feb 2013, 12:51 Post subject:
|
|
[quote="recobayu"] | linuph wrote: |
I'm sorry to ask again.
All of that code can showing an output about WIDTH, HEIGHT, and DEPTH. but then when i write echo $HEIGHT or echo $XWIDTH, it doesn't appear anything. I'm still very2 new in programming. How to save to a variable?
Thanks in advance. |
recobayu
You set the variables by using "eval" as below-
| Code: | eval `xwininfo -root|while read LINE ; do
case $LINE in
Width*) echo ${LINE/: /=};;
Height*) echo ${LINE/: /=};;
esac;
done` |
| Code: | # echo $Width
1366
# echo $Height
768
# |
You can also do that with the other examples by placing "eval" in front and enclosing the following commands in either backticks ` or parens $(commands here).
An example of "eval" works like this in a terminal -
| Code: | # var=t=5
# echo $var
t=5
# echo $t
# $var
bash: t=5: command not found
# eval $var
# echo $t
5
# |
Cheers,
s
|
|
Back to top
|
|
 |
recobayu

Joined: 15 Sep 2010 Posts: 85 Location: indonesia
|
Posted: Wed 20 Feb 2013, 01:17 Post subject:
|
|
Ok. I'm very appreciate to all of you. Thank you very much.
This is what I have now. I make a little start screen was called PupStart
| Code: | #!/bin/sh
funcbtnwide() {
echo '<button width-request="150" height-request="75" homogeneous="true" image-position="Top">
<label>'$1'</label>
<variable>btn'$1'</variable>
<input file>'$2'</input>
<height>50</height>
<action>'$3'&</action>
<action>EXIT:sure</action>
</button>'
}
funcbtnnormal() {
echo '
<button width-request="75" height-request="75" homogeneous="true" image-position="Top">
<label>'$1'</label>
<variable>btn'$1'</variable>
<input file>'$2'</input>
<height>50</height>
<action>'$3'&</action>
<action>EXIT:sure</action>
</button>'
}
echo 'style "os50"
{
font_name="Segoe UI Light 20"
}
widget "*os50ku" style "os50"
class "GtkText*" style "os50"' > /tmp/gtkrc_os50
export GTK2_RC_FILES=/tmp/gtkrc_os50:/root/.gtkrc-2.0
midi=/root/puppy-reference/midi-icons
pixmaps=/root/puppy-reference/pixmaps
eval `xwininfo -root|while read LINE ; do
case $LINE in
Width*) echo ${LINE/: /=};;
Height*) echo ${LINE/: /=};;
esac;
done`
export MAIN_DIALOG='
<window title="Startmenu" height-request="'$Height'" width-request="'$Width'" resizable="true" decorated="false" window_position="1">
<vbox border-width="0">
<text width-chars="40" height-request="20"><label>""</label></text>
<hbox>
<text name="os50ku" use-markup="true"><label>"<span color='"'white'"' size='"'medium'"'>'"$HOSTNAME"'</span>"</label></text>
<button relief="2">
<input file>'$midi/contact48.png'</input>
<height>20</height>
<width>20</width>
</button>
</hbox>
<text name="os50ku" xalign="0" use-markup="true"><label>"<span size='"'xx-large'"' color='"'white'"'>PupStart</span>"</label></text>
<text height-request="20"><label>""</label></text>
<frame>
<hbox scrollable="true" vscrollbar-policy="1">
<vbox>
<text name="os50ku" use-markup="true"><label>"<span color='"'black'"' size='"'large'"'>Desktop</span>"</label></text>
<hseparator></hseparator>
<hbox>
<vbox homogeneous="false" >
'"$(funcbtnwide Desktop $midi/pc48.png EXIT:sure)"'
'"$(funcbtnwide 'Jwm Config' $midi/setup48.png jwmconfig)"'
'"$(funcbtnwide 'GTK Theme' $midi/setup48.png defaultwordprocessor)"'
'"$(funcbtnwide Wallpaper $pixmaps/wallpaper.png wallpaper)"'
</vbox>
<vbox homogeneous="false" >
'"$(funcbtnwide Console $midi/console48.png urxvt)"'
'"$(funcbtnwide Explore $midi/folder48.png rox)"'
'"$(funcbtnwide Pmount $midi/drive48.png pmount)"'
'"$(funcbtnwide Internet $midi/www48.png defaultbrowser)"'
</vbox>
</hbox>
</vbox>
<text width-request="2"><label>""</label></text>
<vbox>
<text name="os50ku" use-markup="true"><label>"<span color='"'black'"' size='"'large'"'>System</span>"</label></text>
<hseparator></hseparator>
<hbox>
<vbox homogeneous="false" >
'"$(funcbtnwide Geany $midi/edit48.png geany)"'
<hbox>'"$(funcbtnnormal Paint $midi/paint48.png mtpaint)"'
'"$(funcbtnnormal Draw $midi/draw48.png inkscape)"'</hbox>
<hbox>'"$(funcbtnnormal Word $midi/word48.png defaultwordprocessor)"'
'"$(funcbtnnormal Excel $midi/spread48.png defaultspreadsheet)"'</hbox>
'"$(funcbtnwide Notecase $midi/edit48.png notecase)"'
</vbox>
<vbox homogeneous="false">
<hbox>
'"$(funcbtnnormal 'Alsa Mixer' $midi/multimedia48.png 'rxvt -e alsamixer')"'
'"$(funcbtnnormal 'New Mixer' $midi/multimedia48.png gnome-alsamixer)"'
</hbox>
<hbox>
'"$(funcbtnnormal Mplayer $midi/multimedia48.png gnome-mplayer)"'
'"$(funcbtnnormal Pmusic /usr/local/pmusic/pmusic20.png pmusic)"'
</hbox>
'"$(funcbtnwide Equalizer /usr/share/icons/hicolor/24x24/apps/eq.png pequalizer)"'
'"$(funcbtnwide Kamera $midi/camera48.png guvcview)"'
</vbox>
</hbox>
</vbox>
<text name="os50ku" width-request="2"><label>""</label></text>
<vbox>
<text name="os50ku" use-markup="true"><label>"<span color='"'black'"' size='"'large'"'>Graphic</span>"</label></text>
<hseparator></hseparator>
<hbox>
<vbox homogeneous="false">
<hbox>
'"$(funcbtnnormal Pburn $midi/optical48.png pburn)"'
'"$(funcbtnnormal 'Wave Editor' $pixmaps/mhwaveedit.xpm mhwaveedit)"'
</hbox>
'"$(funcbtnwide Wallpaper $midi/pc48.png wallpaper)"'
'"$(funcbtnwide Kamera $midi/camera48.png guvcview)"'
'"$(funcbtnwide Kamera $midi/camera48.png guvcview)"'
</vbox>
<vbox homogeneous="false" >
'"$(funcbtnwide Explorer $midi/folder48.png rox)"'
<hbox>'"$(funcbtnnormal Word $midi/word48.png defaultwordprocessor)"'
'"$(funcbtnnormal Excel $midi/spread48.png defaultspreadsheet)"'</hbox>
'"$(funcbtnwide Desktop $midi/pc48.png EXIT:sure)"'
'"$(funcbtnwide Desktop $midi/pc48.png EXIT:sure)"'
</vbox>
</hbox>
</vbox>
<text width-request="2"><label>""</label></text>
<vbox>
<text name="os50ku" use-markup="true"><label>"<span color='"'black'"' size='"'large'"'>Document</span>"</label></text>
<hseparator></hseparator>
<hbox>
<vbox homogeneous="false">
<hbox>
'"$(funcbtnnormal Alsa $midi/multimedia48.png 'rxvt -e alsamixer')"'
'"$(funcbtnnormal Jwm $midi/setup48.png jwmconfig)"'
</hbox>
'"$(funcbtnwide Wallpaper $midi/pc48.png wallpaper)"'
'"$(funcbtnwide Kamera $midi/camera48.png guvcview)"'
'"$(funcbtnwide Kamera $midi/camera48.png guvcview)"'
</vbox>
<vbox homogeneous="false" >
'"$(funcbtnwide Explorer $midi/folder48.png rox)"'
<hbox>'"$(funcbtnnormal Word $midi/word48.png defaultwordprocessor)"'
'"$(funcbtnnormal Excel $midi/spread48.png defaultspreadsheet)"'</hbox>
'"$(funcbtnwide Desktop $midi/pc48.png EXIT:sure)"'
'"$(funcbtnwide Desktop $midi/pc48.png EXIT:sure)"'
</vbox>
</hbox>
</vbox>
<text width-request="2"><label>""</label></text>
<vbox>
<text name="os50ku" use-markup="true"><label>"<span color='"'black'"' size='"'large'"'>Multimedia</span>"</label></text>
<hseparator></hseparator>
<hbox>
<vbox homogeneous="false" >
'"$(funcbtnwide Explorer $midi/folder48.png rox)"'
'"$(funcbtnwide Word $midi/word48.png defaultwordprocessor)"'
'"$(funcbtnwide Desktop $midi/pc48.png EXIT:sure)"'
</vbox>
</hbox>
</vbox>
</hbox>
</frame>
<hbox homogeneous="true">
<button ok></button>
</hbox>
<text width-chars="40" height-request="140"><label>""</label></text>
</vbox>
</window>
'
case $1 in
-d | --dump) echo "$MAIN_DIALOG" ;;
*) gtkdialog --program=MAIN_DIALOG --gtk-module=gtk2desklet ;;
esac
|
if you choose my gtktheme, maybe it's just a little different with the real metro.
http://murga-linux.com/puppy/viewtopic.php?p=671393#671393
|
|
Back to top
|
|
 |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|