summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Schuwalow <maxim.schuwalow@gmail.com>2020-10-22 19:37:09 +0200
committerOrestis Floros <orestisflo@gmail.com>2020-10-24 11:44:34 +0200
commit90e7a156a2606f574c001b4e83fee97402bf6bd5 (patch)
tree44adfda487157868949505e6067912d6b2fc9400
parent3cd1c45eba6de073bc4300eebb4e1cc1a0c4479a (diff)
downloadi3-90e7a156a2606f574c001b4e83fee97402bf6bd5.tar.gz
i3-90e7a156a2606f574c001b4e83fee97402bf6bd5.zip
i3bar: add support for nonprimary output
Added a new output option `nonprimary` that causes the bar to be displayed on all outputs except the primary one. Fixes #4083
-rw-r--r--RELEASE-NOTES-next1
-rw-r--r--docs/userguide9
-rw-r--r--i3bar/src/outputs.c7
3 files changed, 13 insertions, 4 deletions
diff --git a/RELEASE-NOTES-next b/RELEASE-NOTES-next
index c99e27d7..f8b6c65c 100644
--- a/RELEASE-NOTES-next
+++ b/RELEASE-NOTES-next
@@ -29,6 +29,7 @@ working. Please reach out to us in that case!
• i3-input: add different exit codes for when i3-input fails
• allow ppt values in move direction and move position commands
• i3bar: add coordinates relative to the current output in i3bar click events
+ • i3bar: add “nonprimary” output option
┌────────────────────────────┐
│ Bugfixes │
diff --git a/docs/userguide b/docs/userguide
index 5f98206e..5773e96b 100644
--- a/docs/userguide
+++ b/docs/userguide
@@ -1484,9 +1484,16 @@ options for different outputs by using multiple 'bar' blocks.
To make a particular i3bar instance handle multiple outputs, specify the output
directive multiple times.
+These output names have a special meaning:
+
+primary::
+ Selects the output that is configured as primary in the X server.
+nonprimary::
+ Selects every output that is not configured as primary in the X server.
+
*Syntax*:
---------------
-output primary|<output>
+output primary|nonprimary|<output>
---------------
*Example*:
diff --git a/i3bar/src/outputs.c b/i3bar/src/outputs.c
index 46b9c954..168f3eef 100644
--- a/i3bar/src/outputs.c
+++ b/i3bar/src/outputs.c
@@ -192,11 +192,12 @@ static int outputs_end_map_cb(void *params_) {
/* See if we actually handle that output */
if (config.num_outputs > 0) {
+ const bool is_primary = params->outputs_walk->primary;
bool handle_output = false;
for (int c = 0; c < config.num_outputs; c++) {
- if (strcasecmp(params->outputs_walk->name, config.outputs[c]) == 0 ||
- (strcasecmp(config.outputs[c], "primary") == 0 &&
- params->outputs_walk->primary)) {
+ if ((strcasecmp(params->outputs_walk->name, config.outputs[c]) == 0) ||
+ (strcasecmp(config.outputs[c], "primary") == 0 && is_primary) ||
+ (strcasecmp(config.outputs[c], "nonprimary") == 0 && !is_primary)) {
handle_output = true;
break;
}