summaryrefslogtreecommitdiff
path: root/modules/home-manager/hyprland.nix
diff options
context:
space:
mode:
authorJasper Ras <jras@hostnet.nl>2025-02-12 08:19:04 +0100
committerJasper Ras <jras@hostnet.nl>2025-02-12 08:19:04 +0100
commit07f84bb581e369ff79100f0417e9d277f3c1fb61 (patch)
tree64ec899f185a3d794791df191f53939dbc67be41 /modules/home-manager/hyprland.nix
parent8fe481c0858702231335ad6c5eb850b293781b61 (diff)
alot of stuff
Diffstat (limited to 'modules/home-manager/hyprland.nix')
-rw-r--r--modules/home-manager/hyprland.nix297
1 files changed, 297 insertions, 0 deletions
diff --git a/modules/home-manager/hyprland.nix b/modules/home-manager/hyprland.nix
new file mode 100644
index 0000000..77bb675
--- /dev/null
+++ b/modules/home-manager/hyprland.nix
@@ -0,0 +1,297 @@
+{ pkgs, inputs, ... }:
+let
+ wallpaper = ../../assets/wallpaper.jpg;
+in
+{
+ home.packages = with pkgs; [
+ rofi-wayland-unwrapped
+ rofi-rbw-wayland
+ grimblast
+ hyprpicker
+ wl-clipboard
+ ];
+
+ # Required for hyprpicker's cursor but also seems to fix some icons for astal
+ home.pointerCursor = {
+ gtk.enable = true;
+ package = pkgs.adwaita-icon-theme;
+ name = "Adwaita";
+ size = 16;
+ };
+
+ services.wlsunset.enable = true;
+ services.wlsunset.sunrise = "06:00";
+ services.wlsunset.sunset = "17:00";
+
+ wayland.windowManager.hyprland.enable = true;
+ wayland.windowManager.hyprland.systemd.enable = true;
+ wayland.windowManager.hyprland.plugins = [
+ inputs.hy3.packages.x86_64-linux.hy3
+ ];
+
+ wayland.windowManager.hyprland.settings = {
+ "$terminal" = "alacritty";
+ "$mod" = "SUPER";
+
+ exec-once = [ ];
+
+ debug = {
+ "disable_logs" = false;
+ };
+
+ general = {
+ "layout" = "hy3";
+ "border_size" = 2;
+ "col.active_border" = "rgba(fe8423ee) rgba(e11701ee) 45deg";
+ "col.inactive_border" = "rgba(595959aa)";
+ };
+
+ monitor = [
+ "Unknown-1, disable"
+ ",preferred,auto,auto"
+ ];
+
+ xwayland = {
+ force_zero_scaling = true;
+ };
+
+ animations = {
+ bezier = [
+ "easeOutQuint,0.23,1,0.32,1"
+ "easeInOutCubic,0.65,0.05,0.36,1"
+ "linear,0,0,1,1"
+ "almostLinear,0.5,0.5,0.75,1.0"
+ "quick,0.15,0,0.1,1"
+ ];
+ animation = [
+ "global, 1, 10, default"
+ "border, 1, 5.39, easeOutQuint"
+ "windows, 1, 4.79, easeOutQuint"
+ "windowsIn, 1, 4.1, easeOutQuint, popin 87%"
+ "windowsOut, 1, 1.49, linear, popin 87%"
+ "fadeIn, 1, 1.73, almostLinear"
+ "fadeOut, 1, 1.46, almostLinear"
+ "fade, 1, 3.03, quick"
+ "layers, 1, 3.81, easeOutQuint"
+ "layersIn, 1, 4, easeOutQuint, fade"
+ "layersOut, 1, 1.5, linear, fade"
+ "fadeLayersIn, 1, 1.79, almostLinear"
+ "fadeLayersOut, 1, 1.39, almostLinear"
+ "workspaces, 1, 1.94, almostLinear, fade"
+ ];
+ };
+
+ decoration = {
+ "rounding" = 5;
+ "inactive_opacity" = 0.8;
+ };
+
+ bind =
+ [
+ "$mod, Return, exec, alacritty"
+ "$mod, Semicolon, hy3:makegroup, h"
+ "$mod, D, exec, ${pkgs.rofi-wayland-unwrapped}/bin/rofi -show drun"
+ "$mod, F, fullscreen, 1"
+ "$mod, H, hy3:movefocus, l"
+ "$mod, J, hy3:movefocus, d"
+ "$mod, K, hy3:movefocus, u"
+ "$mod, L, hy3:movefocus, r"
+ "$mod, P, exec, ${pkgs.grimblast}/bin/grimblast copy area"
+ "$mod, Q, exec, ${pkgs.hyprlock}/bin/hyprlock"
+ "$mod, V, hy3:makegroup, v"
+ "$mod, W, hy3:changegroup, toggletab"
+ "$mod, X, movecurrentworkspacetomonitor, +1"
+
+ "$mod SHIFT, C, exec, ${pkgs.hyprpicker}/bin/hyprpicker -a -f hex"
+ "$mod SHIFT, D, exec, ${pkgs.rofi-rbw-wayland}/bin/rofi-rbw"
+ "$mod SHIFT, H, hy3:movewindow, l"
+ "$mod SHIFT, J, hy3:movewindow, d"
+ "$mod SHIFT, K, hy3:movewindow, u"
+ "$mod SHIFT, L, hy3:movewindow, r"
+ "$mod SHIFT, P, exec, ${pkgs.grimblast}/bin/grimblast copy screen"
+ "$mod SHIFT, Q, hy3:killactive"
+ ]
+ ++ (
+ builtins.concatLists (builtins.genList (i:
+ let ws = i + 1;
+ in [
+ "$mod, code:1${toString i}, workspace, ${toString ws}"
+ "$mod SHIFT, code:1${toString i}, hy3:movetoworkspace, ${toString ws}"
+ ]
+ )
+ 9)
+ );
+
+ plugin = {
+ hy3 = {
+ tabs = {
+ "col.active" = "0xFFFE8423";
+ "col.inactive" = "0xFF103543";
+ "col.text.inactive" = "0xFFFECDB2";
+ };
+ };
+ };
+ };
+
+ services.hyprpaper.enable = true;
+ services.hyprpaper.settings = {
+ preload = [ "${wallpaper}" ];
+ wallpaper = [ ",${wallpaper}" ];
+ };
+ services.hypridle.enable = true;
+ services.hypridle.settings = {
+ general = {
+ lock_cmd = "pidof hyprlock || hyprlock";
+ };
+
+ listener = [
+ {
+ timeout = 120;
+ on-timeout = "brightnessctl -s set 10";
+ on-resume = "brightnessctl -r";
+ }
+ {
+ timeout = 300;
+ on-timeout = "pidof hyprlock || hyprlock";
+ }
+ {
+ timeout = 600;
+ on-timeout = "hyprctl dispatch dpms off";
+ on-resume = "hyprctl dispatch dpms on";
+ }
+ ];
+ };
+
+ programs.hyprlock.enable = true;
+ programs.hyprlock.settings = {
+ background = [
+ { path = "${wallpaper}";
+ blur_passes = 2;
+ monitor = "";
+ }
+ ];
+
+ general = {
+ no_fade_in = true;
+ no_fade_out = true;
+ hide_cursor = false;
+ disable_loading_bar = true;
+ grace = 0;
+ };
+
+ input-field = [
+ {
+ monitor = "";
+ size = "250, 60";
+ outline_thickness = 2;
+ dots_size = 0.2; # Scale of input-field height, 0.2 - 0.8
+ dots_spacing = 0.35; # Scale of dots' absolute size, 0.0 - 1.0
+ dots_center = true;
+ outer_color = "rgba(0, 0, 0, 0)";
+ inner_color = "rgba(0, 0, 0, 0.2)";
+ font_color = "$foreground";
+ fade_on_empty = false;
+ rounding = -1;
+ check_color = "rgb(204, 136, 34)";
+ placeholder_text = "<i><span foreground=\"##cdd6f4\">Input Password...</span></i>";
+ hide_input = false;
+ position = "0, -200";
+ halign = "center";
+ valign = "center";
+ }
+ ];
+ };
+
+ programs.alacritty = {
+ enable = true;
+ settings = {
+ window = {
+ padding = { x = 5; y = 2; };
+ };
+ env = { TERM = "alacritty-direct"; };
+ terminal.shell = {
+ program = "${pkgs.zsh}/bin/zsh";
+ args = [ "-l" ];
+ };
+ } // builtins.fromJSON (builtins.readFile ../../assets/alacritty-wavez.json);
+ };
+
+ xdg.mimeApps = {
+ enable = true;
+ defaultApplications = {
+ "x-scheme-handler/http" = "firefox.desktop";
+ "x-scheme-handler/https" = "firefox.desktop";
+ "x-scheme-handler/chrome" = "firefox.desktop";
+ "text/html" = "firefox.desktop";
+ "application/x-extension-htm" = "firefox.desktop";
+ "application/x-extension-html" = "firefox.desktop";
+ "application/x-extension-shtml" = "firefox.desktop";
+ "application/xhtml+xml" = "firefox.desktop";
+ "application/x-extension-xhtml" = "firefox.desktop";
+ "application/x-extension-xht" = "firefox.desktop";
+ };
+ associations.added = {
+ "x-scheme-handler/http" = "firefox.desktop";
+ "x-scheme-handler/https" = "firefox.desktop";
+ "x-scheme-handler/chrome" = "firefox.desktop";
+ "text/html" = "firefox.desktop";
+ "application/x-extension-htm" = "firefox.desktop";
+ "application/x-extension-html" = "firefox.desktop";
+ "application/x-extension-shtml" = "firefox.desktop";
+ "application/xhtml+xml" = "firefox.desktop";
+ "application/x-extension-xhtml" = "firefox.desktop";
+ "application/x-extension-xht" = "firefox.desktop";
+ };
+ };
+
+ programs.rbw.enable = true;
+ programs.rbw.settings = {
+ email = "jaspert.ras@gmail.com";
+ pinentry = pkgs.pinentry-gnome3;
+ };
+
+ systemd.user.services.hypr-events = {
+ Unit = {
+ Description = "Listens on Hypr's socket2 for events and handles them";
+ After = [ "graphical-session-pre.target" ];
+ };
+
+ Install = {
+ WantedBy = [ "graphical-session.target" ];
+ };
+
+ Service = {
+ Type = "exec";
+ ExecStart = pkgs.writeShellScript "hyprevents" ''
+ reload_astal() {
+ systemctl --user restart astal
+ }
+
+ handle() {
+ case $1 in
+ monitoradded*) reload_astal ;;
+ monitorremoved*) reload_astal ;;
+ esac
+ }
+
+ ${pkgs.socat}/bin/socat -U - UNIX-CONNECT:$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock | while read -r line; do handle "$line"; done
+ '';
+ };
+ };
+
+ systemd.user.services.astal = {
+ Unit = {
+ Description = "Runs the astal bar instance";
+ After = [ "graphical-session-pre.target" ];
+ };
+
+ Service = {
+ Type = "exec";
+ ExecStart = "${inputs.astal-bar.packages.x86_64-linux.default}/bin/astal-bar";
+ };
+
+ Install = {
+ WantedBy = [ "graphical-session.target" ];
+ };
+ };
+}