}
}
-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;
#include <glib.h>
typedef struct {
+ gboolean last;
guint desktop;
} Options;
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;
}
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;
}