diff --git a/README.md b/README.md index 9ffcb4d..0e8754f 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/home/config/.face b/home/config/.face new file mode 100644 index 0000000..449141c Binary files /dev/null and b/home/config/.face differ diff --git a/home/config/hypr/hyprlock.conf b/home/config/hypr/hyprlock.conf new file mode 100644 index 0000000..49cab24 --- /dev/null +++ b/home/config/hypr/hyprlock.conf @@ -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 "$(date '+%A, %d %B')" + 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 = Bruh, come back! + hide_input = false + position = 0, -140 + halign = center + valign = center +} + diff --git a/home/config/swayidle/config b/home/config/swayidle/config deleted file mode 100755 index 83d7a47..0000000 --- a/home/config/swayidle/config +++ /dev/null @@ -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' diff --git a/home/config/swaylock/config b/home/config/swaylock/config deleted file mode 100755 index 3ba53bc..0000000 --- a/home/config/swaylock/config +++ /dev/null @@ -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 diff --git a/home/config/wlogout/layout b/home/config/wlogout/layout index 6e546a1..345ff6d 100755 --- a/home/config/wlogout/layout +++ b/home/config/wlogout/layout @@ -1,6 +1,6 @@ { "label" : "lock", - "action" : "swaylock", + "action" : "hyprlock", "text" : "Lock", "keybind" : "l" } diff --git a/home/user/config.nix b/home/user/config.nix index baf71a8..fc24192 100644 --- a/home/user/config.nix +++ b/home/user/config.nix @@ -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"; }; } diff --git a/home/user/hypr/bind.nix b/home/user/hypr/bind.nix index b4df5b1..570bffc 100644 --- a/home/user/hypr/bind.nix +++ b/home/user/hypr/bind.nix @@ -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 + ) ) - diff --git a/home/user/hypr/exec.nix b/home/user/hypr/exec.nix index 8c7983a..89fc3b3 100644 --- a/home/user/hypr/exec.nix +++ b/home/user/hypr/exec.nix @@ -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 diff --git a/home/user/hyprland.nix b/home/user/hyprland.nix index ab481d5..0b92fff 100644 --- a/home/user/hyprland.nix +++ b/home/user/hyprland.nix @@ -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"; + # } + ]; + }; + }; } diff --git a/pkgs/fonts/sf-pro-display-bold/default.nix b/pkgs/fonts/sf-pro-display-bold/default.nix new file mode 100644 index 0000000..c5f736d --- /dev/null +++ b/pkgs/fonts/sf-pro-display-bold/default.nix @@ -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; + }; +} diff --git a/system/modules/fonts.nix b/system/modules/fonts.nix index de64874..beb2850 100644 --- a/system/modules/fonts.nix +++ b/system/modules/fonts.nix @@ -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; diff --git a/system/modules/hyprland.nix b/system/modules/hyprland.nix index 2d6e6bb..c69c57f 100644 --- a/system/modules/hyprland.nix +++ b/system/modules/hyprland.nix @@ -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 diff --git a/system/modules/security.nix b/system/modules/security.nix index 245feef..617b6e6 100644 --- a/system/modules/security.nix +++ b/system/modules/security.nix @@ -2,7 +2,7 @@ { services.udev.packages = [ pkgs.yubikey-personalization ]; - + security.pam.services.hyprlock = { }; security.pam.u2f = { enable = true; settings.cue = true;