]> git.sur5r.net Git - i3/i3/blobdiff - include/util.h
Implement 'swap' command.
[i3/i3] / include / util.h
index 9915c1a87a551a42dde79bf0e60505f5c7a8635e..6c5fc4c659eb1c5f7230a143ad314aa6dae2de64 100644 (file)
@@ -10,6 +10,8 @@
  */
 #pragma once
 
+#include <config.h>
+
 #include <err.h>
 
 #include "data.h"
@@ -67,6 +69,14 @@ Rect rect_sub(Rect a, Rect b);
  */
 __attribute__((pure)) bool name_is_digits(const char *name);
 
+/**
+ * Set 'out' to the layout_t value for the given layout. The function
+ * returns true on success or false if the passed string is not a valid
+ * layout name.
+ *
+ */
+bool layout_from_name(const char *layout_str, layout_t *out);
+
 /**
  * Parses the workspace name as a number. Returns -1 if the workspace should be
  * interpreted as a "named workspace".
@@ -147,3 +157,10 @@ void start_nagbar(pid_t *nagbar_pid, char *argv[]);
  *
  */
 void kill_nagbar(pid_t *nagbar_pid, bool wait_for_it);
+
+/**
+ * Converts a string into a long using strtol().
+ * This is a convenience wrapper checking the parsing result. It returns true
+ * if the number could be parsed.
+ */
+bool parse_long(const char *str, long *out, int base);