Created
August 5, 2026 21:06
-
-
Save thebluefish/d78ecb2cc93445b95059128dd4ca1bf9 to your computer and use it in GitHub Desktop.
PiP keybinds for Jellyfin MPV Shim
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| local mp = require "mp" | |
| local pip_enabled = mp.get_property_bool("ontop", false) | |
| -- The corner that most recently enabled PiP | |
| local active_geometry = nil | |
| local function set_window_state(enabled, geometry) | |
| pip_enabled = enabled | |
| mp.set_property_bool("ontop", enabled) | |
| mp.set_property_bool("border", not enabled) | |
| if geometry then | |
| mp.set_property("geometry", geometry) | |
| end | |
| end | |
| -- The same corner undoes its own action | |
| -- Another corner repositions and enables PiP | |
| local function toggle_corner(geometry) | |
| if pip_enabled and active_geometry == geometry then | |
| active_geometry = nil | |
| set_window_state(false, geometry) | |
| else | |
| active_geometry = geometry | |
| set_window_state(true, geometry) | |
| end | |
| end | |
| local function toggle_in_place() | |
| if pip_enabled then | |
| set_window_state(false, active_geometry) | |
| active_geometry = nil | |
| else | |
| active_geometry = nil | |
| set_window_state(true, nil) | |
| end | |
| end | |
| mp.add_forced_key_binding("Ctrl+KP7", "pip_top_left", function() | |
| toggle_corner("0:0") | |
| end) | |
| mp.add_forced_key_binding("Ctrl+KP9", "pip_top_right", function() | |
| toggle_corner("100%:0") | |
| end) | |
| mp.add_forced_key_binding("Ctrl+KP1", "pip_bottom_left", function() | |
| toggle_corner("0:100%") | |
| end) | |
| mp.add_forced_key_binding("Ctrl+KP3", "pip_bottom_right", function() | |
| toggle_corner("100%:100%") | |
| end) | |
| mp.add_forced_key_binding("Ctrl+KP5", "pip_toggle", toggle_in_place) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment