mirror of
https://github.com/FelixKratz/SketchyBar
synced 2024-11-10 13:54:16 +00:00
query defaults
This commit is contained in:
parent
eedd84e98b
commit
a26e228d96
4 changed files with 10 additions and 2 deletions
|
@ -380,6 +380,11 @@ Information about an item can be queried via:
|
|||
sketchybar -m query item <name>
|
||||
```
|
||||
The output is a json structure containing relevant information about the configuration of the item.
|
||||
## Defaults Information
|
||||
Information about the current defaults.
|
||||
```bash
|
||||
sketchybar -m query defaults
|
||||
```
|
||||
## Scripting
|
||||
The bar supports scripts where ever possible to make it as customizable and versatile as possible.
|
||||
When an item invokes a script, the script has access to some environment variables, such as:
|
||||
|
|
|
@ -330,7 +330,6 @@ void bar_item_serialize(struct bar_item* bar_item, FILE* rsp) {
|
|||
bar_item->bounding_rects[i]->size.width,
|
||||
bar_item->bounding_rects[i]->size.height);
|
||||
if (i < bar_item->num_rects - 1) fprintf(rsp, ",\n");
|
||||
else fprintf(rsp, "\n\t}\n}\n");
|
||||
|
||||
}
|
||||
fprintf(rsp, "\n\t}\n}\n");
|
||||
}
|
||||
|
|
|
@ -179,6 +179,7 @@ void bar_manager_init(struct bar_manager* bar_manager) {
|
|||
bar_manager->background.color = rgba_color_from_hex(0x44000000);
|
||||
|
||||
bar_item_init(&bar_manager->default_item, NULL);
|
||||
bar_manager->default_item.name = string_copy("defaults");
|
||||
custom_events_init(&bar_manager->custom_events);
|
||||
|
||||
int shell_refresh_frequency = 1;
|
||||
|
|
|
@ -109,6 +109,7 @@ extern bool g_verbose;
|
|||
#define DOMAIN_QUERY "query"
|
||||
#define COMMAND_QUERY_DEFAULT_ITEMS "default_menu_items"
|
||||
#define COMMAND_QUERY_ITEM "item"
|
||||
#define COMMAND_QUERY_DEFAULTS "defaults"
|
||||
#define COMMAND_QUERY_BAR "bar"
|
||||
|
||||
#define ARGUMENT_COMMON_VAL_ON "on"
|
||||
|
@ -685,6 +686,8 @@ static void handle_domain_query(FILE* rsp, struct token domain, char* message) {
|
|||
bar_item_serialize(g_bar_manager.bar_items[item_index_for_name], rsp);
|
||||
} else if (token_equals(token, COMMAND_QUERY_BAR)) {
|
||||
bar_manager_serialize(&g_bar_manager, rsp);
|
||||
} else if (token_equals(token, COMMAND_QUERY_DEFAULTS)) {
|
||||
bar_item_serialize(&g_bar_manager.default_item, rsp);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue