w3ntp has asked for the wisdom of the Perl Monks concerning the following question:

I have created a multifunction Perl/TK Menu widget that is launched when ever someone logs into my Sun/Solaris box running the gnome environment. Currently the Menu widget only populates the first gnome window only. What I would like to do is have this Perl/TK menu widget automatically populate all gnome windows whenever any user logs in. Any ideas? thanks w3ntp
  • Comment on How to Populate multiple Solaris gnome windows with a Perl/TK widget

Replies are listed 'Best First'.
Re: How to Populate multiple Solaris gnome windows with a Perl/TK widget
by zentara (Cardinal) on Jun 02, 2005 at 19:17 UTC
    Just some ideas off the top of my head ( since you didn't give many details). Like what do you mean..."populate all gnome windows" ? Do you mean every virtual desktop, or every gnome-based application which you launch?

    FWIW, there are 2 types of shells within bash, the -i and -l options. There are a different set of rc files which get run, depending on whether it's a 'login' shell or an 'interactive' shell. For bash, read man bash and look for the INVOCATION section. It tells you which file will be read for a login, and you can probably put your launching statement in that file.

    Of course, you probably need a graphical logon for it to work, because Tk needs a X server to talk to. But there are tests you can do, to see whether you are in X or not.

    Just as another "coffee-room-comment", maybe you should look at Gtk2-perl , instead of Tk, if you are using gnome. There are bindings to the gnome libs withing Gtk2-perl, and may be helpful to you, like "taskbar" apps.


    I'm not really a human, but I play one on earth. flash japh
      Thanks for the reply. To clarify things..When I logon to the solaris box, there are 6 gnome workspaces that appear in the botttom right of the screen that I can select from. I would like my Perl Gui to appear in all 6 of the workspaces, so that whenever the user switches from one workspace to the next the Perl Gui widget will allways appear ontop of the workstpace window. I hope this clarifies things. thanks w3ntp
        It sounds like you just want to add the overrideredirect flag to your script. This code should stay on top of all 6 workspaces.
        #!/usr/bin/perl use warnings; use strict; use Tk; my $mw = tkinit; $mw->geometry("200x300+200+200"); $mw->overrideredirect(1); # set the override-redirect flag $mw->packPropagate(0); # prevent the window being resized # for this demo $mw->Button( -text => 'Quit', -command => sub { Tk::exit(0) }, )->pack( -side => 'bottom', ); MainLoop;

        I'm not really a human, but I play one on earth. flash japh
Re: How to Populate multiple Solaris gnome windows with a Perl/TK widget
by jpeg (Chaplain) on Jun 03, 2005 at 00:12 UTC
    I'm a fvwm guy myself, so I don't know the answer, but I thought I'd point you to an article I read a few years ago in Sysadmin magazine that might give you an alternative (not a solution, but I think it's quite cool):

    Gnome panel applets in perl

    I know under some environments you can 'pin' a window to be always in a certain window or always on top. It's a function of the window manager, not perl. Maybe http://gnomesupport.org could help you.

    HTH.

    --
    jpg
Re: How to Populate multiple Solaris gnome windows with a Perl/TK widget
by zentara (Cardinal) on Jun 03, 2005 at 19:08 UTC
    Just to clarify what I said before, if you can convert your menu from Tk to Gtk2, you can have your "sticky" window with "window manager decorations". Gtk2 separates the 2 things:
    $mw->sticky; #stay on top $mw->set_decorated(0); #no wm controls
    But Tk, just has overrideredirect, which combines the 2.

    I'm not really a human, but I play one on earth. flash japh