Skip to content

Commit a736a42

Browse files
committed
📝 Add debugging notes
1 parent 925333c commit a736a42

File tree

6 files changed

+87
-3
lines changed

6 files changed

+87
-3
lines changed

astro.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ export default defineConfig({
8787
'create-sound-themes',
8888
'compile-from-source',
8989
'contribution-guide',
90+
'debugging',
9091
],
9192
},
9293
{

src/assets/banners/banner13.png

641 KB
Loading

src/assets/img/debugging.png

421 KB
Loading

src/content/docs/compile-from-source.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,11 @@ This will create several packages in the `out/` directory.
152152
* On macOS, it will create a DMG file and a portable zip archive. If the environment variables `KANDO_OSX_SIGN` and `KANDO_OSX_NOTARIZE` are set to `true`, the build process will try to sign and notarize the application.
153153

154154

155-
## Known Issues
155+
## <Icon name="solar:lightbulb-bolt-line-duotone" class="inline-icon" /> Common Issues
156156

157157
On some Linux distributions, you may encounter the error `The SUID sandbox helper binary was found, but is not configured correctly. Rather than run without sandboxing I'm aborting now`. This is related to [this issue](https://github.com/electron/electron/issues/17972) and can be fixed by running these commands:
158158

159159
```bash
160160
sudo chmod 4755 node_modules/electron/dist/chrome-sandbox
161161
sudo chown root node_modules/electron/dist/chrome-sandbox
162-
```
162+
```

src/content/docs/debugging.mdx

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
---
2+
# SPDX-FileCopyrightText: Simon Schneegans <[email protected]>
3+
# SPDX-License-Identifier: CC-BY-4.0
4+
5+
title: Debugging
6+
description: How to debug Kando.
7+
sidebar:
8+
order: 4
9+
---
10+
11+
import { LinkButton } from '@astrojs/starlight/components';
12+
import Intro from '../../components/Intro.astro';
13+
import CustomAside from '../../components/CustomAside.astro';
14+
import {Image} from 'astro:assets';
15+
16+
import vscodeDebugging from '../../assets/img/debugging.png';
17+
18+
![banner](../../assets/banners/banner13.png)
19+
20+
<Intro>
21+
If you want to 💡 **understand Kando's code base** or fix an especially 🐛 **nasty bug**, using a debugger is a great idea.
22+
</Intro>
23+
24+
However, debugging an Electron application is not exactly straightforward.
25+
This is because Electron applications consist of two parts: the main process and the renderer processes.
26+
27+
The main process is responsible for managing the application lifecycle and has access to the operating system.
28+
The renderer processes are responsible for rendering the user interface and are more or less isolated from the operating system.
29+
Kando has one main process and two renderer processes: one for the menu and one for the settings dialog.
30+
31+
## Debugging in VSCode
32+
33+
If you are using [Visual Studio Code](https://code.visualstudio.com/), you can set up debugging by creating a `.vscode/launch.json` file in your project directory.
34+
Put the following content into that file:
35+
36+
```json5 title=".vscode/launch.json"
37+
{
38+
"configurations": [
39+
{
40+
"type": "node",
41+
"request": "launch",
42+
"name": "Kando: Main Process",
43+
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/tsx",
44+
"runtimeArgs": [
45+
"node_modules/@electron-forge/cli/src/electron-forge-start",
46+
"--",
47+
"--remote-debugging-port=9223"
48+
],
49+
"autoAttachChildProcesses": true,
50+
"internalConsoleOptions": "openOnFirstSessionStart",
51+
"console": "integratedTerminal"
52+
},
53+
{
54+
"name": "Kando: Renderer Processes",
55+
"type": "chrome",
56+
"request": "attach",
57+
"port": 9223,
58+
"webRoot": "${workspaceFolder}",
59+
"timeout": 30000
60+
}
61+
],
62+
"compounds": [
63+
{
64+
"name": "Kando: All",
65+
"configurations": ["Kando: Main Process", "Kando: Renderer Processes"]
66+
}
67+
]
68+
}
69+
```
70+
71+
Once this is in place, you can start debugging Kando by selecting the "Kando: All" configuration in the debug panel and clicking the green play button.
72+
This will start the main process and attach the debugger to both the main process and the renderer processes.
73+
You can then set breakpoints in your code and inspect variables!
74+
75+
<center>
76+
<Image src={vscodeDebugging} alt="debugging in VSCode" class="shadow"/>
77+
</center>
78+
79+
## Other IDEs
80+
81+
Have you successfully set up debugging in another IDE?
82+
Let us know by editing this page!
83+
You can also join our [Discord server](https://discord.gg/hZwbVSDkhy) and discuss it there.

src/content/docs/installation-on-windows.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ The zip archive is the standalone version of Kando. You can also download it fro
8888

8989
</Steps>
9090

91-
## <AstroIcon name="solar:bug-bold-duotone" class="inline-icon" /> Known Issues
91+
## <AstroIcon name="solar:lightbulb-bolt-line-duotone" class="inline-icon" /> Common Issues
9292

9393
Sometimes, Kando may not start correctly on Windows.
9494
If you see the following error dialog telling **"Error: The specified module could not be found"** and that `NativeWin32.node` is missing, you can fix this by installing the latest version of the [Visual C++ Redistributable from Microsoft](https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist).

0 commit comments

Comments
 (0)