diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-06-08 20:25:54 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-06-08 20:25:54 +1000 |
| commit | c214b3c5d6cf48ed719e9c13a4f5bda4dc7ad107 (patch) | |
| tree | dd8078ebde032078ccab26f02350c0d7ae50bfb3 /services/Players.qml | |
| parent | colours: fix switching (diff) | |
| download | caelestia-shell-c214b3c5d6cf48ed719e9c13a4f5bda4dc7ad107.tar.gz caelestia-shell-c214b3c5d6cf48ed719e9c13a4f5bda4dc7ad107.tar.bz2 caelestia-shell-c214b3c5d6cf48ed719e9c13a4f5bda4dc7ad107.zip | |
feat: add ipc commands for stuff
Diffstat (limited to 'services/Players.qml')
| -rw-r--r-- | services/Players.qml | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/services/Players.qml b/services/Players.qml index cbaf550..e9a3de4 100644 --- a/services/Players.qml +++ b/services/Players.qml @@ -55,5 +55,43 @@ Singleton { const active = root.active; return active ? active[prop] ?? "Invalid property" : "No active player"; } + + function list(): string { + return root.list.map(p => p.identity).join("\n"); + } + + function play(): void { + const active = root.active; + if (active?.canPlay) + active.play(); + } + + function pause(): void { + const active = root.active; + if (active?.canPause) + active.pause(); + } + + function playPause(): void { + const active = root.active; + if (active?.canTogglePlaying) + active.togglePlaying(); + } + + function previous(): void { + const active = root.active; + if (active?.canGoPrevious) + active.previous(); + } + + function next(): void { + const active = root.active; + if (active?.canGoNext) + active.next(); + } + + function stop(): void { + root.active?.stop(); + } } } |