fix(osd): show OSD at 100% via fabric-cli exec from keybinds
- Add osd_show_audio/osd_show_brightness methods on OSDWindow - Register as standalone functions in __main__ for fabric-cli exec - Keybinds now chain fabric-cli exec after wpctl/brightnessctl - Emit brightness signal on threshold bypass for small changes
This commit is contained in:
4 files changed
+38
-5
No files matched your search
@@ -50,6 +50,30 @@ for key, args in pairs({
|
||||
hl.bind(key, hl.dsp.exec_cmd(cmd))
|
||||
end
|
||||
|
||||
for key, cmd in pairs({
|
||||
AudioRaiseVolume = "wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+",
|
||||
AudioLowerVolume = "wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-",
|
||||
AudioMute = "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle",
|
||||
AudioMicMute = "wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle",
|
||||
}) do
|
||||
hl.bind(
|
||||
"XF86" .. key,
|
||||
hl.dsp.exec_cmd(cmd .. " ; " .. fabricSend .. ' "osd_show_audio()"'),
|
||||
{ locked = true, repeating = true }
|
||||
)
|
||||
end
|
||||
|
||||
for key, cmd in pairs({
|
||||
MonBrightnessUp = "brightnessctl -e4 -n2 set 5%+",
|
||||
MonBrightnessDown = "brightnessctl -e4 -n2 set 5%-",
|
||||
}) do
|
||||
hl.bind(
|
||||
"XF86" .. key,
|
||||
hl.dsp.exec_cmd(cmd .. " ; " .. fabricSend .. ' "osd_show_brightness()"'),
|
||||
{ locked = true, repeating = true }
|
||||
)
|
||||
end
|
||||
|
||||
-- Layer Rules
|
||||
hl.layer_rule({
|
||||
match = {
|
||||
|
||||
@@ -127,6 +127,8 @@ def main():
|
||||
__main__.deskwidget = deskwidget
|
||||
__main__.dock = dock
|
||||
__main__.osd = osd
|
||||
__main__.osd_show_audio = osd.osd_show_audio
|
||||
__main__.osd_show_brightness = osd.osd_show_brightness
|
||||
__main__.screencapture = screencapture
|
||||
__main__.lock_screen = LockScreenWrapper()
|
||||
__main__.switch_keyboard_layout = KeyboardLayout.switch_keyboard_layout
|
||||
|
||||
@@ -284,6 +284,7 @@ class Brightness(Service):
|
||||
abs(new_percent - current_percent) < self.MIN_CHANGE_THRESHOLD
|
||||
and self._last_raw != -1
|
||||
):
|
||||
self.emit("screen", new_percent)
|
||||
return
|
||||
|
||||
self._pending_raw = value
|
||||
|
||||
+11
-5
@@ -68,10 +68,16 @@ class OSDWindow(Window):
|
||||
self.osd = OSD(window=self)
|
||||
self.add(self.osd)
|
||||
|
||||
def osd_show_audio(self):
|
||||
from services.config import get_config
|
||||
|
||||
if __name__ == "__main__":
|
||||
from fabric import Application
|
||||
if not get_config("osd", True):
|
||||
return
|
||||
self.osd.containers["audio"].update()
|
||||
|
||||
osd_window = OSDWindow()
|
||||
app = Application("modus-osd", osd_window)
|
||||
app.run()
|
||||
def osd_show_brightness(self):
|
||||
from services.config import get_config
|
||||
|
||||
if not get_config("osd", True):
|
||||
return
|
||||
self.osd.containers["brightness"].update()
|
||||
Reference in new issue
Block a user