mirror of
https://github.com/eRgo35/nix-config.git
synced 2026-02-04 12:36:13 +01:00
hyprland config
This commit is contained in:
99
home-manager/features/desktop/hyprland/basic-binds.nix
Normal file
99
home-manager/features/desktop/hyprland/basic-binds.nix
Normal file
@@ -0,0 +1,99 @@
|
||||
{lib, ...}: {
|
||||
wayland.windowManager.hyprland.settings = {
|
||||
bindm = [
|
||||
"SUPER,mouse:272,movewindow"
|
||||
"SUPER,mouse:273,resizewindow"
|
||||
];
|
||||
|
||||
bind = let
|
||||
workspaces = [
|
||||
"0"
|
||||
"1"
|
||||
"2"
|
||||
"3"
|
||||
"4"
|
||||
"5"
|
||||
"6"
|
||||
"7"
|
||||
"8"
|
||||
"9"
|
||||
"F1"
|
||||
"F2"
|
||||
"F3"
|
||||
"F4"
|
||||
"F5"
|
||||
"F6"
|
||||
"F7"
|
||||
"F8"
|
||||
"F9"
|
||||
"F10"
|
||||
"F11"
|
||||
"F12"
|
||||
];
|
||||
# Map keys (arrows and hjkl) to hyprland directions (l, r, u, d)
|
||||
directions = rec {
|
||||
left = "l";
|
||||
right = "r";
|
||||
up = "u";
|
||||
down = "d";
|
||||
h = left;
|
||||
l = right;
|
||||
k = up;
|
||||
j = down;
|
||||
};
|
||||
in
|
||||
[
|
||||
"SUPERSHIFT,q,killactive"
|
||||
"SUPERSHIFT,e,exit"
|
||||
|
||||
"SUPER,s,togglesplit"
|
||||
"SUPER,f,fullscreen,1"
|
||||
"SUPERSHIFT,f,fullscreen,0"
|
||||
"SUPERSHIFT,space,togglefloating"
|
||||
|
||||
"SUPER,minus,splitratio,-0.25"
|
||||
"SUPERSHIFT,minus,splitratio,-0.3333333"
|
||||
|
||||
"SUPER,equal,splitratio,0.25"
|
||||
"SUPERSHIFT,equal,splitratio,0.3333333"
|
||||
|
||||
"SUPER,g,togglegroup"
|
||||
"SUPER,t,lockactivegroup,toggle"
|
||||
"SUPER,tab,changegroupactive,f"
|
||||
"SUPERSHIFT,tab,changegroupactive,b"
|
||||
|
||||
"SUPER,apostrophe,workspace,previous"
|
||||
|
||||
"SUPER,u,togglespecialworkspace"
|
||||
"SUPERSHIFT,u,movetoworkspacesilent,special"
|
||||
"SUPER,i,pseudo"
|
||||
]
|
||||
++
|
||||
# Change workspace
|
||||
(map (n: "SUPER,${n},workspace,name:${n}") workspaces)
|
||||
++
|
||||
# Move window to workspace
|
||||
(map (n: "SUPERSHIFT,${n},movetoworkspacesilent,name:${n}") workspaces)
|
||||
++
|
||||
# Move focus
|
||||
(lib.mapAttrsToList (key: direction: "SUPER,${key},movefocus,${direction}") directions)
|
||||
++
|
||||
# Swap windows
|
||||
(lib.mapAttrsToList (key: direction: "SUPERSHIFT,${key},swapwindow,${direction}") directions)
|
||||
++
|
||||
# Move windows
|
||||
(lib.mapAttrsToList (
|
||||
key: direction: "SUPERCONTROL,${key},movewindoworgroup,${direction}"
|
||||
)
|
||||
directions)
|
||||
++
|
||||
# Move monitor focus
|
||||
(lib.mapAttrsToList (key: direction: "SUPERALT,${key},focusmonitor,${direction}") directions)
|
||||
++
|
||||
# Move workspace to other monitor
|
||||
(lib.mapAttrsToList (
|
||||
key: direction: "SUPERALTSHIFT,${key},movecurrentworkspacetomonitor,${direction}"
|
||||
)
|
||||
directions);
|
||||
};
|
||||
}
|
||||
58
home-manager/features/desktop/hyprland/hyprbars.nix
Normal file
58
home-manager/features/desktop/hyprland/hyprbars.nix
Normal file
@@ -0,0 +1,58 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
hyprbars =
|
||||
(pkgs.inputs.hyprland-plugins.hyprbars.override {
|
||||
# Make sure it's using the same hyprland package as we are
|
||||
hyprland = config.wayland.windowManager.hyprland.package;
|
||||
})
|
||||
.overrideAttrs
|
||||
(old: {
|
||||
# Yeet the initialization notification (I hate it)
|
||||
postPatch =
|
||||
(old.postPatch or "")
|
||||
+ ''
|
||||
${lib.getExe pkgs.gnused} -i '/Initialized successfully/d' main.cpp
|
||||
'';
|
||||
});
|
||||
in {
|
||||
wayland.windowManager.hyprland = {
|
||||
plugins = [hyprbars];
|
||||
settings = {
|
||||
"plugin:hyprbars" = {
|
||||
bar_height = 25;
|
||||
#bar_color = "0xdd${config.colorscheme.colors.base00}";
|
||||
#"col.text" = "0xee${config.colorscheme.colors.base05}";
|
||||
#bar_text_font = config.fontProfiles.regular.family;
|
||||
bar_text_size = 12;
|
||||
bar_part_of_window = true;
|
||||
hyprbars-button = let
|
||||
closeAction = "hyprctl dispatch killactive";
|
||||
|
||||
isOnSpecial = ''hyprctl activewindow -j | jq -re 'select(.workspace.name == "special")' >/dev/null'';
|
||||
moveToSpecial = "hyprctl dispatch movetoworkspacesilent special";
|
||||
moveToActive = "hyprctl dispatch movetoworkspacesilent name:$(hyprctl -j activeworkspace | jq -re '.name')";
|
||||
minimizeAction = "${isOnSpecial} && ${moveToActive} || ${moveToSpecial}";
|
||||
|
||||
maximizeAction = "hyprctl dispatch togglefloating";
|
||||
in [
|
||||
# Red close button
|
||||
#"rgb(${config.colorscheme.colors.base08}),12,,${closeAction}"
|
||||
# Yellow "minimize" (send to special workspace) button
|
||||
#"rgb(${config.colorscheme.colors.base0A}),12,,${minimizeAction}"
|
||||
# Green "maximize" (togglefloating) button
|
||||
#"rgb(${config.colorscheme.colors.base0B}),12,,${maximizeAction}"
|
||||
];
|
||||
};
|
||||
bind = let
|
||||
barsEnabled = "hyprctl -j getoption plugin:hyprbars:bar_height | ${lib.getExe pkgs.jq} -re '.int != 0'";
|
||||
setBarHeight = height: "hyprctl keyword plugin:hyprbars:bar_height ${toString height}";
|
||||
toggleOn = setBarHeight config.wayland.windowManager.hyprland.settings."plugin:hyprbars".bar_height;
|
||||
toggleOff = setBarHeight 0;
|
||||
in ["SUPER,m,exec,${barsEnabled} && ${toggleOff} || ${toggleOn}"];
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user