Hi.
I want to open a program (Bash/GtkDialog) at specific screen position. This position is different in different screen resolutions/sizes because it is depending on an icon in the fbpanel taskbar.
How can i get current screen size/resolution and how do i convert this into a gtkdialog position?
Thanks
RSH
Bash & GtkDialog
Bash & GtkDialog
[b][url=http://lazy-puppy.weebly.com]LazY Puppy[/url][/b]
[b][url=http://rshs-dna.weebly.com]RSH's DNA[/url][/b]
[url=http://murga-linux.com/puppy/viewtopic.php?t=91422][b]SARA B.[/b][/url]
[b][url=http://rshs-dna.weebly.com]RSH's DNA[/url][/b]
[url=http://murga-linux.com/puppy/viewtopic.php?t=91422][b]SARA B.[/b][/url]
Make sure you use <window resizable="false">
to avoid empty space
_______________________________________________
Zigbert wrote in his tutorial
If you can read French here's some useful advice on windows
window_position="1" and window_position="2"
can be useful
to avoid empty space
_______________________________________________
Zigbert wrote in his tutorial
Code: Select all
N.B. some properties are enumerated and can be replaced by integer values e.g in a window widget window-position=\"1\" means centre the window and window-position=\"2\" means follow cursor. A tip is when reading the documentation a tooltip indicates the property type
Also note that widgets have hierarchy and inherit from them
window_position="1" and window_position="2"
can be useful
Code: Select all
GtkWindow
Icône de la fenêtre :
<window icon-name="gtk-info">
Titre de la fenêtre :
<window title="Titre">
Fenêtre impossible à redimensionner :
<window resizable="false">
Retirer le contour de la fenêtre :
<window decorated="false">
Cacher la fenêtre de la barre des taches :
<window skip_taskbar_hint="true">
Position de la fenêtre :
<window window_position="XXX">
1 : placer la fenêtre au centre de l'écran;
2 : la fenêtre se placera automatiquement à la position actuelle de la souris;
3 : garder la fenêtre centrée même après redimensionnement.
Exemple final :
<window window_position="1" resizable="false" title="Joli titre" skip_taskbar_hint="true">
<text>
<label>
"Voici une fenêtre non modifiable,
avec un joli titre
qui apparaît au centre de l`écran
et qui n`apparait pas dans la barre des taches."
</label>
</text>
</window>
Retour au Sommaire
Fenêtre pop-up au survol de texte :
#! /bin/bash
#window_position="2"
export POPUP='<window window_position="2" decorated="false">
<vbox>
<text>
<input>cat /tmp/msgaafficher</input>
</text>
</vbox>
</window>'
export MAITRE='<window title="Test survol" icon-name="gtk-info">
<vbox>
<text>
<input>echo "Vouep bon c'\''est pas encore top\nmais bon...\navec 2 dans
window_position est mieux,\nmais a mon avis ogligé de passer par include file pour fonction qui masque
message...\n\na faire évoluer."</input>
</text>
<button>
<label>Essai de survol</label>
<action signal="enter-notify-event">echo "Texte à\nafficher" | tee
/tmp/msgaafficher && sleep 1 && gtkdialog --program=POPUP&</action>
<action signal="leave-notify-event">sleep 2 && kill $(ps ax | grep "gtkdialog
--program=POPUP" | awk '\''{print $1}'\'' | grep -v grep | xargs)&</action>
<action>kill $(ps ax | grep "gtkdialog --program=POPUP" | awk '\''{print $1}'\'' |
grep -v grep | xargs)</action>
<action type="exit">exit</action>
</button>
</vbox>
<action signal="show">echo "" | tee /tmp/msgaafficher</action>
<action signal="hide">echo "" | tee /tmp/msgaafficher</action>
</window>'
gtkdialog --program=MAITRE
exit 0
Here's another example of determining current screen resolution (using xrandr) and adjusting position of the GtkDialog window.
http://www.murga-linux.com/puppy/viewto ... 172#602172
BTW, you said:
will return the current X/Y position, and thanks to this you'll be able to open a new window in exact cursor position, or (in other words) above the mentioned icon, when clicked.
Greetings!
http://www.murga-linux.com/puppy/viewto ... 172#602172
BTW, you said:
In this case you might consider the use of xdotool:This position is different in different screen resolutions/sizes because it is depending on an icon in the fbpanel taskbar.
Code: Select all
xdotool getmouselocation
Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]
[b][color=green]Omnia mea mecum porto.[/color][/b]
Currently this one seems to be the easiest way for me to do.don570 wrote:Zigbert wrote in his tutorial
Code: Select all
N.B. some properties are enumerated and can be replaced by integer values e.g in a window widget window-position="1" means centre the window and window-position="2" means follow cursor. A tip is when reading the documentation a tooltip indicates the property type Also note that widgets have hierarchy and inherit from them
This might be useful also, because LazY Puppy has already built in the xdotool.SFR wrote:BTW, you said:In this case you might consider the use of xdotool:This position is different in different screen resolutions/sizes because it is depending on an icon in the fbpanel taskbar.will return the current X/Y position, and thanks to this you'll be able to open a new window in exact cursor position, or (in other words) above the mentioned icon, when clicked.Code: Select all
xdotool getmouselocation
But: how do i get the results of xdotool in a $xpos and $ypos variable?
To set the result of xdotool as positions of a gtkdialog application i can not use the automatically generated console output of xdotool.
[b][url=http://lazy-puppy.weebly.com]LazY Puppy[/url][/b]
[b][url=http://rshs-dna.weebly.com]RSH's DNA[/url][/b]
[url=http://murga-linux.com/puppy/viewtopic.php?t=91422][b]SARA B.[/b][/url]
[b][url=http://rshs-dna.weebly.com]RSH's DNA[/url][/b]
[url=http://murga-linux.com/puppy/viewtopic.php?t=91422][b]SARA B.[/b][/url]
Like that, I suppose:RSH wrote:This might be useful also, because LazY Puppy has already built in the xdotool.
But: how do i get the results of xdotool in a $xpos and $ypos variable?
To set the result of xdotool as positions of a gtkdialog application i can not use the automatically generated console output of xdotool.
Code: Select all
#!/bin/bash
LOCATION=`xdotool getmouselocation`
Xpos=`echo $LOCATION | cut -f2 -d ':' | cut -f1 -d ' '`
Ypos=`echo $LOCATION | cut -f3 -d ':' | cut -f1 -d ' '`
echo $Xpos # just for testing
echo $Ypos # just for testing
Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]
[b][color=green]Omnia mea mecum porto.[/color][/b]
- technosaurus
- Posts: 4853
- Joined: Mon 19 May 2008, 01:24
- Location: Blue Springs, MO
- Contact:
gtkdialog can set geometry
to get a quick cursor position
then do whatever magic calculations you want for $X and $Y (awk works well)
Code: Select all
gtkdialog
-G, --geometry=[XxY][+W+H] The placement and the size of the window.
Code: Select all
read X Y <<< $(getcurpos)
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].