all repos — openbox @ 4044b942e74b59599e82bb4834a730c32e49820d

openbox fork - make it a bit more like ryudo

let you use "last" in desktop action
Dana Jansens danakj@orodu.net
commit

4044b942e74b59599e82bb4834a730c32e49820d

parent

6973d5b8a50844ef8eecf076f8f15d5ece4270ef

2 files changed, 17 insertions(+), 25 deletions(-)

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

@@ -773,27 +773,6 @@ screen_set_desktop(data->sendto.desk, TRUE);

} } -void action_desktop_dir(union ActionData *data) -{ - guint d; - - d = screen_cycle_desktop(data->desktopdir.dir, - data->desktopdir.wrap, - data->desktopdir.linear, - data->desktopdir.inter.any.interactive, - data->desktopdir.inter.final, - data->desktopdir.inter.cancel); - /* only move the desktop when the action is complete. if we switch - desktops during the interactive action, focus will move but with - NotifyWhileGrabbed and applications don't like that. */ - if (!data->sendtodir.inter.any.interactive || - (data->sendtodir.inter.final && !data->sendtodir.inter.cancel)) - { - if (d != screen_desktop) - screen_set_desktop(d, TRUE); - } -} - void action_send_to_desktop_dir(union ActionData *data) { ObClient *c = data->sendtodir.inter.any.c;
M openbox/actions/desktop.copenbox/actions/desktop.c

@@ -3,6 +3,7 @@ #include "openbox/screen.h"

#include <glib.h> typedef struct { + gboolean last; guint desktop; } Options;

@@ -26,8 +27,14 @@ Options *o;

o = g_new0(Options, 1); - if ((n = parse_find_node("desktop", node))) - o->desktop = parse_int(doc, n) - 1; + if ((n = parse_find_node("desktop", node))) { + gchar *s = parse_string(doc, n); + if (!g_ascii_strcasecmp(s, "last")) + o->last = TRUE; + else + o->desktop = parse_int(doc, n) - 1; + g_free(s); + } return o; }

@@ -42,9 +49,15 @@ /* Always return FALSE because its not interactive */

static gboolean run_func(ObActionsData *data, gpointer options) { Options *o = options; + guint d; - if (o->desktop < screen_num_desktops) - screen_set_desktop(o->desktop, TRUE); + if (o->last) + d = screen_last_desktop; + else + d = o->desktop; + + if (d < screen_num_desktops) + screen_set_desktop(d, TRUE); return FALSE; }