sisko/home: Configure hypr* in nix
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.wayland.windowManager.hyprland;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
./hypridle.nix
|
||||
./hyprland.nix
|
||||
./hyprlock.nix
|
||||
./hyprpaper.nix
|
||||
./keybinds.nix
|
||||
];
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
systemd.user.sessionVariables = {
|
||||
NIXOS_OZONE_WL = "1";
|
||||
WLR_NO_HARDWARE_CURSORS = "1";
|
||||
WLR_RENDERER_ALLOW_SOFTWARE = "1";
|
||||
XDG_CURRENT_DESKTOP = "Hyprland";
|
||||
XDG_SESSION_DESKTOP = "Hyprland";
|
||||
XDG_SESSION_TYPE = "wayland";
|
||||
};
|
||||
|
||||
home.packages = with pkgs; [
|
||||
bibata-cursors
|
||||
swaynotificationcenter
|
||||
wl-clipboard
|
||||
];
|
||||
|
||||
home.pointerCursor = {
|
||||
name = "Bibata-Modern-Ice";
|
||||
package = pkgs.bibata-cursors;
|
||||
size = 24;
|
||||
gtk.enable = true;
|
||||
x11 = {
|
||||
enable = true;
|
||||
defaultCursor = true;
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.wayland.windowManager.hyprland;
|
||||
in
|
||||
{
|
||||
config = lib.mkIf cfg.enable {
|
||||
services.hypridle = {
|
||||
enable = true;
|
||||
settings = {
|
||||
general = {
|
||||
ignore_dbus_inhibit = false;
|
||||
lock_cmd = "pidof hyprlock || ${config.programs.hyprlock.package}/bin/hyprlock";
|
||||
before_sleep_cmd = "${pkgs.systemd}/bin/loginctl lock-session";
|
||||
after_sleep_cmd = "${cfg.finalPackage}/bin/hyprctl dispatch dpms on";
|
||||
};
|
||||
|
||||
listener = [
|
||||
{
|
||||
timeout = 8 * 60;
|
||||
on-timeout = "${pkgs.libnotify}/bin/notify-send \"You are idle!\"";
|
||||
}
|
||||
{
|
||||
timeout = 10 * 60;
|
||||
on-timeout = "${config.programs.hyprlock.package}/bin/hyprlock";
|
||||
}
|
||||
{
|
||||
timeout = 15 * 60;
|
||||
on-timeout = "${pkgs.systemd}/bin/systemctl suspend";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
# TODO - Remove?
|
||||
systemd.user.services.hypridle = {
|
||||
Unit.After = lib.mkForce "graphical-session.target";
|
||||
Service.Slice = "session.slice";
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
{ lib, config, ... }:
|
||||
{
|
||||
wayland.windowManager.hyprland = {
|
||||
systemd.enable = false; # Required for UWSM
|
||||
systemd.enableXdgAutostart = false;
|
||||
configType = "lua";
|
||||
|
||||
settings =
|
||||
let
|
||||
wpDir = "${config.home.homeDirectory}/Pictures/wallpapers";
|
||||
in
|
||||
{
|
||||
on._args = [
|
||||
"hyprland.start"
|
||||
(lib.generators.mkLuaInline (
|
||||
''
|
||||
function()
|
||||
''
|
||||
+
|
||||
|
||||
lib.concatMapStringsSep "\n" (cmd: ''hl.exec_cmd("${cmd}")'') [
|
||||
"swaync"
|
||||
"hyprswitch init --size-factor 5 &"
|
||||
"wl-paste --type text --watch cliphist store #Stores only text data"
|
||||
"wl-paste --type image --watch cliphist store #Stores only image data"
|
||||
# TODO: the hyprpaper hm-module still generates the old config format, use ipc temporarily
|
||||
"hyprctl hyprpaper wallpaper 'DP-1, ${wpDir}/Ultrawide_Stray_City.png'"
|
||||
"hyprctl hyprpaper wallpaper 'DP-2, ${wpDir}/cyberpunk-gas-station-1.jpg'"
|
||||
]
|
||||
|
||||
+ ''
|
||||
end
|
||||
''
|
||||
))
|
||||
];
|
||||
|
||||
monitor = [
|
||||
# Sisko
|
||||
{
|
||||
output = "desc:Philips Consumer Electronics Company 49M2C8900 AU42525000628";
|
||||
mode = "highres@highrr";
|
||||
position = "0x0";
|
||||
scale = "1";
|
||||
supports_hdr = 1;
|
||||
}
|
||||
{
|
||||
output = "desc:LG Electronics LG ULTRAWIDE 407NTABCV312";
|
||||
mode = "highres@highrr";
|
||||
position = "600x-1440";
|
||||
scale = "1";
|
||||
supports_hdr = 1;
|
||||
}
|
||||
|
||||
# fa-t14-2025
|
||||
# TODO
|
||||
|
||||
# Other
|
||||
{
|
||||
output = "";
|
||||
mode = "preferred";
|
||||
position = "auto";
|
||||
scale = "auto";
|
||||
}
|
||||
];
|
||||
|
||||
config = {
|
||||
general = {
|
||||
gaps_in = 8;
|
||||
gaps_out = 12;
|
||||
|
||||
border_size = 1;
|
||||
|
||||
"col.active_border" = {
|
||||
colors = [
|
||||
"rgba(33ccffee)"
|
||||
"rgba(00ff99ee)"
|
||||
];
|
||||
angle = 45;
|
||||
};
|
||||
"col.inactive_border" = "rgba(595959aa)";
|
||||
|
||||
resize_on_border = false;
|
||||
allow_tearing = false;
|
||||
layout = "dwindle";
|
||||
};
|
||||
|
||||
decoration = {
|
||||
rounding = 8;
|
||||
|
||||
active_opacity = 1.0;
|
||||
inactive_opacity = 1.0;
|
||||
|
||||
shadow = {
|
||||
enabled = true;
|
||||
range = 4;
|
||||
render_power = 3;
|
||||
color = "rgba(1a1a1aee)";
|
||||
};
|
||||
|
||||
blur = {
|
||||
enabled = true;
|
||||
size = 3;
|
||||
passes = 1;
|
||||
|
||||
vibrancy = 0.1696;
|
||||
};
|
||||
};
|
||||
|
||||
animations.enabled = false; # TODO
|
||||
|
||||
dwindle = {
|
||||
preserve_split = true;
|
||||
};
|
||||
|
||||
master = {
|
||||
new_status = "master";
|
||||
};
|
||||
|
||||
binds = {
|
||||
movefocus_cycles_fullscreen = 1;
|
||||
};
|
||||
|
||||
misc = {
|
||||
force_default_wallpaper = 0;
|
||||
disable_hyprland_logo = true;
|
||||
};
|
||||
|
||||
input = {
|
||||
kb_layout = "us";
|
||||
kb_variant = "intl";
|
||||
kb_model = "";
|
||||
kb_options = "ctrl:nocaps";
|
||||
kb_rules = "";
|
||||
|
||||
follow_mouse = 1;
|
||||
|
||||
sensitivity = 0;
|
||||
|
||||
touchpad = {
|
||||
natural_scroll = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.wayland.windowManager.hyprland;
|
||||
in
|
||||
{
|
||||
config = lib.mkIf cfg.enable {
|
||||
programs.hyprlock = {
|
||||
enable = true;
|
||||
settings = {
|
||||
general = {
|
||||
hide_cursor = true;
|
||||
no_fade_in = false;
|
||||
};
|
||||
|
||||
background = [
|
||||
{
|
||||
path = "screenshot";
|
||||
blur_passes = 3;
|
||||
blur_size = 8;
|
||||
}
|
||||
];
|
||||
|
||||
input-field = [
|
||||
{
|
||||
size = "200, 50";
|
||||
position = "0, -80";
|
||||
monitor = "";
|
||||
dots_center = true;
|
||||
fade_on_empty = false;
|
||||
font_color = "rgb(202, 211, 245)";
|
||||
inner_color = "rgb(91, 96, 120)";
|
||||
outer_color = "rgb(24, 25, 38)";
|
||||
outline_thickness = 5;
|
||||
placeholder_text = "Password...";
|
||||
shadow_passes = 2;
|
||||
}
|
||||
];
|
||||
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
{ config, lib, ... }:
|
||||
let
|
||||
cfg = config.wayland.windowManager.hyprland;
|
||||
in
|
||||
{
|
||||
config = lib.mkIf cfg.enable {
|
||||
services.hyprpaper = {
|
||||
enable = true;
|
||||
settings.ipc = true;
|
||||
};
|
||||
|
||||
systemd.user.services.hyprpaper = {
|
||||
Unit.After = lib.mkForce "graphical-session.target";
|
||||
Service.Slice = "session.slice";
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,283 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.wayland.windowManager.hyprland;
|
||||
in
|
||||
{
|
||||
config = lib.mkIf cfg.enable {
|
||||
wayland.windowManager.hyprland.settings =
|
||||
let
|
||||
exe = lib.getExe;
|
||||
terminalCommand = "alacritty";
|
||||
resizeAmount = toString 10;
|
||||
in
|
||||
{
|
||||
mod._var = "SUPER";
|
||||
|
||||
# https://github.com/xkbcommon/libxkbcommon/blob/master/include/xkbcommon/xkbcommon-keysyms.h
|
||||
bind =
|
||||
let
|
||||
lua = lib.generators.mkLuaInline;
|
||||
mod = key: args: {
|
||||
_args = [
|
||||
(lua "mod .. \" + ${key}\"")
|
||||
]
|
||||
++ args;
|
||||
};
|
||||
in
|
||||
[
|
||||
# Layout actions
|
||||
|
||||
(mod "U" [
|
||||
(lua "hl.dsp.layout(\"togglesplit\")")
|
||||
])
|
||||
|
||||
(mod "Y" [
|
||||
(lua "hl.dsp.window.float({ action = \"toggle\" })")
|
||||
])
|
||||
|
||||
(mod "T" [
|
||||
(lua "hl.dsp.window.fullscreen({ action = \"toggle\", mode = \"maximized\" })")
|
||||
])
|
||||
|
||||
(mod "C" [
|
||||
(lua "hl.dsp.exec_cmd(\"hyprctl reload\")")
|
||||
])
|
||||
|
||||
# Left click drag
|
||||
(mod "mouse:272" [
|
||||
(lua "hl.dsp.window.drag()")
|
||||
(lua "{ mouse = true }")
|
||||
])
|
||||
|
||||
# Right click drag
|
||||
(mod "mouse:273" [
|
||||
(lua "hl.dsp.window.resize()")
|
||||
(lua "{ mouse = true }")
|
||||
])
|
||||
|
||||
# Window actions
|
||||
(mod "W" [
|
||||
(lua "hl.dsp.window.close()")
|
||||
])
|
||||
|
||||
(mod "SHIFT + W" [
|
||||
(lua "hl.dsp.window.kill()")
|
||||
])
|
||||
|
||||
# Application launches
|
||||
(mod "RETURN" [
|
||||
(lua "hl.dsp.exec_cmd(\"${terminalCommand}\")")
|
||||
])
|
||||
|
||||
(mod "SPACE" [
|
||||
(lua "hl.dsp.exec_cmd(\"rofi -show drun\")")
|
||||
])
|
||||
|
||||
(mod "A" [
|
||||
(lua "hl.dsp.exec_cmd(\"${exe pkgs.pavucontrol}\")")
|
||||
])
|
||||
|
||||
(mod "B" [
|
||||
(lua "hl.dsp.exec_cmd(\"rofi-rbw\")")
|
||||
])
|
||||
|
||||
(mod "N" [
|
||||
(lua "hl.dsp.exec_cmd(\"swaync-client -t -sw\")")
|
||||
])
|
||||
|
||||
(mod "P" [
|
||||
(lua "hl.dsp.exec_cmd(\"${terminalCommand} -e python3\")")
|
||||
])
|
||||
|
||||
(mod "V" [
|
||||
(lua "hl.dsp.exec_cmd(\"rofi -modi clipboard:${pkgs.cliphist}/bin/cliphist-rofi-img -show clipboard\")")
|
||||
])
|
||||
|
||||
# Focus workspace
|
||||
(mod "1" [ (lua "hl.dsp.focus({ workspace = 1 })") ])
|
||||
(mod "2" [ (lua "hl.dsp.focus({ workspace = 2 })") ])
|
||||
(mod "3" [ (lua "hl.dsp.focus({ workspace = 3 })") ])
|
||||
(mod "4" [ (lua "hl.dsp.focus({ workspace = 4 })") ])
|
||||
(mod "5" [ (lua "hl.dsp.focus({ workspace = 5 })") ])
|
||||
(mod "6" [ (lua "hl.dsp.focus({ workspace = 6 })") ])
|
||||
(mod "7" [ (lua "hl.dsp.focus({ workspace = 7 })") ])
|
||||
(mod "8" [ (lua "hl.dsp.focus({ workspace = 8 })") ])
|
||||
(mod "9" [ (lua "hl.dsp.focus({ workspace = 9 })") ])
|
||||
|
||||
# Move window to workspace
|
||||
(mod "SHIFT + 1" [ (lua "hl.dsp.window.move({ workspace = 1 })") ])
|
||||
(mod "SHIFT + 2" [ (lua "hl.dsp.window.move({ workspace = 2 })") ])
|
||||
(mod "SHIFT + 3" [ (lua "hl.dsp.window.move({ workspace = 3 })") ])
|
||||
(mod "SHIFT + 4" [ (lua "hl.dsp.window.move({ workspace = 4 })") ])
|
||||
(mod "SHIFT + 5" [ (lua "hl.dsp.window.move({ workspace = 5 })") ])
|
||||
(mod "SHIFT + 6" [ (lua "hl.dsp.window.move({ workspace = 6 })") ])
|
||||
(mod "SHIFT + 7" [ (lua "hl.dsp.window.move({ workspace = 7 })") ])
|
||||
(mod "SHIFT + 8" [ (lua "hl.dsp.window.move({ workspace = 8 })") ])
|
||||
(mod "SHIFT + 9" [ (lua "hl.dsp.window.move({ workspace = 9 })") ])
|
||||
|
||||
# Focus window
|
||||
(mod "LEFT" [ (lua "hl.dsp.focus({ direction=\"left\" })") ])
|
||||
(mod "RIGHT" [ (lua "hl.dsp.focus({ direction=\"right\" })") ])
|
||||
(mod "UP" [ (lua "hl.dsp.focus({ direction=\"up\" })") ])
|
||||
(mod "DOWN" [ (lua "hl.dsp.focus({ direction=\"down\" })") ])
|
||||
(mod "H" [ (lua "hl.dsp.focus({ direction=\"left\" })") ])
|
||||
(mod "L" [ (lua "hl.dsp.focus({ direction=\"right\" })") ])
|
||||
(mod "K" [ (lua "hl.dsp.focus({ direction=\"up\" })") ])
|
||||
(mod "J" [ (lua "hl.dsp.focus({ direction=\"down\" })") ])
|
||||
|
||||
# Move window
|
||||
(mod "SHIFT + LEFT" [ (lua "hl.dsp.window.move({ direction=\"left\" })") ])
|
||||
(mod "SHIFT + RIGHT" [ (lua "hl.dsp.window.move({ direction=\"right\" })") ])
|
||||
(mod "SHIFT + UP" [ (lua "hl.dsp.window.move({ direction=\"up\" })") ])
|
||||
(mod "SHIFT + DOWN" [ (lua "hl.dsp.window.move({ direction=\"down\" })") ])
|
||||
(mod "SHIFT + H" [ (lua "hl.dsp.window.move({ direction=\"left\" })") ])
|
||||
(mod "SHIFT + L" [ (lua "hl.dsp.window.move({ direction=\"right\" })") ])
|
||||
(mod "SHIFT + K" [ (lua "hl.dsp.window.move({ direction=\"up\" })") ])
|
||||
(mod "SHIFT + J" [ (lua "hl.dsp.window.move({ direction=\"down\" })") ])
|
||||
|
||||
# Resize window
|
||||
(mod "CONTROL + LEFT" [
|
||||
(lua "hl.dsp.window.resize({ x = -${resizeAmount}, y = 0, relative = true })")
|
||||
(lua "{ repeating = true }")
|
||||
])
|
||||
(mod "CONTROL + RIGHT" [
|
||||
(lua "hl.dsp.window.resize({ x = ${resizeAmount}, y = 0, relative = true })")
|
||||
(lua "{ repeating = true }")
|
||||
])
|
||||
(mod "CONTROL + UP" [
|
||||
(lua "hl.dsp.window.resize({ x = 0, y = -${resizeAmount}, relative = true })")
|
||||
(lua "{ repeating = true }")
|
||||
])
|
||||
(mod "CONTROL + DOWN" [
|
||||
(lua "hl.dsp.window.resize({ x = 0, y = ${resizeAmount}, relative = true })")
|
||||
(lua "{ repeating = true }")
|
||||
])
|
||||
(mod "CONTROL + H" [
|
||||
(lua "hl.dsp.window.resize({ x = -${resizeAmount}, y = 0, relative = true })")
|
||||
(lua "{ repeating = true }")
|
||||
])
|
||||
(mod "CONTROL + L" [
|
||||
(lua "hl.dsp.window.resize({ x = ${resizeAmount}, y = 0, relative = true })")
|
||||
(lua "{ repeating = true }")
|
||||
])
|
||||
(mod "CONTROL + K" [
|
||||
(lua "hl.dsp.window.resize({ x = 0, y = -${resizeAmount}, relative = true })")
|
||||
(lua "{ repeating = true }")
|
||||
])
|
||||
(mod "CONTROL + J" [
|
||||
(lua "hl.dsp.window.resize({ x = 0, y = ${resizeAmount}, relative = true })")
|
||||
(lua "{ repeating = true }")
|
||||
])
|
||||
|
||||
# TODO - replace with hyprlock?
|
||||
(mod "F1" [ (lua "hl.dsp.exec_cmd(\"${pkgs.systemd}/bin/loginctl lock-session\")") ])
|
||||
|
||||
# Screenshots
|
||||
{
|
||||
_args = [
|
||||
(lua "\"PRINT\"")
|
||||
(lua "hl.dsp.exec_cmd(\"${exe pkgs.hyprshot} -m output --clipboard-only\")")
|
||||
];
|
||||
}
|
||||
{
|
||||
_args = [
|
||||
(lua "\"CTRL + PRINT\"")
|
||||
(lua "hl.dsp.exec_cmd(\"${exe pkgs.hyprshot} -m region --clipboard-only\")")
|
||||
];
|
||||
}
|
||||
|
||||
{
|
||||
_args = [
|
||||
(lua "\"CTRL + SHIFT + PRINT\"")
|
||||
(lua "hl.dsp.exec_cmd(\"HYPRSHOT_DIR=/home/felixalb/images/screenshots ${exe pkgs.hyprshot} -m region \")")
|
||||
];
|
||||
}
|
||||
|
||||
# Media controls
|
||||
{
|
||||
_args = [
|
||||
(lua "\"XF86AudioPlay\"")
|
||||
(lua "hl.dsp.exec_cmd(\"${exe pkgs.playerctl} play-pause\")")
|
||||
(lua "{ locked = true }")
|
||||
];
|
||||
}
|
||||
|
||||
{
|
||||
_args = [
|
||||
(lua "\"XF86AudioPause\"")
|
||||
(lua "hl.dsp.exec_cmd(\"${exe pkgs.playerctl} play-pause\")")
|
||||
(lua "{ locked = true }")
|
||||
];
|
||||
}
|
||||
|
||||
{
|
||||
_args = [
|
||||
(lua "\"XF86AudioPrev\"")
|
||||
(lua "hl.dsp.exec_cmd(\"${exe pkgs.playerctl} previous\")")
|
||||
(lua "{ locked = true }")
|
||||
];
|
||||
}
|
||||
|
||||
{
|
||||
_args = [
|
||||
(lua "\"XF86AudioNext\"")
|
||||
(lua "hl.dsp.exec_cmd(\"${exe pkgs.playerctl} next\")")
|
||||
(lua "{ locked = true }")
|
||||
];
|
||||
}
|
||||
|
||||
{
|
||||
_args = [
|
||||
(lua "\"XF86AudioMute\"")
|
||||
(lua "hl.dsp.exec_cmd(\"${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle\")")
|
||||
(lua "{ locked = true, repeating = true }")
|
||||
];
|
||||
}
|
||||
|
||||
{
|
||||
_args = [
|
||||
(lua "\"XF86AudioMicMute\"")
|
||||
(lua "hl.dsp.exec_cmd(\"${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle\")")
|
||||
(lua "{ locked = true, repeating = true }")
|
||||
];
|
||||
}
|
||||
|
||||
{
|
||||
_args = [
|
||||
(lua "\"XF86AudioLowerVolume\"")
|
||||
(lua "hl.dsp.exec_cmd(\"${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-\")")
|
||||
(lua "{ locked = true, repeating = true }")
|
||||
];
|
||||
}
|
||||
{
|
||||
_args = [
|
||||
(lua "\"XF86AudioRaiseVolume\"")
|
||||
(lua "hl.dsp.exec_cmd(\"${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+\")")
|
||||
(lua "{ locked = true, repeating = true }")
|
||||
];
|
||||
}
|
||||
|
||||
# Laptop controls
|
||||
{
|
||||
_args = [
|
||||
(lua "\"XF86MonBrightnessUp\"")
|
||||
(lua "hl.dsp.exec_cmd(\"${exe pkgs.brightnessctl} s 10%+\")")
|
||||
(lua "{ locked = true, repeating = true }")
|
||||
];
|
||||
}
|
||||
{
|
||||
_args = [
|
||||
(lua "\"XF86MonBrightnessDown\"")
|
||||
(lua "hl.dsp.exec_cmd(\"${exe pkgs.brightnessctl} s 10%-\")")
|
||||
(lua "{ locked = true, repeating = true }")
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user