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

sway-beta module: add missing pieces #49687

Merged
merged 1 commit into from Nov 4, 2018
Merged

sway-beta module: add missing pieces #49687

merged 1 commit into from Nov 4, 2018

Conversation

ghost
Copy link

@ghost ghost commented Nov 3, 2018

Motivation for this change

Add missing pieces from main module. See comments below.

cc @colemickens @primeos

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Fits CONTRIBUTING.md.

Copy link
Author

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Here are comments on why these changes needed.


swayWrapped = pkgs.writeShellScriptBin "sway" ''
${cfg.extraSessionCommands}
exec ${pkgs.dbus.dbus-launch} --exit-with-session ${swayPackage}/bin/sway
Copy link
Author

Choose a reason for hiding this comment

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

Needed to make dbus dependend programs to work (like libnotify notifications). Also official wiki recommends launching via dbus-launch for one particular case https://github.com/swaywm/sway/wiki#im-not-using-logind-but-still-want-dbuspolkitpower-management-to-work

Copy link
Member

Choose a reason for hiding this comment

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

I just packaged mako in my overlay an hour ago and just noticed it wasn't working.

This patch fixes it. Thanks.

Copy link
Author

@ghost ghost Nov 3, 2018

Choose a reason for hiding this comment

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

@colemickens In case of X program you would also need exec dbus-update-activation-environment DISPLAY in your sway config

export SDL_VIDEODRIVER=wayland
# needs qt5.qtwayland in systemPackages
export QT_QPA_PLATFORM=wayland
export QT_WAYLAND_DISABLE_WINDOWDECORATION="1"
Copy link
Author

Choose a reason for hiding this comment

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

Needed to prepare environment. xkb options moved to sway config in sway-beta, so add another example here. Also mentioned in official wiki https://github.com/swaywm/sway/wiki#disabling-client-side-qt-decorations

Copy link
Member

Choose a reason for hiding this comment

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

xkb options moved to sway config in sway-beta, so add another example here

what do you mean "so add another example here" since it's no longer in the env vars?

Copy link
Author

Choose a reason for hiding this comment

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

extraPackages = mkOption {
type = with types; listOf package;
default = with pkgs; [
xwayland dmenu
xwayland rxvt_unicode dmenu
Copy link
Author

Choose a reason for hiding this comment

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

rxvt_unicode is needed for use with stock config. See ${pkgs.sway-beta}/etc/sway/config

@colemickens
Copy link
Member

LGTM. Fixes at least one problem for me and likely more I didn't know about. Thanks!

Copy link
Member

@primeos primeos left a comment

Choose a reason for hiding this comment

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

Looks good, thanks :)

export SDL_VIDEODRIVER=wayland
# needs qt5.qtwayland in systemPackages
export QT_QPA_PLATFORM=wayland
export QT_WAYLAND_DISABLE_WINDOWDECORATION="1"
Copy link
Member

Choose a reason for hiding this comment

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

Mind adding the following or something similar to the examples (https://github.com/swaywm/sway/wiki/Running-programs-natively-under-wayland#java-under-xwayland)?:

# Fix for some Java AWT applications (e.g. Android Studio),
# use this if they aren't displayed properly:
export _JAVA_AWT_WM_NONREPARENTING=1

Without this e.g. Android-Studio won't be displayed properly (no content is shown after opening a project, only the window itself is visible). (We could also add it to the defaults but I'm not sure if there are any drawbacks.)

Copy link
Author

Choose a reason for hiding this comment

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

@primeos Sure, done!

export QT_WAYLAND_DISABLE_WINDOWDECORATION="1"
# Fix for some Java AWT applications (e.g. Android Studio),
# use this if they aren't displayed properly:
export _JAVA_AWT_WM_NONREPARENTING=1
Copy link
Member

Choose a reason for hiding this comment

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

Is there any reason to not be doing GDK_BACKEND=wayland as well?

Copy link
Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Hm okay. It seems like emersion's most recent edit means that the QT_WAYLAND_DISABLE_WINDOWDECORATION isn't needed either. Or have you observed that it is needed?

Copy link
Author

@ghost ghost Nov 4, 2018

Choose a reason for hiding this comment

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

@colemickens Tested on nixos-unstable. Both settings are still needed:
https://github.com/swaywm/sway/wiki#disabling-client-side-qt-decorations
Don't know why its strikethrough there https://github.com/swaywm/sway/wiki/Running-programs-natively-under-wayland#qt5 Maybe that setting is no more required with recent Qt release we don't have.

@primeos primeos merged commit f319c7f into NixOS:master Nov 4, 2018
@primeos
Copy link
Member

primeos commented Nov 4, 2018

Thanks again :)

BTW: I just noticed that I forgot to check the commit message, according to CONTRIBUTING.md#submitting-changes it should've been "nixos/sway-beta: ...", but it's not really enforced in nixpkgs AFAIK (at least there are many commits without the "nixos/" prefix). It might be something to keep in mind for the next time though (for the consistency).

@ghost
Copy link
Author

ghost commented Nov 4, 2018

@primeos Got it, thanks!

@ghost ghost deleted the sway branch November 4, 2018 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants