#11 systemd integration and other community-contributed stuff
Merged 3 years ago by alebastr. Opened 3 years ago by alebastr.
rpms/ alebastr/sway contrib  into  rawhide

file modified
+36 -2
@@ -1,6 +1,6 @@ 

  Name:           sway

  Version:        1.5.1

- Release:        2%{?dist}

+ Release:        3%{?dist}

  Summary:        i3-compatible window manager for Wayland

  License:        MIT

  URL:            https://github.com/swaywm/sway
@@ -34,6 +34,8 @@ 

  Recommends:     dmenu

  # In addition, xargs is recommended for use in such a launcher arrangement

  Recommends:     findutils

+ # Install configs and scripts for better integration with systemd user session

+ Recommends:     sway-systemd

  

  Requires:       swaybg

  # By default the Fedora background is used
@@ -41,6 +43,9 @@ 

  

  # Lack of graphical drivers may hurt the common use case

  Recommends:     mesa-dri-drivers

+ # Minimal installation doesn't include Qt Wayland backend

+ Recommends:     (qt5-qtwayland if qt5-qtbase-gui)

+ Recommends:     (qt6-qtwayland if qt6-qtbase-gui)

  

  # dmenu (as well as rxvt any many others) requires XWayland on Sway

  Requires:       xorg-x11-server-Xwayland
@@ -53,6 +58,19 @@ 

  Sway is a tiling window manager supporting Wayland compositor protocol and

  i3-compatible configuration.

  

+ %package -n     grimshot

+ Summary:        Helper for screenshots within sway

+ Requires:       grim

+ Requires:       jq

+ Requires:       slurp

+ Requires:       /usr/bin/wl-copy

+ Recommends:     /usr/bin/notify-send

+ 

+ %description -n grimshot

+ Grimshot is an easy to use screenshot tool for sway. It relies on grim,

+ slurp and jq to do the heavy lifting, and mostly provides an easy to use

+ interface.

+ 

  %prep

  %{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}'

  %autosetup -p1
@@ -65,13 +83,20 @@ 

  %meson_install

  # Set Fedora background as default background

  sed -i "s|^output \* bg .*|output * bg /usr/share/backgrounds/default.png fill|" %{buildroot}%{_sysconfdir}/sway/config

+ # Create directory for extra config snippets

+ install -d -m755 -pv %{buildroot}%{_sysconfdir}/sway/config.d

+ 

+ # install contrib/grimshot tool

+ scdoc <contrib/grimshot.1.scd >%{buildroot}%{_mandir}/man1/grimshot.1

+ install -D -m755 -pv contrib/grimshot %{buildroot}%{_bindir}/grimshot

  

  %files

  %license LICENSE

  %doc README.md

  %dir %{_sysconfdir}/sway

+ %dir %{_sysconfdir}/sway/config.d

  %config(noreplace) %{_sysconfdir}/sway/config

- %{_mandir}/man1/*

+ %{_mandir}/man1/sway*

  %{_mandir}/man5/*

  %{_mandir}/man7/*

  %{_bindir}/sway
@@ -90,7 +115,16 @@ 

  %{_datadir}/fish/vendor_completions.d/sway*

  %{_datadir}/backgrounds/sway

  

+ %files -n grimshot

+ %{_bindir}/grimshot

+ %{_mandir}/man1/grimshot.1*

+ 

  %changelog

+ * Sat Feb 20 2021 Aleksei Bavshin <alebastr@fedoraproject.org> - 1.5.1-3

+ - Recommend wayland backend for Qt

+ - Add subpackage for contrib/grimshot screenshot tool

+ - Add 'Recommend: sway-systemd'

+ 

  * Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.1-2

  - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

  

Preparation work for 1.6 + some extras

  • sway now avoids using "wayland-0" socket. The change is going to break any wayland applications running as dbus-activated or systemd services (mako, xdg-desktop-portal-wlr, etc) and thus we should propagate WAYLAND_DISPLAY value received from the compositor to a systemd user instance
  • xdg-desktop-portal needs XDG_CURRENT_DESKTOP=sway to be able to pick the right portal implementation for org.freedesktop.portal.Screenshot and org.freedesktop.portal.ScreenCast
  • apparently nothing in the base installation pulls qtwayland platform plugins and all the Qt apps are running under Xwayland. Let's fix that as well (just because I had this change stashed for a few months).
  • grimshot is an useful script for taking screenshots from contrib/ directory.

Sources and additional reading:

My 2 cents:

  1. Overall, the PR looks good to me; I'm especially in favour of the contrib subpackage, which allows users to just plainly ignore this and keep using sway as they used to 🙂

  2. The more complex parts of the configuration (the systemd integration snippets especially) would greatly benefit from more documentations. I know there is a comment already, but it explains what is happening and not really why it is happening. I would suggest to at least put some of the relevant "additional reading" links directly as comments to the snippets.

    Even better, since the systemd snippets are already being taken from sway wiki, let's include the whole page (in markdown format) as documentation of the contrib package and point to that – that should prevent link rot.

Overall, the PR looks good to me; I'm especially in favour of the contrib subpackage, which allows users to just plainly ignore this and keep using sway as they used to 🙂

That was the idea since someone mentioned in a previous conversation that we'd want to make this optional.
Note: Recommends is still pretty much broken at the moment as dnf will offer to install recommended deps whenever the main package is changed (rhbz#1699672). At a certain point i started thinking that we need a Fedora-specific documentation page for things like that (i.e. how to deal with unwanted recommends, what we do different from upstream config, etc).

The more complex parts of the configuration (the systemd integration snippets especially) would greatly benefit from more documentations. I know there is a comment already, but it explains what is happening and not really why it is happening. I would suggest to at least put some of the relevant "additional reading" links directly as comments to the snippets.

That sounds reasonable. I'll expand the comments.

Even better, since the systemd snippets are already being taken from sway wiki, let's include the whole page (in markdown format) as documentation of the contrib package and point to that – that should prevent link rot.

systemd snippets are compiled from multiple sources. The systemd integration wiki page is mostly focused on a sway-as-a-user-service approach which I neither use nor endorse and I feel that adding it verbatim may mislead users. I wouldn't mind adding the FAQ page from wiki into the package docs though.

systemd snippets are compiled from multiple sources. The systemd integration wiki page is mostly focused on a sway-as-a-user-service approach which I neither use nor endorse and I feel that adding it verbatim may mislead users.

I missed that during cursory reading, it seemed that all that came from the single page – my bad.
In that case, do what you feel it's best.

My original idea was something along the lines of „since we already provide snippets from wiki page(s), let's also provide/point the user to the source(s)“. With a single wiki page, it looked simple enough to just use it as is 🙂

Change of plans, I guess.

I moved all the systemd bits to https://github.com/alebastr/sway-systemd and added my script to deal with Changes/EnableSystemdOomd. Expanded comments are also included :smile: .

The new sway-systemd package is available at copr:alebastr/sway-extras/package/sway-systemd.
Systemd-oomd script is only installed for f34+ though, so rebuild the package from git repo with rpkg --path srpm local --with cgroups if you want to test that part on f33.

The current plan is to make sure that the code works, submit the package to Fedora and add Recommends: sway-systemd to the sway.spec. Inviting other distributions' maintainers to participate is also an important part of the plan.

Code reviews and testing would be appreciated!

3 new commits added

  • Add 'Recommends: sway-systemd'
  • Add subpackage for contrib/grimshot screenshot tool
  • Recommend wayland backend for Qt
3 years ago

Ready for review.

New package reviews:

Since my previous posting sway-systemd got a lot of new text in the README.md (and very few code changes).

I assume that by now everyone interested had a chance to review. It's time to merge, close some bugs and free my workspace for 1.6-rc1 work.

Pull-Request has been merged by alebastr

3 years ago