Merge remote-tracking branch 'origin/nixos' into nixos
This commit is contained in:
commit
ea59147fcd
31 changed files with 1449 additions and 369 deletions
|
|
@ -6,6 +6,10 @@
|
|||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.my.programs.hyprland;
|
||||
|
||||
boolToYesNo = bool: if bool then "yes" else "no";
|
||||
|
||||
mkRule = rule: windowRegexes: "windowrulev2 = ${rule},${concatStringsSep "," windowRegexes}";
|
||||
mkRules = rules: windowRegexes: concatStringsSep "\n" (map (flip mkRule windowRegexes) rules);
|
||||
in
|
||||
|
|
@ -55,12 +59,12 @@ in
|
|||
# See https://wiki.hyprland.org/Configuring/Variables/ for more
|
||||
|
||||
rounding = 3
|
||||
blur = yes
|
||||
blur = ${boolToYesNo cfg.blur}
|
||||
blur_size = 3
|
||||
blur_passes = 3
|
||||
blur_new_optimizations = on
|
||||
|
||||
drop_shadow = yes
|
||||
drop_shadow = ${boolToYesNo cfg.shadows}
|
||||
shadow_range = 10
|
||||
shadow_render_power = 2
|
||||
|
||||
|
|
@ -72,13 +76,21 @@ in
|
|||
|
||||
# Some default Lanimations, see https://wiki.hyprland.org/Configuring/Animations/ for more
|
||||
|
||||
bezier = myBezier, 0.45, 0, 0.55, 1
|
||||
bezier = sine, 0.445, 0.05, 0.55, 0.95
|
||||
bezier = quad, 0.455, 0.03, 0.515, 0.955
|
||||
bezier = cubic, 0.68, -0.55, 0.265, 1.55
|
||||
bezier = quart, 0.77, 0, 0.175, 1
|
||||
bezier = quint, 0.86, 0, 0.07, 1
|
||||
bezier = expo, 1, 0, 0, 1
|
||||
bezier = circ, 0.785, 0.135, 0.15, 0.86
|
||||
bezier = back, 0.68, -0.55, 0.265, 1.55
|
||||
|
||||
animation = windows, 1, 3, myBezier
|
||||
animation = windowsOut, 1, 3, myBezier
|
||||
animation = border, 1, 3, myBezier
|
||||
animation = fade, 1, 3, myBezier
|
||||
animation = workspaces, 1, 3, myBezier
|
||||
|
||||
animation = windows, 1, 3, circ
|
||||
animation = windowsOut, 1, 2, quint
|
||||
animation = border, 1, 2, sine
|
||||
animation = fade, 1, 2, sine
|
||||
animation = workspaces, 1, 5, circ
|
||||
}
|
||||
|
||||
dwindle {
|
||||
|
|
@ -109,17 +121,19 @@ in
|
|||
# windowrulev2 = float,class:^(kitty)$,title:^(kitty)$
|
||||
# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more
|
||||
|
||||
${optionalString cfg.blur ''
|
||||
# Kitty
|
||||
windowrulev2 = opacity 0.95 0.95, class:^kitty$
|
||||
|
||||
windowrulev2 = opacity 0.85 0.85, floating:1
|
||||
|
||||
# Firefox Sharing Indicator
|
||||
${mkRules ["float" "move 49% 40" "noborder"] ["title:^(.*Sharing Indicator)$"]}
|
||||
|
||||
# Rofi
|
||||
${mkRules ["float" "opacity 0.85 0.85" "noborder"] ["class:^([rR]ofi)$"]}
|
||||
|
||||
windowrulev2 = opacity 0.85 0.85, floating:1
|
||||
''}
|
||||
|
||||
# Firefox Sharing Indicator
|
||||
${mkRules ["float" "move 49% 40" "noborder" "nofullscreenrequest"] ["title:^(.*Sharing Indicator)$"]}
|
||||
|
||||
# Emacs
|
||||
windowrulev2 = opaque, class:^emacs$
|
||||
|
||||
|
|
@ -134,26 +148,32 @@ in
|
|||
$windowMod = ALT
|
||||
|
||||
# Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more
|
||||
bind = $mainMod, D, exec, hyprctl keyword general:layout dwindle
|
||||
bind = $mainMod, E, exec, emacsclient -c -a emacs
|
||||
bind = $mainMod, F, togglefloating,
|
||||
bind = $mainMod SHIFT, F, fullscreen,
|
||||
bind = $mainMod, M, exec, hyprctl keyword general:layout master
|
||||
bind = $mainMod, P, pseudo, # dwindle
|
||||
bind = $mainMod, Q, killactive,
|
||||
bind = $mainMod, R, exec, rofi -x11 -show combi
|
||||
bind = $mainMod, C, exec, rofi -x11 -show calc -modi calc -no-show-match -no-sort | wl-copy
|
||||
bind = $mainMod, B, exec, rofi-bluetooth
|
||||
bind = $mainMod, RETURN, exec, kitty
|
||||
bind = $mainMod, T, togglesplit, # dwindle
|
||||
bind = , XF86AudioLowerVolume, exec, pamixer -d 5
|
||||
bind = , XF86AudioMute, exec, pamixer -t
|
||||
bind = , XF86AudioNext, exec, playerctl -p "spotifyd,firefox" next
|
||||
bind = , XF86AudioPlay, exec, playerctl -p "spotifyd,firefox" play-pause
|
||||
bind = , XF86AudioPrev, exec, playerctl -p "spotifyd,firefox" previous
|
||||
bind = , XF86AudioRaiseVolume, exec, pamixer -i 5
|
||||
bind = , XF86MonBrightnessDown, exec, brightnessctl s 10%-
|
||||
bind = , XF86MonBrightnessUp, exec, brightnessctl s 10%+
|
||||
|
||||
# Window binds
|
||||
bind = $mainMod , F , togglefloating ,
|
||||
bind = $mainMod , P , pseudo ,
|
||||
bind = $mainMod , Q , killactive ,
|
||||
bind = $mainMod , T , togglesplit ,
|
||||
bind = $mainMod SHIFT , F , fullscreen ,
|
||||
|
||||
# Program binds
|
||||
bind = $mainMod , B , exec , rofi-bluetooth
|
||||
bind = $mainMod , C , exec , rofi -show calc -modi calc -no-show-match -no-sort | wl-copy
|
||||
bind = $mainMod , D , exec , hyprctl keyword general:layout dwindle
|
||||
bind = $mainMod , E , exec , emacsclient -c -a emacs
|
||||
bind = $mainMod , M , exec , hyprctl keyword general:layout master
|
||||
bind = $mainMod , R , exec , rofi -show combi
|
||||
bind = $mainMod , RETURN , exec , kitty
|
||||
|
||||
# XF86 keys
|
||||
bind = , XF86AudioLowerVolume , exec , pamixer -d 5
|
||||
bind = , XF86AudioRaiseVolume , exec , pamixer -i 5
|
||||
bind = , XF86AudioMute , exec , pamixer -t
|
||||
bind = , XF86AudioNext , exec , playerctl -p "spotifyd,firefox" next
|
||||
bind = , XF86AudioPlay , exec , playerctl -p "spotifyd,firefox" play-pause
|
||||
bind = , XF86AudioPrev , exec , playerctl -p "spotifyd,firefox" previous
|
||||
bind = , XF86MonBrightnessDown , exec , brightnessctl s 10%-
|
||||
bind = , XF86MonBrightnessUp , exec , brightnessctl s 10%+
|
||||
|
||||
# Move focus with mainMod + hjkl
|
||||
bind = $mainMod, H, movefocus, l
|
||||
|
|
@ -161,11 +181,17 @@ in
|
|||
bind = $mainMod, K, movefocus, u
|
||||
bind = $mainMod, J, movefocus, d
|
||||
|
||||
# Change current active window size with mainMod + hjkl
|
||||
# Change current active window size with mainMod + SHIFT + hjkl
|
||||
bind = $mainMod SHIFT, H, resizeactive, -10 0
|
||||
bind = $mainMod SHIFT, L, resizeactive, 10 0
|
||||
bind = $mainMod SHIFT, K, resizeactive, 0 -10
|
||||
bind = $mainMod SHIFT, J, resizeactive, 0 10
|
||||
bind = $mainMod SHIFT, K, resizeactive, 0 -10
|
||||
bind = $mainMod SHIFT, L, resizeactive, 10 0
|
||||
|
||||
# Move current active window with mainMod + ALT + hjkl
|
||||
bind = $mainMod ALT, H, movewindow, l
|
||||
bind = $mainMod ALT, J, movewindow, d
|
||||
bind = $mainMod ALT, K, movewindow, u
|
||||
bind = $mainMod ALT, L, movewindow, r
|
||||
|
||||
# Switch workspaces with mainMod + [0-9]
|
||||
bind = $mainMod, 1, workspace, 1
|
||||
|
|
@ -200,4 +226,5 @@ in
|
|||
bindm = $mainMod, mouse:273, resizewindow
|
||||
|
||||
exec-once=synology-drive
|
||||
exec-once=randomWallpaper
|
||||
''
|
||||
|
|
|
|||
|
|
@ -15,6 +15,16 @@ in
|
|||
options.my.programs.hyprland = {
|
||||
enable = mkEnableOption "hyprland";
|
||||
nvidiaSupport = mkEnableOption "enable nvidia Support";
|
||||
blur = mkOption {
|
||||
type = types.bool;
|
||||
description = "enable window blurring";
|
||||
default = true;
|
||||
};
|
||||
shadows = mkOption {
|
||||
type = types.bool;
|
||||
description = "enable window shadows";
|
||||
default = true;
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
|
@ -26,39 +36,59 @@ in
|
|||
services.dunst.enable = true;
|
||||
};
|
||||
|
||||
home-manager.users.moritz = {
|
||||
imports = [ inputs.hyprland.homeManagerModules.default ];
|
||||
# enable nix module
|
||||
programs.hyprland = {
|
||||
enable = true;
|
||||
package = null; # because we use the home-manager module
|
||||
};
|
||||
|
||||
programs.waybar = {
|
||||
enable = true;
|
||||
package = pkgs.waybar-hyprland;
|
||||
systemd = {
|
||||
enable = true;
|
||||
target = "hyprland-session.target";
|
||||
};
|
||||
settings = {
|
||||
mainBar = {
|
||||
layer = "top";
|
||||
position = "top";
|
||||
height = 30;
|
||||
modules-left = [ "wlr/workspaces" ];
|
||||
modules-center = [ "hyprland/window" ];
|
||||
modules-right = [ "network" "memory" "cpu" "battery" "clock" ];
|
||||
modules = {
|
||||
"wlr/workspaces" = {
|
||||
on-click = "activate";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# enable home-manager module
|
||||
home-manager.users.moritz = {
|
||||
# import home-manager module
|
||||
imports = [ inputs.hyprland.homeManagerModules.default ];
|
||||
|
||||
wayland.windowManager.hyprland = {
|
||||
enable = true;
|
||||
package = hyprland;
|
||||
extraConfig = import ./config.nix args;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
# add waybar as a status bar
|
||||
home-manager.users.moritz.programs.waybar = {
|
||||
enable = true;
|
||||
|
||||
# use package with hyprland support for switching workspaces
|
||||
package = pkgs.waybar-hyprland;
|
||||
|
||||
# start using systemd service
|
||||
systemd = {
|
||||
enable = true;
|
||||
target = "hyprland-session.target";
|
||||
};
|
||||
|
||||
settings = {
|
||||
mainBar = {
|
||||
layer = "top";
|
||||
position = "top";
|
||||
height = 30;
|
||||
modules-left = [ "wlr/workspaces" ];
|
||||
modules-center = [ "hyprland/window" ];
|
||||
modules-right = [ "network" "memory" "cpu" "battery" "clock" ];
|
||||
modules = {
|
||||
"wlr/workspaces" = {
|
||||
on-click = "activate";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
# lock screen after timeout
|
||||
home-manager.users.moritz = {
|
||||
services.swayidle = {
|
||||
enable = true;
|
||||
events = [
|
||||
|
|
@ -83,49 +113,57 @@ in
|
|||
}
|
||||
];
|
||||
};
|
||||
|
||||
# start swayidle as part of hyprland, not sway
|
||||
systemd.user.services.swayidle.Install.WantedBy = lib.mkForce [ "hyprland-session.target" ];
|
||||
|
||||
xdg.configFile."hypr/hyprpaper.conf" = {
|
||||
text =
|
||||
let
|
||||
setWallpaper = wallpaper: ''
|
||||
preload = ${wallpaper}
|
||||
wallpaper = ,${wallpaper}
|
||||
'';
|
||||
in
|
||||
setWallpaper "/home/moritz/.config/wallpapers/a_short_walk.png";
|
||||
onChange = "${pkgs.systemd}/bin/systemctl restart --user hyprpaper.service";
|
||||
};
|
||||
};
|
||||
|
||||
# adds pam module for swaylock
|
||||
security.pam.services.swaylock = { };
|
||||
|
||||
|
||||
# start hyprpaper daemon using systemd unit (to set wallpaper)
|
||||
systemd.user.services.hyprpaper = {
|
||||
enable = true;
|
||||
path = [ pkgs.hyprpaper ];
|
||||
wantedBy = [ "hyprland-session.target" ];
|
||||
after = [ "display-manager.service" ];
|
||||
after = [ "hyprland-session.target" ];
|
||||
script = "hyprpaper";
|
||||
};
|
||||
|
||||
users.users.moritz.packages = with pkgs; [
|
||||
swayidle
|
||||
swaylock-effects
|
||||
pamixer
|
||||
playerctl
|
||||
brightnessctl
|
||||
grimblast
|
||||
slurp
|
||||
grim
|
||||
wl-clipboard
|
||||
wdisplays
|
||||
];
|
||||
|
||||
security.pam.services.swaylock = { };
|
||||
|
||||
programs.hyprland = {
|
||||
enable = true;
|
||||
package = null;
|
||||
# set hyprpaper conf (for setting initial background)
|
||||
home-manager.users.moritz.xdg.configFile."hypr/hyprpaper.conf" = {
|
||||
text =
|
||||
let
|
||||
setWallpaper = wallpaper: ''
|
||||
preload = ${wallpaper}
|
||||
wallpaper = ,${wallpaper}
|
||||
'';
|
||||
in
|
||||
setWallpaper "/home/moritz/.config/wallpapers/a_short_walk.png";
|
||||
onChange = "${pkgs.systemd}/bin/systemctl restart --user hyprpaper.service";
|
||||
};
|
||||
|
||||
|
||||
# only consider graphical-session.target started when hyprland-sesstion.target is reached
|
||||
systemd.user.targets.hyprland-session = {
|
||||
wantedBy = [ "graphical-session.target" ];
|
||||
before = [ "graphical-session.target" ];
|
||||
};
|
||||
|
||||
|
||||
# add user packages for wayland and hyprland in particular
|
||||
users.users.moritz.packages = with pkgs; [
|
||||
pamixer # pulse audio cli
|
||||
playerctl # control media playback
|
||||
brightnessctl # control brightness
|
||||
grimblast # screenshot tool for hyprland
|
||||
slurp # region select for wayland (for screensharing)
|
||||
wl-clipboard # clipboard tool for wayland
|
||||
];
|
||||
|
||||
|
||||
# additional environment variables
|
||||
environment.sessionVariables =
|
||||
{
|
||||
XDG_CURRENT_DESKTOP = "Hyprland";
|
||||
|
|
@ -136,18 +174,19 @@ in
|
|||
QT_WAYLAND_DISABLE_WINDOWDECORATION = "1";
|
||||
QT_QPA_PLATFORMTHEME = "qt5ct";
|
||||
_JAVA_AWT_WM_NONEREPARENTING = "1";
|
||||
} //
|
||||
(if cfg.nvidiaSupport then
|
||||
} // (optionalAttrs cfg.nvidiaSupport
|
||||
{
|
||||
LIBVA_DRIVER_NAME = "nvidia";
|
||||
GBM_BACKEND = "nvidia-drm";
|
||||
__GLX_VENDOR_LIBRARY_NAME = "nvidia";
|
||||
WLR_NO_HARDWARE_CURSORS = "1";
|
||||
__GL_VRR_ALLOWED = "0";
|
||||
} else { });
|
||||
});
|
||||
|
||||
|
||||
services = {
|
||||
dbus.enable = true;
|
||||
# use pipewire (needed for screensharing)
|
||||
pipewire = {
|
||||
enable = true;
|
||||
alsa.enable = true;
|
||||
|
|
@ -163,12 +202,14 @@ in
|
|||
user = "moritz";
|
||||
};
|
||||
defaultSession = "hyprland";
|
||||
sessionPackages = [ hyprland ];
|
||||
sessionPackages = [ hyprland ]; # can't set the defaultSession otherwise
|
||||
};
|
||||
};
|
||||
};
|
||||
security.rtkit.enable = true;
|
||||
|
||||
|
||||
# dekstop portal (for screensharing)
|
||||
xdg.portal = {
|
||||
enable = true;
|
||||
wlr.enable = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue