[openbox] Move to last desktop

Jim Rees rees at umich.edu
Mon Dec 10 20:45:06 EST 2012


David Vogt wrote:

  Hi all,
  
  Since a few days, I have added a few shortcuts for creating and removing
  virtual desktops. When a new desktop is created, I want it to be at the
  end (which works nicely), and then go there and use it.
  
  However, this seems not to work. There is no <action> to go to the last
  desktop.

The following completely untested patch adds magic desktop number 9999,
which maps to the last desktop.

Now that I think about it, "-1" would probably be better.

From: Jim Rees <rees at umich.edu>
Date: Mon, 10 Dec 2012 20:38:08 -0500
Subject: [PATCH] add magic desktop number 9999

Signed-off-by: Jim Rees <rees at umich.edu>
---
 openbox/actions/desktop.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/openbox/actions/desktop.c b/openbox/actions/desktop.c
index 8dadf55..23733fb 100644
--- a/openbox/actions/desktop.c
+++ b/openbox/actions/desktop.c
@@ -199,8 +199,12 @@ static gpointer setup_func(xmlNodePtr node,
             o->u.rel.dir = OB_DIRECTION_EAST;
         }
         else {
+            int n = atoi(s);
             o->type = ABSOLUTE;
-            o->u.abs.desktop = atoi(s) - 1;
+            if (n == 9999)
+                o->u.abs.desktop = screen_num_desktops - 1;
+            else
+                o->u.abs.desktop = n - 1;
         }
         g_free(s);
     }
-- 
1.7.9.5


More information about the openbox mailing list