added monitor and workspace configuration options to my hyprland config

This commit is contained in:
pagedmov
2024-11-08 01:26:06 -05:00
parent 2127996ee8
commit 4a3fb537b9
7 changed files with 120 additions and 180 deletions

View File

@@ -12,7 +12,11 @@
homeFiles.enable = true; homeFiles.enable = true;
# modules/home/environment # modules/home/environment
hyprlandConfig.enable = true; hyprlandConfig = {
enable = true;
monitorNames = [ "HDMI-A-1" "DP-1" ];
workspaceLayout = "dualmonitor";
};
autojumpConfig.enable = true; autojumpConfig.enable = true;
stylixHomeConfig.enable = true; stylixHomeConfig.enable = true;
waybarConfig.enable = true; waybarConfig.enable = true;

View File

@@ -12,7 +12,11 @@
homeFiles.enable = true; homeFiles.enable = true;
# modules/home/environment # modules/home/environment
hyprlandConfig.enable = true; hyprlandConfig = {
enable = true;
workspaceLayout = "singlemonitor";
monitorNames = [ "eDP-1" ];
};
autojumpConfig.enable = true; autojumpConfig.enable = true;
stylixHomeConfig.enable = true; stylixHomeConfig.enable = true;
waybarConfig.enable = true; waybarConfig.enable = true;

View File

@@ -14,40 +14,4 @@
./scripts ./scripts
./files.nix ./files.nix
]; ];
movOpts = {
# ./files
homeFiles.enable = lib.mkDefault false;
# ./environment
hyprlandConfig.enable = lib.mkDefault false;
autojumpConfig.enable = lib.mkDefault false;
stylixHomeConfig.enable = lib.mkDefault false;
waybarConfig.enable = lib.mkDefault false;
gtkConfig.enable = lib.mkDefault false;
spicetifyConfig.enable = lib.mkDefault false;
starshipConfig.enable = lib.mkDefault false;
# ./programs
btopConfig.enable = lib.mkDefault false;
swayncConfig.enable = lib.mkDefault false;
userPkgs.enable = lib.mkDefault false;
cavaConfig.enable = lib.mkDefault false;
ezaConfig.enable = lib.mkDefault false;
firefoxConfig.enable = lib.mkDefault false;
fuzzelConfig.enable = lib.mkDefault false;
fzfConfig.enable = lib.mkDefault false;
gitConfig.enable = lib.mkDefault false;
kittyConfig.enable = lib.mkDefault false;
yaziConfig.enable = lib.mkDefault false;
zshConfig.enable = lib.mkDefault false;
passConfig.enable = lib.mkDefault false;
batConfig.enable = lib.mkDefault false;
# ./scripts
movScripts.enable = lib.mkDefault false;
movScripts.commandScripts.enable = lib.mkDefault false;
movScripts.hyprlandControls.enable = lib.mkDefault false;
movScripts.nixShortcuts.enable = lib.mkDefault false;
};
} }

View File

@@ -1,20 +1,32 @@
{inputs, pkgs, lib, config, self, host, ... }: let { inputs, pkgs, lib, config, self, host, ... }:
let
desktop = host == "oganesson"; desktop = host == "oganesson";
screenshot_bind = screenshot_bind = if desktop then
if desktop [ "super, print, exec, grimblast copy area" ]
then [ else
"super, print, exec, grimblast copy area" [
]
else [
# My laptop does not have a printscreen button # My laptop does not have a printscreen button
"super, insert, exec, grimblast copy area" "super, insert, exec, grimblast copy area"
]; ];
scheme = config.lib.stylix.colors; scheme = config.lib.stylix.colors;
mons = config.movOpts.hyprlandConfig.monitorNames;
in { in {
options = { options = {
movOpts.hyprlandConfig.enable = lib.mkEnableOption "enables my hyprland config"; movOpts.hyprlandConfig = {
enable = lib.mkEnableOption "enables my hyprland config";
workspaceLayout = lib.mkOption {
type = lib.types.str;
default = "dualmonitor";
};
monitorNames = lib.mkOption {
type = lib.types.listOf lib.types.str;
# The order of the monitor names matters for the purpose of workspace assignment
# For instance, in a dual monitor setup, index 0 gets 4,5 and 6, while index 1 gets 1,2 and 3
default = [ "DP-1" "HDMI-A-1" ];
};
};
}; };
config = lib.mkIf config.movOpts.hyprlandConfig.enable { config = lib.mkIf config.movOpts.hyprlandConfig.enable {
home.packages = with pkgs; [ home.packages = with pkgs; [
@@ -29,25 +41,20 @@ in {
wayland wayland
direnv direnv
]; ];
systemd.user.targets.hyprland-session.Unit.Wants = ["xdg-desktop-autostart.target"]; systemd.user.targets.hyprland-session.Unit.Wants =
[ "xdg-desktop-autostart.target" ];
wayland.windowManager.hyprland = { wayland.windowManager.hyprland = {
enable = true; enable = true;
xwayland = { xwayland = { enable = true; };
enable = true;
};
systemd.enable = true; systemd.enable = true;
}; };
wayland.windowManager.hyprland = { wayland.windowManager.hyprland = {
settings = { settings = {
monitor = monitor = if (host == "oganesson") then [
if (host == "oganesson") "DP-1, 1920x1080@144, 1920x0, 1"
then [ "HDMI-A-1, 1920x1080, 0x0, 1"
"DP-1, 1920x1080@144, 1920x0, 1" ] else
"HDMI-A-1, 1920x1080, 0x0, 1" [ "eDP-1, 1600x900, 0x0, 1" ];
]
else [
"eDP-1, 1600x900, 0x0, 1"
];
exec-once = [ exec-once = [
"waybar &" "waybar &"
@@ -62,35 +69,34 @@ in {
]; ];
workspace = workspace =
if desktop if (config.movOpts.hyprlandConfig.workspaceLayout == "dualmonitor") then [
then [ "1,persistent=true,monitor:${builtins.elemAt mons 0}"
"1,persistent=true,monitor:HDMI-A-1" "2,persistent=true,monitor:${builtins.elemAt mons 0}"
"2,persistent=true,monitor:HDMI-A-1" "3,persistent=true,monitor:${builtins.elemAt mons 0}"
"3,persistent=true,monitor:HDMI-A-1" "4,persistent=true,monitor:${builtins.elemAt mons 1}"
"4,persistent=true,monitor:DP-1" "5,persistent=true,monitor:${builtins.elemAt mons 1}"
"5,persistent=true,monitor:DP-1" "6,persistent=true,monitor:${builtins.elemAt mons 1}"
"6,persistent=true,monitor:DP-1" ] else if (config.movOpts.hyprlandConfig.workspaceLayout == "singlemonitor") then [
] "1,persistent=true,monitor:${builtins.elemAt mons 0} "
else [ "2,persistent=true,monitor:${builtins.elemAt mons 0}"
"1,persistent=true,monitor:eDP-1" "3,persistent=true,monitor:${builtins.elemAt mons 0}"
"2,persistent=true,monitor:eDP-1" "4,persistent=true,monitor:${builtins.elemAt mons 0}"
"3,persistent=true,monitor:eDP-1" ] else if (config.movOpts.hyprlandConfig.workspaceLayout == "trimonitor") then [
"4,persistent=true,monitor:eDP-1" "1,persistent=true,monitor:${builtins.elemAt mons 2}"
]; "2,persistent=true,monitor:${builtins.elemAt mons 2}"
"3,persistent=true,monitor:${builtins.elemAt mons 1}"
"4,persistent=true,monitor:${builtins.elemAt mons 1}"
"5,persistent=true,monitor:${builtins.elemAt mons 0}"
"6,persistent=true,monitor:${builtins.elemAt mons 0}"
] else [];
env = [ env = [
"XDG_CONFIG_HOME,$HOME/.config" "XDG_CONFIG_HOME,$HOME/.config"
"XDG_DATA_HOME,$HOME/.local/share" "XDG_DATA_HOME,$HOME/.local/share"
"XDG_CACHE_HOME,$HOME/.cache" "XDG_CACHE_HOME,$HOME/.cache"
]; ];
layerrule = [ layerrule = [ "blur,waybar" "ignorezero,waybar" "blur,launcher" ];
"blur,waybar" windowrule = [ "opacity 0.8,nemo" ];
"ignorezero,waybar"
"blur,launcher"
];
windowrule = [
"opacity 0.8,nemo"
];
input = { input = {
kb_layout = "us"; kb_layout = "us";
@@ -146,7 +152,7 @@ in {
size = 2; size = 2;
passes = 1; passes = 1;
brightness = 1; brightness = 1;
contrast = 1.400; contrast = 1.4;
ignore_opacity = true; ignore_opacity = true;
popups = true; popups = true;
noise = 0; noise = 0;
@@ -189,52 +195,48 @@ in {
"workspaces, 1, 4, easeOutCubic, fade" # styles: slide, slidevert, fade, slidefade, slidefadevert "workspaces, 1, 4, easeOutCubic, fade" # styles: slide, slidevert, fade, slidefade, slidefadevert
]; ];
bind = bind = [
[ "super, up, exec, pactl set-sink-volume @default_sink@ +10%"
"super, up, exec, pactl set-sink-volume @default_sink@ +10%" "super, down, exec, pactl set-sink-volume @default_sink@ -10%"
"super, down, exec, pactl set-sink-volume @default_sink@ -10%" "super, t, exec, swaync-client -t -sw"
"super, t, exec, swaync-client -t -sw" "super, a, exec, firefox"
"super, a, exec, firefox" "super, q, exec, kitty --title Kitty"
"super, q, exec, kitty --title Kitty" "super shift, q, exec, [float;size 40% 30%;move onscreen cursor -50% -50%] kitty --title Kitty"
"super shift, q, exec, [float;size 40% 30%;move onscreen cursor -50% -50%] kitty --title Kitty" "super, c, killactive,"
"super, c, killactive," "super, e, exec, nemo"
"super, e, exec, nemo" "super, p, exec, [float;size 40% 25%;move onscreen cursor] [ ! -f /tmp/keyringfile ] && kitty toolbelt"
"super, p, exec, [float;size 40% 25%;move onscreen cursor] [ ! -f /tmp/keyringfile ] && kitty toolbelt" "super shift, m, exit,"
"super shift, m, exit," "super, m, exec, fuzzel"
"super, m, exec, fuzzel" "super, r, exec, neovide"
"super, r, exec, neovide" "super, b, togglesplit, # dwindle"
"super, b, togglesplit, # dwindle" "super, f, togglefloating"
"super, f, togglefloating" "super, g, fullscreen"
"super, g, fullscreen" "super, h, movefocus, l"
"super, h, movefocus, l" "super, l, movefocus, r"
"super, l, movefocus, r" "super, k, movefocus, u"
"super, k, movefocus, u" "super, j, movefocus, d"
"super, j, movefocus, d" "super shift, h, movewindow, l"
"super shift, h, movewindow, l" "super shift, l, movewindow, r"
"super shift, l, movewindow, r" "super shift, k, movewindow, u"
"super shift, k, movewindow, u" "super shift, j, movewindow, d"
"super shift, j, movewindow, d" "super, d, exec, switchmon"
"super, d, exec, switchmon" "super, 1, exec, hyprctl 'dispatch workspace 1'"
"super, 1, exec, hyprctl 'dispatch workspace 1'" "super, 2, exec, hyprctl 'dispatch workspace 2'"
"super, 2, exec, hyprctl 'dispatch workspace 2'" "super, 3, exec, hyprctl 'dispatch workspace 3'"
"super, 3, exec, hyprctl 'dispatch workspace 3'" "super, 4, exec, hyprctl 'dispatch workspace 4'"
"super, 4, exec, hyprctl 'dispatch workspace 4'" "super, 5, exec, hyprctl 'dispatch workspace 5'"
"super, 5, exec, hyprctl 'dispatch workspace 5'" "super, 6, exec, hyprctl 'dispatch workspace 6'"
"super, 6, exec, hyprctl 'dispatch workspace 6'" "super shift, 1, movetoworkspace, 1"
"super shift, 1, movetoworkspace, 1" "super shift, 2, movetoworkspace, 2"
"super shift, 2, movetoworkspace, 2" "super shift, 3, movetoworkspace, 3"
"super shift, 3, movetoworkspace, 3" "super shift, 4, movetoworkspace, 4"
"super shift, 4, movetoworkspace, 4" "super shift, 5, movetoworkspace, 5"
"super shift, 5, movetoworkspace, 5" "super shift, 6, movetoworkspace, 6"
"super shift, 6, movetoworkspace, 6" "super, s, togglespecialworkspace, magic"
"super, s, togglespecialworkspace, magic" "super shift, s, movetoworkspace, special:magic"
"super shift, s, movetoworkspace, special:magic" ] ++ screenshot_bind;
] bindm =
++ screenshot_bind; [ "super, mouse:272, movewindow" "super, mouse:273, resizewindow" ];
bindm = [
"super, mouse:272, movewindow"
"super, mouse:273, resizewindow"
];
}; };
}; };
}; };

View File

@@ -13,14 +13,17 @@ let
"6" = ""; "6" = "";
}; };
persistent-workspaces = persistent-workspaces =
if desktop if (config.movOpts.hyprlandConfig.workspaceLayout == "singlemonitor") then {
then { "${builtins.elemAt monitors 0}" = [ 1 2 3 4 ];
"HDMI-A-1" = [1 2 3]; } else if (config.movOpts.hyprlandConfig.workspaceLayout == "dualmonitor") then {
"DP-1" = [4 5 6]; "${builtins.elemAt monitors 0}" = [ 1 2 3 ];
} "${builtins.elemAt monitors 1}" = [ 4 5 6 ];
else { } else if (config.movOpts.hyprlandConfig.workspaceLayout == "trimonitor") then {
"eDP-1" = [1 2 3 4]; "${builtins.elemAt monitors 2}" = [ 1 2 ];
}; "${builtins.elemAt monitors 1}" = [ 3 4 ];
"${builtins.elemAt monitors 0}" = [ 5 6 ];
} else {};
}; };
scheme = config.lib.stylix.colors; scheme = config.lib.stylix.colors;
@@ -46,15 +49,7 @@ let
color6 = scheme.base0E; color6 = scheme.base0E;
color7 = scheme.base0F; color7 = scheme.base0F;
}; };
monitors = monitors = config.movOpts.hyprlandConfig.monitorNames;
if desktop
then [
"DP-1"
"HDMI-A-1"
]
else [
"eDP-1"
];
in { in {
options = { options = {
movOpts.waybarConfig.enable = lib.mkEnableOption "enables my waybar configuration"; movOpts.waybarConfig.enable = lib.mkEnableOption "enables my waybar configuration";
@@ -68,7 +63,7 @@ in {
settings = { settings = {
mainBar = { mainBar = {
layer = "bottom"; layer = "bottom";
output = builtins.elemAt monitors 0; output = builtins.elemAt monitors 1;
position = "top"; position = "top";
name = "mainBar"; name = "mainBar";
margin-left = 8; margin-left = 8;
@@ -242,8 +237,8 @@ in {
layer = "bottom"; layer = "bottom";
output = output =
if desktop if desktop
then builtins.elemAt monitors 1 then builtins.elemAt monitors 0
else builtins.elemAt monitors 0; else builtins.elemAt monitors 1;
position = "right"; position = "right";
margin-top = 8; margin-top = 8;
margin-right = 5; margin-right = 5;

View File

@@ -24,31 +24,18 @@ pkgs.writeShellApplication {
[ "$numresults" -eq 0 ] && echo "$1 not found in ${nixpkgs_toplevel}/pkgs" && exit 1 [ "$numresults" -eq 0 ] && echo "$1 not found in ${nixpkgs_toplevel}/pkgs" && exit 1
if [ "$numresults" -gt 1 ]; then if [ "$numresults" -gt 1 ]; then
# Trim the path to show only package directory and .nix file (e.g., package/default.nix)
results=$(echo "$results" | awk -F"${nixpkgs_toplevel}/pkgs/" '{print $2}') results=$(echo "$results" | awk -F"${nixpkgs_toplevel}/pkgs/" '{print $2}')
file=$(echo "$results" | fzf) file=$(echo "$results" | fzf)
full_path="${nixpkgs_toplevel}/pkgs/$file" full_path="${nixpkgs_toplevel}/pkgs/$file"
# Check if the file contains any non-UTF-8 characters nvim "$full_path"
if grep --color='auto' -P -q "[^\x00-\x7F]" "$full_path"; then
NIXD_FLAGS="--semantic-tokens=false" nvim "$full_path"
else
nvim "$full_path"
fi
else else
# Trim the path for the single result case
result_path=$(echo "$results" | awk -F"${nixpkgs_toplevel}/pkgs/" '{print $2}') result_path=$(echo "$results" | awk -F"${nixpkgs_toplevel}/pkgs/" '{print $2}')
full_path="${nixpkgs_toplevel}/pkgs/$result_path" full_path="${nixpkgs_toplevel}/pkgs/$result_path"
nvim "$full_path"
# Check if the file contains any non-UTF-8 characters
if grep --color='auto' -P -q "[^\x00-\x7F]" "$full_path"; then
NIXD_FLAGS="--semantic-tokens=false" nvim "$full_path"
else
nvim "$full_path"
fi
fi fi
''; '';
} }

View File

@@ -13,20 +13,4 @@
./software ./software
./environment ./environment
]; ];
movOpts = {
networkModule.enable = lib.mkDefault false;
nixSettings.enable = lib.mkDefault false;
bootLoader.enable = lib.mkDefault false;
issue.enable = lib.mkDefault false;
sddmConfig.enable = lib.mkDefault false;
stylixConfig.enable = lib.mkDefault false;
gamingPkgs.enable = lib.mkDefault false;
steamConfig.enable = lib.mkDefault false;
sysPkgs.enable = lib.mkDefault false;
sysProgs.enable = lib.mkDefault false;
sysServices.enable = lib.mkDefault false;
virtConfig.enable = lib.mkDefault false;
powerProfiles.enable = lib.mkDefault false;
};
} }