all repos — openbox @ c590a83207ed5825b513e2278789ed13f55574b2

openbox fork - make it a bit more like ryudo

Add "active" and "primary" options to the <monitor> placement option for per-app settings (bug #5180)
Dana Jansens danakj@orodu.net
commit

c590a83207ed5825b513e2278789ed13f55574b2

parent

a0d14c7d4468b6348d906a68bb5dfe3acce0ad64

3 files changed, 29 insertions(+), 4 deletions(-)

jump to
M openbox/config.copenbox/config.c

@@ -111,6 +111,7 @@ ObAppSettings *settings = g_slice_new0(ObAppSettings);

settings->type = -1; settings->decor = -1; settings->shade = -1; + settings->monitor_type = 0; settings->monitor = -1; settings->focus = -1; settings->desktop = 0;

@@ -135,6 +136,7 @@

copy_if(type, (ObClientType)-1); copy_if(decor, -1); copy_if(shade, -1); + copy_if(monitor_type, 0); copy_if(monitor, -1); copy_if(focus, -1); copy_if(desktop, 0);

@@ -200,8 +202,8 @@ */

/* Manages settings for individual applications. Some notes: monitor is the screen number in a multi monitor - (Xinerama) setup (starting from 0) or mouse, meaning the - monitor the pointer is on. Default: mouse. + (Xinerama) setup (starting from 0), or mouse: the monitor the pointer + is on, active: the active monitor, primary: the primary monitor. Layer can be three values, above (Always on top), below (Always on bottom) and everything else (normal behaviour). Positions can be an integer value or center, which will

@@ -294,7 +296,14 @@ (c = obt_xml_find_node(n->children, "monitor")))

if (!obt_xml_node_contains(c, "default")) { gchar *s = obt_xml_node_string(c); if (!g_ascii_strcasecmp(s, "mouse")) - settings->monitor = 0; + settings->monitor_type = + OB_APP_SETTINGS_MONITOR_MOUSE; + else if (!g_ascii_strcasecmp(s, "active")) + settings->monitor_type = + OB_APP_SETTINGS_MONITOR_ACTIVE; + else if (!g_ascii_strcasecmp(s, "primary")) + settings->monitor_type = + OB_APP_SETTINGS_MONITOR_PRIMARY; else settings->monitor = obt_xml_node_int(c); g_free(s);
M openbox/config.hopenbox/config.h

@@ -33,6 +33,13 @@ #include <glib.h>

typedef struct _ObAppSettings ObAppSettings; +typedef enum { + OB_APP_SETTINGS_MONITOR_FIXED, + OB_APP_SETTINGS_MONITOR_PRIMARY, + OB_APP_SETTINGS_MONITOR_ACTIVE, + OB_APP_SETTINGS_MONITOR_MOUSE +} ObAppSettingsMonitor; + struct _ObAppSettings { GPatternSpec *class;

@@ -49,6 +56,7 @@ guint desktop;

gint shade; gint decor; gint focus; + ObAppSettingsMonitor monitor_type; gint monitor; gint iconic; gint skip_pager;
M openbox/place.copenbox/place.c

@@ -451,7 +451,15 @@

ob_debug("placing by per-app settings"); /* Find which head the pointer is on */ - if (settings->monitor == 0) { + if (settings->monitor_type == OB_APP_SETTINGS_MONITOR_PRIMARY) { + guint m = screen_monitor_primary(TRUE); + screen = screen_area(client->desktop, m, NULL); + } + else if (settings->monitor_type == OB_APP_SETTINGS_MONITOR_ACTIVE) { + guint m = screen_monitor_active(); + screen = screen_area(client->desktop, m, NULL); + } + else if (settings->monitor_type == OB_APP_SETTINGS_MONITOR_MOUSE) { screen = pick_pointer_head(client); g_assert(screen); }