]> Dogcows Code - chaz/openbox/blobdiff - util/epist/screen.cc
add cycling of windows of the same class on all workspaces
[chaz/openbox] / util / epist / screen.cc
index 72ee34352dea39616dea96de51902664a0ec68fa..d6ce9bbbd0591cde2ccf3367a8f303e4537d0c80 100644 (file)
@@ -164,11 +164,11 @@ void screen::handleKeypress(const XEvent &e) {
         return;
 
       case Action::nextWindow:
-        cycleWindow(true, false);
+        cycleWindow(true);
         return;
 
       case Action::prevWindow:
-        cycleWindow(false, false);
+        cycleWindow(false);
         return;
 
       case Action::nextWindowOnAllWorkspaces:
@@ -179,6 +179,22 @@ void screen::handleKeypress(const XEvent &e) {
         cycleWindow(false, true);
         return;
 
+      case Action::nextWindowOfClass:
+        cycleWindow(true, false, true);
+        return;
+
+      case Action::prevWindowOfClass:
+        cycleWindow(false, false, true);
+        return;
+
+      case Action::nextWindowOfClassOnAllWorkspaces:
+        cycleWindow(true, true, true);
+        return;
+
+      case Action::prevWindowOfClassOnAllWorkspaces:
+        cycleWindow(false, true, true);
+        return;
+
       case Action::changeWorkspace:
         changeWorkspace(it->number());
         return;
@@ -332,7 +348,8 @@ void screen::updateActiveWindow() {
  */
 
 
-void screen::cycleWindow(const bool forward, const bool alldesktops) const {
+void screen::cycleWindow(const bool forward, const bool alldesktops,
+                         const bool sameclass) const {
   assert(_managed);
 
   if (_clients.empty()) return;
@@ -354,7 +371,9 @@ void screen::cycleWindow(const bool forward, const bool alldesktops) const {
     }
   } while (target == _clients.end() ||
            (*target)->iconic() ||
-           (! alldesktops && (*target)->desktop() != _active_desktop));
+           (! alldesktops && (*target)->desktop() != _active_desktop) ||
+           (sameclass && _active != _clients.end() &&
+            (*target)->appClass() != (*_active)->appClass()));
   
   if (target != _clients.end())
     (*target)->focus();
This page took 0.02637 seconds and 4 git commands to generate.