* [gentoo-user] pop up windows with text message
@ 2013-07-09 16:54 Joseph
2013-07-09 22:52 ` Neil Bothwick
` (3 more replies)
0 siblings, 4 replies; 10+ messages in thread
From: Joseph @ 2013-07-09 16:54 UTC (permalink / raw
To: gentoo-user
How to design a sticky note pop-up when file is present?
I would like to check if file is present via and open a terminal window with a simple message.
I think a simple bash script and a cron job would do the trick or is there a better solution?
I've tried cron + bash script
cron:
32 10 * * * sh /home/joseph/xp_share/wall.sh
wall.sh
terminal
wall file ready
When I open terminal and type: "terminal" new windows pops up
But if close all the terminals and run wall.sh script the terminal will not open.
I get an error message: (terminal:24945): Gtk-WARNING **: cannot open
display:
--
Joseph
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [gentoo-user] pop up windows with text message
2013-07-09 16:54 [gentoo-user] pop up windows with text message Joseph
@ 2013-07-09 22:52 ` Neil Bothwick
2013-07-10 9:21 ` Alan McKinnon
` (2 subsequent siblings)
3 siblings, 0 replies; 10+ messages in thread
From: Neil Bothwick @ 2013-07-09 22:52 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: text/plain, Size: 759 bytes --]
On Tue, 9 Jul 2013 10:54:31 -0600, Joseph wrote:
> I would like to check if file is present via and open a terminal window
> with a simple message. I think a simple bash script and a cron job
> would do the trick or is there a better solution?
>
> I've tried cron + bash script
I think incron may be a better fit, its jobs are triggered by file
creation, deletion or modification.
> When I open terminal and type: "terminal" new windows pops up
> But if close all the terminals and run wall.sh script the terminal will
> not open. I get an error message: (terminal:24945): Gtk-WARNING **:
> cannot open display:
You probably need to export DISPLAY in your script.
--
Neil Bothwick
I get enough exercise just pushing my luck.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [gentoo-user] pop up windows with text message
2013-07-09 16:54 [gentoo-user] pop up windows with text message Joseph
2013-07-09 22:52 ` Neil Bothwick
@ 2013-07-10 9:21 ` Alan McKinnon
2013-07-11 2:48 ` Joseph
2013-07-11 5:12 ` Mark David Dumlao
2013-07-13 22:59 ` felix
3 siblings, 1 reply; 10+ messages in thread
From: Alan McKinnon @ 2013-07-10 9:21 UTC (permalink / raw
To: gentoo-user
On 09/07/2013 18:54, Joseph wrote:
> How to design a sticky note pop-up when file is present?
>
> I would like to check if file is present via and open a terminal window
> with a simple message.
> I think a simple bash script and a cron job would do the trick or is
> there a better solution?
>
> I've tried cron + bash script
>
> cron:
> 32 10 * * * sh /home/joseph/xp_share/wall.sh
>
> wall.sh
> terminal
> wall file ready
>
> When I open terminal and type: "terminal" new windows pops up
> But if close all the terminals and run wall.sh script the terminal will
> not open.
> I get an error message: (terminal:24945): Gtk-WARNING **: cannot open
> display:
>
You want inotify for this.
You are polling something to discover if it's there, what yu really want
to do is let the kernel notify you when the event you are interested in
occurs.
There are many tools out there that interface with the kernel's inotify
system.
--
Alan McKinnon
alan.mckinnon@gmail.com
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [gentoo-user] pop up windows with text message
2013-07-10 9:21 ` Alan McKinnon
@ 2013-07-11 2:48 ` Joseph
2013-07-11 4:47 ` Wang Xuerui
2013-07-11 8:28 ` Neil Bothwick
0 siblings, 2 replies; 10+ messages in thread
From: Joseph @ 2013-07-11 2:48 UTC (permalink / raw
To: gentoo-user
On 07/10/13 11:21, Alan McKinnon wrote:
>On 09/07/2013 18:54, Joseph wrote:
>> How to design a sticky note pop-up when file is present?
>>
>> I would like to check if file is present via and open a terminal window
>> with a simple message.
>> I think a simple bash script and a cron job would do the trick or is
>> there a better solution?
>>
>> I've tried cron + bash script
>>
>> cron:
>> 32 10 * * * sh /home/joseph/xp_share/wall.sh
>>
>> wall.sh
>> terminal
>> wall file ready
>>
>> When I open terminal and type: "terminal" new windows pops up
>> But if close all the terminals and run wall.sh script the terminal will
>> not open.
>> I get an error message: (terminal:24945): Gtk-WARNING **: cannot open
>> display:
>>
>
>
>You want inotify for this.
>
>You are polling something to discover if it's there, what yu really want
>to do is let the kernel notify you when the event you are interested in
>occurs.
>
>There are many tools out there that interface with the kernel's inotify
>system.
>
>
>--
>Alan McKinnon
>alan.mckinnon@gmail.com
Thanks Alan, yes I'm looking into it and your are the second person who suggested to me "inotify" is the tool for the job.
I've installed inotify-tools but I think I will need to find more samples to make it to work :-)
I just want to monitor one file in a directory.
I usually copy the file over the network to another computer (same file name) I'll overwrite the file.
Once I copy the file, the system should notify a use that new file exist (a message pop-up). If the use closes the message and will not open the file, after few
ours I want to remind the user that the file has not been open yet.
Will it be very complicated to write a bash script like this?
--
Joseph
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [gentoo-user] pop up windows with text message
2013-07-11 2:48 ` Joseph
@ 2013-07-11 4:47 ` Wang Xuerui
2013-07-11 8:28 ` Neil Bothwick
1 sibling, 0 replies; 10+ messages in thread
From: Wang Xuerui @ 2013-07-11 4:47 UTC (permalink / raw
To: gentoo-user
2013/7/11 Joseph <syscon780@gmail.com>:
> I just want to monitor one file in a directory.
> I usually copy the file over the network to another computer (same file
> name) I'll overwrite the file.
>
> Once I copy the file, the system should notify a use that new file exist (a
> message pop-up). If the use closes the message and will not open the file,
> after few ours I want to remind the user that the file has not been open
> yet.
>
> Will it be very complicated to write a bash script like this?
I once wrote a small Python script to help me with automating
Git-based deployments, but it's simple enough to be suitable for a
variety of use cases:
https://github.com/xen0n/touchmon
It allows you to specify a hook for each file observed, just make sure
the watched file exists before starting the watcher (a known
limitation). Inside the hook script (any language is OK) you can
pop-up a dialog and store a timestamp somewhere, if the user has the
file opened for him/her. Then for the periodic notofication, maybe a
cronjob would suffice? Simply check the stored timestamp with the
current time. If polling is not what you want, you can extend the
inotify part to also monitor events like IN_OPEN or IN_ACCESS and
manipulate your timer accordingly. But be aware of false positives
like some background daemon accessing the file, as ALL opens and reads
are watched.
Hope this helps~
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [gentoo-user] pop up windows with text message
2013-07-09 16:54 [gentoo-user] pop up windows with text message Joseph
2013-07-09 22:52 ` Neil Bothwick
2013-07-10 9:21 ` Alan McKinnon
@ 2013-07-11 5:12 ` Mark David Dumlao
2013-07-13 22:59 ` felix
3 siblings, 0 replies; 10+ messages in thread
From: Mark David Dumlao @ 2013-07-11 5:12 UTC (permalink / raw
To: gentoo-user
Btw, rather than directly opening a terminal window, you may want to
use the notify-send api / command line to do your popup. That way it
gets rendered natively by your desktop of choice, and you don't have
to fuss about searching which DISPLAY variable X is running on.
You can do something like
notify-send --app-name=foo
--icon=icon-name-in-usr-share-icons-without-the-path-and-extension
--urgency=normal|critical --expire-time=milliseconds "TITLE"
"LONGTEXT"
On Wed, Jul 10, 2013 at 12:54 AM, Joseph <syscon780@gmail.com> wrote:
> How to design a sticky note pop-up when file is present?
>
> I would like to check if file is present via and open a terminal window with
> a simple message.
> I think a simple bash script and a cron job would do the trick or is there a
> better solution?
>
> I've tried cron + bash script
>
> cron:
> 32 10 * * * sh /home/joseph/xp_share/wall.sh
>
> wall.sh
> terminal
> wall file ready
>
> When I open terminal and type: "terminal" new windows pops up
> But if close all the terminals and run wall.sh script the terminal will not
> open.
> I get an error message: (terminal:24945): Gtk-WARNING **: cannot open
> display:
>
> --
> Joseph
>
--
This email is: [ ] actionable [ ] fyi [ ] social
Response needed: [ ] yes [ ] up to you [ ] no
Time-sensitive: [ ] immediate [ ] soon [ ] none
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [gentoo-user] pop up windows with text message
2013-07-11 2:48 ` Joseph
2013-07-11 4:47 ` Wang Xuerui
@ 2013-07-11 8:28 ` Neil Bothwick
2013-07-13 3:06 ` Joseph
1 sibling, 1 reply; 10+ messages in thread
From: Neil Bothwick @ 2013-07-11 8:28 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: text/plain, Size: 1010 bytes --]
On Wed, 10 Jul 2013 20:48:22 -0600, Joseph wrote:
> Thanks Alan, yes I'm looking into it and your are the second person who
> suggested to me "inotify" is the tool for the job. I've installed
> inotify-tools but I think I will need to find more samples to make it
> to work :-)
Try incron, it uses the kernel's inotify functions but does the work
for you, and it comes with plenty of examples.
> Once I copy the file, the system should notify a use that new file
> exist (a message pop-up). If the use closes the message and will not
> open the file, after few ours I want to remind the user that the file
> has not been open yet.
incron could launch one script you when the file is created. This
would send the notification and create an at job to send another
notification after a specified time. Then you could have another
icrond task triggered by the file being opened for read, that kills
the at job
--
Neil Bothwick
God is real, unless specifically declared integer.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [gentoo-user] pop up windows with text message
2013-07-11 8:28 ` Neil Bothwick
@ 2013-07-13 3:06 ` Joseph
0 siblings, 0 replies; 10+ messages in thread
From: Joseph @ 2013-07-13 3:06 UTC (permalink / raw
To: gentoo-user
On 07/11/13 09:28, Neil Bothwick wrote:
>On Wed, 10 Jul 2013 20:48:22 -0600, Joseph wrote:
>
>> Thanks Alan, yes I'm looking into it and your are the second person who
>> suggested to me "inotify" is the tool for the job. I've installed
>> inotify-tools but I think I will need to find more samples to make it
>> to work :-)
>
>Try incron, it uses the kernel's inotify functions but does the work
>for you, and it comes with plenty of examples.
>
>> Once I copy the file, the system should notify a use that new file
>> exist (a message pop-up). If the use closes the message and will not
>> open the file, after few ours I want to remind the user that the file
>> has not been open yet.
>
>incron could launch one script you when the file is created. This
>would send the notification and create an at job to send another
>notification after a specified time. Then you could have another
>icrond task triggered by the file being opened for read, that kills
>the at job
>
>
>--
>Neil Bothwick
>
>God is real, unless specifically declared integer.
I found "gxmessage" it is very simple and perfect for pop-up message on the other computer.
--
Joseph
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [gentoo-user] pop up windows with text message
2013-07-09 16:54 [gentoo-user] pop up windows with text message Joseph
` (2 preceding siblings ...)
2013-07-11 5:12 ` Mark David Dumlao
@ 2013-07-13 22:59 ` felix
2013-07-15 18:17 ` Joseph
3 siblings, 1 reply; 10+ messages in thread
From: felix @ 2013-07-13 22:59 UTC (permalink / raw
To: gentoo-user
On Tue, Jul 09, 2013 at 10:54:31AM -0600, Joseph wrote:
> How to design a sticky note pop-up when file is present?
>
> I would like to check if file is present via and open a terminal window with a simple message.
> I think a simple bash script and a cron job would do the trick or is there a better solution?
Only partially related, I wrote the following dumb little script for crontab notifies, or to check a laptop battery every 5 minutes and report if below a certain level, etc. Really simple, but it works on most X systems.
#!/bin/sh
if [ -z "$DISPLAY" ]; then export DISPLAY=localhost:0; fi
xmopts=
while [ "$1" = "-x" ]; do
xmopts="$xmopts $2"
shift;shift
done
echo "$@
" | xmessage -bg green -fg red -file - -title Alert -nearmouse -default okay $xmopts
--
... _._. ._ ._. . _._. ._. ___ .__ ._. . .__. ._ .. ._.
Felix Finch: scarecrow repairman & rocket surgeon / felix@crowfix.com
GPG = E987 4493 C860 246C 3B1E 6477 7838 76E9 182E 8151 ITAR license #4933
I've found a solution to Fermat's Last Theorem but I see I've run out of room o
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [gentoo-user] pop up windows with text message
2013-07-13 22:59 ` felix
@ 2013-07-15 18:17 ` Joseph
0 siblings, 0 replies; 10+ messages in thread
From: Joseph @ 2013-07-15 18:17 UTC (permalink / raw
To: gentoo-user
On 07/13/13 15:59, felix@crowfix.com wrote:
>On Tue, Jul 09, 2013 at 10:54:31AM -0600, Joseph wrote:
>> How to design a sticky note pop-up when file is present?
>>
>> I would like to check if file is present via and open a terminal window with a simple message.
>> I think a simple bash script and a cron job would do the trick or is there a better solution?
>
>Only partially related, I wrote the following dumb little script for crontab notifies, or to check a laptop battery every 5 minutes and report if below a certain level, etc. Really simple, but it works on most X systems.
>
> #!/bin/sh
>
> if [ -z "$DISPLAY" ]; then export DISPLAY=localhost:0; fi
> xmopts=
> while [ "$1" = "-x" ]; do
> xmopts="$xmopts $2"
> shift;shift
> done
> echo "$@
> " | xmessage -bg green -fg red -file - -title Alert -nearmouse -default okay $xmopts
>
>--
> ... _._. ._ ._. . _._. ._. ___ .__ ._. . .__. ._ .. ._.
> Felix Finch: scarecrow repairman & rocket surgeon / felix@crowfix.com
> GPG = E987 4493 C860 246C 3B1E 6477 7838 76E9 182E 8151 ITAR license #4933
>I've found a solution to Fermat's Last Theorem but I see I've run out of room o
>
I came to the same conclusion, using gxmessage
$ ssh -t user@IP_address 'gxmessage -nearmouse -borderless --display :0.0 -entry Test message'
--
Joseph
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2013-07-15 18:16 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-09 16:54 [gentoo-user] pop up windows with text message Joseph
2013-07-09 22:52 ` Neil Bothwick
2013-07-10 9:21 ` Alan McKinnon
2013-07-11 2:48 ` Joseph
2013-07-11 4:47 ` Wang Xuerui
2013-07-11 8:28 ` Neil Bothwick
2013-07-13 3:06 ` Joseph
2013-07-11 5:12 ` Mark David Dumlao
2013-07-13 22:59 ` felix
2013-07-15 18:17 ` Joseph
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox