openbox/actions/fullscreen.c \
openbox/actions/iconify.c \
openbox/actions/kill.c \
+ openbox/actions/layer.c \
openbox/actions/lower.c \
openbox/actions/maximize.c \
openbox/actions/maximizehorizontal.c \
ObClient *c = data->layer.any.c;
client_action_start(data);
- if (data->layer.layer < 0)
- client_set_layer(c, c->below ? 0 : -1);
- else if (data->layer.layer > 0)
- client_set_layer(c, c->above ? 0 : 1);
client_action_end(data, config_focus_under_mouse);
}
-void action_toggle_dockautohide(union ActionData *data)
-{
-}
-
-void action_remove_desktop(union ActionData *data)
-{
-}
action_resizerelative_startup();
action_addremovedesktop_startup();
action_dockautohide_startup();
+ action_layer_startup();
}
void action_resizerelative_startup();
void action_addremovedesktop_startup();
void action_dockautohide_startup();
+void action_layer_startup();
#endif
o = g_new0(Options, 1);
o->toggle = TRUE;
- if ((n = parse_find_node("decorations", node))) {
+ if ((n = parse_find_node("state", node))) {
gchar *s = parse_string(doc, n);
if (g_ascii_strcasecmp(s, "toggle")) {
o->toggle = FALSE;
--- /dev/null
+#include "openbox/actions.h"
+#include "openbox/client.h"
+
+typedef struct {
+ gint layer; /*!< -1 for below, 0 for normal, and 1 for above */
+ gboolean toggle;
+ gboolean on;
+} Options;
+
+static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node);
+static void free_func(gpointer options);
+static gboolean run_func(ObActionsData *data, gpointer options);
+
+void action_layer_startup()
+{
+ actions_register("Layer",
+ setup_func,
+ free_func,
+ run_func,
+ NULL, NULL);
+}
+
+static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node)
+{
+ xmlNodePtr n;
+ Options *o;
+
+ o = g_new0(Options, 1);
+ o->toggle = TRUE;
+
+ if ((n = parse_find_node("layer", node))) {
+ gchar *s = parse_string(doc, n);
+ if (!g_ascii_strcasecmp(s, "above") ||
+ !g_ascii_strcasecmp(s, "top"))
+ o->layer = 1;
+ else if (!g_ascii_strcasecmp(s, "below") ||
+ !g_ascii_strcasecmp(s, "bottom"))
+ o->layer = -1;
+ else if (!g_ascii_strcasecmp(s, "normal") ||
+ !g_ascii_strcasecmp(s, "middle"))
+ o->layer = 0;
+ g_free(s);
+ }
+ if ((n = parse_find_node("state", node))) {
+ gchar *s = parse_string(doc, n);
+ if (g_ascii_strcasecmp(s, "toggle")) {
+ o->toggle = FALSE;
+ o->on = parse_bool(doc, n);
+ }
+ g_free(s);
+ }
+
+ return o;
+}
+
+static void free_func(gpointer options)
+{
+ Options *o = options;
+
+ g_free(o);
+}
+
+/* Always return FALSE because its not interactive */
+static gboolean run_func(ObActionsData *data, gpointer options)
+{
+ Options *o = options;
+
+ if (data->client) {
+ ObClient *c = data->client;
+
+ actions_client_move(data, TRUE);
+
+ if (o->layer < 0) {
+ if (o->toggle || c->below != o->on)
+ client_set_layer(c, c->below ? 0 : -1);
+ }
+ else if (o->layer > 0) {
+ if (o->toggle || c->above != o->on)
+ client_set_layer(c, c->above ? 0 : 1);
+ }
+ else {
+ if ((o->toggle || o->on) && (c->above || c->below))
+ client_set_layer(c, 0);
+ }
+
+ actions_client_move(data, FALSE);
+ }
+
+ return FALSE;
+}
o = g_new0(Options, 1);
o->toggle = TRUE;
- if ((n = parse_find_node("maximize", node))) {
+ if ((n = parse_find_node("state", node))) {
gchar *s = parse_string(doc, n);
if (g_ascii_strcasecmp(s, "toggle")) {
o->toggle = FALSE;
o = g_new0(Options, 1);
o->toggle = TRUE;
- if ((n = parse_find_node("maximize", node))) {
+ if ((n = parse_find_node("state", node))) {
gchar *s = parse_string(doc, n);
if (g_ascii_strcasecmp(s, "toggle")) {
o->toggle = FALSE;
o = g_new0(Options, 1);
o->toggle = TRUE;
- if ((n = parse_find_node("maximize", node))) {
+ if ((n = parse_find_node("state", node))) {
gchar *s = parse_string(doc, n);
if (g_ascii_strcasecmp(s, "toggle")) {
o->toggle = FALSE;
o = g_new0(Options, 1);
o->toggle = TRUE;
- if ((n = parse_find_node("omnipresent", node))) {
+ if ((n = parse_find_node("state", node))) {
gchar *s = parse_string(doc, n);
if (g_ascii_strcasecmp(s, "toggle")) {
o->toggle = FALSE;
o = g_new0(Options, 1);
o->toggle = TRUE;
- if ((n = parse_find_node("shade", node))) {
+ if ((n = parse_find_node("state", node))) {
gchar *s = parse_string(doc, n);
if (g_ascii_strcasecmp(s, "toggle")) {
o->toggle = FALSE;