summaryrefslogtreecommitdiff
path: root/openbox/actions
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2013-09-08 13:39:59 -0400
committerDana Jansens <danakj@orodu.net>2013-09-09 10:47:43 -0400
commit7b408bc3b8f5166a3c725459e0ae7fd93ec8aacb (patch)
tree1dcfddd23141a043a049b05b7027555ab12ee6b3 /openbox/actions
parentadcb7a78d9e58c2670b0b046f418a39ec52afb5e (diff)
Add a strict option to the ToggleShowDesktop action
When the strict option is used, normal windows are not able to show themselves while showing the desktop.
Diffstat (limited to 'openbox/actions')
-rw-r--r--openbox/actions/showdesktop.c39
1 files changed, 37 insertions, 2 deletions
diff --git a/openbox/actions/showdesktop.c b/openbox/actions/showdesktop.c
index 6dc77d5e..3c3b2d10 100644
--- a/openbox/actions/showdesktop.c
+++ b/openbox/actions/showdesktop.c
@@ -1,17 +1,52 @@
#include "openbox/actions.h"
#include "openbox/screen.h"
+typedef struct {
+ /* If true, windows are unable to be shown while in the showing-desktop
+ state. */
+ gboolean strict;
+} Options;
+
+static gpointer setup_func(xmlNodePtr node);
+static void free_func(gpointer o);
static gboolean run_func(ObActionsData *data, gpointer options);
void action_showdesktop_startup(void)
{
- actions_register("ToggleShowDesktop", NULL, NULL, run_func);
+ actions_register("ToggleShowDesktop", setup_func, free_func, run_func);
+}
+
+static gpointer setup_func(xmlNodePtr node)
+{
+ xmlNodePtr n;
+ Options *o = g_slice_new0(Options);
+ o->strict = FALSE;
+
+ if ((n = obt_xml_find_node(node, "strict")))
+ o->strict = obt_xml_node_bool(n);
+
+ return o;
+}
+
+static void free_func(gpointer o)
+{
+ g_slice_free(Options, o);
}
/* Always return FALSE because its not interactive */
static gboolean run_func(ObActionsData *data, gpointer options)
{
- screen_show_desktop(!screen_showing_desktop, NULL);
+ Options *o = options;
+
+ ObScreenShowDestopMode show_mode;
+ if (screen_showing_desktop())
+ show_mode = SCREEN_SHOW_DESKTOP_NO;
+ else if (!o->strict)
+ show_mode = SCREEN_SHOW_DESKTOP_UNTIL_WINDOW;
+ else
+ show_mode = SCREEN_SHOW_DESKTOP_UNTIL_TOGGLE;
+
+ screen_show_desktop(show_mode, NULL);
return FALSE;
}