Added option to select primary display on tray_output
This commit is contained in:
parent
206b96202c
commit
9a58c1fcaa
|
@ -964,7 +964,7 @@ you can turn off the functionality entirely.
|
||||||
|
|
||||||
*Syntax*:
|
*Syntax*:
|
||||||
-------------------------
|
-------------------------
|
||||||
tray_output <none|output>
|
tray_output <none|primary|output>
|
||||||
-------------------------
|
-------------------------
|
||||||
|
|
||||||
*Example*:
|
*Example*:
|
||||||
|
@ -974,12 +974,20 @@ bar {
|
||||||
tray_output none
|
tray_output none
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# show tray icons on the primary monitor
|
||||||
|
tray_output primary
|
||||||
|
|
||||||
# show tray icons on the big monitor
|
# show tray icons on the big monitor
|
||||||
bar {
|
bar {
|
||||||
tray_output HDMI2
|
tray_output HDMI2
|
||||||
}
|
}
|
||||||
-------------------------
|
-------------------------
|
||||||
|
|
||||||
|
Note that you might not have a primary output configured yet. To do so, run:
|
||||||
|
-------------------------
|
||||||
|
xrandr --output <output> --primary
|
||||||
|
-------------------------
|
||||||
|
|
||||||
=== Font
|
=== Font
|
||||||
|
|
||||||
Specifies the font (again, X core font, not Xft, just like in i3) to be used in
|
Specifies the font (again, X core font, not Xft, just like in i3) to be used in
|
||||||
|
|
|
@ -40,6 +40,7 @@ i3_output* get_output_by_name(char* name);
|
||||||
struct i3_output {
|
struct i3_output {
|
||||||
char* name; /* Name of the output */
|
char* name; /* Name of the output */
|
||||||
bool active; /* If the output is active */
|
bool active; /* If the output is active */
|
||||||
|
bool primary; /* If it is the primary output */
|
||||||
int ws; /* The number of the currently visible ws */
|
int ws; /* The number of the currently visible ws */
|
||||||
rect rect; /* The rect (relative to the root-win) */
|
rect rect; /* The rect (relative to the root-win) */
|
||||||
|
|
||||||
|
|
|
@ -45,15 +45,19 @@ static int outputs_null_cb(void *params_) {
|
||||||
static int outputs_boolean_cb(void *params_, int val) {
|
static int outputs_boolean_cb(void *params_, int val) {
|
||||||
struct outputs_json_params *params = (struct outputs_json_params*) params_;
|
struct outputs_json_params *params = (struct outputs_json_params*) params_;
|
||||||
|
|
||||||
if (strcmp(params->cur_key, "active")) {
|
if (!strcmp(params->cur_key, "active")) {
|
||||||
return 0;
|
params->outputs_walk->active = val;
|
||||||
|
FREE(params->cur_key);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
params->outputs_walk->active = val;
|
if (!strcmp(params->cur_key, "primary")) {
|
||||||
|
params->outputs_walk->primary = val;
|
||||||
FREE(params->cur_key);
|
FREE(params->cur_key);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -450,9 +450,12 @@ static void handle_client_message(xcb_client_message_event_t* event) {
|
||||||
SLIST_FOREACH(walk, outputs, slist) {
|
SLIST_FOREACH(walk, outputs, slist) {
|
||||||
if (!walk->active)
|
if (!walk->active)
|
||||||
continue;
|
continue;
|
||||||
if (config.tray_output &&
|
if (config.tray_output) {
|
||||||
strcasecmp(walk->name, config.tray_output) != 0)
|
if ((strcasecmp(walk->name, config.tray_output) != 0) &&
|
||||||
|
(!walk->primary || strcasecmp("primary", config.tray_output) != 0))
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
DLOG("using output %s\n", walk->name);
|
DLOG("using output %s\n", walk->name);
|
||||||
output = walk;
|
output = walk;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue