From fad7c6e46dd9954340ac0b127a9e0297866a0173 Mon Sep 17 00:00:00 2001 From: Hadi <112569860+anotherhadi@users.noreply.github.com> Date: Fri, 14 Jun 2024 20:58:52 +0200 Subject: [PATCH] Update --- home/system/hyprland/hypridle.nix | 40 ++++---- home/system/hyprland/hyprlock.nix | 147 +++++++++++++++-------------- home/system/hyprland/hyprpaper.nix | 20 ++-- home/system/waybar/default.nix | 12 ++- hosts/guest/variables.nix | 1 + hosts/laptop/variables.nix | 1 + 6 files changed, 119 insertions(+), 102 deletions(-) diff --git a/home/system/hyprland/hypridle.nix b/home/system/hyprland/hypridle.nix index 06556e9..7219eec 100644 --- a/home/system/hyprland/hypridle.nix +++ b/home/system/hyprland/hypridle.nix @@ -1,23 +1,21 @@ -{ config, pkgs, ... }: { - home.packages = with pkgs; [ hypridle ]; +{ pkgs, ... }: { - xdg.configFile."hypr/hypridle.conf".text = '' - general { - ignore_dbus_inhibit = false - } - - # Screenlock - listener { - timeout = 600 - on-timeout = ${pkgs.hyprlock}/bin/hyprlock - on-resume = ${pkgs.libnotify}/bin/notify-send "Welcome back ${config.home.username}!" - } - - # Suspend (not working on my laptop) - #listener { - # timeout = 660 - # on-timeout = systemctl suspend - # on-resume = ${pkgs.libnotify}/bin/notify-send "Welcome back to your desktop!" - #} - ''; + services.hypridle = { + enable = true; + settings = { + general = { ignore_dbus_inhibit = false; }; + listener = [ + { + timeout = 600; + on-timeout = pkgs.hyprlock + "/bin/hyprlock"; + } + { + timeout = 660; + on-timeout = "systemctl suspend"; + on-resume = pkgs.libnotify + + "/bin/notify-send 'Welcome back to your desktop!'"; + } + ]; + }; + }; } diff --git a/home/system/hyprland/hyprlock.nix b/home/system/hyprland/hyprlock.nix index 5250983..cdf4622 100644 --- a/home/system/hyprland/hyprlock.nix +++ b/home/system/hyprland/hyprlock.nix @@ -1,75 +1,84 @@ -{ pkgs, config, ... }: { +{ config, ... }: { - home.packages = with pkgs; [ hyprlock ]; + programs.hyprlock = { + enable = true; + settings = { + general = { + disable_loading_bar = true; + grace = 5; + no_fade_in = true; + no_fade_out = true; + }; - xdg.configFile."hypr/hyprlock.conf".text = '' - background { - monitor = - path = $HOME/wallpapers/${config.var.theme.wallpaper} - color = rgb(${config.var.theme.colors.bg}) + background = { + monitor = ""; + path = "$HOME/wallpapers/${config.var.theme.wallpaper}"; + color = "rgb(${config.var.theme.colors.bg})"; - blur_size = 4 - blur_passes = 3 - noise = 0.0117 - contrast = 1.3000 - brightness = 0.8000 - vibrancy = 0.2100 - vibrancy_darkness = 0.0 - } + blur_size = 4; + blur_passes = 3; + noise = 1.17e-2; + contrast = 1.3; + brightness = 0.8; + vibrancy = 0.21; + vibrancy_darkness = 0.0; + }; - input-field { - monitor = - size = 250, 50 - outline_thickness = 3 - dots_size = 0.2 # Scale of input-field height, 0.2 - 0.8 - dots_spacing = 0.64 # Scale of dots' absolute size, 0.0 - 1.0 - dots_center = true - outer_color = rgb(${config.var.theme.colors.accent}) - inner_color = rgb(${config.var.theme.colors.bg}) - font_color = rgb(${config.var.theme.colors.fg}) - fade_on_empty = true - placeholder_text = Password... # Text rendered in the input box when it's empty. - hide_input = false - position = 0, 80 - halign = center - valign = bottom - } + input-field = [{ + monitor = ""; + size = "250, 50"; + outline_thickness = 3; + dots_size = 0.2; # Scale of input-field height, 0.2 - 0.8 + dots_spacing = 0.64; # Scale of dots' absolute size, 0.0 - 1.0 + dots_center = true; + outer_color = "rgb(${config.var.theme.colors.accent})"; + inner_color = "rgb(${config.var.theme.colors.bg})"; + font_color = "rgb(${config.var.theme.colors.fg})"; + fade_on_empty = true; + placeholder_text = + "Password..."; # Text rendered in the input box when it's empty. + position = "0, 80"; + halign = "center"; + valign = "bottom"; + }]; - # Current time - label { - monitor = - text = cmd[update:1000] echo " $(date +"%H:%M:%S") " - color = rgb(${config.var.theme.colors.fg}) - font_size = 64 - font_family = ${config.var.theme.font} - position = 0, 16 - halign = center - valign = center - } - - # User label - label { - monitor = - text = Hey $USER - color = rgb(${config.var.theme.colors.fg}) - font_size = 20 - font_family = ${config.var.theme.font} - position = 0, 0 - halign = center - valign = center - } - - - # Type to unlock - label { - monitor = - text = Type to unlock! - color = rgb(${config.var.theme.colors.fg}) - font_size = 16 - font_family = ${config.var.theme.font} - position = 0, 30 - halign = center - valign = bottom - } - ''; + label = [ + # Current time + { + monitor = ""; + text = + ''cmd[update:1000] echo " $(date +"%H:%M:%S") "''; + color = "rgb(${config.var.theme.colors.fg})"; + font_size = 64; + font_family = config.var.theme.font; + position = "0, 16"; + halign = "center"; + valign = "center"; + } + # User label + { + monitor = ""; + text = '' + Hey $USER''; + color = "rgb(${config.var.theme.colors.fg})"; + font_size = 20; + font_family = config.var.theme.font; + position = "0, 0"; + halign = "center"; + valign = "center"; + } + # Type to unlock + { + monitor = ""; + text = "Type to unlock!"; + color = "rgb(${config.var.theme.colors.fg})"; + font_size = 16; + font_family = config.var.theme.font; + position = "0, 30"; + halign = "center"; + valign = "bottom"; + } + ]; + }; + }; } diff --git a/home/system/hyprland/hyprpaper.nix b/home/system/hyprland/hyprpaper.nix index 8a0bdf1..3b6cd1f 100644 --- a/home/system/hyprland/hyprpaper.nix +++ b/home/system/hyprland/hyprpaper.nix @@ -1,10 +1,12 @@ -{ pkgs, config, ... }: { - home.packages = with pkgs; [ hyprpaper ]; - - xdg.configFile."hypr/hyprpaper.conf".text = '' - preload = ~/wallpapers/${config.var.theme.wallpaper} - wallpaper = ,~/wallpapers/${config.var.theme.wallpaper} - ipc=true - splash=false - ''; +{ config, ... }: { + services.hyprpaper = { + enable = true; + settings = { + ipc = "on"; + splash = false; + splash_offset = 2.0; + preload = [ "~/wallpapers/${config.var.theme.wallpaper}" ]; + wallpaper = [ ",~/wallpapers/${config.var.theme.wallpaper}" ]; + }; + }; } diff --git a/home/system/waybar/default.nix b/home/system/waybar/default.nix index aa0eb66..a89554a 100644 --- a/home/system/waybar/default.nix +++ b/home/system/waybar/default.nix @@ -9,10 +9,16 @@ # package = inputs.waybar.packages."${pkgs.system}".waybar; settings = { mainBar = { - layer = "top"; - position = "top"; + layer = config.var.theme.waybar.position; + position = config.var.theme.waybar.position; spacing = 0; - "margin-top" = if config.var.theme.waybar.float then + "margin-top" = if config.var.theme.waybar.float + && config.var.theme.waybar.position == "top" then + config.var.theme.gaps-out + else + 0; + "margin-bottom" = if config.var.theme.waybar.float + && config.var.theme.waybar.position == "bottom" then config.var.theme.gaps-out else 0; diff --git a/hosts/guest/variables.nix b/hosts/guest/variables.nix index eb81a51..45576d5 100644 --- a/hosts/guest/variables.nix +++ b/hosts/guest/variables.nix @@ -40,6 +40,7 @@ waybar = { transparent = true; float = true; + position = "top"; }; colors = { diff --git a/hosts/laptop/variables.nix b/hosts/laptop/variables.nix index 042b8d4..db8a51e 100644 --- a/hosts/laptop/variables.nix +++ b/hosts/laptop/variables.nix @@ -40,6 +40,7 @@ waybar = { transparent = true; float = true; + position = "top"; }; colors = {