Compare commits

..

3 Commits

Author SHA1 Message Date
5192368ba8 add 0.11.0 section to changelog 2025-05-22 09:43:54 +01:00
a84754d5ec add hotkey sub typer
minor bump
2025-05-22 09:43:42 +01:00
48fab684a3 add hotkey section 2025-05-22 09:42:51 +01:00
5 changed files with 88 additions and 2 deletions

View File

@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
# [0.11.0] - 2025-05-22
### Added
- hotkey commands, see [Hotkey](https://github.com/onyx-and-iris/obsws-cli?tab=readme-ov-file#hotkey)
# [0.10.0] - 2025-04-27 # [0.10.0] - 2025-04-27
### Added ### Added

View File

@ -452,10 +452,45 @@ obsws-cli virtualcam toggle
obsws-cli virtualcam status obsws-cli virtualcam status
``` ```
#### Hotkey
- list: List all hotkeys.
```console
obsws-cli hotkey list
```
- trigger: Trigger a hotkey by name.
```console
obsws-cli hotkey trigger OBSBasic.StartStreaming
obsws-cli hotkey trigger OBSBasic.StopStreaming
```
- trigger-sequence: Trigger a hotkey by sequence.
- flags:
*optional*
- --shift: Press shift.
- --ctrl: Press control.
- --alt: Press alt.
- --cmd: Press command (mac).
- args: <key_id>
- Check [obs-hotkeys.h][obs-keyids] for a full list of OBS key ids.
```console
obsws-cli hotkey trigger-sequence OBS_KEY_F1 --ctrl
obsws-cli hotkey trigger-sequence OBS_KEY_F1 --shift --ctrl
```
## License ## License
`obsws-cli` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license. `obsws-cli` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.
[obs-studio]: https://obsproject.com/ [obs-studio]: https://obsproject.com/
[obs-keyids]: https://github.com/obsproject/obs-studio/blob/master/libobs/obs-hotkeys.h

View File

@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2025-present onyx-and-iris <code@onyxandiris.online> # SPDX-FileCopyrightText: 2025-present onyx-and-iris <code@onyxandiris.online>
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
__version__ = "0.10.5" __version__ = "0.11.0"

View File

@ -7,6 +7,7 @@ import typer
from . import ( from . import (
group, group,
hotkey,
input, input,
profile, profile,
record, record,
@ -24,6 +25,7 @@ from .alias import AliasGroup
app = typer.Typer(cls=AliasGroup) app = typer.Typer(cls=AliasGroup)
for module in ( for module in (
group, group,
hotkey,
input, input,
profile, profile,
record, record,

43
obsws_cli/hotkey.py Normal file
View File

@ -0,0 +1,43 @@
"""module containing commands for hotkey management."""
import typer
from .alias import AliasGroup
app = typer.Typer(cls=AliasGroup)
@app.callback()
def main():
"""Control hotkeys in OBS."""
@app.command('list | ls')
def list(
ctx: typer.Context,
):
"""List all hotkeys."""
resp = ctx.obj.get_hotkey_list()
typer.echo('\n'.join(resp.hotkeys))
@app.command('trigger | tr')
def trigger(
ctx: typer.Context,
hotkey: str = typer.Argument(..., help='The hotkey to trigger'),
):
"""Trigger a hotkey by name."""
ctx.obj.trigger_hotkey_by_name(hotkey)
@app.command('trigger-sequence | trs')
def trigger_sequence(
ctx: typer.Context,
shift: bool = typer.Option(False, help='Press shift when triggering the hotkey'),
ctrl: bool = typer.Option(False, help='Press control when triggering the hotkey'),
alt: bool = typer.Option(False, help='Press alt when triggering the hotkey'),
cmd: bool = typer.Option(False, help='Press cmd when triggering the hotkey'),
key_id: str = typer.Argument(..., help='The hotkey to trigger'),
):
"""Trigger a hotkey by sequence."""
ctx.obj.trigger_hotkey_by_key_sequence(key_id, shift, ctrl, alt, cmd)