[Hyprland,Eww] Refactors configs so that I can share more between Vega and Altair

This commit is contained in:
2026-06-01 16:54:06 -07:00
parent e078067a5e
commit e936b9da8f
12 changed files with 274 additions and 124 deletions

View File

@@ -1,15 +1,48 @@
{ pkgs, ... }:
{
home = {
packages = with pkgs; [
# For Noto Sans NF
nerd-fonts.noto
];
file.".config/eww".source = ./config;
config,
pkgs,
lib,
...
}:
{
options = {
programs.eww.widgets = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ ];
};
};
programs.eww = {
enable = true;
config = {
home = {
packages = with pkgs; [
# For Noto Sans NF
nerd-fonts.noto
];
file.".config/eww".source = ./config;
};
programs.eww = {
enable = true;
};
systemd.user.services.eww = lib.mkIf (config.programs.eww.widgets != [ ]) {
Unit = {
Description = "Eww widgets";
After = [ "hyprland-session.target" ]; # Start only after hyprland
PartOf = [ "hyprland-session.target" ]; # Force it to exit if hyprland does
};
Service = {
Type = "oneshot";
RemainAfterExit = true;
ExecStart = "${pkgs.eww}/bin/eww open ${lib.concatStringsSep " " config.programs.eww.widgets}";
ExecStop = "${pkgs.eww}/bin/eww kill";
};
Install = {
WantedBy = [ "hyprland-session.target" ];
};
};
};
}

View File

@@ -1,10 +1,5 @@
hl.on("hyprland.start", function()
hl.exec_cmd("nm-applet")
-- hl.exec_cmd("sleep 2 && hyprpm reload -n")
-- hl.exec_cmd("systemctl --user start hyprpolkitagent")
hl.exec_cmd("gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark'")
hl.exec_cmd("gsettings set org.gnome.desktop.interface gtk-theme 'Adwaita-dark'")
hl.exec_cmd("wpaperd")
hl.exec_cmd("sleep 2 && eww open-many primary-statusbar secondary-statusbar")
hl.exec_cmd("xrandr --output DP-2 --primary")
end)

View File

@@ -84,25 +84,25 @@ hl.device({
sensitivity = -0.200000,
})
hl.monitor({
output = "DP-2",
mode = "3440x1440@164",
position = "0x0",
})
hl.monitor({
output = "DP-1",
mode = "2560x1440",
position = "-1440x-510",
-- 0 -> normal (no transforms)
-- 1 -> 90 degrees
-- 2 -> 180 degrees
-- 3 -> 270 degrees
-- 4 -> flipped
-- 5 -> flipped + 90 degrees
-- 6 -> flipped + 180 degrees
-- 7 -> flipped + 270 degrees
transform = 1,
})
-- hl.monitor({
-- output = "DP-2",
-- mode = "3440x1440@164",
-- position = "0x0",
-- })
-- hl.monitor({
-- output = "DP-1",
-- mode = "2560x1440",
-- position = "-1440x-510",
-- -- 0 -> normal (no transforms)
-- -- 1 -> 90 degrees
-- -- 2 -> 180 degrees
-- -- 3 -> 270 degrees
-- -- 4 -> flipped
-- -- 5 -> flipped + 90 degrees
-- -- 6 -> flipped + 180 degrees
-- -- 7 -> flipped + 270 degrees
-- transform = 1,
-- })
for i = 1, 10 do
hl.workspace_rule({ workspace = i, monitor = "DP-1", default_name = "L" .. tostring(i) })

View File

@@ -1,8 +1,15 @@
{ pkgs, inputs, ... }:
{
pkgs,
inputs,
config,
lib,
...
}:
{
imports = [
../swaylock.nix
./hypridle.nix
../../options/monitors.nix
];
xdg.configFile = {
@@ -11,9 +18,27 @@
recursive = true;
};
"hypr/base.lua" = {
source = ./config/hyprland.lua;
"hypr/monitors.lua" = {
text = lib.concatStrings (
lib.imap0 (
idx:
{ name, value }:
let
offset = idx * 10;
in
lib.concatMapStrings (
i:
let
ws = offset + i;
in
''
hl.workspace_rule({ workspace = ${toString ws}, monitor = "${name}", default_name = "${name}_${toString i}" })
''
) (lib.range 1 10)
) (lib.attrsToList config.hardware.monitors)
);
};
"hypr/config" = {
source = ./config;
recursive = true;
@@ -43,6 +68,7 @@
];
extraConfig = ''
require("monitors")
require("config.hyprland")
'';

View File

@@ -1,4 +1,5 @@
monitors: _: {
{ config, ... }:
{
services.hyprpaper = {
enable = true;
settings = {
@@ -9,7 +10,7 @@ monitors: _: {
timeout = 3600;
recursive = true;
fit_mode = "cover";
}) monitors;
}) (builtins.attrNames config.hardware.monitors);
};
};
}

View File

@@ -1,4 +1,9 @@
{ pkgs, inputs, ... }:
{
config,
pkgs,
inputs,
...
}:
let
zen-browser = inputs.zen-browser.packages.${pkgs.stdenv.hostPlatform.system}.default;
in
@@ -11,6 +16,7 @@ in
../apps/element.nix
../apps/discord.nix
./terminal.nix
../options/monitors.nix
];
home = {
@@ -59,7 +65,10 @@ in
programs = {
# browsers
firefox.enable = true;
firefox = {
enable = true;
configPath = "${config.xdg.configHome}/mozilla/firefox";
};
chromium.enable = true;
};

View File

@@ -1,4 +1,5 @@
monitors: _: {
{ config }:
{
# NOTE: Wpaperd displays wallpaper upside-down on 90´ ccw rotated
# monitors as of 26.05
services.wpaperd = {
@@ -12,7 +13,7 @@ monitors: _: {
# containes the current images.
path = "~/Pictures/Wallpaper/${mon}";
};
}) monitors
}) (builtins.attrNames config.hardware.monitors)
)
// {
default = {