Added wayland, hyprland and eww
This commit is contained in:
148
modules/desktop/hyprland.nix
Normal file
148
modules/desktop/hyprland.nix
Normal file
@@ -0,0 +1,148 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.samfelag.modules.desktop.hyprland;
|
||||
mod = "Mod4";
|
||||
in {
|
||||
|
||||
options.samfelag.modules.desktop.hyprland = with lib; {
|
||||
enable = mkEnableOption "hyprland window manager";
|
||||
|
||||
mod = my.mkOpt' types.str "Mod4" "Main modifier key for hyprland";
|
||||
|
||||
laptop = mkEnableOption "Enable features for a laptop (trackpad, battery, etc...)";
|
||||
|
||||
extraKeybindings = my.mkOpt (types.listOf types.str) [ ];
|
||||
extraStartup = my.mkOpt (types.listOf types.attrs) [ ];
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
# Wallpaper
|
||||
hyprpaper
|
||||
];
|
||||
|
||||
# - Dependencies -----------------------------
|
||||
samfelag.modules.desktop.rofi.enable = true;
|
||||
samfelag.modules.desktop.eww.enable = true;
|
||||
|
||||
# - Configuration -----------------------------
|
||||
|
||||
# Hyprpaper
|
||||
hm.xdg.configFile."hypr/hyprpaper.conf".text = ''
|
||||
preload = ${config.samfelag.modules.desktop.wallpaper}
|
||||
wallpaper = ,${config.samfelag.modules.desktop.wallpaper}
|
||||
'';
|
||||
|
||||
programs.hyprland = {
|
||||
enable = true;
|
||||
xwayland.enable = true;
|
||||
enableNvidiaPatches = true;
|
||||
};
|
||||
|
||||
hm.wayland.windowManager.hyprland = {
|
||||
enable = true;
|
||||
xwayland.enable = true;
|
||||
enableNvidiaPatches = true;
|
||||
|
||||
package = pkgs.hyprland;
|
||||
# Optional
|
||||
# Whether to enable hyprland-session.target on hyprland startup
|
||||
systemd.enable = true;
|
||||
|
||||
settings = {
|
||||
input = {
|
||||
kb_layout = "es";
|
||||
};
|
||||
|
||||
monitor = ",highres,auto,1";
|
||||
|
||||
exec-once = [
|
||||
"hyprpaper"
|
||||
"eww open top-bar"
|
||||
];
|
||||
|
||||
decoration = {
|
||||
rounding = 10;
|
||||
};
|
||||
|
||||
gestures = {
|
||||
# See https://wiki.hyprland.org/Configuring/Variables/ for more
|
||||
workspace_swipe = false;
|
||||
};
|
||||
|
||||
bind = [
|
||||
|
||||
"${cfg.mod}, Q, killactive,"
|
||||
|
||||
"${cfg.mod}, F, fullscreen, 1"
|
||||
"${cfg.mod} SHIFT, F, fullscreen, 0"
|
||||
|
||||
"${cfg.mod} SHIFT, SPACE, togglefloating"
|
||||
|
||||
# Move focus
|
||||
"${cfg.mod}, left, movefocus, l"
|
||||
"${cfg.mod}, right, movefocus, r"
|
||||
"${cfg.mod}, up, movefocus, u"
|
||||
"${cfg.mod}, down, movefocus, d"
|
||||
|
||||
"${cfg.mod}, h, movefocus, l"
|
||||
"${cfg.mod}, l, movefocus, r"
|
||||
"${cfg.mod}, k, movefocus, u"
|
||||
"${cfg.mod}, j, movefocus, d"
|
||||
|
||||
# Move focus
|
||||
"${cfg.mod} SHIFT, left, movewindow, l"
|
||||
"${cfg.mod} SHIFT, right, movewindow, r"
|
||||
"${cfg.mod} SHIFT, up, movewindow, u"
|
||||
"${cfg.mod} SHIFT, down, movewindow, d"
|
||||
|
||||
"${cfg.mod} SHIFT, h, movewindow, l"
|
||||
"${cfg.mod} SHIFT, l, movewindow, r"
|
||||
"${cfg.mod} SHIFT, k, movewindow, u"
|
||||
"${cfg.mod} SHIFT, j, movewindow, d"
|
||||
|
||||
# Switch workspace
|
||||
"${cfg.mod}, 1, workspace, 1"
|
||||
"${cfg.mod}, 2, workspace, 2"
|
||||
"${cfg.mod}, 3, workspace, 3"
|
||||
"${cfg.mod}, 4, workspace, 4"
|
||||
"${cfg.mod}, 5, workspace, 5"
|
||||
"${cfg.mod}, 0, workspace, 6"
|
||||
|
||||
# Move to workspace
|
||||
"${cfg.mod} SHIFT, 1, movetoworkspace, 1"
|
||||
"${cfg.mod} SHIFT, 2, movetoworkspace, 2"
|
||||
"${cfg.mod} SHIFT, 3, movetoworkspace, 3"
|
||||
"${cfg.mod} SHIFT, 4, movetoworkspace, 4"
|
||||
"${cfg.mod} SHIFT, 5, movetoworkspace, 5"
|
||||
"${cfg.mod} SHIFT, 0, movetoworkspace, 6"
|
||||
|
||||
# - Media ------------------------------
|
||||
|
||||
# Pulse Audio controls (mute)
|
||||
", XF86AudioMute, exec, pactl set-sink-mute @DEFAULT_SINK@ toggle"
|
||||
|
||||
# Media player controls
|
||||
", XF86AudioPlay, exec, playerctl play-pause"
|
||||
", XF86AudioPause, exec, playerctl play-pause"
|
||||
", XF86AudioNext, exec, playerctl next"
|
||||
", XF86AudioPrev, exec, playerctl previous"
|
||||
", XF86AudioStop, exec, playerctl stop"
|
||||
|
||||
] ++ cfg.extraKeybindings;
|
||||
|
||||
binde = [
|
||||
# Pulse Audio controls (volume)
|
||||
", XF86AudioRaiseVolume, exec, pactl set-sink-volume @DEFAULT_SINK@ +5%"
|
||||
", XF86AudioLowerVolume, exec, pactl set-sink-volume @DEFAULT_SINK@ -5%"
|
||||
];
|
||||
|
||||
bindm = [
|
||||
"${cfg.mod}, mouse:272, movewindow"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user