Code: Select all
# -G <width>x<height>+<X_position>+<Y_position>
gtkdialog -G 256x24+500+600 -p MAIN & WINDOW_PID=$!
Greetings
Wolfgang
Code: Select all
# -G <width>x<height>+<X_position>+<Y_position>
gtkdialog -G 256x24+500+600 -p MAIN & WINDOW_PID=$!
Code: Select all
#! /bin/bash
# Determine current screen resolution
RES=$(xrandr | grep "current" | awk '{print$8"x"$10}' | tr -d ',')
[ "`echo "$RES" | tr -cd '[[:digit:]]'`" = "" ] && RES=$(xrandr | grep "*" | awk '{print$2"x"$4}') # XVesa has different ouput IIRC(?)
MAXX=$(echo $RES | cut -f1 -d 'x')
MAXY=$(echo $RES | cut -f2 -d 'x')
WIDTH=200 # Window width
HEIGHT=40 # Window height
X=$(( ($MAXX/2) - ($WIDTH/2) )) # Center horizontally
Y=$(( $MAXY-$HEIGHT-50 )) # 50px above bottom of the screen
export MAIN='
<window>
<text><label>Some text blah blah blah...</label></text>
</window>
'
gtkdialog -G "$WIDTH"x"$HEIGHT"+"$X"+"$Y" -p MAIN
Code: Select all
MAXX=`xwininfo -root | grep Width | awk '{print $2}'`
MAXY=`xwininfo -root | grep Height | awk '{print $2}'`
This line already doing it:and what happens when you work with Xvesa and how an error can be avoided?
Code: Select all
[ "`echo "$RES" | tr -cd '[[:digit:]]'`" = "" ] && RES=$(xrandr | grep "*" | awk '{print$2"x"$4}') # XVesa has different ouput IIRC(?)
Code: Select all
#! /bin/bash
[ -f /tmp/temp_PID ] && WINDOW_PID=`cat /tmp/temp_PID` || exit
rm -f /tmp/temp_PID # remove temp file, if already used
kill $WINDOW_PID # kill window
.
.
my programcode
.
.
-----------------------------------------------------------
RES=$(xrandr | grep "current" | awk '{print$8"x"$10}' | tr -d ',')
-----------------------------------------------------------
[ "`echo "$RES" | tr -cd '[[:digit:]]'`" = "" ] && RES=$(xrandr | grep "*" | awk '{print$2"x"$4}')
-----------------------------------------------------------
MAXX=$(echo $RES | cut -f1 -d 'x')
MAXY=$(echo $RES | cut -f2 -d 'x')
-----------------------------------------------------------
WIDTH=300
HEIGHT=24
-----------------------------------------------------------
X=$(( ($MAXX/2) - ($WIDTH/2) ))
Y=$(( $MAXY-$HEIGHT-130 ))
export MAIN='
<window decorated="false" skip_taskbar_hint="true">
<text use-markup="true"><label>"<b><span color='"'black'"' size='"'large'"'><u>Some message...</u></span></b>"</label></text>
</window>
'
gtkdialog -G "$WIDTH"x"$HEIGHT"+"$X"+"$Y" -p MAIN & WINDOW_PID=$!
echo $WINDOW_PID > /tmp/temp_PID
Code: Select all
#! /bin/bash
TEMPFILE=/tmp/infowindow_temp_PID
[ -f $TEMPFILE ] && WINDOW_PID=`cat $TEMPFILE` && kill $WINDOW_PID && rm -f $TEMPFILE
#.
#.
#my programcode
#.
#.
MESSAGE="$1" # first passed parameter is a message
[ "$MESSAGE" = "" ] && exit # if no parameter - exit
#-----------------------------------------------------------
RES=$(xrandr | grep "current" | awk '{print$8"x"$10}' | tr -d ',')
#-----------------------------------------------------------
[ "`echo "$RES" | tr -cd '[[:digit:]]'`" = "" ] && RES=$(xrandr | grep "*" | awk '{print$2"x"$4}')
#-----------------------------------------------------------
MAXX=$(echo $RES | cut -f1 -d 'x')
MAXY=$(echo $RES | cut -f2 -d 'x')
#-----------------------------------------------------------
WIDTH=$(( (${#MESSAGE}+1) *12)) # WIDTH = ((lenght of text + 1) * 12)
HEIGHT=24
#-----------------------------------------------------------
X=$(( ($MAXX/2) - ($WIDTH/2) ))
Y=$(( $MAXY-$HEIGHT-130 ))
export MAIN='
<window decorated="false" skip_taskbar_hint="true">
<text use-markup="true"><label>"<b><span color='"'black'"' size='"'large'"'><u>'$MESSAGE'</u></span></b>"</label></text>
</window>
'
gtkdialog -G "$WIDTH"x"$HEIGHT"+"$X"+"$Y" -p MAIN & WINDOW_PID=$!
echo $WINDOW_PID > $TEMPFILE