Skip to content

Commit 130b881

Browse files
authored
Merge pull request #344 from Samillion/dev_fadein_feat
feat: add an option for osc to fade in
2 parents 124b836 + 5a30ed2 commit 130b881

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

docs/USER_OPTS.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ Create `modernz.conf` in your mpv script-opts directory:
3030
| ----------------------- | ----- | ---------------------------------------------------------------------- |
3131
| hidetimeout | 2000 | time (in ms) before OSC hides if no mouse movement |
3232
| seek_resets_hidetimeout | yes | if seeking should reset the hidetimeout |
33-
| fadeduration | 250 | fade-out duration (in ms), set to `"0"` for no fade |
33+
| fadeduration | 200 | fade-out duration (in ms), set to `"0"` for no fade |
34+
| fadein | no | whether to enable fade-in effect |
3435
| minmousemove | 0 | minimum mouse movement (in pixels) required to show OSC |
3536
| bottomhover | yes | show OSC only when hovering at the bottom |
3637
| bottomhover_zone | 130 | height of hover zone for bottomhover (in pixels) |

modernz.conf

+3-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ hidetimeout=1500
2525
# if seeking should reset the hidetimeout
2626
seek_resets_hidetimeout=yes
2727
# fade-out duration (in ms), set to 0 for no fade
28-
fadeduration=250
28+
fadeduration=200
29+
# whether to enable fade-in effect
30+
fadein=no
2931
# minimum mouse movement (in pixels) required to show OSC
3032
minmousemove=0
3133
# show OSC only when hovering at the bottom

modernz.lua

+11-4
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ local user_opts = {
3333
-- OSC behaviour and scaling
3434
hidetimeout = 1500, -- time (in ms) before OSC hides if no mouse movement
3535
seek_resets_hidetimeout = true, -- if seeking should reset the hidetimeout
36-
fadeduration = 250, -- fade-out duration (in ms), set to 0 for no fade
36+
fadeduration = 200, -- fade-out duration (in ms), set to 0 for no fade
37+
fadein = false, -- whether to enable fade-in effect
3738
minmousemove = 0, -- minimum mouse movement (in pixels) required to show OSC
3839
bottomhover = true, -- show OSC only when hovering at the bottom
3940
bottomhover_zone = 130, -- height of hover zone for bottomhover (in pixels)
@@ -2864,9 +2865,15 @@ local function show_osc()
28642865
--remember last time of invocation (mouse move)
28652866
state.showtime = mp.get_time()
28662867

2867-
osc_visible(true)
2868-
2869-
if user_opts.fadeduration > 0 then
2868+
if user_opts.fadeduration <= 0 then
2869+
osc_visible(true)
2870+
elseif user_opts.fadein then
2871+
if not state.osc_visible then
2872+
state.anitype = "in"
2873+
request_tick()
2874+
end
2875+
else
2876+
osc_visible(true)
28702877
state.anitype = nil
28712878
end
28722879
end

0 commit comments

Comments
 (0)