diff options
| -rw-r--r-- | src/parser.c | 5 | ||||
| -rw-r--r-- | src/sxwm.c | 31 |
2 files changed, 25 insertions, 11 deletions
diff --git a/src/parser.c b/src/parser.c index 6ee0d6e..7cc59d1 100644 --- a/src/parser.c +++ b/src/parser.c @@ -160,6 +160,11 @@ int parser(Config *cfg) goto found; } + snprintf(path, sizeof path, "/usr/local/share/sxwmrc"); + if (access(path, R_OK) == 0) { + goto found; + } + found: FILE *f = fopen(path, "r"); if (!f) { @@ -1534,30 +1534,39 @@ void toggle_floating(void) return; } - focused->floating = !focused->floating; if (focused->fullscreen) { focused->fullscreen = False; tile(); XSetWindowBorderWidth(dpy, focused->win, user_config.border_width); } + focused->floating = !focused->floating; + if (focused->floating) { XWindowAttributes wa; - XGetWindowAttributes(dpy, focused->win, &wa); - focused->x = wa.x; - focused->y = wa.y; - focused->w = wa.width; - focused->h = wa.height; - - XConfigureWindow( - dpy, focused->win, CWX | CWY | CWWidth | CWHeight, - &(XWindowChanges){.x = focused->x, .y = focused->y, .width = focused->w, .height = focused->h}); + if (XGetWindowAttributes(dpy, focused->win, &wa)) { + focused->x = wa.x; + focused->y = wa.y; + focused->w = wa.width; + focused->h = wa.height; + + XConfigureWindow( + dpy, focused->win, + CWX | CWY | CWWidth | CWHeight, + &(XWindowChanges){ + .x = focused->x, + .y = focused->y, + .width = focused->w, + .height = focused->h + } + ); + } } tile(); update_borders(); - /* floating windows are on top */ + /* Raise and refocus floating window */ if (focused->floating) { XRaiseWindow(dpy, focused->win); XSetInputFocus(dpy, focused->win, RevertToPointerRoot, CurrentTime); |
