Made volume OSD not restart every time volume is changed
This commit is contained in:
parent
7b4d251d7e
commit
20597acd64
Binary file not shown.
Binary file not shown.
@ -48,11 +48,7 @@ def qt_process(to_qt_queue, from_qt_queue):
|
|||||||
osd.update_codecs(command['vcodec'], command['acodec'], command['video_res'], command['interlaced'])
|
osd.update_codecs(command['vcodec'], command['acodec'], command['video_res'], command['interlaced'])
|
||||||
|
|
||||||
# Volume OSD commands
|
# Volume OSD commands
|
||||||
elif command['action'] == 'show_volume_osd':
|
elif command['action'] == 'show_volume_osd' or command['action'] == 'update_volume_osd':
|
||||||
# Close existing volume OSD if present
|
|
||||||
if volume_osd is not None:
|
|
||||||
volume_osd.close_widget()
|
|
||||||
|
|
||||||
# Get volume level and mute state
|
# Get volume level and mute state
|
||||||
volume_level = command.get('volume_level', 0)
|
volume_level = command.get('volume_level', 0)
|
||||||
is_muted = command.get('is_muted', False)
|
is_muted = command.get('is_muted', False)
|
||||||
@ -60,25 +56,23 @@ def qt_process(to_qt_queue, from_qt_queue):
|
|||||||
# If muted, override volume display to 0
|
# If muted, override volume display to 0
|
||||||
display_volume = 0 if is_muted else volume_level
|
display_volume = 0 if is_muted else volume_level
|
||||||
|
|
||||||
# Create new volume OSD
|
# Update existing volume OSD if present, otherwise create new one
|
||||||
volume_osd = VolumeOsdWidget(display_volume)
|
if volume_osd is not None and volume_osd.isVisible():
|
||||||
if is_wayland:
|
|
||||||
volume_osd.showFullScreen()
|
|
||||||
else:
|
|
||||||
volume_osd.show()
|
|
||||||
|
|
||||||
# Start the close timer
|
|
||||||
volume_osd.start_close_timer()
|
|
||||||
elif command['action'] == 'update_volume_osd':
|
|
||||||
if volume_osd is not None:
|
|
||||||
volume_level = command.get('volume_level', 0)
|
|
||||||
is_muted = command.get('is_muted', False)
|
|
||||||
|
|
||||||
# If muted, override volume display to 0
|
|
||||||
display_volume = 0 if is_muted else volume_level
|
|
||||||
|
|
||||||
volume_osd.update_volume(display_volume)
|
volume_osd.update_volume(display_volume)
|
||||||
volume_osd.start_close_timer()
|
volume_osd.start_close_timer()
|
||||||
|
else:
|
||||||
|
# Create new volume OSD if none exists or if it's not visible
|
||||||
|
if volume_osd is not None:
|
||||||
|
volume_osd.close_widget()
|
||||||
|
|
||||||
|
volume_osd = VolumeOsdWidget(display_volume)
|
||||||
|
if is_wayland:
|
||||||
|
volume_osd.showFullScreen()
|
||||||
|
else:
|
||||||
|
volume_osd.show()
|
||||||
|
|
||||||
|
# Start the close timer
|
||||||
|
volume_osd.start_close_timer()
|
||||||
elif command['action'] == 'close_volume_osd':
|
elif command['action'] == 'close_volume_osd':
|
||||||
if volume_osd is not None:
|
if volume_osd is not None:
|
||||||
volume_osd.close_widget()
|
volume_osd.close_widget()
|
||||||
|
|||||||
@ -168,6 +168,7 @@ class VolumeControl:
|
|||||||
|
|
||||||
# Update OSD if queue is available
|
# Update OSD if queue is available
|
||||||
if self.to_qt_queue is not None:
|
if self.to_qt_queue is not None:
|
||||||
|
# Always use 'show_volume_osd' action to ensure the OSD appears
|
||||||
self.to_qt_queue.put({
|
self.to_qt_queue.put({
|
||||||
'action': 'show_volume_osd',
|
'action': 'show_volume_osd',
|
||||||
'volume_level': new_volume,
|
'volume_level': new_volume,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user