Spotify keyboard shortcuts - MacOS & Microsoft Sculpt keyboard - macos

I recently got an ergonomic Sculpt keyboard that I use with my Macbook. I managed to configure some handy keyboard shortcuts for e.g. moving between screens but I'm failing miserably at configuring "Next" and "Previous" buttons to use with Spotify.
I tried first Karabiner but it's apparently missing both options. So I started digging in keyboard settings. In Keyboard -> Shortcuts -> App Shortcuts I'm able to add manually a new shortcut for moving to the next song. And it works but only when I'm on the screen with Spotify. But the whole point of this shortcut is to switch between songs while doing something else, without even looking at Spotify app. And that I cannot configure somehow.
Has anyone done something like this before and can recommend a solution? Thanks in advance.

Karabiner can easily do this though. Make a complex modification rule
bind some keybind to keybind fastfoward to skip next song and rewind to go to previous track. play_or_pause for obviously playing or pausing.
in fact i made a simple test to see if this works or not
{
"description": "Spotify next and prev button map",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "n"
},
"to": [ {
"key_code": "fastforward"
} ]
}
]
},
I make the letter n here to be fastfoward you can edit as you like

Related

one or more errors occurred failed to launch debug adapter Visual Studio 2019

From today morning, my Visual Studio is behaving very strangely. I get the error "one or more errors occurred failed to launch debug adapter" whenever I run the project.
I run my project profile instead of running it in the IIS Express profile. Here is my launchSettings.json file.
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:65498",
"sslPort": 44318
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"<ProjectName>": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:5001;http://localhost:5000"
}
}
}
And when I check the Output window, this is what I get.
The program '[22052] .exe' has exited with code -1
(0xffffffff).
Another thing I noticed is that a new browser tab is opened without any URL in it, just an about:blank page.
I am having this problem too and think it may have something to do with the Edge Browser(or an update?) and the JavaScript Debugger. The first time I run a WebApp, everything works fine. Every time afterwards, I receive the "failed to launch debug adapter" shown above.
I have to either disable the Javascript Debugger or Use Internet Explorer to run the app.
The issue was that the process that got started from my previous execution was still running. When we start the project using the profile project, it will start a new process, and you can see that there is a new Debug console window as in the preceding image.
You can just close this window and run your project again, and that will fix the issues. You can also enable a setting that will close this process when the debugging stops. To do that, go to Tools and then click on Options, select Debugging and then enable the option Automatically close the console when debugging stops.
If you don't see the option, just click on the other options under the Debugging menu, and wait for the contents to load, and then click on the Debugging menu again. Sometimes it was just showing a blank screen without any options. Seems like a bug in Visual Studio 2019.
Also, make sure to close the browser window that was opened from the last execution. For me it was opened, that is the reason why a new tab with about: blank was opening.
Happy Coding!.
We're having the same problem as zBestData above since moving to Visual Studio 2019, Version 16.9.1.
We don't have much time to look into it at the moment but seems to be related to msedge.exe processes left running after a debug session. As a workaround, before starting a second debug session, close all open Edge windows, then kill any msedge.exe instances (eg in Task Manager).
Otherwise, we find we need to Restart the system to clear the fault.
The issue is most likely with your browser, which acts as debug adapter in this case. Close all instances of your browser.
Explanation:
As the error message indicates, there is additional information in the output window.
Open the visualstudio-js-debugger.txt file. It should be in a location similar to the one below.
Remember to replace your-user-name in the path below with your correct username.
C:/Users/*your-user-name*/AppData/Local/Temp/visualstudio-js-debugger.txt
The file should look as below, take note of the adapter Id, highlighted in red, it is the Chrome Browser. So you can just close all instances of the Chrome Browser in this case.
Switch the browser, e.g. to Opera, and it will work.
Because the Edge engine can work, for example, in Teams / Outlook and will report a problem.

Start karma tests in Firefox without privacy notice tab and disable extensions

I am using the karma-firefox-launcher plugin to launch my karama tests in Firefox, which works just fine. However every time it launches, Firefox seems to think this is a first-run and it also opens tabs for the privacy notice page, and another one for an extension.
This is what I see every time I run the tests
I was able to make a custom launcher for Firefox in my karma config file to start it in safe mode, like this:
customLaunchers: {
firefox_custom: {
base: 'Firefox',
flags: ["-safe-mode"]
},
},
Which works, but now it shows this dialog every time (which requires the button to be clicked to continue) and is is equally annoying
In my attempt to disable the privacy notice tab, I've tried setting these preferences, but none have worked. Perhaps I'm not setting them correctly?
flags: ["-pref='app.normandy.first_run=false'"]
and
flags: ["-pref='datareporting.policy.firstRunURL='"]
What CLI flags can I set here to both disable extensions without the additional dialog, and stop the privacy
According to the karma-firefox-launcher docs, you can set preferences directly, so after browsing around in the firefox about:config page and searching for "firstrun" I found a preference named toolkit.telemetry.reportingpolicy.firstRun
So, the following will work to prevent that privacy notice tab from opening, but the Adobe Acrobat extension "welcome" tab still opens.
firefox_custom: {
base: 'Firefox',
prefs: {
'toolkit.telemetry.reportingpolicy.firstRun': false,
}
},
It's improved but not all the way there yet! I'll update this answer if I find anything else out.

Launch Chrome Extension from Mac Dock

Is it possible to put an icon in the Mac dock for a chrome extension I'm working on.
Here's the extension code just for reference. manifest.json:
{
"manifest_version": 2,
"name": "Habitica",
"author": "Sam Dale",
"description": "A launcher to quickly get to Habitica. Especially great for Mac users.",
"version": "1.0",
"icons": {"16": "habitica-logo-16.png", "128": "habitica-logo-128.png", "300": "habitica-logo-300.png"},
"browser_action": {
"default_icon": "habitica-logo-128.png",
"default_title": "Habitica"
},
"background": {
"scripts": ["background.js"],
"persistent": false
}
}
background.js:
chrome.browserAction.onClicked.addListener(function(tab) {
chrome.tabs.create({ url: "https://habitica.com/#/tasks" });
});
There is no API to interact with the dock. So, no easy way.
I can think of several complicated ways to do it, but in general I would recommend avoiding that idea.
One can add a shortcut to a non-existing webpage, say, https://launch-my-awesome-extension.horse/, and intercept it with webRequest API.
Note that one can't use a link to a Chrome extension page to sidestep webRequest requirements: such links are likely to be ignored if you try to open them via a shortcut due to elevated privilege of chrome-extension:// pages.
Write a companion native app and use Native Messaging API with all the usual consequences.
Complication: Chrome can only initiate Native Messaging, you cannot launch an app to tell Chrome something; so there must be some resident component already launched when you click the dock icon.
Both are cumbersome and not really a good idea.

Before closing window Sublime Text

Is there a way in Sublime Text to detect before window is closing to add a custom command?
I run a custom command with this shortcuts:
[
{ "keys": ["ctrl+shift+w"], "command": "custom_command"},
{ "keys": ["alt+f4"], "command": "custom_command"}
]
But there are other ways to close Sublime Text and makes sense that a before closing window event should cover all.
There is an event handler function that gets called before a view is closed. I think the name of the function you need is
on_pre_close(view)
All event handler functions are listed within the Sublime Text 3 API. I didn't find one for when the window is closed but I think when the window is going to close, it should close each view first, so using the above function should solve your problem. Here is the link to the Event Listeners section of the API. It should help you.
https://www.sublimetext.com/docs/3/api_reference.html#sublime_plugin.EventListener
Incase you are new to building plugins,
Note that to use Event Listener functions you will need to have a plugin in which you have a class like this
class your_class_name(sublime_plugin.EventListener):
def on_pre_close(self,view):
#Your code here
Maybe python's atexit https://docs.python.org/3/library/atexit.html would work.
(I have not tried it - it is possible that python plugin API will not be fully working at the time atexit functions are called)

Accessing console and devtools of extension's background.js

I just started out with Google Chrome extensions and I can't seem to log to console from my background js. When an error occurs (because of a syntax error, for example), I can't find any error messages either.
My manifest file:
{
"name": "My First Extension",
"version": "1.0",
"manifest_version": 2,
"description": "The first extension that I made.",
"browser_action": {
"default_icon": "icon.png"
},
"background": {
"scripts": ["background.js"]
},
"permissions": [
"pageCapture",
"tabs"
]
}
background.js:
alert("here");
console.log("Hello, world!")
When I load the extension, the alert comes up but I don't see anything being logged to console. What am I doing wrong?
You're looking at the wrong place. These console messages do not appear in the web page, but in the invisible background page (ManifestV2) or service worker (ManifestV3).
To view the correct console open devtools for the background script's context:
Visit chrome://extensions/ or right-click the extension icon and select "Manage extensions".
Enable developer mode
Click on the link named background page (ManifestV2) or service worker (ManifestV3).
Screenshot for ManifestV2 extensions:
Screenshot for ManifestV3 extensions:
I had the same problem, in my case the logging was set to "Hide all" in the console tab in Chrome Developer tools.
I had not even realised this was an option, and I can't remember turning it off
For followers who wish to see the debug console for a "content script" of their chrome extension, it is available by doing a normal "show developer console" then use the dropdown arrow to selects its "javascript environment" then you'll have access to its methods, etc.
additionally
if you want to see content_script js file ( when "background" property is not set ) in manifest.json
"content_scripts": [{
"matches": ["<all_urls>"],
"js": ["popup.js"],
}]
"browser_action": {
"default_icon": "icon_32.png",
"default_popup": "popup.html"
}
then right click on extension icon and click on Inspect popup and developer window opens with popup.html opened , there you see console tab.
Similar to the answer of Michiel i also had a funny console configuration: A filter i dont remember setting:
After clearing the filter i saw the messages.
I had this problem as well. It seems as though my webpage was not updating to the newly saved script. This was solved by pressing Ctrl + refresh (or Ctrl + F5) in the chrome browser.
If we want to read messages printed to console from the popup page, we can click the extension icon to open the popup page, then do right click on the popup page anywhere, a dropdown menu will display, we just click "Inspect" menu to open the developer tool. Notice that the popup page must be keep opening. If it is closed(by window.close()), the developer tool will be closed too.
The other answer(s) work(s) for background.js but, if you are looking for console.logs from the popup then you can try:
var bkg = chrome.extension.getBackgroundPage();
bkg.console.log('foo');
I was developing using cra, and this worked for me.
For those developing extensions for Firefox:
TL;DR version: you need to use Ctrl+Shift+J to call up the browser console window, and click on the settings icon on the top right-hand corner and make sure that "Show Content Messages" is checked.
Longer explanation from a related stackoverflow question: How do I see the console.log output of a background script in a Firefox WebExtension?

Resources