Skip to content

Commit

Permalink
Merge branch 'Goxore:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
vimjoyer authored Feb 5, 2025
2 parents e697524 + d7b4467 commit 76f01db
Show file tree
Hide file tree
Showing 10 changed files with 317 additions and 259 deletions.
2 changes: 0 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@
inputs.home-manager.follows = "home-manager";
};

# hyprland.url = "github:hyprwm/Hyprland";

disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
Expand Down
9 changes: 0 additions & 9 deletions homeManagerModules/bundles/desktop.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,6 @@
lib,
...
}: {
options = {
myHomeManager.startupScript = lib.mkOption {
default = "";
description = ''
Startup script
'';
};
};

config = {
myHomeManager.zathura.enable = lib.mkDefault true;
myHomeManager.rofi.enable = lib.mkDefault true;
Expand Down
177 changes: 14 additions & 163 deletions homeManagerModules/features/hyprland/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,79 +4,17 @@
lib,
inputs,
...
}: let
moveToMonitor =
lib.mapAttrsToList
(
id: workspace: "hyprctl dispatch moveworkspacetomonitor ${id} ${toString workspace.monitorId}"
)
config.myHomeManager.workspaces;

moveToMonitorScript = pkgs.writeShellScriptBin "script" ''
${lib.concatLines moveToMonitor}
'';

generalStartScript = pkgs.writeShellScriptBin "start" ''
${pkgs.swww}/bin/swww init &
${pkgs.networkmanagerapplet}/bin/nm-applet --indicator &
# hyprctl setcursor Bibata-Modern-Ice 16 &
systemctl --user import-environment PATH &
systemctl --user restart xdg-desktop-portal.service &
# wait a tiny bit for wallpaper
sleep 2
${pkgs.swww}/bin/swww img ${config.stylix.image} &
# wait for monitors to connect
sleep 3
ags &
${lib.getExe moveToMonitorScript}
# general startupScript extension
${config.myHomeManager.startupScript}
'';

autostarts =
lib.lists.flatten
(lib.mapAttrsToList
(
id: workspace: (map (startentry: "[workspace ${id} silent] ${startentry}") workspace.autostart)
)
config.myHomeManager.workspaces);

monitorScript = pkgs.writeShellScriptBin "script" ''
handle() {
case $1 in monitoradded*)
${lib.getExe moveToMonitorScript}
esac
}
${lib.getExe pkgs.socat} - "UNIX-CONNECT:/tmp/hypr/''${HYPRLAND_INSTANCE_SIGNATURE}/.socket2.sock" | while read -r line; do handle "$line"; done
'';
exec-once =
[
(lib.getExe generalStartScript)
(lib.getExe monitorScript)

# I forgor why i need this
"dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP"
]
++ autostarts;
in {
}: {
imports = [
./monitors.nix
./keymaps.nix
./start.nix
];

options = {
myHomeManager.windowanimation = lib.mkOption {
options.myHomeManager.hyprland = {
split-workspaces.enable = lib.mkEnableOption "enable split workspaces plugin";

windowanimation = lib.mkOption {
default = "workspaces, 1, 3, myBezier, fade";
description = ''
animation for switching workspaces.
Expand All @@ -88,13 +26,16 @@ in {
config = {
myHomeManager.waybar.enable = lib.mkDefault false;
myHomeManager.ags.enable = lib.mkDefault true;
myHomeManager.hyprland.split-workspaces.enable = lib.mkDefault true;
myHomeManager.keymap.enable = lib.mkDefault true;
myHomeManager.start.enable = lib.mkDefault true;

wayland.windowManager.hyprland = {
plugins = [
# inputs.hyprscroller.packages.${pkgs.system}.hyprscroller
];
# package = inputs.hyprland.packages."${pkgs.system}".hyprland;
plugins =
[]
++ lib.optional
config.myHomeManager.hyprland.split-workspaces.enable
(pkgs.callPackage ./split-workspaces.nix {});

enable = true;
settings = {
Expand Down Expand Up @@ -122,13 +63,6 @@ in {
)
(config.myHomeManager.monitors);

# workspace =
# lib.mapAttrsToList
# (
# name: m: "${m.name},${m.workspace}"
# )
# (lib.filter (m: m.enabled && m.workspace != null) config.myHomeManager.monitors);

env = [
"XCURSOR_SIZE,24"
];
Expand Down Expand Up @@ -191,7 +125,7 @@ in {
"borderangle, 1, 8, default"
"fade, 1, 7, default"
]
++ [config.myHomeManager.windowanimation];
++ [config.myHomeManager.hyprland.windowanimation];
};

dwindle = {
Expand All @@ -212,89 +146,6 @@ in {
# See https://wiki.hyprland.org/Configuring/Variables/ for more
workspace_swipe = false;
};
"$mainMod" = "SUPER";

# "$mainMod" =
# if (osConfig.altIsSuper or false)
# then "ALT"
# else "SUPER";

# Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more
bind =
[
"$mainMod, return, exec, kitty"
"$mainMod, Q, killactive,"
"$mainMod SHIFT, M, exit,"
"$mainMod SHIFT, F, togglefloating,"
"$mainMod, F, fullscreen,"
"$mainMod, T, pin,"
"$mainMod, G, togglegroup,"
"$mainMod, bracketleft, changegroupactive, b"
"$mainMod, bracketright, changegroupactive, f"
"$mainMod, S, exec, rofi -show drun -show-icons"
"$mainMod, P, pin, active"

",XF86AudioRaiseVolume, exec, wpctl set-volume -l 1.4 @DEFAULT_AUDIO_SINK@ 5%+"
",XF86AudioLowerVolume, exec, wpctl set-volume -l 1.4 @DEFAULT_AUDIO_SINK@ 5%-"

"$mainMod, left, movefocus, l"
"$mainMod, right, movefocus, r"
"$mainMod, up, movefocus, u"
"$mainMod, down, movefocus, d"

"$mainMod, h, movefocus, l"
"$mainMod, l, movefocus, r"
"$mainMod, k, movefocus, u"
"$mainMod, j, movefocus, d"

"$mainMod SHIFT, h, movewindow, l"
"$mainMod SHIFT, l, movewindow, r"
"$mainMod SHIFT, k, movewindow, u"
"$mainMod SHIFT, j, movewindow, d"
]
++ map (n: "$mainMod SHIFT, ${toString n}, movetoworkspace, ${toString (
if n == 0
then 10
else n
)}") [1 2 3 4 5 6 7 8 9 0]
++ map (n: "$mainMod, ${toString n}, workspace, ${toString (
if n == 0
then 10
else n
)}") [1 2 3 4 5 6 7 8 9 0];

binde = [
"$mainMod SHIFT, h, moveactive, -20 0"
"$mainMod SHIFT, l, moveactive, 20 0"
"$mainMod SHIFT, k, moveactive, 0 -20"
"$mainMod SHIFT, j, moveactive, 0 20"

"$mainMod CTRL, l, resizeactive, 30 0"
"$mainMod CTRL, h, resizeactive, -30 0"
"$mainMod CTRL, k, resizeactive, 0 -10"
"$mainMod CTRL, j, resizeactive, 0 10"
];

bindm = [
# Move/resize windows with mainMod + LMB/RMB and dragging
"$mainMod, mouse:272, movewindow"
"$mainMod, mouse:273, resizewindow"
];

# league of legends fixes
# windowrulev2 = [
# "float,class:^(leagueclientux.exe)$,title:^(League of Legends)$"
# "tile,class:^(league of legends.exe)$,title:^(League of Legends (TM) Client)$ windowrule = size 1920 1080,^(league of legends.exe)$"
# ];
#
# windowrule = [
# "size 1600 900,^(leagueclientux.exe)$"
# "center,^(leagueclientux.exe)$"
# "center,^(league of legends.exe)$"
# "forceinput,^(league of legends.exe)$"
# ];

exec-once = exec-once;
};
};

Expand Down
110 changes: 85 additions & 25 deletions homeManagerModules/features/hyprland/keymaps.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,88 @@
config,
...
}: {
options = {
myHomeManager.keybinds = lib.mkOption {
default = {
"$mainMod, A" = {
"f"."f" = {
exec = "firefox";
};
};
wayland.windowManager.hyprland = {
settings = {
"$mainMod" = "SUPER";

"$mainMod, B" = {
"f"."f" = {
exec = "pcmanfm";
};
};
};
bind = let
toWSNumber = n: (toString (
if n == 0
then 10
else n
));

moveworkspace-command =
if config.myHomeManager.hyprland.split-workspaces.enable
then "split-movetoworkspace"
else "movetoworkspace";
moveworkspaces = map (n: "$mainMod SHIFT, ${toString n}, ${moveworkspace-command}, ${toWSNumber n}") [1 2 3 4 5 6 7 8 9 0];

workspace-command =
if config.myHomeManager.hyprland.split-workspaces.enable
then "split-workspace"
else "workspace";

woworkspaces = map (n: "$mainMod, ${toString n}, ${workspace-command}, ${toWSNumber n}") [1 2 3 4 5 6 7 8 9 0];
in
[
"$mainMod, return, exec, kitty"
"$mainMod, Q, killactive,"
"$mainMod SHIFT, M, exit,"
"$mainMod SHIFT, F, togglefloating,"
"$mainMod, F, fullscreen,"
"$mainMod, T, pin,"
"$mainMod, G, togglegroup,"
"$mainMod, bracketleft, changegroupactive, b"
"$mainMod, bracketright, changegroupactive, f"
"$mainMod, S, exec, rofi -show drun -show-icons"
"$mainMod, P, pin, active"

",XF86AudioRaiseVolume, exec, wpctl set-volume -l 1.4 @DEFAULT_AUDIO_SINK@ 5%+"
",XF86AudioLowerVolume, exec, wpctl set-volume -l 1.4 @DEFAULT_AUDIO_SINK@ 5%-"

"$mainMod, left, movefocus, l"
"$mainMod, right, movefocus, r"
"$mainMod, up, movefocus, u"
"$mainMod, down, movefocus, d"

"$mainMod, h, movefocus, l"
"$mainMod, l, movefocus, r"
"$mainMod, k, movefocus, u"
"$mainMod, j, movefocus, d"

"$mainMod SHIFT, h, movewindow, l"
"$mainMod SHIFT, l, movewindow, r"
"$mainMod SHIFT, k, movewindow, u"
"$mainMod SHIFT, j, movewindow, d"
]
++ woworkspaces
++ moveworkspaces;

binde = [
"$mainMod SHIFT, h, moveactive, -20 0"
"$mainMod SHIFT, l, moveactive, 20 0"
"$mainMod SHIFT, k, moveactive, 0 -20"
"$mainMod SHIFT, j, moveactive, 0 20"

"$mainMod CTRL, l, resizeactive, 30 0"
"$mainMod CTRL, h, resizeactive, -30 0"
"$mainMod CTRL, k, resizeactive, 0 -10"
"$mainMod CTRL, j, resizeactive, 0 10"
];

bindm = [
# Move/resize windows with mainMod + LMB/RMB and dragging
"$mainMod, mouse:272, movewindow"
"$mainMod, mouse:273, resizewindow"
];
};
};

config = {
wayland.windowManager.hyprland = let
# ================================================================ #
# = ./../keymap.nix to hypr = #
# ================================================================ #

extraConfig = let
wrapWriteApplication = text:
lib.getExe (pkgs.writeShellApplication {
name = "script";
Expand Down Expand Up @@ -56,13 +118,11 @@
${lib.concatLines (lib.mapAttrsToList (makeHyprBinds submapname) keyOptions)}
submap = reset
'';
in {
extraConfig =
lib.mkAfter
(lib.concatLines
(lib.mapAttrsToList
(makeHyprBinds "root")
config.myHomeManager.keybinds));
};
in
lib.mkAfter
(lib.concatLines
(lib.mapAttrsToList
(makeHyprBinds "root")
config.myHomeManager.keybinds));
};
}
Loading

0 comments on commit 76f01db

Please sign in to comment.