mirror of
https://github.com/labwc/labwc.git
synced 2026-03-21 05:33:52 -04:00
osd: support full app_id in window switcher (#1309)
Support showing full application identifier or the trimmed variant in window switcher OSD. Regression notice: For anyone using ‘identifier’ in window-switcher field configuration, change it to ‘trimmed_identifier’.
This commit is contained in:
parent
ccd4ab943e
commit
d2d469133f
5 changed files with 24 additions and 2 deletions
|
|
@ -163,6 +163,9 @@ this is for compatibility with Openbox.
|
||||||
- *identifier* Show identifier (app_id for native Wayland
|
- *identifier* Show identifier (app_id for native Wayland
|
||||||
windows and WM_CLASS for XWayland clients)
|
windows and WM_CLASS for XWayland clients)
|
||||||
|
|
||||||
|
- *trimmed_identifier* Show trimmed identifier. Trimming removes the first
|
||||||
|
two nodes of 'org.' strings.
|
||||||
|
|
||||||
- *title* Show window title if different to app_id
|
- *title* Show window title if different to app_id
|
||||||
|
|
||||||
*width* defines the width of the field expressed as a percentage of
|
*width* defines the width of the field expressed as a percentage of
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,8 @@
|
||||||
<windowSwitcher show="yes" preview="yes" outlines="yes">
|
<windowSwitcher show="yes" preview="yes" outlines="yes">
|
||||||
<fields>
|
<fields>
|
||||||
<field content="type" width="25%" />
|
<field content="type" width="25%" />
|
||||||
<field content="identifier" width="25%" />
|
<field content="trimmed_identifier" width="25%" />
|
||||||
|
<!-- <field content="identifier" width="25%" /> -->
|
||||||
<field content="title" width="50%" />
|
<field content="title" width="50%" />
|
||||||
</fields>
|
</fields>
|
||||||
</windowSwitcher>
|
</windowSwitcher>
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ enum window_switcher_field_content {
|
||||||
LAB_FIELD_NONE = 0,
|
LAB_FIELD_NONE = 0,
|
||||||
LAB_FIELD_TYPE,
|
LAB_FIELD_TYPE,
|
||||||
LAB_FIELD_IDENTIFIER,
|
LAB_FIELD_IDENTIFIER,
|
||||||
|
LAB_FIELD_TRIMMED_IDENTIFIER,
|
||||||
LAB_FIELD_TITLE,
|
LAB_FIELD_TITLE,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -198,6 +198,8 @@ fill_window_switcher_field(char *nodename, char *content)
|
||||||
} else if (!strcmp(content, "app_id")) {
|
} else if (!strcmp(content, "app_id")) {
|
||||||
wlr_log(WLR_ERROR, "window-switcher field 'app_id' is deprecated");
|
wlr_log(WLR_ERROR, "window-switcher field 'app_id' is deprecated");
|
||||||
current_field->content = LAB_FIELD_IDENTIFIER;
|
current_field->content = LAB_FIELD_IDENTIFIER;
|
||||||
|
} else if (!strcmp(content, "trimmed_identifier")) {
|
||||||
|
current_field->content = LAB_FIELD_TRIMMED_IDENTIFIER;
|
||||||
} else if (!strcmp(content, "title")) {
|
} else if (!strcmp(content, "title")) {
|
||||||
current_field->content = LAB_FIELD_TITLE;
|
current_field->content = LAB_FIELD_TITLE;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1228,7 +1230,7 @@ static struct {
|
||||||
int width;
|
int width;
|
||||||
} fields[] = {
|
} fields[] = {
|
||||||
{ LAB_FIELD_TYPE, 25 },
|
{ LAB_FIELD_TYPE, 25 },
|
||||||
{ LAB_FIELD_IDENTIFIER, 25 },
|
{ LAB_FIELD_TRIMMED_IDENTIFIER, 25 },
|
||||||
{ LAB_FIELD_TITLE, 50 },
|
{ LAB_FIELD_TITLE, 50 },
|
||||||
{ LAB_FIELD_NONE, 0 },
|
{ LAB_FIELD_NONE, 0 },
|
||||||
};
|
};
|
||||||
|
|
|
||||||
15
src/osd.c
15
src/osd.c
|
|
@ -41,6 +41,15 @@ static const char *
|
||||||
get_formatted_app_id(struct view *view)
|
get_formatted_app_id(struct view *view)
|
||||||
{
|
{
|
||||||
char *s = (char *)view_get_string_prop(view, "app_id");
|
char *s = (char *)view_get_string_prop(view, "app_id");
|
||||||
|
if (!s) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
get_trimmed_app_id(char *s)
|
||||||
|
{
|
||||||
if (!s) {
|
if (!s) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -355,6 +364,12 @@ render_osd(struct server *server, cairo_t *cairo, int w, int h,
|
||||||
case LAB_FIELD_IDENTIFIER:
|
case LAB_FIELD_IDENTIFIER:
|
||||||
buf_add(&buf, get_app_id(*view));
|
buf_add(&buf, get_app_id(*view));
|
||||||
break;
|
break;
|
||||||
|
case LAB_FIELD_TRIMMED_IDENTIFIER:
|
||||||
|
{
|
||||||
|
char *s = (char *)get_app_id(*view);
|
||||||
|
buf_add(&buf, get_trimmed_app_id(s));
|
||||||
|
break;
|
||||||
|
}
|
||||||
case LAB_FIELD_TITLE:
|
case LAB_FIELD_TITLE:
|
||||||
buf_add(&buf, get_title(*view));
|
buf_add(&buf, get_title(*view));
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue