leaner default space script

This commit is contained in:
Felix Kratz 2021-11-13 15:27:08 +01:00
parent 2d5ba3f2ab
commit fc3db286b7
2 changed files with 3 additions and 11 deletions

View file

@ -263,15 +263,11 @@ where *$SELECTED* has the value *true* if the associated space is selected and *
By default the space component invokes the following script:
```bash
if [ "$SELECTED" = "true" ]; then
sketchybar -m --set $NAME icon.highlight=on
else
sketchybar -m --set $NAME icon.highlight=off
fi
sketchybar -m --set $NAME icon.highlight=$SELECTED
```
which you can freely configure to your liking by supplying a different script to the space component:
```bash
sketchybar -m --set <name> script=<path to script>
sketchybar -m --set <name> script=<script/path>
```
For performance reasons the space script is only run on change.

View file

@ -185,11 +185,7 @@ void bar_item_set_type(struct bar_item* bar_item, char type) {
if (type == BAR_COMPONENT_SPACE) {
if (strlen(bar_item->script) == 0) {
bar_item_set_script(bar_item, string_copy("if [ \"$SELECTED\" = \"true\" ]; then "
"sketchybar -m --set $NAME icon.highlight=on;"
"else "
"sketchybar -m --set $NAME icon.highlight=off;"
" fi"));
bar_item_set_script(bar_item, string_copy("sketchybar -m --set $NAME icon.highlight=$SELECTED"));
}
bar_item->update_mask |= UPDATE_SPACE_CHANGE;