From d7898e19e8cab8f4dc0a7f4d0ea7f197db2ba647 Mon Sep 17 00:00:00 2001 From: Pim Kunis Date: Sun, 9 Jun 2024 19:08:00 +0200 Subject: [PATCH] Add hyprland --- flake.lock | 440 ++++++++++++++++++++++++++++++- flake.nix | 19 ++ hyprland/default.nix | 183 +++++++++++++ hyprland/home.nix | 191 ++++++++++++++ hyprland/waybar/config.jsonc.nix | 183 +++++++++++++ hyprland/waybar/style.css.nix | 204 ++++++++++++++ 6 files changed, 1211 insertions(+), 9 deletions(-) create mode 100644 hyprland/default.nix create mode 100644 hyprland/home.nix create mode 100644 hyprland/waybar/config.jsonc.nix create mode 100644 hyprland/waybar/style.css.nix diff --git a/flake.lock b/flake.lock index ede4485..0c3d335 100644 --- a/flake.lock +++ b/flake.lock @@ -25,6 +25,120 @@ "type": "github" } }, + "base16": { + "inputs": { + "fromYaml": "fromYaml" + }, + "locked": { + "lastModified": 1708890466, + "narHash": "sha256-LlrC09LoPi8OPYOGPXegD72v+//VapgAqhbOFS3i8sc=", + "owner": "SenchoPens", + "repo": "base16.nix", + "rev": "665b3c6748534eb766c777298721cece9453fdae", + "type": "github" + }, + "original": { + "owner": "SenchoPens", + "repo": "base16.nix", + "type": "github" + } + }, + "base16-fish": { + "flake": false, + "locked": { + "lastModified": 1622559957, + "narHash": "sha256-PebymhVYbL8trDVVXxCvZgc0S5VxI7I1Hv4RMSquTpA=", + "owner": "tomyun", + "repo": "base16-fish", + "rev": "2f6dd973a9075dabccd26f1cded09508180bf5fe", + "type": "github" + }, + "original": { + "owner": "tomyun", + "repo": "base16-fish", + "type": "github" + } + }, + "base16-foot": { + "flake": false, + "locked": { + "lastModified": 1696725948, + "narHash": "sha256-65bz2bUL/yzZ1c8/GQASnoiGwaF8DczlxJtzik1c0AU=", + "owner": "tinted-theming", + "repo": "base16-foot", + "rev": "eedbcfa30de0a4baa03e99f5e3ceb5535c2755ce", + "type": "github" + }, + "original": { + "owner": "tinted-theming", + "repo": "base16-foot", + "type": "github" + } + }, + "base16-helix": { + "flake": false, + "locked": { + "lastModified": 1696727917, + "narHash": "sha256-FVrbPk+NtMra0jtlC5oxyNchbm8FosmvXIatkRbYy1g=", + "owner": "tinted-theming", + "repo": "base16-helix", + "rev": "dbe1480d99fe80f08df7970e471fac24c05f2ddb", + "type": "github" + }, + "original": { + "owner": "tinted-theming", + "repo": "base16-helix", + "type": "github" + } + }, + "base16-kitty": { + "flake": false, + "locked": { + "lastModified": 1665001328, + "narHash": "sha256-aRaizTYPpuWEcvoYE9U+YRX+Wsc8+iG0guQJbvxEdJY=", + "owner": "kdrag0n", + "repo": "base16-kitty", + "rev": "06bb401fa9a0ffb84365905ffbb959ae5bf40805", + "type": "github" + }, + "original": { + "owner": "kdrag0n", + "repo": "base16-kitty", + "type": "github" + } + }, + "base16-tmux": { + "flake": false, + "locked": { + "lastModified": 1696725902, + "narHash": "sha256-wDPg5elZPcQpu7Df0lI5O8Jv4A3T6jUQIVg63KDU+3Q=", + "owner": "tinted-theming", + "repo": "base16-tmux", + "rev": "c02050bebb60dbb20cb433cd4d8ce668ecc11ba7", + "type": "github" + }, + "original": { + "owner": "tinted-theming", + "repo": "base16-tmux", + "type": "github" + } + }, + "base16-vim": { + "flake": false, + "locked": { + "lastModified": 1663659192, + "narHash": "sha256-uJvaYYDMXvoo0fhBZUhN8WBXeJ87SRgof6GEK2efFT0=", + "owner": "chriskempson", + "repo": "base16-vim", + "rev": "3be3cd82cd31acfcab9a41bad853d9c68d30478d", + "type": "github" + }, + "original": { + "owner": "chriskempson", + "repo": "base16-vim", + "type": "github" + } + }, "crane": { "inputs": { "flake-compat": [ @@ -116,6 +230,22 @@ "type": "github" } }, + "flake-compat_2": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-parts": { "inputs": { "nixpkgs-lib": [ @@ -139,7 +269,7 @@ }, "flake-utils": { "inputs": { - "systems": "systems_2" + "systems": "systems_3" }, "locked": { "lastModified": 1681202837, @@ -155,6 +285,22 @@ "type": "github" } }, + "fromYaml": { + "flake": false, + "locked": { + "lastModified": 1689549921, + "narHash": "sha256-iX0pk/uB019TdBGlaJEWvBCfydT6sRq+eDcGPifVsCM=", + "owner": "SenchoPens", + "repo": "fromYaml", + "rev": "11fbbbfb32e3289d3c631e0134a23854e7865c84", + "type": "github" + }, + "original": { + "owner": "SenchoPens", + "repo": "fromYaml", + "type": "github" + } + }, "gitignore": { "inputs": { "nixpkgs": [ @@ -177,6 +323,23 @@ "type": "github" } }, + "gnome-shell": { + "flake": false, + "locked": { + "lastModified": 1713702291, + "narHash": "sha256-zYP1ehjtcV8fo+c+JFfkAqktZ384Y+y779fzmR9lQAU=", + "owner": "GNOME", + "repo": "gnome-shell", + "rev": "0d0aadf013f78a7f7f1dc984d0d812971864b934", + "type": "github" + }, + "original": { + "owner": "GNOME", + "ref": "46.1", + "repo": "gnome-shell", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -198,6 +361,27 @@ "type": "github" } }, + "home-manager_2": { + "inputs": { + "nixpkgs": [ + "stylix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1714981474, + "narHash": "sha256-b3/U21CJjCjJKmA9WqUbZGZgCvospO3ArOUTgJugkOY=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "6ebe7be2e67be7b9b54d61ce5704f6fb466c536f", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, "homeage": { "inputs": { "nixpkgs": [ @@ -218,6 +402,137 @@ "type": "github" } }, + "hyprcursor": { + "inputs": { + "hyprlang": [ + "hyprland", + "hyprlang" + ], + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1716576411, + "narHash": "sha256-FIN1wMoyePBTtibCbaeJaoKNLuAYIGwLCWAYC1DJanw=", + "owner": "hyprwm", + "repo": "hyprcursor", + "rev": "57298fc4f13c807e50ada2c986a3114b7fc2e621", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprcursor", + "type": "github" + } + }, + "hyprland": { + "inputs": { + "hyprcursor": "hyprcursor", + "hyprlang": "hyprlang", + "hyprwayland-scanner": "hyprwayland-scanner", + "nixpkgs": "nixpkgs", + "systems": "systems_2", + "xdph": "xdph" + }, + "locked": { + "lastModified": 1717784649, + "narHash": "sha256-rU23X1kppflHachNGlwjjVNtz5haTVgFAUrrQjRE1o0=", + "ref": "refs/heads/main", + "rev": "c31d9ef4172452f6f219f91d9b87a24d91f0cf3a", + "revCount": 4774, + "submodules": true, + "type": "git", + "url": "https://github.com/hyprwm/Hyprland" + }, + "original": { + "submodules": true, + "type": "git", + "url": "https://github.com/hyprwm/Hyprland" + } + }, + "hyprland-protocols": { + "inputs": { + "nixpkgs": [ + "hyprland", + "xdph", + "nixpkgs" + ], + "systems": [ + "hyprland", + "xdph", + "systems" + ] + }, + "locked": { + "lastModified": 1691753796, + "narHash": "sha256-zOEwiWoXk3j3+EoF3ySUJmberFewWlagvewDRuWYAso=", + "owner": "hyprwm", + "repo": "hyprland-protocols", + "rev": "0c2ce70625cb30aef199cb388f99e19a61a6ce03", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprland-protocols", + "type": "github" + } + }, + "hyprlang": { + "inputs": { + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1716473782, + "narHash": "sha256-+qLn4lsHU6iL3+HTo1gTQ1tWzet8K9h+IfVemzEQZj8=", + "owner": "hyprwm", + "repo": "hyprlang", + "rev": "87d5d984109c839482b88b4795db073eb9ed446f", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprlang", + "type": "github" + } + }, + "hyprwayland-scanner": { + "inputs": { + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1716058375, + "narHash": "sha256-CwjWoVnBZE5SBpRx9dgSQGCr4Goxyfcyv3zZbOhVqzk=", + "owner": "hyprwm", + "repo": "hyprwayland-scanner", + "rev": "3afed4364790aebe0426077631af1e164a9650cc", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprwayland-scanner", + "type": "github" + } + }, "lanzaboote": { "inputs": { "crane": "crane", @@ -263,16 +578,16 @@ }, "nixpkgs": { "locked": { - "lastModified": 1717281328, - "narHash": "sha256-evZPzpf59oNcDUXxh2GHcxHkTEG4fjae2ytWP85jXRo=", - "owner": "nixos", + "lastModified": 1716330097, + "narHash": "sha256-8BO3B7e3BiyIDsaKA0tY8O88rClYRTjvAp66y+VBUeU=", + "owner": "NixOS", "repo": "nixpkgs", - "rev": "b3b2b28c1daa04fe2ae47c21bb76fd226eac4ca1", + "rev": "5710852ba686cc1fd0d3b8e22b3117d43ba374c2", "type": "github" }, "original": { - "owner": "nixos", - "ref": "nixos-24.05", + "owner": "NixOS", + "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } @@ -309,6 +624,38 @@ "type": "github" } }, + "nixpkgs_2": { + "locked": { + "lastModified": 1717281328, + "narHash": "sha256-evZPzpf59oNcDUXxh2GHcxHkTEG4fjae2ytWP85jXRo=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "b3b2b28c1daa04fe2ae47c21bb76fd226eac4ca1", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1714912032, + "narHash": "sha256-clkcOIkg8G4xuJh+1onLG4HPMpbtzdLv4rHxFzgsH9c=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "ee4a6e0f566fe5ec79968c57a9c2c3c25f2cf41d", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "nur": { "locked": { "lastModified": 1717521378, @@ -361,11 +708,13 @@ "disko": "disko", "home-manager": "home-manager", "homeage": "homeage", + "hyprland": "hyprland", "lanzaboote": "lanzaboote", "nixos-hardware": "nixos-hardware", - "nixpkgs": "nixpkgs", + "nixpkgs": "nixpkgs_2", "nixpkgs-unstable": "nixpkgs-unstable", - "nur": "nur" + "nur": "nur", + "stylix": "stylix" } }, "rust-overlay": { @@ -393,6 +742,34 @@ "type": "github" } }, + "stylix": { + "inputs": { + "base16": "base16", + "base16-fish": "base16-fish", + "base16-foot": "base16-foot", + "base16-helix": "base16-helix", + "base16-kitty": "base16-kitty", + "base16-tmux": "base16-tmux", + "base16-vim": "base16-vim", + "flake-compat": "flake-compat_2", + "gnome-shell": "gnome-shell", + "home-manager": "home-manager_2", + "nixpkgs": "nixpkgs_3" + }, + "locked": { + "lastModified": 1717859878, + "narHash": "sha256-4tVJ4y2fRykrlBozQ1t1nSDcseSzpuODabBCQZi72lQ=", + "owner": "danth", + "repo": "stylix", + "rev": "f0ddd45fbe8d72964e4b92701fe2243da7e48937", + "type": "github" + }, + "original": { + "owner": "danth", + "repo": "stylix", + "type": "github" + } + }, "systems": { "locked": { "lastModified": 1681028828, @@ -409,6 +786,21 @@ } }, "systems_2": { + "locked": { + "lastModified": 1689347949, + "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", + "owner": "nix-systems", + "repo": "default-linux", + "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default-linux", + "type": "github" + } + }, + "systems_3": { "locked": { "lastModified": 1681028828, "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", @@ -422,6 +814,36 @@ "repo": "default", "type": "github" } + }, + "xdph": { + "inputs": { + "hyprland-protocols": "hyprland-protocols", + "hyprlang": [ + "hyprland", + "hyprlang" + ], + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1716290197, + "narHash": "sha256-1u9Exrc7yx9qtES2brDh7/DDZ8w8ap1nboIOAtCgeuM=", + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "rev": "91e48d6acd8a5a611d26f925e51559ab743bc438", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 1519c12..102381b 100644 --- a/flake.nix +++ b/flake.nix @@ -6,6 +6,7 @@ nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; nur.url = "github:nix-community/NUR"; nixos-hardware.url = "github:NixOS/nixos-hardware/master"; + stylix.url = "github:danth/stylix"; home-manager = { url = "github:nix-community/home-manager?ref=release-24.05"; @@ -32,6 +33,12 @@ url = "github:nix-community/disko"; inputs.nixpkgs.follows = "nixpkgs"; }; + + hyprland = { + type = "git"; + url = "https://github.com/hyprwm/Hyprland"; + submodules = true; + }; }; outputs = @@ -184,8 +191,20 @@ boot.initrd.luks.devices."luks-8ffd3129-4908-4209-98c4-4eb68a35c494".device = "/dev/disk/by-uuid/8ffd3129-4908-4209-98c4-4eb68a35c494"; boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "vmd" "nvme" "usb_storage" ]; + + specialisation.hyprland = { + inheritParentConfig = false; + configuration = import ./hyprland; + }; }; }); + + hyprland = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { inherit inputs; }; + + modules = [ ./hyprland ]; + }; }; }; } diff --git a/hyprland/default.nix b/hyprland/default.nix new file mode 100644 index 0000000..9083cc2 --- /dev/null +++ b/hyprland/default.nix @@ -0,0 +1,183 @@ +{ pkgs, config, lib, inputs, ... }: { + imports = [ + inputs.stylix.nixosModules.stylix + ../modules/nixos/lanzaboote.nix + inputs.nixos-hardware.nixosModules.dell-xps-13-9310 + inputs.home-manager.nixosModules.home-manager + ]; + + time.timeZone = "Europe/Amsterdam"; + i18n.defaultLocale = "en_US.UTF-8"; + sound.enable = true; + + programs = { + hyprland = { + enable = true; + package = inputs.hyprland.packages."${pkgs.system}".hyprland; + }; + dconf.enable = true; + file-roller.enable = true; + }; + + services = { + xserver = { + displayManager.gdm = { + enable = true; + wayland = true; + }; + enable = true; + excludePackages = [ pkgs.xterm ]; + }; + + printing.enable = true; + + pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + jack.enable = true; + }; + + dbus = { + enable = true; + packages = [ pkgs.gnome3.gnome-keyring pkgs.gcr ]; + }; + gnome = { + gnome-keyring.enable = true; + sushi.enable = true; + }; + }; + + users = { + users.pim = { + isNormalUser = true; + extraGroups = [ "wheel" "input" "wireshark" "dialout" ]; + }; + }; + + environment = { + variables.NIXOS_OZONE_WL = "1"; + systemPackages = with pkgs; [ + wget + curl + git + btop + ripgrep + vim + tree + dig + jq + file + sbctl + ]; + + etc."greetd/environments".text = "hyprland"; + }; + + system.stateVersion = "24.05"; + + security = { + rtkit.enable = true; + + sudo.extraConfig = '' + Defaults timestamp_timeout=30 + ''; + }; + + nix = { + package = pkgs.nixFlakes; + settings.trusted-users = [ "root" "pim" ]; + + extraOptions = '' + experimental-features = nix-command flakes + ''; + }; + + nixpkgs.hostPlatform = "x86_64-linux"; + nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ "libfprint-2-tod1-goodix" ]; + + boot = { + kernelModules = [ "kvm-intel" ]; + extraModulePackages = [ ]; + + initrd = { + kernelModules = [ ]; + }; + + kernel.sysctl = { + "net.core.default_qdisc" = "fq"; + "net.ipv4.tcp_congestion_control" = "bbr"; + }; + }; + + hardware = { + cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + pulseaudio.enable = false; + + opengl = { + enable = true; + driSupport = true; + driSupport32Bit = true; + extraPackages = with pkgs; [ vaapiVdpau libvdpau-va-gl ]; + }; + }; + + pim.lanzaboote.enable = true; + networking.hostName = "xps-9315"; + swapDevices = [{ device = "/dev/disk/by-uuid/96a43c35-0174-4e92-81f0-168a5f601f0b"; }]; + fileSystems = { + "/" = + { + device = "/dev/disk/by-uuid/31638735-5cc4-4013-8037-17e30edcbb0a"; + fsType = "ext4"; + }; + + "/boot" = + { + device = "/dev/disk/by-uuid/560E-F8A2"; + fsType = "vfat"; + options = [ "fmask=0022" "dmask=0022" ]; + }; + }; + + boot.initrd.luks.devices."luks-8ffd3129-4908-4209-98c4-4eb68a35c494".device = "/dev/disk/by-uuid/8ffd3129-4908-4209-98c4-4eb68a35c494"; + boot.initrd.availableKernelModules = [ "sd_mod" "xhci_pci" "thunderbolt" "vmd" "nvme" "usb_storage" ]; + + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + extraSpecialArgs = { inherit inputs; }; + + users.pim = { + imports = [ ./home.nix ]; + }; + }; + + stylix = { + base16Scheme = "${pkgs.base16-schemes}/share/themes/gruvbox-dark-medium.yaml"; + image = "${inputs.hyprland}/assets/wall2.png"; + + cursor = { + package = pkgs.bibata-cursors; + name = "Bibata-Modern-Ice"; + }; + + fonts = { + monospace = { + package = pkgs.nerdfonts.override { fonts = [ "JetBrainsMono" ]; }; + name = "JetBrainsMono Nerd Font Mono"; + }; + + sansSerif = { + package = pkgs.dejavu_fonts; + name = "DejaVu Sans"; + }; + + serif = { + package = pkgs.dejavu_fonts; + name = "DejaVu Serif"; + }; + }; + }; +} diff --git a/hyprland/home.nix b/hyprland/home.nix new file mode 100644 index 0000000..87cacbc --- /dev/null +++ b/hyprland/home.nix @@ -0,0 +1,191 @@ +{ pkgs, lib, config, inputs, ... }: { + imports = [ + ../home-manager/neovim + ./waybar/style.css.nix + ./waybar/config.jsonc.nix + ]; + home = { + username = "pim"; + homeDirectory = "/home/pim"; + stateVersion = "23.05"; + + packages = with pkgs; [ + hyprland + telegram-desktop + signal-desktop + ]; + }; + + programs = { + home-manager.enable = true; + alacritty.enable = true; + + librewolf = { + enable = true; + settings = { + "identity.fxaccounts.enabled" = true; + "privacy.clearOnShutdown.history" = false; + "privacy.clearOnShutdown.downloads" = false; + "browser.translations.automaticallyPopup" = false; + "browser.aboutConfig.showWarning" = false; + "privacy.clearOnShutdown.cookies" = false; + }; + }; + + waybar = { + enable = true; + + systemd = { + enable = true; + target = "hyprland-session.target"; + }; + }; + }; + + fonts.fontconfig.enable = true; + + wayland.windowManager.hyprland = + let + mainMod = "SUPER"; + terminalEmulator = lib.getExe config.programs.alacritty.package; + fileManager = lib.getExe pkgs.gnome.nautilus; + webBrowser = lib.getExe config.programs.librewolf.package; + launcherCommand = "${lib.getExe pkgs.wofi} --show drun --allow-images --insensitive --matching fuzzy"; + # startupScript = pkgs.writeShellScriptBin "hyprlandStart.sh" '' + # ${lib.getExe pkgs.waybar} & + # ''; + in + { + enable = true; + settings = { + # exec-once = "${lib.getExe startupScript}"; + monitor = ",preferred,auto,auto"; + env = [ + "XCURSOR_SIZE,24" + "HYPRCURSOR_SIZE,24" + ]; + general = { + gaps_in = 5; + gaps_out = 20; + border_size = 2; + resize_on_border = false; + layout = "dwindle"; + }; + + decoration = { + rounding = 10; + active_opacity = "1.0"; + inactive_opacity = "1.0"; + drop_shadow = true; + shadow_range = 4; + shadow_render_power = 3; + + blur = { + enabled = true; + size = 3; + passes = 1; + vibrancy = "0.1696"; + }; + }; + + animations = { + enabled = true; + bezier = "myBezier, 0.05, 0.9, 0.1, 1.05"; + animation = [ + "windows, 1, 7, myBezier" + "windowsOut, 1, 7, default, popin 80%" + "border, 1, 10, default" + "borderangle, 1, 8, default" + "fade, 1, 7, default" + "workspaces, 1, 6, default" + ]; + }; + + dwindle = { + pseudotile = true; + preserve_split = true; + }; + + master.new_is_master = true; + + misc = { + force_default_wallpaper = -1; + disable_hyprland_logo = false; + }; + + input = { + follow_mouse = 1; + sensitivity = 0; + touchpad.natural_scroll = true; + }; + + gestures.workspace_swipe = false; + + bind = [ + "${mainMod}, T, exec, ${terminalEmulator}" + "${mainMod}, D, exec, ${fileManager}" + "${mainMod}, E, exec, ${webBrowser}" + "${mainMod}, W, exec, ${launcherCommand}" + + "${mainMod} SHIFT, Q, killactive" + "${mainMod}, M, exit" + "${mainMod}, V, togglefloating" + "${mainMod}, P, pseudo," + "${mainMod}, C, togglesplit," + "${mainMod}, F, fullscreen, 0" + + "${mainMod}, left, movefocus, l" + "${mainMod}, right, movefocus, r" + "${mainMod}, up, movefocus, u" + "${mainMod}, down, movefocus, d" + + "${mainMod}, H, movefocus, l" + "${mainMod}, L, movefocus, r" + "${mainMod}, K, movefocus, u" + "${mainMod}, J, movefocus, d" + + "${mainMod} SHIFT, H, movewindow, l" + "${mainMod} SHIFT, L, movewindow, r" + "${mainMod} SHIFT, K, movewindow, u" + "${mainMod} SHIFT, J, movewindow, d" + + "${mainMod} Control&SHIFT, H, resizeactive, exact -10% 0" + "${mainMod} Control&SHIFT, L, resizeactive, exact 10% 0" + "${mainMod} Control&SHIFT, K, resizeactive, exact 0 -10%" + "${mainMod} Control&SHIFT, J, resizeactive, exact 0 10%" + + "${mainMod}, 1, workspace, 1" + "${mainMod}, 2, workspace, 2" + "${mainMod}, 3, workspace, 3" + "${mainMod}, 4, workspace, 4" + "${mainMod}, 5, workspace, 5" + "${mainMod}, 6, workspace, 6" + "${mainMod}, 7, workspace, 7" + "${mainMod}, 8, workspace, 8" + "${mainMod}, 9, workspace, 9" + "${mainMod}, 0, workspace, 10" + + "${mainMod} SHIFT, 1, movetoworkspace, 1" + "${mainMod} SHIFT, 2, movetoworkspace, 2" + "${mainMod} SHIFT, 3, movetoworkspace, 3" + "${mainMod} SHIFT, 4, movetoworkspace, 4" + "${mainMod} SHIFT, 5, movetoworkspace, 5" + "${mainMod} SHIFT, 6, movetoworkspace, 6" + "${mainMod} SHIFT, 7, movetoworkspace, 7" + "${mainMod} SHIFT, 8, movetoworkspace, 8" + "${mainMod} SHIFT, 9, movetoworkspace, 9" + "${mainMod} SHIFT, 0, movetoworkspace, 10" + + "${mainMod}, mouse_down, workspace, e+1" + "${mainMod}, mouse_up, workspace, e-1" + ]; + + bindm = [ + "${mainMod}, mouse:272, movewindow" + "${mainMod}, mouse:273, resizewindow" + ]; + + windowrulev2 = "suppressevent maximize, class:.*"; + }; + }; +} diff --git a/hyprland/waybar/config.jsonc.nix b/hyprland/waybar/config.jsonc.nix new file mode 100644 index 0000000..0e94e6e --- /dev/null +++ b/hyprland/waybar/config.jsonc.nix @@ -0,0 +1,183 @@ +{ pkgs, config, lib, ... }: { + xdg.configFile."waybar/config" = { + onChange = '' + ${pkgs.procps}/bin/pkill -u $USER -USR2 waybar || true + ''; + + text = + let + palette = config.stylix.generated.palette; + in + '' + { + "layer": "top", + // "output": [], + "position": "top", + "height": 36, + // "width": 900, + // "margin": "", + "margin-top": 10, + "margin-bottom": 0, + "margin-left": 10, + "margin-right": 10, + "spacing": 10, + "gtk-layer-shell": true, + "border-radius": 10, + + "clock": { + "interval": 1, + "format": " {:%I:%M} ", + "format-alt": " {:%A, %d %B} ", + // "on-click": "gnome-calendar", + "tooltip": true, + "tooltip-format": "{calendar}", + "calendar": { + "mode": "year", + "mode-mon-col": 3, + "format": { + "today": "{}" + } + } + }, + "modules-left": [ + "clock", + "hyprland/workspaces", + "custom/notification" + ], + "modules-center": [ + "hyprland/submap", + "hyprland/window" + ], + "modules-right": [ + + // "cpu", + // "memory", + "network#wlp2s0", + "bluetooth", + "backlight", + // "pulseaudio#microphone", + "pulseaudio#audio", + "battery", + + "tray" + ], + + "hyprland/workspaces": { + "format": " {icon} ", + "format-icons": { + "default": "󰄰", + "active": "" + }, + "on-click": "activate" + }, + + "hyprland/submap": { + "format": "{}", + "tooltip": false + }, + + "hyprland/window": { + "format": " {} ", + "separate-outputs": false + }, + + "tray": { + "icon-size": 15, + "spacing": 10 + }, + + "cpu": { + "format": " {usage}%", + "on-click": "", + "tooltip": false + }, + + "memory": { + "format": "󰍛 {used:0.1f}GB ({percentage}%) / {total:0.1f}GB", + "on-click": "", + "tooltip": false + }, + + "backlight": { + "format": " {icon} {percent} ", + "format-icons": [ + "󰃟" + ], + "on-scroll-up": "${lib.getExe pkgs.brightnessctl} set +5%", + "on-scroll-down": "${lib.getExe pkgs.brightnessctl} set 5%-", + "on-click": "${lib.getExe pkgs.brightnessctl} set 1", + "tooltip": false + }, + + "pulseaudio#audio": { + "format": " {icon} {volume:2} ", + "format-bluetooth": " {icon} {volume}%  ", + "format-muted": " {icon} Muted ", + "format-icons": { + "headphones": "", + "default": [ + "", + "" + ] + }, + "scroll-step": 5, + "on-click": "pavucontrol", + "on-click-right": "pamixer -t" + }, + + "network#wlp2s0": { + "interval": 1, + "interface": "wlan0", + "format-icons": [ + "󰤯", + "󰤟", + "󰤢", + "󰤥", + "󰤨" + ], + "format-wifi": " {icon} ", // added multiple spaces to the right, was not aligning center correctly, still is not :( + "format-disconnected": "󰤮", + "on-click": "iwgtk", + "tooltip": true, + "tooltip-format": "󰢮 {ifname}\n󰩟 {ipaddr}/{cidr}\n{icon} {essid}\n󱑽 {signalStrength}% {signaldBm} dBm {frequency} MHz\n󰞒 {bandwidthDownBytes}\n󰞕 {bandwidthUpBytes}" + }, + + "bluetooth": { + "format-disabled": " 󰂲 ", + "format-off": " 󰂲 ", + "format-on": " 󰂯 ", + "format-connected": " 󰂯 ", + "format-connected-battery": " 󰂯 ", + "tooltip-format-connected": " {device_alias} 󰂄{device_battery_percentage} ", + "on-click": "blueberry", + "tooltip": true + }, + + "battery": { + "states": { + "warning": 20, + "critical": 10 + }, + + "format": " {icon} {capacity} ", + "format-charging": " 󰂄 {capacity} ", + "format-plugged": " 󱘖 {capacity} ", + "format-icons": [ + "󰁺", + "󰁻", + "󰁼", + "󰁽", + "󰁾", + "󰁿", + "󰂀", + "󰂁", + "󰂂", + "󰁹" + ], + "on-click": "", + "tooltip": false + } + } + ''; + }; +} diff --git a/hyprland/waybar/style.css.nix b/hyprland/waybar/style.css.nix new file mode 100644 index 0000000..00dd90c --- /dev/null +++ b/hyprland/waybar/style.css.nix @@ -0,0 +1,204 @@ +{ config, ... }: { + programs.waybar.style = + let + palette = config.stylix.generated.palette; + in + '' + * { + font-size: 14px; + font-family: "Hack Nerd Font"; + border-radius: 10; + } + + window#waybar { + background-color: transparent; + color: #${palette.base05}; + /* border-radius: 20px; */ + /* border: 1px solid #${palette.base00}; */ + } + + tooltip { + background: #${palette.base00}; + border: 1px solid #${palette.base05}; + border-radius: 10px; + } + tooltip label { + color: #${palette.base05}; + } + + #workspaces { + background-color: transparent; + margin-top: 0; + margin-bottom: 0; + } + + #workspaces button { + background-color: #${palette.base00}; + color: #${palette.base05}; + border-radius: 10px; + transition: all 0.3s ease; + margin-right: 10; + } + + #workspaces button:hover { + box-shadow: inherit; + text-shadow: inherit; + background-color: #${palette.base04}; + color: #${palette.base09}; + min-width: 30px; + transition: all 0.3s ease; + } + + #workspaces button.focused, + #workspaces button.active { + background-color: #${palette.base02}; + color: #${palette.base09}; + min-width: 30px; + transition: all 0.3s ease; + animation: colored-gradient 10s ease infinite; + } + + /* #workspaces button.focused:hover, + #workspaces button.active:hover { + background-color: #${palette.base09}; + transition: all 1s ease; + } */ + + #workspaces button.urgent { + background-color: #${palette.base0F}; + color: #${palette.base00}; + transition: all 0.3s ease; + } + + /* #workspaces button.hidden {} */ + + #taskbar { + border-radius: 8px; + margin-top: 4px; + margin-bottom: 4px; + margin-left: 1px; + margin-right: 1px; + } + + #taskbar button { + color: #${palette.base05}; + padding: 1px 8px; + margin-left: 1px; + margin-right: 1px; + } + + #taskbar button:hover { + background: transparent; + border: 1px solid #${palette.base02}; + border-radius: 8px; + transition: all 0.3s ease; + animation: colored-gradient 10s ease infinite; + } + + /* #taskbar button.maximized {} */ + + /* #taskbar button.minimized {} */ + + #taskbar button.active { + border: 1px solid #${palette.base02}; + border-radius: 8px; + transition: all 0.3s ease; + animation: colored-gradient 10s ease infinite; + } + + /* #taskbar button.fullscreen {} */ + + /* -------------------------------------------------------------------------------- */ + + #custom-launcher, + /* #window, */ + #submap + #mode, + /* #tray, */ + #cpu, + #memory, + #backlight, + #window { background-color: #${palette.base02}; } + #pulseaudio.audio { background-color: #${palette.base02}; } + #pulseaudio.microphone, + #network { background-color: #${palette.base02}; } + #bluetooth { background-color: #${palette.base02}; } + #battery { background-color: #${palette.base02}; } + #clock { background-color: #${palette.base02}; } + #custom-powermenu, + + #custom-notification { + background-color: transparent; + color: #${palette.base05}; + padding: 1px 8px; + margin-top: 5px; + margin-bottom: 5px; + margin-left: 2px; + margin-right: 2px; + border-radius: 20px; + transition: all 0.3s ease; + } + + #submap { + background-color: #${palette.base00}; + border: 0; + } + + /* If workspaces is the leftmost module, omit left margin */ + /* .modules-left > widget:first-child > #workspaces, */ + .modules-left > widget:first-child > #workspaces button, + .modules-left > widget:first-child > #taskbar button, + .modules-left > widget:first-child > #custom-launcher, + .modules-left > widget:first-child > #window, + .modules-left > widget:first-child > #tray, + .modules-left > widget:first-child > #cpu, + .modules-left > widget:first-child > #memory, + .modules-left > widget:first-child > #backlight, + .modules-left > widget:first-child > #pulseaudio.audio, + .modules-left > widget:first-child > #pulseaudio.microphone, + .modules-left > widget:first-child > #network, + .modules-left > widget:first-child > #bluetooth, + .modules-left > widget:first-child > #battery, + .modules-left > widget:first-child > #clock, + .modules-left > widget:first-child > #custom-powermenu, + .modules-left > widget:first-child > #custom-notification { + margin-left: 5px; + } + + /* If workspaces is the rightmost module, omit right margin */ + /* .modules-right > widget:last-child > #workspaces, */ + /* .modules-right > widget:last-child > #workspaces, */ + .modules-right > widget:last-child > #workspaces button, + .modules-right > widget:last-child > #taskbar button, + .modules-right > widget:last-child > #custom-launcher, + .modules-right > widget:last-child > #window, + .modules-right > widget:last-child > #tray, + .modules-right > widget:last-child > #cpu, + .modules-right > widget:last-child > #memory, + .modules-right > widget:last-child > #backlight, + .modules-right > widget:last-child > #pulseaudio.audio, + .modules-right > widget:last-child > #pulseaudio.microphone, + .modules-right > widget:last-child > #network, + .modules-right > widget:last-child > #bluetooth, + .modules-right > widget:last-child > #battery, + .modules-right > widget:last-child > #clock, + .modules-right > widget:last-child > #custom-powermenu, + .modules-right > widget:last-child > #custom-notification { + margin-right: 5px; + } + + /* -------------------------------------------------------------------------------- */ + + #tray { + background-color: #${palette.base00}; + padding: 1px 8px; + } + #tray > .passive { + -gtk-icon-effect: dim; + } + #tray > .needs-attention { + -gtk-icon-effect: highlight; + background-color: #${palette.base0F}; + } + ''; +}