modules/window-manager: add hyprland

This commit is contained in:
Dmitriy Pleshevskiy 2024-04-22 23:43:16 +03:00
parent c93ef62b37
commit 629c9e995c
Signed by: pleshevskiy
GPG Key ID: 17041163DA10A9A2
11 changed files with 186 additions and 22 deletions

View File

@ -492,11 +492,11 @@
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1711593151,
"narHash": "sha256-/9NCoPI7fqJIN8viONsY9X0fAeq8jc3GslFCO0ky6TQ=",
"lastModified": 1713714268,
"narHash": "sha256-ZJGnom7YthvNxUZLdUzy5VePTwYgDYcnnPpyHT4n9lY=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "bb2b73df7bcfbd2dd55ff39b944d70547d53c267",
"rev": "69ee1d82f1fa4c70a3dc9a64111e7eef3b8e4527",
"type": "github"
},
"original": {

View File

@ -1,4 +1,4 @@
{ globalData, ... }:
{ ... }:
{
imports = [
@ -8,15 +8,12 @@
];
################################################################################
# Programs
# Window manager
################################################################################
local.programs.browsers.tor-browser = {
enable = true;
container = {
enable = true;
externalInterface = "wg0";
sshAuthorizedKeys = globalData.publicKeys.users.jan;
};
local.window-manager = {
xmonad.enable = false;
hyprland.enable = true;
};
################################################################################
@ -24,7 +21,7 @@
################################################################################
# Enable the Docker
virtualisation.docker.enable = true;
# virtualisation.docker.enable = true;
# Torrent
# services.transmission.enable = true;

View File

@ -9,12 +9,18 @@ in
home-manager.users.jan = {
local.window-manager = {
hyprland.enable = true;
polybar.enable = false;
xmonad.enable = false;
xmonad.projects = import ./xmonad-projects.secret.nix;
};
local.programs.terminals.wezterm.enable = false;
# local.programs.dev-tools.k8s.enable = true;
local.programs.libreoffice.enable = true;
local.programs.libreoffice.enable = false;
local.services.lan-mouse.settings = {
port = asusData.lan-mouse.port;

View File

@ -3,6 +3,7 @@
{
imports = [
./xmonad.nix
./hyprland.nix
./polybar.nix
];
}

View File

@ -0,0 +1,131 @@
{ config, pkgs, lib, ... }:
let
cfg = config.local.window-manager.hyprland;
in
{
options.local.window-manager.hyprland = with lib; {
enable = mkEnableOption "hyperland window manager";
};
config = lib.mkIf cfg.enable {
home.packages = with pkgs.unstable; [
foot
wl-clipboard
wlsunset
swaybg
dmenu-wayland
];
wayland.windowManager.hyprland = {
enable = true;
package = pkgs.unstable.hyprland;
systemd.enable = true;
xwayland.enable = true;
settings = {
# monitors
monitor = ",preferred,auto,auto";
# env
env = [
"XCURSOR_SIZE,24"
"HYPRCURSOR_SIZE,24"
];
# look and feel
general = {
gaps_in = 5;
gaps_out = 20;
border_size = 2;
"col.active_border" = "rgba(33ccffee) rgba(00ff99ee) 45deg";
"col.inactive_border" = "rgba(595959aa)";
resize_on_border = false;
allow_tearing = false;
layout = "master";
};
decoration = {
rounding = 5;
active_opacity = 1.0;
inactive_opacity = 1.0;
drop_shadow = false;
blur = {
enabled = false;
};
};
animations = {
enabled = false;
};
master = {
orientation = "top";
new_is_master = false;
};
gestures = {
workspace_swipe = false;
};
"$terminal" = "foot";
"$browser" = "librewolf";
"$fileManager" = "vifm";
"$menu" = "dmenu-wl_run";
"$mod" = "ALT_L";
bind = lib.flatten [
# programs
"$mod SHIFT, Return, exec, $terminal"
"$mod SHIFT, S, exec, flameshot gui"
"$mod SHIFT, B, exec, $browser"
"$mod, p, exec, $menu"
# Move focus
(lib.flip lib.mapAttrsToList { L = "r"; H = "l"; J = "d"; K = "u"; } (k: d:
"$mod, ${k}, movefocus, ${d}"
))
(lib.flip map [ 1 2 3 4 5 6 7 8 9 0 ] (i:
let wid = if i == 0 then 10 else i; in
[
# switch warkspaces with mod + [0-9]
"$mod, ${toString i}, workspace, ${toString wid}"
# move active window to a workspace with mod + shift + [0-9]
"$mod SHIFT, ${toString i}, movetoworkspace, ${toString wid}"
]
))
];
bindm = [
"$mod, mouse:272, movewindow"
"$mod, mouse:273, resizewindow"
];
input = let kb = config.home.keyboard; in {
kb_model = kb.model;
kb_layout = kb.layout;
kb_variant = kb.variant;
kb_options = lib.head kb.options;
};
};
};
};
}

View File

@ -15,7 +15,7 @@
local.fonts.enable = lib.mkDefault true;
local.sound.enable = lib.mkDefault true;
local.window-manager.enable = lib.mkDefault true;
local.window-manager.xmonad.enable = lib.mkDefault true;
################################################################################
# Services

View File

@ -7,6 +7,6 @@
./nix.nix
./sound.nix
./system.nix
./window-manager.nix
./window-manager
];
}

View File

@ -0,0 +1,9 @@
{ ... }:
{
imports = [
./hyprland.nix
./xmonad.nix
];
}

View File

@ -0,0 +1,19 @@
{ config, lib, pkgs, ... }:
let
cfg = config.local.window-manager.hyprland;
in
{
options.local.window-manager.hyprland = with lib; {
enable = mkEnableOption "hyperland window manager";
};
config = lib.mkIf cfg.enable {
programs.hyprland = {
enable = true;
package = pkgs.unstable.hyprland;
};
programs.gnupg.agent.pinentryFlavor = "gtk2";
};
}

View File

@ -1,9 +1,10 @@
{ config, pkgs, lib, ... }:
let cfg = config.local.window-manager.xmonad; in
{
options.local.window-manager.enable = lib.mkEnableOption "window-manager";
options.local.window-manager.xmonad.enable = lib.mkEnableOption "window-manager";
config = lib.mkIf config.local.window-manager.enable {
config = lib.mkIf cfg.enable {
services.dbus = {
enable = true;
packages = [ pkgs.dconf ];

View File

@ -52,13 +52,13 @@
};
local.window-manager = {
xmonad.enable = true;
polybar.enable = true;
xmonad.enable = lib.mkDefault true;
polybar.enable = lib.mkDefault true;
};
xdg.enable = true;
xdg.enable = lib.mkDefault true;
local.shell.enable = true;
local.shell.enable = lib.mkDefault true;
################################################################################