Skip to content

Commit ced72d9

Browse files
committed
Add support for relative dials
Same as the ring but uses "dial"
1 parent ffc8d18 commit ced72d9

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

src/gsetwacom/__init__.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,32 @@ def tablet_set_ring_action(ctx, ring: int, mode: int, direction: str, action: st
399399
change_action(path, action, keybinding)
400400

401401

402+
@tablet.command(name="set-dial-action")
403+
@click.option("--dial", type=int, default=1, help="The dial number to change")
404+
@click.option("--mode", type=int, default=0, help="The zero-indexed mode")
405+
@click.option(
406+
"--direction",
407+
type=click.Choice(["cw", "ccw"]),
408+
default="cw",
409+
help="The dial movement direction",
410+
)
411+
@click.argument("action", type=click.Choice(["none", "help", "switch-monitor", "keybinding"]))
412+
@click.argument(
413+
"keybinding",
414+
type=str,
415+
required=False,
416+
)
417+
@click.pass_context
418+
def tablet_set_dial_action(ctx, dial: int, mode: int, direction: str, action: str, keybinding: str | None):
419+
"""
420+
Change the action the tablet dial is mapped to for a movement direction and in a given mode.
421+
"""
422+
r = chr(ord("A") + dial - 1) # dial 1 -> dialA
423+
subpath = f"dial{r}-{direction}-mode-{mode}"
424+
path = f"{ctx.obj.path}{subpath}/"
425+
change_action(path, action, keybinding)
426+
427+
402428
@tablet.command(name="set-strip-action")
403429
@click.option("--strip", type=int, default=1, help="The strip number to change")
404430
@click.option("--mode", type=int, default=0, help="The zero-indexed mode")

0 commit comments

Comments
 (0)