Skip to content

Improve Arch Linux support and fix video export on Hyprland#484

Open
psychosomat wants to merge 2 commits intosiddharthvaddem:mainfrom
psychosomat:main
Open

Improve Arch Linux support and fix video export on Hyprland#484
psychosomat wants to merge 2 commits intosiddharthvaddem:mainfrom
psychosomat:main

Conversation

@psychosomat
Copy link
Copy Markdown

@psychosomat psychosomat commented Apr 21, 2026

  • Add pacman package build target for Arch Linux in electron-builder.json5
  • Update build:linux script in package.json to include pacman target
  • Fix dialog window issues on Wayland/Hyprland:
    • Pass mainWindow reference to dialog.showSaveDialog and dialog.showOpenDialog in electron/ipc/handlers.ts
    • Required for proper dialog functionality on Wayland compositors
    • Previously dialogs opened without parent window attachment causing issues on Hyprland

Changes ensure:

  • Correct video export on Arch Linux + Hyprland systems
  • Ability to install via pacman package manager
  • Improved compatibility with Wayland compositors

Summary by CodeRabbit

  • New Features

    • Linux builds now also produce Debian (.deb) and Pacman packages in addition to AppImage
    • Better Wayland support for improved window rendering and screen capture
  • Improvements

    • File open/save dialogs are now properly attached to the main application window for a more consistent user experience

- Add pacman package build target for Arch Linux in electron-builder.json5
- Update build:linux script in package.json to include pacman target
- Fix dialog window issues on Wayland/Hyprland:
  * Pass mainWindow reference to dialog.showSaveDialog and dialog.showOpenDialog in electron/ipc/handlers.ts
  * Required for proper dialog functionality on Wayland compositors
  * Previously dialogs opened without parent window attachment causing issues on Hyprland

Changes ensure:
- Correct video export on Arch Linux + Hyprland systems
- Ability to install via pacman package manager
- Improved compatibility with Wayland compositors
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 21, 2026

📝 Walkthrough

Walkthrough

Detect Wayland sessions on Linux and add corresponding Electron command-line flags; make file dialogs attach to the main BrowserWindow when available; and extend Linux packaging targets to include deb and pacman alongside AppImage.

Changes

Cohort / File(s) Summary
Wayland / Linux startup
electron/main.ts
Detect Wayland via XDG_SESSION_TYPE or WAYLAND_DISPLAY and add --ozone-platform=wayland plus enable-features=WaylandWindowDrag,WebRTCPipeWireCapturer.
File dialog handling
electron/ipc/handlers.ts
Add buildDialogOptions to attach parent: getMainWindow() when valid; use it for showSaveDialog / showOpenDialog in save-exported-video, open-video-file-picker, save-project-file, load-project-file.
Packaging config
electron-builder.json5, package.json
Extend linux.target to include deb and pacman; update build:linux npm script to pass AppImage deb pacman to electron-builder.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • siddharthvaddem

Poem

Wayland sneaks in, a quiet swap of gears 🌙
Dialogs find their homes, no more floating fears
AppImage, deb, pacman — triple the cheer
builds hum along, lowkey less cursed this year ✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The PR description covers the key changes and motivation, but doesn't follow the repository's template structure with sections like Type of Change, Testing, or Checklist. Consider using the repository's PR template structure with explicit sections (Type of Change, Testing steps, Checklist items) for better consistency and clarity.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately captures the main changes: adding Arch Linux support (pacman) and fixing Wayland/Hyprland dialog issues.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 31f0483c65

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread package.json
"build:mac": "tsc && vite build && electron-builder --mac",
"build:win": "tsc && vite build && electron-builder --win",
"build:linux": "tsc && vite build && electron-builder --linux AppImage deb",
"build:linux": "tsc && vite build && electron-builder --linux AppImage deb pacman",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Publish pacman package in Linux CI artifacts

This change adds pacman to the Linux build targets, but the build-linux workflow still uploads only AppImage/zsync/deb artifacts (.github/workflows/build.yml, upload step at lines 245-253). That means the new pacman package is built and then discarded, so Arch users cannot access the package from CI outputs and release automation tied to these artifacts. Please include the pacman output pattern in the upload paths.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@electron/ipc/handlers.ts`:
- Around line 839-856: The dialog calls duplicate the options and pass
getMainWindow() directly which may return a stale/destroyed BrowserWindow;
create a small helper (e.g., buildDialogOptions or attachParentIfAlive) that
accepts the base options object and will attach a valid parent only when
getMainWindow() exists and !mainWindow.isDestroyed(), then use that helper for
dialog.showSaveDialog and the other dialog callers so you build the options once
(title, defaultPath, filters, properties) and only add a parent: mainWindow when
safe instead of passing getMainWindow() directly in
showSaveDialog/showOpenDialog call sites referenced here.
- Around line 362-364: The supportsWindowOpacity flag incorrectly treats Wayland
the same as non-Linux platforms; update the assignment of supportsWindowOpacity
(which currently references isWayland) to exclude Wayland so Linux always
follows the no-opacity codepath: remove the "|| isWayland" portion where
supportsWindowOpacity is computed, leaving isWayland as a separate boolean and
ensuring subsequent logic in the code that calls BrowserWindow.setOpacity(0) and
win.hide() (refer to supportsWindowOpacity, isWayland, BrowserWindow.setOpacity,
and win.hide) will run the Linux fallback path.

In `@electron/main.ts`:
- Line 41: Replace the incorrect Chromium feature name "PipeWire" used in
app.commandLine.appendSwitch("enable-features", "...") with the correct feature
"WebRTCPipeWireCapturer" so the call to app.commandLine.appendSwitch (in
electron/main.ts) enables WaylandWindowDrag and WebRTCPipeWireCapturer; update
the feature list string passed to app.commandLine.appendSwitch accordingly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 66c50af3-1976-48d7-9764-ef5b99972944

📥 Commits

Reviewing files that changed from the base of the PR and between cccb966 and 31f0483.

📒 Files selected for processing (4)
  • electron-builder.json5
  • electron/ipc/handlers.ts
  • electron/main.ts
  • package.json

Comment thread electron/ipc/handlers.ts Outdated
Comment thread electron/ipc/handlers.ts Outdated
Comment thread electron/main.ts Outdated
- Add buildDialogOptions helper function to safely attach parent window only when valid and not destroyed
- Update all dialog calls (save-exported-video, open-video-file-picker, save-project-file, load-project-file) to use the helper
- Fix supportsWindowOpacity logic by removing || isWayland so Linux always follows no-opacity codepath
- Change incorrect Chromium feature name 'PipeWire' to 'WebRTCPipeWireCapturer' in main.ts
- Remove unused isWayland variable in handlers.ts
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
electron/main.ts (1)

33-43: wayland detection + pipewire flag — looks good 👍

pipewire feature name is now correct (WebRTCPipeWireCapturer), matching the previous round of feedback. detection via XDG_SESSION_TYPE/WAYLAND_DISPLAY is the standard heuristic.

two tiny nits, both optional:

  • process.env.WAYLAND_DISPLAY !== undefined treats an empty string as "wayland present". vanishingly rare in practice but a truthy check is slightly safer:
  • electron also supports --ozone-platform-hint=auto, which lets chromium pick wayland when available and gracefully fall back to x11 otherwise. since you're already gating on a wayland check, hard-setting wayland is fine — just flagging in case you want the softer landing for weird sessions (e.g. XWayland-only apps or broken compositors).
optional tweak
-	const isWayland =
-		process.env.XDG_SESSION_TYPE === "wayland" || process.env.WAYLAND_DISPLAY !== undefined;
+	const isWayland =
+		process.env.XDG_SESSION_TYPE === "wayland" || Boolean(process.env.WAYLAND_DISPLAY);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@electron/main.ts` around lines 33 - 43, Change the WAYLAND detection to treat
an empty string as absent by replacing the strict undefined check with a
truthiness check (e.g., use process.env.WAYLAND_DISPLAY instead of
process.env.WAYLAND_DISPLAY !== undefined) in the isWayland calculation so
isWayland is false for empty strings; optionally, if you prefer a softer
fallback instead of forcing Wayland, switch the call to
app.commandLine.appendSwitch("ozone-platform", "wayland") to use the hint form
app.commandLine.appendSwitch("ozone-platform-hint", "auto") (or use that variant
when you want Chromium to prefer Wayland but fall back to X11) while keeping the
WebRTCPipeWireCapturer feature appendSwitch unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@electron/main.ts`:
- Around line 33-43: Change the WAYLAND detection to treat an empty string as
absent by replacing the strict undefined check with a truthiness check (e.g.,
use process.env.WAYLAND_DISPLAY instead of process.env.WAYLAND_DISPLAY !==
undefined) in the isWayland calculation so isWayland is false for empty strings;
optionally, if you prefer a softer fallback instead of forcing Wayland, switch
the call to app.commandLine.appendSwitch("ozone-platform", "wayland") to use the
hint form app.commandLine.appendSwitch("ozone-platform-hint", "auto") (or use
that variant when you want Chromium to prefer Wayland but fall back to X11)
while keeping the WebRTCPipeWireCapturer feature appendSwitch unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f43e5ca0-dc0b-4710-a618-29485c3f4ea7

📥 Commits

Reviewing files that changed from the base of the PR and between 31f0483 and d6d872e.

📒 Files selected for processing (2)
  • electron/ipc/handlers.ts
  • electron/main.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • electron/ipc/handlers.ts

@Qodo-Free-For-OSS
Copy link
Copy Markdown

Hi, The new helper adds a parent property inside the dialog options object, but dialog.showSaveDialog/showOpenDialog require the parent BrowserWindow as a separate first argument. This likely leaves dialogs unparented on Wayland/Hyprland, so the intended fix won’t work.

Severity: action required | Category: correctness

How to fix: Pass parent as first arg

Agent prompt to fix - you can give this to your LLM of choice:

Issue description

dialog.showSaveDialog / dialog.showOpenDialog are being called with a single options object that includes a parent property. Electron expects the parent BrowserWindow to be passed as the first positional argument, so dialogs remain effectively unparented.

Issue Context

The PR goal is to attach dialogs to the main window for Wayland compositors (Hyprland). Current implementation builds {...options, parent: mainWindow} and calls dialog.showSaveDialog(dialogOptions).

Fix Focus Areas

  • electron/ipc/handlers.ts[55-68]
  • electron/ipc/handlers.ts[852-863]
  • electron/ipc/handlers.ts[898-914]
  • electron/ipc/handlers.ts[992-1007]
  • electron/ipc/handlers.ts[1038-1054]

Suggested approach

  • Change helper to return { parentWindow, options } or return a tuple [parentWindow, options].
  • Call dialogs as:
    • dialog.showSaveDialog(parentWindow ?? undefined, options) (or branch: if parent exists, use 2-arg overload; else use 1-arg)
    • dialog.showOpenDialog(parentWindow ?? undefined, options)
  • Keep the destroyed-window guard (don’t pass destroyed window).

Spotted by Qodo code review - free for open-source projects.

@Qodo-Free-For-OSS
Copy link
Copy Markdown

Hi, buildDialogOptions references Electron.OpenDialogOptions / Electron.SaveDialogOptions via the global Electron namespace, which is inconsistent with the rest of the repo’s explicit electron imports and can break typechecking depending on TS type setup.

Severity: remediation recommended | Category: maintainability

How to fix: Import dialog option types

Agent prompt to fix - you can give this to your LLM of choice:

Issue description

The helper function uses Electron.OpenDialogOptions / Electron.SaveDialogOptions via a global namespace, which is inconsistent with the rest of the code and can be brittle.

Issue Context

electron/ipc/handlers.ts already imports runtime symbols from electron. Prefer explicit type imports for options types.

Fix Focus Areas

  • electron/ipc/handlers.ts[1-13]
  • electron/ipc/handlers.ts[59-63]

Suggested change

  • Add import type { OpenDialogOptions, SaveDialogOptions } from "electron";
  • Update the generic constraint to T extends OpenDialogOptions | SaveDialogOptions.

Found by Qodo code review. FYI, Qodo is free for open-source.

@psychosomat psychosomat mentioned this pull request Apr 25, 2026
1 task
@siddharthvaddem
Copy link
Copy Markdown
Owner

@psychosomat I will not be able to validate this/ test this. Waiting on someone who can help validate this before it can be merged

@psychosomat
Copy link
Copy Markdown
Author

@psychosomat I will not be able to validate this/ test this. Waiting on someone who can help validate this before it can be merged

No problem - I totally get that you already have enough of PR. Either way, I'd be happy to help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants