LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   How to make overlay to display text? (https://www.linuxquestions.org/questions/programming-9/how-to-make-overlay-to-display-text-4175414315/)

dth4h 07-01-2012 01:16 PM

How to make overlay to display text?
 
2 Attachment(s)
I made this script that displays numbers (mouse screen coordinates). As of now they are displayed through the terminal, which is fine but it would be a lot more useful if they were displayed through an overlay on the screen.

But the problem is, I have no idea how to make something like this. I am thinking that it could be done with GTK and Python, but I don't know how to program either of those.

I would like it to be displayed on the screen on top of something that looks like the pngs that are attached to this post.


I guess what I am looking for is for it to do something like conky. It displays text on screen on top of a semi-transparent black overlay.
Where it would differ from conky is that it would be on top of all windows at all times (until the process is closed or killed of course).

whizje 07-01-2012 01:57 PM

With xmessage you can create a window with a text. Not exactly what you wanted but maybe useable.

Dafydd 07-01-2012 05:35 PM

Could you either post or point me to the code that produces those windows?
Thanks
D

whizje 07-02-2012 12:56 AM

Code:

xmessage "hello"

Roken 07-02-2012 05:12 AM

If you want to make a custom overlay you could use conky.

dth4h 07-03-2012 04:37 PM

Quote:

Originally Posted by whizje (Post 4716864)
Code:

xmessage "hello"

That wont work, because the number will always be changing (because it shows where the mouse is, and the mouse keeps moving). So it would make a zillion window pop-up all over.

I want something that will display a number that will always be changing.

Thanks for replying though.

dth4h 07-03-2012 04:40 PM

Quote:

Originally Posted by Roken (Post 4717011)
If you want to make a custom overlay you could use conky.

Thanks, that is a cool idea, but if I use conky for that, then wont I not be able to use it as a system monitor anymore?
Plus I would prefer to use my own built in program for this instead of an external one.

Dafydd 07-03-2012 04:55 PM

is this to be called from inside some html code?

dth4h 07-03-2012 04:58 PM

Quote:

Originally Posted by Dafydd (Post 4718516)
is this to be called from inside some html code?

No, it is just a bash script that can be called from the terminal with an alias I made to it (mouse-location).

Roken 07-03-2012 06:37 PM

Theres's nothing to stop you running more than one conky, one dedicated to your required task. It's very nature is such that you would use your own bash script anyway. All conky would do is put it on the screen for you (exec ${sh your/script})

dth4h 07-03-2012 06:44 PM

Quote:

Originally Posted by Roken (Post 4718560)
Theres's nothing to stop you running more than one conky, one dedicated to your required task. It's very nature is such that you would use your own bash script anyway. All conky would do is put it on the screen for you (exec ${sh your/script})

I didn't know you could run two of them at the same time. Thanks for the info.
If no one else comes up with another solution, then I will look into that.

whizje 07-04-2012 01:57 AM

1 Attachment(s)
You can run xmessage from a script with as variables the positions.
Code:

x=3
y=2
xmessage $x' '$y

Attachment 10037

whizje 07-04-2012 02:00 AM

For options of xmessage run in a terminal
Code:

man xmessage


All times are GMT -5. The time now is 11:41 PM.