feat: add hyprlock & hypridle

This commit is contained in:
DACHXY 2025-01-03 22:37:31 +08:00
parent 43bb08b86d
commit e1af19001f
14 changed files with 233 additions and 57 deletions

View file

@ -10,7 +10,8 @@
- ✅ [treesitter](https://github.com/nvim-treesitter/nvim-treesitter)
- ❌ mason (not support on NixOS)
- [X] Waybar
- [X] Swayidle
- [X] Hyprlock
- [X] Hypridle
- [X] Swaync (Notification Center)
- [X] Hyprpaper (Wallpaper)
- [X] Ghostty (Terminal)

BIN
home/config/.face Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

View file

@ -0,0 +1,93 @@
$font = CaskaydiaCove Nerd Font
$font2 = SF Pro Display Bold
background {
monitor =
path = screenshot
blur_passes = 3
blur_size = 8
contrast = 0.8916
brightness = 0.8172
vibrancy = 0.1696
vibrancy_darkness = 0.0
}
# GENERAL
general {
no_fade_in = false
grace = 0
disable_loading_bar = false
}
# TIME
label {
monitor =
text = cmd[update:1000] echo "$(date +"%-I:%M%p")"
color = rgba(250, 189, 47, .75)
font_size = 120
font_family = $font2
position = 0, -140
halign = center
valign = top
}
# DAY-DATE-MONTH
label {
monitor =
text = cmd[update:1000] echo "<span>$(date '+%A, %d %B')</span>"
color = rgba(225, 225, 225, 0.75)
font_size = 30
font_family = $font2
position = 0, 200
halign = center
valign = center
}
# LOGO
image {
monitor =
path = $HOME/.face
border_size = 2
border_color = rgba(255, 255, 255, .75)
size = 95
rounding = -1
rotate = 0
reload_time = -1
reload_cmd =
position = 0, 60
halign = center
valign = center
}
# USER
label {
monitor =
text = Hello, $USER
color = rgba(255, 255, 255, .65)
font_size = 25
font_family = $font2
position = 0, -70
halign = center
valign = center
}
# INPUT FIELD
input-field {
monitor =
size = 290, 60
outline_thickness = 2
dots_size = 0.2 # Scale of input-field height, 0.2 - 0.8
dots_spacing = 0.2 # Scale of dots' absolute size, 0.0 - 1.0
dots_center = true
outer_color = rgba(0, 0, 0, 0)
inner_color = rgba(60, 56, 54, 0.35)
font_color = rgb(200, 200, 200)
fade_on_empty = false
font_family = $font2
placeholder_text = <i><span foreground="##ffffff99">Bruh, come back!</span></i>
hide_input = false
position = 0, -140
halign = center
valign = center
}

View file

@ -1,4 +0,0 @@
timeout 300 'if pgrep swaylock; then hyprctl dispatch dpms off; fi'
resume 'hyprctl dispatch dpms on'
timeout 420 'systemctl suspend'
before-sleep 'swaylock'

View file

@ -1,31 +0,0 @@
daemonize
indicator
clock
screenshots
effect-blur=11x11
font=JetBrains Mono
indicator-radius=80
indicator-thickness=8
timestr=%I:%M %p
datestr=%F
inside-color=#181926
ring-color=#8bd5ca
key-hl-color=#a6da95
text-color=#cad3f5
layout-text-color=#cad3f5
layout-bg-color=#181926
text-caps-lock-color=#cad3f5
inside-clear-color=#f4dbd6
ring-clear-color=#f0c6c6
text-clear-color=#1e2030
inside-ver-color=#91d7e3
ring-ver-color=#7dc4e4
text-ver-color=#1e2030
inside-wrong-color=#ee99a0
ring-wrong-color=#ed8796
text-wrong-color=#1e2030

View file

@ -1,6 +1,6 @@
{
"label" : "lock",
"action" : "swaylock",
"action" : "hyprlock",
"text" : "Lock",
"keybind" : "l"
}

View file

@ -7,8 +7,6 @@ in
".config/wallpapers".source = "${configDir}/wallpapers";
".config/kitty".source = "${configDir}/kitty";
".config/neofetch".source = "${configDir}/neofetch";
".config/swayidle".source = "${configDir}/swayidle";
".config/swaylock".source = "${configDir}/swaylock";
".config/wlogout".source = "${configDir}/wlogout";
".config/waybar" = {
recursive = true;
@ -36,5 +34,7 @@ in
recursive = true;
source = "${configDir}/ghostty";
};
".face".source = "${configDir}/.face";
".hyprlock_bg.svg".source = "${configDir}/hyprlock_bg.vsg";
};
}

View file

@ -23,7 +23,7 @@ in
''${mainMod} ALT, W, exec, ${uwsm} ${scripts}/waybarRestart.sh''
''${mainMod}, P, pseudo, # dwindle''
''${mainMod}, S, togglesplit, # dwindle''
''CTRL ${mainMod} SHIFT, L, exec, swaylock''
''CTRL ${mainMod} SHIFT, L, exec, hyprlock''
''${mainMod} SHIFT, s, exec, hyprshot -m region --clipboard-only --freeze''
''CTRL SHIFT, s, exec, hyprshot -m window --clipboard-only --freeze''
''CTRL SHIFT ${mainMod}, s, exec, hyprshot -m output --clipboard-only --freeze''
@ -33,6 +33,9 @@ in
'',F11, fullscreen''
''${mainMod}, C, exec, code''
# Color Picker
''${mainMod} SHIFT, P, exec, hyprpicker -f hex -a -z -r''
# Cycle windows
''ALT, TAB, cyclenext''
''ALT, TAB, bringactivetotop''
@ -55,7 +58,6 @@ in
''${mainMod} SHIFT, k, movewindow, u''
''${mainMod} SHIFT, j, movewindow, d''
# Media
'',XF86AudioRaiseVolume, exec, wpctl set-mute @DEFAULT_SINK@ 0 && wpctl set-volume @DEFAULT_SINK@ ${volumeStep}%+''
'',XF86AudioLowerVolume, exec, wpctl set-mute @DEFAULT_SINK@ 0 && wpctl set-volume @DEFAULT_SINK@ ${volumeStep}%-''
@ -70,18 +72,20 @@ in
# ==== Plugins ==== #
# Overview
''${mainMod}, o, hyprexpo:expo, toggle''
] ++ (
]
++ (
# workspaces
# binds $mainMod + [shift +] {1..9} to [move to] workspace {1..9}
builtins.concatLists (builtins.genList
(i:
let ws = i + 1;
builtins.concatLists (
builtins.genList (
i:
let
ws = i + 1;
in
[
"${mainMod}, code:1${toString i}, workspace, ${toString ws}"
"${mainMod} SHIFT, code:1${toString i}, movetoworkspace, ${toString ws}"
]
) 9
)
9)
)

View file

@ -23,8 +23,7 @@ let
systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP &
uwsm app -- hyprpaper &
uwsm app -- waybar -c ~/.config/waybar/config.json -s ~/.config/waybar/style.css &
uwsm app -- swayidle -w &
uwsm app -- sway-audio-idle-inhibit &
systemctl --user enable --now hypridle.service &
uwsm fcitx5 -rd &
uwsm app -- fcitx5-remote -r &
uwsm app -- hyprsunset -t 3000k

View file

@ -26,6 +26,13 @@ let
input = import ./hypr/input.nix;
plugins = import ./hypr/plugin.nix;
cursorName = "catppuccin-macchiato-lavender-cursors";
getCurrentSong = pkgs.writeShellScriptBin "getSong" ''
song_info=$(playerctl metadata --format '{{title}} 󰎆 {{artist}}')
echo "$song_info"
'';
hyprlockAccent = "lavender";
in
{
home.packages = with pkgs; [
@ -81,4 +88,74 @@ in
ipc = "on";
};
};
programs.hyprlock = {
enable = true;
importantPrefixes = [
"$"
"monitor"
"size"
"source"
];
extraConfig =
builtins.readFile ../config/hypr/hyprlock.conf
+ ''
# CURRENT SONG
label {
monitor =
text = cmd[update:1000] echo "$(${getCurrentSong}/bin/getSong)"
color = rgba(235, 219, 178, .75)
font_size = 16
font_family = $font, $font2
position = 0, 80
halign = center
valign = bottom
}
'';
};
services.hypridle = {
enable = true;
settings = {
general = {
lock_cmd = "pidof hyprlock || hyprlock";
before_sleep_cmd = "loginctl lock-session";
after_sleep_cmd = "hyprctl dispatch dpms on";
ignore_dbus_inhibit = false;
ignore_systemd_inhibit = false;
};
listener = [
# 2.5min -> set monitor backlight to minimum
{
timeout = 150;
on-timeout = "brightnessctl -s set 10";
on-resume = "brightnessctl -r";
}
# 2.5min -> turn off keyboard backlight
{
timeout = 150;
on-timeout = "brightnessctl -sd rgb:kbd_backlight set 0";
on-resume = "brightnessctl -rd rgb:kbd_backlight";
}
# 5min -> Lock screen
{
timeout = 300;
on-timeout = "loginctl lock-session";
}
# 5.5min -> Screen off
{
timeout = 330;
on-timeout = "hyprctl dispatch dpms off";
on-resume = "hyprctl dispatch dpms on";
}
# 30min -> Suspend pc
# {
# timeout = 1800;
# on-timeout = "systemctl suspend";
# }
];
};
};
}

View file

@ -0,0 +1,32 @@
{
stdenvNoCC,
lib,
fetchurl,
}:
stdenvNoCC.mkDerivation {
pname = "sf-pro-display-bold";
version = "1.0.0";
src = fetchurl {
url = "https://raw.githubusercontent.com/MartinRGB/MAKA_H5_Album_Project/master/design/font/SF_Pro/SF-Pro-Display-Bold.ttf";
sha256 = "sha256-yjCRiRtzDDAnOxbMg8na+Uu0bw+YUmJhbOqBVdURjxQ=";
};
dontUnpack = true;
installPhase = ''
runHook preInstall
mkdir -p $out/share/fonts/truetype/SF-Pro-Display-Bold
install -m444 $src $out/share/fonts/truetype/SF-Pro-Display-Bold/SF-Pro-Display-Bold.ttf
runHook postInstall
'';
meta = with lib; {
description = "SF Pro Display Bold font";
homepage = "https://github.com/MartinRGB/MAKA_H5_Album_Project";
platforms = platforms.all;
};
}

View file

@ -1,10 +1,17 @@
{ pkgs, nix-version, ... }:
{
pkgs,
lib,
nix-version,
...
}:
let
nerdfont-pkg =
if nix-version == "25.05" then
pkgs.nerd-fonts.caskaydia-cove
else
(pkgs.nerdfonts.override { fonts = [ "CascadiaCode" ]; });
sf-pro-display-bold = pkgs.callPackage ../../pkgs/fonts/sf-pro-display-bold { };
in
{
fonts.packages =
@ -14,10 +21,11 @@ in
noto-fonts-cjk-sans
noto-fonts-cjk-serif
noto-fonts-emoji
sf-pro-display-bold
])
++ ([
++ [
nerdfont-pkg
]);
];
fonts.fontDir.enable = true;

View file

@ -36,9 +36,6 @@
qt5.qtwayland
qt6.qtwayland
swayidle
sway-audio-idle-inhibit # Prevent idle when playing audio
swaylock-effects
wlogout
wl-clipboard
rofi-wayland-unwrapped

View file

@ -2,7 +2,7 @@
{
services.udev.packages = [ pkgs.yubikey-personalization ];
security.pam.services.hyprlock = { };
security.pam.u2f = {
enable = true;
settings.cue = true;