Some loose ends for sway on nixos which we should fix

Instead of using a system service I tried to setup gdm + sway only and it does not seem to work. gdm does not start as it complains about not find the sway session description file. There is no information in the Sway wiki page about this usecase unfortunately.
Did you try it ? (I created a topic especially for my issue in the Learn section)

These instructions don’t seem to work for me, and although I am using home-manager, that shouldn’t affect it. I checked the xdpw FAQ and I can’t figure out why screensharing doesn’t work.
I can provide logs of xdg portal crashing, though I dont know how much it can help. Also I am using sway on hybrid graphics (intel+nvidia) if that matters too

I used these instructions and can now finally get full screen sharing in zoom in chromium working. My waybar works fine, although I never used systemd before; I exec straight from sway/config, so I’m not the target audience to test.

One odd point: If I have two screens (laptop plus external), it only shows the option of a single screen. It also no longer allows showing individual application windows. I have to go to chrome://flags and disable WebRTC PipeWire support to re-renable individual windows, which requires a restart of chromium. It’s not a dealbreaker, but certainly not a smooth workflow like we had in x11 land.

After fiddling around with sway on home-manager I managed to get screensharing working on obs… but only the flatpak version. Screenshoting with slurp works fine but chromium based browsers just crash after trying to screenshare. OBS from nixpkgs just shows a black screen.

@danyeet : as far as I am aware, sway does not support nvidia graphics officially. There even used to be a flag along the lines of -my-next-gpu-wont-be-nvidia which you needed to even launch sway when there was an nvidia device on the pci bus!!! This was very annoying on machines which use integrated graphics for rendering to a display and an nvidia GPU for gpu computing, or vfio passthrough or something like that.

Also, i don’t use home manager, so don’t have anything useful to say about how it interacts with sway.

I’m still struggling to get on-the-fly theme change with gsettings working in GTK3 apps, GTK4 apps works flawlessly.

Are you achieve to change them with your config?

I track two issues related:
https://github.com/NixOS/nixpkgs/issues/168485
https://github.com/nix-community/home-manager/issues/2793#issuecomment-1101231127

I’m a GNOME user, but was curious to try Sway. I followed the new instructions on the wiki and they mostly work, thanks! One thing I had to change was to comment out xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; since it clashed with something else (enabled indirectly by something in my config). In any case, the pre-existing setting did include xdg-desktop-portal-gtk so no problem.

The only annoying thing is that now when I log into GNOME I have to wait significantly longer (ca. 20-30 sec.) than without the sway config (ca. 2 sec.). I checked journalctl but the cause is not immediately obvious to me.

Sounds suspiciously like a portals problem - GNOME needs xdg-portals-gnome afaik.

Thanks for the tip. If I comment out xdg.portal.gtkUsePortal = true; the GNOME starts quickly.

It seems that GNOME and Sway do not coexist well. Setting xdg.portal.wlr.enable = true; breaks screen sharing in GNOME.

1 Like

Using gsettings to switch themes on the fly does work for me.

Great to hear!

Can you share with me an excerpt of your related config?

My entire config is open-source. Sway config is here, theme config is here.

1 Like

Hi, your nixos-configs are really amazing, thank for make it public. Really well ordered modules system. Thanks I’m learning a lot and feel shame of my configs :slight_smile: I tried to adjust my sway/theme to your config but still it doesn’t work. Also surprised you dont need some workaround I do. For instance:

How do you solve the message error??

$> gsettings set org.gnome.desktop.interface gtk-theme Adwaita-dark
No schemas installed

without the workaround:

xdg.systemDirs.data = [
    "${pkgs.gtk3}/share/gsettings-schemas/${pkgs.gtk3.name}"
    "${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/${pkgs.gsettings-desktop-schem
as.name}"
];

I disabled the xdg.portal.wlr.enable flag and things seems to run smoothly, including screencast and screenshots. The GNOME config seems to take care of what’s needed.

That’s fixed by home-manager because of this setting

I’m scraping HM code but not sure what exactly this module add to system config. In any case I have it enabled and no schemas yet.

It doesn’t really add anything to the sway config. It instructs the nixpkgs derivation to include the gappsWrapperHook. Not sure why it doesn’t work for you, when I had similar “no schemas installed” issues that was the fix.

I cherry pick this

https://github.com/NixOS/nixpkgs/commit/95f001206fd289959940fa1f6cc10993841818cb

then I have schemas into sway again. But still gtk3 apps (mainly firefox-esr and ungoogled-chromium) ignoring theme (Adwaita-dark) o color-scheme (prefer-dark) setting.

I’ve been trying for days to get sway working in a UTM vm on an M1 Mac. I tried using the sway configuration from this discussion but my vm just boots to a console login. Here is my vm’s configuration. Is there something obvious I’m missing?