better host identification method

This commit is contained in:
cnst
2024-11-02 14:05:41 +01:00
parent 81a45ac062
commit 0f497bb437
6 changed files with 55 additions and 42 deletions

View File

@@ -19,7 +19,6 @@ in {
options = {
home.programs.hyprland = {
enable = mkEnableOption "Enable Hyprland";
user = mkOption {type = types.enum ["cnst" "toothpick"];};
};
};

View File

@@ -5,13 +5,8 @@
...
}: let
inherit (lib) mkIf mkEnableOption mkMerge;
kbOption =
if osConfig.networking.hostName == "cnixpad"
then "ctrl:swapcaps"
else "";
cfg = config.home.programs.hyprland;
host = osConfig.networking.hostName;
in {
options = {
home.programs.hyprland.inputs.enable = mkEnableOption "Enables input settings in Hyprland";
@@ -44,7 +39,6 @@ in {
input = {
kb_layout = "se";
kb_variant = "nodeadkeys";
kb_options = kbOption;
follow_mouse = 1;
accel_profile = "flat";
sensitivity = 0; # -1.0 - 1.0, 0 means no modification.
@@ -84,31 +78,37 @@ in {
};
}
(mkIf (cfg.user == "toothpick") {
wayland.windowManager.hyprland.settings.render = {
(mkIf (host == "toothpc") {
wayland.windowManager.hyprland.settings = {
render = {
explicit_sync = 0;
explicit_sync_kms = 0;
direct_scanout = false;
};
cursor = {
no_hardware_cursors = true;
};
};
})
(mkIf (cfg.user != "toothpick") {
wayland.windowManager.hyprland.settings.render = {
(mkIf (host != "toothpc") {
wayland.windowManager.hyprland.settings = {
render = {
explicit_sync = 2;
explicit_sync_kms = 2;
direct_scanout = false;
};
})
(mkIf (cfg.user == "toothpick") {
wayland.windowManager.hyprland.settings.cursor = {
no_hardware_cursors = true;
cursor = {
no_hardware_cursors = 2;
};
};
})
(mkIf (cfg.user != "toothpick") {
wayland.windowManager.hyprland.settings.cursor = {
no_hardware_cursors = 2;
(mkIf (host == "cnixpad") {
wayland.windowManager.hyprland.settings = {
input = {
kb_options = "ctrl:swapcaps";
};
};
})
]);

View File

@@ -7,6 +7,7 @@
}: let
inherit (lib) mkIf mkEnableOption mkMerge;
cfg = config.home.programs.hyprland;
host = osConfig.networking.hostName;
in {
options = {
home.programs.hyprland.keybinds.enable = mkEnableOption "Enables keybind settings in Hyprland";
@@ -86,32 +87,38 @@ in {
};
}
(mkIf (cfg.user == "cnst") {
wayland.windowManager.hyprland.settings = let
cnixpad = osConfig.networking.hostName == "cnixpad";
modKey =
if cnixpad
then "ALT_L"
else "SUPER";
in {
(mkIf (host == "cnix") {
wayland.windowManager.hyprland.settings = {
"$terminal" = "alacritty";
"$browser" = "zen";
"$browserinc" = "zen --private-window";
"$mod" = modKey;
"$mod" = "SUPER";
bind = [
# Add more host-specific binds as needed
];
};
})
(mkIf (cfg.user == "toothpick") {
(mkIf (host == "cnixpad") {
wayland.windowManager.hyprland.settings = {
"$terminal" = "foot";
"$browser" = "zen";
"$browserinc" = "zen --private-window";
"$mod" = "ALT_L";
bind = [
# Add more host-specific binds as needed
];
};
})
(mkIf (host == "toothpc") {
wayland.windowManager.hyprland.settings = {
"$terminal" = "foot";
"$browser" = "firefox";
"$browserinc" = "firefox --private-window";
"$mod" = "ALT_L";
bind = [
# Add more toothpc-specific binds as needed
# Add more host-specific binds as needed
];
};
})

View File

@@ -1,10 +1,12 @@
{
lib,
config,
osConfig,
...
}: let
inherit (lib) mkIf mkEnableOption mkMerge;
cfg = config.home.programs.hyprland;
host = osConfig.networking.hostName;
in {
options = {
home.programs.hyprland.startup.enable = mkEnableOption "Enables startup settings in Hyprland";
@@ -22,7 +24,7 @@ in {
};
}
(mkIf (cfg.user == "cnix") {
(mkIf (host == "cnix") {
wayland.windowManager.hyprland.settings.exec-once = [
"mullvad-vpn"
"blueman-applet"
@@ -31,7 +33,14 @@ in {
];
})
(mkIf (cfg.user == "toothpc") {
(mkIf (host == "cnixpad") {
wayland.windowManager.hyprland.settings.exec-once = [
"blueman-applet"
"pamixer --set-volume 50"
];
})
(mkIf (host == "toothpc") {
wayland.windowManager.hyprland.settings.exec-once = [
"mullvad-vpn"
"hyprctl dispatch exec 'sleep 3s && solaar -w hide'"

View File

@@ -49,7 +49,6 @@
};
hyprland = {
enable = true;
user = "cnst";
};
hyprlock = {
enable = true;

View File

@@ -40,7 +40,6 @@
};
hyprland = {
enable = true;
user = "toothpick";
};
hyprlock = {
enable = true;