]> git.lizzy.rs Git - bspwm.git/blobdiff - messages.c
Automatically check for sockets without screen name.
[bspwm.git] / messages.c
index da669c405d62c826afe1c0c0f0722185e4eafc09..d859a3f8d91fba99ebee71fb055f92717c200397 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2014, Bastien Dejean
+/* Copyright (c) 2012, Bastien Dejean
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those
- * of the authors and should not be interpreted as representing official policies,
- * either expressed or implied, of the FreeBSD Project.
  */
 
 #include <errno.h>
@@ -261,6 +257,8 @@ int cmd_window(char **args, int num)
                        num--, args++;
                        if (num < 2)
                                return MSG_SYNTAX;
+                       if (!is_tiled(trg.node->client))
+                               return MSG_FAILURE;
                        direction_t dir;
                        if (!parse_direction(*args, &dir))
                                return MSG_FAILURE;
@@ -529,6 +527,8 @@ int cmd_monitor(char **args, int num)
                        desktop_t *d = trg.monitor->desk_head;
                        while (num > 0 && d != NULL) {
                                snprintf(d->name, sizeof(d->name), "%s", *args);
+                               initialize_desktop(d);
+                               arrange(trg.monitor, d);
                                d = d->next;
                                num--, args++;
                        }
@@ -868,7 +868,7 @@ int cmd_quit(char **args, int num)
 
 int set_setting(coordinates_t loc, char *name, char *value)
 {
-#define DESKWINGLOBSET(k, v) \
+#define DESKWINDEFSET(k, v) \
                if (loc.node != NULL) \
                        loc.node->client->k = v; \
                else if (loc.desktop != NULL) \
@@ -882,9 +882,9 @@ int set_setting(coordinates_t loc, char *name, char *value)
                unsigned int bw;
                if (sscanf(value, "%u", &bw) != 1)
                        return MSG_FAILURE;
-               DESKWINGLOBSET(border_width, bw)
-#undef DESKWINGLOBSET
-#define DESKGLOBSET(k, v) \
+               DESKWINDEFSET(border_width, bw)
+#undef DESKWINDEFSET
+#define DESKDEFSET(k, v) \
                if (loc.desktop != NULL) \
                        loc.desktop->k = v; \
                else if (loc.monitor != NULL) \
@@ -896,8 +896,8 @@ int set_setting(coordinates_t loc, char *name, char *value)
                int wg;
                if (sscanf(value, "%i", &wg) != 1)
                        return MSG_FAILURE;
-               DESKGLOBSET(window_gap, wg)
-#undef DESKGLOBSET
+               DESKDEFSET(window_gap, wg)
+#undef DESKDEFSET
 #define MONDESKSET(k, v) \
                if (loc.desktop != NULL) \
                        loc.desktop->k = v; \
@@ -987,16 +987,25 @@ int set_setting(coordinates_t loc, char *name, char *value)
                        return MSG_FAILURE;
                SETBOOL(borderless_monocle)
                SETBOOL(gapless_monocle)
+               SETBOOL(pointer_follows_focus)
                SETBOOL(pointer_follows_monitor)
                SETBOOL(apply_floating_atom)
                SETBOOL(auto_alternate)
                SETBOOL(auto_cancel)
                SETBOOL(history_aware_focus)
+               SETBOOL(focus_by_distance)
                SETBOOL(ignore_ewmh_focus)
-               SETBOOL(remove_disabled_monitors)
-               SETBOOL(remove_unplugged_monitors)
-               SETBOOL(merge_overlapping_monitors)
 #undef SETBOOL
+#define SETMONBOOL(s) \
+       } else if (streq(#s, name)) { \
+               if (!parse_bool(value, &s)) \
+                       return MSG_FAILURE; \
+               if (s) \
+                       update_monitors();
+               SETMONBOOL(remove_disabled_monitors)
+               SETMONBOOL(remove_unplugged_monitors)
+               SETMONBOOL(merge_overlapping_monitors)
+#undef SETMONBOOL
        } else {
                return MSG_FAILURE;
        }
@@ -1013,17 +1022,17 @@ int get_setting(coordinates_t loc, char *name, FILE* rsp)
        if (streq("split_ratio", name))
                fprintf(rsp, "%lf", split_ratio);
        else if (streq("window_gap", name))
-               if (loc.desktop == NULL)
-                       return MSG_FAILURE;
-               else
+               if (loc.desktop != NULL)
                        fprintf(rsp, "%i", loc.desktop->window_gap);
+               else
+                       fprintf(rsp, "%i", window_gap);
        else if (streq("border_width", name))
                if (loc.node != NULL)
                        fprintf(rsp, "%u", loc.node->client->border_width);
                else if (loc.desktop != NULL)
                        fprintf(rsp, "%u", loc.desktop->border_width);
                else
-                       return MSG_FAILURE;
+                       fprintf(rsp, "%u", border_width);
        else if (streq("external_rules_command", name))
                fprintf(rsp, "%s", external_rules_command);
        else if (streq("status_prefix", name))
@@ -1062,11 +1071,13 @@ int get_setting(coordinates_t loc, char *name, FILE* rsp)
        GETBOOL(borderless_monocle)
        GETBOOL(gapless_monocle)
        GETBOOL(focus_follows_pointer)
+       GETBOOL(pointer_follows_focus)
        GETBOOL(pointer_follows_monitor)
        GETBOOL(apply_floating_atom)
        GETBOOL(auto_alternate)
        GETBOOL(auto_cancel)
        GETBOOL(history_aware_focus)
+       GETBOOL(focus_by_distance)
        GETBOOL(ignore_ewmh_focus)
        GETBOOL(remove_disabled_monitors)
        GETBOOL(remove_unplugged_monitors)