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

Issue2795: Add shortcut setting and handler for "Activate Fit to window" feature #2835

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

RonnyFenrich
Copy link

This PR implements my own feature request :)
It allows the user to define a shortcut which will toggle the "Fit to window" player functionality.

  • Adds a new entry to Preferences > Shortcuts > Player: Activate Fit to window
  • Adds shortcut_activate_fit_to_window shortcut handler triggered by that new shortcut key which will just trigger a click of the existing 'Fit to window' player button

@ImprovedTube
Copy link
Member

hi @RonnyFenrich yay! :)
nice!

It is requiring to have the button enabled. Some users enabling the shortcut won't know about it, so to consider them, you could make the shortcut only trigger the function, or enable and disable the button too each time, if the button was not already enabled in our menu at the time of setting the shortcut.

We also have the same feature at appearance : player : player size: max. height* and other options like max. width, which you might like ( #2794 (comment) )

Generally we can also make shortcuts change one of the toggles in our menu too, by changing chromium storage variables.

4.7.25 DARK THEME
------------------------------------------------------------------------------*/
ImprovedTube.shortcutDarkTheme = function () {
if (document.documentElement.hasAttribute('dark')) {
// message will propagate all the way to setTheme() so we dont need to do anything more here
ImprovedTube.messages.send({action: 'set', key: 'theme', value: 'light'});
} else {
ImprovedTube.messages.send({action: 'set', key: 'theme', value: 'dark'});
CSS features and most JS features are prepared to react once any of these variables changes, including the player button "fit-to-window"
// REACTION OR VISUAL FEEDBACK WHEN THE USER CHANGES A SETTING (already automated for our CSS features):
} else if (message.action === 'storage-changed') {
let camelized_key = message.camelizedKey;
ImprovedTube.storage[message.key] = message.value;
if (['block_vp9', 'block_h264', 'block_av1'].includes(message.key)) {
let atlas = {block_vp9:'vp9|vp09', block_h264:'avc1', block_av1:'av01'}
) ...


*So the player button "fit to window" actually is "max height" and the icon's arrow will more accurately be vertical, instead of should not be diagonal. And this project should be about keeping all these things consistent ( deduplicated )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

2 participants