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

nixos/gnome3: add GNOME Flashback sessions option #53695

Merged
merged 1 commit into from Jan 21, 2019

Conversation

@chpatrick
Copy link
Contributor

chpatrick commented Jan 9, 2019

Motivation for this change

This allows you to enable GNOME Flashback sessions with a custom window manager.

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)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@chpatrick chpatrick requested a review from Infinisil as a code owner Jan 9, 2019

@chpatrick

This comment has been minimized.

Copy link
Contributor Author

chpatrick commented Jan 9, 2019

I'm not totally sure about the organization. Maybe gnome-flashback-session should be in gnome-flashback's passthru?

@jtojnar jtojnar requested a review from hedning Jan 9, 2019

@chpatrick chpatrick force-pushed the chpatrick:gnome-flashback-session branch 2 times, most recently from e26a011 to 4842da7 Jan 9, 2019

@chpatrick

This comment has been minimized.

Copy link
Contributor Author

chpatrick commented Jan 9, 2019

Done, please take a look

export XDG_CURRENT_DESKTOP="GNOME-Flashback:GNOME"
fi
exec ${gnome3.gnome-session}/bin/gnome-session --session=gnome-flashback-${wmName} "$@"

This comment has been minimized.

Copy link
@jtojnar

jtojnar Jan 9, 2019

Contributor

Maybe add an option for extra arguments like the acceleration disablement.

This comment has been minimized.

Copy link
@chpatrick

chpatrick Jan 10, 2019

Author Contributor

It works for me without it and it's not a documented gnome-session flag so I think we should add it if someone needs it.

This comment has been minimized.

@chpatrick chpatrick force-pushed the chpatrick:gnome-flashback-session branch from 4842da7 to 6f18572 Jan 10, 2019

@chpatrick

This comment has been minimized.

Copy link
Contributor Author

chpatrick commented Jan 11, 2019

Hmm on my desktop it doesn't work yet because /nix/store/gnome-panel-.../share/applications isn't in some PATH. Do you know where I should add it?

@jtojnar

This comment has been minimized.

Copy link
Contributor

jtojnar commented Jan 11, 2019

That should go to XDG_DATA_DIRS and that is what wrapGAppsHook with

  preFixup = ''
    gappsWrapperArgs+=(
      # Session file requirements (for finding desktop files)
      --prefix XDG_DATA_DIRS : "${gnome-panel}/share"
    )
  '';

would do. But that is pretty pointless use of wrapGAppsHook.

I suggest that you just add the XDG_DATA_DIRS for the required desktop files into the session script like in the initial gist, and move wrapGAppsHook to the gnome-flashback package for finding the GSettings schemas.

@chpatrick chpatrick force-pushed the chpatrick:gnome-flashback-session branch from 6f18572 to f25a7c0 Jan 11, 2019

@chpatrick

This comment has been minimized.

Copy link
Contributor Author

chpatrick commented Jan 11, 2019

OK, please take a look.

@chpatrick chpatrick force-pushed the chpatrick:gnome-flashback-session branch from f25a7c0 to 1552624 Jan 11, 2019

@chpatrick chpatrick force-pushed the chpatrick:gnome-flashback-session branch from 1552624 to f143ca7 Jan 13, 2019

@chpatrick

This comment has been minimized.

Copy link
Contributor Author

chpatrick commented Jan 13, 2019

I got it working with writeScript and co. I also needed to make some .desktop Execs absolute for it to work properly. Please take a look.

@chpatrick chpatrick force-pushed the chpatrick:gnome-flashback-session branch from f143ca7 to 869245c Jan 14, 2019

@hedning
Copy link
Contributor

hedning left a comment

Looks fine to me.

@jtojnar

This comment has been minimized.

Copy link
Contributor

jtojnar commented Jan 19, 2019

I tried running

{ pkgs, config, ... }: {
  services.xserver = {
    displayManager.gdm = {
      enable = true;
      debug = true;
    };
    desktopManager.gnome3 = {
      enable = true;
      debug = true;
      flashback.enableMetacity = true;
    };
  };
}

in a VM and found two issues:

  1. The Applications menu is empty. We probably need either

    environment.systemPackages = [ pkgs.gnome3.gnome-menus ];
    environment.pathsToLink = [ "/share/desktop-directories" ];
    

    or better yet

      preFixup = ''
        gappsWrapperArgs+=(
          --prefix XDG_DATA_DIRS : "${gnome-menus}/share"
        )
      '';
    

    in gnome-panel

  2. I cannot lock the screen:

    Jan 19 01:00:48 nixos .gnome-panel-wr[1180]: Could not ask screensaver to lock: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.ScreenSaver was not provided by any .service files
    

    Packaging gnome-screensaver and adding it to dbus.packages will be needed to support this.

@jtojnar

This comment has been minimized.

Copy link
Contributor

jtojnar commented Jan 19, 2019

It also might be nice to be enable gnome-flashback without gnome-shell. Maybe we could move most of the gnome3.nix to gnome-common.nix and then have gnome3.nix and gnome-flashback only containing enable and their own specific flags in, along with imports = [ ./gnome-common.nix ];.

@jtojnar

This comment has been minimized.

Copy link
Contributor

jtojnar commented Jan 19, 2019

  preFixup = ''
    gappsWrapperArgs+=(
      --prefix XDG_DATA_DIRS : "${gnome-menus}/share:${gnome-flashback}/share"
      --prefix XDG_CONFIG_DIRS : "${gnome-menus}/etc/xdg:${gnome-flashback}/etc/xdg"
    )
  '';

seems to fix it.

@chpatrick

This comment has been minimized.

Copy link
Contributor Author

chpatrick commented Jan 20, 2019

I'm working on packaging gnome-screensaver. While I do that, what do you think about opinionatedly replacing gnome-screensaver with xscreensaver? gnome-screensaver is deprecated and seems to need a lot of patches to get it to work properly (at least on Ubuntu). This shows how it's possible to do it.

@chpatrick chpatrick force-pushed the chpatrick:gnome-flashback-session branch from 869245c to 8759716 Jan 20, 2019

@chpatrick

This comment has been minimized.

Copy link
Contributor Author

chpatrick commented Jan 20, 2019

OK I got it working with gnome-screensaver and also fixed the panel. Please take a look.

# Find out where the session service file goes
# The sad sed hack is recomended by section 27.10 of the automake manual.
-DBUS_SESSION_SERVICE_DIR=`pkg-config --variable session_bus_services_dir dbus-1 | sed -e 's,/usr/share,${datarootdir},g'`
+DBUS_SESSION_SERVICE_DIR=${datarootdir}/dbus-1/services

This comment has been minimized.

Copy link
@jtojnar

jtojnar Jan 21, 2019

Contributor

You can use PKG_CONFIG_DBUS_1_SESSION_BUS_SERVICES_DIR = "${placeholder "out"}/share/dbus-1/services"; in the expression.

This comment has been minimized.

Copy link
@chpatrick

chpatrick Jan 21, 2019

Author Contributor

I don't understand what that's for, I want to set the path directly instead of using the sed hack.

This comment has been minimized.

Copy link
@jtojnar

jtojnar Jan 21, 2019

Contributor

The sed hack will not do anything on Nix, as we do not use /usr/share prefix. Instead, we can override the path returned by pkg-config --variable session_bus_services_dir dbus-1 using the aforementioned environment variable, avoiding the need to patch the configure script.

This comment has been minimized.

Copy link
@chpatrick

chpatrick Jan 21, 2019

Author Contributor

The pkgconfig + sed hack is introduced by the Ubuntu patch that adds the dbus service. As you said it doesn't work, so I just replace it with the correct path directly. I don't see why changing what pkg-config returns would help.

This comment has been minimized.

Copy link
@chpatrick

chpatrick Jan 21, 2019

Author Contributor

I don't understand why pkg-config needs to be involved at all. This is the original patch:

https://git.launchpad.net/ubuntu/+source/gnome-screensaver/tree/debian/patches/05_dbus_service.patch?h=ubuntu/cosmic#n12

This comment has been minimized.

Copy link
@jtojnar

jtojnar Jan 21, 2019

Contributor

Well, the sed will not bother us with the environment variable set:

$ env PKG_CONFIG_DBUS_1_SESSION_BUS_SERVICES_DIR='${placeholder "out"}/share/dbus-1/services' pkg-config --variable session_bus_services_dir dbus-1 | sed -e 's,/usr/share,${datarootdir},g'
${placeholder "out"}/share/dbus-1/services

This comment has been minimized.

Copy link
@chpatrick

chpatrick Jan 21, 2019

Author Contributor

OK, in that case isn't it best to patch in the correct solution you described? I've pushed that now.

This comment has been minimized.

Copy link
@jtojnar

jtojnar Jan 21, 2019

Contributor

That would work too, though I would prefer to minimize the number of patches. It is messy enough as is, and there are much more patches than other distros have:

https://git.archlinux.org/svntogit/community.git/tree/trunk?h=packages/gnome-screensaver
https://salsa.debian.org/gnome-team/gnome-screensaver/tree/debian/master/debian/patches

This comment has been minimized.

Copy link
@jtojnar

jtojnar Jan 21, 2019

Contributor

I guess we might want to switch to Arch’s patchset, as it is much closer to our philosophy. With Ubuntu, it is hard to tell which patches are Ubuntu specific, only needed due to patches of some other component (24 looks like that).

This comment has been minimized.

Copy link
@chpatrick

chpatrick Jan 21, 2019

Author Contributor

24 is also in the Arch patches: https://git.archlinux.org/svntogit/community.git/tree/trunk/use-screensaver-background.patch?h=packages/gnome-screensaver

The enabled Ubuntu patches all seem to be bugfixes not present in the other distros, I think it would be a good idea to have them. I think if we want to really get it right we should support xscreensaver since this package is old and deprecated, but let's do that in another PR.

@jtojnar

This comment has been minimized.

Copy link
Contributor

jtojnar commented Jan 21, 2019

Creating a DBus interface for xscreensaver could work, though maybe we would need to implement the other methods too.

@chpatrick chpatrick force-pushed the chpatrick:gnome-flashback-session branch from 8759716 to c5cd572 Jan 21, 2019

@chpatrick

This comment has been minimized.

Copy link
Contributor Author

chpatrick commented Jan 21, 2019

Let's just do what upstream does with gnome-screensaver for now and merge this if possible. We can make another PR to add xscreensaver support.

@chpatrick chpatrick force-pushed the chpatrick:gnome-flashback-session branch from c5cd572 to cca2643 Jan 21, 2019

@GrahamcOfBorg GrahamcOfBorg requested a review from jtojnar Jan 21, 2019

@jtojnar

This comment has been minimized.

Copy link
Contributor

jtojnar commented Jan 21, 2019

By the way, do we care about running Flashback without having GNOME Shell installed?

@chpatrick chpatrick force-pushed the chpatrick:gnome-flashback-session branch from cca2643 to b25095b Jan 21, 2019

@chpatrick

This comment has been minimized.

Copy link
Contributor Author

chpatrick commented Jan 21, 2019

By the way, do we care about running Flashback without having GNOME Shell installed?

I guess it could be useful, but I'd like to merge this first since it works now and separating the two would be quite a big change. If there's demand for it we can make another PR.

@jtojnar

This comment has been minimized.

Copy link
Contributor

jtojnar commented Jan 21, 2019

Works for me, thanks for your work.

@jtojnar jtojnar merged commit dd3626c into NixOS:master Jan 21, 2019

10 checks passed

grahamcofborg-eval ^.^!
Details
grahamcofborg-eval-check-maintainers matching changed paths to changed attrs...
Details
grahamcofborg-eval-check-meta config.nix: checkMeta = true
Details
grahamcofborg-eval-nixos-manual nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./nixos/release.nix -A manual
Details
grahamcofborg-eval-nixos-options nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./nixos/release.nix -A options
Details
grahamcofborg-eval-nixpkgs-manual nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./pkgs/top-level/release.nix -A manual
Details
grahamcofborg-eval-nixpkgs-tarball nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./pkgs/top-level/release.nix -A tarball
Details
grahamcofborg-eval-nixpkgs-unstable-jobset nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./pkgs/top-level/release.nix -A unstable
Details
grahamcofborg-eval-package-list nix-env -qa --json --file .
Details
grahamcofborg-eval-package-list-no-aliases nix-env -qa --json --file . --arg config { allowAliases = false; }
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.