From 259cb021db412471baf1478a6aa619ed0545d997 Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Sun, 13 Aug 2023 10:46:51 +0200 Subject: Update the macros --- src/macros/1-ff.py | 2 +- src/macros/4-move_mouse.py | 1 + src/macros/qqsp.py | 103 +++++++++++++++++++++++++++++++++++++++++++++ src/macros/teams.py | 13 +++++- src/macros/windows.py | 36 ++++++++++++++++ src/macros/zim.py | 1 - 6 files changed, 152 insertions(+), 4 deletions(-) create mode 100644 src/macros/qqsp.py create mode 100644 src/macros/windows.py (limited to 'src') diff --git a/src/macros/1-ff.py b/src/macros/1-ff.py index f1d26ce..09ed7f6 100644 --- a/src/macros/1-ff.py +++ b/src/macros/1-ff.py @@ -77,7 +77,7 @@ def build_application(): configuration.registerKey(5, ">", key([Keycode.CONTROL, Keycode.PAGE_DOWN]), 0x050505) configuration.registerKey(12, "", app.rot_cw, None) configuration.registerKey(13, "", app.rot_ccw,None) - configuration.registerGroup(app.group) + #configuration.registerGroup(app.group) return configuration configuration = build_application() diff --git a/src/macros/4-move_mouse.py b/src/macros/4-move_mouse.py index ef6ede0..85979ea 100644 --- a/src/macros/4-move_mouse.py +++ b/src/macros/4-move_mouse.py @@ -48,6 +48,7 @@ def build_application(): actor = NoIdle() configuration.setTick(5000, actor.update) configuration.registerKey(4, "switch", actor.pause, actor.color) + configuration.is_layout = False return configuration configuration = build_application() diff --git a/src/macros/qqsp.py b/src/macros/qqsp.py new file mode 100644 index 0000000..6ff0487 --- /dev/null +++ b/src/macros/qqsp.py @@ -0,0 +1,103 @@ +# SPDX-FileCopyrightText: 2021 Phillip Burgess for Adafruit Industries +# +# SPDX-License-Identifier: MIT + +# MACROPAD Hotkeys example: Mouse control + +# The syntax for Mouse macros is highly peculiar, in order to maintain +# backward compatibility with the original keycode-only macro files. +# The third item for each macro is a list in brackets, and each value within +# is normally an integer (Keycode), float (delay) or string (typed literally). +# Consumer Control codes were added as list-within-list, and then mouse +# further complicates this by adding dicts-within-list. Each mouse-related +# dict can have any mix of keys 'buttons' w/integer mask of button values +# (positive to press, negative to release), 'x' w/horizontal motion, +# 'y' w/vertical and 'wheel' with scrollwheel motion. + +# To reference Mouse constants, import Mouse like so... +from keycode_win_frnb import Keycode # Use the french bepo layout +import colorsys + +import skeleton +from actions import Action + + +class Color(object): + """ Represent the color of a key in the HSV model. + + The class implements the int() function in order to being compatible with + the remaining of the application. + """ + def __init__(self, h, s, v): + self.col = (h, s, v) + + def __int__(self): + r, g, b = colorsys.hsv_to_rgb(self.col[0], self.col[1], self.col[2]) + return (r<<16) + (g<<8) + b + +def build_application(): + configuration = skeleton.Configuration("qqsp") + configuration.visible = False + configuration.registerKey( + 0, + "7", + lambda macropad, key, pressed: Action().key(pressed, [Keycode.KEYPAD_SEVEN]), + Color(0.333, 1.0, 0.0196)) + configuration.registerKey( + 1, + "8", + lambda macropad, key, pressed: Action().key(pressed, [Keycode.KEYPAD_EIGHT]), + Color(0.266, 1.0, 0.0196)) + configuration.registerKey( + 2, + "9", + lambda macropad, key, pressed: Action().key(pressed, [Keycode.KEYPAD_NINE]), + Color(0.166, 1.0, 0.0196)) + configuration.registerKey( + 3, + "4", + lambda macropad, key, pressed: Action().key(pressed, [Keycode.KEYPAD_FOUR]), + Color(0.4, 1.0, 0.0196)) + configuration.registerKey( + 4, + "5", + lambda macropad, key, pressed: Action().key(pressed, [Keycode.KEYPAD_FIVE]), + Color(0.333, 0.6, 0.0196)) + configuration.registerKey( + 5, + "6", + lambda macropad, key, pressed: Action().key(pressed, [Keycode.KEYPAD_SIX]), + Color(0.16, 0.6, 0.0196)) + configuration.registerKey( + 6, + "1", + lambda macropad, key, pressed: Action().key(pressed, [Keycode.KEYPAD_ONE]), + # 0x000505 + Color(0.5, 1.0, 0.0196)) + configuration.registerKey( + 7, + "2", + lambda macropad, key, pressed: Action().key(pressed, [Keycode.KEYPAD_TWO]), + Color(0.5, 0.6, 0.0196)) + configuration.registerKey( + 8, + "3", + lambda macropad, key, pressed: Action().key(pressed, [Keycode.KEYPAD_THREE]), + # 0x050505 + Color(0.01, 0.01, 0.0196)) + configuration.registerKey( + 9, + "0", + lambda macropad, key, pressed: Action().key(pressed, [Keycode.KEYPAD_ZERO]), + # 0x000507 + Color(0.54, 1.0, 0.027)) + + # The dot key. + configuration.registerKey( + 11, + "^O", + lambda macropad, key, pressed: Action().key(pressed, [Keycode.CONTROL, Keycode.O]), + 0x050507) + return configuration + +configuration = build_application() diff --git a/src/macros/teams.py b/src/macros/teams.py index 621f8b6..374fc82 100644 --- a/src/macros/teams.py +++ b/src/macros/teams.py @@ -29,16 +29,25 @@ def planning(macropad, key, pressed): def link(macropad, key, pressed): Action().key(pressed, [Keycode.CONTROL, Keycode.K]) +def mic(macropad, key, pressed): + Action().key(pressed, [Keycode.SHIFT, Keycode.CONTROL, Keycode.M]) + +def camera(macropad, key, pressed): + Action().key(pressed, [Keycode.SHIFT, Keycode.CONTROL, Keycode.O]) + def build_application(): configuration = skeleton.Configuration("Teams") configuration.visible = False configuration.registerKey(0, "Convers.", conv, 0x050000) configuration.registerKey(3, "Planning", planning, 0x050200) - configuration.registerKey(2, "Link", link, 0x020002) + configuration.registerKey(6, "Micro.", mic, 0x000202) + configuration.registerKey(9, "camera", camera, 0x020200) + + configuration.registerKey(2, "Link", link, 0x020002) + return configuration configuration = build_application() - diff --git a/src/macros/windows.py b/src/macros/windows.py new file mode 100644 index 0000000..6e9896d --- /dev/null +++ b/src/macros/windows.py @@ -0,0 +1,36 @@ +from keycode_win_frnb import Keycode # Use the french bepo layout + +import skeleton +from actions import Action + +def tab(macropad, key, pressed): + Action().key(pressed, [Keycode.RIGHT_ALT, Keycode.TAB]) + +def win_l(macropad, key, pressed): + Action().key(pressed, [Keycode.CONTROL, Keycode.WINDOWS, Keycode.LEFT_ARROW]) + +def win_r(macropad, key, pressed): + Action().key(pressed, [Keycode.CONTROL, Keycode.WINDOWS, Keycode.RIGHT_ARROW]) + +def close(macropad, key, pressed): + Action().key(pressed, [Keycode.ALT, Keycode.F4]) + +def rot_cw(macropad, key, pressed): + Action().key(pressed, [Keycode.RIGHT_ARROW]) + +def rot_ccw(macropad, key, pressed): + Action().key(pressed, [Keycode.LEFT_ARROW]) + +def build_application(): + configuration = skeleton.Configuration("Windows") + configuration.hidden = True + + configuration.registerKey(2, "x", close, 0x050000) + configuration.registerKey(7, "^<", win_l, 0x000000) + configuration.registerKey(8, "^>", win_r, 0x000000) + configuration.registerKey(11, "^TAB", tab, 0x000000) + configuration.registerKey(12, "", rot_cw, None) + configuration.registerKey(13, "", rot_ccw, None) + return configuration + +configuration = build_application() diff --git a/src/macros/zim.py b/src/macros/zim.py index fa93c4a..6377858 100644 --- a/src/macros/zim.py +++ b/src/macros/zim.py @@ -50,4 +50,3 @@ def build_application(): return configuration configuration = build_application() - -- cgit v1.2.3