fvwm-convert-2.6: Minor cleanups.
[fvwm.git] / tests / perl / module-flash
blob2bba635663a34de1f0f7d1b596232dd4c9046f3a
1 #!/usr/bin/perl -w
3 # This module opens a flash window for one second when page is changed.
4 # Run and stop it from fvwm as:
5 # Module /path/to/module-flash
6 # KillModule /path/to/module-flash
8 use lib `fvwm-perllib dir`;
9 use FVWM::Module;
11 # choose the flash command (install osd_cat from xosd, it is nice)
12 my $flash_cmd = -x '/usr/bin/osd_cat'
13 ? "osd_cat -f 12x24 -A center -p middle -l 1 -s 2 -d 2 -c yellow"
14 : "xmessage -name FlashWindow -bg rgb:50/a0/d0 -fg white -center "
15 . "-timeout 1 -buttons '' -xrm '*Margin: 12' -xrm '*cursorName: none' "
16 . "-xrm '*borderWidth: 2' -xrm '*borderColor: rgb:f0/f0/a0' -file -";
18 my $module = new FVWM::Module(Debug => 0);
20 # show flash on every page switching
21 my $page_tracker = $module->track("PageInfo");
23 $page_tracker->observe(sub {
24 my ($module, $tracker, $info) = @_;
25 $module->send(
26 "Exec killall osd_cat xmessage 2>/dev/null; " .
27 "echo 'Desk $info->{desk_n} " .
28 "($info->{page_nx}, $info->{page_ny})' | $flash_cmd"
30 });
32 # make the FlashWindow special: OnTop, without border, without focus and so on
33 $module->send("Style FlashWindow UsePPosition, NoTitle, NoHandles, BorderWidth 10, StaysOnTop, WindowListSkip, NeverFocus");
35 # finally enter event loop
36 $module->event_loop;