I've always dreaded the X startup I have to go thru, where I switch thru 10 virtual desktops and start applications in each one. I know there is "desktop suspend-to-disk", but that requires a kernel patch, etc. This is just a simple Perl script, that will cycle thru your virtual desktops and start applications. You may need to adjust the delay, if your computer is slow, to prevent a slow-starting app from appearing on the adjacent desktop. Tested with ICEWM, and works with EWMH compliant window managers, and requires the wmctrl program.

I have 10 desktops, so adjust your script according to your desktop setup.

#!/usr/bin/perl use warnings; use strict; use X11::WMCtrl; # based on the EWMH specification: # http://www.freedesktop.org/standards/wm-spec/ # wmctrl only works with window managers which implement # this specification. # The homepage of wmctrl: # http://sweb.cz/tripie/utils/wmctrl/ # wmctrl must be installed somewhere in the path my $wmctrl = X11::WMCtrl->new; my %setup= ( 0 => '/home/zentara/mozilla/run-mozilla.sh', 1 => '/usr/bin/sylpheed', 2 => '/usr/bin/tk-spamchecker', 3 => undef, 4 => undef, 5 => 'xterm -fn 10x20 -ls -geometry 97x35+0+25 -e /usr/bin/mc', 6 => undef, 7 => 'xterm -fn 10x20 -ls -geometry 97x35+0+25 -e /usr/bin/mc', 8 => '/usr/bin/agent', 9 => '/usr/bin/girc' ); foreach my $wrksp (0..9){ $wmctrl->switch($wrksp); my $cmd = $setup{$wrksp}; if(defined $cmd){ system("$cmd &"); sleep 3 } $wmctrl->maximize($wrksp); } #my $app = $windows[0]->{title}; #$wmctrl->maximize($app); #$wmctrl->unmaximize($app); #$wmctrl->shade($app); #$wmctrl->unshade($app); #$wmctrl->close($app);

In reply to automate your linux window manager by zentara

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.