Add Lock action.
[mikachu/openbox.git] / openbox / actions / lock.c
diff --git a/openbox/actions/lock.c b/openbox/actions/lock.c
new file mode 100644 (file)
index 0000000..1271cbc
--- /dev/null
@@ -0,0 +1,17 @@
+#include "openbox/actions.h"
+#include "openbox/client.h"
+
+static gboolean run_func(ObActionsData *data, gpointer options);
+
+void action_lock_startup(void)
+{
+    actions_register("Lock", NULL, NULL, run_func);
+}
+
+/* Always return FALSE because its not interactive */
+static gboolean run_func(ObActionsData *data, gpointer options)
+{
+    if (data->client)
+        data->client->locked = !data->client->locked;
+    return FALSE;
+}