summaryrefslogtreecommitdiff
path: root/src/actionGroups/windowListGroup.vala
diff options
context:
space:
mode:
Diffstat (limited to 'src/actionGroups/windowListGroup.vala')
-rw-r--r--src/actionGroups/windowListGroup.vala32
1 files changed, 24 insertions, 8 deletions
diff --git a/src/actionGroups/windowListGroup.vala b/src/actionGroups/windowListGroup.vala
index a2dc19c..1560f5f 100644
--- a/src/actionGroups/windowListGroup.vala
+++ b/src/actionGroups/windowListGroup.vala
@@ -32,7 +32,7 @@ public class WindowListGroup : ActionGroup {
public static GroupRegistry.TypeDescription register() {
var description = new GroupRegistry.TypeDescription();
description.name = _("Group: Window List");
- description.icon = "gnome-window-manager";
+ description.icon = "preferences-system-windows";
description.description = _("Shows a Slice for each of your opened Windows. Almost like Alt-Tab.");
description.id = "window_list";
return description;
@@ -94,21 +94,37 @@ public class WindowListGroup : ActionGroup {
(bamf_app == null) ? application.get_icon_name().down() : bamf_app.get_icon(),
"%lu".printf(window.get_xid())
);
- action.activated.connect(() => {
+ action.activated.connect((time_stamp) => {
Wnck.Screen.get_default().force_update();
var xid = (X.Window)uint64.parse(action.real_command);
var win = Wnck.Window.get(xid);
- var time = Gtk.get_current_event_time();
- if (win.get_workspace() != null
- && win.get_workspace() != win.get_screen().get_active_workspace())
- win.get_workspace().activate(time);
+ if (win.get_workspace() != null) {
+ //select the workspace
+ if (win.get_workspace() != win.get_screen().get_active_workspace())
+ win.get_workspace().activate(time_stamp);
+
+ //select the viewport inside the wprkspace
+ if (!win.is_in_viewport(win.get_workspace()) ) {
+ int xp, yp, widthp, heightp, scx, scy, nx, ny, wx, wy;
+ win.get_geometry (out xp, out yp, out widthp, out heightp);
+ scx= win.get_screen().get_width();
+ scy= win.get_screen().get_height();
+ wx= win.get_workspace().get_viewport_x();
+ wy= win.get_workspace().get_viewport_y();
+ if (scx > 0 && scy > 0) {
+ nx= ((wx+xp) / scx) * scx;
+ ny= ((wy+yp) / scy) * scy;
+ win.get_screen().move_viewport(nx, ny);
+ }
+ }
+ }
if (win.is_minimized())
- win.unminimize(time);
+ win.unminimize(time_stamp);
- win.activate_transient(time);
+ win.activate_transient(time_stamp);
});
this.add_action(action);
}