How to change F5 key binding on Ubuntu 22.04 laptop - visual-studio-code

I have installed Visual Studio Code on Ubuntu 22.04 and found out that F5 Start Debugging key does not work because it is captured by operation system. It is bound to lower screen brightness function.
How can I disable this operation system key binding?
As a quick fix I have changed keyboard mapping inside VS Code, but I do not like it.
I would rather keep standard VS Code binding and bind Fn+F5 to lower screen brightness, as it is indicated on my laptop keyboard.

Related

Iterm2 Customized Key Mapping does not work as Vscode Shell

I have configured my Vscode to use ITerm2 as the built-in shell.
However, my customized key mapping does not work inside the Vscode. But it does work in external standalone ITerm2.
For example, in VScode ITerm2, Option + H combination displays the escape character, as shown.
But in external ITerm, it moves the cursor left, as expected due to my key mapping configuration, as below.

Visual studio code ctrl + ~ doesn't open terminal in KDE plasma

Currently on Ubuntu I'm running KDE version 5.18.8, and I've just started coding in Visual Studio Code, but when toggling the console, I just get an old notification on the top right corner of my screen informing me how old it is, not using the shortcut entirely.
*(I toggled the terminal manually in the settings)
Is this a shortcut I have to change in vscode or KDE? Since there isn't anything online I can seem to find for this. It's a bit of an annoyance.

Visual Studio Code Chromebook Linux eats Alt-Tab: can't next-tab programs

On my Pixelbook/Chromebook with VSCode running under the Linux support, Alt-Tab is eaten by VSCode, and not passed to the
host operating system (ChromeOS/Pixelbook my case).
So, you can Alt-Tab (next-window) through all other windows on the Chromebook until you get to VSCode, and there you will stop, because it eats the Alt-Tab key commands.
(or at least that is what seems to be effectively happening)
Surprisingly, I could not find a bound key keybinding in the keyboard shortcuts setup page,
so I may not have a good grip on the exact problem.
I did find a workaround posted below.
Adding this to settings.json did seem to do the trick,
although I don't understand why.
// this allows me to use alt-tab on chromebook yeah!
"terminal.integrated.commandsToSkipShell": []
This setting is supposed to route keys/commands away from the integrated terminal to VSCode's key handler.
But what I needed/wanted was to stop VSCode's key handler from consuming/stopping Alt-Tab from hitting the host operating system.
This did seem to do the trick, although it is not clear why to me.

Arrow keys don't work when running Visual Studio Code by X11 ssh forwarding

I install VSCode in a Linux VM which is running on VirtualBox and is managed by Vagrant. When I open VSCode from host by ssh X11 forwarding, key mapping is in a mess -- arrow keys, home/end/delete keys don't work.
I've test it on MacOS host (X server is XQuartz) and Win7 host (with MobaXterm's built-in X server), both have issue. On MacOS it's even worse, some alphabets are mapped incorrect.
Arrow keys work fine on other application over X11 forwarding. So I suspect that it should be related to VSCode.
I had read VSCode document about key binding, but couldn't find any clue.
In VSCode 1.11, you may be running into this issue: https://github.com/Microsoft/vscode/issues/24107
I believe the latest insiders 1.12 builds should have a fix. In the current VSCode 1.11 release, you should also be able to set "keyboard.dispatch": "keyCode" to restore the previous keyboard handling logic
Please let us know if you still are running into any issues with keybindings in the latest 1.12 insiders builds

How can I disable GPU rendering in Visual Studio Code

I'm with bad rendering issues... Seems that the Visual Studio Code window do not clean a screen area before redraw it. The same thing happens here with chrome browser, but in chrome I can start it with " --disable-gpu-rendering " and it goes well.
How can I disable GPU rendering in Visual Studio Code ?
I'm thinking it's a hardware specific problem, and I'm looking for a other way to solve it too.
May be useful know my hardware:
Machine: Notebook dell vostro 3500 (intel chipset)
CPU: Intel i5
RAM: 8G
linux kernel: 4.0
video graphics: intel i915 (latest)
X -version: X.Org X Server 1.14.0
Note that VSCode 1.40 (Oct. 2019) proposes an alternative to the parameter/flag --disable-gpu:
Disable GPU acceleration
We have heard issue reports from users that seem related to how the GPU is used to render VS Code's UI.
These users have a much better experience when running VS Code with the additional --disable-gpu command-line argument.
Running with this argument will disable the GPU hardware acceleration and fall back to a software renderer.
To make life easier, you can add this flag as a setting so that it does not have to be passed on the command line each time.
To add this flag:
Open the Command Palette (Ctrl+Shift+P).
Run the Preferences: Configure Runtime Arguments command.
This command will open a argv.json file to configure runtime arguments.
You might see some default arguments there already.
Add
"disable-hardware-acceleration": true
Restart VS Code.
Note: Do not use this setting unless you are seeing issues!
Note that Gilbert points out in the comments to "How To Fix Screen Flickering Issue On Mac, MacBook, And iMac" from Preeti Seth.
Gilbert adds:
I fixed the problem by disabling automatic graphics switching on my macbook pro.
The setting is located in system preferences -> battery.
It worked!
Under Windows, I can confirm that launching VSCode with --disable-gpu does not create a GPU process:
C:\Users\alex\AppData\Local\Code\app-0.1.0>Code.exe --disable-gpu
Perhaps the same flag works on Linux too?
On Ubuntu, the file to edit is /usr/share/applications/code.desktop.
Change:
Exec=/usr/share/code/code --unity-launch %F
to:
Exec=/usr/share/code/code --disable-gpu --unity-launch %F
For Windows users
Visual studio code is based on chrome, to make it work you'll have to disable hardware acceleration.
Add --disable-gpu --disable-gpu-compositing to the vs code shortcut on your desktop.
Example:
"C:\Program Files (x86)\Microsoft VS Code\Code.exe" --disable-gpu --disable-gpu-compositing
Inside settings.json you can write this:-
"terminal.integrated.gpuAcceleration": "off"
on Mac running in virtualbox you can edit the file in ~/.vscode/argv.json
Add
"disable-hardware-acceleration": true
macOS users can try the following commands in the terminal :
Goto Applications folder :
cd Applications
Open VS Code with GPU Disabled :
Visual\ Studio\ Code.app/Contents/MacOS/Electron --disable-gpu
Note : You might need to supply sudo with second command.
On Linux Mint I had to right click the lower left mint button, then choose configure, then press the menu button. Then press the "Open Menu Editor" button and find Visual Studio Code in the programming group. Click properties and find the command field. There you can set the --disable-gpu option.
If environment variables are mapped correctly, you can simply use cmd.exe to start an instance of code with --disable-gpu . See the screenshot. enter image description here
Sometimes the problem is caused by automatic graphic switching as the computer tries to save energy.
In my case my macbook pro has battery problems so they manifested as the screen flickering whenever I ran an intensive application like vscode.
To disable automatic graphic switching, go to system preferences -> battery and untick Automatic graphic switching.
Refer to this guide: https://wethegeek.com/how-to-fix-screen-flickering-issue-on-mac-macbook-and-imac/