From 41106623e83720373cd1c5c4f0603d28951141fa Mon Sep 17 00:00:00 2001 From: Natsu Kagami Date: Tue, 25 Jun 2024 20:24:48 +0200 Subject: [PATCH] Move sway startups to desktop files --- home/kagami-pc-home.nix | 1 + home/modules/linux/graphical/default.nix | 27 +++++++++-------------- home/modules/programs/my-sway/default.nix | 16 +------------- overlay.nix | 20 ++++++++++++++++- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/home/kagami-pc-home.nix b/home/kagami-pc-home.nix index 0eb1ed7..0218c17 100644 --- a/home/kagami-pc-home.nix +++ b/home/kagami-pc-home.nix @@ -37,6 +37,7 @@ # Enable X11 configuration linux.graphical.type = "wayland"; linux.graphical.wallpaper = ./images/pixiv_18776904.png; + linux.graphical.defaults.webBrowser = "librewolf.desktop"; programs.my-sway.enable = true; programs.my-sway.fontSize = 15.0; programs.my-sway.enableLaptopBars = false; diff --git a/home/modules/linux/graphical/default.nix b/home/modules/linux/graphical/default.nix index 2e37121..e4916e2 100644 --- a/home/modules/linux/graphical/default.nix +++ b/home/modules/linux/graphical/default.nix @@ -33,11 +33,16 @@ in startup = mkOption { type = types.listOf types.package; description = "List of packages to include in ~/.config/autostart"; - default = [ ]; + default = with pkgs; [ + librewolf + thunderbird + vesktop + premid + ]; }; defaults.webBrowser = mkOption { type = types.str; - default = "firefox.desktop"; + default = "librewolf.desktop"; description = "Desktop file of the default web browser"; }; }; @@ -52,7 +57,6 @@ in feh # For images? deluge # Torrent client pavucontrol # PulseAudio control panel - firefox cinnamon.nemo # File manager thunderbird # Email sublime-music # For navidrome @@ -72,9 +76,7 @@ in whatsapp-for-linux obs-studio - (librewolf.override { - nativeMessagingHosts = with pkgs; [ kdePackages.plasma-browser-integration ]; - }) + librewolf ## CLI stuff dex # .desktop file management, startup @@ -88,12 +90,7 @@ in ])); nki.programs.discord.enable = pkgs.stdenv.isx86_64; - nki.programs.discord.package = pkgs.vesktop.overrideAttrs (attrs: { - nativeBuildInputs = attrs.nativeBuildInputs ++ [ pkgs.nss_latest pkgs.makeWrapper ]; - postFixup = (attrs.postFixup or "") + '' - ln -s $out/bin/vesktop $out/bin/discord - ''; - }); + nki.programs.discord.package = pkgs.vesktop; # Yellow light! services.wlsunset = { @@ -223,10 +220,8 @@ in source = let srcFile = pkgs.runCommand "${pkg.name}-startup" { } '' - mkdir - p $out - cp $ - (ls - d ${ - pkg}/share/applications/*.desktop | head -n 1) $out/${pkg.name}.desktop + mkdir -p $out + cp $(ls -d ${pkg}/share/applications/*.desktop | head -n 1) $out/${pkg.name}.desktop ''; in "${srcFile}/${pkg.name}.desktop"; diff --git a/home/modules/programs/my-sway/default.nix b/home/modules/programs/my-sway/default.nix index aecb47c..801dd11 100644 --- a/home/modules/programs/my-sway/default.nix +++ b/home/modules/programs/my-sway/default.nix @@ -78,11 +78,6 @@ in description = "The command for the browser"; default = "${pkgs.firefox-wayland}/bin/firefox"; }; - discord = mkOption { - type = types.nullOr types.str; - description = "The command for discord"; - default = "${config.nki.programs.discord.package}/bin/discord"; - }; lockCmd = mkOption { type = types.str; @@ -164,18 +159,9 @@ in { command = "${pkgs.dex}/bin/dex -ae sway"; } # Waybar { command = "systemctl --user restart waybar"; always = true; } - # Startup programs - { command = "${cfg.browser}"; } - { command = "thunderbird"; } # IME { command = "fcitx5"; } - ] ++ (if cfg.discord != null then [ - { command = "${cfg.discord}"; } - ] ++ lib.lists.optional - (!pkgs.stdenv.isAarch64) - ( - { command = "${pkgs.premid}/bin/premid"; } - ) else [ ]); + ]; ### Keybindings # diff --git a/overlay.nix b/overlay.nix index 8ee8fa6..ed78a82 100644 --- a/overlay.nix +++ b/overlay.nix @@ -68,10 +68,28 @@ let }) ]; }); + + librewolf = (prev.librewolf.override { + nativeMessagingHosts = with final; [ kdePackages.plasma-browser-integration ]; + }); + + # Add desktop file to premid + premid = final.symlinkJoin { + name = prev.premid.name; + paths = [ + prev.premid + (final.makeDesktopItem { + name = prev.premid.name; + desktopName = "PreMID"; + exec = final.lib.getExe prev.premid; + icon = "premid"; + }) + ]; + }; }; overlay-libs = final: prev: { - libs.crane = inputs.crane.lib.${prev.system}; + libs.crane = inputs.crane.mkLib final; }; overlay-packages = final: prev: {