let you use "last" in desktop action
This commit is contained in:
parent
6973d5b8a5
commit
4044b942e7
2 changed files with 17 additions and 25 deletions
|
@ -773,27 +773,6 @@ void action_send_to_desktop(union ActionData *data)
|
|||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include <glib.h>
|
||||
|
||||
typedef struct {
|
||||
gboolean last;
|
||||
guint desktop;
|
||||
} Options;
|
||||
|
||||
|
@ -26,8 +27,14 @@ static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node)
|
|||
|
||||
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 @@ static void free_func(gpointer options)
|
|||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue