-
Notifications
You must be signed in to change notification settings - Fork 427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Diversion: Remove tight coupling of all Action and Condition classes #2740
base: master
Are you sure you want to change the base?
Conversation
97b0d0b
to
81a9d84
Compare
c0ed6d4
to
58119ca
Compare
f2b42f2
to
6a99fc6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The return of all rule functions needs to be preserved and I don't think these changes do that. The return is used to determine whether to continue processing or terminate the current rule or all rules.
When I run with this PR only the first rule appears to be evaluated and maybe only the first condition of the first rule.
6a99fc6
to
9774ed9
Compare
Replace tight coupling of Action and Condition classes by removing their common base class and converting it into a function. The RuleComponent was a base class solely holding a compile function and passing it to its children. There is no need for tight coupling with inheritance for that purpose. Related pwr-Solaar#2659
Enforce a common interface for all Action and Condition related classes and connect them to a common protocol class to support isinstance checks. Related pwr-Solaar#2659
9774ed9
to
515f972
Compare
I reverted the logic back to check-then-act, instead of try/raise. I am not aware of any other substantial change. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better, but it looks as if only the first rule is evaluated, even if it doesn't do anything.
Before PR
Depress Host Switch Channel 2
2025-01-02 09:11:00,565,565 DEBUG [SolaarListener:hidraw3] logitech_receiver.base: (15) => r[11 03 0B00 00D20000000000000000000000000000]
2025-01-02 09:11:00,566,566 DEBUG [SolaarListener:hidraw3] logitech_receiver.notifications: <Device(3,4066,Craft Advanced Keyboard,112C46EA)>: notification for feature REPROG CONTROLS V4, report 0, data 00D20000000000000000000000000000
2025-01-02 09:11:00,566,566 DEBUG [SolaarListener:hidraw3] logitech_receiver.notifications: <Device(3,4066,Craft Advanced Keyboard,112C46EA)>: diverted controls pressed: 0xd2, 0x0, 0x0, 0x0
2025-01-02 09:11:00,567,567 DEBUG [MainThread] logitech_receiver.diversion: evaluating rules on Notification(11,3,0B,00,00D20000000000000000000000000000)
2025-01-02 09:11:00,568,568 DEBUG [MainThread] logitech_receiver.diversion: evaluate rule: Rule[Rule(/home/pfps/.config/solaar/rules.yaml)[Rule(/home/pfps/.config/solaar/rules.yaml)[Key: Host Switch Channel 2 (released), Rule[Active: 198E3EB8, Set: 43DAF041 change-host 0, Set: 198E3EB8 change-host 0, Execute: notify-send Switched keyboard and mouse to receiver], Execute: notify-send Mouse not active, Set: 43DAF041 change-host 0, Execute: notify-send Switched keyboard to receiver. Mouse not active it will have to be switched manually], Rule(/home/pfps/.config/solaar/rules.yaml)[Key: Host Switch Channel 3 (released), Set: 43DAF041 change-host 2, Set: 198E3EB8 change-host 2, Execute: notify-send Switched to Bluetooth], Rule(/home/pfps/.config/solaar/rules.yaml)[Key: Lock PC (pressed), Execute: xflock4, Execute: notify-send Lock], Rule(/home/pfps/.config/solaar/rules.yaml)[Key: Show Desktop (pressed), KeyPress: Alt_L F5 click, Execute: notify-send Show Desktop], Rule(/home/pfps/.config/solaar/rules.yaml)[Feature: CROWN, Process: quodlibet, Rule[Test: crown_pressed, Test: crown_right_ratchet, KeyPress: XF86_AudioNext click, Execute: notify-send Next Song], Rule[Test: crown_pressed, Test: crown_left_ratchet, KeyPress: XF86_AudioPrev click, Execute: notify-send Previous Song], Rule[Test: crown_right_ratchet, KeyPress: XF86_AudioRaiseVolume click], Rule[Test: crown_left_ratchet, KeyPress: XF86_AudioLowerVolume click]]], Rule[Rule[Rule[Key: Brightness Down (pressed), KeyPress: XF86_MonBrightnessDown click], Rule[Key: Brightness Up (pressed), KeyPress: XF86_MonBrightnessUp click]]]]
2025-01-02 09:11:00,568,568 DEBUG [MainThread] logitech_receiver.diversion: evaluate rule: Rule(/home/pfps/.config/solaar/rules.yaml)[Rule(/home/pfps/.config/solaar/rules.yaml)[Key: Host Switch Channel 2 (released), Rule[Active: 198E3EB8, Set: 43DAF041 change-host 0, Set: 198E3EB8 change-host 0, Execute: notify-send Switched keyboard and mouse to receiver], Execute: notify-send Mouse not active, Set: 43DAF041 change-host 0, Execute: notify-send Switched keyboard to receiver. Mouse not active it will have to be switched manually], Rule(/home/pfps/.config/solaar/rules.yaml)[Key: Host Switch Channel 3 (released), Set: 43DAF041 change-host 2, Set: 198E3EB8 change-host 2, Execute: notify-send Switched to Bluetooth], Rule(/home/pfps/.config/solaar/rules.yaml)[Key: Lock PC (pressed), Execute: xflock4, Execute: notify-send Lock], Rule(/home/pfps/.config/solaar/rules.yaml)[Key: Show Desktop (pressed), KeyPress: Alt_L F5 click, Execute: notify-send Show Desktop], Rule(/home/pfps/.config/solaar/rules.yaml)[Feature: CROWN, Process: quodlibet, Rule[Test: crown_pressed, Test: crown_right_ratchet, KeyPress: XF86_AudioNext click, Execute: notify-send Next Song], Rule[Test: crown_pressed, Test: crown_left_ratchet, KeyPress: XF86_AudioPrev click, Execute: notify-send Previous Song], Rule[Test: crown_right_ratchet, KeyPress: XF86_AudioRaiseVolume click], Rule[Test: crown_left_ratchet, KeyPress: XF86_AudioLowerVolume click]]]
2025-01-02 09:11:00,569,569 DEBUG [MainThread] logitech_receiver.diversion: evaluate rule: Rule(/home/pfps/.config/solaar/rules.yaml)[Key: Host Switch Channel 2 (released), Rule[Active: 198E3EB8, Set: 43DAF041 change-host 0, Set: 198E3EB8 change-host 0, Execute: notify-send Switched keyboard and mouse to receiver], Execute: notify-send Mouse not active, Set: 43DAF041 change-host 0, Execute: notify-send Switched keyboard to receiver. Mouse not active it will have to be switched manually]
2025-01-02 09:11:00,569,569 DEBUG [MainThread] logitech_receiver.diversion: evaluate condition: Key: Host Switch Channel 2 (released)
2025-01-02 09:11:00,569,569 DEBUG [MainThread] logitech_receiver.diversion: evaluate rule: Rule(/home/pfps/.config/solaar/rules.yaml)[Key: Host Switch Channel 3 (released), Set: 43DAF041 change-host 2, Set: 198E3EB8 change-host 2, Execute: notify-send Switched to Bluetooth]
2025-01-02 09:11:00,570,570 DEBUG [MainThread] logitech_receiver.diversion: evaluate condition: Key: Host Switch Channel 3 (released)
2025-01-02 09:11:00,570,570 DEBUG [MainThread] logitech_receiver.diversion: evaluate rule: Rule(/home/pfps/.config/solaar/rules.yaml)[Key: Lock PC (pressed), Execute: xflock4, Execute: notify-send Lock]
2025-01-02 09:11:00,570,570 DEBUG [MainThread] logitech_receiver.diversion: evaluate condition: Key: Lock PC (pressed)
2025-01-02 09:11:00,570,570 DEBUG [MainThread] logitech_receiver.diversion: evaluate rule: Rule(/home/pfps/.config/solaar/rules.yaml)[Key: Show Desktop (pressed), KeyPress: Alt_L F5 click, Execute: notify-send Show Desktop]
2025-01-02 09:11:00,570,570 DEBUG [MainThread] logitech_receiver.diversion: evaluate condition: Key: Show Desktop (pressed)
2025-01-02 09:11:00,571,571 DEBUG [MainThread] logitech_receiver.diversion: evaluate rule: Rule(/home/pfps/.config/solaar/rules.yaml)[Feature: CROWN, Process: quodlibet, Rule[Test: crown_pressed, Test: crown_right_ratchet, KeyPress: XF86_AudioNext click, Execute: notify-send Next Song], Rule[Test: crown_pressed, Test: crown_left_ratchet, KeyPress: XF86_AudioPrev click, Execute: notify-send Previous Song], Rule[Test: crown_right_ratchet, KeyPress: XF86_AudioRaiseVolume click], Rule[Test: crown_left_ratchet, KeyPress: XF86_AudioLowerVolume click]]
2025-01-02 09:11:00,571,571 DEBUG [MainThread] logitech_receiver.diversion: evaluate condition: Feature: CROWN
2025-01-02 09:11:00,571,571 DEBUG [MainThread] logitech_receiver.diversion: evaluate rule: Rule[Rule[Rule[Key: Brightness Down (pressed), KeyPress: XF86_MonBrightnessDown click], Rule[Key: Brightness Up (pressed), KeyPress: XF86_MonBrightnessUp click]]]
2025-01-02 09:11:00,571,571 DEBUG [MainThread] logitech_receiver.diversion: evaluate rule: Rule[Rule[Key: Brightness Down (pressed), KeyPress: XF86_MonBrightnessDown click], Rule[Key: Brightness Up (pressed), KeyPress: XF86_MonBrightnessUp click]]
2025-01-02 09:11:00,571,571 DEBUG [MainThread] logitech_receiver.diversion: evaluate rule: Rule[Key: Brightness Down (pressed), KeyPress: XF86_MonBrightnessDown click]
2025-01-02 09:11:00,571,571 DEBUG [MainThread] logitech_receiver.diversion: evaluate condition: Key: Brightness Down (pressed)
2025-01-02 09:11:00,571,571 DEBUG [MainThread] logitech_receiver.diversion: evaluate rule: Rule[Key: Brightness Up (pressed), KeyPress: XF86_MonBrightnessUp click]
2025-01-02 09:11:00,571,571 DEBUG [MainThread] logitech_receiver.diversion: evaluate condition: Key: Brightness Up (pressed)
Release Host Switch Channel 2
2025-01-02 09:11:08,089,089 DEBUG [SolaarListener:hidraw3] logitech_receiver.base: (15) => r[11 03 0B00 00000000000000000000000000000000]
2025-01-02 09:11:08,090,090 DEBUG [SolaarListener:hidraw3] logitech_receiver.notifications: <Device(3,4066,Craft Advanced Keyboard,112C46EA)>: notification for feature REPROG CONTROLS V4, report 0, data 00000000000000000000000000000000
2025-01-02 09:11:08,090,090 DEBUG [SolaarListener:hidraw3] logitech_receiver.notifications: <Device(3,4066,Craft Advanced Keyboard,112C46EA)>: diverted controls pressed: 0x0, 0x0, 0x0, 0x0
2025-01-02 09:11:08,091,091 DEBUG [MainThread] logitech_receiver.diversion: evaluating rules on Notification(11,3,0B,00,00000000000000000000000000000000)
2025-01-02 09:11:08,091,091 DEBUG [MainThread] logitech_receiver.diversion: evaluate rule: Rule[Rule(/home/pfps/.config/solaar/rules.yaml)[Rule(/home/pfps/.config/solaar/rules.yaml)[Key: Host Switch Channel 2 (released), Rule[Active: 198E3EB8, Set: 43DAF041 change-host 0, Set: 198E3EB8 change-host 0, Execute: notify-send Switched keyboard and mouse to receiver], Execute: notify-send Mouse not active, Set: 43DAF041 change-host 0, Execute: notify-send Switched keyboard to receiver. Mouse not active it will have to be switched manually], Rule(/home/pfps/.config/solaar/rules.yaml)[Key: Host Switch Channel 3 (released), Set: 43DAF041 change-host 2, Set: 198E3EB8 change-host 2, Execute: notify-send Switched to Bluetooth], Rule(/home/pfps/.config/solaar/rules.yaml)[Key: Lock PC (pressed), Execute: xflock4, Execute: notify-send Lock], Rule(/home/pfps/.config/solaar/rules.yaml)[Key: Show Desktop (pressed), KeyPress: Alt_L F5 click, Execute: notify-send Show Desktop], Rule(/home/pfps/.config/solaar/rules.yaml)[Feature: CROWN, Process: quodlibet, Rule[Test: crown_pressed, Test: crown_right_ratchet, KeyPress: XF86_AudioNext click, Execute: notify-send Next Song], Rule[Test: crown_pressed, Test: crown_left_ratchet, KeyPress: XF86_AudioPrev click, Execute: notify-send Previous Song], Rule[Test: crown_right_ratchet, KeyPress: XF86_AudioRaiseVolume click], Rule[Test: crown_left_ratchet, KeyPress: XF86_AudioLowerVolume click]]], Rule[Rule[Rule[Key: Brightness Down (pressed), KeyPress: XF86_MonBrightnessDown click], Rule[Key: Brightness Up (pressed), KeyPress: XF86_MonBrightnessUp click]]]]
2025-01-02 09:11:08,092,092 DEBUG [MainThread] logitech_receiver.diversion: evaluate rule: Rule(/home/pfps/.config/solaar/rules.yaml)[Rule(/home/pfps/.config/solaar/rules.yaml)[Key: Host Switch Channel 2 (released), Rule[Active: 198E3EB8, Set: 43DAF041 change-host 0, Set: 198E3EB8 change-host 0, Execute: notify-send Switched keyboard and mouse to receiver], Execute: notify-send Mouse not active, Set: 43DAF041 change-host 0, Execute: notify-send Switched keyboard to receiver. Mouse not active it will have to be switched manually], Rule(/home/pfps/.config/solaar/rules.yaml)[Key: Host Switch Channel 3 (released), Set: 43DAF041 change-host 2, Set: 198E3EB8 change-host 2, Execute: notify-send Switched to Bluetooth], Rule(/home/pfps/.config/solaar/rules.yaml)[Key: Lock PC (pressed), Execute: xflock4, Execute: notify-send Lock], Rule(/home/pfps/.config/solaar/rules.yaml)[Key: Show Desktop (pressed), KeyPress: Alt_L F5 click, Execute: notify-send Show Desktop], Rule(/home/pfps/.config/solaar/rules.yaml)[Feature: CROWN, Process: quodlibet, Rule[Test: crown_pressed, Test: crown_right_ratchet, KeyPress: XF86_AudioNext click, Execute: notify-send Next Song], Rule[Test: crown_pressed, Test: crown_left_ratchet, KeyPress: XF86_AudioPrev click, Execute: notify-send Previous Song], Rule[Test: crown_right_ratchet, KeyPress: XF86_AudioRaiseVolume click], Rule[Test: crown_left_ratchet, KeyPress: XF86_AudioLowerVolume click]]]
2025-01-02 09:11:08,092,092 DEBUG [MainThread] logitech_receiver.diversion: evaluate rule: Rule(/home/pfps/.config/solaar/rules.yaml)[Key: Host Switch Channel 2 (released), Rule[Active: 198E3EB8, Set: 43DAF041 change-host 0, Set: 198E3EB8 change-host 0, Execute: notify-send Switched keyboard and mouse to receiver], Execute: notify-send Mouse not active, Set: 43DAF041 change-host 0, Execute: notify-send Switched keyboard to receiver. Mouse not active it will have to be switched manually]
2025-01-02 09:11:08,092,092 DEBUG [MainThread] logitech_receiver.diversion: evaluate condition: Key: Host Switch Channel 2 (released)
2025-01-02 09:11:08,092,092 DEBUG [MainThread] logitech_receiver.diversion: evaluate rule: Rule[Active: 198E3EB8, Set: 43DAF041 change-host 0, Set: 198E3EB8 change-host 0, Execute: notify-send Switched keyboard and mouse to receiver]
2025-01-02 09:11:08,093,093 DEBUG [MainThread] logitech_receiver.diversion: evaluate condition: Active: 198E3EB8
2025-01-02 09:11:08,093,093 DEBUG [MainThread] logitech_receiver.base: (19) pinging device 1
2025-01-02 09:11:08,093,093 DEBUG [MainThread] logitech_receiver.base: (19) <= w[11 01 001A 00006300000000000000000000000000]
2025-01-02 09:11:08,696,696 DEBUG [SolaarListener:hidraw3] logitech_receiver.base: (15) => r[11 01 001A 04056300000000000000000000000000]
2025-01-02 09:11:08,696,696 DEBUG [MainThread] logitech_receiver.base: (19) => r[11 01 001A 04056300000000000000000000000000]
2025-01-02 09:11:08,696,696 INFO [MainThread] logitech_receiver.diversion: Set action: ['43DAF041', 'change-host', 0]
2025-01-02 09:11:08,697,697 DEBUG [MainThread] logitech_receiver.settings: change-host: cached value NamedInt(0, '1:idefix') on <Device(3,4066,Craft Advanced Keyboard,112C46EA)>
2025-01-02 09:11:08,697,697 DEBUG [MainThread] logitech_receiver.settings: change-host: write NamedInt(0, '1:idefix') to <Device(3,4066,Craft Advanced Keyboard,112C46EA)>
2025-01-02 09:11:08,697,697 DEBUG [MainThread] logitech_receiver.settings: change-host: prepare write(1:idefix) => b'\x00'
2025-01-02 09:11:08,698,698 DEBUG [MainThread] logitech_receiver.base: (23) <= w[11 03 081B 00000000000000000000000000000000]
2025-01-02 09:11:08,699,699 INFO [MainThread] logitech_receiver.diversion: Set action: ['198E3EB8', 'change-host', 0]
2025-01-02 09:11:08,700,700 DEBUG [MainThread] logitech_receiver.settings: change-host: cached value NamedInt(0, '1:idefix') on <Device(1,4082,MX Master 3 Wireless Mouse,198E3EB8)>
2025-01-02 09:11:08,700,700 DEBUG [MainThread] logitech_receiver.settings: change-host: write NamedInt(0, '1:idefix') to <Device(1,4082,MX Master 3 Wireless Mouse,198E3EB8)>
2025-01-02 09:11:08,700,700 DEBUG [MainThread] logitech_receiver.settings: change-host: prepare write(1:idefix) => b'\x00'
2025-01-02 09:11:08,700,700 DEBUG [MainThread] logitech_receiver.base: (19) <= w[11 01 0A1C 00000000000000000000000000000000]
2025-01-02 09:11:08,702,702 INFO [MainThread] logitech_receiver.diversion: Execute action: ['notify-send', 'Switched keyboard and mouse to receiver']
2025-01-02 09:11:08,704,704 DEBUG [MainThread] solaar.ui.config_panel: on <Device(3,4066,Craft Advanced Keyboard,112C46EA)> changing setting change-host to [NamedInt(0, '1:idefix')]
2025-01-02 09:11:08,705,705 DEBUG [MainThread] solaar.ui.config_panel: on <Device(3,4066,Craft Advanced Keyboard,112C46EA)> changing setting change-host to [NamedInt(0, '1:idefix')]
2025-01-02 09:11:08,717,717 DEBUG [SolaarListener:hidraw3] logitech_receiver.base: (15) => r[11 03 081B 00000000000000000000000000000000]
2025-01-02 09:11:08,797,797 DEBUG [SolaarListener:hidraw3] logitech_receiver.base: (15) => r[11 01 0A1C 00000000000000000000000000000000]
2025-01-02 09:11:13,715,715 INFO [Thread-1] solaar.configuration: saved ['1.1.14-59-ge9a58fb3', {'_NAME': 'Craft Advanced Keyboard', '_absent': ['hi-res-scroll', 'lowres-scroll-mode', 'hires-smooth-invert', 'hires-smooth-resolution', 'hires-scroll-mode', 'scroll-ratchet', 'smart-shift', 'thumb-scroll-invert', 'thumb-scroll-mode', 'onboard_profiles', 'report_rate', 'report_rate_extended', 'pointer_speed', 'dpi', 'dpi_extended', 'speed-change', 'backlight_level', 'backlight_duration_hands_out', 'backlight_duration_hands_in', 'backlight_duration_powered', 'backlight-timed', 'led_control', 'led_zone_', 'rgb_control', 'rgb_zone_', 'brightness_control', 'per-key-lighting', 'reprogrammable-keys', 'divert-gkeys', 'm-key-leds', 'mr-key-led', 'gesture2-gestures', 'gesture2-divert', 'gesture2-params', 'sidetone', 'equalizer', 'adc_power_management'], '_battery': 4096, '_modelId': 'B35040660000', '_sensitive': {'divert-keys': True, 'hires-scroll-mode': 'ignore', 'hires-smooth-invert': 'ignore', 'hires-smooth-resolution': 'ignore'}, '_serial': '112C46EA', '_unitId': '43DAF041', '_wpid': '4066', 'backlight': 0, 'change-host': None, 'crown-smooth': False, 'disable-keyboard-keys': {1: False, 2: False, 4: False, 8: False, 16: False}, 'divert-crown': False, 'divert-keys': {10: 0, 110: 0, 111: 0, 191: 0, 199: 0, 200: 0, 209: 0, 210: 1, 211: 1, 224: 0, 225: 0, 226: 0, 227: 0, 228: 0, 229: 0, 230: 0, 231: 0, 232: 0, 233: 0, 234: 0, 235: 0, 236: 0}, 'fn-swap': True, 'multiplatform': 0, 'persistent-remappable-keys': None}, {'_NAME': 'MX Master 3 Wireless Mouse', '_absent': ['hi-res-scroll', 'lowres-scroll-mode', 'onboard_profiles', 'report_rate', 'report_rate_extended', 'pointer_speed', 'dpi_extended', 'speed-change', 'backlight', 'backlight_level', 'backlight_duration_hands_out', 'backlight_duration_hands_in', 'backlight_duration_powered', 'backlight-timed', 'led_control', 'led_zone_', 'rgb_control', 'rgb_zone_', 'brightness_control', 'per-key-lighting', 'fn-swap', 'persistent-remappable-keys', 'disable-keyboard-keys', 'crown-smooth', 'divert-crown', 'divert-gkeys', 'm-key-leds', 'mr-key-led', 'multiplatform', 'gesture2-gestures', 'gesture2-divert', 'gesture2-params', 'sidetone', 'equalizer', 'adc_power_management'], '_battery': 4096, '_modelId': 'B02340820000', '_sensitive': {'hires-scroll-mode': 'ignore', 'hires-smooth-invert': 'ignore', 'hires-smooth-resolution': 'ignore'}, '_serial': '198E3EB8', '_unitId': '198E3EB8', '_wpid': '4082', 'change-host': None, 'divert-keys': {82: 0, 83: 0, 86: 0, 195: 0, 196: 0}, 'dpi': 1000, 'hires-scroll-mode': False, 'hires-smooth-invert': False, 'hires-smooth-resolution': True, 'reprogrammable-keys': {80: 80, 81: 81, 82: 82, 83: 83, 86: 86, 195: 195, 196: 196}, 'scroll-ratchet': 2, 'smart-shift': 23, 'thumb-scroll-invert': False, 'thumb-scroll-mode': False}] to /home/pfps/.config/solaar/config.yaml
After PR
Depress Host Switch Channel 2
2025-01-02 09:12:41,812,812 DEBUG [SolaarListener:hidraw3] logitech_receiver.base: (15) => r[11 03 0B00 00D20000000000000000000000000000]
2025-01-02 09:12:41,813,813 DEBUG [SolaarListener:hidraw3] logitech_receiver.notifications: <Device(3,4066,Craft Advanced Keyboard,112C46EA)>: notification for feature REPROG CONTROLS V4, report 0, data 00D20000000000000000000000000000
2025-01-02 09:12:41,813,813 DEBUG [SolaarListener:hidraw3] logitech_receiver.notifications: <Device(3,4066,Craft Advanced Keyboard,112C46EA)>: diverted controls pressed: 0xd2, 0x0, 0x0, 0x0
2025-01-02 09:12:41,814,814 DEBUG [MainThread] logitech_receiver.diversion: evaluating rules on Notification(11,3,0B,00,00D20000000000000000000000000000)
2025-01-02 09:12:41,814,814 DEBUG [MainThread] logitech_receiver.diversion: evaluate rule: Rule[Rule(/home/pfps/.config/solaar/rules.yaml)[Rule(/home/pfps/.config/solaar/rules.yaml)[Key: Host Switch Channel 2 (released), Rule[Active: 198E3EB8, Set: 43DAF041 change-host 0, Set: 198E3EB8 change-host 0, Execute: notify-send Switched keyboard and mouse to receiver], Execute: notify-send Mouse not active, Set: 43DAF041 change-host 0, Execute: notify-send Switched keyboard to receiver. Mouse not active it will have to be switched manually], Rule(/home/pfps/.config/solaar/rules.yaml)[Key: Host Switch Channel 3 (released), Set: 43DAF041 change-host 2, Set: 198E3EB8 change-host 2, Execute: notify-send Switched to Bluetooth], Rule(/home/pfps/.config/solaar/rules.yaml)[Key: Lock PC (pressed), Execute: xflock4, Execute: notify-send Lock], Rule(/home/pfps/.config/solaar/rules.yaml)[Key: Show Desktop (pressed), KeyPress: Alt_L F5 click, Execute: notify-send Show Desktop], Rule(/home/pfps/.config/solaar/rules.yaml)[Feature: CROWN, Process: quodlibet, Rule[Test: crown_pressed, Test: crown_right_ratchet, KeyPress: XF86_AudioNext click, Execute: notify-send Next Song], Rule[Test: crown_pressed, Test: crown_left_ratchet, KeyPress: XF86_AudioPrev click, Execute: notify-send Previous Song], Rule[Test: crown_right_ratchet, KeyPress: XF86_AudioRaiseVolume click], Rule[Test: crown_left_ratchet, KeyPress: XF86_AudioLowerVolume click]]], Rule[Rule[Rule[Key: Brightness Down (pressed), KeyPress: XF86_MonBrightnessDown click], Rule[Key: Brightness Up (pressed), KeyPress: XF86_MonBrightnessUp click]]]]
2025-01-02 09:12:41,815,815 DEBUG [MainThread] logitech_receiver.diversion: evaluate rule: Rule(/home/pfps/.config/solaar/rules.yaml)[Rule(/home/pfps/.config/solaar/rules.yaml)[Key: Host Switch Channel 2 (released), Rule[Active: 198E3EB8, Set: 43DAF041 change-host 0, Set: 198E3EB8 change-host 0, Execute: notify-send Switched keyboard and mouse to receiver], Execute: notify-send Mouse not active, Set: 43DAF041 change-host 0, Execute: notify-send Switched keyboard to receiver. Mouse not active it will have to be switched manually], Rule(/home/pfps/.config/solaar/rules.yaml)[Key: Host Switch Channel 3 (released), Set: 43DAF041 change-host 2, Set: 198E3EB8 change-host 2, Execute: notify-send Switched to Bluetooth], Rule(/home/pfps/.config/solaar/rules.yaml)[Key: Lock PC (pressed), Execute: xflock4, Execute: notify-send Lock], Rule(/home/pfps/.config/solaar/rules.yaml)[Key: Show Desktop (pressed), KeyPress: Alt_L F5 click, Execute: notify-send Show Desktop], Rule(/home/pfps/.config/solaar/rules.yaml)[Feature: CROWN, Process: quodlibet, Rule[Test: crown_pressed, Test: crown_right_ratchet, KeyPress: XF86_AudioNext click, Execute: notify-send Next Song], Rule[Test: crown_pressed, Test: crown_left_ratchet, KeyPress: XF86_AudioPrev click, Execute: notify-send Previous Song], Rule[Test: crown_right_ratchet, KeyPress: XF86_AudioRaiseVolume click], Rule[Test: crown_left_ratchet, KeyPress: XF86_AudioLowerVolume click]]]
2025-01-02 09:12:41,815,815 DEBUG [MainThread] logitech_receiver.diversion: evaluate rule: Rule(/home/pfps/.config/solaar/rules.yaml)[Key: Host Switch Channel 2 (released), Rule[Active: 198E3EB8, Set: 43DAF041 change-host 0, Set: 198E3EB8 change-host 0, Execute: notify-send Switched keyboard and mouse to receiver], Execute: notify-send Mouse not active, Set: 43DAF041 change-host 0, Execute: notify-send Switched keyboard to receiver. Mouse not active it will have to be switched manually]
2025-01-02 09:12:41,815,815 DEBUG [MainThread] logitech_receiver.diversion: evaluate condition: Key: Host Switch Channel 2 (released)
Release diverted key
2025-01-02 09:12:44,254,254 DEBUG [SolaarListener:hidraw3] logitech_receiver.base: (15) => r[11 03 0B00 00000000000000000000000000000000]
2025-01-02 09:12:44,255,255 DEBUG [SolaarListener:hidraw3] logitech_receiver.notifications: <Device(3,4066,Craft Advanced Keyboard,112C46EA)>: notification for feature REPROG CONTROLS V4, report 0, data 00000000000000000000000000000000
2025-01-02 09:12:44,255,255 DEBUG [SolaarListener:hidraw3] logitech_receiver.notifications: <Device(3,4066,Craft Advanced Keyboard,112C46EA)>: diverted controls pressed: 0x0, 0x0, 0x0, 0x0
2025-01-02 09:12:44,256,256 DEBUG [MainThread] logitech_receiver.diversion: evaluating rules on Notification(11,3,0B,00,00000000000000000000000000000000)
2025-01-02 09:12:44,256,256 DEBUG [MainThread] logitech_receiver.diversion: evaluate rule: Rule[Rule(/home/pfps/.config/solaar/rules.yaml)[Rule(/home/pfps/.config/solaar/rules.yaml)[Key: Host Switch Channel 2 (released), Rule[Active: 198E3EB8, Set: 43DAF041 change-host 0, Set: 198E3EB8 change-host 0, Execute: notify-send Switched keyboard and mouse to receiver], Execute: notify-send Mouse not active, Set: 43DAF041 change-host 0, Execute: notify-send Switched keyboard to receiver. Mouse not active it will have to be switched manually], Rule(/home/pfps/.config/solaar/rules.yaml)[Key: Host Switch Channel 3 (released), Set: 43DAF041 change-host 2, Set: 198E3EB8 change-host 2, Execute: notify-send Switched to Bluetooth], Rule(/home/pfps/.config/solaar/rules.yaml)[Key: Lock PC (pressed), Execute: xflock4, Execute: notify-send Lock], Rule(/home/pfps/.config/solaar/rules.yaml)[Key: Show Desktop (pressed), KeyPress: Alt_L F5 click, Execute: notify-send Show Desktop], Rule(/home/pfps/.config/solaar/rules.yaml)[Feature: CROWN, Process: quodlibet, Rule[Test: crown_pressed, Test: crown_right_ratchet, KeyPress: XF86_AudioNext click, Execute: notify-send Next Song], Rule[Test: crown_pressed, Test: crown_left_ratchet, KeyPress: XF86_AudioPrev click, Execute: notify-send Previous Song], Rule[Test: crown_right_ratchet, KeyPress: XF86_AudioRaiseVolume click], Rule[Test: crown_left_ratchet, KeyPress: XF86_AudioLowerVolume click]]], Rule[Rule[Rule[Key: Brightness Down (pressed), KeyPress: XF86_MonBrightnessDown click], Rule[Key: Brightness Up (pressed), KeyPress: XF86_MonBrightnessUp click]]]]
2025-01-02 09:12:44,256,256 DEBUG [MainThread] logitech_receiver.diversion: evaluate rule: Rule(/home/pfps/.config/solaar/rules.yaml)[Rule(/home/pfps/.config/solaar/rules.yaml)[Key: Host Switch Channel 2 (released), Rule[Active: 198E3EB8, Set: 43DAF041 change-host 0, Set: 198E3EB8 change-host 0, Execute: notify-send Switched keyboard and mouse to receiver], Execute: notify-send Mouse not active, Set: 43DAF041 change-host 0, Execute: notify-send Switched keyboard to receiver. Mouse not active it will have to be switched manually], Rule(/home/pfps/.config/solaar/rules.yaml)[Key: Host Switch Channel 3 (released), Set: 43DAF041 change-host 2, Set: 198E3EB8 change-host 2, Execute: notify-send Switched to Bluetooth], Rule(/home/pfps/.config/solaar/rules.yaml)[Key: Lock PC (pressed), Execute: xflock4, Execute: notify-send Lock], Rule(/home/pfps/.config/solaar/rules.yaml)[Key: Show Desktop (pressed), KeyPress: Alt_L F5 click, Execute: notify-send Show Desktop], Rule(/home/pfps/.config/solaar/rules.yaml)[Feature: CROWN, Process: quodlibet, Rule[Test: crown_pressed, Test: crown_right_ratchet, KeyPress: XF86_AudioNext click, Execute: notify-send Next Song], Rule[Test: crown_pressed, Test: crown_left_ratchet, KeyPress: XF86_AudioPrev click, Execute: notify-send Previous Song], Rule[Test: crown_right_ratchet, KeyPress: XF86_AudioRaiseVolume click], Rule[Test: crown_left_ratchet, KeyPress: XF86_AudioLowerVolume click]]]
2025-01-02 09:12:44,257,257 DEBUG [MainThread] logitech_receiver.diversion: evaluate rule: Rule(/home/pfps/.config/solaar/rules.yaml)[Key: Host Switch Channel 2 (released), Rule[Active: 198E3EB8, Set: 43DAF041 change-host 0, Set: 198E3EB8 change-host 0, Execute: notify-send Switched keyboard and mouse to receiver], Execute: notify-send Mouse not active, Set: 43DAF041 change-host 0, Execute: notify-send Switched keyboard to receiver. Mouse not active it will have to be switched manually]
2025-01-02 09:12:44,257,257 DEBUG [MainThread] logitech_receiver.diversion: evaluate condition: Key: Host Switch Channel 2 (released)
2025-01-02 09:12:44,257,257 DEBUG [MainThread] logitech_receiver.diversion: evaluate rule: Rule[Active: 198E3EB8, Set: 43DAF041 change-host 0, Set: 198E3EB8 change-host 0, Execute: notify-send Switched keyboard and mouse to receiver]
2025-01-02 09:12:44,257,257 DEBUG [MainThread] logitech_receiver.diversion: evaluate condition: Active: 198E3EB8
2025-01-02 09:12:44,257,257 DEBUG [MainThread] logitech_receiver.base: (19) pinging device 1
2025-01-02 09:12:44,259,259 DEBUG [MainThread] logitech_receiver.base: (19) <= w[11 01 0015 00008800000000000000000000000000]
2025-01-02 09:12:44,488,488 DEBUG [MainThread] logitech_receiver.base: (19) => r[11 01 0015 04058800000000000000000000000000]
2025-01-02 09:12:44,489,489 DEBUG [SolaarListener:hidraw3] logitech_receiver.base: (15) => r[11 01 0015 04058800000000000000000000000000]
2025-01-02 09:12:44,489,489 INFO [MainThread] logitech_receiver.diversion: Set action: ['43DAF041', 'change-host', 0]
2025-01-02 09:12:44,489,489 DEBUG [MainThread] logitech_receiver.settings: change-host: cached value NamedInt(0, '1:idefix') on <Device(3,4066,Craft Advanced Keyboard,112C46EA)>
2025-01-02 09:12:44,489,489 DEBUG [MainThread] logitech_receiver.settings: change-host: write NamedInt(0, '1:idefix') to <Device(3,4066,Craft Advanced Keyboard,112C46EA)>
2025-01-02 09:12:44,489,489 DEBUG [MainThread] logitech_receiver.settings: change-host: prepare write(1:idefix) => b'\x00'
2025-01-02 09:12:44,490,490 DEBUG [MainThread] logitech_receiver.base: (23) <= w[11 03 0816 00000000000000000000000000000000]
2025-01-02 09:12:44,491,491 DEBUG [MainThread] solaar.ui.config_panel: on <Device(3,4066,Craft Advanced Keyboard,112C46EA)> changing setting change-host to [NamedInt(0, '1:idefix')]
2025-01-02 09:12:44,512,512 DEBUG [SolaarListener:hidraw3] logitech_receiver.base: (15) => r[11 03 0816 00000000000000000000000000000000]
2025-01-02 09:12:49,511,511 INFO [Thread-2] solaar.configuration: saved ['1.1.14-62-g515f9726', {'_NAME': 'Craft Advanced Keyboard', '_modelId': 'B35040660000', '_sensitive': {'divert-keys': True, 'hires-scroll-mode': 'ignore', 'hires-smooth-invert': 'ignore', 'hires-smooth-resolution': 'ignore'}, '_serial': '112C46EA', '_unitId': '43DAF041', '_wpid': '4066', 'backlight': 0, 'change-host': None, 'crown-smooth': False, 'disable-keyboard-keys': {1: False, 2: False, 4: False, 8: False, 16: False}, 'divert-crown': False, 'divert-keys': {10: 0, 110: 0, 111: 0, 191: 0, 199: 0, 200: 0, 209: 0, 210: 1, 211: 1, 224: 0, 225: 0, 226: 0, 227: 0, 228: 0, 229: 0, 230: 0, 231: 0, 232: 0, 233: 0, 234: 0, 235: 0, 236: 0}, 'fn-swap': True, 'multiplatform': 0, 'persistent-remappable-keys': None, '_absent': ['hi-res-scroll', 'lowres-scroll-mode', 'hires-smooth-invert', 'hires-smooth-resolution', 'hires-scroll-mode', 'scroll-ratchet', 'smart-shift', 'thumb-scroll-invert', 'thumb-scroll-mode', 'onboard_profiles', 'report_rate', 'report_rate_extended', 'pointer_speed', 'dpi', 'dpi_extended', 'speed-change', 'backlight_level', 'backlight_duration_hands_out', 'backlight_duration_hands_in', 'backlight_duration_powered', 'backlight-timed', 'led_control', 'led_zone_', 'rgb_control', 'rgb_zone_', 'brightness_control', 'per-key-lighting', 'reprogrammable-keys', 'divert-gkeys', 'm-key-leds', 'mr-key-led', 'gesture2-gestures', 'gesture2-divert', 'gesture2-params', 'sidetone', 'equalizer', 'adc_power_management'], '_battery': 4096}, {'_NAME': 'MX Master 3 Wireless Mouse', '_modelId': 'B02340820000', '_sensitive': {'hires-scroll-mode': 'ignore', 'hires-smooth-invert': 'ignore', 'hires-smooth-resolution': 'ignore'}, '_serial': '198E3EB8', '_unitId': '198E3EB8', '_wpid': '4082', 'change-host': None, 'divert-keys': {82: 0, 83: 0, 86: 0, 195: 0, 196: 0}, 'dpi': 1000, 'hires-scroll-mode': False, 'hires-smooth-invert': False, 'hires-smooth-resolution': True, 'reprogrammable-keys': {80: 80, 81: 81, 82: 82, 83: 83, 86: 86, 195: 195, 196: 196}, 'scroll-ratchet': 2, 'smart-shift': 23, 'thumb-scroll-invert': False, 'thumb-scroll-mode': False, '_absent': ['hi-res-scroll', 'lowres-scroll-mode', 'onboard_profiles', 'report_rate', 'report_rate_extended', 'pointer_speed', 'dpi_extended', 'speed-change', 'backlight', 'backlight_level', 'backlight_duration_hands_out', 'backlight_duration_hands_in', 'backlight_duration_powered', 'backlight-timed', 'led_control', 'led_zone_', 'rgb_control', 'rgb_zone_', 'brightness_control', 'per-key-lighting', 'fn-swap', 'persistent-remappable-keys', 'disable-keyboard-keys', 'crown-smooth', 'divert-crown', 'divert-gkeys', 'm-key-leds', 'mr-key-led', 'multiplatform', 'gesture2-gestures', 'gesture2-divert', 'gesture2-params', 'sidetone', 'equalizer', 'adc_power_management'], '_battery': 4096}] to /home/pfps/.config/solaar/config.yaml
Rules file
%YAML 1.3
---
- Key: [Host Switch Channel 2, released]
- Rule:
- Active: 198E3EB8
- Set: [43DAF041, change-host, 0]
- Set: [198E3EB8, change-host, 0]
- Execute: [notify-send, Switched keyboard and mouse to receiver]
- Execute: [notify-send, Mouse not active]
- Set: [43DAF041, change-host, 0]
- Execute: [notify-send, Switched keyboard to receiver. Mouse not active, it will
have to be switched manually]
...
---
- Key: [Host Switch Channel 3, released]
- Set: [43DAF041, change-host, 2]
- Set: [198E3EB8, change-host, 2]
- Execute: [notify-send, Switched to Bluetooth]
...
---
- Key: [Lock PC, pressed]
- Execute: xflock4
- Execute: [notify-send, Lock]
...
---
- Key: [Show Desktop, pressed]
- KeyPress:
- [Alt_L, F5]
- click
- Execute: [notify-send, Show Desktop]
...
---
- Feature: CROWN
- Process: quodlibet
- Rule:
- Test: crown_pressed
- Test: crown_right_ratchet
- KeyPress:
- XF86_AudioNext
- click
- Execute: [notify-send, Next Song]
- Rule:
- Test: crown_pressed
- Test: crown_left_ratchet
- KeyPress:
- XF86_AudioPrev
- click
- Execute: [notify-send, Previous Song]
- Rule:
- Test: crown_right_ratchet
- KeyPress:
- XF86_AudioRaiseVolume
- click
- Rule:
- Test: crown_left_ratchet
- KeyPress:
- XF86_AudioLowerVolume
- click
...
Get rid of RuleComponent and its inheritance tree.