Commit 4529ed91 authored by OPNA2608's avatar OPNA2608
Browse files

nixosTests.lomiri: Replace wallpaper service with Dconf setting

Still doesn't work in the VM though.
parent d1cef34d
Loading
Loading
Loading
Loading
+17 −47
Original line number Diff line number Diff line
@@ -66,48 +66,12 @@ let
      ''
        magick -size 640x480 canvas:white -pointsize 30 -fill black -annotate +100+100 '${wallpaperText}' $out
      '';
  # gsettings tool with access to wallpaper schema
  lomiri-gsettings =
    pkgs:
    pkgs.stdenv.mkDerivation {
      name = "lomiri-gsettings";
      dontUnpack = true;
      nativeBuildInputs = with pkgs; [
        glib
        wrapGAppsHook3
      ];
      buildInputs = with pkgs; [
        # Not using the Lomiri-namespaced setting yet
        # lomiri.lomiri-schemas
        gsettings-desktop-schemas
      ];
      installPhase = ''
        runHook preInstall
        mkdir -p $out/bin
        ln -s ${pkgs.lib.getExe' pkgs.glib "gsettings"} $out/bin/lomiri-gsettings
        runHook postInstall
      '';

  lomiriWallpaperDconfSettings = pkgs: {
    settings = {
      "org/gnome/desktop/background" = {
        picture-uri = "file://${wallpaperFile pkgs}";
      };
  setLomiriWallpaperService =
    pkgs:
    let
      lomiriServices = [
        "lomiri.service"
        "lomiri-full-greeter.service"
        "lomiri-full-shell.service"
        "lomiri-greeter.service"
        "lomiri-shell.service"
      ];
    in
    rec {
      description = "Set Lomiri wallpaper to something OCR-able";
      wantedBy = lomiriServices;
      before = lomiriServices;
      serviceConfig = {
        Type = "oneshot";
        # Not using the Lomiri-namespaed settings yet
        # ExecStart = "${lomiri-gsettings pkgs}/bin/lomiri-gsettings set com.lomiri.Shell background-picture-uri file://${wallpaperFile pkgs}";
        ExecStart = "${lomiri-gsettings pkgs}/bin/lomiri-gsettings set org.gnome.desktop.background picture-uri file://${wallpaperFile pkgs}";
    };
  };

@@ -413,12 +377,14 @@ in
            ];
          };

          programs.dconf.profiles.user.databases = [
            (lomiriWallpaperDconfSettings pkgs)
          ];

          # Help with OCR
          systemd.tmpfiles.settings = {
            "10-lomiri-test-setup" = terminalOcrTmpfilesSetup { inherit pkgs lib config; };
          };

          systemd.user.services.set-lomiri-wallpaper = setLomiriWallpaperService pkgs;
        };

      enableOCR = true;
@@ -562,12 +528,14 @@ in
            ];
          };

          programs.dconf.profiles.user.databases = [
            (lomiriWallpaperDconfSettings pkgs)
          ];

          # Help with OCR
          systemd.tmpfiles.settings = {
            "10-lomiri-test-setup" = terminalOcrTmpfilesSetup { inherit pkgs lib config; };
          };

          systemd.user.services.set-lomiri-wallpaper = setLomiriWallpaperService pkgs;
        };

      enableOCR = true;
@@ -710,7 +678,9 @@ in

            environment.etc."${wallpaperName}".source = wallpaperFile pkgs;

            systemd.user.services.set-lomiri-wallpaper = setLomiriWallpaperService pkgs;
            programs.dconf.profiles.user.databases = [
              (lomiriWallpaperDconfSettings pkgs)
            ];

            # Help with OCR
            systemd.tmpfiles.settings = {