[openbox] 3x3 grid desktop

Clay Barnes clay.barnes at gmail.com
Sat Sep 10 12:19:38 EDT 2005


Mikael Magnusson wrote:

>On 9/7/05, Clay Barnes <clay.barnes at gmail.com> wrote:
>  
>
>>Is there any CLI method for doing something like this?  I don't use a
>>pager, and don't like them, but I would like to change the arrangement
>>at X11 start time through .xinitrc.  It is very much a pain to load a
>>pager, change the settings, and kill it every time I start X11 (frequently).
>>    
>>
>
>There was a patch long ago that added a config option in openbox for
>the number of rows. It is a bit buggy, but I guess it will be fine for
>you. I don't actually remember what's wrong with it. I also don't know
>who I got it from.
>
>  
>
>------------------------------------------------------------------------
>
>diff -wrup openbox-3.2/openbox/config.c openbox-3.2_vmx/openbox/config.c
>--- openbox-3.2/openbox/config.c	2004-04-17 14:12:49.000000000 +0200
>+++ openbox-3.2_vmx/openbox/config.c	2004-04-28 20:08:39.000000000 +0200
>@@ -39,6 +39,7 @@ gboolean config_theme_keepborder;
> gchar *config_title_layout;
>
> gint    config_desktops_num;
>+gint    config_desktops_rows;
> GSList *config_desktops_names;
> gint    config_screen_firstdesk;
>
>@@ -266,6 +267,11 @@ static void parse_desktops(ObParseInst *
>         if (d > 0)
>             config_desktops_num = d;
>     }
>+    if ((n = parse_find_node("rows", node))) {
>+        gint d = parse_int(doc, n);
>+        if (d > 0)
>+            config_desktops_rows = d;
>+    }
>     if ((n = parse_find_node("firstdesk", node))) {
>         gint d = parse_int(doc, n);
>         if (d > 0)
>@@ -549,6 +555,7 @@ void config_startup(ObParseInst *i)
>     parse_register(i, "theme", parse_theme, NULL);
>
>     config_desktops_num = 4;
>+    config_desktops_rows = 1;
>     config_screen_firstdesk = 1;
>     config_desktops_names = NULL;
>
>diff -wrup openbox-3.2/openbox/config.h openbox-3.2_vmx/openbox/config.h
>--- openbox-3.2/openbox/config.h	2004-03-21 21:06:40.000000000 +0100
>+++ openbox-3.2_vmx/openbox/config.h	2004-04-28 20:10:07.000000000 +0200
>@@ -84,6 +84,8 @@ extern gchar *config_title_layout;
>
> /*! The number of desktops */
> extern gint config_desktops_num;
>+/*! The number of desktops rows */
>+extern gint config_desktops_rows;
> /*! Desktop to start on, put 5 to start in the center of a 3x3 grid */
> extern gint config_screen_firstdesk;
> /*! Names for the desktops */
>
>diff -wrup openbox-3.2/openbox/screen.c openbox-3.2_vmx/openbox/screen.c
>--- openbox-3.2/openbox/screen.c	2004-04-06 19:58:54.000000000 +0200
>+++ openbox-3.2_vmx/openbox/screen.c	2004-04-28 20:11:49.000000000 +0200
>@@ -156,7 +156,7 @@ gboolean screen_annex()
>     XSetWindowAttributes attrib;
>     pid_t pid;
>     gint i, num_support;
>-    guint32 *supported;
>+    guint32 *supported, layout[4];
>
>     /* create the netwm support window */
>     attrib.override_redirect = TRUE;
>@@ -194,6 +194,14 @@ gboolean screen_annex()
>     PROP_SET32(RootWindow(ob_display, ob_screen),
>                openbox_pid, cardinal, pid);
>
>+    /* set desktop layout */
>+    layout[0] = screen_desktop_layout.orientation;
>+    layout[1] = screen_desktop_layout.columns;
>+    layout[2] = screen_desktop_layout.rows;
>+    layout[3] = screen_desktop_layout.start_corner;
>+    PROP_SETA32(RootWindow(ob_display, ob_screen),
>+               net_desktop_layout, cardinal, layout, 4);
>+
>     /* set supporting window */
>     PROP_SET32(RootWindow(ob_display, ob_screen),
>                net_supporting_wm_check, window, screen_support_win);
>@@ -825,8 +833,10 @@ void screen_update_layout()
>         /* defaults */
>         orient = OB_ORIENTATION_HORZ;
>         corner = OB_CORNER_TOPLEFT;
>-        rows = 1;
>-        cols = screen_num_desktops;
>+        rows = config_desktops_rows;
>+        cols = screen_num_desktops / config_desktops_rows;
>+        if (screen_num_desktops % config_desktops_rows)
>+            cols += 1;
>     }
>
>     screen_desktop_layout.orientation = orient;
>  
>
Thanks.  I'll look into that, but I'm not completely sure I can afford 
any buggyness in my WM (I have ATI drivers, and I have to do a full 
reboot if I restart my WM (going to a terminal from X freezes the system 
when I try to exit terminal mode again)).

Also, I'm trying to stay with purely package-management programs, so 
patching and compiling I try to avoid (I will do it whenever there's a 
need (i.e. the kernel), but for minor features, I avoid it).

For the good of the community, I may patch and recompile and get some 
real behavior info from the bugs to get the feature fixed and generally 
available to the rest of the world...



More information about the openbox mailing list