feat: add hyprland WIP

This commit is contained in:
Jacob Bachmann 2024-03-19 19:10:27 +01:00
parent 971f3a44de
commit 7c5af81e75
Signed by: bchmnn
GPG key ID: 732A612DAD28067D
8 changed files with 170 additions and 9 deletions

View file

@ -8,7 +8,7 @@
gui = {
enable = true;
flavour = [ "sway" ];
flavour = [ "sway" "hyprland" ];
};
nvidia.enable = false;
audio.enable = true;

View file

@ -8,7 +8,7 @@
flavour = mkOption {
type = types.listOf types.str;
default = [ "sway" ];
example = [ "sway" "i3" ];
example = [ "sway" "i3" "hyprland" ];
description = ''
The flavour (WM) for your system to use
'';

View file

@ -3,6 +3,7 @@
environment.pathsToLink = [ "/libexec" ]; # links /libexec from derivations to /run/current-system/sw
programs.sway.enable = builtins.elem "sway" gui.flavour;
programs.hyprland.enable = builtins.elem "hyprland" gui.flavour;
services.xserver.windowManager.i3.enable = builtins.elem "i3" gui.flavour;
services.xserver = {
@ -16,6 +17,7 @@
etc = {
"greetd/environments".text = ''
sway
Hyprland
'';
"greetd/kanshi-config".text = ''
profile nomad {

View file

@ -18,6 +18,7 @@
nvd # Nix/NixOS package version diff tool
inotify-tools # a C library and a set of command-line programs providing a simple interface to inotify
ghostscript # postscript interpreter (mainline version)
ventoy-full # bootable usb solution
] ++ lib.optionals (devenv.enable) [
# languages
gcc13

View file

@ -1,13 +1,14 @@
{ lib, config, ... }: lib.mkIf config.bchmnn.gui.enable {
{ lib, config, pkgs, ... }: lib.mkIf config.bchmnn.gui.enable {
xdg.portal = {
enable = true;
wlr.enable = true;
# gtk portal needed to make gtk apps happy
# extraPortals = [
# pkgs.xdg-desktop-portal-wlr
# pkgs.xdg-desktop-portal-gtk
# ];
# upper has been replaced by following
config.common.default = "*";
extraPortals = with lib; with config.bchmnn; optionals (elem "sway" gui.flavour) [
pkgs.xdg-desktop-portal-wlr
] ++ optionals (elem "hyprland" gui.flavour) [
pkgs.xdg-desktop-portal-hyprland
];
};
}

View file

@ -6,6 +6,8 @@
./programs
] ++ optionals (gui.enable && elem "sway" gui.flavour) [
./sway
] ++ optionals (gui.enable && elem "hyprland" gui.flavour) [
./hyprland
] ++ optionals (gui.enable && elem "i3" gui.flavour) [
./i3
];

View file

@ -0,0 +1,143 @@
{ pkgs, lib, nixosConfig, ... }:
let
common = (import ../common.nix) { pkgs = pkgs; lib = lib; };
in
{
imports = [
../sway/waybar.nix
../sway/wofi.nix
];
wayland.windowManager.hyprland = {
enable = true;
enableNvidiaPatches = nixosConfig.bchmnn.nvidia.enable;
# plugins = [ hy3.packages.x86_64-linux.hy3 ];
settings = {
"exec-once" = with pkgs; [
"${waybar}/bin/waybar"
"${dbus}/bin/dbus-update-activation-environment --all"
"${kanshi}/bin/kanshi"
"${networkmanagerapplet}/bin/nm-applet"
"${blueman}/bin/blueman-applet"
"${udiskie}/bin/udiskie --tray"
"${swaynotificationcenter}/bin/swaync"
"${nextcloud-client}/bin/nextcloud"
"${plasma5Packages.kdeconnect-kde}/bin/kdeconnect-indicator"
"${system-config-printer}/bin/system-config-printer-applet"
"${emote}/bin/emote"
];
input = {
accel_profile = "flat";
touchpad = {
natural_scroll = "true";
scroll_factor = "0.5";
};
};
general = {
border_size = "2";
gaps_out = "5";
gaps_in = "5";
};
decoration = {
rounding = "5";
drop_shadow = "true";
shadow_range = "10";
shadow_render_power = "3"; # int [1-4]
shadow_offset = "0 5"; # vec2 [0, 0]
shadow_scale = "0.5"; # float [0.0-1.0]
"col.shadow" = "rgba(00000099)";
};
"$terminal" = "${pkgs.alacritty}/bin/alacritty";
"$fileManager" = "${pkgs.gnome.nautilus}/bin/nautilus";
"$menu" = "${pkgs.wofi}/bin/wofi";
"$mod" = "SUPER";
bind = [
"$mod, Q, killactive,"
"$mod, return, exec, $terminal"
"$mod SHIFT, Q, exit,"
"$mod SHIFT, E, exec, $fileManager"
"$mod, D, togglefloating,"
"$mod, space, exec, $menu"
"$mod CONTROL SHIFT, L, exec, ${pkgs.swaylock-effects}/bin/swaylock --screenshots --clock --indicator --indicator-radius 100 --indicator-thickness 7 --effect-blur 7x5 --effect-vignette 0.5:0.5 --ring-color ffffff --key-hl-color ${common.colorschemes.default._activeDark} --line-color 00000000 --inside-color 00000088 --inside-ver-color ${common.colorschemes.default._activeDark} --separator-color 00000000 --text-color ${common.colorschemes.default._activeDark} --fade-in 0.1"
"$mod SHIFT, V, exec, ${pkgs.pavucontrol}/bin/pavucontrol"
"$mod SHIFT, B, exec, ${pkgs.blueman}/bin/blueman-manager"
"$mod SHIFT, N, exec, ${pkgs.networkmanagerapplet}/bin/nm-connection-editor"
"$mod SHIFT, A, exec, ${pkgs.swaynotificationcenter}/bin/swaync-client -t -sw"
"$mod, period, exec, ${pkgs.emote}/bin/emote"
# bind = $mod, P, pseudo, # dwindle
# bind = $mod, J, togglesplit, # dwindle
# Move focus
"$mod, H, movefocus, l"
"$mod, L, movefocus, r"
"$mod, K, movefocus, u"
"$mod, J, movefocus, d"
"$mod, P, focusmonitor, l"
"$mod, N, focusmonitor, r"
# Move windows
"$mod SHIFT, H, movewindow, l"
"$mod SHIFT, J, movewindow, d"
"$mod SHIFT, K, movewindow, u"
"$mod SHIFT, L, movewindow, r"
# Switch workspaces
"$mod, 1, workspace, 1"
"$mod, 2, workspace, 2"
"$mod, 3, workspace, 3"
"$mod, 4, workspace, 4"
"$mod, 5, workspace, 5"
"$mod, 6, workspace, 6"
"$mod, 7, workspace, 7"
"$mod, 8, workspace, 8"
"$mod, 9, workspace, 9"
"$mod, 0, workspace, 10"
# Move active window to a workspace
"$mod SHIFT, 1, movetoworkspace, 1"
"$mod SHIFT, 2, movetoworkspace, 2"
"$mod SHIFT, 3, movetoworkspace, 3"
"$mod SHIFT, 4, movetoworkspace, 4"
"$mod SHIFT, 5, movetoworkspace, 5"
"$mod SHIFT, 6, movetoworkspace, 6"
"$mod SHIFT, 7, movetoworkspace, 7"
"$mod SHIFT, 8, movetoworkspace, 8"
"$mod SHIFT, 9, movetoworkspace, 9"
"$mod SHIFT, 0, movetoworkspace, 10"
"$mod CONTROL, J, workspace, -1"
"$mod CONTROL, K, workspace, +1"
"$mod CONTROL SHIFT, J, movecurrentworkspacetomonitor, l"
"$mod CONTROL SHIFT, K, movecurrentworkspacetomonitor, r"
"$mod, W, togglegroup,"
", print, exec, ${pkgs.sway-contrib.grimshot}/bin/grimshot copy area"
];
binde = [
", XF86AudioRaiseVolume, exec, ${pkgs.wireplumber}/bin/wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%+"
", XF86AudioLowerVolume, exec, ${pkgs.wireplumber}/bin/wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%-"
", XF86AudioMute, exec, ${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"
", XF86AudioMicMute, exec, ${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"
", XF86MonBrightnessDown, exec, ${pkgs.brightnessctl}/bin/brightnessctl -q set 5%-"
", XF86MonBrightnessUp, exec, ${pkgs.brightnessctl}/bin/brightnessctl -q set 5%+"
", XF86AudioPrev, exec, ${pkgs.playerctl}/bin/playerctl previous"
", XF86AudioNext, exec, ${pkgs.playerctl}/bin/playerctl next"
", XF86AudioPlay, exec, ${pkgs.playerctl}/bin/playerctl play-pause"
", XF86AudioPause, exec, ${pkgs.playerctl}/bin/playerctl play-pause"
];
bindm = [
# mouse movements
"$mod, mouse:272, movewindow"
"$mod, mouse:273, resizewindow"
"$mod ALT, mouse:272, resizewindow"
];
};
systemd = {
enable = true;
# extraCommands = []
};
xwayland.enable = true;
};
}

View file

@ -5,12 +5,14 @@
settings.mainBar = {
layer = "top";
margin = "5 5 5 5";
modules-left = [ "sway/workspaces" "sway/window" "sway/mode" ];
modules-left = [ "sway/workspaces" "sway/window" "sway/mode"
# "hyprland/workspaces" "hyprland/window"
];
modules-center = [ "clock" ];
modules-right = [ "tray" "network" "pulseaudio" "custom/mem" "temperature" "backlight" "battery" ];
"sway/workspaces" = {
disable-scroll = true;
persistent_workspaces = {
persistent-workspaces = {
"1" = [ ];
"2" = [ ];
"3" = [ ];
@ -24,6 +26,12 @@
"sway/mode" = {
format = "<span style=\"italic\">{}</span>";
};
"hyprland/workspaces" = {
disable-scroll = true;
};
"hyprland/window" = {
format = "{title}";
};
clock = {
timezones = [ "Europe/Berlin" ];
tooltip-format = "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>";
@ -201,6 +209,10 @@
color: white;
}
#workspaces button.visible {
color: white;
}
#window {
padding-left: 16px;
padding-right: 16px;