rpwoodbu / mosh-chrome

Mosh for Chrome
GNU General Public License v3.0
372 stars 59 forks source link

Enable translucent windows #167

Open plurry opened 6 years ago

plurry commented 6 years ago

Could you add transparency support? There's information here and a slightly-outdated demo here.You add app.window.alpha to the permissions and add alphaEnabled: true when you call chrome.app.window.create.

You'd have to be on the Dev channel of Chrome OS for transparency to work, but it should automatically revert to a regular window for everyone else, and it would be really useful to me.

I would try to do it myself but Mosh looks too hard to build on a Chromebook without Ubuntu.

rpwoodbu commented 6 years ago

Building Mosh for Chrome on a Chromebook isn't something I've ever tried (I don't bother with things like Crouton). You can easily build with an Ubuntu VM at your favorite cloud provider.

I doubt I will find time to look into this, so I definitely recommend trying this for yourself.

gordol commented 6 years ago

I tried this and the app breaks in stable chrome os... throws a console error about disallowed permissions.

rpwoodbu commented 6 years ago

@gordol According to the linked doc, you need the app.window.alpha permission and possibly also the app.window.shape permission in the manifest. Easy to add to your test; would be curious of the result.

gordol commented 6 years ago

indeed, i added app.window.alpha but it still had permissions issues.

https://github.com/gordol/mosh-chrome/commit/1a95d958c1fec5bb335f5ef92b5be078fa3e6520

it very well may have worked in dev channel, but i'm staying on stable currently, sorry.

i do have another chromebook pixel that's running linux, and I could toss chrome OS back on it, and give it a try, but you're welcome to try out my fork at that commit on your own dev instance if you want.

if you need me to put a build up for you let me know, was a bit of a pain to get the tooling all updated properly with the older versions to get builds to work.

gordol commented 6 years ago

trying this again now with shape permission too...

gordol commented 6 years ago

There were warnings when trying to install this extension: 'app.window.alpha' requires dev channel or newer, but this is the stable channel.

Then, when you launch it:

Unchecked runtime.lastError while running contextMenus.create: Cannot create item with duplicate id new_session at chrome-extension://aocmcdnbijiampmakimmbilaglcnocbg/background.js:64:21 _generated_background_page.html:1 Error in response to app.window.create: TypeError: Cannot read property 'onClosed' of undefined at chrome-extension://aocmcdnbijiampmakimmbilaglcnocbg/background.js:32:23 at newSession (chrome-extension://aocmcdnbijiampmakimmbilaglcnocbg/background.js:26:21) _generated_background_page.html:1 Unchecked runtime.lastError while running app.window.create: The alphaEnabled option requires dev channel or newer. at newSession (chrome-extension://aocmcdnbijiampmakimmbilaglcnocbg/background.js:26:21)

So yeah.. it doesn't fall-back and work on non-dev channel.

gordol commented 6 years ago

btw that first error occurs on other builds too...

_generated_background_page.html:1 Unchecked runtime.lastError while running contextMenus.create: Cannot create item with duplicate id new_session at chrome-extension://fhpnkcjaehfkccaejfaeeibpalcihkkk/background.js:63:21

only the bottom two are relevant to this issue.

gordol commented 6 years ago

also see here: https://bugs.chromium.org/p/chromium/issues/detail?id=436596

https://developer.chrome.com/apps/app_window#type-CreateWindowOptions

it's not documented there, probably for good reason.

gordol commented 6 years ago

alrighty... even on dev, it doesn't work...

the error is:

unchecked runtime.lastError while running app.window.create: The alphaEnabled option can only be used with "frame: 'none'"

gordol commented 6 years ago

adding frame: none unfortunately removes all window decorations...

but, transparency does indeed work on dev channel.

so then we'd need to add our own window controls back. hmm...

have a look: https://imgur.com/a/WalwBoY

you'll need to add frame:none and alphaEnabled to all the window.create calls, new session, etc...

gordol commented 6 years ago

apparently this should be usable on stable with a flag, but... it doesn't appear to actually work: https://bugs.chromium.org/p/chromium/issues/detail?id=793278