Modules/Hyprland: Use hyprland flake instead of nixpkgs and split config into multiple files
This commit is contained in:
24
flake.nix
24
flake.nix
@ -32,10 +32,6 @@
|
|||||||
nur.url = "github:nix-community/NUR";
|
nur.url = "github:nix-community/NUR";
|
||||||
nur.inputs.nixpkgs.follows = "nixpkgs";
|
nur.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
|
||||||
# Firefox theme
|
|
||||||
textfox.url = "github:adriankarlen/textfox";
|
|
||||||
textfox.inputs.nixpkgs.follows = "nixpkgs";
|
|
||||||
|
|
||||||
# Nix Package Search - nps
|
# Nix Package Search - nps
|
||||||
nps.url = "github:OleMussmann/nps";
|
nps.url = "github:OleMussmann/nps";
|
||||||
nps.inputs.nixpkgs.follows = "nixpkgs";
|
nps.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
@ -44,6 +40,16 @@
|
|||||||
nix-alien.url = "github:thiagokokada/nix-alien";
|
nix-alien.url = "github:thiagokokada/nix-alien";
|
||||||
nix-alien.inputs.nixpkgs.follows = "nixpkgs";
|
nix-alien.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
|
||||||
|
# Hyprland (use flake so plugins are not built from source)
|
||||||
|
hyprland.url = "github:hyprwm/Hyprland";
|
||||||
|
hyprland.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
|
||||||
|
# HyprPlugins
|
||||||
|
hyprland-plugins.url = "github:hyprwm/hyprland-plugins";
|
||||||
|
hyprland-plugins.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
hypr-dynamic-cursors.url = "github:VirtCode/hypr-dynamic-cursors";
|
||||||
|
hypr-dynamic-cursors.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
|
||||||
# NeoVim <3
|
# NeoVim <3
|
||||||
nixvim.url = "github:nix-community/nixvim";
|
nixvim.url = "github:nix-community/nixvim";
|
||||||
nixvim.inputs.nixpkgs.follows = "nixpkgs";
|
nixvim.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
@ -52,6 +58,10 @@
|
|||||||
# emacs-overlay.url = "github:nix-community/emacs-overlay";
|
# emacs-overlay.url = "github:nix-community/emacs-overlay";
|
||||||
# emacs-overlay.inputs.nixpkgs.follows = "nixpkgs";
|
# emacs-overlay.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
|
||||||
|
# Firefox theme
|
||||||
|
textfox.url = "github:adriankarlen/textfox";
|
||||||
|
textfox.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
|
||||||
# Declarative Flatpak
|
# Declarative Flatpak
|
||||||
nix-flatpak.url = "github:gmodena/nix-flatpak/?ref=latest";
|
nix-flatpak.url = "github:gmodena/nix-flatpak/?ref=latest";
|
||||||
# nix-flatpak.inputs.nixpkgs.follows = "nixpkgs"; # nix-flatpak doesn't have this
|
# nix-flatpak.inputs.nixpkgs.follows = "nixpkgs"; # nix-flatpak doesn't have this
|
||||||
@ -60,12 +70,6 @@
|
|||||||
# musnix.url = "github:musnix/musnix";
|
# musnix.url = "github:musnix/musnix";
|
||||||
# musnix.inputs.nixpkgs.follows = "nixpkgs";
|
# musnix.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
|
||||||
# HyprPlugins
|
|
||||||
# hyprland-plugins.url = "github:hyprwm/hyprland-plugins";
|
|
||||||
# hyprland-plugins.inputs.nixpkgs.follows = "nixpkgs";
|
|
||||||
# hypr-dynamic-cursors.url = "github:VirtCode/hypr-dynamic-cursors";
|
|
||||||
# hypr-dynamic-cursors.inputs.nixpkgs.follows = "nixpkgs";
|
|
||||||
|
|
||||||
# Pinned versions
|
# Pinned versions
|
||||||
# v4l2loopback-pinned.url = "github:nixos/nixpkgs/4684fd6b0c01e4b7d99027a34c93c2e09ecafee2";
|
# v4l2loopback-pinned.url = "github:nixos/nixpkgs/4684fd6b0c01e4b7d99027a34c93c2e09ecafee2";
|
||||||
# unityhub-pinned.url = "github:huantianad/nixpkgs/9542b0bc7701e173a10e6977e57bbba68bb3051f";
|
# unityhub-pinned.url = "github:huantianad/nixpkgs/9542b0bc7701e173a10e6977e57bbba68bb3051f";
|
||||||
|
29
home/modules/hyprland/autostart.nix
Normal file
29
home/modules/hyprland/autostart.nix
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
hyprland,
|
||||||
|
}:
|
||||||
|
builtins.concatLists [
|
||||||
|
(lib.optionals hyprland.dunst.enable ["dunst"]) # Notifications
|
||||||
|
[
|
||||||
|
# Start clipboard management
|
||||||
|
"wl-paste -t text --watch clipman store --no-persist"
|
||||||
|
"wl-paste -p -t text --watch clipman store -P --histpath=\"~/.local/share/clipman-primary.json\""
|
||||||
|
|
||||||
|
"hyprctl setcursor Bibata-Modern-Classic 16"
|
||||||
|
"hyprsunset --identity"
|
||||||
|
|
||||||
|
# HACK: Hyprland doesn't set the xwayland/x11 keymap correctly
|
||||||
|
"setxkbmap -layout ${hyprland.keyboard.layout} -variant ${hyprland.keyboard.variant} -option ${hyprland.keyboard.option} -model pc104"
|
||||||
|
|
||||||
|
# HACK: Flatpak doesn't find applications in the system PATH
|
||||||
|
"systemctl --user import-environment PATH && systemctl --user restart xdg-desktop-portal.service"
|
||||||
|
|
||||||
|
# Provide a polkit authentication UI.
|
||||||
|
# This is used for example when running systemd commands without root.
|
||||||
|
# "systemctl --user start hyprpolkitagent.service"
|
||||||
|
# "${pkgs.kdePackages.polkit-kde-agent-1}/libexec/polkit-kde-authentication-agent-1"
|
||||||
|
"${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"
|
||||||
|
]
|
||||||
|
]
|
@ -10,110 +10,14 @@
|
|||||||
}: let
|
}: let
|
||||||
inherit (config.modules) hyprland color;
|
inherit (config.modules) hyprland color;
|
||||||
|
|
||||||
always-bind = lib.mergeAttrsList [
|
always-bind = import ./mappings.nix {inherit lib config hyprland;};
|
||||||
{
|
|
||||||
# Hyprland control
|
|
||||||
"$mainMod, a" = ["exec, rofi -drun-show-actions -show drun"];
|
|
||||||
"$mainMod, q" = ["killactive"];
|
|
||||||
"$mainMod, v" = ["togglefloating"];
|
|
||||||
"$mainMod, f" = ["fullscreen"];
|
|
||||||
"$mainMod, c" = ["exec, clipman pick --tool=rofi"];
|
|
||||||
"$mainMod SHIFT, l" = ["exec, loginctl lock-session"];
|
|
||||||
"$mainMod, tab" = ["workspace, previous"];
|
|
||||||
"ALT, tab" = ["exec, rofi -show window"];
|
|
||||||
# "$mainMod, g" = ["togglegroup"];
|
|
||||||
# "ALT, tab" = ["changegroupactive"];
|
|
||||||
|
|
||||||
# Move focus with mainMod + arrow keys
|
|
||||||
"$mainMod, h" = ["movefocus, l"];
|
|
||||||
"$mainMod, l" = ["movefocus, r"];
|
|
||||||
"$mainMod, k" = ["movefocus, u"];
|
|
||||||
"$mainMod, j" = ["movefocus, d"];
|
|
||||||
|
|
||||||
# Swap windows
|
|
||||||
"$mainMod CTRL, h" = ["movewindow, l"];
|
|
||||||
"$mainMod CTRL, l" = ["movewindow, r"];
|
|
||||||
"$mainMod CTRL, k" = ["movewindow, u"];
|
|
||||||
"$mainMod CTRL, d" = ["movewindow, d"];
|
|
||||||
|
|
||||||
# Reset workspaces to the defined configuration in hyprland.workspaces:
|
|
||||||
"CTRL ALT, r" = let
|
|
||||||
mkWBinding = m: w:
|
|
||||||
"moveworkspacetomonitor, "
|
|
||||||
+ "${builtins.toString w} ${builtins.toString m}";
|
|
||||||
mkWsBindings = m: ws: builtins.map (mkWBinding m) ws;
|
|
||||||
in
|
|
||||||
hyprland.workspaces
|
|
||||||
|> builtins.mapAttrs mkWsBindings
|
|
||||||
|> builtins.attrValues
|
|
||||||
|> builtins.concatLists;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Switch to WS: "$mainMod, 1" = ["workspace, 1"];
|
|
||||||
(let
|
|
||||||
mkWBinding = w: k: {"$mainMod, ${k}" = ["workspace, ${w}"];};
|
|
||||||
in
|
|
||||||
hyprland.keybindings.ws-bindings
|
|
||||||
|> builtins.mapAttrs mkWBinding
|
|
||||||
|> builtins.attrValues
|
|
||||||
|> lib.mergeAttrsList)
|
|
||||||
|
|
||||||
# Toggle special WS: "$mainMod, x" = ["togglespecialworkspace, ferdium"];
|
|
||||||
(let
|
|
||||||
mkSpecialWBinding = w: k: {"$mainMod, ${k}" = ["togglespecialworkspace, ${w}"];};
|
|
||||||
in
|
|
||||||
hyprland.keybindings.special-ws-bindings
|
|
||||||
|> builtins.mapAttrs mkSpecialWBinding
|
|
||||||
|> builtins.attrValues
|
|
||||||
|> lib.mergeAttrsList)
|
|
||||||
|
|
||||||
# Move to WS: "$mainMod SHIFT, 1" = ["movetoworkspace, 1"];
|
|
||||||
(let
|
|
||||||
mkMoveWBinding = w: k: {"$mainMod SHIFT, ${k}" = ["movetoworkspace, ${w}"];};
|
|
||||||
in
|
|
||||||
(hyprland.keybindings.ws-bindings)
|
|
||||||
|> builtins.mapAttrs mkMoveWBinding
|
|
||||||
|> builtins.attrValues
|
|
||||||
|> lib.mergeAttrsList)
|
|
||||||
|
|
||||||
# Move to special WS: "$mainMod SHIFT, x" = ["movetoworkspace, special:ferdium"];
|
|
||||||
(let
|
|
||||||
mkSpecialMoveWBinding = w: k: {"$mainMod SHIFT, ${k}" = ["movetoworkspace, special:${w}"];};
|
|
||||||
in
|
|
||||||
(hyprland.keybindings.special-ws-bindings)
|
|
||||||
|> builtins.mapAttrs mkSpecialMoveWBinding
|
|
||||||
|> builtins.attrValues
|
|
||||||
|> lib.mergeAttrsList)
|
|
||||||
];
|
|
||||||
|
|
||||||
always-bindm = {
|
always-bindm = {
|
||||||
"$mainMod, mouse:272" = ["movewindow"];
|
"$mainMod, mouse:272" = ["movewindow"];
|
||||||
"$mainMod, mouse:273" = ["resizewindow"];
|
"$mainMod, mouse:273" = ["resizewindow"];
|
||||||
};
|
};
|
||||||
|
|
||||||
always-exec = builtins.concatLists [
|
always-exec = import ./autostart.nix {inherit lib pkgs config hyprland;};
|
||||||
(lib.optionals hyprland.dunst.enable ["dunst"]) # Notifications
|
|
||||||
[
|
|
||||||
# Start clipboard management
|
|
||||||
"wl-paste -t text --watch clipman store --no-persist"
|
|
||||||
"wl-paste -p -t text --watch clipman store -P --histpath=\"~/.local/share/clipman-primary.json\""
|
|
||||||
|
|
||||||
"hyprctl setcursor Bibata-Modern-Classic 16"
|
|
||||||
"hyprsunset --identity"
|
|
||||||
|
|
||||||
# HACK: Hyprland doesn't set the xwayland/x11 keymap correctly
|
|
||||||
"setxkbmap -layout ${hyprland.keyboard.layout} -variant ${hyprland.keyboard.variant} -option ${hyprland.keyboard.option} -model pc104"
|
|
||||||
|
|
||||||
# HACK: Flatpak doesn't find applications in the system PATH
|
|
||||||
"systemctl --user import-environment PATH && systemctl --user restart xdg-desktop-portal.service"
|
|
||||||
|
|
||||||
# Provide a polkit authentication UI.
|
|
||||||
# This is used for example when running systemd commands without root.
|
|
||||||
# "systemctl --user start hyprpolkitagent.service"
|
|
||||||
# "${pkgs.kdePackages.polkit-kde-agent-1}/libexec/polkit-kde-authentication-agent-1"
|
|
||||||
"${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"
|
|
||||||
]
|
|
||||||
];
|
|
||||||
in {
|
in {
|
||||||
options.modules.hyprland = import ./options.nix {inherit lib mylib;};
|
options.modules.hyprland = import ./options.nix {inherit lib mylib;};
|
||||||
|
|
||||||
@ -207,6 +111,9 @@ in {
|
|||||||
};
|
};
|
||||||
|
|
||||||
programs = {
|
programs = {
|
||||||
|
hyprlock = import ./hyprlock.nix {inherit config hyprland color;};
|
||||||
|
|
||||||
|
# TODO: IMV shouldn't be part of the hyprland module
|
||||||
imv = {
|
imv = {
|
||||||
enable = true;
|
enable = true;
|
||||||
settings = {
|
settings = {
|
||||||
@ -219,176 +126,27 @@ in {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
hyprlock = {
|
|
||||||
enable = true;
|
|
||||||
|
|
||||||
settings = {
|
|
||||||
general = {
|
|
||||||
disable_loading_bar = true;
|
|
||||||
grace = 0; # Immediately lock
|
|
||||||
hide_cursor = true;
|
|
||||||
no_fade_in = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
# The widgets start here.
|
|
||||||
|
|
||||||
background = [
|
|
||||||
{
|
|
||||||
path = "${config.paths.nixflake}/wallpapers/${color.wallpaper}.jpg";
|
|
||||||
blur_passes = 3;
|
|
||||||
blur_size = 10;
|
|
||||||
monitor = "";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
input-field = [
|
|
||||||
# Password input
|
|
||||||
{
|
|
||||||
size = "200, 50";
|
|
||||||
position = "0, 0";
|
|
||||||
monitor = "";
|
|
||||||
dots_center = true;
|
|
||||||
fade_on_empty = false;
|
|
||||||
font_color = "rgb(${color.hex.accentText})";
|
|
||||||
font_family = "${color.font}";
|
|
||||||
inner_color = "rgb(${color.hex.accent})";
|
|
||||||
outer_color = "rgb(${color.hex.accent})";
|
|
||||||
outline_thickness = 2;
|
|
||||||
placeholder_text = "<span foreground='\#\#${color.hex.accentText}'>Password...</span>";
|
|
||||||
shadow_passes = 0;
|
|
||||||
rounding = 4;
|
|
||||||
halign = "center";
|
|
||||||
valign = "center";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
label = [
|
|
||||||
# Date
|
|
||||||
{
|
|
||||||
position = "0, 300";
|
|
||||||
monitor = "";
|
|
||||||
text = ''cmd[update:1000] date -I'';
|
|
||||||
color = "rgba(${color.hex.text}AA)";
|
|
||||||
font_size = 22;
|
|
||||||
font_family = "${color.font}";
|
|
||||||
halign = "center";
|
|
||||||
valign = "center";
|
|
||||||
}
|
|
||||||
|
|
||||||
# Time
|
|
||||||
{
|
|
||||||
position = "0, 200";
|
|
||||||
monitor = "";
|
|
||||||
text = ''cmd[update:1000] date +"%-H:%M"'';
|
|
||||||
color = "rgba(${color.hex.text}AA)";
|
|
||||||
font_size = 95;
|
|
||||||
font_family = "${color.font} Extrabold";
|
|
||||||
halign = "center";
|
|
||||||
valign = "center";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
services = {
|
services = {
|
||||||
hyprpaper = {
|
# TODO: Dunst shouldn't be part of the hyprland module
|
||||||
enable = true;
|
dunst = import ./dunst.nix {inherit pkgs config hyprland color;};
|
||||||
|
hypridle = import ./hypridle.nix {inherit config hyprland color;};
|
||||||
settings = {
|
hyprpaper = import ./hyprpaper.nix {inherit config hyprland color;};
|
||||||
ipc = "on";
|
|
||||||
splash = false;
|
|
||||||
splash_offset = 2.0;
|
|
||||||
|
|
||||||
# Wallpapers have to be preloaded to be displayed
|
|
||||||
preload = let
|
|
||||||
mkPreload = name: "${config.paths.nixflake}/wallpapers/${name}.jpg";
|
|
||||||
in
|
|
||||||
color.wallpapers |> builtins.map mkPreload;
|
|
||||||
|
|
||||||
wallpaper = let
|
|
||||||
mkWallpaper = monitor:
|
|
||||||
"${monitor}, "
|
|
||||||
+ "${config.paths.nixflake}/wallpapers/${color.wallpaper}.jpg";
|
|
||||||
in
|
|
||||||
hyprland.monitors
|
|
||||||
|> builtins.attrNames
|
|
||||||
|> builtins.map mkWallpaper;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
hypridle = {
|
|
||||||
enable = true;
|
|
||||||
|
|
||||||
settings = {
|
|
||||||
general = {
|
|
||||||
# DPMS - Display Powermanagement Signaling. "On" means the monitor is on.
|
|
||||||
after_sleep_cmd = "hyprctl dispatch dpms on";
|
|
||||||
ignore_dbus_inhibit = false;
|
|
||||||
lock_cmd = "hyprlock";
|
|
||||||
};
|
|
||||||
|
|
||||||
listener = [
|
|
||||||
{
|
|
||||||
timeout = 900;
|
|
||||||
on-timeout = "hyprlock";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
timeout = 1200;
|
|
||||||
on-timeout = "hyprctl dispatch dpms off";
|
|
||||||
on-resume = "hyprctl dispatch dpms on";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
# Notification service
|
|
||||||
dunst = {
|
|
||||||
enable = hyprland.dunst.enable;
|
|
||||||
|
|
||||||
iconTheme.package = pkgs.papirus-icon-theme;
|
|
||||||
iconTheme.name = "Papirus";
|
|
||||||
|
|
||||||
settings = {
|
|
||||||
global = {
|
|
||||||
monitor = config.modules.waybar.monitor;
|
|
||||||
font = "${color.font} 11";
|
|
||||||
offset = "10x10";
|
|
||||||
background = color.hexS.base;
|
|
||||||
foreground = color.hexS.text;
|
|
||||||
frame_width = 2;
|
|
||||||
corner_radius = 6;
|
|
||||||
separator_color = "frame";
|
|
||||||
};
|
|
||||||
|
|
||||||
urgency_low = {
|
|
||||||
frame_color = color.hexS.green;
|
|
||||||
};
|
|
||||||
|
|
||||||
urgency_normal = {
|
|
||||||
frame_color = color.hexS.green;
|
|
||||||
};
|
|
||||||
|
|
||||||
urgency_critical = {
|
|
||||||
frame_color = color.hexS.red;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
wayland.windowManager.hyprland = {
|
wayland.windowManager.hyprland = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
package = inputs.hyprland.packages.${pkgs.system}.hyprland;
|
||||||
|
portalPackage = inputs.hyprland.packages.${pkgs.system}.xdg-desktop-portal-hyprland;
|
||||||
|
|
||||||
systemd.enable = true; # Enable hyprland-session.target
|
systemd.enable = true; # Enable hyprland-session.target
|
||||||
systemd.variables = ["--all"]; # Import PATH into systemd
|
systemd.variables = ["--all"]; # Import PATH into systemd
|
||||||
xwayland.enable = true;
|
xwayland.enable = true;
|
||||||
|
|
||||||
plugins = [
|
plugins = [
|
||||||
# TODO: Takes ages (compiles all hyprland dependencies locally...)
|
inputs.hypr-dynamic-cursors.packages.${pkgs.system}.hypr-dynamic-cursors
|
||||||
# Probably have to use hyprland flake to follow...
|
inputs.hyprland-plugins.packages.${pkgs.system}.hyprbars
|
||||||
|
|
||||||
# inputs.hypr-dynamic-cursors.packages.${pkgs.system}.hypr-dynamic-cursors
|
|
||||||
# inputs.hyprland-plugins.packages.${pkgs.system}.hyprbars
|
|
||||||
];
|
];
|
||||||
|
|
||||||
settings = {
|
settings = {
|
||||||
|
36
home/modules/hyprland/dunst.nix
Normal file
36
home/modules/hyprland/dunst.nix
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
hyprland,
|
||||||
|
color,
|
||||||
|
}: {
|
||||||
|
enable = hyprland.dunst.enable;
|
||||||
|
|
||||||
|
iconTheme.package = pkgs.papirus-icon-theme;
|
||||||
|
iconTheme.name = "Papirus";
|
||||||
|
|
||||||
|
settings = {
|
||||||
|
global = {
|
||||||
|
monitor = config.modules.waybar.monitor;
|
||||||
|
font = "${color.font} 11";
|
||||||
|
offset = "10x10";
|
||||||
|
background = color.hexS.base;
|
||||||
|
foreground = color.hexS.text;
|
||||||
|
frame_width = 2;
|
||||||
|
corner_radius = 6;
|
||||||
|
separator_color = "frame";
|
||||||
|
};
|
||||||
|
|
||||||
|
urgency_low = {
|
||||||
|
frame_color = color.hexS.green;
|
||||||
|
};
|
||||||
|
|
||||||
|
urgency_normal = {
|
||||||
|
frame_color = color.hexS.green;
|
||||||
|
};
|
||||||
|
|
||||||
|
urgency_critical = {
|
||||||
|
frame_color = color.hexS.red;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
28
home/modules/hyprland/hypridle.nix
Normal file
28
home/modules/hyprland/hypridle.nix
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
hyprland,
|
||||||
|
color,
|
||||||
|
}: {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
settings = {
|
||||||
|
general = {
|
||||||
|
# DPMS - Display Powermanagement Signaling. "On" means the monitor is on.
|
||||||
|
after_sleep_cmd = "hyprctl dispatch dpms on";
|
||||||
|
ignore_dbus_inhibit = false;
|
||||||
|
lock_cmd = "hyprlock";
|
||||||
|
};
|
||||||
|
|
||||||
|
listener = [
|
||||||
|
{
|
||||||
|
timeout = 900;
|
||||||
|
on-timeout = "hyprlock";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
timeout = 1200;
|
||||||
|
on-timeout = "hyprctl dispatch dpms off";
|
||||||
|
on-resume = "hyprctl dispatch dpms on";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
74
home/modules/hyprland/hyprlock.nix
Normal file
74
home/modules/hyprland/hyprlock.nix
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
hyprland,
|
||||||
|
color,
|
||||||
|
}: {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
settings = {
|
||||||
|
general = {
|
||||||
|
disable_loading_bar = true;
|
||||||
|
grace = 0; # Immediately lock
|
||||||
|
hide_cursor = true;
|
||||||
|
no_fade_in = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
# The widgets start here.
|
||||||
|
|
||||||
|
background = [
|
||||||
|
{
|
||||||
|
path = "${config.paths.nixflake}/wallpapers/${color.wallpaper}.jpg";
|
||||||
|
blur_passes = 3;
|
||||||
|
blur_size = 10;
|
||||||
|
monitor = "";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
input-field = [
|
||||||
|
# Password input
|
||||||
|
{
|
||||||
|
size = "200, 50";
|
||||||
|
position = "0, 0";
|
||||||
|
monitor = "";
|
||||||
|
dots_center = true;
|
||||||
|
fade_on_empty = false;
|
||||||
|
font_color = "rgb(${color.hex.accentText})";
|
||||||
|
font_family = "${color.font}";
|
||||||
|
inner_color = "rgb(${color.hex.accent})";
|
||||||
|
outer_color = "rgb(${color.hex.accent})";
|
||||||
|
outline_thickness = 2;
|
||||||
|
placeholder_text = "<span foreground='\#\#${color.hex.accentText}'>Password...</span>";
|
||||||
|
shadow_passes = 0;
|
||||||
|
rounding = 4;
|
||||||
|
halign = "center";
|
||||||
|
valign = "center";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
label = [
|
||||||
|
# Date
|
||||||
|
{
|
||||||
|
position = "0, 300";
|
||||||
|
monitor = "";
|
||||||
|
text = ''cmd[update:1000] date -I'';
|
||||||
|
color = "rgba(${color.hex.text}AA)";
|
||||||
|
font_size = 22;
|
||||||
|
font_family = "${color.font}";
|
||||||
|
halign = "center";
|
||||||
|
valign = "center";
|
||||||
|
}
|
||||||
|
|
||||||
|
# Time
|
||||||
|
{
|
||||||
|
position = "0, 200";
|
||||||
|
monitor = "";
|
||||||
|
text = ''cmd[update:1000] date +"%-H:%M"'';
|
||||||
|
color = "rgba(${color.hex.text}AA)";
|
||||||
|
font_size = 95;
|
||||||
|
font_family = "${color.font} Extrabold";
|
||||||
|
halign = "center";
|
||||||
|
valign = "center";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
28
home/modules/hyprland/hyprpaper.nix
Normal file
28
home/modules/hyprland/hyprpaper.nix
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
hyprland,
|
||||||
|
color,
|
||||||
|
}: {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
settings = {
|
||||||
|
ipc = "on";
|
||||||
|
splash = false;
|
||||||
|
splash_offset = 2.0;
|
||||||
|
|
||||||
|
# Wallpapers have to be preloaded to be displayed
|
||||||
|
preload = let
|
||||||
|
mkPreload = name: "${config.paths.nixflake}/wallpapers/${name}.jpg";
|
||||||
|
in
|
||||||
|
color.wallpapers |> builtins.map mkPreload;
|
||||||
|
|
||||||
|
wallpaper = let
|
||||||
|
mkWallpaper = monitor:
|
||||||
|
"${monitor}, "
|
||||||
|
+ "${config.paths.nixflake}/wallpapers/${color.wallpaper}.jpg";
|
||||||
|
in
|
||||||
|
hyprland.monitors
|
||||||
|
|> builtins.attrNames
|
||||||
|
|> builtins.map mkWallpaper;
|
||||||
|
};
|
||||||
|
}
|
81
home/modules/hyprland/mappings.nix
Normal file
81
home/modules/hyprland/mappings.nix
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
{
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
hyprland,
|
||||||
|
}:
|
||||||
|
lib.mergeAttrsList [
|
||||||
|
{
|
||||||
|
# Hyprland control
|
||||||
|
"$mainMod, a" = ["exec, rofi -drun-show-actions -show drun"];
|
||||||
|
"$mainMod, q" = ["killactive"];
|
||||||
|
"$mainMod, v" = ["togglefloating"];
|
||||||
|
"$mainMod, f" = ["fullscreen"];
|
||||||
|
"$mainMod, c" = ["exec, clipman pick --tool=rofi"];
|
||||||
|
"$mainMod SHIFT, l" = ["exec, loginctl lock-session"];
|
||||||
|
"$mainMod, tab" = ["workspace, previous"];
|
||||||
|
"ALT, tab" = ["exec, rofi -show window"];
|
||||||
|
# "$mainMod, g" = ["togglegroup"];
|
||||||
|
# "ALT, tab" = ["changegroupactive"];
|
||||||
|
|
||||||
|
# Move focus with mainMod + arrow keys
|
||||||
|
"$mainMod, h" = ["movefocus, l"];
|
||||||
|
"$mainMod, l" = ["movefocus, r"];
|
||||||
|
"$mainMod, k" = ["movefocus, u"];
|
||||||
|
"$mainMod, j" = ["movefocus, d"];
|
||||||
|
|
||||||
|
# Swap windows
|
||||||
|
"$mainMod CTRL, h" = ["movewindow, l"];
|
||||||
|
"$mainMod CTRL, l" = ["movewindow, r"];
|
||||||
|
"$mainMod CTRL, k" = ["movewindow, u"];
|
||||||
|
"$mainMod CTRL, d" = ["movewindow, d"];
|
||||||
|
|
||||||
|
# Reset workspaces to the defined configuration in hyprland.workspaces:
|
||||||
|
"CTRL ALT, r" = let
|
||||||
|
mkWBinding = m: w:
|
||||||
|
"moveworkspacetomonitor, "
|
||||||
|
+ "${builtins.toString w} ${builtins.toString m}";
|
||||||
|
|
||||||
|
mkWsBindings = m: ws: builtins.map (mkWBinding m) ws;
|
||||||
|
in
|
||||||
|
hyprland.workspaces
|
||||||
|
|> builtins.mapAttrs mkWsBindings
|
||||||
|
|> builtins.attrValues
|
||||||
|
|> builtins.concatLists;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Switch to WS: "$mainMod, 1" = ["workspace, 1"];
|
||||||
|
(let
|
||||||
|
mkWBinding = w: k: {"$mainMod, ${k}" = ["workspace, ${w}"];};
|
||||||
|
in
|
||||||
|
hyprland.keybindings.ws-bindings
|
||||||
|
|> builtins.mapAttrs mkWBinding
|
||||||
|
|> builtins.attrValues
|
||||||
|
|> lib.mergeAttrsList)
|
||||||
|
|
||||||
|
# Toggle special WS: "$mainMod, x" = ["togglespecialworkspace, ferdium"];
|
||||||
|
(let
|
||||||
|
mkSpecialWBinding = w: k: {"$mainMod, ${k}" = ["togglespecialworkspace, ${w}"];};
|
||||||
|
in
|
||||||
|
hyprland.keybindings.special-ws-bindings
|
||||||
|
|> builtins.mapAttrs mkSpecialWBinding
|
||||||
|
|> builtins.attrValues
|
||||||
|
|> lib.mergeAttrsList)
|
||||||
|
|
||||||
|
# Move to WS: "$mainMod SHIFT, 1" = ["movetoworkspace, 1"];
|
||||||
|
(let
|
||||||
|
mkMoveWBinding = w: k: {"$mainMod SHIFT, ${k}" = ["movetoworkspace, ${w}"];};
|
||||||
|
in
|
||||||
|
(hyprland.keybindings.ws-bindings)
|
||||||
|
|> builtins.mapAttrs mkMoveWBinding
|
||||||
|
|> builtins.attrValues
|
||||||
|
|> lib.mergeAttrsList)
|
||||||
|
|
||||||
|
# Move to special WS: "$mainMod SHIFT, x" = ["movetoworkspace, special:ferdium"];
|
||||||
|
(let
|
||||||
|
mkSpecialMoveWBinding = w: k: {"$mainMod SHIFT, ${k}" = ["movetoworkspace, special:${w}"];};
|
||||||
|
in
|
||||||
|
hyprland.keybindings.special-ws-bindings
|
||||||
|
|> builtins.mapAttrs mkSpecialMoveWBinding
|
||||||
|
|> builtins.attrValues
|
||||||
|
|> lib.mergeAttrsList)
|
||||||
|
]
|
Reference in New Issue
Block a user