feat: configure Hyprlock and locking before suspend
This commit is contained in:
parent
a95cf01724
commit
e8b7684f35
6 changed files with 442 additions and 0 deletions
4
hypr/hypridle.conf
Normal file
4
hypr/hypridle.conf
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
general {
|
||||
lock_cmd = pgrep -x hyprlock >/dev/null || hyprlock
|
||||
before_sleep_cmd = loginctl lock-session
|
||||
}
|
||||
|
|
@ -272,6 +272,7 @@ end
|
|||
-- Example binds, see https://wiki.hypr.land/Configuring/Basics/Binds/ for more
|
||||
hl.bind(mainMod .. " + T", hl.dsp.exec_cmd(terminal))
|
||||
hl.bind(mainMod .. " + R", hl.dsp.exec_cmd(appsmenu))
|
||||
hl.bind(mainMod .. " + L", hl.dsp.exec_cmd("pgrep -x hyprlock >/dev/null || hyprlock"))
|
||||
hl.bind(mainMod .. " + SHIFT + S", hl.dsp.exec_cmd("hyprshot -m region --clipboard-only"))
|
||||
local closeWindowBind = hl.bind(mainMod .. " + C", hl.dsp.window.close())
|
||||
-- closeWindowBind:set_enabled(false)
|
||||
|
|
|
|||
365
hypr/hyprlock.conf
Normal file
365
hypr/hyprlock.conf
Normal file
|
|
@ -0,0 +1,365 @@
|
|||
# Two-column lock screen. Positions are relative to the centre of each monitor.
|
||||
$font = ProFontWindows Nerd Font Mono
|
||||
$cream = rgb(eee8dd)
|
||||
$muted = rgb(bcb5ab)
|
||||
$red = rgb(bc3b3b)
|
||||
$dark = rgb(1c1717)
|
||||
|
||||
general {
|
||||
hide_cursor = true
|
||||
ignore_empty_input = true
|
||||
}
|
||||
|
||||
background {
|
||||
monitor =
|
||||
path = ~/Git/Custom-environment/wallpapers/night_city.jpg
|
||||
color = rgb(223638)
|
||||
blur_passes = 4
|
||||
blur_size = 10
|
||||
brightness = 0.7
|
||||
noise = 0.02
|
||||
}
|
||||
|
||||
# Login card.
|
||||
shape {
|
||||
monitor =
|
||||
size = 360, 380
|
||||
color = rgba(28, 40, 39, 0.6)
|
||||
rounding = 25
|
||||
position = -200, 160
|
||||
halign = center
|
||||
valign = center
|
||||
zindex = 0
|
||||
}
|
||||
|
||||
label {
|
||||
monitor =
|
||||
text = NixOS
|
||||
color = $muted
|
||||
font_size = 20
|
||||
font_family = $font
|
||||
position = -200, 300
|
||||
halign = center
|
||||
valign = center
|
||||
zindex = 2
|
||||
}
|
||||
|
||||
label {
|
||||
monitor =
|
||||
text = Log in
|
||||
color = $cream
|
||||
font_size = 56
|
||||
font_family = $font
|
||||
position = -200, 235
|
||||
halign = center
|
||||
valign = center
|
||||
zindex = 2
|
||||
}
|
||||
|
||||
shape {
|
||||
monitor =
|
||||
size = 320, 70
|
||||
color = $red
|
||||
rounding = 20
|
||||
position = -200, 130
|
||||
halign = center
|
||||
valign = center
|
||||
zindex = 1
|
||||
}
|
||||
|
||||
label {
|
||||
monitor =
|
||||
text = Username
|
||||
color = $dark
|
||||
font_size = 14
|
||||
font_family = $font
|
||||
position = -295, 150
|
||||
halign = center
|
||||
valign = center
|
||||
zindex = 2
|
||||
}
|
||||
|
||||
label {
|
||||
monitor =
|
||||
text = $USER
|
||||
color = $dark
|
||||
font_size = 28
|
||||
font_family = $font
|
||||
position = -200, 117
|
||||
halign = center
|
||||
valign = center
|
||||
zindex = 2
|
||||
}
|
||||
|
||||
input-field {
|
||||
monitor =
|
||||
size = 320, 70
|
||||
outline_thickness = 0
|
||||
inner_color = $red
|
||||
font_color = $dark
|
||||
font_family = $font
|
||||
placeholder_text = Password
|
||||
fail_text = <i>$FAIL</i>
|
||||
fail_color = rgb(e15b64)
|
||||
check_color = rgb(cda67d)
|
||||
capslock_color = rgb(cda67d)
|
||||
rounding = 20
|
||||
fade_on_empty = false
|
||||
position = -200, 40
|
||||
halign = center
|
||||
valign = center
|
||||
zindex = 2
|
||||
}
|
||||
|
||||
# Clock card.
|
||||
shape {
|
||||
monitor =
|
||||
size = 360, 160
|
||||
color = rgba(28, 40, 39, 0.6)
|
||||
rounding = 25
|
||||
position = -200, -140
|
||||
halign = center
|
||||
valign = center
|
||||
zindex = 0
|
||||
}
|
||||
|
||||
label {
|
||||
monitor =
|
||||
text = $TIME
|
||||
color = $cream
|
||||
font_size = 96
|
||||
font_family = $font
|
||||
position = -200, -120
|
||||
halign = center
|
||||
valign = center
|
||||
zindex = 2
|
||||
}
|
||||
|
||||
label {
|
||||
monitor =
|
||||
text = cmd[update:60000] sh ~/.config/hypr/scripts/lock-status.sh uptime
|
||||
color = $muted
|
||||
font_size = 18
|
||||
font_family = $font
|
||||
position = -200, -195
|
||||
halign = center
|
||||
valign = center
|
||||
zindex = 2
|
||||
}
|
||||
|
||||
# Profile and date card.
|
||||
shape {
|
||||
monitor =
|
||||
size = 360, 650
|
||||
color = rgba(28, 40, 39, 0.6)
|
||||
rounding = 25
|
||||
position = 200, 25
|
||||
halign = center
|
||||
valign = center
|
||||
zindex = 0
|
||||
}
|
||||
|
||||
image {
|
||||
monitor =
|
||||
path = ~/Git/Custom-environment/wallpapers/kotost.png
|
||||
size = 124
|
||||
rounding = 24
|
||||
border_size = 4
|
||||
border_color = $red
|
||||
position = 200, 260
|
||||
halign = center
|
||||
valign = center
|
||||
zindex = 2
|
||||
}
|
||||
|
||||
label {
|
||||
monitor =
|
||||
text = cmd[update:60000] sh ~/.config/hypr/scripts/lock-status.sh weekday
|
||||
color = $cream
|
||||
font_size = 56
|
||||
font_family = $font
|
||||
position = 200, 150
|
||||
halign = center
|
||||
valign = center
|
||||
zindex = 2
|
||||
}
|
||||
|
||||
label {
|
||||
monitor =
|
||||
text = cmd[update:60000] sh ~/.config/hypr/scripts/lock-status.sh date
|
||||
color = $muted
|
||||
font_size = 20
|
||||
font_family = $font
|
||||
position = 200, 100
|
||||
halign = center
|
||||
valign = center
|
||||
zindex = 2
|
||||
}
|
||||
|
||||
# Media and device card.
|
||||
shape {
|
||||
monitor =
|
||||
size = 360, 320
|
||||
color = rgba(28, 23, 23, 0.94)
|
||||
rounding = 25
|
||||
shadow_passes = 3
|
||||
shadow_size = 8
|
||||
shadow_color = rgba(0, 0, 0, 0.5)
|
||||
position = 200, -140
|
||||
halign = center
|
||||
valign = center
|
||||
zindex = 1
|
||||
}
|
||||
|
||||
label {
|
||||
monitor =
|
||||
text =
|
||||
color = $cream
|
||||
font_size = 24
|
||||
font_family = $font
|
||||
position = 200, -10
|
||||
halign = center
|
||||
valign = center
|
||||
zindex = 3
|
||||
}
|
||||
|
||||
label {
|
||||
monitor =
|
||||
text = cmd[update:5000] sh ~/.config/hypr/scripts/lock-status.sh music-title
|
||||
color = $cream
|
||||
font_size = 20
|
||||
font_family = $font
|
||||
position = 200, -40
|
||||
halign = center
|
||||
valign = center
|
||||
zindex = 3
|
||||
}
|
||||
|
||||
label {
|
||||
monitor =
|
||||
text = cmd[update:5000] sh ~/.config/hypr/scripts/lock-status.sh music-artist
|
||||
color = $muted
|
||||
font_size = 16
|
||||
font_family = $font
|
||||
position = 200, -65
|
||||
halign = center
|
||||
valign = center
|
||||
zindex = 3
|
||||
}
|
||||
|
||||
shape {
|
||||
monitor =
|
||||
size = 150, 75
|
||||
color = rgb(cda67d)
|
||||
rounding = 20
|
||||
position = 115, -130
|
||||
halign = center
|
||||
valign = center
|
||||
zindex = 2
|
||||
}
|
||||
|
||||
shape {
|
||||
monitor =
|
||||
size = 150, 75
|
||||
color = rgb(cda67d)
|
||||
rounding = 20
|
||||
position = 285, -130
|
||||
halign = center
|
||||
valign = center
|
||||
zindex = 2
|
||||
}
|
||||
|
||||
label {
|
||||
monitor =
|
||||
text =
|
||||
color = $dark
|
||||
font_size = 26
|
||||
font_family = $font
|
||||
position = 115, -118
|
||||
halign = center
|
||||
valign = center
|
||||
zindex = 3
|
||||
}
|
||||
|
||||
label {
|
||||
monitor =
|
||||
text = cmd[update:10000] sh ~/.config/hypr/scripts/lock-status.sh network
|
||||
color = $dark
|
||||
font_size = 12
|
||||
font_family = $font
|
||||
position = 115, -150
|
||||
halign = center
|
||||
valign = center
|
||||
zindex = 3
|
||||
}
|
||||
|
||||
label {
|
||||
monitor =
|
||||
text =
|
||||
color = $dark
|
||||
font_size = 26
|
||||
font_family = $font
|
||||
position = 285, -118
|
||||
halign = center
|
||||
valign = center
|
||||
zindex = 3
|
||||
}
|
||||
|
||||
label {
|
||||
monitor =
|
||||
text = cmd[update:10000] sh ~/.config/hypr/scripts/lock-status.sh bluetooth
|
||||
color = $dark
|
||||
font_size = 12
|
||||
font_family = $font
|
||||
position = 285, -150
|
||||
halign = center
|
||||
valign = center
|
||||
zindex = 3
|
||||
}
|
||||
|
||||
shape {
|
||||
monitor =
|
||||
size = 320, 100
|
||||
color = $red
|
||||
rounding = 25
|
||||
position = 200, -235
|
||||
halign = center
|
||||
valign = center
|
||||
zindex = 2
|
||||
}
|
||||
|
||||
label {
|
||||
monitor =
|
||||
text =
|
||||
color = $dark
|
||||
font_size = 24
|
||||
font_family = $font
|
||||
position = 200, -203
|
||||
halign = center
|
||||
valign = center
|
||||
zindex = 3
|
||||
}
|
||||
|
||||
label {
|
||||
monitor =
|
||||
text = cmd[update:10000] sh ~/.config/hypr/scripts/lock-status.sh power-value
|
||||
color = $dark
|
||||
font_size = 34
|
||||
font_family = $font
|
||||
position = 200, -235
|
||||
halign = center
|
||||
valign = center
|
||||
zindex = 3
|
||||
}
|
||||
|
||||
label {
|
||||
monitor =
|
||||
text = cmd[update:10000] sh ~/.config/hypr/scripts/lock-status.sh power-status
|
||||
color = $dark
|
||||
font_size = 14
|
||||
font_family = $font
|
||||
position = 200, -267
|
||||
halign = center
|
||||
valign = center
|
||||
zindex = 3
|
||||
}
|
||||
69
hypr/scripts/lock-status.sh
Normal file
69
hypr/scripts/lock-status.sh
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Hyprlock labels accept Pango markup. Escape text coming from applications.
|
||||
escape_text() {
|
||||
cut -c "1-${1:-26}" | sed -e 's/&/\&/g' -e 's/</\</g' -e 's/>/\>/g'
|
||||
}
|
||||
|
||||
battery() {
|
||||
for supply in /sys/class/power_supply/*; do
|
||||
if [ -r "$supply/type" ] && [ "$(cat "$supply/type")" = Battery ]; then
|
||||
printf '%s\n' "$supply"
|
||||
return
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
case "${1:-}" in
|
||||
uptime)
|
||||
awk '{ minutes = int($1 / 60); printf " UPTIME %dH%02dM\n", int(minutes / 60), minutes % 60 }' /proc/uptime
|
||||
;;
|
||||
weekday) LC_TIME=C date +%a | tr '[:lower:]' '[:upper:]' ;;
|
||||
date) LC_TIME=C date '+%d %B, %Y' ;;
|
||||
music-title|music-artist)
|
||||
field=title
|
||||
fallback='Nothing playing'
|
||||
if [ "$1" = music-artist ]; then
|
||||
field=artist
|
||||
fallback='Media player'
|
||||
fi
|
||||
value=''
|
||||
if command -v playerctl >/dev/null 2>&1; then
|
||||
value=$(playerctl metadata --format "{{$field}}" 2>/dev/null) || value=''
|
||||
fi
|
||||
printf '%s\n' "${value:-$fallback}" | escape_text
|
||||
;;
|
||||
network)
|
||||
value=''
|
||||
if command -v nmcli >/dev/null 2>&1; then
|
||||
value=$(nmcli -t -f TYPE,NAME connection show --active 2>/dev/null |
|
||||
awk -F: '$1 == "802-11-wireless" || $1 == "802-3-ethernet" { sub(/^[^:]*:/, ""); print; exit }')
|
||||
fi
|
||||
printf '%s\n' "${value:-Offline}" | escape_text 18
|
||||
;;
|
||||
bluetooth)
|
||||
value=''
|
||||
if command -v bluetoothctl >/dev/null 2>&1; then
|
||||
value=$(timeout 2 bluetoothctl devices Connected 2>/dev/null |
|
||||
sed -n '1s/^Device [^ ]* //p')
|
||||
fi
|
||||
printf '%s\n' "${value:-Not connected}" | escape_text 18
|
||||
;;
|
||||
power-value)
|
||||
supply=$(battery)
|
||||
if [ -n "$supply" ] && [ -r "$supply/capacity" ]; then
|
||||
printf '%s%%\n' "$(cat "$supply/capacity")"
|
||||
else
|
||||
printf '%s\n' 'AC'
|
||||
fi
|
||||
;;
|
||||
power-status)
|
||||
supply=$(battery)
|
||||
if [ -n "$supply" ] && [ -r "$supply/status" ]; then
|
||||
cat "$supply/status"
|
||||
else
|
||||
printf '%s\n' 'Desktop power'
|
||||
fi
|
||||
;;
|
||||
*) exit 1 ;;
|
||||
esac
|
||||
Loading…
Add table
Add a link
Reference in a new issue