Skip to content

Commit fb8b948

Browse files
committed
FEAT: modernX.lua now sets the tick rate to the monitors refresh rate
1 parent 0f67003 commit fb8b948

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ Please note that many of these scripts have been slightly modified from their in
3939
- This adds the following options: `show_sponsorblock_segments`, `add_sponsorblock_chapters`, `sponsorblock_sponsor_color`, `sponsorblock_intro_color`, `sponsorblock_outro_color`, `sponsorblock_interaction_color`, `sponsorblock_selfpromo_color` and `sponsorblock_filler_color`
4040
- Fix `seekbar_cache_color` to `modernX.lua`
4141
- Added `progress_bar_height` to `modernX.lua`
42+
- FIX: fix thumbnail border clipping through text weird
43+
- FEAT: `modernX.lua` now sets the tick rate to the monitors refresh rate
4244

4345
### 2025-01-16
4446

scripts/modernx.lua

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ local sponsorblock_color_map = {
388388
filler = user_opts.sponsorblock_filler_color
389389
}
390390

391-
local tick_delay = 1 / 100 -- 100FPS
391+
local tick_delay = 1 / 60 -- 60FPS
392392
local audio_track_count = 0 -- TODO: implement
393393
local sub_track_count = 0 -- TODO: implement
394394
local window_control_box_width = 138
@@ -1428,7 +1428,13 @@ function limited_list(prop, pos)
14281428
return count, reslist
14291429
end
14301430

1431-
-- downloading --
1431+
local function set_tick_delay(_, display_fps)
1432+
-- may be nil if unavailable or 0 fps is reported
1433+
if not display_fps then
1434+
return
1435+
end
1436+
tick_delay = 1 / display_fps
1437+
end
14321438

14331439
local function newfilereset()
14341440
request_init()
@@ -1445,15 +1451,16 @@ end
14451451

14461452
local function startupevents()
14471453
state.new_file_flag = true
1454+
set_tick_delay("display_fps", mp.get_property_number("display_fps"))
14481455
state.videoDescription = "Loading description..."
14491456
state.file_size_normalized = "Approximating size..."
14501457
check_path_url()
14511458
checktitle()
14521459
if user_opts.automatic_keyframe_mode then
14531460
if mp.get_property_number("duration", 0) > user_opts.automatic_keyframe_limit then
1454-
user_opts.seekbar_keyframes = true
1461+
user_opts.seekbar_keyframes = true
14551462
else
1456-
user_opts.seekbar_keyframes = false
1463+
user_opts.seekbar_keyframes = false
14571464
end
14581465
end
14591466
destroyscrollingkeys() -- close description
@@ -4238,6 +4245,7 @@ mp.observe_property('osd-dimensions', 'native', function(name, val)
42384245
-- we might have to worry about property update ordering)
42394246
request_init_resize()
42404247
end)
4248+
mp.observe_property("display-fps", "number", set_tick_delay)
42414249
-- mouse show/hide bindings
42424250
mp.set_key_bindings({
42434251
{'mouse_move', function(e) process_event('mouse_move', nil) end},

0 commit comments

Comments
 (0)