forked from external/yambar
modules/dwl: handle the appid status
dwl added an "appid" field as output status [1]. We currently don't
handle this field, and thus output warnings that say "UNKNOWN action".
Handle the "appid" field correctly and expose a value of this field to
users. Also, suppress the warnings.
Link: 7f9a212476
[1]
This commit is contained in:
parent
daeb59e021
commit
963b9d47ee
3 changed files with 19 additions and 3 deletions
|
@ -17,9 +17,11 @@
|
||||||
* river: support for ‘layout’ events.
|
* river: support for ‘layout’ events.
|
||||||
* dwl: support for specifying name of tags ([#256][256])
|
* dwl: support for specifying name of tags ([#256][256])
|
||||||
* i3/sway: extend option `sort`; use `native` to sort numbered workspaces only.
|
* i3/sway: extend option `sort`; use `native` to sort numbered workspaces only.
|
||||||
|
* modules/dwl: handle the appid status ([#284][284])
|
||||||
|
|
||||||
[246]: https://codeberg.org/dnkl/yambar/issues/246
|
[246]: https://codeberg.org/dnkl/yambar/issues/246
|
||||||
[256]: https://codeberg.org/dnkl/yambar/pulls/256
|
[256]: https://codeberg.org/dnkl/yambar/pulls/256
|
||||||
|
[284]: https://codeberg.org/dnkl/yambar/pulls/284
|
||||||
|
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
|
@ -8,7 +8,7 @@ dwl - This module provides information about dwl tags, and information.
|
||||||
This module provides a map of each tags present in dwl.
|
This module provides a map of each tags present in dwl.
|
||||||
|
|
||||||
Each tags has its _id_, its _name_, its status (_selected_, _empty_, _urgent_)
|
Each tags has its _id_, its _name_, its status (_selected_, _empty_, _urgent_)
|
||||||
and the global data like _title_, _fullscreen_, _floating_,
|
and the global data like _title_, _appid_, _fullscreen_, _floating_,
|
||||||
_selmon_, and _layout_). The tags start a 1. For needs where
|
_selmon_, and _layout_). The tags start a 1. For needs where
|
||||||
you only want information about the global data and not the _tags_,
|
you only want information about the global data and not the _tags_,
|
||||||
there is a tag with the id _0_ that contains only the global data.
|
there is a tag with the id _0_ that contains only the global data.
|
||||||
|
@ -44,6 +44,9 @@ Running multiple instances at the same time may result in
|
||||||
| title
|
| title
|
||||||
: string
|
: string
|
||||||
: The currently focused window's title.
|
: The currently focused window's title.
|
||||||
|
| appid
|
||||||
|
: string
|
||||||
|
: The currently focused window's application id.
|
||||||
| fullscreen
|
| fullscreen
|
||||||
: bool
|
: bool
|
||||||
: True if there is a fullscreen window in the current tag.
|
: True if there is a fullscreen window in the current tag.
|
||||||
|
|
|
@ -35,6 +35,7 @@ struct private
|
||||||
|
|
||||||
/* dwl data */
|
/* dwl data */
|
||||||
char *title;
|
char *title;
|
||||||
|
char *appid;
|
||||||
bool fullscreen;
|
bool fullscreen;
|
||||||
bool floating;
|
bool floating;
|
||||||
bool selmon;
|
bool selmon;
|
||||||
|
@ -45,6 +46,7 @@ struct private
|
||||||
enum LINE_MODE {
|
enum LINE_MODE {
|
||||||
LINE_MODE_0,
|
LINE_MODE_0,
|
||||||
LINE_MODE_TITLE,
|
LINE_MODE_TITLE,
|
||||||
|
LINE_MODE_APPID,
|
||||||
LINE_MODE_FULLSCREEN,
|
LINE_MODE_FULLSCREEN,
|
||||||
LINE_MODE_FLOATING,
|
LINE_MODE_FLOATING,
|
||||||
LINE_MODE_SELMON,
|
LINE_MODE_SELMON,
|
||||||
|
@ -94,6 +96,7 @@ content(struct module *module)
|
||||||
struct tag_set tags = {
|
struct tag_set tags = {
|
||||||
.tags = (struct tag*[]){
|
.tags = (struct tag*[]){
|
||||||
tag_new_string(module, "title", private->title),
|
tag_new_string(module, "title", private->title),
|
||||||
|
tag_new_string(module, "appid", private->appid),
|
||||||
tag_new_bool(module, "fullscreen", private->fullscreen),
|
tag_new_bool(module, "fullscreen", private->fullscreen),
|
||||||
tag_new_bool(module, "floating", private->floating),
|
tag_new_bool(module, "floating", private->floating),
|
||||||
tag_new_bool(module, "selmon", private->selmon),
|
tag_new_bool(module, "selmon", private->selmon),
|
||||||
|
@ -104,7 +107,7 @@ content(struct module *module)
|
||||||
tag_new_bool(module, "empty", it->item->empty),
|
tag_new_bool(module, "empty", it->item->empty),
|
||||||
tag_new_bool(module, "urgent", it->item->urgent),
|
tag_new_bool(module, "urgent", it->item->urgent),
|
||||||
},
|
},
|
||||||
.count = 10,
|
.count = 11,
|
||||||
};
|
};
|
||||||
exposable[i++] = private->label->instantiate(private->label, &tags);
|
exposable[i++] = private->label->instantiate(private->label, &tags);
|
||||||
tag_set_destroy(&tags);
|
tag_set_destroy(&tags);
|
||||||
|
@ -114,6 +117,7 @@ content(struct module *module)
|
||||||
struct tag_set tags = {
|
struct tag_set tags = {
|
||||||
.tags = (struct tag*[]){
|
.tags = (struct tag*[]){
|
||||||
tag_new_string(module, "title", private->title),
|
tag_new_string(module, "title", private->title),
|
||||||
|
tag_new_string(module, "appid", private->appid),
|
||||||
tag_new_bool(module, "fullscreen", private->fullscreen),
|
tag_new_bool(module, "fullscreen", private->fullscreen),
|
||||||
tag_new_bool(module, "floating", private->floating),
|
tag_new_bool(module, "floating", private->floating),
|
||||||
tag_new_bool(module, "selmon", private->selmon),
|
tag_new_bool(module, "selmon", private->selmon),
|
||||||
|
@ -124,7 +128,7 @@ content(struct module *module)
|
||||||
tag_new_bool(module, "empty", true),
|
tag_new_bool(module, "empty", true),
|
||||||
tag_new_bool(module, "urgent", false),
|
tag_new_bool(module, "urgent", false),
|
||||||
},
|
},
|
||||||
.count = 10,
|
.count = 11,
|
||||||
};
|
};
|
||||||
exposable[i++] = private->label->instantiate(private->label, &tags);
|
exposable[i++] = private->label->instantiate(private->label, &tags);
|
||||||
tag_set_destroy(&tags);
|
tag_set_destroy(&tags);
|
||||||
|
@ -183,6 +187,12 @@ process_line(char *line, struct module *module)
|
||||||
free(private->title);
|
free(private->title);
|
||||||
private->title = strdup(save_pointer);
|
private->title = strdup(save_pointer);
|
||||||
break;
|
break;
|
||||||
|
} else if (strcmp(string, "appid") == 0) {
|
||||||
|
line_mode = LINE_MODE_APPID;
|
||||||
|
/* Update the appid here, same as the title. */
|
||||||
|
free(private->appid);
|
||||||
|
private->appid = strdup(save_pointer);
|
||||||
|
break;
|
||||||
} else if (strcmp(string, "fullscreen") == 0)
|
} else if (strcmp(string, "fullscreen") == 0)
|
||||||
line_mode = LINE_MODE_FULLSCREEN;
|
line_mode = LINE_MODE_FULLSCREEN;
|
||||||
else if (strcmp(string, "floating") == 0)
|
else if (strcmp(string, "floating") == 0)
|
||||||
|
@ -235,6 +245,7 @@ process_line(char *line, struct module *module)
|
||||||
} else
|
} else
|
||||||
switch (line_mode) {
|
switch (line_mode) {
|
||||||
case LINE_MODE_TITLE:
|
case LINE_MODE_TITLE:
|
||||||
|
case LINE_MODE_APPID:
|
||||||
assert(false); /* unreachable */
|
assert(false); /* unreachable */
|
||||||
break;
|
break;
|
||||||
case LINE_MODE_FULLSCREEN:
|
case LINE_MODE_FULLSCREEN:
|
||||||
|
|
Loading…
Add table
Reference in a new issue