diff --git a/modules/home-manager/common.nix b/modules/home-manager/common.nix index 4600d9d..13f8dfe 100644 --- a/modules/home-manager/common.nix +++ b/modules/home-manager/common.nix @@ -70,71 +70,6 @@ source = ./scripts; recursive = true; }; - - ".local/share/scripts/hyprland/start_services.sh" = { - executable = true; - text = # sh - '' - #!/bin/sh - - # - # Make sure xdg-desktop-portal-hyprland has access to what it needs - # - dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP & - - # - # Start waybar. - # - waybar & - - # - # Start xwaylandvideobridge - # - xwaylandvideobridge & - - - # - # Start wallpaper daemon - # - ~/.local/share/scripts/wallpaper.sh & - - # - # Start notification daemon. - # - mako & - - # - # Start polkit agent - # - ${pkgs.libsForQt5.polkit-kde-agent}/libexec/polkit-kde-authentication-agent-1 - - # - # Start kwallet service - # - kwalletd6 & - - # - # Start kdeconnect daemon - # - kdeconnectd & - - # - # Clipboard manager - # - wl-paste --type text --watch cliphist store & - wl-paste --type image --watch cliphist store & - - # - # Start Fcitx5 - # - fcitx5 & - - # - # Start the blueman applet for managing bluetooth devices - # - blueman-applet & - ''; - }; }; # Configure XDG diff --git a/modules/home-manager/programs/hyprland/default.nix b/modules/home-manager/programs/hyprland/default.nix index aeca597..a409aa8 100644 --- a/modules/home-manager/programs/hyprland/default.nix +++ b/modules/home-manager/programs/hyprland/default.nix @@ -1,15 +1,30 @@ -{ config, lib, ... }: - { - options.modules.hyprland.extraConfig = lib.mkOption { - type = lib.types.str; - default = ""; - example = # hyprlang - '' - monitor = DP-3, 1920x1080@74.973, 2560x0, 1 - monitor = DP-2, 2560x1440@165.00301, 0x0, 1 - ''; - description = "Configuration to be appended to my own."; + config, + lib, + pkgs, + ... +}: + +let + cfg = config.modules.hyprland; +in +{ + options.modules.hyprland = { + extraConfig = lib.mkOption { + type = lib.types.str; + default = ""; + example = # hyprlang + '' + monitor = DP-3, 1920x1080@74.973, 2560x0, 1 + monitor = DP-2, 2560x1440@165.00301, 0x0, 1 + ''; + description = "Configuration to be appended to my own."; + }; + + scripts = { + screenshot.enable = lib.mkEnableOption "screenshot"; + startup.enable = lib.mkEnableOption "startup"; + }; }; config = { @@ -138,11 +153,23 @@ ''; }; + # Set-up the scripts for services and apps. + home.packages = lib.mkIf cfg.scripts.startup.enable [ + (import ./scripts/start_services.nix pkgs) + (import ./scripts/start_apps.nix pkgs) + ]; + + # Then add the hyprland screenshot scripts. + xdg.dataFile = lib.mkIf cfg.scripts.screenshot.enable { + "scripts/hyprland/screenshot.sh".source = ./scripts/screenshot.sh; + "scripts/hyprland/screenshot_area.sh".source = ./scripts/screenshot_area.sh; + }; + # Configure hyprland - we enable it in NixOS. xdg.configFile."hypr/hyprland.conf".text = # hyprlang '' source = $HOME/.config/hypr/frappe.conf - ${config.modules.hyprland.extraConfig} + ${cfg.extraConfig} # # Please note not all available settings / options are set here. @@ -157,10 +184,10 @@ exec-once = /etc/profiles/per-user/wizardlink/etc/profile.d/hm-session-vars.sh # Start the core services of my desktop - exec-once = ~/.local/share/scripts/hyprland/start_services.sh + exec-once = start_services # Open the apps I always use - exec-once = ~/.local/share/scripts/hyprland/start_apps.sh + exec-once = start_apps # Set cursor size. env = HYPRCURSOR_SIZE, 36 diff --git a/modules/home-manager/scripts/hyprland/screenshot.sh b/modules/home-manager/programs/hyprland/scripts/screenshot.sh similarity index 100% rename from modules/home-manager/scripts/hyprland/screenshot.sh rename to modules/home-manager/programs/hyprland/scripts/screenshot.sh diff --git a/modules/home-manager/scripts/hyprland/screenshot_area.sh b/modules/home-manager/programs/hyprland/scripts/screenshot_area.sh similarity index 100% rename from modules/home-manager/scripts/hyprland/screenshot_area.sh rename to modules/home-manager/programs/hyprland/scripts/screenshot_area.sh diff --git a/modules/home-manager/programs/hyprland/scripts/start_apps.nix b/modules/home-manager/programs/hyprland/scripts/start_apps.nix new file mode 100755 index 0000000..27740d5 --- /dev/null +++ b/modules/home-manager/programs/hyprland/scripts/start_apps.nix @@ -0,0 +1,15 @@ +pkgs: + +pkgs.writeShellScriptBin "start_apps" '' + # Open qbittorrent + qbittorrent & + + # Open vesktop + vesktop & + + # Open steam + steam & + + # Open firefox + firefox +'' diff --git a/modules/home-manager/programs/hyprland/scripts/start_services.nix b/modules/home-manager/programs/hyprland/scripts/start_services.nix new file mode 100644 index 0000000..367a16f --- /dev/null +++ b/modules/home-manager/programs/hyprland/scripts/start_services.nix @@ -0,0 +1,59 @@ +pkgs: + +pkgs.writeShellScriptBin "start_services" '' + # + # Make sure xdg-desktop-portal-hyprland has access to what it needs + # + dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP & + + # + # Start waybar. + # + waybar & + + # + # Start xwaylandvideobridge + # + xwaylandvideobridge & + + + # + # Start wallpaper daemon + # + ~/.local/share/scripts/wallpaper.sh & + + # + # Start notification daemon. + # + mako & + + # + # Start polkit agent + # + ${pkgs.libsForQt5.polkit-kde-agent}/libexec/polkit-kde-authentication-agent-1 & + + # + # Start kwallet service + # + kwalletd6 & + + # + # Start kdeconnect daemon + # + kdeconnectd & + + # + # Start Fcitx5 + # + fcitx5 & + + # + # Start the blueman applet for managing bluetooth devices + # + blueman-applet & + + # + # Clipboard manager + # + ${pkgs.wl-clipboard}/bin/wl-paste --watch cliphist store & +'' diff --git a/modules/home-manager/scripts/hyprland/start_apps.sh b/modules/home-manager/scripts/hyprland/start_apps.sh deleted file mode 100755 index f4dca8b..0000000 --- a/modules/home-manager/scripts/hyprland/start_apps.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -# Open qbittorrent -qbittorrent & - -# Open vesktop -vesktop & - -# Open steam -steam & - -# Open firefox -firefox