From 7b80013e7474ac3dcfe7f3f9d92e04bfe12e3091 Mon Sep 17 00:00:00 2001 From: Tigor Hutasuhut Date: Sun, 20 Oct 2024 11:03:56 +0700 Subject: [PATCH] hyprland: split some config to its own module --- home/modules/hyprland/hyprland.nix | 5 ----- home/modules/hyprland/pyprland.nix | 8 ++++++-- home/modules/hyprland/waybar.nix | 1 + home/programs/whatsapp.nix | 33 +++--------------------------- profiles/castle.nix | 5 ++++- 5 files changed, 14 insertions(+), 38 deletions(-) diff --git a/home/modules/hyprland/hyprland.nix b/home/modules/hyprland/hyprland.nix index 9a760ea..1d48f8e 100644 --- a/home/modules/hyprland/hyprland.nix +++ b/home/modules/hyprland/hyprland.nix @@ -197,16 +197,11 @@ in extraConfig = /*hyprlang*/ '' exec-once=foot --server - exec-once=swww-daemon - exec-once=bash -c "sleep 10; hypridle" - exec-once=waybar exec-once=nm-applet exec-once=pasystray source=${config.home.homeDirectory}/.cache/wallust/hyprland.conf - exec-once=sleep 0.2 && swww img ${config.home.homeDirectory}/.cache/wallpaper/current - exec-once=bash -c "sleep 10; until ping -c 1 web.whatsapp.com; do sleep 1; done; whatsapp-for-linux" exec-once=bash -c "sleep 10; until ping -c 1 discord.com; do sleep 1; done; discord" exec-once=bash -c "sleep 10; until ping -c 1 google.com; do sleep 1; done; slack" exec-once=bash -c "sleep 10; until ping -c 1 nextcloud.tigor.web.id; do sleep 1; done; nextcloud --background" diff --git a/home/modules/hyprland/pyprland.nix b/home/modules/hyprland/pyprland.nix index e062a0f..6dfb5d9 100644 --- a/home/modules/hyprland/pyprland.nix +++ b/home/modules/hyprland/pyprland.nix @@ -22,7 +22,7 @@ in config = lib.mkIf cfg.enable { home.packages = [ unstable.pyprland - unstable.swww + pkgs.swww ]; home.file.".config/hypr/pyprland.toml".source = let @@ -40,7 +40,11 @@ in }; wayland.windowManager.hyprland.settings = { - exec-once = [ "pypr" ]; + exec-once = [ + "pypr" + "swww-daemon" + "sleep 0.2 && swww img ${config.home.homeDirectory}/.cache/wallpaper/current" + ]; bind = [ "$mod, W, exec, pypr wall next" ]; diff --git a/home/modules/hyprland/waybar.nix b/home/modules/hyprland/waybar.nix index 06b5b08..4e3f854 100644 --- a/home/modules/hyprland/waybar.nix +++ b/home/modules/hyprland/waybar.nix @@ -148,6 +148,7 @@ in rofi-wayland ]; wayland.windowManager.hyprland.settings.exec-once = [ + "sleep 1 && waybar" "wl-paste --watch cliphist store" ]; programs.waybar = { diff --git a/home/programs/whatsapp.nix b/home/programs/whatsapp.nix index 06dce79..ad92923 100644 --- a/home/programs/whatsapp.nix +++ b/home/programs/whatsapp.nix @@ -6,35 +6,8 @@ in config = lib.mkIf cfg.enable { home.packages = [ pkgs.whatsapp-for-linux ]; - systemd.user = lib.mkIf cfg.autostart { - services.whatsapp = { - Unit = { - Description = "WhatsApp for Linux"; - Wants = [ "graphical.target" ]; - After = [ "nss-lookup.target" ]; - StartLimitIntervalSec = 300; - StartLimitBurst = 10; - }; - Service = - let - bash = "${pkgs.bash}/bin/bash"; - ping = "${pkgs.unixtools.ping}/bin/ping"; - host = "web.whatsapp.com"; - sleep = "${pkgs.coreutils}/bin/sleep"; - whatsapp = "${pkgs.whatsapp-for-linux}/bin/whatsapp-for-linux"; - exec = ''${bash} -c "until ${ping} -c 1 ${host}; do ${sleep} 1; done; ${whatsapp}"''; - in - { - Type = "simple"; - ExecStartPre = "${sleep} 10"; - ExecStart = exec; - Restart = "on-failure"; - RemainAfterExit = "yes"; - }; - Install = { - WantedBy = [ "default.target" ]; - }; - }; - }; + wayland.windowManager.hyprland.settings.exec-once = lib.mkIf cfg.autostart [ + "sleep 10; until ${pkgs.unixtools.ping}/bin/ping -c 1 web.whatsapp.com; do sleep 1; done; whatsapp-for-linux" + ]; }; } diff --git a/profiles/castle.nix b/profiles/castle.nix index 8a7e05f..b92444d 100644 --- a/profiles/castle.nix +++ b/profiles/castle.nix @@ -50,7 +50,10 @@ in }; discord.enable = true; slack.enable = true; - whatsapp.enable = true; + whatsapp = { + enable = true; + autostart = true; + }; obs.enable = true; avahi.enable = true; steam.enable = true;