mirror of
https://github.com/FelixKratz/SketchyBar
synced 2024-11-23 03:43:02 +00:00
optional modifiers for item cloning
This commit is contained in:
parent
50d4da59da
commit
73f8f533ba
2 changed files with 8 additions and 2 deletions
|
@ -437,9 +437,10 @@ sketchybar -m --move <name> after <reference name>
|
|||
Currently only on HEAD.
|
||||
It is possible to clone another item instead of adding a completely blank item
|
||||
```bash
|
||||
sketchybar -m --clone <name> <parent name>
|
||||
sketchybar -m --clone <name> <parent name> [optional: before/after]
|
||||
```
|
||||
the new item will inherit *all* properties of the parent item.
|
||||
the new item will inherit *all* properties of the parent item. The optional *before* and *after* modifiers can be used
|
||||
to move the item *before*, or *after* the parent, equivalently to a --move command.
|
||||
## Renaming Items
|
||||
Currently only on HEAD.
|
||||
It is possible to rename any item. The new name should obviously not be in use by another item:
|
||||
|
|
|
@ -75,6 +75,7 @@ static void handle_domain_rename(FILE* rsp, struct token domain, char* message)
|
|||
static void handle_domain_clone(FILE* rsp, struct token domain, char* message) {
|
||||
struct token name = get_token(&message);
|
||||
struct token parent = get_token(&message);
|
||||
struct token modifier = get_token(&message);
|
||||
struct bar_item* parent_item = NULL;
|
||||
|
||||
int parent_index = bar_manager_get_item_index_for_name(&g_bar_manager, parent.text);
|
||||
|
@ -92,6 +93,10 @@ static void handle_domain_clone(FILE* rsp, struct token domain, char* message) {
|
|||
struct bar_item* bar_item = bar_manager_create_item(&g_bar_manager);
|
||||
bar_item_inherit_from_item(bar_item, parent_item);
|
||||
bar_item_set_name(bar_item, token_to_string(name));
|
||||
if (token_equals(modifier, ARGUMENT_COMMON_VAL_BEFORE))
|
||||
bar_manager_move_item(&g_bar_manager, bar_item, parent_item, true);
|
||||
else if (token_equals(modifier, ARGUMENT_COMMON_VAL_AFTER))
|
||||
bar_manager_move_item(&g_bar_manager, bar_item, parent_item, false);
|
||||
bar_item_needs_update(bar_item);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue