This commit is contained in:
Peritia 2026-02-12 15:32:45 +01:00
parent b6b87d5aed
commit 9c72a71585
3546 changed files with 18655 additions and 0 deletions

View file

@ -0,0 +1,54 @@
{
config,
lib,
nixosVista,
...
}: let
cfg = nixosVista.hyprland;
in {
############################################################
# Options exposed to the user
############################################################
options.nixosVista.hyprland = {
customTop = lib.mkOption {
type = lib.types.lines;
default = "";
description = ''
Custom Hyprland configuration injected near the top
of the generated config.
'';
};
customBottom = lib.mkOption {
type = lib.types.lines;
default = "";
description = ''
Custom Hyprland configuration injected at the very bottom
of the generated config.
'';
};
};
############################################################
# Inject into fragment system
############################################################
config = lib.mkIf nixosVista.enable {
nixosVista.hyprland.fragments.customTop = lib.mkIf (cfg.customTop != "") ''
############################################################
# Your Custom User / nixosVista.hyprland.customTop
############################################################
${cfg.customTop}
'';
nixosVista.hyprland.fragments.customBottom = lib.mkIf (cfg.customBottom != "") ''
############################################################
# Custom User Bottom Config / nixosVista.hyprland.customBottom
############################################################
${cfg.customBottom}
'';
};
}

View file

@ -0,0 +1,22 @@
{lib, ...}: {
imports = [
# Main entry:
./main.nix
# Each one is a Snippet for the main
# Each one will first add to the fragment so that it can build the hyprland config in order
./header.nix
./monitor.nix
./startup.nix
./variables.nix
./enviorment.nix
./special.nix
./input.nix
./keybindings.nix
./windowRules.nix
./style
# Doesn't work yet:
#./customUser.nix
];
}

View file

@ -0,0 +1,31 @@
{
config,
lib,
nixosVista,
...
}: let
cfg = nixosVista.hyprland;
############################################################
# Environment variables (Hyprland env = ...)
############################################################
envLines =
lib.mapAttrsToList
(name: value: "env = ${name},${value}")
cfg.env;
in {
config = lib.mkIf nixosVista.enable {
nixosVista.hyprland.fragments.environment = ''
############################################################
# Environment
############################################################
# env = XCURSOR_SIZE,24
# env = HYPRCURSOR_SIZE,24
${lib.concatStringsSep "\n" envLines}
'';
};
}

View file

@ -0,0 +1,18 @@
{
config,
lib,
nixosVista,
...
}: {
config = lib.mkIf nixosVista.enable {
#warnings = [">>> HYPRLAND HEADER MODULE ACTIVE <<<"];
nixosVista.hyprland.fragments.header = ''
# ========
# Hyprland config file
# Credit goes alot to diinki
# Inspiration: https://github.com/diinki/diinki-aero/
# ========
'';
};
}

View file

@ -0,0 +1,38 @@
{
config,
lib,
nixosVista,
...
}: let
cfg = nixosVista.hyprland.input;
optionalLine = name: value:
lib.optional (value != null && value != "")
"${name} = ${value}";
lines =
[
"kb_layout = ${cfg.kb_layout}"
"follow_mouse = ${toString cfg.follow_mouse}"
"sensitivity = ${toString cfg.sensitivity}"
]
++ optionalLine "kb_options" cfg.kb_options
++ optionalLine "kb_rules" cfg.kb_rules
++ optionalLine "kb_variant" cfg.kb_variant
++ optionalLine "kb_model" cfg.kb_model;
in {
config = lib.mkIf nixosVista.enable {
nixosVista.hyprland.fragments.input = ''
############################################################
# Input
############################################################
input {
${lib.concatStringsSep "\n " lines}
touchpad {
natural_scroll = ${lib.boolToString cfg.touchpad.natural_scroll}
}
}
'';
};
}

View file

@ -0,0 +1,170 @@
{
config,
lib,
nixosVista,
...
}: let
cfg = nixosVista.hyprland.keybindings;
############################################################
# Presets
############################################################
# I wanna adjust the Main Keybinds still a lil but anyone can easily build their own
defaultPreset = [
# Main modifier
#"$mainMod = SUPER"
# Switch focus Arrow keys
"bind = $mainMod, left, movefocus, l"
"bind = $mainMod, right, movefocus, r"
"bind = $mainMod, up, movefocus, u"
"bind = $mainMod, down, movefocus, d"
# Terminal
"bind = $mainMod, Enter, exec, $terminal"
"bind = $mainMod, Return, exec, $terminal"
# Kill active
"bind = $mainMod, Q, killactive"
# Screenshot
"bind = $mainMod SHIFT, S, exec, hyprshot --mode region --output-folder /tmp"
# File manager
"bind = $mainMod, E, exec, $fileManager"
# Toggle floating
"bind = $mainMod SHIFT, SPACE, togglefloating"
# Fullscreen
"bind = $mainMod, F, fullscreen"
# Launcher
"bind = $mainMod, D, exec, $menu"
# Workspaces
"bind = $mainMod, 1, workspace, 1"
"bind = $mainMod, 2, workspace, 2"
"bind = $mainMod, 3, workspace, 3"
"bind = $mainMod, 4, workspace, 4"
"bind = $mainMod, 5, workspace, 5"
"bind = $mainMod, 6, workspace, 6"
"bind = $mainMod, 7, workspace, 7"
"bind = $mainMod, 8, workspace, 8"
"bind = $mainMod, 9, workspace, 9"
"bind = $mainMod, 0, workspace, 10"
# Move to workspace
"bind = $mainMod SHIFT, 1, movetoworkspace, 1"
"bind = $mainMod SHIFT, 2, movetoworkspace, 2"
"bind = $mainMod SHIFT, 3, movetoworkspace, 3"
"bind = $mainMod SHIFT, 4, movetoworkspace, 4"
"bind = $mainMod SHIFT, 5, movetoworkspace, 5"
"bind = $mainMod SHIFT, 6, movetoworkspace, 6"
"bind = $mainMod SHIFT, 7, movetoworkspace, 7"
"bind = $mainMod SHIFT, 8, movetoworkspace, 8"
"bind = $mainMod SHIFT, 9, movetoworkspace, 9"
"bind = $mainMod SHIFT, 0, movetoworkspace, 10"
# Mouse
"bindm = $mainMod, mouse:272, movewindow"
"bindm = $mainMod, mouse:273, resizewindow"
# Volume / brightness
"bindel = ,XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+"
"bindel = ,XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"
"bindel = ,XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"
"bindel = ,XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"
"bindel = ,XF86MonBrightnessUp, exec, brightnessctl s 10%+"
"bindel = ,XF86MonBrightnessDown, exec, brightnessctl s 10%-"
];
diinkii = [
# Main modifier
#"$mainMod = SUPER"
# Terminal
"bind = $mainMod, Return, exec, $terminal"
# Kill active
"bind = $mainMod, Q, killactive"
# Screenshot
"bind = $mainMod SHIFT, S, exec, hyprshot --mode region --output-folder /tmp"
# File manager
"bind = $mainMod, E, exec, $fileManager"
# Toggle floating
"bind = $mainMod SHIFT, SPACE, togglefloating"
# Fullscreen
"bind = $mainMod, F, fullscreen"
# Launcher
"bind = $mainMod, D, exec, $menu"
# Workspaces
"bind = $mainMod, 1, workspace, 1"
"bind = $mainMod, 2, workspace, 2"
"bind = $mainMod, 3, workspace, 3"
"bind = $mainMod, 4, workspace, 4"
"bind = $mainMod, 5, workspace, 5"
"bind = $mainMod, 6, workspace, 6"
"bind = $mainMod, 7, workspace, 7"
"bind = $mainMod, 8, workspace, 8"
"bind = $mainMod, 9, workspace, 9"
"bind = $mainMod, 0, workspace, 10"
# Move to workspace
"bind = $mainMod SHIFT, 1, movetoworkspace, 1"
"bind = $mainMod SHIFT, 2, movetoworkspace, 2"
"bind = $mainMod SHIFT, 3, movetoworkspace, 3"
"bind = $mainMod SHIFT, 4, movetoworkspace, 4"
"bind = $mainMod SHIFT, 5, movetoworkspace, 5"
"bind = $mainMod SHIFT, 6, movetoworkspace, 6"
"bind = $mainMod SHIFT, 7, movetoworkspace, 7"
"bind = $mainMod SHIFT, 8, movetoworkspace, 8"
"bind = $mainMod SHIFT, 9, movetoworkspace, 9"
"bind = $mainMod SHIFT, 0, movetoworkspace, 10"
# Mouse
"bindm = $mainMod, mouse:272, movewindow"
"bindm = $mainMod, mouse:273, resizewindow"
# Volume / brightness
"bindel = ,XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+"
"bindel = ,XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"
"bindel = ,XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"
"bindel = ,XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"
"bindel = ,XF86MonBrightnessUp, exec, brightnessctl s 10%+"
"bindel = ,XF86MonBrightnessDown, exec, brightnessctl s 10%-"
];
minimalPreset = [
"$mainMod = SUPER"
"bind = $mainMod, Return, exec, $terminal"
"bind = $mainMod, Q, killactive"
];
presetBinds =
if cfg.preset == "default"
then defaultPreset
else if cfg.preset == "minimal"
then minimalPreset
else [];
finalBinds = presetBinds ++ cfg.extra;
in {
config = lib.mkIf (nixosVista.enable && finalBinds != []) {
#warnings = [">>> HYPRLAND KEYBINDS MODULE ACTIVE <<<"];
nixosVista.hyprland.fragments.keybinds = ''
############################################################
# Keybindings
############################################################
${lib.concatStringsSep "\n" finalBinds}
'';
};
}

View file

@ -0,0 +1,92 @@
{
config,
lib,
nixosVista,
...
}: let
############################################################
# Correct Fragment Source (IMPORTANT)
############################################################
fragments =
config.nixosVista.hyprland.fragments or {};
get = name:
fragments.${name} or "";
ordered = [
(get "header")
(get "customTop")
(get "monitors")
(get "startup")
(get "variables")
(get "environment")
(get "special")
(get "input")
(get "style")
(get "animation")
(get "keybinds")
(get "windowRules")
(get "customBottom")
];
filteredOrdered =
lib.filter (x: x != "") ordered;
finalConfig = lib.concatStringsSep "\n\n" (
[
''
# IF YOU SEE THIS IT LOADED
# Not needed anymore
#exec-once = hyprctl notify 5 3000 "rgb(ff0000)" "HM HYPRLAND ACTIVE"
''
]
++ filteredOrdered
);
in {
############################################################
# Root Options
############################################################
options.nixosVista.hyprland = {
enable =
lib.mkEnableOption "NixOS-Vista Hyprland configuration";
fragments = lib.mkOption {
type = lib.types.attrsOf lib.types.lines;
default = {};
internal = true;
description = "Internal fragment registry for deterministic assembly.";
};
};
############################################################
# Config
############################################################
# Uncomment this and it will error:
#warnings = [">>> HYPRLAND main.nix gets imported <<<"];
config = lib.mkIf nixosVista.enable {
##########################################################
# Warnings
##########################################################
# Not needed anymore:
# warnings = let
# fragmentNames =
# builtins.attrNames fragments;
# in [
# ">>> HYPRLAND HM MODULE IS LOADED <<<"
# ">>> ENABLE = ${toString config.nixosVista.hyprland.enable}"
# ">>> REGISTERED FRAGMENTS: ${toString fragmentNames}"
# ">>> ORDERED COUNT (non-empty): ${toString (builtins.length filteredOrdered)}"
# ">>> FINAL CONFIG LENGTH: ${toString (builtins.stringLength finalConfig)}"
# ];
##########################################################
wayland.windowManager.hyprland = {
enable = true;
extraConfig = finalConfig;
};
};
}

View file

@ -0,0 +1,56 @@
{
config,
lib,
nixosVista,
...
}: let
cfg = nixosVista;
############################################################
# Generate explicit monitor lines
############################################################
explicitMonitors =
lib.mapAttrsToList
(
name: settings: "monitor = ${name}, ${settings}"
)
cfg.monitor.list;
############################################################
# Optional fallback monitor
############################################################
fallbackMonitor =
lib.optional
(cfg.monitor.defaultMonitor != null)
"monitor = , ${cfg.monitor.defaultMonitor}";
############################################################
# Final monitor block
############################################################
monitorConfig =
explicitMonitors ++ fallbackMonitor;
in {
config = lib.mkIf (nixosVista.enable && monitorConfig != []) {
#warnings = [">>> HYPRLAND MONITOR MODULE ACTIVE <<<"];
nixosVista.hyprland.fragments.monitors = ''
############################################################
# Monitors
############################################################
# Run `hyprctl monitors all` to see available monitor names
#
# Format:
# monitor = NAME, RESOLUTION@REFRESH, POSITION, SCALE
#
# Example:
# monitor = DP-1, 1920x1080@144, 0x0, 1
# monitor = , preferred, auto, 1
############################################################
${lib.concatStringsSep "\n" monitorConfig}
'';
};
}

View file

@ -0,0 +1,40 @@
{
config,
lib,
nixosVista,
...
}: let
cfg = nixosVista.hyprland.special;
in {
config = lib.mkIf (nixosVista.enable && cfg.noHardwareCursor) {
nixosVista.hyprland.fragments.special = ''
############################################################
# Special Settings
############################################################
cursor {
no_hardware_cursors = true
}
############################################################
# Ill make an option for this later:
############################################################
# We have our own wallpapers :) So I'll disable default things.
misc {
force_default_wallpaper = 0
disable_hyprland_logo = true
}
# No need for gestures unless you have a touch display.
# gestures {
# workspace_swipe = false
# }
'';
};
}

View file

@ -0,0 +1,66 @@
{
config,
lib,
nixosVista,
...
}: let
cfg = nixosVista.hyprland.startup;
root = nixosVista;
############################################################
# Default Preset (Context Aware)
############################################################
defaultExecOnce = [
"nm-applet"
"waybar"
"hyprpaper"
# "/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1"
"$HOME/.config/eww/start.sh"
];
defaultExec = [];
minimalExecOnce = [];
minimalExec = [];
############################################################
# Select preset
############################################################
presetExecOnce =
if cfg.preset == "default"
then defaultExecOnce
else if cfg.preset == "minimal"
then minimalExecOnce
else [];
presetExec =
if cfg.preset == "default"
then defaultExec
else if cfg.preset == "minimal"
then minimalExec
else [];
############################################################
# Merge user extras
############################################################
finalExecOnce = presetExecOnce ++ cfg.extraExecOnce;
finalExec = presetExec ++ cfg.extraExec;
execOnceLines = map (cmd: "exec-once = ${cmd}") finalExecOnce;
execLines = map (cmd: "exec = ${cmd}") finalExec;
allLines = execOnceLines ++ execLines;
in {
config = lib.mkIf (nixosVista.enable && allLines != []) {
nixosVista.hyprland.fragments.startup = ''
############################################################
# Startup Programs
############################################################
${lib.concatStringsSep "\n" allLines}
'';
};
}

View file

@ -0,0 +1,27 @@
{
config,
lib,
nixosVista,
...
}: let
cfg = nixosVista.hyprland.style.animation;
animationLines =
lib.concatStringsSep "\n " cfg.config;
in {
config = lib.mkIf nixosVista.enable {
#warnings = [ ">>> HYPRLAND Animations MODULE ACTIVE <<<" ];
nixosVista.hyprland.fragments.animation = ''
############################################################
# Animations
############################################################
animations {
enabled = ${lib.boolToString cfg.enabled}
${animationLines}
}
'';
};
}

View file

@ -0,0 +1,6 @@
{
imports = [
./animation.nix
./style.nix
];
}

View file

@ -0,0 +1,85 @@
{
cfg,
lib,
nixosVista,
...
}: let
enabled = nixosVista.enable && nixosVista.theme.enable;
in {
config = lib.mkIf enabled {
#warnings = [">>> HYPRLAND STYLE MODULE ACTIVE <<<"];
nixosVista.hyprland.fragments.style = ''
# ========
# Credit goes alot to diinki
# Inspiration: https://github.com/diinki/diinki-aero/
# ========
# !!DESIGN!! #
# --------------------------------------------------------------------------------- #
# !!DESIGN!! #
# The gaps between windows, as well as border colors.
# proportional to the taskbar values.
general {
# Inner and Outer gaps between windows.
gaps_in = 5
gaps_out = 10
# I prefer a thin border
border_size = 1
# Border colors.
col.active_border = rgb(18,18,18)
col.inactive_border = rgb(18,18,18)
# Set to true enable resizing windows by clicking and dragging on borders and gaps
resize_on_border = true
layout = dwindle
# READ https://wiki.hyprland.org/Configuring/Tearing/ BEFORE TURNING ON!
allow_tearing = false
}
# Window Decorations! Shadow, Blur, etc.
decoration {
# 8px same as taskbar, change if wanted.
rounding = 12
# I want transparancy to not change, since we have the colored border.
active_opacity = 1.0
inactive_opacity = 1
# Window Shadow
shadow:enabled = true
shadow:range = 16
shadow:render_power = 5
shadow:color = rgba(0,0,0,0.35)
# Transparent Window Blur
blur:enabled = true
blur:new_optimizations = true
blur:size = 2
blur:passes = 3
blur:vibrancy = 0.1696
}
# Read https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more info on dwindle layout.
dwindle {
pseudotile = true
preserve_split = true
}
# Read https://wiki.hyprland.org/Configuring/Master-Layout/ for more info on master layout.
master {
new_status = master
}
'';
};
}

View file

@ -0,0 +1,32 @@
{
config,
lib,
nixosVista,
...
}: let
cfg = nixosVista.hyprland;
############################################################
# Generate $variables
############################################################
variables =
lib.mapAttrsToList
(name: value: "\$${name} = ${value}")
cfg.variables;
in {
config = lib.mkIf nixosVista.enable {
nixosVista.hyprland.fragments.variables = ''
############################################################
# Hyprland Variables
############################################################
# $terminal = kitty
# $fileManager = caja
# $menu = wofi --show drun
${lib.concatStringsSep "\n" variables}
'';
};
}

View file

@ -0,0 +1,66 @@
{
config,
lib,
nixosVista,
...
}: let
cfg = nixosVista.hyprland.windowRules;
############################################################
# Default Preset
############################################################
defaultPreset = [
# This adds a blur to the background of wofi (our app launcher)
# The reason we can't do this within wofi itself, is because gtk3 doesn't
# have a built-in background blur.
"layerrule = blur none, match:namespace wofi"
"layerrule = ignore_alpha 0.01, match:namespace wofi"
# Add blur to waybar, for same reason as above. Since we have two versions
# of the waybar design, one with translucency.
"layerrule = blur none, match:namespace waybar"
"layerrule = blur_popups on, match:namespace waybar"
"layerrule = ignore_alpha 0.01, match:namespace waybar"
# Add blur to eww widgets
"layerrule = blur none, match:namespace eww"
"layerrule = blur_popups on, match:namespace eww"
"layerrule = ignore_alpha 0.01, match:namespace eww"
# Fix dragging issues with XWayland
"windowrule = no_focus on, match:class ^$, match:title ^$, match:xwayland true, match:float true, match:fullscreen false, match:pin false"
];
minimalPreset = [];
############################################################
# Select preset
############################################################
presetRules =
if cfg.preset == "default"
then defaultPreset
else if cfg.preset == "minimal"
then minimalPreset
else [];
############################################################
# Merge preset + extra
############################################################
finalRules = presetRules ++ cfg.extra;
in {
config = lib.mkIf (nixosVista.enable && finalRules != []) {
nixosVista.hyprland.fragments.windowRules = ''
############################################################
# Window Rules
############################################################
# Here should be the new lines:
${lib.concatStringsSep "\n" finalRules}
'';
};
}