{
  config,
  pkgs,
  myConfig,
  ...
}: {
  home.packages = [
    # TODO: will rewrite later
    (pkgs.writeShellScriptBin "tte-loop" ''
      trap 'printf "\e[?25h"; exit 0' INT
      printf '\e[?25l'
      effects=(beams binarypath blackhole bouncyballs bubbles burn colorshift crumble decrypt errorcorrect expand fireworks highlight laseretch matrix middleout orbittingvolley overflow pour print rain randomsequence rings scattered slice slide spotlights spray swarm sweep synthgrid unstable vhstape waves wipe)
      while true; do
        clear
        cols=$(tput cols)
        lines=$(tput lines)
        effect="''${effects[RANDOM % ''${#effects[@]}]}"
        printf '\e[?25l'
        ${pkgs.terminaltexteffects}/bin/tte --input-file ${config.home.homeDirectory}/.config/nixos/assets/branding.txt --anchor-canvas c --anchor-text c --canvas-width "$cols" --canvas-height "$((lines-2))" --frame-rate 120 "$effect"
        printf '\e[?25l'
        sleep 2
      done
    '')
    (pkgs.writeShellScriptBin "tte-screensaver" ''
      # Get all monitors
      monitors=$(${pkgs.hyprland}/bin/hyprctl monitors -j | ${pkgs.jq}/bin/jq -r '.[].name')

      # Launch ghostty on each monitor one at a time
      for monitor in $monitors; do
        ${pkgs.hyprland}/bin/hyprctl dispatch focusmonitor "$monitor"
        sleep 0.3
        ${pkgs.ghostty}/bin/ghostty --config-file=${config.home.homeDirectory}/.config/ghostty/screensaver --fullscreen -e tte-loop &
        sleep 1
      done

      # Monitor for any input and exit when detected
      ${pkgs.libinput}/bin/libinput debug-events 2>/dev/null | head -n 1 >/dev/null

      # Input detected, kill all screensaver instances
      ${pkgs.procps}/bin/pkill -f "ghostty.*tte-loop"
    '')
  ];

  home.file.".config/ghostty/screensaver".text = ''
    window-padding-x = 0
    window-padding-y = 0
    window-padding-color = "extend-always"
  '';
  programs.ghostty = {
    enable = true;
    package =
      if pkgs.stdenv.isDarwin
      then pkgs.ghostty-bin
      else pkgs.ghostty;
    enableFishIntegration = true;

    settings = {
      font-family = myConfig.terminal.font;
      confirm-close-surface = false;
      app-notifications = false;
      window-padding-x = 15;
      window-padding-y = 15;
      window-padding-balance = true;
      gtk-titlebar = false;
      mouse-hide-while-typing = true;
      copy-on-select = "clipboard";
      auto-update = "off";
    };
  };

  wayland.windowManager.hyprland.settings.bindd = [
    "SUPER, P, Toggle Preload, togglespecialworkspace, preload"
    "SUPER SHIFT, P, Move to Preload Special Workspace, movetoworkspace, special:preload"
  ];

  wayland.windowManager.hyprland.settings.exec-once = [
    "[workspace special:preload silent] uwsm app -- xdg-terminal-exec"
    "[workspace 1] uwsm app -- ghostty -e bash -c 'fastfetch; exec $SHELL'" # TODO: must be xdg-terminal-exec, or default user terminal
  ];
}
