Codium and VSCode lock up when trying to open a file in Sway

I’m currently building out a minimal Nix/Sway set up on my Pinebook Pro (arm). And for the most part, it’s been going great! However, i’ve run into an issue with anything chromium based (chromium, vscode, and codium) where when clicking “open file” or “open folder” (whatever would open the file picker), the whole program just freezes, no file picker shows up, and I have to force quit the program.

I was able to fix this issue with chromium by adding the following override.

nixpkgs.config.chromium.commandLineArgs = “–enable-features=UseOzonePlatform --ozone-platform=wayland”;

So now launching chromium from dmenu passes in those args and it works great. However, I set up the same command line args for vscode and codium and it doesnt work.

However, when I launch vscode and codium from the terminal with these args, it works! I get a file picker. But it won’t work from dmenu. Ideally i’d like to just set something and any chromium based thing will use wayland native.

I’ve also tried: environment.sessionVariables.NIXOS_OZONE_WL = “1”; as per the vscode wiki, and it doesn’t work either.

I’ve even set:

~/.config/electron-flags.conf to:
–enable-features=UseOzonePlatform,WaylandWindowDecorations --ozone-platform=wayland

What am I missing here? How can I get vscode or codium to launch from dmenu with these flags and have a working file picker in sway?

1 Like

How is vscode/codium installed, exactly? dmenu just works via PATH, so the only reason it would be different from what you get in a terminal is if your shell init scripts set something that isn’t set for your GUI session itself.

1 Like

Thanks everyone who commented here! Quick update on the issue. I was on 21.11 with this issue, but when I finally got 22.05 booting on the sd card, it now just works, so I guess it’s fixed!

Nix 22.05 still won’t boot from the emmc, but 21.11 will for some bizzare reason, but that’s a different story.