Skip to content

Instantly share code, notes, and snippets.

@bbidulock
Created May 15, 2014 11:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bbidulock/e652839e798da983915f to your computer and use it in GitHub Desktop.
Save bbidulock/e652839e798da983915f to your computer and use it in GitHub Desktop.
Little test program for static windows in JWM
#!/usr/bin/perl
use Glib qw(TRUE FALSE);
use Gtk2 -init;
use strict;
use warnings;
my $manager = Gtk2::Gdk::DisplayManager->get;
my $dpy = $manager->get_default_display;
my $screen = $dpy->get_default_screen;
my $root = $screen->get_root_window;
my $property = Gtk2::Gdk::Atom->new(_XROOTPMAP_ID=>FALSE);
my $pixmap;
my ($type,$format,@data) = $root->property_get($property,undef,0,255,FALSE);
if ($type and $data[0]) {
my $pmid = $data[0];
my ($x,$y,$w,$h,$d) = $root->get_geometry;
$pixmap = Gtk2::Gdk::Pixmap->foreign_new_for_screen($screen,$pmid,$w,$h,$d);
$pixmap->set_colormap($screen->get_default_colormap);
}
my $win = Gtk2::Window->new('toplevel');
$win->set_default_size(400,400);
$win->set_gravity('static');
$win->realize;
$win->window->set_geometry_hints({win_gravity=>'static'});
if ($pixmap) {
my $style = $win->get_default_style->copy;
foreach (qw(normal prelight)) {
$style->bg_pixmap($_,$pixmap);
}
$win->set_style($style);
}
$win->show;
$win->signal_connect(destroy=>sub{Gtk2->main_quit(); 1;});
Gtk2->main;
exit(0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment