i3bar: accept 'primary' for output config option

This commit is contained in:
lebenlechzer 2017-03-12 21:17:12 +01:00
parent 8c3ddce5a2
commit 2f0f8b16c2
3 changed files with 26 additions and 7 deletions

View File

@ -1378,7 +1378,7 @@ directive multiple times.
*Syntax*: *Syntax*:
--------------- ---------------
output <output> output primary|<output>
--------------- ---------------
*Example*: *Example*:
@ -1400,7 +1400,19 @@ bar {
statusline #ffffff statusline #ffffff
} }
} }
# show bar on the primary monitor and on HDMI2
bar {
output primary
output HDMI2
status_command i3status
}
------------------------------- -------------------------------
Note that you might not have a primary output configured yet. To do so, run:
-------------------------
xrandr --output <output> --primary
-------------------------
=== Tray output === Tray output

View File

@ -63,12 +63,18 @@ void got_subscribe_reply(char *reply) {
* *
*/ */
void got_output_reply(char *reply) { void got_output_reply(char *reply) {
DLOG("Clearing old output configuration...\n");
i3_output *o_walk;
SLIST_FOREACH(o_walk, outputs, slist) {
destroy_window(o_walk);
}
FREE_SLIST(outputs, i3_output);
DLOG("Parsing outputs JSON...\n"); DLOG("Parsing outputs JSON...\n");
parse_outputs_json(reply); parse_outputs_json(reply);
DLOG("Reconfiguring windows...\n"); DLOG("Reconfiguring windows...\n");
reconfig_windows(false); reconfig_windows(false);
i3_output *o_walk;
SLIST_FOREACH(o_walk, outputs, slist) { SLIST_FOREACH(o_walk, outputs, slist) {
kick_tray_clients(o_walk); kick_tray_clients(o_walk);
} }

View File

@ -189,12 +189,13 @@ static int outputs_end_map_cb(void *params_) {
if (config.num_outputs > 0) { if (config.num_outputs > 0) {
bool handle_output = false; bool handle_output = false;
for (int c = 0; c < config.num_outputs; c++) { for (int c = 0; c < config.num_outputs; c++) {
if (strcasecmp(params->outputs_walk->name, config.outputs[c]) != 0) if (strcasecmp(params->outputs_walk->name, config.outputs[c]) == 0 ||
continue; (strcasecmp(config.outputs[c], "primary") == 0 &&
params->outputs_walk->primary)) {
handle_output = true; handle_output = true;
break; break;
} }
}
if (!handle_output) { if (!handle_output) {
DLOG("Ignoring output \"%s\", not configured to handle it.\n", DLOG("Ignoring output \"%s\", not configured to handle it.\n",
params->outputs_walk->name); params->outputs_walk->name);