Modularise the hyprland config

This commit is contained in:
SebastianStork 2024-04-14 14:45:49 +02:00
parent 74982fa9f8
commit f6b56dae28
4 changed files with 96 additions and 75 deletions

View file

@ -8,7 +8,7 @@
in { in {
imports = [ imports = [
./qtile.nix ./qtile.nix
./hyprland.nix ./hyprland
]; ];
options.myConfig.de = { options.myConfig.de = {

View file

@ -1,5 +1,4 @@
{ {
inputs,
config, config,
pkgs, pkgs,
lib, lib,
@ -8,8 +7,8 @@
cfg = config.myConfig.de; cfg = config.myConfig.de;
in { in {
imports = [ imports = [
inputs.hyprlock.homeManagerModules.hyprlock ./waybar.nix
inputs.hypridle.homeManagerModules.hypridle ./hypridlelock.nix
]; ];
options.myConfig.de.hyprland.enable = lib.mkEnableOption ""; options.myConfig.de.hyprland.enable = lib.mkEnableOption "";
@ -22,77 +21,6 @@ in {
splash=false splash=false
''; '';
programs.hyprlock = {
enable = true;
backgrounds = [
{
path = "screenshot";
blur_passes = 1;
blur_size = 6;
}
];
};
services.hypridle = let
hyprlockExe = "${lib.getExe inputs.hyprlock.packages.${pkgs.system}.default}";
in {
enable = true;
lockCmd = "pidof ${hyprlockExe} || ${hyprlockExe}";
# beforeSleepCmd = "loginctl lock-session";
afterSleepCmd = "hyprctl dispatch dpms on";
listeners = [
{
timeout = 600;
onTimeout = "hyprctl dispatch dpms off";
onResume = "hyprctl dispatch dpms on";
}
{
timeout = 1200;
onTimeout = "loginctl lock-session";
}
];
};
programs.waybar = {
enable = true;
systemd.enable = true;
settings = {
mainBar = {
layer = "top";
position = "top";
spacing = 3;
modules-left = ["clock"];
modules-center = ["hyprland/workspaces"];
modules-right = ["tray" "wireplumber" "backlight" "battery"];
"hyprland/workspaces" = {
active-only = false;
all-outputs = true;
};
backlight = {
device = "amdgpu_bl1";
};
};
};
style = ''
* {
border: none;
border-radius: 0px;
font-family: "JetBrainsMono Nerd Font";
font-size: 14px;
}
window#waybar {
background-color: rgba(43, 48, 59, 0.5);
color: #ffffff;
}
'';
};
myConfig.rofi.enable = true; myConfig.rofi.enable = true;
services.cliphist.enable = true; services.cliphist.enable = true;

View file

@ -0,0 +1,45 @@
{
inputs,
config,
pkgs,
lib,
...
}: {
imports = [
inputs.hyprlock.homeManagerModules.hyprlock
inputs.hypridle.homeManagerModules.hypridle
];
config = lib.mkIf config.myConfig.de.hyprland.enable {
programs.hyprlock = {
enable = true;
backgrounds = [
{
path = "screenshot";
blur_passes = 1;
blur_size = 6;
}
];
};
services.hypridle = let
hyprlockExe = "${lib.getExe inputs.hyprlock.packages.${pkgs.system}.default}";
in {
enable = true;
lockCmd = "pidof ${hyprlockExe} || ${hyprlockExe}";
# beforeSleepCmd = "loginctl lock-session";
afterSleepCmd = "hyprctl dispatch dpms on";
listeners = [
{
timeout = 600;
onTimeout = "hyprctl dispatch dpms off";
onResume = "hyprctl dispatch dpms on";
}
{
timeout = 1200;
onTimeout = "loginctl lock-session";
}
];
};
};
}

View file

@ -0,0 +1,48 @@
{
config,
lib,
...
}: {
config = lib.mkIf config.myConfig.de.hyprland.enable {
programs.waybar = {
enable = true;
systemd.enable = true;
settings = {
mainBar = {
layer = "top";
position = "top";
spacing = 3;
modules-left = ["clock"];
modules-center = ["hyprland/workspaces"];
modules-right = ["tray" "wireplumber" "backlight" "battery"];
"hyprland/workspaces" = {
active-only = false;
all-outputs = true;
};
backlight = {
device = "amdgpu_bl1";
};
};
};
style = ''
* {
border: none;
border-radius: 0px;
font-family: "JetBrainsMono Nerd Font";
font-size: 14px;
}
window#waybar {
background-color: rgba(43, 48, 59, 0.5);
color: #ffffff;
}
'';
};
};
}