Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change all sway references to swayfx #257

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

notpeelz
Copy link

@notpeelz notpeelz commented Dec 26, 2023

Notes:
  • I changed as little as possible to minimize merge conflicts with upstream
  • SWAYSOCK wasn't renamed because it would break e.g python scripts using i3ipc
  • Commands such as swaynag_command are unchanged
  • The project description in the manpage (sway(1)) was updated, hopefully you will find it adequate :)
  • CONTRIBUTING.md was updated to reflect the direction of this project
  • Contributor and author mentions in manpages/documentation were updated
Packages:

AUR: I've tested the AUR packages and use the PKGBUILD on my own machine as a daily driver. I have sway installed side-by-side with swayfx with no conflicts.

RPM: I'm not familiar with RPM. I've updated the spec file to the best of my ability. Untested.

Nix: Unchanged. I don't have a Nix/NixOS environment to test with.

Fixes #191

@notpeelz
Copy link
Author

notpeelz commented Dec 27, 2023

I'm thinking maybe it would be a good idea to rename SWAYSOCK to SWAYFXSOCK after all:

  1. if a program calls sway --get-socketpath, it returns SwayFX's socket path, which could be considered incorrect, as sway isn't running.
  2. tools that integrate with sway might want to check if the user is running SwayFX (and not sway). XDG_CURRENT_DESKTOP is the preferred way to check what compositor the user is running; however, sway doesn't set that environment variable, which becomes the user's responsibility to set it to the correct value (and therefore might be unreliable). Renaming it to SWAYFXSOCK gives programs a more reliable way to determine the "flavor" of sway in use.
  3. SwayFX's IPC might not remain 100% compatible with sway's in the long run
  4. it would allow scenarios where sway is run as a nested compositor on top of SwayFX, without clobbering the environment variable. I've accidentally run sway with the default config at least a couple times... On Arch Linux, the default config sources 50-systemd-user.conf, which updates SWAYSOCK in the systemd environment block, breaking all scripts that make use of swaymsg.
  5. SWAYSOCK is pretty much the only thing remaining that could result in accidental "crosstalk" between compositors.

Copy link
Collaborator

@ErikReider ErikReider left a comment

Choose a reason for hiding this comment

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

Some nits, hopefully the "same here" comments are in the correct order.

Kudos for rewriting some of the texts too! :)

@@ -12,5 +12,5 @@ exec systemctl --user import-environment DISPLAY \
exec hash dbus-update-activation-environment 2>/dev/null && \
dbus-update-activation-environment --systemd DISPLAY \
SWAYSOCK \
XDG_CURRENT_DESKTOP=sway \
XDG_CURRENT_DESKTOP="swayfx:sway:wlroots" \
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does having it colon separated actually work? Will it be detected by the portals conf?

Copy link
Author

Choose a reason for hiding this comment

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

Portals work fine on my end. If I initiate screen sharing from Firefox/Discord, it calls xdp-wlr. Everything else calls xdp-gtk (as defined in swayfx-portals.conf).

The colon-separated list is used by NotShowIn=/OnlyShowIn= in .desktop files: https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html

If $XDG_CURRENT_DESKTOP is set then it contains a colon-separated list of strings. In order, each string is considered. If a matching entry is found in OnlyShowIn then the desktop file is shown. If an entry is found in NotShowIn then the desktop file is not shown. If none of the strings match then the default action is taken (as above).
$XDG_CURRENT_DESKTOP should have been set by the login manager, according to the value of the DesktopNames found in the session file. The entry in the session file has multiple values separated in the usual way: with a semicolon.


_sway()
_swayfx()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't these file names be renamed to swayfx? (all completion files)

Copy link
Author

Choose a reason for hiding this comment

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

I didn't rename any files to avoid creating unnecessary conflicts when pulling from upstream.
The files get renamed by meson at install time (see the changes in meson.build).
e.g completions/bash/sway gets deployed to /usr/share/bash-completion/completions/swayfx

completions/zsh/_sway Show resolved Hide resolved
completions/zsh/_swaymsg Show resolved Hide resolved
Comment on lines +280 to +284
swayfx_zsh_files = [
'_swayfx',
'_swayfxmsg',
]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this be here? Shouldn't zsh_files also be removed then?

Copy link
Author

Choose a reason for hiding this comment

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

swayfx_zsh_files is passed to install_data() a couple lines below. It's used for renaming purposes.

meson.build Show resolved Hide resolved
meson.build Show resolved Hide resolved
sway/sway.1.scd Show resolved Hide resolved
@notpeelz
Copy link
Author

notpeelz commented Jan 13, 2024

Marking as draft until the review is done.

Edit: nevermind, draft PRs can't be reviewed. I thought it just blocked merging lol

pokes @WillPower3309

@notpeelz notpeelz marked this pull request as draft January 13, 2024 20:53
@notpeelz notpeelz marked this pull request as ready for review January 13, 2024 20:55
@mochaaP
Copy link

mochaaP commented Jan 17, 2024

Could we provide distro packages like sway-is-swayfx or swayfx-sway to provide /usr/bin/sway{,msg,nag,bar}? This could break some packages depending on the binaries or the sway package name.

@notpeelz
Copy link
Author

notpeelz commented Jan 18, 2024

I've squashed the fixup commits and added a new subpackage to alias swayfx's versions of sway{,bar,msg,nag}.
I also tried modifying the Fedora spec file, but rpkg was giving me strange errors (tested in a Fedora 39 VM).
Also, rpkg-util is no longer maintained/developed, so we should probably use some other packaging tool (such as fedpkg, dist-git or tito).

@mochaaP
Copy link

mochaaP commented Jan 18, 2024

We usually use fedpkg for day-to-day packaging works. https://docs.fedoraproject.org/en-US/package-maintainers/Package_Maintenance_Guide/#common_fedpkg_commands Hope this helps!

@notpeelz
Copy link
Author

Thanks! I'll look into it.

BTW, if we go forward with the SWAYSOCK rename, the compat packages could ship a config file to alias the environment variable, e.g.

/etc/swayfx/config.d/50-swaysock-compat.conf:

exec systemctl --user set-environment \
  SWAYSOCK="$SWAYFXSOCK" \
  I3SOCK="$SWAYFXSOCK"

@notpeelz notpeelz marked this pull request as draft January 24, 2024 02:40
@notpeelz
Copy link
Author

notpeelz commented Feb 15, 2024

I rebased against the latest changes and got rid of most packaging-related commits.
This should make it easier to review. I plan on submitting the rest of the changes in separate PR(s).

@notpeelz notpeelz marked this pull request as ready for review February 15, 2024 15:44
Breaking changes:
  - path: /etc/sway -> /etc/swayfx
  - path: /etc/swaynag -> /etc/swayfxnag
  - path: $XDG_CONFIG_HOME/sway -> $XDG_CONFIG_HOME/swayfx
  - path: $XDG_CONFIG_HOME/swaynag -> $XDG_CONFIG_HOME/swayfxnag
  - bin: sway -> swayfx
  - bin: swaymsg -> swayfxmsg
  - bin: swaynag -> swayfxnag
  - bin: swaybar -> swayfxbar

Other changes:
  - meson option: swaybar -> swayfxbar
  - meson option: swaynag -> swayfxnag
  - XDG_CURRENT_DESKTOP: sway -> swayfx:sway
@WillPower3309
Copy link
Owner

Hey peelz! Thanks a ton for all the work here and apologies on my end for the delays. I think it's a good call to save the swaysock change for a separate PR as I'd like to have more of a conversation there on if this is something we'd want

Comment on lines -47 to +50
- The current layer namespaces can be shown with `swaymsg -r -t get_outputs | jq '.[0].layer_shell_surfaces | .[] | .namespace'`
- The current layer namespaces can be shown with `swayfxmsg -r -t get_outputs | jq '.[0].layer_shell_surfaces | .[] | .namespace'`
- Example: `layer_effects "waybar" blur enable; shadows enable; corner_radius 6`
- Note: If an application uses gtk, its namespace is likely to be "gtk-layer-shell"
- SwayIPC Example: `swaymsg "layer_effects 'waybar' 'blur enable; shadows enable; corner_radius 6'"`
- SwayIPC Example: `swayfxmsg "layer_effects 'waybar' 'blur enable; shadows enable; corner_radius 6'"`
Copy link
Owner

Choose a reason for hiding this comment

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

not sure how I feel about this one. Do you mind if we save the IPC changes for a follow-up PR? I think we need some more discussion there

Copy link
Contributor

Choose a reason for hiding this comment

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

Same here. I have scripts using the Sway IPC that i can now use in both Sway and SwayFX. The change would mean that i need to change all of them to be only SwayFX compatible. However, if I do want to run Sway instead (development etc) none of my scripts will work and I feel like those negatives are gonna outweigh the (possible) positives.

Copy link
Author

Choose a reason for hiding this comment

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

That defeats the whole point of #191.

There's two options:

  1. we close this PR and keep SwayFX as a drop-in replacement for Sway
  2. we go forward with the rename and make SwayFX independent, allowing it to be installed side-by-side with Sway

If we go forward with the rename, we can't have any packaged files conflicting with upstream.
Splitting up the changes into more PRs is only going to make it harder to complete the migration.

When it comes to "IPC compatibility", you can temporarily symlink the binaries, e.g.: ~/.local/bin/swaymsg -> /usr/bin/swayfxmsg

As I stated in my earlier comments, I had started working on the packaging side of things. Before the rebase, I had a commit (a06a4ab) that added a subpackage to create those symlinks. This would alleviate the friction when switching between SwayFX and Sway.

From what I understand both @RicArch97 and @WillPower3309 use Nix/NixOS, in which case you can create those symlinks in the postInstall step, i.e:

postInstall = (old.postInstall or "") + ''
  for f in "" msg nag bar; do
    ln -sT "swayfx$f" "$out/bin/sway$f"
  done
'';

@@ -12,5 +12,5 @@ exec systemctl --user import-environment DISPLAY \
exec hash dbus-update-activation-environment 2>/dev/null && \
dbus-update-activation-environment --systemd DISPLAY \
SWAYSOCK \
XDG_CURRENT_DESKTOP=sway \
XDG_CURRENT_DESKTOP="swayfx:sway" \
Copy link
Owner

Choose a reason for hiding this comment

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

Q: does this env var play well with having multiple values?

Copy link
Author

Choose a reason for hiding this comment

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

Yep. Erik asked the same question (see previous review).

@WillPower3309
Copy link
Owner

Just a minor comment and a question

@ozwaldorf ozwaldorf mentioned this pull request Apr 5, 2024
@werdahias
Copy link

Allowing side-by-side installing (where no binaries are named the same) with sway would also really ease packaging for debian and in consequence, ubuntu

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.

Change all references from sway, to swayfx
6 participants