xdp-dux portal backend
Idea: an xdp-dux portal backend. It would implement things like screencast and global shortcuts on niri through the same mutter dbus interfaces xdp-gnome uses, but without the gnome deps.
portals.conf
Dux could ship its own Niri (Dux) wayland session that sets XDG_CURRENT_DESKTOP=dux:niri, plus a dux-portals.conf that makes xdp-dux the default instead of gnome.
YaLTeR suggested putting the session file in its own package that depends on both niri and dux.
File chooser
Add a setting to pick between nautilus and dux files.
Hey @bbedward, I was looking into portals myself but for aesthetics reasons (I wanted the portals to look m3). I have drafted the UI for this (in kotlin since that's what I'm comfortable with) and let claude do the rest, so I have like ~5k lines of unreviewed code here for a demo:
https://github.com/user-attachments/assets/98ca4f75-97af-4d9c-878c-6b884e017685
It implemented the backend you described in go, including:
- Talking to niri through mutter dbus for ScreenCast
- Restore tokens for a "Remember this choice" feature and a way to forget them And a frontend:
- The screen share picker
- A page in settings to forget remembered choices (gnome doesn't have this xD)
The picker also has a "region" feature, which is another ~3.5k lines (mostly C) because niri doesn't provide it. That is not something dux should maintain, it could be a niri feature if wanted.
I generally think the idea of moving away from other-compositor deps is good, and it would allow for customization of said portals in the future, possibly like above.
If I may suggest it, it could be cool (yet probably a lot of work) to ship dux-niri with restricted access to some niri and wayland features to a trusted dux process for safety (I can give examples on why its safer). If you think this is feasible/worth discussing, I'll open an issue.
I like the idea of the screencast picker getting the dux style, but I'm not sure dux is the right place for the niri backend itself.
A portal backend for niri would be useful for every niri user, not only for people running dux, and it has to follow niri changes. Hyprland and wlroots both ship their own backends (xdph and xdp-wlr), so an xdp-niri maintained by niri would fit that pattern a lot better in my opinion.
xdph and xdp-wlr already let you swap the screencast picker for your own binary. If xdp-niri had the same option, dux could ship one picker and use it on all three, so the picker looks and works the same everywhere.
The opt-in approach dux files already uses for the file chooser (writing the portals.conf override for the user and putting it back when turned off) would work here too without requiring a dux-niri session.
Kind of depends on what YaLTeR thinks about creating a xdp-niri, but I think creating the visible frontend here and leaving the backend to the compositors is a much cleaner approach.
The idea came from Yalter;)
but I think creating the visible frontend here and leaving the backend to the compositors is a much cleaner approach.
I agree entirely, I just wanted a fast but usable mockup. Having the backend in dux would mean a decently big part of the codebase is niri only, at that point it would be better for the backend to be separate.
Hyprland and wlroots both ship their own backends (xdph and xdp-wlr), so an xdp-niri maintained by niri would fit that pattern a lot better in my opinion. xdph and xdp-wlr already let you swap the screencast picker for your own binary. If xdp-niri had the same option, dux could ship one picker and use it on all three, so the picker looks and works the same everywhere.
This is a great approach. You'd could point those pickers to a simple dms portal-screencast command for example.
The part about forgetting remembered choices in settings applies to any portal backend, it's a good addition in any case and would not depend on dux specific portals.