Hyprland module

This commit is contained in:
outfoxxed 2023-06-22 01:04:50 -07:00
parent 30184feda2
commit 2f1b04728d
Signed by: outfoxxed
GPG Key ID: 4C88A185FB89301E
8 changed files with 436 additions and 19 deletions

View File

@ -20,6 +20,90 @@
"type": "github"
}
},
"hyprland": {
"inputs": {
"hyprland-protocols": "hyprland-protocols",
"nixpkgs": [
"nixpkgs"
],
"wlroots": "wlroots",
"xdph": "xdph"
},
"locked": {
"lastModified": 1687375226,
"narHash": "sha256-y4l7tZELvVNmMZNdLmLdEZkApBWn1p7+MuGAxY0s47s=",
"owner": "hyprwm",
"repo": "Hyprland",
"rev": "fc59cef1ee573a950c5d5f3bacf1b51142fd56db",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "Hyprland",
"type": "github"
}
},
"hyprland-hy3": {
"inputs": {
"hyprland": [
"hyprland"
]
},
"locked": {
"lastModified": 1687408781,
"narHash": "sha256-JiAJX2I76t0QheIsJXAe3aDw97VcvjfZzUz1aQRDV0I=",
"owner": "outfoxxed",
"repo": "hy3",
"rev": "96bd4255442ea69d961d1aa7ad41b96909bbf460",
"type": "github"
},
"original": {
"owner": "outfoxxed",
"repo": "hy3",
"type": "github"
}
},
"hyprland-protocols": {
"inputs": {
"nixpkgs": [
"hyprland",
"nixpkgs"
]
},
"locked": {
"lastModified": 1684265364,
"narHash": "sha256-AxNnWbthsuNx73HDQr0eBxrcE3+yfl/WsaXZqUFmkpQ=",
"owner": "hyprwm",
"repo": "hyprland-protocols",
"rev": "8c279b9fb0f2b031427dc5ef4eab53f2ed835530",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprland-protocols",
"type": "github"
}
},
"hyprpaper": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1685950944,
"narHash": "sha256-59by/hDMxPhq2KLRdjL5n5HoQjbfLdpykOa7BG6gEYw=",
"owner": "hyprwm",
"repo": "Hyprpaper",
"rev": "64d0ebd66652a5614b645b1ffb4d592ba50d532a",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "Hyprpaper",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1686960236,
@ -38,6 +122,9 @@
"root": {
"inputs": {
"home-manager": "home-manager",
"hyprland": "hyprland",
"hyprland-hy3": "hyprland-hy3",
"hyprpaper": "hyprpaper",
"nixpkgs": "nixpkgs",
"stable": "stable"
}
@ -56,6 +143,49 @@
"ref": "nixos-23.05",
"type": "indirect"
}
},
"wlroots": {
"flake": false,
"locked": {
"host": "gitlab.freedesktop.org",
"lastModified": 1686753331,
"narHash": "sha256-KovjVFwcuoUO0eu/UiWrnD3+m/K+SHSAVIz4xF9K1XA=",
"owner": "wlroots",
"repo": "wlroots",
"rev": "7e7633abf09b362d0bad9e3fc650fd692369291d",
"type": "gitlab"
},
"original": {
"host": "gitlab.freedesktop.org",
"owner": "wlroots",
"repo": "wlroots",
"type": "gitlab"
}
},
"xdph": {
"inputs": {
"hyprland-protocols": [
"hyprland",
"hyprland-protocols"
],
"nixpkgs": [
"hyprland",
"nixpkgs"
]
},
"locked": {
"lastModified": 1685385764,
"narHash": "sha256-r+XMyOoRXq+hlfjayb+fyi9kq2JK48TrwuNIAXqlj7U=",
"owner": "hyprwm",
"repo": "xdg-desktop-portal-hyprland",
"rev": "4d9ff0c17716936e0b5ca577a39e263633901ed1",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "xdg-desktop-portal-hyprland",
"type": "github"
}
}
},
"root": "root",

View File

@ -7,6 +7,21 @@
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
hyprland = {
url = "github:hyprwm/Hyprland";
inputs.nixpkgs.follows = "nixpkgs";
};
hyprland-hy3 = {
url = "github:outfoxxed/hy3";
inputs.hyprland.follows = "hyprland";
};
hyprpaper = {
url = "github:hyprwm/Hyprpaper";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs @ { self, nixpkgs, ... }: {
@ -22,6 +37,7 @@
./modules/core
./modules/system.nix
./modules/user
./modules/hyprland
./systems/lenovo
];
};

View File

@ -0,0 +1,54 @@
{ system, inputs, impurity, lib, config, pkgs, ... }: let
inherit (inputs) hyprland hyprpaper hyprland-hy3;
wrapper = pkgs.writeShellScriptBin "hyprland" ''
${config.hyprland-session.prerun}
${hyprland.packages.${system}.default}/bin/Hyprland $@
'';
in {
imports = [ hyprland.nixosModules.default ];
options.hyprland-session = with lib; {
prerun = mkOption {
type = types.separatedString "\n";
default = "";
};
extraConfig = mkOption {
type = types.separatedString "\n";
default = "";
};
};
config = {
programs.hyprland.enable = true;
nix.settings = {
substituters = [ "https://hyprland.cachix.org" ];
trusted-public-keys = [ "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" ];
};
home-manager.users.${config.main-user} = {
imports = [ hyprland.homeManagerModules.default ];
home.packages = [ wrapper ];
wayland.windowManager.hyprland = {
enable = true;
package = wrapper;
plugins = [ hyprland-hy3.packages.${system}.default ];
extraConfig = ''
exec-once = ${hyprpaper.packages.${system}.default}/bin/hyprpaper
source = ${impurity.link ./hyprland.conf}
${config.hyprland-session.extraConfig}
'';
};
xdg.configFile."hypr/hyprpaper.conf".text = ''
preload = ${./wallpaper.png}
wallpaper = ,${./wallpaper.png}
'';
};
};
}

View File

@ -0,0 +1,187 @@
general {
gaps_in = 3
gaps_out = 5
border_size = 2
col.active_border = rgba(33ccffee) rgba(00ff99ee) 45deg
col.inactive_border = rgba(595959aa)
resize_on_border = true
extend_border_grab_area = 5;
layout = hy3
}
input {
kb_layout = us
sensitivity = 0
follow_mouse = 1
mouse_refocus = false
accel_profile = flat
}
decoration {
rounding = 5
blur = yes
blur_size = 5
blur_passes = 4
blur_new_optimizations = on
drop_shadow = yes
shadow_range = 4
shadow_render_power = 3
col.shadow = rgba(1a1a1aee)
}
animations {
enabled = yes
bezier = windowIn, 0.06, 0.71, 0.25, 1
bezier = windowResize, 0.04, 0.67, 0.38, 1
animation = windowsIn, 1, 3, windowIn, slide #popin 20%
animation = windowsOut, 1, 3, windowIn, slide #popin 70%
animation = windowsMove, 1, 2.5, windowResize
animation = border, 1, 10, default
animation = borderangle, 1, 8, default
animation = fade, 1, 3, default
animation = workspaces, 1, 6, default
}
gestures {
workspace_swipe = true
workspace_swipe_fingers = 4
workspace_swipe_forever = true
workspace_swipe_cancel_ratio = 0.15
}
misc {
no_direct_scanout = false
}
binds {
workspace_back_and_forth = true
}
plugin {
hy3 {
tabs {
height = 5
padding = 8
render_text = false
}
}
}
layerrule = blur, wofi
windowrulev2 = float, class:^(opensnitch_ui)$
windowrulev2 = dimaround, class:^(opensnitch_ui)$
windowrulev2 = float, class:^(org.kde.polkit-kde-authentication-agent-1)$
windowrulev2 = dimaround, class:^(org.kde.polkit-kde-authentication-agent-1)$
windowrulev2 = float, class:^(gcr-prompter)$
windowrulev2 = dimaround, class:^(gcr-prompter)$
windowrulev2 = float, class:^(org.freedesktop.impl.portal.desktop.kde)$
windowrulev2 = size 1000 700, class:^(org.freedesktop.impl.portal.desktop.kde)$
windowrulev2 = center, class:^(org.freedesktop.impl.portal.desktop.kde)$
windowrulev2 = dimaround, class:^(org.freedesktop.impl.portal.desktop.kde)$
$mod = SUPER
$term = alacritty
$launcher = wofi
bind = $mod+SHIFT, m, exit
bind = $mod, return, exec, $term
bind = $mod, grave, exec, $launcher
bind = $mod+SHIFT, q, killactive
bind = $mod, f, fullscreen, 1
bind = $mod+SHIFT, f, fullscreen, 0
bind = $mod+SHIFT, tab, togglefloating
bind = $mod, d, hy3:makegroup, h
bind = $mod, s, hy3:makegroup, v
bind = $mod, z, hy3:makegroup, tab
bind = $mod, a, hy3:changefocus, raise
bind = $mod+SHIFT, a, hy3:changefocus, lower
bind = $mod, e, togglesplit
bindm = $mod, mouse:272, movewindow
bindm = $mod, mouse:273, resizewindow
bindn = , mouse:272, hy3:focustab, mouse
bindn = , mouse_down, hy3:focustab, l, require_hovered
bindn = , mouse_up, hy3:focustab, r, require_hovered
bind = ,XF86AudioPlay, exec, playerctl play-pause
bind = ,XF86AudioStop, exec, playerctl -a stop
bind = ,XF86AudioNext, exec, playerctl next
bind = ,XF86AudioPrev, exec, playerctl previous
bind = $mod, h, hy3:movefocus, l
bind = $mod, j, hy3:movefocus, d
bind = $mod, k, hy3:movefocus, u
bind = $mod, l, hy3:movefocus, r
bind = $mod, left, hy3:movefocus, l
bind = $mod, down, hy3:movefocus, d
bind = $mod, up, hy3:movefocus, u
bind = $mod, right, hy3:movefocus, r
bind = $mod+CONTROL, h, hy3:movefocus, l, visible
bind = $mod+CONTROL, j, hy3:movefocus, d, visible
bind = $mod+CONTROL, k, hy3:movefocus, u, visible
bind = $mod+CONTROL, l, hy3:movefocus, r, visible
bind = $mod+CONTROL, left, hy3:movefocus, l, visible
bind = $mod+CONTROL, down, hy3:movefocus, d, visible
bind = $mod+CONTROL, up, hy3:movefocus, u, visible
bind = $mod+CONTROL, right, hy3:movefocus, r, visible
bind = $mod+SHIFT, h, hy3:movewindow, l, once
bind = $mod+SHIFT, j, hy3:movewindow, d, once
bind = $mod+SHIFT, k, hy3:movewindow, u, once
bind = $mod+SHIFT, l, hy3:movewindow, r, once
bind = $mod+SHIFT, left, hy3:movewindow, l, once
bind = $mod+SHIFT, down, hy3:movewindow, d, once
bind = $mod+SHIFT, up, hy3:movewindow, u, once
bind = $mod+SHIFT, right, hy3:movewindow, r, once
bind = $mod, 1, workspace, 01
bind = $mod, 2, workspace, 02
bind = $mod, 3, workspace, 03
bind = $mod, 4, workspace, 04
bind = $mod, 5, workspace, 05
bind = $mod, 6, workspace, 06
bind = $mod, 7, workspace, 07
bind = $mod, 8, workspace, 08
bind = $mod, 9, workspace, 09
bind = $mod, 0, workspace, 10
bind = $mod, F1, workspace, 11
bind = $mod, F2, workspace, 12
bind = $mod, F3, workspace, 13
bind = $mod, F4, workspace, 14
bind = $mod, F5, workspace, 15
bind = $mod, F6, workspace, 16
bind = $mod, F7, workspace, 17
bind = $mod, F8, workspace, 18
bind = $mod, F9, workspace, 19
bind = $mod, F10, workspace, 20
bind = $mod+SHIFT, 1, movetoworkspacesilent, 01
bind = $mod+SHIFT, 2, movetoworkspacesilent, 02
bind = $mod+SHIFT, 3, movetoworkspacesilent, 03
bind = $mod+SHIFT, 4, movetoworkspacesilent, 04
bind = $mod+SHIFT, 5, movetoworkspacesilent, 05
bind = $mod+SHIFT, 6, movetoworkspacesilent, 06
bind = $mod+SHIFT, 7, movetoworkspacesilent, 07
bind = $mod+SHIFT, 8, movetoworkspacesilent, 08
bind = $mod+SHIFT, 9, movetoworkspacesilent, 09
bind = $mod+SHIFT, 0, movetoworkspacesilent, 10
bind = $mod+SHIFT, F1, movetoworkspacesilent, 11
bind = $mod+SHIFT, F2, movetoworkspacesilent, 12
bind = $mod+SHIFT, F3, movetoworkspacesilent, 13
bind = $mod+SHIFT, F4, movetoworkspacesilent, 14
bind = $mod+SHIFT, F5, movetoworkspacesilent, 15
bind = $mod+SHIFT, F6, movetoworkspacesilent, 16
bind = $mod+SHIFT, F7, movetoworkspacesilent, 17
bind = $mod+SHIFT, F8, movetoworkspacesilent, 18
bind = $mod+SHIFT, F9, movetoworkspacesilent, 19
bind = $mod+SHIFT, F10, movetoworkspacesilent, 20

View File

@ -0,0 +1,37 @@
# session
export XDG_SESSION_TYPE=wayland
export XDG_SESSION_DESKTOP=hyprland
export XDG_CURRENT_DESKTOP=hyprland
# firefox
export MOZ_ENABLE_WAYLAND=1
export MOZ_DBUS_REMOTE=1
# qt
export QT_QPA_PLATFORM=wayland
export QT_WAYLAND_DISABLE_WINDOWDECORATION=1
# gtk
export GDK_BACKEND=wayland
# sdl
export SDL_VIDEODRIVER=wayland
# java
export _JAVA_AWT_WM_NONREPARENTING=1
export JDK_JAVA_OPTIONS="-Dawt.useSystemAAFontSettings=on -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel -Dswing.crossplatformlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel"
# other
export CLUTTER_BACKEND=wayland
export XCURSOR_SIZE=24
export NIXOS_OZONE_WL=1
# cursed dbus
dbus-update-activation-environment --systemd MOZ_ENABLE_WAYLAND MOZ_DBUS_REMOTE QT_QPA_PLATFORM QT_QPA_PLATFORMTHEME QT_WAYLAND_DISABLE_WINDOWDECORATION SDL_VIDEODRIVER _JAVA_AWT_WM_NONREPARENTING JDK_JAVA_OPTIONS XCURSOR_SIZE XCURSOR_THEME
# theme in dbus:
# QT_PLUGIN_PATH=<qt5ct>/lib/qt-ver/plugins + breeze will correctly set the theme.
# HOWEVER it won't find thumbnailers. For now the easiest way to deal with this, though definitely not
# the right one, is to just throw $PATH into dbus.
@dbusenv@ --systemd PATH

BIN
modules/hyprland/wallpaper.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 MiB

View File

@ -8,9 +8,9 @@ in {
./general.nix
];
options.user = lib.mkOption {
type = with lib.types; attrsOf anything;
default = {};
options.main-user = lib.mkOption {
type = lib.types.str;
default = username;
};
config = {
@ -65,22 +65,15 @@ in {
# use system nixpkgs instead of home-manager nixpkgs
useGlobalPkgs = true;
users.${username} = config.user;
};
users.${username} = {
home = {
inherit username homeDirectory;
stateVersion = config.system.stateVersion;
};
# pass the user config as a system module argument
_module.args = {
homeConfig = config.home-manager.users.${username};
};
user = {
home = {
inherit username homeDirectory;
stateVersion = config.system.stateVersion;
# enable xdg dir management
xdg.enable = true;
};
# enable xdg dir management
xdg.enable = true;
};
};
}

View File

@ -1,5 +1,5 @@
{ pkgs, homeConfig, ... }: {
user = {
{ pkgs, config, ... }: {
home-manager.users.${config.main-user} = {
home.packages = with pkgs; [
ark
kwrite