From f291845c44615eaef00a49d351dc3fe64388bdb5 Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Mon, 23 Jun 2025 21:04:54 +1000 Subject: [PATCH] hypr: use shell for lock screen --- .gitignore | 1 - hypr/hypridle.conf | 2 +- hypr/hyprland/execs.conf | 6 +- hypr/hyprland/keybinds.conf | 5 +- hypr/scripts/battery.fish | 17 -- hypr/scripts/gen-hyprlock.fish | 28 ---- hypr/scripts/monitor-hyprlock.fish | 10 -- hypr/scripts/templates/hyprlock/base.conf | 12 -- .../templates/hyprlock/futuristic/main.conf | 78 --------- .../hyprlock/futuristic/per-monitor.conf | 35 ---- .../templates/hyprlock/round/main.conf | 155 ------------------ .../templates/hyprlock/round/per-monitor.conf | 49 ------ hypr/scripts/track-time.fish | 10 -- hypr/scripts/truncate.fish | 35 ---- hypr/scripts/weather.fish | 13 -- 15 files changed, 5 insertions(+), 451 deletions(-) delete mode 100755 hypr/scripts/battery.fish delete mode 100755 hypr/scripts/gen-hyprlock.fish delete mode 100755 hypr/scripts/monitor-hyprlock.fish delete mode 100644 hypr/scripts/templates/hyprlock/base.conf delete mode 100644 hypr/scripts/templates/hyprlock/futuristic/main.conf delete mode 100644 hypr/scripts/templates/hyprlock/futuristic/per-monitor.conf delete mode 100644 hypr/scripts/templates/hyprlock/round/main.conf delete mode 100644 hypr/scripts/templates/hyprlock/round/per-monitor.conf delete mode 100755 hypr/scripts/track-time.fish delete mode 100755 hypr/scripts/truncate.fish delete mode 100755 hypr/scripts/weather.fish diff --git a/.gitignore b/.gitignore index 6e782f7..a56bea1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ /hypr/hyprland/overrides.conf /hypr/scheme/current.conf -/hypr/hyprlock.conf /spicetify/config-xpui.ini /spicetify/Themes/caelestia/color.ini diff --git a/hypr/hypridle.conf b/hypr/hypridle.conf index 9c82226..1d41dc3 100644 --- a/hypr/hypridle.conf +++ b/hypr/hypridle.conf @@ -1,5 +1,5 @@ general { - lock_cmd = pidof hyprlock || hyprlock + lock_cmd = caelestia shell lock lock before_sleep_cmd = loginctl lock-session after_sleep_cmd = hyprctl dispatch dpms on } diff --git a/hypr/hyprland/execs.conf b/hypr/hyprland/execs.conf index e6e5044..170bfd1 100644 --- a/hypr/hyprland/execs.conf +++ b/hypr/hyprland/execs.conf @@ -26,15 +26,11 @@ exec-once = mpris-proxy # Resize and move picture in picture windows exec-once = caelestia pip -d -# Regenerate hyprlock config on monitor changes -exec = ~/.config/hypr/scripts/gen-hyprlock.fish -exec-once = ~/.config/hypr/scripts/monitor-hyprlock.fish - # Reload hyprland when config changes (to regenerate everything) exec-once = ~/.config/hypr/scripts/monitor-config.fish # Start shell -exec-once = caelestia shell +exec-once = caelestia shell -d # Idle daemon exec-once = hypridle diff --git a/hypr/hyprland/keybinds.conf b/hypr/hyprland/keybinds.conf index 86a7643..f2a0f6d 100644 --- a/hypr/hyprland/keybinds.conf +++ b/hypr/hyprland/keybinds.conf @@ -17,6 +17,8 @@ bind = Ctrl+Alt, Delete, global, caelestia:session bind = Ctrl+Alt, C, global, caelestia:clearNotifs bind = Super, K, global, caelestia:showall +bind = Super, L, global, caelestia:lock + bindl = , XF86MonBrightnessUp, global, caelestia:brightnessUp bindl = , XF86MonBrightnessDown, global, caelestia:brightnessDown @@ -163,8 +165,7 @@ bindl = Super+Shift, M, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle bindle = , XF86AudioRaiseVolume, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ 0; wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 10%+ bindle = , XF86AudioLowerVolume, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ 0; wpctl set-volume @DEFAULT_AUDIO_SINK@ 10%- -# Lock and sleep -bind = Super, L, exec, loginctl lock-session +# Sleep bind = Super+Shift, L, exec, systemctl suspend-then-hibernate # Clipboard and emoji picker diff --git a/hypr/scripts/battery.fish b/hypr/scripts/battery.fish deleted file mode 100755 index a400ad3..0000000 --- a/hypr/scripts/battery.fish +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/fish - -for battery in /sys/class/power_supply/*BAT* - if test -f "$battery/uevent" - set has_battery - break - end -end - -if set -q has_battery - if test "$(cat /sys/class/power_supply/*/status | head -1)" = "Charging" - echo -n "(+) " - end - echo "$(cat /sys/class/power_supply/*/capacity | head -1)% remaining" -else - exit 1 -end diff --git a/hypr/scripts/gen-hyprlock.fish b/hypr/scripts/gen-hyprlock.fish deleted file mode 100755 index c5f6609..0000000 --- a/hypr/scripts/gen-hyprlock.fish +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/fish - -set -l src (dirname (status filename)) - -set -q XDG_CONFIG_HOME && set -l config $XDG_CONFIG_HOME/caelestia || set -l config $HOME/.config/caelestia - -cp $src/templates/hyprlock/base.conf $src/../hyprlock.conf - -test -f $config/hypr.json && set -l style (jq -r '.hyprlock.style' $config/hypr.json) -test -f "$src/templates/hyprlock/$style/main.conf" || set -l style round - -cat $src/templates/hyprlock/$style/main.conf >> $src/../hyprlock.conf - -if test -f $src/templates/hyprlock/$style/per-monitor.conf - for monitor in (hyprctl monitors -j | jq -r '.[] | "\(.name) \(.width) \(.height)"') - set -l monitor (string split ' ' $monitor) - set -l name $monitor[1] - set -l width $monitor[2] - set -l height $monitor[3] - - set -l tmp (mktemp) - cp $src/templates/hyprlock/$style/per-monitor.conf $tmp - sed -n 's/.*{{ \(.*\) }}.*/\1/p' $src/templates/hyprlock/$style/per-monitor.conf | while read expr - sed -i "s|{{ $expr }}|$(echo "echo $expr" | .)|g" $tmp - end - cat $tmp >> $src/../hyprlock.conf - end -end diff --git a/hypr/scripts/monitor-hyprlock.fish b/hypr/scripts/monitor-hyprlock.fish deleted file mode 100755 index 6dd5803..0000000 --- a/hypr/scripts/monitor-hyprlock.fish +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/fish - -set -l src (dirname (status filename)) - -socat -U - UNIX-CONNECT:$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock | while read line - switch $line - case 'monitor*' - $src/gen-hyprlock.fish - end -end diff --git a/hypr/scripts/templates/hyprlock/base.conf b/hypr/scripts/templates/hyprlock/base.conf deleted file mode 100644 index 66ee61e..0000000 --- a/hypr/scripts/templates/hyprlock/base.conf +++ /dev/null @@ -1,12 +0,0 @@ -source = ~/.config/hypr/scheme/current.conf - -$scripts = ~/.config/hypr/scripts -$media_cmd = caelestia shell mpris getActive - -animation { - bezier = linear, 1, 1, 0, 0 - animation = fadeIn, 1, 5, linear - animation = fadeOut, 1, 3, linear - animation = inputField, 1, 2, linear - animation = inputFieldColors, 1, 3, linear -} diff --git a/hypr/scripts/templates/hyprlock/futuristic/main.conf b/hypr/scripts/templates/hyprlock/futuristic/main.conf deleted file mode 100644 index a2f0893..0000000 --- a/hypr/scripts/templates/hyprlock/futuristic/main.conf +++ /dev/null @@ -1,78 +0,0 @@ -$font_family_clock = Speculum -$font_family_extras = Departure Mono - -$cpu_temps = cat /sys/class/thermal/thermal_zone*/temp -$get_cpu_temp = fish -c 'math -s 1 \( ($cpu_temps | string join +) \) / ($cpu_temps | wc -l) / 1000' -$get_cpu_load = top -bn1 | grep 'Cpu(s)' | sed 's/.*, *\([0-9.]*\)%* id.*/\1/' | awk '{print 100 - $1}' - -$has_media = playerctl status &> /dev/null -$print_media = printf '%s: %s\nBy: %s' "$(test "$($media_cmd isPlaying)" = true && echo 'Playing' || echo 'Paused')" "$($media_cmd trackTitle)" "$($media_cmd trackArtist)" -$get_media = $has_media && $print_media || printf 'No media playing\nTry playing something!' - -background { - color = rgb($crust) - path = $HOME/.local/state/caelestia/wallpaper/current - blur_passes = 3 - blur_size = 3 - noise = 0.05 - contrast = 1 - brightness = 0.8 - vibrancy = 0.2 - vibrancy_darkness = 0.2 -} - -input-field { - monitor = - size = 320, 60 - outline_thickness = 0 - dots_size = 0.225 - dots_spacing = 0.5 - dots_text_format = * - inner_color = rgba($tertiary45) - font_color = rgb($text) - check_color = rgb($sky) - fail_color = rgb($error) - fade_on_empty = false - placeholder_text =    - fail_text = !!! - swap_font_color = true - rounding = 0 - font_family = JetBrains Mono NF Bold - font_size = 30 - - position = 0, -120 - halign = center - valign = center -} - -label { # Clock - monitor = - text = cmd[update:1000] date +'%H//%M//%S' - color = rgb($primary) - font_size = 110 - font_family = $font_family_clock - - shadow_passes = 2 - shadow_size = 2 - shadow_color = rgb(a0a0a0) - - position = 0, 70 - halign = center - valign = center -} - -label { # Date - monitor = - text = cmd[update:5000] date +'%D' - color = rgba($secondarybf) - font_size = 60 - font_family = $font_family_clock - - shadow_passes = 2 - shadow_size = 2 - shadow_color = rgb(a0a0a0) - - position = 355, -35 - halign = center - valign = center -} diff --git a/hypr/scripts/templates/hyprlock/futuristic/per-monitor.conf b/hypr/scripts/templates/hyprlock/futuristic/per-monitor.conf deleted file mode 100644 index 4c58316..0000000 --- a/hypr/scripts/templates/hyprlock/futuristic/per-monitor.conf +++ /dev/null @@ -1,35 +0,0 @@ - -# MONITOR {{ $name }} -label { # CPU info - monitor = {{ $name }} - text = cmd[update:5000] printf '%s°C :CPU Temp\n%s%% :CPU Load' "$($get_cpu_temp)" "$($get_cpu_load)" - color = rgb($tertiary) - font_size = 14 - font_family = $font_family_extras - text_align = right - - shadow_passes = 2 - shadow_size = 2 - shadow_color = rgb(a0a0a0) - - position = -{{ (math $width / 2 + 175) }}, -120 - halign = right - valign = center -} - -label { # Media playing - monitor = {{ $name }} - text = cmd[update:1000] $get_media - color = rgb($tertiary) - font_size = 14 - font_family = $font_family_extras - text_align = left - - shadow_passes = 2 - shadow_size = 2 - shadow_color = rgb(a0a0a0) - - position = {{ (math $width / 2 + 175) }}, -120 - halign = left - valign = center -} diff --git a/hypr/scripts/templates/hyprlock/round/main.conf b/hypr/scripts/templates/hyprlock/round/main.conf deleted file mode 100644 index beb309d..0000000 --- a/hypr/scripts/templates/hyprlock/round/main.conf +++ /dev/null @@ -1,155 +0,0 @@ -$font_family = JetBrainsMonoNF -$truncate_cmd = playerctl status &> /dev/null && $scripts/truncate.fish $font_family - -background { - color = rgb($crust) - path = $HOME/.local/state/caelestia/wallpaper/current - blur_passes = 3 - blur_size = 2 - noise = 0.0117 - contrast = 0.8916 - brightness = 0.8172 - vibrancy = 0.1696 - vibrancy_darkness = 0.0 -} - -input-field { - monitor = - size = 320, 60 - outline_thickness = 0 - dots_size = 0.225 - dots_spacing = 0.2 - inner_color = rgba($base66) - font_color = rgb($text) - check_color = rgb($sky) - fail_color = rgb($error) - fade_on_empty = false - placeholder_text = 󰌾 Logged in as $USER - fail_text = $FAIL ($ATTEMPTS) - swap_font_color = true - - position = 0, 300 - halign = center - valign = bottom -} - -shape { # Player background - monitor = - size = 400, 110 - color = rgba($base66) - rounding = 20 - - position = 0, 100 - halign = center - valign = bottom -} - -shape { # Player fallback cover art - monitor = - size = 90, 90 - color = rgba($surface266) - rounding = 5 - - position = -140, 110 - halign = center - valign = bottom -} - -label { # Player fallback cover art icon - monitor = - text =  - color = rgb($subtext0) - font_size = 40 - font_family = $font_family - - position = -135, 120 - halign = center - valign = bottom -} - -image { # Player cover art - monitor = - size = 84 - border_size = 3 - border_color = rgb($text) - rounding = 5 - reload_time = 1 - reload_cmd = $media_cmd trackArtUrl - - position = -140, 110 - halign = center - valign = bottom - zindex = 1 -} - -label { # Clock - monitor = - text = $TIME - color = rgb($primary) - font_size = 200 - font_family = $font_family ExtraBold - - position = 0, 300 - halign = center - valign = center -} - -label { # Date - monitor = - text = cmd[update:5000] date +'%B %d %Y' - color = rgb($secondary) - font_size = 40 - font_family = $font_family Bold - - position = 0, 50 - halign = center - valign = center -} - -label { # Day - monitor = - text = cmd[update:5000] date +'%A' - color = rgb($secondary) - font_size = 40 - font_family = $font_family Bold - - position = 500, 180 - halign = center - valign = center -} - -label { # Uptime - monitor = - text = cmd[update:60000] uptime -p - color = rgb($primary) - font_size = 20 - font_family = $font_family Bold - - position = -20, 20 - halign = right - valign = bottom -} - -label { # Battery - monitor = - text = cmd[update:5000] $scripts/battery.fish - color = rgb($primary) - font_size = 20 - font_family = $font_family Bold - - position = 20, 20 - halign = left - valign = bottom -} - -label { # Weather if no battery - monitor = - text = cmd[update:90000] $scripts/battery.fish > /dev/null || $scripts/weather.fish - color = rgb($primary) - font_size = 20 - font_family = $font_family Bold - - position = 20, 20 - halign = left - valign = bottom -} diff --git a/hypr/scripts/templates/hyprlock/round/per-monitor.conf b/hypr/scripts/templates/hyprlock/round/per-monitor.conf deleted file mode 100644 index 70152c4..0000000 --- a/hypr/scripts/templates/hyprlock/round/per-monitor.conf +++ /dev/null @@ -1,49 +0,0 @@ - -# MONITOR {{ $name }} -label { # Player identity - monitor = {{ $name }} - text = cmd[update:1000] $truncate_cmd 12 150 "$($media_cmd identity)" - color = rgb($subtext0) - font_size = 12 - font_family = $font_family - - position = {{ (math $width / 2 - 80) }}, 170 - halign = left - valign = bottom -} - -label { # Player track title - monitor = {{ $name }} - text = cmd[update:1000] $truncate_cmd-Bold 14 150 "$($media_cmd trackTitle)" || echo 'No media playing' - color = rgb($text) - font_size = 14 - font_family = $font_family Bold - - position = {{ (math $width / 2 - 80) }}, 142 - halign = left - valign = bottom -} - -label { # Player track artist - monitor = {{ $name }} - text = cmd[update:1000] $truncate_cmd 12 100 "$($media_cmd trackArtist)" - color = rgb($text) - font_size = 12 - font_family = $font_family - - position = {{ (math $width / 2 - 80) }}, 120 - halign = left - valign = bottom -} - -label { # Player track time - monitor = {{ $name }} - text = cmd[update:1000] $scripts/track-time.fish - color = rgb($subtext0) - font_size = 12 - font_family = $font_family - - position = {{ (math 180 - $width / 2) }}, 110 - halign = right - valign = bottom -} diff --git a/hypr/scripts/track-time.fish b/hypr/scripts/track-time.fish deleted file mode 100755 index 21adc7f..0000000 --- a/hypr/scripts/track-time.fish +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/fish - -function fmt-time -a secs - printf "%d:%02d" (math -s 0 $secs / 60 % 60) (math -s 0 $secs % 60) -end - -set -l position (caelestia shell mpris getActive position) -set -l length (caelestia shell mpris getActive length) - -test $position != 'No media' -a $position != 'No active player' && echo "$(fmt-time $position)/$(fmt-time $length)" diff --git a/hypr/scripts/truncate.fish b/hypr/scripts/truncate.fish deleted file mode 100755 index 3585088..0000000 --- a/hypr/scripts/truncate.fish +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/fish - -function get-width -a font size string - magick -font $font -font Noto-Sans-CJK-JP -font Noto-Sans-CJK-SC -font Noto-Sans-CJK-TC -font Noto-Sans-CJK-KR -font Noto-Sans-CJK-HK -font Noto-Sans-CJK-TC \ - -pointsize $size label:$string -format '%w' info: -end - -set -l font $argv[1] -set -l size $argv[2] -set -l max_width $argv[3] -set -l string $argv[4] -set -l dot_width (get-width $font $size '...') - -if test (get-width $font $size $string) -gt $max_width - # Cut in half until less than max width - set -l st 0 - set -l ed (string length $string) - while ! set -q done - set -l idx (math -s 0 $st + \( $ed - $st \) / 2) - set -l width (math (get-width $font $size (string sub -e $idx $string)) + $dot_width) - if test $width -gt $max_width - set ed $idx - else - if test (math abs $st - $ed) -le 1 - set done - set string (string sub -e $idx $string) - else - set st $idx - end - end - end - echo "$(string trim -r $string)..." -else - echo $string -end diff --git a/hypr/scripts/weather.fish b/hypr/scripts/weather.fish deleted file mode 100755 index 1a6653e..0000000 --- a/hypr/scripts/weather.fish +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/fish - -set -q XDG_CACHE_HOME && set -l cache $XDG_CACHE_HOME || set -l cache $HOME/.cache -set -l cache $cache/caelestia/weather.json - -if test -f $cache - jq -r '.current | "\(.condition.text) • \(.temp_c)°C | UV \(.uv) •  \(.wind_kph) kph"' $cache - exit -end - -set -l format '\(.weatherDesc[0].value) • \(.temp_C)°C | UV \(.uvIndex) •  \(.windspeedKmph) kph' -set -l city (curl ipinfo.io | jq -r '.city') -curl "wttr.in/$city?format=j1" | jq -er '.current_condition[0] | "'$format'"'