Files
nixos/apps/ghostty/default.nix
T
CLAUDE AI 40b7db2c00 fix(hypr): reliable gaming workspace focus across monitors
- Add game-focus-watcher: listens on hyprland socket, auto-focuses
  gaming workspace when a game opens, closing any special workspace
  on DP-1 first via --batch to avoid async dispatch races
- Add gaming-focus script: SUPER+G now handles special workspaces on
  DP-1 regardless of focused monitor, with toggle-back behavior
- Fix steam windowrule to send all class:steam windows to special:steam,
  not just title:Steam, preventing dialogs leaking to normal workspaces
- Fix monitor 0 -> monitor DP-1 in mkGameRules and steam_app rules
  so games always launch at correct resolution on the gaming monitor
- Extract gamingMonitor variable as single source of truth
2026-05-28 07:57:33 -05:00

81 lines
2.9 KiB
Nix

{
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 1] uwsm app -- ghostty -e bash -c 'fastfetch; exec $SHELL'" # TODO: must be xdg-terminal-exec, or default user terminal
"[workspace special:preload silent] uwsm app -- xdg-terminal-exec"
];
}