nix-configs

Personal NixOS and home-manager configuration files
Log | Files | Refs

hyprland.nix (7567B)


      1 { lib, machine, vars, ... }:
      2 
      3 let
      4   numlockMachines = [ "atlas" "arcadia" ]; numlockEnabled = builtins.elem machine numlockMachines;
      5 in
      6 {
      7   wayland.windowManager.hyprland = {
      8     enable = true;
      9     configType = "lua";
     10     extraConfig = ''
     11       -- General
     12       hl.config({
     13         general={gaps_in=5,gaps_out=20,border_size=2,col={active_border={colors={"rgba(33ccffee)","rgba(00ff99ee)"},angle=45},inactive_border="rgba(595959aa)"},resize_on_border=false,allow_tearing=false,layout="dwindle"},
     14         decoration={rounding=10,rounding_power=2,active_opacity=1.0,inactive_opacity=1.0,shadow={enabled=true,range=4,render_power=3,color=0xee1a1a1a},blur={enabled=true,size=3,passes=1,vibrancy=0.1696}},
     15         animations={enabled=true},
     16         cursor={inactive_timeout=3},
     17         ecosystem={no_donation_nag=true}
     18       })
     19       -- Animations
     20       hl.curve("easeOutQuint",   { type = "bezier", points = { {0.23, 1},    {0.32, 1}    } })
     21       hl.curve("easeInOutCubic", { type = "bezier", points = { {0.65, 0.05}, {0.36, 1}    } })
     22       hl.curve("linear",         { type = "bezier", points = { {0, 0},       {1, 1}       } })
     23       hl.curve("almostLinear",   { type = "bezier", points = { {0.5, 0.5},   {0.75, 1}    } })
     24       hl.curve("quick",          { type = "bezier", points = { {0.15, 0},    {0.1, 1}     } })
     25       hl.curve("easy",           { type = "spring", mass = 1, stiffness = 71.2633, dampening = 15.8273644 })
     26       hl.animation({ leaf = "global",        enabled = true,  speed = 10,   bezier = "default" })
     27       hl.animation({ leaf = "border",        enabled = true,  speed = 5.39, bezier = "easeOutQuint" })
     28       hl.animation({ leaf = "windows",       enabled = true,  speed = 4.79, spring = "easy" })
     29       hl.animation({ leaf = "windowsIn",     enabled = true,  speed = 4.1,  spring = "easy",         style = "popin 87%" })
     30       hl.animation({ leaf = "windowsOut",    enabled = true,  speed = 1.49, bezier = "linear",       style = "popin 87%" })
     31       hl.animation({ leaf = "fadeIn",        enabled = true,  speed = 1.73, bezier = "almostLinear" })
     32       hl.animation({ leaf = "fadeOut",       enabled = true,  speed = 1.46, bezier = "almostLinear" })
     33       hl.animation({ leaf = "fade",          enabled = true,  speed = 3.03, bezier = "quick" })
     34       hl.animation({ leaf = "layers",        enabled = true,  speed = 3.81, bezier = "easeOutQuint" })
     35       hl.animation({ leaf = "layersIn",      enabled = true,  speed = 4,    bezier = "easeOutQuint", style = "fade" })
     36       hl.animation({ leaf = "layersOut",     enabled = true,  speed = 1.5,  bezier = "linear",       style = "fade" })
     37       hl.animation({ leaf = "fadeLayersIn",  enabled = true,  speed = 1.79, bezier = "almostLinear" })
     38       hl.animation({ leaf = "fadeLayersOut", enabled = true,  speed = 1.39, bezier = "almostLinear" })
     39       hl.animation({ leaf = "workspaces",    enabled = true,  speed = 1.94, bezier = "almostLinear", style = "fade" })
     40       hl.animation({ leaf = "workspacesIn",  enabled = true,  speed = 1.21, bezier = "almostLinear", style = "fade" })
     41       hl.animation({ leaf = "workspacesOut", enabled = true,  speed = 1.94, bezier = "almostLinear", style = "fade" })
     42       hl.animation({ leaf = "zoomFactor",    enabled = true,  speed = 7,    bezier = "quick" })
     43       -- Monitors
     44       hl.monitor({output="",mode="preferred",position="auto",scale="auto"})
     45       -- Environment
     46       hl.env("XCURSOR_SIZE", "24")
     47       hl.env("HYPRCURSOR_SIZE", "24")
     48       -- Layouts
     49       hl.config({dwindle={preserve_split=true}})
     50       hl.config({master={new_status="master"}})
     51       hl.config({scrolling={fullscreen_on_one_column=true}})
     52       -- Misc
     53       hl.config({misc={force_default_wallpaper=0,disable_hyprland_logo=true,disable_splash_rendering=true}})
     54       -- Input
     55       hl.config({input={numlock_by_default=${lib.boolToString numlockEnabled},kb_layout="gb",kb_options="caps:backspace",follow_mouse=1,sensitivity=0,touchpad={natural_scroll=false}}})
     56       -- Launch binds
     57       hl.bind("SUPER + T", hl.dsp.exec_cmd("alacritty"))
     58       hl.bind("SUPER + RETURN", hl.dsp.exec_cmd("alacritty"))
     59       hl.bind("SUPER + R", hl.dsp.exec_cmd("tofi-run | xargs -I{} sh -c '{}'"))
     60       hl.bind("ALT + Tab", hl.dsp.window.cycle_next())
     61       hl.bind("ALT + SHIFT + Tab", hl.dsp.window.cycle_next({ next = false }))
     62       hl.bind("SUPER + SHIFT + Q", hl.dsp.window.close())
     63       hl.bind("SUPER + E", hl.dsp.exec_cmd("alacritty -e lf"))
     64       -- WM controls
     65       hl.bind("SUPER + Space", hl.dsp.window.float({ action = "toggle" }))
     66       hl.bind("SUPER + F", hl.dsp.window.fullscreen())
     67       hl.bind("SUPER + P", hl.dsp.window.pseudo())
     68       hl.bind("SUPER + J", hl.dsp.layout("togglesplit"))    -- dwindle only
     69       hl.bind("SUPER + left",  hl.dsp.focus({ direction = "left" }))
     70       hl.bind("SUPER + right", hl.dsp.focus({ direction = "right" }))
     71       hl.bind("SUPER + up",    hl.dsp.focus({ direction = "up" }))
     72       hl.bind("SUPER + down",  hl.dsp.focus({ direction = "down" }))
     73       for a=1,10 do local b=a%10;
     74         hl.bind("SUPER + "..b,hl.dsp.focus({workspace=a}))
     75         hl.bind("SUPER + SHIFT + "..b,hl.dsp.window.move({workspace=a}))
     76       end
     77       hl.bind("ALT + mouse:272", hl.dsp.window.drag(),   { mouse = true })
     78       hl.bind("ALT + mouse:273", hl.dsp.window.resize(), { mouse = true })
     79       -- Media binds
     80       hl.bind("XF86AudioRaiseVolume", hl.dsp.exec_cmd("wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+"), { locked = true, repeating = true })
     81       hl.bind("XF86AudioLowerVolume", hl.dsp.exec_cmd("wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"),      { locked = true, repeating = true })
     82       hl.bind("XF86AudioMute",        hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"),     { locked = true, repeating = true })
     83       hl.bind("XF86AudioMicMute",     hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"),   { locked = true, repeating = true })
     84       hl.bind("XF86MonBrightnessUp",  hl.dsp.exec_cmd("brightnessctl -e4 -n2 set 5%+"),                  { locked = true, repeating = true })
     85       hl.bind("XF86MonBrightnessDown",hl.dsp.exec_cmd("brightnessctl -e4 -n2 set 5%-"),                  { locked = true, repeating = true })
     86       hl.bind("XF86AudioNext",  hl.dsp.exec_cmd("playerctl next"),       { locked = true })
     87       hl.bind("XF86AudioPause", hl.dsp.exec_cmd("playerctl play-pause"), { locked = true })
     88       hl.bind("XF86AudioPlay",  hl.dsp.exec_cmd("playerctl play-pause"), { locked = true })
     89       hl.bind("XF86AudioPrev",  hl.dsp.exec_cmd("playerctl previous"),   { locked = true })
     90       -- Smart gaps
     91       hl.workspace_rule({ workspace = "w[tv1]", gaps_out = 0, gaps_in = 0 })
     92       hl.workspace_rule({ workspace = "f[1]", gaps_out = 0, gaps_in = 0 })
     93       hl.window_rule({ match = { float = false, workspace = "w[tv1]" }, border_size = 0 })
     94       hl.window_rule({ match = { float = false, workspace = "w[tv1]" }, rounding = 0 })
     95       hl.window_rule({ match = { float = false, workspace = "f[1]" }, border_size = 0 })
     96       hl.window_rule({ match = { float = false, workspace = "f[1]" }, rounding = 0 })
     97       -- Ignore maximize requests from all apps
     98       hl.window_rule({name="suppress-maximize-events",match={class=".*"},suppress_event="maximize"})
     99       -- Fix XWayland dragging issues
    100       hl.window_rule({name="fix-xwayland-drags",match={class="^$",title="^$",xwayland=true,float=true,fullscreen=false,pin=false},no_focus=true})
    101     '';
    102     };
    103 
    104   dconf.enable = true;
    105 
    106   programs.fish.interactiveShellInit = ''
    107       if test (tty) = "/dev/tty1"; exec start-hyprland; end
    108     '';
    109 
    110 }