LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-04-2010, 02:12 PM   #1
zensunni
Member
 
Registered: Feb 2008
Posts: 45

Rep: Reputation: 0
Popup message on gnome/x-windows


Disclaimer: I know nothing of x-windows or gnome interface, but I am an novice programmer.

I was curious if there is a simple way to run a popup window that appears in front of all other windows and interrupts the user.

It would be cool to find a pre-made python/perl script or something of the like.

I've tried these:
http://bytes.com/topic/perl/answers/...p-message-perl

But I think those were for windows...

Last edited by zensunni; 11-04-2010 at 02:25 PM.
 
Old 11-04-2010, 03:51 PM   #2
jkzfixme
Member
 
Registered: Sep 2006
Location: Orange County, NY
Distribution: Ubuntu, Solaris, Android
Posts: 329
Blog Entries: 21

Rep: Reputation: 52
no need for perl just use xmessage

Quote:
xmessage -button ok -center file - "stop with the facebook, boss is on the way around the corner !"
Regards,
JKZfixme
 
Old 11-04-2010, 03:57 PM   #3
jkzfixme
Member
 
Registered: Sep 2006
Location: Orange County, NY
Distribution: Ubuntu, Solaris, Android
Posts: 329
Blog Entries: 21

Rep: Reputation: 52
all joking aside what are you trying to do with it ? If you are trying to get a program to ask before it does something as in the link you provided try this

Quote:
#uses xmessage to ask first.
answer=$(xmessage -button ok -center file - "Are you sure you want to do whatever ? " -buttons yes,no -print)
if [ $answer = "yes" ]
then
# Do whatever after this line
 
Old 11-04-2010, 04:45 PM   #4
arizonagroovejet
Senior Member
 
Registered: Jun 2005
Location: England
Distribution: openSUSE, Fedora, CentOS
Posts: 1,093

Rep: Reputation: 197Reputation: 197
zenity is also worth a look http://library.gnome.org/users/zenity/stable/
if you're after something that fits in to GNOME aesthetically.

You cannot guarantee that a zenity pop up will appear on top of all other windows. I don't know if you can force xmessage windows on top. If you are will to get in to writing python or perl you can use the GTK bindings and set the window you create to always be on top, but that's quite advanced.

Incidentally, notify-send is good for passive pop up messages in GNOME http://www.linuxjournal.com/content/...ts-notify-send
 
Old 11-04-2010, 07:19 PM   #5
zensunni
Member
 
Registered: Feb 2008
Posts: 45

Original Poster
Rep: Reputation: 0
jkzfixme:

I'm just giving myself a warning before automatic shutdown.

What's the path to xmessage?

BTW, how do you find the path for any command? (perl, python, shutdown, etc). Is there a simple lookup place?

I'm using Ubuntu 10.04

[edit] I found my answer. I just type: "which <command you wanna know the path to>".
Very, very helpful.

Last edited by zensunni; 11-04-2010 at 07:44 PM.
 
Old 11-04-2010, 07:56 PM   #6
zensunni
Member
 
Registered: Feb 2008
Posts: 45

Original Poster
Rep: Reputation: 0
Arg,

Not working from Cron...

I'm using:
Code:
/usr/bin/xmessage -button ok -center file - "George Takai: Helooooo"
Not sure what's wrong...

Last edited by zensunni; 11-04-2010 at 08:11 PM.
 
Old 11-05-2010, 06:14 AM   #7
arizonagroovejet
Senior Member
 
Registered: Jun 2005
Location: England
Distribution: openSUSE, Fedora, CentOS
Posts: 1,093

Rep: Reputation: 197Reputation: 197
Something running from cron isn't going to have access to your display, or even know what the display is

Try saving this somewhere and calling from cron. Don't forget to set execute permission on it.

Code:
#!/bin/bash
export DISPLAY=:0.0;
export  XAUTHORITY=$(ps h $(pidof X) | awk '{print $11}');
/usr/bin/xmessage -button ok -center file - "George Takai: Helooooo";
That's what I use in a script which has to be called from cron and display something on the user's X session.

Last edited by arizonagroovejet; 11-05-2010 at 06:16 AM. Reason: Hit 'post' far too quickly.
 
1 members found this post helpful.
Old 11-05-2010, 11:05 AM   #8
zensunni
Member
 
Registered: Feb 2008
Posts: 45

Original Poster
Rep: Reputation: 0
Wow, thanks.

It's frustrating knowing you can do anything on linux, but not having the competence to do so.

I've been putting off really learning exactly how linux works, since ubuntu is so easy to use. But eventually, I'll have to sink some time into it.

Thanks again. This was very a helpful fix.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Remove Message Popup on Boot mcdef Linux - Newbie 15 09-11-2009 06:55 AM
Unlike KDE, isnt it annoying you that ESC do no close popup windows in GNOME? frenchn00b Linux - General 0 10-20-2008 02:16 PM
Send popup message to Windows computer Snouser Linux - Software 5 08-02-2008 05:54 PM
My own message popup on iconbar piokon Linux - Newbie 1 08-01-2007 07:01 AM
popup message/ bruse Linux - Newbie 14 09-05-2005 12:53 PM


All times are GMT -5. The time now is 02:32 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration