Skip to content

Visibility state is lost on unpause if showonpause is active #387

@snaphat

Description

@snaphat

The current session's user-defined visibility setting is lost if showonpause is active and an unpause event occurs.

Steps to Reproduce

  1. Set keeponpause=yes in modernz.conf
  2. Set visibility=always in modernz.conf
  3. Add Del script-binding modernz/visibility to input.conf
  4. Start mpv with a video
  5. Pause the video
  6. Cycle the visibility to auto
  7. Unpause, then pause again
  8. Visibility will revert to the original setting (or whatever happened to be saved during the initial pause)

Root Cause

The user_opt.visibility field is used to store both the user's visibility preference (as set during a visibility cycle) and temporary overrides (e.g., during pause). ModernZ attempts to preserve the original preference by saving user_opt.visibility into state.temp_visibility_mode during pause. However, this approach is flawed:

  • If the user cycles visibility while paused, user_opt.visibility will be updated, but state.temp_visibility_mode will not reflect this change.
  • On unpause, state.temp_visibility_mode is restored, unintentionally overwriting the user's updated preference.
  • Additionally, if visibility is cycled while showonpause is active, it may affect the temporary state instead of the persistent user setting.

This dual use of user_opt.visibility leads to lost state and inconsistent behavior.

Proposed Fix

Persistent user preferences (even if runtime-only) should be stored separately from temporary script-driven changes.

See the following modification for a possible solution:
main...snaphat:ModernZ:main

Additional Notes

A similar issue occurs if mouse_seek_pause=yes is set in modernz.conf. After seeking with the mouse, the pause state is lost. I haven't analyzed the source code for that behavior.

Expected Behavior

.

Actual Behavior

.

Log File

No response

I carefully read all instructions and confirm that I did the following:

  • I tested with the latest mpv version to validate that the issue is not already fixed.
  • I provided all required information.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions