From ed2e55b94118cb8831781e7cff636dc010be6a57 Mon Sep 17 00:00:00 2001 From: nanahi <130121847+na-na-hi@users.noreply.github.com> Date: Sat, 2 May 2026 19:18:41 -0400 Subject: [PATCH] options: make player-operation-mode readable as a property Make it readable as a property so that scripts and conditional autoprofiles can customize behavior depending if player is launched as pseudo gui mode. --- DOCS/interface-changes/player-operation-mode.rst | 1 + DOCS/man/input.rst | 5 +++++ player/command.c | 9 +++++++++ 3 files changed, 15 insertions(+) create mode 100644 DOCS/interface-changes/player-operation-mode.rst diff --git a/DOCS/interface-changes/player-operation-mode.rst b/DOCS/interface-changes/player-operation-mode.rst new file mode 100644 index 0000000000..28188d3111 --- /dev/null +++ b/DOCS/interface-changes/player-operation-mode.rst @@ -0,0 +1 @@ +make `player-operation-mode` readable as a property diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst index f5ac290045..cb72178701 100644 --- a/DOCS/man/input.rst +++ b/DOCS/man/input.rst @@ -4386,6 +4386,11 @@ Property list A string containing the currently active clipboard backend. See ``--clipboard-backends`` option for the list of available backends. +``player-operation-mode`` + A read-only string of the current player operation mode, mirroring the + ``--player-operation-mode`` option. To set operation mode, set the option + at startup instead. + ``clock`` The current local time in hour:minutes format. diff --git a/player/command.c b/player/command.c index bc032ea480..7578cbe5c5 100644 --- a/player/command.c +++ b/player/command.c @@ -3166,6 +3166,14 @@ static int mp_property_term_size(void *ctx, struct m_property *prop, return m_property_read_sub(props, action, arg); } +static int mp_property_player_operation_mode(void *ctx, struct m_property *prop, + int action, void *arg) +{ + MPContext *mpctx = ctx; + const struct m_opt_choice_alternatives mode_names[] = {{"cplayer", 0}, {"pseudo-gui", 1}}; + return m_property_strdup_ro(action, arg, m_opt_choice_str(mode_names, mpctx->opts->operation_mode)); +} + static int mp_property_mouse_pos(void *ctx, struct m_property *prop, int action, void *arg) { @@ -4633,6 +4641,7 @@ static const struct m_property mp_properties_base[] = { {"idle-active", mp_property_idle}, {"window-id", mp_property_window_id}, {"display-swapchain", mp_property_vo_display_swapchain}, + {"player-operation-mode", mp_property_player_operation_mode}, {"chapter-list", mp_property_list_chapters}, {"track-list", mp_property_list_tracks},