Skip to content
This repository has been archived by the owner on Apr 18, 2023. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mschuwalow authored and orestisfl committed Oct 24, 2020
1 parent 3cd1c45 commit 90e7a15
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions RELEASE-NOTES-next
Expand Up @@ -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 │
Expand Down
9 changes: 8 additions & 1 deletion docs/userguide
Expand Up @@ -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*:
Expand Down
7 changes: 4 additions & 3 deletions i3bar/src/outputs.c
Expand Up @@ -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;
}
Expand Down

0 comments on commit 90e7a15

Please sign in to comment.