mirror of
https://github.com/jellyfin/jellyfin-mpv-shim.git
synced 2025-02-17 04:59:34 +00:00
Raise and lower mirror on Windows to allow MPV to show.
This commit is contained in:
parent
dce462ea7b
commit
5da093699f
@ -41,7 +41,7 @@ class DisplayMirror(object):
|
||||
if 'webview_ready' in dir(webview):
|
||||
threading.Thread(target=lambda: (webview.webview_ready(), load_idle())).start()
|
||||
|
||||
maybe_display_window = webview.create_window(title="Jellyfin MPV Shim", js_api=helpers, fullscreen=True)
|
||||
maybe_display_window = webview.create_window(title="Jellyfin MPV Shim Mirror", js_api=helpers, fullscreen=True)
|
||||
if maybe_display_window is not None:
|
||||
# It returned a Window object instead of blocking, we're running on 3.2 (or compatible)
|
||||
self.display_window = maybe_display_window
|
||||
|
@ -256,6 +256,8 @@ class PlayerManager(object):
|
||||
self.update_subtitle_visuals()
|
||||
|
||||
if win_utils:
|
||||
if settings.display_mirroring:
|
||||
win_utils.mirror_act(False)
|
||||
win_utils.raise_mpv()
|
||||
|
||||
if offset is not None and offset > 0:
|
||||
@ -500,6 +502,9 @@ class PlayerManager(object):
|
||||
def send_timeline_stopped(self):
|
||||
self.should_send_timeline = False
|
||||
self._video.client.jellyfin.session_stop(self.get_timeline_options())
|
||||
|
||||
if win_utils and settings.display_mirroring:
|
||||
win_utils.mirror_act(True)
|
||||
|
||||
def upd_player_hide(self):
|
||||
self._player.keep_open = self._video.parent.has_next
|
||||
|
@ -23,3 +23,15 @@ def raise_mpv():
|
||||
|
||||
except Exception:
|
||||
log.error("Could not raise MPV.", exc_info=True)
|
||||
|
||||
def mirror_act(state):
|
||||
try:
|
||||
top_windows = []
|
||||
win32gui.EnumWindows(windowEnumerationHandler, top_windows)
|
||||
for i in top_windows:
|
||||
if "Jellyfin MPV Shim Mirror" in i[1]:
|
||||
win32gui.ShowWindow(i[0], 9 if state else 6)
|
||||
break
|
||||
|
||||
except Exception:
|
||||
log.error("Could not raise/lower MPV mirror.", exc_info=True)
|
||||
|
Loading…
x
Reference in New Issue
Block a user