Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

read hover animations from input.conf #5

Open
phyzhenli opened this issue May 21, 2022 · 8 comments
Open

read hover animations from input.conf #5

phyzhenli opened this issue May 21, 2022 · 8 comments

Comments

@phyzhenli
Copy link

Hi,

I modify some values of hotkeys in input.conf. Is there a way to read the value from the file and update hover animations?

Thanks

@Zren
Copy link
Owner

Zren commented May 21, 2022

Ctrl+F to search for setButtonTooltip to edit the tooltips.

https://github.com/Zren/mpv-osc-tethys/blob/master/osc_tethys.lua#L3475

As for osc_tethys.lua dynamically parsing the shortcut keys and using them in the tooltips, I'd have to look into it.

@Zren
Copy link
Owner

Zren commented May 21, 2022

@Zren
Copy link
Owner

Zren commented May 22, 2022

To log all the bindings:

local bindings = mp.get_property_native("input-bindings", {})
for _, bind in pairs(bindings) do
    jsonstr, err = utils.format_json(bind)
    msg.warn(jsonstr)
end

Here's a few relevant bindings for a couple tooltips.

// Pause
{"comment":"toggle pause/playback mode","priority":0,"key":"MBTN_RIGHT","cmd":"cycle pause","section":"default","is_weak":true} 
{"comment":"toggle pause/playback mode","priority":0,"key":"p","cmd":"cycle pause","section":"default","is_weak":true} 
{"comment":"toggle pause/playback mode","priority":0,"key":"SPACE","cmd":"cycle pause","section":"default","is_weak":true} 
{"comment":"toggle pause/playback mode","priority":0,"key":"PLAY","cmd":"cycle pause","section":"default","is_weak":true} 
{"comment":"toggle pause/playback mode","priority":0,"key":"PAUSE","cmd":"cycle pause","section":"default","is_weak":true} 
{"comment":"toggle pause/playback mode","priority":0,"key":"PLAYPAUSE","cmd":"cycle pause","section":"default","is_weak":true}

// Seek
{"comment":"seek 10 seconds forward","priority":0,"key":"WHEEL_UP","cmd":"seek 10","section":"default","is_weak":true} 
{"comment":"seek 10 seconds backward","priority":0,"key":"WHEEL_DOWN","cmd":"seek -10","section":"default","is_weak":true} 
{"comment":"seek 5 seconds forward","priority":0,"key":"RIGHT","cmd":"seek  5","section":"default","is_weak":true} 
{"comment":"seek 5 seconds backward","priority":0,"key":"LEFT","cmd":"seek -5","section":"default","is_weak":true} 
{"comment":"seek 1 minute forward","priority":0,"key":"UP","cmd":"seek  60","section":"default","is_weak":true} 
{"comment":"seek 1 minute backward","priority":0,"key":"DOWN","cmd":"seek -60","section":"default","is_weak":true} 
{"comment":"seek exactly 1 second forward","priority":0,"key":"Shift+RIGHT","cmd":"no-osd seek  1 exact","section":"default","is_weak":true} 
{"comment":"seek exactly 1 second backward","priority":0,"key":"Shift+LEFT","cmd":"no-osd seek -1 exact","section":"default","is_weak":true} 
{"comment":"seek exactly 5 seconds forward","priority":0,"key":"Shift+UP","cmd":"no-osd seek  5 exact","section":"default","is_weak":true} 
{"comment":"seek exactly 5 seconds backward","priority":0,"key":"Shift+DOWN","cmd":"no-osd seek -5 exact","section":"default","is_weak":true} 
{"comment":"seek 10 minutes forward","priority":0,"key":"Shift+PGUP","cmd":"seek 600","section":"default","is_weak":true} 
{"comment":"seek 10 minutes backward","priority":0,"key":"Shift+PGDWN","cmd":"seek -600","section":"default","is_weak":true} 
{"comment":"seek 1 minute forward","priority":0,"key":"FORWARD","cmd":"seek 60","section":"default","is_weak":true} 
{"comment":"seek 1 minute backward","priority":0,"key":"REWIND","cmd":"seek -60","section":"default","is_weak":true}  
// Seek (added by ~/.config/mpv/input.conf) at priority=5
{"comment":"forward","priority":5,"key":"RIGHT","cmd":"seek  5 exact","section":"default","is_weak":false} 
{"comment":"backward","priority":5,"key":"LEFT","cmd":"seek -5 exact","section":"default","is_weak":false} 
{"comment":"forward","priority":5,"key":"WHEEL_UP","cmd":"seek  5 exact","section":"default","is_weak":false} 
{"comment":"backward","priority":5,"key":"WHEEL_DOWN","cmd":"seek -5 exact","section":"default","is_weak":false} 

Here's the full list.

{"comment":"don't do anything","priority":0,"key":"MBTN_LEFT","cmd":"ignore","section":"default","is_weak":true} 
{"comment":"toggle fullscreen","priority":0,"key":"MBTN_LEFT_DBL","cmd":"cycle fullscreen","section":"default","is_weak":true} 
{"comment":"toggle pause/playback mode","priority":0,"key":"MBTN_RIGHT","cmd":"cycle pause","section":"default","is_weak":true} 
{"comment":"skip to the previous file","priority":0,"key":"MBTN_BACK","cmd":"playlist-prev","section":"default","is_weak":true} 
{"comment":"skip to the next file","priority":0,"key":"MBTN_FORWARD","cmd":"playlist-next","section":"default","is_weak":true} 
{"comment":"seek 10 seconds forward","priority":0,"key":"WHEEL_UP","cmd":"seek 10","section":"default","is_weak":true} 
{"comment":"seek 10 seconds backward","priority":0,"key":"WHEEL_DOWN","cmd":"seek -10","section":"default","is_weak":true} 
{"key":"WHEEL_LEFT","priority":0,"cmd":"add volume -2","section":"default","is_weak":true} 
{"key":"WHEEL_RIGHT","priority":0,"cmd":"add volume 2","section":"default","is_weak":true} 
{"comment":"seek 5 seconds forward","priority":0,"key":"RIGHT","cmd":"seek  5","section":"default","is_weak":true} 
{"comment":"seek 5 seconds backward","priority":0,"key":"LEFT","cmd":"seek -5","section":"default","is_weak":true} 
{"comment":"seek 1 minute forward","priority":0,"key":"UP","cmd":"seek  60","section":"default","is_weak":true} 
{"comment":"seek 1 minute backward","priority":0,"key":"DOWN","cmd":"seek -60","section":"default","is_weak":true} 
{"comment":"seek exactly 1 second forward","priority":0,"key":"Shift+RIGHT","cmd":"no-osd seek  1 exact","section":"default","is_weak":true} 
{"comment":"seek exactly 1 second backward","priority":0,"key":"Shift+LEFT","cmd":"no-osd seek -1 exact","section":"default","is_weak":true} 
{"comment":"seek exactly 5 seconds forward","priority":0,"key":"Shift+UP","cmd":"no-osd seek  5 exact","section":"default","is_weak":true} 
{"comment":"seek exactly 5 seconds backward","priority":0,"key":"Shift+DOWN","cmd":"no-osd seek -5 exact","section":"default","is_weak":true} 
{"comment":"seek to the previous subtitle","priority":0,"key":"Ctrl+LEFT","cmd":"no-osd sub-seek -1","section":"default","is_weak":true} 
{"comment":"seek to the next subtitle","priority":0,"key":"Ctrl+RIGHT","cmd":"no-osd sub-seek  1","section":"default","is_weak":true} 
{"comment":"change subtitle timing such that the previous subtitle is displayed","priority":0,"key":"Shift+Ctrl+LEFT","cmd":"sub-step -1","section":"default","is_weak":true} 
{"comment":"change subtitle timing such that the next subtitle is displayed","priority":0,"key":"Shift+Ctrl+RIGHT","cmd":"sub-step 1","section":"default","is_weak":true} 
{"comment":"move the video right","priority":0,"key":"Alt+LEFT","cmd":"add video-pan-x  0.1","section":"default","is_weak":true} 
{"comment":"move the video left","priority":0,"key":"Alt+RIGHT","cmd":"add video-pan-x -0.1","section":"default","is_weak":true} 
{"comment":"move the video down","priority":0,"key":"Alt+UP","cmd":"add video-pan-y  0.1","section":"default","is_weak":true} 
{"comment":"move the video up","priority":0,"key":"Alt+DOWN","cmd":"add video-pan-y -0.1","section":"default","is_weak":true} 
{"comment":"zoom in","priority":0,"key":"Alt++","cmd":"add video-zoom   0.1","section":"default","is_weak":true} 
{"comment":"zoom out","priority":0,"key":"Alt+-","cmd":"add video-zoom  -0.1","section":"default","is_weak":true} 
{"comment":"reset zoom and pan settings","priority":0,"key":"Alt+BS","cmd":"set video-zoom 0 ; set video-pan-x 0 ; set video-pan-y 0","section":"default","is_weak":true} 
{"comment":"seek to the next chapter","priority":0,"key":"PGUP","cmd":"add chapter 1","section":"default","is_weak":true} 
{"comment":"seek to the previous chapter","priority":0,"key":"PGDWN","cmd":"add chapter -1","section":"default","is_weak":true} 
{"comment":"seek 10 minutes forward","priority":0,"key":"Shift+PGUP","cmd":"seek 600","section":"default","is_weak":true} 
{"comment":"seek 10 minutes backward","priority":0,"key":"Shift+PGDWN","cmd":"seek -600","section":"default","is_weak":true} 
{"comment":"decrease the playback speed","priority":0,"key":"[","cmd":"multiply speed 1/1.1","section":"default","is_weak":true} 
{"comment":"increase the playback speed","priority":0,"key":"]","cmd":"multiply speed 1.1","section":"default","is_weak":true} 
{"comment":"halve the playback speed","priority":0,"key":"{","cmd":"multiply speed 0.5","section":"default","is_weak":true} 
{"comment":"double the playback speed","priority":0,"key":"}","cmd":"multiply speed 2.0","section":"default","is_weak":true} 
{"comment":"reset the speed to normal","priority":0,"key":"BS","cmd":"set speed 1.0","section":"default","is_weak":true} 
{"comment":"undo the previous (or marked) seek","priority":0,"key":"Shift+BS","cmd":"revert-seek","section":"default","is_weak":true} 
{"comment":"mark the position for revert-seek","priority":0,"key":"Shift+Ctrl+BS","cmd":"revert-seek mark","section":"default","is_weak":true} 
{"key":"q","priority":0,"cmd":"quit","section":"default","is_weak":true} 
{"comment":"exit and remember the playback position","priority":0,"key":"Q","cmd":"quit-watch-later","section":"default","is_weak":true} 
{"comment":"leave fullscreen","priority":0,"key":"ESC","cmd":"set fullscreen no","section":"default","is_weak":true} 
{"comment":"toggle pause/playback mode","priority":0,"key":"p","cmd":"cycle pause","section":"default","is_weak":true} 
{"comment":"advance one frame and pause","priority":0,"key":".","cmd":"frame-step","section":"default","is_weak":true} 
{"comment":"go back by one frame and pause","priority":0,"key":",","cmd":"frame-back-step","section":"default","is_weak":true} 
{"comment":"toggle pause/playback mode","priority":0,"key":"SPACE","cmd":"cycle pause","section":"default","is_weak":true} 
{"comment":"skip to the next file","priority":0,"key":">","cmd":"playlist-next","section":"default","is_weak":true} 
{"comment":"skip to the next file","priority":0,"key":"ENTER","cmd":"playlist-next","section":"default","is_weak":true} 
{"comment":"skip to the previous file","priority":0,"key":"<","cmd":"playlist-prev","section":"default","is_weak":true} 
{"comment":"toggle displaying the OSD on user interaction or always","priority":0,"key":"O","cmd":"no-osd cycle-values osd-level 3 1","section":"default","is_weak":true} 
{"comment":"show playback progress","priority":0,"key":"o","cmd":"show-progress","section":"default","is_weak":true} 
{"comment":"show playback progress","priority":0,"key":"P","cmd":"show-progress","section":"default","is_weak":true} 
{"comment":"display information and statistics","priority":0,"key":"i","cmd":"script-binding stats/display-stats","section":"default","is_weak":true} 
{"comment":"toggle displaying information and statistics","priority":0,"key":"I","cmd":"script-binding stats/display-stats-toggle","section":"default","is_weak":true} 
{"comment":"open the console","priority":0,"key":"`","cmd":"script-binding console/enable","section":"default","is_weak":true} 
{"comment":"shift subtitles 100 ms earlier","priority":0,"key":"z","cmd":"add sub-delay -0.1","section":"default","is_weak":true} 
{"comment":"delay subtitles by 100 ms","priority":0,"key":"Z","cmd":"add sub-delay +0.1","section":"default","is_weak":true} 
{"comment":"delay subtitles by 100 ms","priority":0,"key":"x","cmd":"add sub-delay +0.1","section":"default","is_weak":true} 
{"comment":"change audio/video sync by delaying the audio","priority":0,"key":"Ctrl++","cmd":"add audio-delay 0.100","section":"default","is_weak":true} 
{"comment":"change audio/video sync by shifting the audio earlier","priority":0,"key":"Ctrl+-","cmd":"add audio-delay -0.100","section":"default","is_weak":true} 
{"comment":"increase the subtitle font size","priority":0,"key":"G","cmd":"add sub-scale +0.1","section":"default","is_weak":true} 
{"comment":"decrease the subtitle font size","priority":0,"key":"F","cmd":"add sub-scale -0.1","section":"default","is_weak":true} 
{"key":"9","priority":0,"cmd":"add volume -2","section":"default","is_weak":true} 
{"key":"/","priority":0,"cmd":"add volume -2","section":"default","is_weak":true} 
{"key":"0","priority":0,"cmd":"add volume 2","section":"default","is_weak":true} 
{"key":"*","priority":0,"cmd":"add volume 2","section":"default","is_weak":true} 
{"comment":"toggle mute","priority":0,"key":"m","cmd":"cycle mute","section":"default","is_weak":true} 
{"key":"1","priority":0,"cmd":"add contrast -1","section":"default","is_weak":true} 
{"key":"2","priority":0,"cmd":"add contrast 1","section":"default","is_weak":true} 
{"key":"3","priority":0,"cmd":"add brightness -1","section":"default","is_weak":true} 
{"key":"4","priority":0,"cmd":"add brightness 1","section":"default","is_weak":true} 
{"key":"5","priority":0,"cmd":"add gamma -1","section":"default","is_weak":true} 
{"key":"6","priority":0,"cmd":"add gamma 1","section":"default","is_weak":true} 
{"key":"7","priority":0,"cmd":"add saturation -1","section":"default","is_weak":true} 
{"key":"8","priority":0,"cmd":"add saturation 1","section":"default","is_weak":true} 
{"comment":"halve the window size","priority":0,"key":"Alt+0","cmd":"set current-window-scale 0.5","section":"default","is_weak":true} 
{"comment":"reset the window size","priority":0,"key":"Alt+1","cmd":"set current-window-scale 1.0","section":"default","is_weak":true} 
{"comment":"double the window size","priority":0,"key":"Alt+2","cmd":"set current-window-scale 2.0","section":"default","is_weak":true} 
{"comment":"toggle the deinterlacing filter","priority":0,"key":"d","cmd":"cycle deinterlace","section":"default","is_weak":true} 
{"comment":"move subtitles up","priority":0,"key":"r","cmd":"add sub-pos -1","section":"default","is_weak":true} 
{"comment":"move subtitles down","priority":0,"key":"R","cmd":"add sub-pos +1","section":"default","is_weak":true} 
{"comment":"move subtitles down","priority":0,"key":"t","cmd":"add sub-pos +1","section":"default","is_weak":true} 
{"comment":"hide or show the subtitles","priority":0,"key":"v","cmd":"cycle sub-visibility","section":"default","is_weak":true} 
{"comment":"hide or show the secondary subtitles","priority":0,"key":"Alt+v","cmd":"cycle secondary-sub-visibility","section":"default","is_weak":true} 
{"comment":"toggle stretching SSA/ASS subtitles with anamorphic videos to match the historical renderer","priority":0,"key":"V","cmd":"cycle sub-ass-vsfilter-aspect-compat","section":"default","is_weak":true} 
{"comment":"toggle overriding SSA/ASS subtitle styles with the normal styles","priority":0,"key":"u","cmd":"cycle-values sub-ass-override \"force\" \"no\"","section":"default","is_weak":true} 
{"comment":"switch subtitle track","priority":0,"key":"j","cmd":"cycle sub","section":"default","is_weak":true} 
{"comment":"switch subtitle track backwards","priority":0,"key":"J","cmd":"cycle sub down","section":"default","is_weak":true} 
{"comment":"switch audio track","priority":0,"key":"SHARP","cmd":"cycle audio","section":"default","is_weak":true} 
{"comment":"switch video track","priority":0,"key":"_","cmd":"cycle video","section":"default","is_weak":true} 
{"comment":"toggle placing the video on top of other windows","priority":0,"key":"T","cmd":"cycle ontop","section":"default","is_weak":true} 
{"comment":"toggle fullscreen","priority":0,"key":"f","cmd":"cycle fullscreen","section":"default","is_weak":true} 
{"comment":"take a screenshot of the video in its original resolution with subtitles","priority":0,"key":"s","cmd":"screenshot","section":"default","is_weak":true} 
{"comment":"take a screenshot of the video in its original resolution without subtitles","priority":0,"key":"S","cmd":"screenshot video","section":"default","is_weak":true} 
{"comment":"take a screenshot of the window with OSD and subtitles","priority":0,"key":"Ctrl+s","cmd":"screenshot window","section":"default","is_weak":true} 
{"comment":"automatically screenshot every frame; issue this command again to stop taking screenshots","priority":0,"key":"Alt+s","cmd":"screenshot each-frame","section":"default","is_weak":true} 
{"comment":"decrease panscan","priority":0,"key":"w","cmd":"add panscan -0.1","section":"default","is_weak":true} 
{"comment":"shrink black bars by cropping the video","priority":0,"key":"W","cmd":"add panscan +0.1","section":"default","is_weak":true} 
{"comment":"shrink black bars by cropping the video","priority":0,"key":"e","cmd":"add panscan +0.1","section":"default","is_weak":true} 
{"comment":"cycle the video aspect ratio (\"-1\" is the container aspect)","priority":0,"key":"A","cmd":"cycle-values video-aspect-override \"16:9\" \"4:3\" \"2.35:1\" \"-1\"","section":"default","is_weak":true} 
{"key":"POWER","priority":0,"cmd":"quit","section":"default","is_weak":true} 
{"comment":"toggle pause/playback mode","priority":0,"key":"PLAY","cmd":"cycle pause","section":"default","is_weak":true} 
{"comment":"toggle pause/playback mode","priority":0,"key":"PAUSE","cmd":"cycle pause","section":"default","is_weak":true} 
{"comment":"toggle pause/playback mode","priority":0,"key":"PLAYPAUSE","cmd":"cycle pause","section":"default","is_weak":true} 
{"comment":"unpause","priority":0,"key":"PLAYONLY","cmd":"set pause no","section":"default","is_weak":true} 
{"comment":"pause","priority":0,"key":"PAUSEONLY","cmd":"set pause yes","section":"default","is_weak":true} 
{"key":"STOP","priority":0,"cmd":"quit","section":"default","is_weak":true} 
{"comment":"seek 1 minute forward","priority":0,"key":"FORWARD","cmd":"seek 60","section":"default","is_weak":true} 
{"comment":"seek 1 minute backward","priority":0,"key":"REWIND","cmd":"seek -60","section":"default","is_weak":true} 
{"comment":"skip to the next file","priority":0,"key":"NEXT","cmd":"playlist-next","section":"default","is_weak":true} 
{"comment":"skip to the previous file","priority":0,"key":"PREV","cmd":"playlist-prev","section":"default","is_weak":true} 
{"key":"VOLUME_UP","priority":0,"cmd":"add volume 2","section":"default","is_weak":true} 
{"key":"VOLUME_DOWN","priority":0,"cmd":"add volume -2","section":"default","is_weak":true} 
{"comment":"toggle mute","priority":0,"key":"MUTE","cmd":"cycle mute","section":"default","is_weak":true} 
{"key":"CLOSE_WIN","priority":0,"cmd":"quit","section":"default","is_weak":true} 
{"key":"Ctrl+w","priority":0,"cmd":"quit","section":"default","is_weak":true} 
{"comment":"switch edition","priority":0,"key":"E","cmd":"cycle edition","section":"default","is_weak":true} 
{"comment":"set/clear A-B loop points","priority":0,"key":"l","cmd":"ab-loop","section":"default","is_weak":true} 
{"comment":"toggle infinite looping","priority":0,"key":"L","cmd":"cycle-values loop-file \"inf\" \"no\"","section":"default","is_weak":true} 
{"key":"Ctrl+c","priority":0,"cmd":"quit 4","section":"default","is_weak":true} 
{"comment":"cycle OSC visibility between never, auto (mouse-move) and always","priority":0,"key":"DEL","cmd":"script-binding osc/visibility","section":"default","is_weak":true} 
{"comment":"toggle hardware decoding","priority":0,"key":"Ctrl+h","cmd":"cycle-values hwdec \"auto\" \"no\"","section":"default","is_weak":true} 
{"comment":"show the playlist","priority":0,"key":"F8","cmd":"show-text ${playlist}","section":"default","is_weak":true} 
{"comment":"show the list of video, audio and sub tracks","priority":0,"key":"F9","cmd":"show-text ${track-list}","section":"default","is_weak":true} 
{"comment":"seek to the previous chapter","priority":0,"key":"!","cmd":"add chapter -1","section":"default","is_weak":true} 
{"comment":"seek to the next chapter","priority":0,"key":"@","cmd":"add chapter 1","section":"default","is_weak":true} 
{"comment":"forward","priority":5,"key":"RIGHT","cmd":"seek  5 exact","section":"default","is_weak":false} 
{"comment":"backward","priority":5,"key":"LEFT","cmd":"seek -5 exact","section":"default","is_weak":false} 
{"comment":"forward","priority":5,"key":"WHEEL_UP","cmd":"seek  5 exact","section":"default","is_weak":false} 
{"comment":"backward","priority":5,"key":"WHEEL_DOWN","cmd":"seek -5 exact","section":"default","is_weak":false} 
{"key":"-","priority":5,"cmd":"keypress {","section":"default","is_weak":false} 
{"key":"=","priority":5,"cmd":"keypress }","section":"default","is_weak":false} 
{"key":"q","priority":-1,"cmd":"quit 4","section":"encode","is_weak":true} 
{"key":"ESC","priority":-1,"cmd":"quit 4","section":"encode","is_weak":true} 
{"key":"CLOSE_WIN","priority":-1,"cmd":"quit 4","section":"encode","is_weak":true}

@phyzhenli
Copy link
Author

Ctrl+F to search for setButtonTooltip to edit the tooltips.

https://github.com/Zren/mpv-osc-tethys/blob/master/osc_tethys.lua#L3475

As for osc_tethys.lua dynamically parsing the shortcut keys and using them in the tooltips, I'd have to look into it.

Thank you for your timely reply! I have modified the tooltips and am very satisfied.

However, updating the hover animations according to the input.conf looks a bit complicated...

Zren added a commit that referenced this issue May 25, 2022
Mpv's stats.lua has a great example of parsing the bindings. We use
regex on the command to find all alternative shortcuts and list them
in the generated labels.

A number of obvious shortcuts like media keys are filtered out.

Prettified a few keys, Arrow keys are replaced with unicode arrows.
@Zren
Copy link
Owner

Zren commented May 25, 2022

Does this bindtooltip branch work good enough?

https://github.com/Zren/mpv-osc-tethys/blob/bindtooltip/osc_tethys.lua

@debugzxcv
Copy link

debugzxcv commented May 27, 2022

Does this bindtooltip branch work good enough?

https://github.com/Zren/mpv-osc-tethys/blob/bindtooltip/osc_tethys.lua

incorrect forward/back tooltips.

a seek -0.1 keyframes
d seek +0.1 keyframes

@phyzhenli
Copy link
Author

Does this bindtooltip branch work good enough?

https://github.com/Zren/mpv-osc-tethys/blob/bindtooltip/osc_tethys.lua

Yes! It works great on my machine. Thank you for your help!

@Zren
Copy link
Owner

Zren commented May 27, 2022

I've added a speed button like netflix, and in the process realized how annoying parsing int/real numbers are since lua doesn't have conditional groups, so I can't parse a positive or negative integer with ((%-)?%d+). And I can't use (%d+(%.%d+))? to match an integer or a real number.

http://www.lua.org/manual/5.2/manual.html#6.4.1

...Though now that I think of it, I could probably use [%d%.]+ to match integer 1 /real numbers 1.0. It would also match 1.0.0 and 1. and 1... but whatever.

Edit: I can use a conditional on just %+? though, so that works.


incorrect forward/back tooltips.

a seek -0.1 keyframes
d seek +0.1 keyframes

Hmmm, yeah, I'm not currently searching for real numbers, so that's why it doesn't work. I hadn't thought about a + in front of positive numbers though, so thanks for pointing that out.

The -0.1 tooltip is Forward 0s {\bord(3)\b(700)} a {\bord(1)\b(400)} while the +0.1 is ignored atm.

local seekBackBinds = grepBindByCmd("^seek(%s+)(%-[%d%.]+)", {"REWIND", "Shift+PGDWN"})
local seekFrwdBinds = grepBindByCmd("^seek(%s+)(%+?[%d%.]+)", {"FORWARD", "Shift+PGUP"})
...
local seekBy = bind.cmd:match("^seek%s+([%+%-]?[%d%.]+)")
seekBy = tonumber(seekBy) -- Note: +0.1 is parsed okay
...
return ("Back %ss %s"):format(-seekBy, formatBindKey(bind.key)) -- Had to change %d to %s to print real numbers

I just noticed the Shift+ArrowKeys are also missing, as they use no-osd seek. If I do parse them, I'll probably ignore them in the tooltip though...

// no-osd seek
{"priority":0,"is_weak":true,"key":"Shift+UP","mods":"Shift","section":"default","cmd":"no-osd seek  5 exact","mods_count":1,"comment":"seek exactly 5 seconds forward"} 
{"priority":0,"is_weak":true,"key":"Shift+DOWN","mods":"Shift","section":"default","cmd":"no-osd seek -5 exact","mods_count":1,"comment":"seek exactly 5 seconds backward"} 
{"priority":0,"is_weak":true,"key":"Shift+LEFT","mods":"Shift","section":"default","cmd":"no-osd seek -1 exact","mods_count":1,"comment":"seek exactly 1 second backward"} 
{"priority":0,"is_weak":true,"key":"Shift+RIGHT","mods":"Shift","section":"default","cmd":"no-osd seek  1 exact","mods_count":1,"comment":"seek exactly 1 second forward"}

Zren added a commit that referenced this issue May 27, 2022
The pattern can have a few false positives, but the shortcut wouldn't
work anyway in such cases.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants