Open hamadahiro opened 7 months ago
One option would be to use sketchybar --query
and jq
to find if the value of the setting and decide what to do from there. For example:
# in a script file somewhere (I keep mine in ~/.config/skhd/scripts)
# -- topmost.sh -- #
#!/usr/bin/env bash
# queries sketchybar's bar element and returns a JSON object with properties
# jq filters for the "topmost" property in the object and returns true if the value of topmost is "on"
if $(sketchybar --query bar | jq '.topmost == "on"'); then
# if topmost is on, turn off
sketchybar --bar topmost=off
else
# vice versa
sketchybar --bar topmost=on
fi
Then in skhdrc:
fn - m : ~/.config/skhd/scripts/topmost.sh
I have set up a shortcut in skhdrc to toggle the
topmost
of sketchybar using two different key combinations:Is it possible to toggle the
topmost
with just one combination? Iftopmost
is "on", turn it "off", and vice versa?