mon / 0x40-web

Pretty images and colours
http://0x40.mon.im/
MIT License
388 stars 38 forks source link

Fullscreen option? #60

Closed mjsir911 closed 2 years ago

mjsir911 commented 2 years ago

Hey, thank you for making this.

Is there an option to fullscreen the website? On firefox I can press F11 to fullscreen the browser but this doesn't hide the tabs without other workarounds. Is it possible / can you add the feature to full screen the app with a button (maybe F11?).

https://developer.mozilla.org/en-US/docs/Web/API/Fullscreen_API

Thanks!

mon commented 2 years ago

I cannot replicate that, hitting F11 hides everything on my copy of firefox. Your mouse isn't hiding at the top of the screen, keeping them active?

mjsir911 commented 2 years ago

ah thank you for the quick response, I have browser.fullscreen.autohide set to false, which is the desired behaviour for me for all websites except yours (I like to have my tabs available when full screened on i3)

mon commented 2 years ago

Am I right in assuming the fullscreen API ignored browser.fullscreen.autohide? Seems reasonable enough, just need to pick a key for it (I don't like the idea of overloading F11 with identical behaviour, feels like something that could break)

mjsir911 commented 2 years ago

Can confirm this lil snippet of code works in the console:

// define a handler
function doc_keyUp(e) {

    // this would test for whichever key is 40 (down arrow) and the ctrl key at the same time
  console.log(e.key)
    if (e.key === 'J') {
        // call your function to do the thing
        document.body.requestFullscreen();
      console.log('hi')
    }
}
// register the handler 
document.addEventListener('keyup', doc_keyUp, false);

It's a bit unintuitive since just running document.body.requestFullscreen() from the console doesn't work because it's technically running on no user input

mon commented 2 years ago

Just to bump this issue - might be a week or 3. I've just moved and need to reassemble my dev machine.

mjsir911 commented 2 years ago

Thanks for the update! if you decide upon a sane keycode I could see what I could do to help ;-)

mon commented 2 years ago

Added as Alt+Enter, since that's commonly used for fullscreen and not actually taken by Chrome/Firefox already (yay!). Will make a new release later, for now it's live on my site when cloudflare evicts the cache - give it 48 hours.