Commit graph

1443 commits

Author SHA1 Message Date
Emanuele Torre
7313b01fcc Don't store the split direction's csq as a string 2020-07-31 09:56:18 +02:00
Bastien Dejean
7d5f0a6acc Revert "Escape shell chars in the erc arguments"
This reverts commit 7a7b17ba28.
2020-07-31 09:45:59 +02:00
Bastien Dejean
7a7b17ba28 Escape shell characters in the erc arguments
Since `eval "$4"` is frequently used within the external rules command,
we want to avoid the possibility of unwanted code execution.

Fixes #1162.
Closes #1161.
2020-07-30 10:38:45 +02:00
Bastien Dejean
9ef79d76d4 Remove redundant tests 2020-07-28 18:28:44 +02:00
Bastien Dejean
d87e6c0f77 Generalize a few node descriptors
- `next` and `prev` might now return any node in the context of a
  depth-first in-order tree traversal.
- `biggest`, `smallest` and `pointed` now return leaves instead of
  windows. In particular, `pointed` can now be used to get the id of a
  pointed receptacle.

Fixes #1113.
2020-07-28 11:14:28 +02:00
Bastien Dejean
a54ab707cf Pass a *run level* argument to bspwmrc
Fixes #1158.
2020-07-27 18:36:08 +02:00
SeerLite
8f41d7989f Make the example bspwmrcs restart friendly 2020-07-27 11:36:41 +02:00
Bastien Dejean
d4804cd741 Catch descriptor-free incompatibilities in queries 2020-07-26 21:37:18 +02:00
Bastien Dejean
be4177b88d Honor all the descriptor-free constraints
Fixes #1094.
2020-07-26 21:19:37 +02:00
Bastien Dejean
c6d4e6e570 Revert "Transfer sticky nodes in move_client"
This is unnecessary since we're transferring to the active desktop of
the destination monitor.

So #1098 should in fact be fixed by 5df311b12c.
2020-07-26 20:42:21 +02:00
Bastien Dejean
6d6ac15217 Honor hidden nodes in set_{floating,fullscreen}
Fixes #1110.
2020-07-26 20:28:03 +02:00
Bastien Dejean
feeafe8ccb Reset some of the reference fields in query -{M,D}
Fixes #1111.
2020-07-26 19:28:43 +02:00
Bastien Dejean
c366c2c39a Transfer sticky nodes in move_client
Fixes #1098.
2020-07-26 18:18:31 +02:00
Bastien Dejean
5df311b12c Update the monitor's sticky count on unlink/insert 2020-07-26 17:57:20 +02:00
Bastien Dejean
c59491c19e Don't try to find the ancestors of NULL
Fixes #1089.
2020-07-26 15:34:37 +02:00
Emanuele Torre
dc303be2cc Escape single asterisks 2020-07-26 14:47:49 +02:00
Emanuele Torre
6c39ab0823 Port BSPWM to gcc10
GCC10 enables -fno-common by default.
This patch allows building BSPWM with -fno-common enabled.

Fixes #1119.
2020-07-26 14:36:52 +02:00
Emanuele Torre
eca4fbeb76 Move get_color_pixel() from helpers.h to bspwm.h 2020-07-26 14:36:52 +02:00
Emanuele Torre
8e0de51414 Fix a few typos 2020-07-26 14:20:17 +02:00
Jason Nader
440ab2b3b4 Amend typo in manpage 2020-07-26 14:10:47 +02:00
Justinien Bouron
3db5a66f19 Remove dead subscribers early
Fix bug in which "dead" subscribers would not be removed right away and would
consume resources *and* file descriptors which could lead to the bspwm process
running out of available file descriptors and not being able to accept new
incoming connections.

When a process subscribes to bspwm events (i.e. `bspc subscribe <event>`), bspwm
keeps some state about this subscriber such as the file descriptor in which to
write the events and which events are requested by the subscriber.

When a subscriber dies (i.e. the `bspc subscribe ...` process is killed) bspwm
does not know it right away. Instead, on the next event being logged, if bspwm
encounters an error when trying to write() into the file descriptor associated
to a subscriber bspwm will consider this subscriber dead and remove it from the
linked list (which will also close() the file descriptor of the subscriber).
This is done in the put_status() function defined in subscribe.c.

This means that bspwm keeps file descriptors on potentially closed streams for
some time.
Normally this is ok, because events are generated often (when focusing nodes,
switching desktop, etc ...), therefore those "dead" file descriptors are not
kept around for too long.
However, during a period of inactivity (i.e. the user is not actively using the
computer or never switching nodes or desktops) those file descriptors can be
kept for a long time.
This is especially problematic in the following scenario:
    1. User leaves the machine idle.
    2. A "churn" of subscribers happens, where subscribers come and go.
    3. Since the machine is idle, no events are happening and the file
       descriptor of all dead subscribers are not closed.
    4. bspwm consumes more and more file descriptors as new subscribers are
       created.
    5. At some point bspwm has too many opened file descriptors and cannot
       accepts new incoming connections. The accept() syscall in the mainloop
       fails (returning EMFILE) and bspwm is stuck in an infinite loop, not
       being able to serve new request. At this point bspwm needs to be killed
       and restarted.

While this could be deemed as unlikely (the maximum number of opened files being
1024 AFAIK (Arch Linux)), it turns out that this exact scenario can happen with
polybar (https://github.com/polybar/polybar) and the bspwm module. When a
laptop connected to an external monitor becomes idle, and the screen saver kicks
in, polybar periodically reloads itself (because of xrandr events) and therefore
periodically kill and re-create a subscriber. Since there is no activity on the
bspwm process, all dead instances of the polybar subscriber are not removed and
bspwm eventually runs out of file descriptors and gets stuck in the infinite
loop while consuming 100% cpu.
(Note: This is not a polybar issue, polybar does the right thing here).

The fix is as follows: In the main loop of bspwm, check for any dead subscribers
and remove them (if any). This is accomplished by a new function declared in
subscribe.h: prune_dead_subscribers().
prune_dead_subscribers() will iterate through the linked list of subscribers and
for each of them will try to call write() on their file descriptor with an empty
buffer (i.e. size == 0). If the write() fails (returns -1) then the subscriber
is declared dead and this function can remove it from the list and close the
associated file descriptor.
2020-07-26 12:37:26 +02:00
Matt Vollrath
a658f4ffae Fix inconsistent WM_CLASS field truncation
Fixes #1117
2020-07-26 12:26:19 +02:00
Matt Vollrath
6db8831e30 Add WM_NAME rule matching 2020-07-26 12:20:16 +02:00
Matt Vollrath
273e5097b1 Fix parsing hidden field
hidden was always set true if present, use the parsed value instead.
2020-05-15 00:54:43 -04:00
tobias
cf2d40772e Add node modifiers: horizontal, vertical 2020-03-16 12:19:24 +01:00
tobias
331902cc05 Add node descriptor: first_ancestor 2020-03-16 12:14:29 +01:00
Bastien Dejean
46ac471e42 Add an example that uses intermediate consequences 2020-02-03 18:41:25 +01:00
Danny Colin
d3a7768356 Add community information 2020-02-02 18:28:53 +01:00
Bastien Dejean
df7c6cc781 Pass --tags to git describe
Fixes #1003.
2019-08-26 17:07:49 +02:00
Bastien Dejean
f0558346b2 Fix GCC warnings 2019-08-19 16:08:08 +02:00
Bastien Dejean
89d3cd8a0e bspc: Write failure messages to standard error
Fixes #999.
2019-08-19 09:42:27 +02:00
Bastien Dejean
2ffd9c1409 Version 0.9.9 2019-08-13 17:27:55 +02:00
Bastien Dejean
c1759b5d86 Allocate the right amount of arguments on restart
Fixes #995.
2019-08-12 13:45:50 +02:00
Bastien Dejean
e36a68f3a8 Honor single_monocle in set_hidden
Fixes #990.
2019-08-02 12:21:49 +02:00
Bastien Dejean
8fa2185672 Version 0.9.8 2019-07-27 14:58:05 +02:00
Tobias Stoeckmann
baa6a55847 Enforce strict mode of jsmn.
If no strict mode of jsmn is enforced, then the correct amount of
json elements would have to be checked to avoid segmentation faults
on malformed state files:

$ echo '{ "focusedMonitorId" }' > malformed-state
$ bspwm -s malformed-state
Segmentation fault
$ _

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2019-07-12 20:40:39 +02:00
Bastien Dejean
5c39084ad3 Fix infinite loop in find_closest_node
If `ref->node == NULL` and `ref->desktop->root != NULL` (the reference
desktop contains hidden nodes or/and receptacles), then the ending
condition `n != ref->node` will never be true.

Fixes #977.
2019-06-06 11:25:32 +02:00
Bastien Dejean
5ac163b0dd Apply removal adjustments for the spiral a. i. s.
Fixes #966.
2019-05-12 10:27:00 +02:00
Xaver Hellauer
0b033642e2 Added *marked* flag to report documentation 2019-04-29 10:01:38 +02:00
Bastien Dejean
342c2e3c31 Rely on the user layout to skip the presel fb
Fixes #954.
2019-04-18 17:58:48 +02:00
Bastien Dejean
4e7c34694b Fix inconsistencies regarding the user layout
Fixes #939.
2019-03-05 09:45:31 +01:00
Bastien Dejean
16063bf09b Version 0.9.7 2019-02-24 09:22:29 +01:00
Bastien Dejean
4330265178 Honor single_monocle in make_desktop
Fixes #929.
2019-02-19 15:33:36 +01:00
Bastien Dejean
8cac00488c Mention a way to emulate paddingless_monocle 2019-02-15 15:34:36 +01:00
Bastien Dejean
dc3d468958 Version 0.9.6 2019-02-13 11:20:41 +01:00
Bastien Dejean
b7b5c98daa Alternate auto scheme: Try to find a *full* split
Fixes #923.
2019-02-11 17:30:14 +01:00
Cosmo Borsky
21a025b1e7 Add .editorconfig 2019-02-01 17:45:23 +01:00
Bastien Dejean
00cf7896a4 Handle single_monocle more carefully
Closes #919.
Fixes #730.
2019-02-01 13:45:09 +01:00
Cosmo Borsky
644b9e591a Add default value for ignore_ewmh_struts 2019-01-30 17:32:56 +01:00
Sam Bazley
2e4abbcadc Add wm command: --restart
Closes #904.
2019-01-30 11:18:51 +01:00