diff --git a/bin/omarchy-cmd-screensaver b/bin/omarchy-cmd-screensaver index 0d3d4779..3a44369f 100755 --- a/bin/omarchy-cmd-screensaver +++ b/bin/omarchy-cmd-screensaver @@ -1,13 +1,13 @@ #!/bin/bash screensaver_in_focus() { - hyprctl activewindow -j | jq -e '.class == "Screensaver"' >/dev/null 2>&1 + hyprctl activewindow -j | jq -e '.class == "com.omarchy.Screensaver"' >/dev/null 2>&1 } exit_screensaver() { hyprctl keyword cursor:invisible false pkill -x tte 2>/dev/null - pkill -f "alacritty --class Screensaver" 2>/dev/null + pkill -f com.omarchy.Screensaver 2>/dev/null exit 0 } diff --git a/bin/omarchy-launch-screensaver b/bin/omarchy-launch-screensaver index f81b4cde..2dfd0c9b 100755 --- a/bin/omarchy-launch-screensaver +++ b/bin/omarchy-launch-screensaver @@ -6,7 +6,7 @@ if ! command -v tte &>/dev/null; then fi # Exit early if screensave is already running -pgrep -f "alacritty --class Screensaver" && exit 0 +pgrep -f com.omarchy.Screensaver && exit 0 # Allow screensaver to be turned off but also force started if [[ -f ~/.local/state/omarchy/toggles/screensaver-off ]] && [[ $1 != "force" ]]; then @@ -14,15 +14,34 @@ if [[ -f ~/.local/state/omarchy/toggles/screensaver-off ]] && [[ $1 != "force" ] fi focused=$(hyprctl monitors -j | jq -r '.[] | select(.focused == true).name') +terminal=$(xdg-terminal-exec --print-id) for m in $(hyprctl monitors -j | jq -r '.[] | .name'); do hyprctl dispatch focusmonitor $m - # FIXME: Find a way to make this generic where we it can work for kitty + ghostty - hyprctl dispatch exec -- \ - alacritty --class Screensaver \ - --config-file ~/.local/share/omarchy/default/alacritty/screensaver.toml \ - -e omarchy-cmd-screensaver + case $terminal in + *Alacritty*) + hyprctl dispatch exec -- \ + alacritty --class=com.omarchy.Screensaver \ + --config-file ~/.local/share/omarchy/default/alacritty/screensaver.toml \ + -e omarchy-cmd-screensaver + ;; + *ghostty*) + hyprctl dispatch exec -- \ + ghostty --class=com.omarchy.Screensaver \ + --font-size=18 \ + -e omarchy-cmd-screensaver + ;; + *kitty*) + hyprctl dispatch exec -- \ + kitty --class=com.omarchy.Screensaver \ + --override font_size=18 \ + -e omarchy-cmd-screensaver + ;; + *) + notify-send "✋ Screensaver only runs in Alacritty, Ghostty, or Kitty" + ;; + esac done hyprctl dispatch focusmonitor $focused diff --git a/default/hypr/apps/system.conf b/default/hypr/apps/system.conf index 82300521..08f10771 100644 --- a/default/hypr/apps/system.conf +++ b/default/hypr/apps/system.conf @@ -8,7 +8,7 @@ windowrule = tag +floating-window, class:(xdg-desktop-portal-gtk|sublime_text|De windowrule = float, class:org.gnome.Calculator # Fullscreen screensaver -windowrule = fullscreen, class:Screensaver +windowrule = fullscreen, class:com.omarchy.Screensaver # No transparency on media windows windowrule = opacity 1 1, class:^(zoom|vlc|mpv|org.kde.kdenlive|com.obsproject.Studio|com.github.PintaProject.Pinta|imv|org.gnome.NautilusPreviewer)$