>Hi, what exactly are you trying to do with Gnome2::Wnck ?

Window tiling on multiple workspaces. Firstly, I use WNCK get a list of workspaces and their sizes. Then I create a test Gtk2::Window, size 100x100. Then I use WNCK to get the actual size of the window. This gives me the size of window controls.

Then I draw a test window in the top left/bottom right corners of the window. Then I use WNCK to get the actual size/position of the window. This gives me the size and position of taskbars/panels, which gives me the size of the available workspace.

Specifically, these are the operations I use. I have never found any alternative to WNCK, and of course finding something that works on MS Windows as well as Linux is just a foolish pipe dream :)

Get the default screen and workspace

$screen = Gnome2::Wnck::Screen->get_default() $screen->force_update(); $workspace = $screen->get_active_workspace();

Get remaining workspaces

do { $otherWorkspace = $workspace->get_neighbor('WNCK_MOTION_RIGHT'); until (! $otherWorkspace);

Get the size of a workspace

$workspace->get_width(); $workspace->get_height();

Move a window to a workspace

$wnckWin->move_to_workspace($workspace);

Get a window's current screen

$screen = $wnckWin->get_screen();

Get the system name/number for a workspace

$num = $workspace->get_number(); $name = $workspace->get_name();

Get/set the size and position of the window

$wnckWin->get_client_window_geometry(); $wnckWin->set_geometry( 'WNCK_WINDOW_GRAVITY_CURRENT', [ 'WNCK_WINDOW_CHANGE_X', 'WNCK_WINDOW_CHANGE_Y', 'WNCK_WINDOW_CHANGE_WIDTH', 'WNCK_WINDOW_CHANGE_HEIGHT', ], $x, $y, $width, $height, );

Minimise/unminimise windows

$wnckWin->unminimize(time()); $wnckWin->minimize(); if (wnckWin->is_minimized) { ... }

Given a WNCK window, find the equivalent Gtk2 window

foreach my $gtkWin (Gtk2::Window->list_toplevels()) { $wnckWinXid = $wnckWin->get_xid(); $gtkWinXid = $gtkWin->get_xid(); if ($wnckWinXid eq $gtkWinXid) { ... } }

Given a Gtk window, find the equivalent WNCK window

$gdkWin = $gtkWin->get_window(); $winXid = $gdkWin->get_xid(); $wnckScreen->force_update(); foreach my $wnckWin ($wnckScreen->get_windows()) { my $wnckWinXid = $wnckWin->get_xid(); if ($wnckWinXid && $wnckWinXid eq $winXid) { ... }

Find the WNCK window for "Notepad" or "Firefox", or whatever

$wnckScreen->force_update(); foreach my $wnckWin ($wnckScreen->get_windows()) { if ($wnckWin->get_name() eq 'Notepad') { ... } }

In reply to Re^2: Upgrade Gtk2 to Gtk3, and Gnome2::Wnck breaks by Anonymous Monk
in thread Upgrade Gtk2 to Gtk3, and Gnome2::Wnck breaks by Anonymous Monk

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.