users/ryan/modules/simple-bar/simple-bar-source/lib/skhd.js
63e15655ee66d63088bc907072616b988fee4351
· 593 B · 17 lines
raw
| 1 | import * as Uebersicht from "uebersicht"; |
| 2 | import * as Settings from "./settings"; |
| 3 | import * as Utils from "./utils"; |
| 4 | |
| 5 | /** |
| 6 | * Retrieves the current mode by executing a shell script and parsing its output. |
| 7 | * |
| 8 | * @returns {Promise<Object> | undefined} A promise that resolves to the parsed JSON object representing the mode. |
| 9 | */ |
| 10 | export async function getMode() { |
| 11 | const settings = Settings.get(); |
| 12 | const { shell } = settings.global; |
| 13 | const mode = await Uebersicht.run( |
| 14 | `cat $(${shell} ./simple-bar/lib/scripts/yabai-set-mode-server.sh --query 2>&1)`, |
| 15 | ); |
| 16 | return Utils.parseJson(mode); |
| 17 | } |