Global(system) hotkeys for chrome extension - google-chrome-extension

Is it possible to create system hotkeys/shortcuts for Google Chrome Extension? I mean hotkeys that also works when Chrome doesn't have focus.

Yes, but it won't be trivial. To get truly global hotkeys you will have to use native messaging. You will need to create some application to run in the background and capture keypresses and then you can send those keypresses back to Chrome through stdout. This approach will require you to create an additional installer for your extension to install the native messaging app onto the user's system...before you could bundle your app along with the extension (using NPAPI) but that has recently been phased out. I have seen some discussion in the Chromium group about adding bundling support for native messaging apps, but nothing has been added (yet).
Another much easier option is to use the Chrome commands API which will enable you to use hotkeys across all Chrome windows (but not globally...). Just something to consider if "true" global hotkeys are not an absolute requirement since this approach is (much) less complex.
Global media keys will be added to Chrome soon, however. There is a good discussion about this feature to read here.

It's now part of Chrome: chrome://extensions/shortcuts

Related

How do I get access to all the files in the extension in Chrome Extension Manifest Version 3 (MV3)?

Background
I've been using the crx-hotreload package to auto-reload my chrome extensions during development because it's annoying to have to click the refresh button on the Extensions page every time you make a change; however, this package doesn't work with MV3 because it uses the chrome.runtime.getPackageDirectoryEntry method, which seems to have been removed from chrome.runtime in MV3. I can't find documentation to confirm that it was removed, but it's not there when I try to use it.
Questions
Does anyone know how to get access to all the files in the extension directory in Chrome Extension Manifest Version 3?
Or generally, is there a better way that I can hot-reload my chrome extensions during development that would work for MV3?
This is one of many things based on DOM capabilities of background pages that are removed from ManifestV3 because service workers don't have DOM. For example, getPackageDirectoryEntry is using the old nonstandard FileSystem API in its returned value.
As to why, apparently the switch to service workers simplifies the internal source code in Chromium, even if it doesn't provide any real improvements for extension authors or users.
At this point all you can do is present a convincing use case and ask Chromium developers via https://crbug.com to implement an alternative API.

Node-webkit Browser Plugin

Description of the Problem
As NPAPI plugins will be deprecated in Chrome (maybe in Firefox too soon) and being part of a project (WebChimera) that is based on an NPAPI plugin. I've been thinking of different solutions to keep NPAPI support in browsers. (as porting this plugin to NaCL is currently impossible, but the plugin can be used in a frozen version of node-webkit that currently supports NPAPIs)
So I was wondering if it is possible for a browser page to open a node-webkit app on the user's PC, then using JS with/without jQuery to send data about the html element where the Node-Webkit window (with always on top set) should be to the app (maybe through a websocket) to always position it there.
I know I can get a html element's size, position in JavaScript, I also know I can track the scroll of the user and browser tab changes to do the necessary changes to the window size, position and visibility.
The Question
The thing that truly stops me from even attempting this is how would I know when a browser is not fullscreen, and how would I know the browser's position on the screen if it is not fullscreen either from the on page JS or from node-webkit directly. Another thing that should be a concern is what screen is the browser window on.
Am I the only one that has thought of such an endeavor with node-webkit, are there any open source projects attempting this?
Any thoughts or comments on this would be greatly appreciated as a solution to this would not only save NPAPI plugins in the near future but will also open a world where Node-Webkit can also be used as a viable solution to build browser plugins too. :)
This would involve a lot of painful hackery. You'd have to solve most of these issues on all platforms independently and rely on a lot of implementation details.
As a possible alternative, check out the plans for FireBreath 2.0 which will support plugins which can be loaded via NPAPI, ActiveX, and Native Messaging via a new protocol called FireWyrm. Currently there is no drawing support when using the FireWyrm interface and only Native Messaging is supported. Additionally it's not quite finished, though I'm getting close =]
Now it's possible to use libvlc to play video directly on NW.js/Electron page: https://www.npmjs.com/package/webchimera.js
What this project is: it's low level (written in C++) addon which use libvlc and allow decode video frames to JS ArrayBuffer object. In turn this ArrayBuffer object could be drawn on HTML5 canvas directly or with WebGL. This project use Node.js/V8 API directly and not use NPAPI at all, so will live even after NPAPI deprecation. Another good thing - perfomance of this (espesially if use WebGL) is comparable with original VLC player perfomance.
Simple usage example available at: https://github.com/jaruba/wcjs-player

Chrome extension to change Desktop wallpaper

I'm diving into the world of Chrome Extension development, primarily because there is a very small feature that is missing in Chrome that I miss dearly. The context-menu option to "Set as background/wallpaper" like that found in Firefox. Sounds trivial, but it's convenient.
I have most of the "basic" stuff worked out with the manifest file, am able to install it, even managed to get it to show up as a context menu item.
The problem obviously is that I am wanting to mess with a user's OS-level settings which is extremely difficult because of security issues (fully understand this).
I found an extension that allowed this in older versions of Chrome, and it looked like the developer used some type of .dll and C++ to accomplish this.
I'm not really sure how to make this work.
Since that Chrome doesn't allow these kind of manipulations (such as your PC's settings), you will need to create a native application that will run beside your extension. When the user chooses the image from your extension and selects "use as wallpaper", you will use the native messaging API to send a message to your desktop application, that will set the wallpaper (and do whatever else you can't do within a chrome extension) for you.
You can use the chrome.wallpaper app api to set the wallpaper after using the messaging api to send the image from your extension.

IE or FF Launcher

I would like to know if it's possible to develop an extension that allows to open a link with another browser : If in Chrome I click on a link that is configured in such extension, it opens FF or IE with this link.
I didn't find any extension (except extension that have a frame in a chrome tab), so does that mean that there is a technical limitation to do that ?
Best regards
I did something for FF what could be modified to do just that.
I have used the ability to execute shell commands from an extension, and configured the call to launch a 3rd party application.
Look for examples on nsIProcess
In chrome you can use the NPAPI plugins: http://code.google.com/chrome/extensions/npapi.html
Unfortunately, I think that kms is correct in saying that you cannot execute native code in a Chrome Extension, and must therefore pair your extension with an NPAPI Plugin and have them talk to one another. It was one of the most difficult programming tasks I've ever done, although the NPAPI Plugin was made easier by basing it on FireBreath, so at least I didn't need to write very much C++.
UPDATE: Since 2014 or so, Native Messaging is included in Chrome's Web Extensions API and, mercifully, NPAPI is gone.

Google Chrome Extension for Transparent Tabs or Windows

Is it possible to create a browser extension that would allow page-controlled window opacity? Not so that various elements on the page are of a given opacity, but to allow one to see other windows (like the desktop) behind the browser page.
Thank you.
No, this is not possible in an extension. Such transparency would be handled at the window manager level, and would require platform-specific code. This means that either Chrome would have to add this feature and expose it as an extension API (currently no such feature exists), or you would have to write a plugin.

Resources