You want to hide your main window, and then put up a different window and mark it as "transient", which means it's a menu or popup or something like that. The following works for me, though I don't have KDE.

Also, in some window managers (like fvwm), you can configure different window decorations for different window names. So you could have a config line like "Style BatteryMeter NoTitle" or something along those lines.

#!/usr/bin/perl -w use strict; use Tk; use constant UPDATE_PERIOD => 30; # seconds use constant METER_MAX_LEN => 500; our $BatteryMeter; sub set_meter_size { my $percent_strength = shift; my $new_len = int $percent_strength * METER_MAX_LEN; $new_len = 1 if $new_len < 1; # Geometry format is WidthxHeight+OffsetFromLeft+OffsetFromTop $BatteryMeter->geometry("${new_len}x2+10+200"); } sub update_battery_strength { my $battery_strength = rand(); # instead of rand(), figure out you +r # battery life set_meter_size($battery_strength); } my $main_window = MainWindow->new(); $main_window->withdraw(); $BatteryMeter = $main_window->Toplevel(-background => 'red'); $BatteryMeter->transient($main_window); update_battery_strength(); $BatteryMeter->repeat(1000 * UPDATE_PERIOD, \&update_battery_strength) +; MainLoop();
Good luck!

In reply to Re: Making Unmanaged X Graphics? by PreferredUserName
in thread Making Unmanaged X Graphics? by suaveant

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.