Files
nixos/apps/ghostty/default.nix
T

72 lines
2.4 KiB
Nix

{
config,
pkgs,
...
}: {
home.packages = [
# TODO: will rewrite later
(pkgs.writeShellScriptBin "tte-loop" ''
trap 'exit 0' INT
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
lines=$(tput lines)
effect="''${effects[RANDOM % ''${#effects[@]}]}"
${pkgs.terminaltexteffects}/bin/tte --input-file ${config.home.homeDirectory}/.config/nixos/assets/branding.txt --anchor-canvas c --anchor-text c --canvas-width 0 --canvas-height "$((lines - 2))" --frame-rate 240 "$effect"
sleep 2
done
'')
(pkgs.writeShellScriptBin "tte-screensaver" ''
exit_screensaver() {
${pkgs.hyprland}/bin/hyprctl keyword cursor:inactive_timeout 0
${pkgs.procps}/bin/pkill -x tte 2>/dev/null
${pkgs.procps}/bin/pkill -f "ghostty.*tte-loop" 2>/dev/null
exit 0
}
trap exit_screensaver SIGINT SIGTERM SIGHUP SIGQUIT
# Hide cursor
${pkgs.hyprland}/bin/hyprctl keyword cursor:inactive_timeout 1
# 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
exit_screensaver
'')
];
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 = {
confirm-close-surface = false;
app-notifications = false;
window-padding-x = 15;
window-padding-y = 15;
window-padding-balance = true;
};
};
}