in reply to Making Unmanaged X Graphics?
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.
Good luck!#!/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();
|
|---|