Replies: 1 comment
-
|
Use the existing import threading
import time
import os
from src.backend.PluginManager.ActionBase import ActionBase
from src.backend.PluginManager.EventAssigner import EventAssigner
from src.backend.DeckManagement.InputIdentifier import Input
class VolumeRepeatAction(ActionBase):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.repeating = False
self.repeat_thread = None
def on_ready(self):
# Register hold events
self.add_event_assigner(EventAssigner(
id="volume_hold_start",
ui_label="Volume Hold Start",
default_events=[Input.Key.Events.HOLD_START],
callback=self.start_repeat
))
self.add_event_assigner(EventAssigner(
id="volume_hold_stop",
ui_label="Volume Hold Stop",
default_events=[Input.Key.Events.HOLD_STOP],
callback=self.stop_repeat
))
def start_repeat(self, data):
self.repeating = True
self.repeat_thread = threading.Thread(target=self._repeat_volume)
self.repeat_thread.daemon = True
self.repeat_thread.start()
def _repeat_volume(self):
while self.repeating:
# For volume up - change to -5% for volume down
os.system("pactl set-sink-volume @DEFAULT_SINK@ +5%")
time.sleep(0.1) # 100ms repeat rate
def stop_repeat(self, data):
self.repeating = FalseQuick Implementation Steps
Flatpak Permission FixIf the core447 volume plugin doesn't work with Flatpak version: # Grant PulseAudio access
flatpak override --user --socket=pulseaudio com.core447.StreamController
# Restart StreamController after applying |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Is there an easy way to make a key for volume up or down including when the key being pressed it keeps repeating this action?
I use Audio Control.
But I have to tap to lower/increase instead of having additional option of normal tap plus hold(auto lower/auto increase volume)
All old multimedia keyboards do too does it right thought...
I'm missing some other basic shortcuts like calculator or open multimedia player button too etc. (I know you can do it with the tools that are available, but you know the basic stuff should be just some clicks without scripts imho)
Calculator I managed to make work.
But prebuilt basic classic office/multimedia style keyboard plugin would be neat.
Thanks for the app btw :)
(Flatpak version) Maybe I need to grant the app additional permissions? Because the core 447 volume plugin doesn't work for me
Beta Was this translation helpful? Give feedback.
All reactions