From a0cc623c4b914bb0af70b78cc4f62a64cf8680e4 Mon Sep 17 00:00:00 2001 From: Jimbo Date: Sun, 8 Dec 2024 06:41:06 -0500 Subject: [PATCH] Add Hyprland, attempt generalization --- flake.nix | 1 - hosts/extern/default.nix | 2 + hosts/extern/users/default.nix | 4 + hosts/extern/users/jimbo/default.nix | 6 + hosts/jupiter/boot/default.nix | 44 ----- hosts/jupiter/default.nix | 16 -- hosts/jupiter/disko/default.nix | 97 ---------- hosts/jupiter/filesystems/default.nix | 11 -- hosts/jupiter/hardware/default.nix | 17 -- hosts/jupiter/wireguard/default.nix | 23 --- hosts/tower/default.nix | 2 - hosts/tower/users/jimbo/default.nix | 4 +- modules/home/default.nix | 1 + modules/home/programs/gui/default.nix | 1 - modules/home/programs/gui/rofi/default.nix | 1 - modules/home/programs/gui/swappy/default.nix | 11 -- .../home/programs/misc/headless/default.nix | 1 + .../home/programs/terminal/zsh/default.nix | 19 +- modules/home/user/default.nix | 1 + modules/home/wms/default.nix | 1 + .../home/wms/hyprland/autostart/default.nix | 26 +++ modules/home/wms/hyprland/default.nix | 18 ++ modules/home/wms/hyprland/hotkeys/README.md | 84 +++++++++ modules/home/wms/hyprland/hotkeys/default.nix | 166 ++++++++++++++++++ modules/home/wms/hyprland/inputs/default.nix | 16 ++ modules/home/wms/hyprland/outputs/default.nix | 36 ++++ modules/home/wms/hyprland/plugins/default.nix | 22 +++ .../home/wms/hyprland/programs/default.nix | 5 + modules/home/wms/hyprland/rules/default.nix | 37 ++++ modules/home/wms/hyprland/theme/default.nix | 51 ++++++ modules/home/wms/niri/autostart/default.nix | 9 +- modules/home/wms/niri/hotkeys/default.nix | 6 +- modules/home/wms/programs/default.nix | 4 +- .../wms/programs/mako/makotoggle/default.nix | 4 +- modules/home/wms/programs/waybar/default.nix | 30 +++- modules/home/wms/sway/autostart/default.nix | 7 +- modules/home/wms/sway/default.nix | 6 - modules/home/wms/sway/hotkeys/default.nix | 24 +-- modules/home/wms/sway/programs/default.nix | 3 +- .../wms/sway/programs/prop-sway/default.nix | 13 ++ .../wms/sway/programs/screen-sway/default.nix | 44 ----- .../wms/sway/programs/tools-sway/default.nix | 33 ---- modules/home/wms/sway/rules/default.nix | 1 - modules/home/wms/sway/theme/default.nix | 2 +- .../system/accounts/groups/admin/default.nix | 6 + modules/system/accounts/groups/default.nix | 1 + modules/system/accounts/users/default.nix | 5 +- .../system/accounts/users/jimbo/default.nix | 2 +- .../disks/impermanence/jimbo/default.nix | 2 +- modules/system/programs/desktops/default.nix | 3 +- modules/system/programs/security/default.nix | 2 +- .../system/programs/security/doas/default.nix | 16 -- .../programs/security/privilege/default.nix | 31 ++++ .../programs/security/privilege/default.nix~ | 31 ++++ .../general/displaymanager/default.nix | 5 + .../general/displaymanager/uwsm/default.nix | 0 .../services/general/portals/default.nix | 5 +- 57 files changed, 634 insertions(+), 385 deletions(-) create mode 100644 hosts/extern/users/default.nix create mode 100644 hosts/extern/users/jimbo/default.nix delete mode 100644 hosts/jupiter/boot/default.nix delete mode 100644 hosts/jupiter/default.nix delete mode 100644 hosts/jupiter/disko/default.nix delete mode 100644 hosts/jupiter/filesystems/default.nix delete mode 100644 hosts/jupiter/hardware/default.nix delete mode 100644 hosts/jupiter/wireguard/default.nix delete mode 100644 modules/home/programs/gui/swappy/default.nix create mode 100644 modules/home/wms/hyprland/autostart/default.nix create mode 100644 modules/home/wms/hyprland/default.nix create mode 100644 modules/home/wms/hyprland/hotkeys/README.md create mode 100644 modules/home/wms/hyprland/hotkeys/default.nix create mode 100644 modules/home/wms/hyprland/inputs/default.nix create mode 100644 modules/home/wms/hyprland/outputs/default.nix create mode 100644 modules/home/wms/hyprland/plugins/default.nix create mode 100644 modules/home/wms/hyprland/programs/default.nix create mode 100644 modules/home/wms/hyprland/rules/default.nix create mode 100644 modules/home/wms/hyprland/theme/default.nix create mode 100644 modules/home/wms/sway/programs/prop-sway/default.nix delete mode 100644 modules/home/wms/sway/programs/screen-sway/default.nix delete mode 100644 modules/home/wms/sway/programs/tools-sway/default.nix create mode 100644 modules/system/accounts/groups/admin/default.nix delete mode 100644 modules/system/programs/security/doas/default.nix create mode 100644 modules/system/programs/security/privilege/default.nix create mode 100644 modules/system/programs/security/privilege/default.nix~ create mode 100755 modules/system/services/general/displaymanager/uwsm/default.nix diff --git a/flake.nix b/flake.nix index b544c8c..fbbb7dc 100644 --- a/flake.nix +++ b/flake.nix @@ -75,7 +75,6 @@ nixosConfigurations = { tower = mkNix [ ./hosts/tower ]; # Main Desktop - jupiter = mkNix [ ./hosts/jupiter ]; # Steam Deck axolotl = mkNix [ ./hosts/axolotl ]; # PineBook Pro lacros = mkNix [ ./hosts/lacros ]; # Dell Chromebook redmond = mkNix [ ./hosts/redmond ]; # Lenovo Dual-Boot Laptop diff --git a/hosts/extern/default.nix b/hosts/extern/default.nix index a09fb4b..6e236f6 100644 --- a/hosts/extern/default.nix +++ b/hosts/extern/default.nix @@ -6,11 +6,13 @@ ./filesystems ./hardware ./modules + ./users ../../modules/system ]; system.wireguard.client.enable = true; networking.wireguard.interfaces.wgc.ips = [ "10.100.0.21/24" ]; + system.stateVersion = "24.11"; networking.hostName = "extern"; } diff --git a/hosts/extern/users/default.nix b/hosts/extern/users/default.nix new file mode 100644 index 0000000..a0f4778 --- /dev/null +++ b/hosts/extern/users/default.nix @@ -0,0 +1,4 @@ +{ ... }: +{ + imports = [ ./jimbo ]; +} diff --git a/hosts/extern/users/jimbo/default.nix b/hosts/extern/users/jimbo/default.nix new file mode 100644 index 0000000..e39c27e --- /dev/null +++ b/hosts/extern/users/jimbo/default.nix @@ -0,0 +1,6 @@ +{ ... }: +{ + home-manager.users.jimbo = { + home.stateVersion = "24.11"; + }; +} diff --git a/hosts/jupiter/boot/default.nix b/hosts/jupiter/boot/default.nix deleted file mode 100644 index 7a227d6..0000000 --- a/hosts/jupiter/boot/default.nix +++ /dev/null @@ -1,44 +0,0 @@ -{ config, pkgs, ... }: -{ - boot = { - kernelPackages = pkgs.unstable.linuxPackages_latest; - kernel.sysctl."vm.max_map_count" = 2147483642; - kernelParams = [ - "amd_iommu=on" - "iommu=pt" - "nested=1" - "transparent_hugepage=never" - ]; - - initrd.systemd = { - enable = true; - services.root-reset = { - description = "Reset root and snapshot last boot"; - wantedBy = [ "initrd.target" ]; - before = [ "sysroot.mount" ]; - after = [ "dev-${config.networking.hostName}-root.device" ]; - unitConfig.DefaultDependencies = "no"; - serviceConfig.Type = "oneshot"; - script = '' - mkdir -p /mnt - mount /dev/${config.networking.hostName}/root /mnt - - if [[ -e /mnt/prev ]]; then - btrfs subvolume delete /mnt/prev - fi - - btrfs subvolume snapshot /mnt/root /mnt/prev - - btrfs subvolume list -o /mnt/root | cut -f9 -d' ' | while read subvolume; do - btrfs subvolume delete "/mnt/$subvolume" - done - - btrfs subvolume delete /mnt/root - btrfs subvolume create /mnt/root - - umount /mnt - ''; - }; - }; - }; -} diff --git a/hosts/jupiter/default.nix b/hosts/jupiter/default.nix deleted file mode 100644 index 5be5666..0000000 --- a/hosts/jupiter/default.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ ... }: -{ - imports = [ - ./boot - ./disko - ./filesystems - ./hardware - ./wireguard - ../../modules/system - ]; - - system.lanzaboote.enable = true; - system.libvirtd.enable = true; - - networking.hostName = "jupiter"; -} diff --git a/hosts/jupiter/disko/default.nix b/hosts/jupiter/disko/default.nix deleted file mode 100644 index 6c6c98d..0000000 --- a/hosts/jupiter/disko/default.nix +++ /dev/null @@ -1,97 +0,0 @@ -{ disko, config, ... }: -{ - imports = [ disko.nixosModules.disko ]; - - disko.devices = { - disk = { - "${config.networking.hostName}" = { - type = "disk"; - device = "/dev/nvme0n1"; - content = { - type = "gpt"; - partitions = { - ESP = { - priority = 1; - size = "2G"; - type = "EF00"; - content = { - type = "filesystem"; - format = "vfat"; - mountpoint = "/boot"; - mountOptions = [ "umask=0077" ]; - }; - }; - luks = { - size = "100%"; - content = { - type = "luks"; - name = "${config.networking.hostName}-disk"; - settings.allowDiscards = true; - passwordFile = "/tmp/secret.key"; - content = { - type = "lvm_pv"; - vg = "${config.networking.hostName}"; - }; - }; - }; - }; - }; - }; - }; - - lvm_vg = { - "${config.networking.hostName}" = { - type = "lvm_vg"; - lvs = { - root = { - size = "100%"; - content = { - type = "btrfs"; - extraArgs = [ "-f" ]; - subvolumes = { - "/root" = { - mountpoint = "/"; - mountOptions = [ "compress=zstd" "noatime" "ssd" ]; - }; - "/prev" = { - mountpoint = "/prev"; - mountOptions = [ "compress=zstd" "noatime" "ssd" ]; - }; - "/nix" = { - mountpoint = "/nix"; - mountOptions = [ "compress=zstd" "noatime" "ssd" ]; - }; - - # Impermanence - "/persist" = { - mountpoint = "/persist"; - mountOptions = [ "compress=zstd" "noatime" "ssd" ]; - }; - "/persist/.snapshots" = { }; - - "/jimbo" = { - mountpoint = "/persist/home/jimbo"; - mountOptions = [ "compress=zstd" "noatime" "ssd" ]; - }; - "/jimbo/.snapshots" = { }; - }; - }; - }; - swap = { - size = "8G"; - content = { - type = "swap"; - discardPolicy = "both"; - }; - }; - }; - }; - }; - }; - - # Needed for impermanence - fileSystems = { - "/persist".neededForBoot = true; - "/persist/home/jimbo".neededForBoot = true; - }; -} diff --git a/hosts/jupiter/filesystems/default.nix b/hosts/jupiter/filesystems/default.nix deleted file mode 100644 index 2ac554d..0000000 --- a/hosts/jupiter/filesystems/default.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ ... }: -{ - fileSystems = { - # Remote - "/home/jimbo/JimboNFS" = { - device = "10.100.0.1:/export/JimboNFS"; - fsType = "nfs4"; - options = [ "x-systemd.automount" "_netdev" "nofail" "noauto" ]; - }; - }; -} diff --git a/hosts/jupiter/hardware/default.nix b/hosts/jupiter/hardware/default.nix deleted file mode 100644 index 6d0e066..0000000 --- a/hosts/jupiter/hardware/default.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ config, lib, ... }: - -{ - boot.initrd.availableKernelModules = [ - "nvme" - "xhci_pci" - "usb_storage" - "usbhid" - "sd_mod" - "sdhci_pci" - ]; - boot.kernelModules = [ "kvm-amd" ]; - - networking.useDHCP = lib.mkDefault true; - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; -} diff --git a/hosts/jupiter/wireguard/default.nix b/hosts/jupiter/wireguard/default.nix deleted file mode 100644 index 7ca7ad5..0000000 --- a/hosts/jupiter/wireguard/default.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ lib, config, ... }: -{ - networking = { - firewall = { - allowedUDPPorts = [ 51820 ]; - trustedInterfaces = [ "wgc" ]; - }; - - wireguard.interfaces.wgc = { - ips = [ "10.100.0.21/24" ]; - listenPort = 51820; - privateKey = config.secrets.wgClientPriv; - peers = [ - { # Cyberspark Server - publicKey = "qnOT/lXOJMaQgDUdXpyfGZB2IEyUouRje2m/bCe9ux8="; - allowedIPs = [ "10.100.0.0/24" ]; - endpoint = "sv.${config.domains.jim1}:51820"; - persistentKeepalive = 25; - } - ]; - }; - }; -} diff --git a/hosts/tower/default.nix b/hosts/tower/default.nix index 9e61861..46965f7 100644 --- a/hosts/tower/default.nix +++ b/hosts/tower/default.nix @@ -15,8 +15,6 @@ system.video.nvidia.enable = true; system.libvirtd.enable = true; - environment.sessionVariables.NIXOS_OZONE_WL = "1"; - networking.hostName = "tower"; system.stateVersion = "24.05"; } diff --git a/hosts/tower/users/jimbo/default.nix b/hosts/tower/users/jimbo/default.nix index dc383bc..76f5a16 100644 --- a/hosts/tower/users/jimbo/default.nix +++ b/hosts/tower/users/jimbo/default.nix @@ -1,6 +1,6 @@ -{ ... }: +{ lib, ... }: { home-manager.users.jimbo = { - home.stateVersion = "24.05"; + home.stateVersion = lib.mkForce "24.05"; }; } diff --git a/modules/home/default.nix b/modules/home/default.nix index 143c4e1..951e849 100644 --- a/modules/home/default.nix +++ b/modules/home/default.nix @@ -15,4 +15,5 @@ ]; nixpkgs.config.allowUnfree = true; + home.stateVersion = "24.11"; } diff --git a/modules/home/programs/gui/default.nix b/modules/home/programs/gui/default.nix index 06dc69f..8376689 100644 --- a/modules/home/programs/gui/default.nix +++ b/modules/home/programs/gui/default.nix @@ -9,7 +9,6 @@ ./mpv ./pcmanfm ./rofi - ./swappy ./thunderbird ]; } diff --git a/modules/home/programs/gui/rofi/default.nix b/modules/home/programs/gui/rofi/default.nix index 4cda37a..1828492 100644 --- a/modules/home/programs/gui/rofi/default.nix +++ b/modules/home/programs/gui/rofi/default.nix @@ -133,7 +133,6 @@ Btop) foot -a btop -T Btop btop;; Music) foot -a music -T Music ncmpcpp;; Sound) foot -a sound -T Sound pulsemixer;; - EasyEffects) easyeffects;; esac } diff --git a/modules/home/programs/gui/swappy/default.nix b/modules/home/programs/gui/swappy/default.nix deleted file mode 100644 index e343544..0000000 --- a/modules/home/programs/gui/swappy/default.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ pkgs, ... }: -{ - home = { - packages = with pkgs; [ swappy ]; - file.".config/swappy/config".text = '' - [Default] - early_exit=true - save_dir=$HOME/Pictures/Screenshots - ''; - }; -} diff --git a/modules/home/programs/misc/headless/default.nix b/modules/home/programs/misc/headless/default.nix index 9349e1e..1bc356c 100644 --- a/modules/home/programs/misc/headless/default.nix +++ b/modules/home/programs/misc/headless/default.nix @@ -4,5 +4,6 @@ p7zip vimv dua + trash-cli ]; } diff --git a/modules/home/programs/terminal/zsh/default.nix b/modules/home/programs/terminal/zsh/default.nix index 57455cb..5f25883 100644 --- a/modules/home/programs/terminal/zsh/default.nix +++ b/modules/home/programs/terminal/zsh/default.nix @@ -10,27 +10,28 @@ plugins = [ "git" ]; }; shellAliases = { - # NixOS aliases - flakedate = "doas nix flake update --flake /etc/nixos"; - nhs = "doas nh os switch -R"; + # NixOS + flakedate = "sudo nix flake update --flake /etc/nixos"; + nhs = "sudo nh os switch -R /etc/nixos"; nhu = "flakedate && nhs"; ns = "nix-shell -p"; - nixclean = "doas nix-store --gc; nix-collect-garbage -d"; - nixpurge = "doas nix-collect-garbage --delete-old"; - nixoptimize = "doas nix store optimise"; + nixclean = "sudo nix-store --gc; nix-collect-garbage -d"; + nixpurge = "sudo nix-collect-garbage --delete-old"; + nixoptimize = "sudo nix store optimise"; nixscrub = "nixclean; nixpurge; nixoptimize"; - # Shortcut aliases + # Shortcuts ff = "clear && fastfetch"; ip = "ip -c"; ls = "${pkgs.eza}/bin/eza -a --color=always --group-directories-first --icons"; - nls = "/usr/bin/env ls"; cat = "${pkgs.bat}/bin/bat --paging never"; - ncat = "/usr/bin/env cat"; copycat = "wl-copy <"; myip = "curl ifconfig.co"; seneca = "ssh jhampton1@matrix.senecapolytechnic.ca"; + + # Deny + rm = ''echo "Use trash."; false''; }; initExtra = '' ${pkgs.any-nix-shell}/bin/any-nix-shell zsh --info-right | source /dev/stdin; pfetch diff --git a/modules/home/user/default.nix b/modules/home/user/default.nix index 8ad3bad..ceae3d9 100644 --- a/modules/home/user/default.nix +++ b/modules/home/user/default.nix @@ -10,6 +10,7 @@ HISTCONTROL = "ignoreboth"; QT_QPA_PLATFORMTHEME = "gtk3"; NIXPKGS_ALLOW_UNFREE = 1; + NIXOS_OZONE_WL = 1; }; }; } diff --git a/modules/home/wms/default.nix b/modules/home/wms/default.nix index a137fc5..e202772 100644 --- a/modules/home/wms/default.nix +++ b/modules/home/wms/default.nix @@ -1,6 +1,7 @@ { ... }: { imports = [ + ./hyprland ./niri ./programs ./sway diff --git a/modules/home/wms/hyprland/autostart/default.nix b/modules/home/wms/hyprland/autostart/default.nix new file mode 100644 index 0000000..75aaaf6 --- /dev/null +++ b/modules/home/wms/hyprland/autostart/default.nix @@ -0,0 +1,26 @@ +{ pkgs, ... }: +{ + wayland.windowManager.hyprland.settings.exec-once = [ + "waybar" + + # Scratchpads + "foot -a btop -T Gotop btop" + "foot -a music -T Music ncmpcpp" + "foot -a sound -T Sound pulsemixer" + + # Deamons and tray + "hyprpaper" + "wl-paste -t text --watch clipman store -P" + "wl-copy" + "mako" + "sunshine" + "${pkgs.mate.mate-polkit}/libexec/polkit-mate-authentication-agent-1" + + # Foreground + "librewolf -P Misc --name=MiscBrowser" + "thunderbird" + "vesktop" + "fractal" + "telegram-desktop" + ]; +} diff --git a/modules/home/wms/hyprland/default.nix b/modules/home/wms/hyprland/default.nix new file mode 100644 index 0000000..f3e063f --- /dev/null +++ b/modules/home/wms/hyprland/default.nix @@ -0,0 +1,18 @@ +{ config, pkgs, ... }: +{ + imports = [ + ./autostart + ./hotkeys + ./inputs + ./outputs + ./plugins + ./programs + ./rules + ./theme + ]; + + wayland.windowManager.hyprland = { + enable = true; + plugins = with pkgs.hyprlandPlugins; [ hy3 ]; + }; +} diff --git a/modules/home/wms/hyprland/hotkeys/README.md b/modules/home/wms/hyprland/hotkeys/README.md new file mode 100644 index 0000000..e81f67b --- /dev/null +++ b/modules/home/wms/hyprland/hotkeys/README.md @@ -0,0 +1,84 @@ +# Sway Window Manager Hotkeys + +## Application Launchers +| Key Combination | Action | +|----------------------|-------------------------------------------| +| Win + F1 | Launch **LibreWolf** (Jim profile) | +| Win + F2 | Launch **LibreWolf** (Alt profile) | +| Win + F3 | Launch **LibreWolf** (Misc profile) | +| Win + F4 | Launch **Discord** | +| Win + F5 | Launch **Steam** | +| Win + F6 | Launch **Heroic Games** | +| Win + F7 | Launch **Looking Glass** VM Client | +| Win + F10 | Launch **Virt-Manager** | +| Win + F11 | Open **Rofi Scratchpads** | +| Win + F12 | Open **NixOS Configuration Files** | + +## Window Management +| Key Combination | Action | +|----------------------|-------------------------------------------| +| Win + Arrows | Focus in the specified direction | +| Win + Shift + Arrows | Move window in the specified direction | +| Win + Shift + Space | Toggle window floating | +| Win + Space | Switch focus between floating/tiled | +| Win + Shift + {1-9} | Move window to a workspace and focus | +| Win + {1-9} | Switch to specified workspace | +| Win + 0 | Pin window and toggle border | +| Win + F | Toggle fullscreen | +| Win + Shift + R | Reload configuration | +| Win + Q | Close the current window | + +## Layout Management +| Key Combination | Action | +|----------------------|-------------------------------------------| +| Win + W | Toggle split layout | +| Win + E | Toggle tabbed/stacking layout | +| Win + H/V | Split window horizontally/vertically | +| Win + A/D | Focus parent/child container | + +## Volume and Media Controls +| Key Combination | Action | +|----------------------|-------------------------------------------| +| XF86AudioRaiseVolume | Raise system volume | +| XF86AudioLowerVolume | Lower system volume | +| XF86AudioMute | Mute/unmute audio | +| XF86AudioPlay | Toggle media playback | +| XF86AudioNext | Skip to the next track | +| XF86AudioPrev | Go to the previous track | + +## Screenshot and Brightness Controls +| Key Combination | Action | +|----------------------|-------------------------------------------| +| Print | Take a screenshot | +| Shift + Print | Screenshot of the current window | +| Brightness Up + Down | Change screen brightness | + +## Scratchpads +| Key Combination | Action | +|----------------------|-------------------------------------------| +| Ctrl + Shift + Escape | Open **Gotop** (monitoring) | +| Win + Shift + M | Open **Music** scratchpad | +| Win + Shift + V | Open **Sound Settings** scratchpad | +| Win + Shift + Backslash | Open **EasyEffects** scratchpad | + +## Special Sway Tools +| Key Combination | Action | +|----------------------|-------------------------------------------| +| Win + Escape | **Kill** selected window | +| Win + Ctrl + X | **Inspect** window properties | +| Win + Ctrl + Prior/Next | Switch OBS scene to **Main**/**Guest** | + +## Miscellaneous +| Key Combination | Action | +|----------------------|-------------------------------------------| +| Win + Return | Open **Foot terminal** | +| Win + S | Open **Rofi (run commands)** | +| Win + C | Open **Clipman (clipboard manager)** | +| Win + X | Open **Power Menu** | +| Win + B | Show/Hide **Waybar** | + +## Workspaces (Alternate) +| Key Combination | Action | +|----------------------|-------------------------------------------| +| Alt + F1-F9 | Switch to alternate workspace | +| Alt + Shift + F1-F9 | Move window to alt workspace and focus | diff --git a/modules/home/wms/hyprland/hotkeys/default.nix b/modules/home/wms/hyprland/hotkeys/default.nix new file mode 100644 index 0000000..ddbe8b5 --- /dev/null +++ b/modules/home/wms/hyprland/hotkeys/default.nix @@ -0,0 +1,166 @@ +{ pkgs, config, ... }: +{ + wayland.windowManager.hyprland.settings = let + # Set default modifier and variables + primeMod = "Super"; + secMod = "Alt"; + resizeAmount = "55"; + in { + bind = [ + ## Launchers + + # Browser + ''${primeMod}, F1, exec, librewolf -p Main --name MainBrowser | notify-send "Main Browser"'' + ''${primeMod}, F2, exec, librewolf -p Alt --name AltBrowser | notify-send "Alternate Browser"'' + ''${primeMod}, F3, exec, librewolf -p Misc --name MiscBrowser | notify-send "Miscellaneous Browser"'' + + # Virtual machines + ''${primeMod}, F4, exec, virt-manager | notify-send "Virtual Machines"'' + ''${primeMod}, F5, exec, looking-glass-client input:rawMouse=yes | notify-send "Looking Glass"'' + + # Prime + key + "${primeMod}, s, exec, rofi -show run -p Command" + "${primeMod}, c, exec, clipman pick -t rofi" + "${primeMod}, x, exec, rofiscripts --power" + "${primeMod}, b, exec, pkill -USR1 waybar" + "${primeMod}, Return, exec, foot" + + # Prime + shift + key + "${primeMod} Shift, s, exec, rofi -show drun -modi drun -drun-display-format {name} -show-icons -disable-history" + "${primeMod} Shift, t, exec, pcmanfm" + "${primeMod} Shift, e, exec, bemoji -n -P 0" + "${primeMod} Shift, b, exec, rofi-bluetooth" + "${primeMod} Shift, Return, exec, foot ranger" + + # Prime + ctrl + key + "${primeMod} Ctrl, s, exec, rofiscripts --scratchpads" + ''${primeMod} Ctrl, c, exec, wlpicker && notify-send "Color copied to clipboard"'' + + ## Media + + # Volume + "${secMod}, j, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-" + "${secMod}, k, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+" + + # MPD + "${primeMod}, Backslash, exec, mpc toggle" + "${secMod} Shift, h, exec, mpc prev" + "${secMod} Shift, j, exec, mpc volume -3" + "${secMod} Shift, k, exec, mpc volume +3" + "${secMod} Shift, l, exec, mpc next" + + ## Miscellaneous + + # Notifications + "${primeMod}, n, exec, makotoggle" + "${primeMod} Shift, n, exec, makoctl restore" + "${primeMod} Ctrl, n, exec, makoctl dismiss -a" + + # Screenshots + ''${secMod}, f, exec, XDG_SCREENSHOTS_DIR="$HOME/Pictures/Screenshots" SLURP_ARGS="-w 3 -c 3823C4 -B 00000066 -b 00000099" grimblast --freeze --notify copysave area'' + "${secMod} Shift, f, exec, grimblast --notify copysave output" + "${secMod} Ctrl, f, exec, grimblast --notify copysave active" + + # Screenshots + + # Display and keyboard brightness + "${primeMod}, equal, exec, light -A 5" + "${primeMod}, minus, exec, light -U 5" + "${primeMod} Shift, equal, exec, light -A 1" + "${primeMod} Shift, minus, exec, light -U 1" + ",XF86KbdBrightnessUp, exec, light -s sysfs/leds/smc::kbd_backlight -A 5" + ",XF86KbdBrightnessDown, exec, light -s sysfs/leds/smc::kbd_backlight -U 5" + + ## Window manager + "${primeMod}, q, killactive," + + # Switch to workspaces + "${primeMod}, grave, workspace, name:0" + "${primeMod}, 1, workspace, name:${config.ws.w1}" + "${primeMod}, 2, workspace, name:${config.ws.w2}" + "${primeMod}, 3, workspace, name:${config.ws.w3}" + "${primeMod}, 4, workspace, name:${config.ws.w4}" + "${primeMod}, 5, workspace, name:${config.ws.w5}" + "${primeMod}, 6, workspace, name:${config.ws.w6}" + "${primeMod}, 7, workspace, name:${config.ws.w7}" + "${primeMod}, 8, workspace, name:${config.ws.w8}" + "${primeMod}, 9, workspace, name:${config.ws.w9}" + + # Switch to alternate workspaces + "${secMod}, F1, workspace, name:${config.ws.w1a}" + "${secMod}, F2, workspace, name:${config.ws.w2a}" + "${secMod}, F3, workspace, name:${config.ws.w3a}" + "${secMod}, F4, workspace, name:${config.ws.w4a}" + "${secMod}, F5, workspace, name:${config.ws.w5a}" + "${secMod}, F6, workspace, name:${config.ws.w6a}" + "${secMod}, F7, workspace, name:${config.ws.w7a}" + "${secMod}, F8, workspace, name:${config.ws.w8a}" + "${secMod}, F9, workspace, name:${config.ws.w9a}" + + # Move window to and focus workspace + "${primeMod} Shift, grave, movetoworkspace, name:${config.ws.w0}" + "${primeMod} Shift, 1, movetoworkspace, name:${config.ws.w1}" + "${primeMod} Shift, 2, movetoworkspace, name:${config.ws.w2}" + "${primeMod} Shift, 3, movetoworkspace, name:${config.ws.w3}" + "${primeMod} Shift, 4, movetoworkspace, name:${config.ws.w4}" + "${primeMod} Shift, 5, movetoworkspace, name:${config.ws.w5}" + "${primeMod} Shift, 6, movetoworkspace, name:${config.ws.w6}" + "${primeMod} Shift, 7, movetoworkspace, name:${config.ws.w7}" + "${primeMod} Shift, 8, movetoworkspace, name:${config.ws.w8}" + "${primeMod} Shift, 9, movetoworkspace, name:${config.ws.w9}" + + # Move window to and focus alternate workspace + "${secMod} Shift, F1, movetoworkspace, name:${config.ws.w1a}" + "${secMod} Shift, F2, movetoworkspace, name:${config.ws.w2a}" + "${secMod} Shift, F3, movetoworkspace, name:${config.ws.w3a}" + "${secMod} Shift, F4, movetoworkspace, name:${config.ws.w4a}" + "${secMod} Shift, F5, movetoworkspace, name:${config.ws.w5a}" + "${secMod} Shift, F6, movetoworkspace, name:${config.ws.w6a}" + "${secMod} Shift, F7, movetoworkspace, name:${config.ws.w7a}" + "${secMod} Shift, F8, movetoworkspace, name:${config.ws.w8a}" + "${secMod} Shift, F9, movetoworkspace, name:${config.ws.w9a}" + + # Change focused window + "${primeMod}, h, hy3:movefocus, l" + "${primeMod}, j, hy3:movefocus, d" + "${primeMod}, k, hy3:movefocus, u" + "${primeMod}, l, hy3:movefocus, r" + + # Move focused window + "${primeMod} Shift, h, hy3:movewindow, l" + "${primeMod} Shift, j, hy3:movewindow, d" + "${primeMod} Shift, k, hy3:movewindow, u" + "${primeMod} Shift, l, hy3:movewindow, r" + + # Resize window + "${primeMod} ${secMod}, h, resizeactive, -${resizeAmount} 0" + "${primeMod} ${secMod}, j, resizeactive, 0 -${resizeAmount}" + "${primeMod} ${secMod}, k, resizeactive, 0 ${resizeAmount}" + "${primeMod} ${secMod}, l, resizeactive, ${resizeAmount} 0" + + # Floating + "${primeMod}, Space, hy3:togglefocuslayer" + "${primeMod} Shift, Space, togglefloating" + + # Change layout + "${primeMod}, f, fullscreen" + "${primeMod}, w, hy3:changegroup, opposite" + "${primeMod}, v, hy3:makegroup, v" + "${primeMod}, e, hy3:changegroup, toggletab" + + ## Scratchpads + "${primeMod} Shift, Backslash, togglespecialworkspace, btop" + "${primeMod} Shift, m, togglespecialworkspace, music" + "${primeMod} Shift, v, togglespecialworkspace, sound" + ]; + + # Mouse + bindm = [ + "${primeMod}, mouse:272, movewindow" + "${primeMod}, mouse:273, resizewindow" + ]; + bindn = [ + ",mouse:272, hy3:focustab, mouse" + ]; + }; +} diff --git a/modules/home/wms/hyprland/inputs/default.nix b/modules/home/wms/hyprland/inputs/default.nix new file mode 100644 index 0000000..c7140ff --- /dev/null +++ b/modules/home/wms/hyprland/inputs/default.nix @@ -0,0 +1,16 @@ +{ config, ... }: +{ + wayland.windowManager.hyprland.settings = { + input = { + follow_mouse = 1; + accel_profile = "flat"; + scroll_factor = 0.8; + touchpad.natural_scroll = false; + }; + gestures.workspace_swipe = false; + device = { + name = "sinowealth-game-mouse"; + sensitivity = "-0.9"; + }; + }; +} diff --git a/modules/home/wms/hyprland/outputs/default.nix b/modules/home/wms/hyprland/outputs/default.nix new file mode 100644 index 0000000..0c4937a --- /dev/null +++ b/modules/home/wms/hyprland/outputs/default.nix @@ -0,0 +1,36 @@ +{ config, ... }: +{ + # Monitors + wayland.windowManager.hyprland.settings = { + monitor = [ + "${config.displays.d1},1920x1080@143.980, 3840x405, 1" + "${config.displays.d2},1920x1080@60, 1920x405, 1" + "${config.displays.d3},1680x1050@59.883, 5760x0, 1, transform, 1" + "${config.displays.d4},1920x1080@60, 0x405, 1" + ]; + + workspace = [ + "name:${config.ws.w1}, monitor:${config.displays.d1}, default:true" + "name:${config.ws.w2}, monitor:${config.displays.d1}" + "name:${config.ws.w3}, monitor:${config.displays.d1}" + "name:${config.ws.w1a}, monitor:${config.displays.d1}" + "name:${config.ws.w2a}, monitor:${config.displays.d1}" + "name:${config.ws.w3a}, monitor:${config.displays.d1}" + + "name:${config.ws.w4}, monitor:${config.displays.d2}, default:true" + "name:${config.ws.w5}, monitor:${config.displays.d2}" + "name:${config.ws.w6}, monitor:${config.displays.d2}" + "name:${config.ws.w4a}, monitor:${config.displays.d2}" + "name:${config.ws.w5a}, monitor:${config.displays.d2}" + + "name:${config.ws.w7}, monitor:${config.displays.d3}, default:true" + "name:${config.ws.w8}, monitor:${config.displays.d3}" + "name:${config.ws.w9}, monitor:${config.displays.d3}" + "name:${config.ws.w7a}, monitor:${config.displays.d3}" + "name:${config.ws.w8a}, monitor:${config.displays.d3}" + + "name:${config.ws.w6a}, monitor:${config.displays.d4}, default:true" + "name:${config.ws.w9a}, monitor:${config.displays.d4}" + ]; + }; +} diff --git a/modules/home/wms/hyprland/plugins/default.nix b/modules/home/wms/hyprland/plugins/default.nix new file mode 100644 index 0000000..43f3bdc --- /dev/null +++ b/modules/home/wms/hyprland/plugins/default.nix @@ -0,0 +1,22 @@ +{ config, ... }: +{ + wayland.windowManager.hyprland.settings.plugin = { + hy3 = { + no_gaps_when_only = 0; + node_collapse_policy = 0; + group_inset = 5; + tabs = { + text_font = config.look.fonts.main; + text_height = 10; + height = 17; + padding = 0; + rounding = 0; + "col.active" = "rgba(${config.look.colors.prime}FF)"; + "col.inactive" = "rgba(${config.look.colors.split}FF)"; + "col.urgent" = "rgba(${config.look.colors.urgent}FF)"; + "col.text.active" = "rgba(${config.look.colors.text}FF)"; + "col.text.inactive" = "rgba(${config.look.colors.text}FF)"; + }; + }; + }; +} diff --git a/modules/home/wms/hyprland/programs/default.nix b/modules/home/wms/hyprland/programs/default.nix new file mode 100644 index 0000000..1527533 --- /dev/null +++ b/modules/home/wms/hyprland/programs/default.nix @@ -0,0 +1,5 @@ +{ pkgs, ... }: +{ + imports = [ + ]; +} diff --git a/modules/home/wms/hyprland/rules/default.nix b/modules/home/wms/hyprland/rules/default.nix new file mode 100644 index 0000000..0e26e53 --- /dev/null +++ b/modules/home/wms/hyprland/rules/default.nix @@ -0,0 +1,37 @@ +{ config, ... }: +{ + wayland.windowManager.hyprland.settings = { + windowrulev2 = [ + # Scratchpads + "workspace special:btop silent, class:^(btop)$" + "workspace special:music silent, class:^(music)$" + "workspace special:sound silent, class:^(sound)$" + + # Browsers + "workspace name:${config.ws.w1} silent, class:(MainBrowser)" + "workspace name:${config.ws.w1a} silent, class:(AltBrowser)" + + # Communication + "workspace name:${config.ws.w7} silent, class:(MiscBrowser)" + "workspace name:${config.ws.w7} silent, class:(vesktop)" + "workspace name:${config.ws.w8} silent, class:(org.gnome.Fractal)" + "workspace name:${config.ws.w8} silent, class:(org.telegram.desktop)" + "workspace name:${config.ws.w9} silent, class:(thunderbird)" + + # Etc + "workspace name:${config.ws.w2} silent, class:(steam)" + "workspace name:${config.ws.w2} silent, class:(heroic)" + "workspace name:${config.ws.w2a} silent, class:(looking-glass-client)" + "workspace name:${config.ws.w4a} silent, class:(com.obsproject.Studio)" + + # Borderless single window part 1 + "bordersize 0, floating:0, onworkspace:w[tv1]" + ]; + + # Borderless on single window part 2 + workspace = [ "w[tv1], gapsout:0, gapsin:0" ]; + + # Borderless screenshots + layerrule = "noanim, selection"; + }; +} diff --git a/modules/home/wms/hyprland/theme/default.nix b/modules/home/wms/hyprland/theme/default.nix new file mode 100644 index 0000000..82d0083 --- /dev/null +++ b/modules/home/wms/hyprland/theme/default.nix @@ -0,0 +1,51 @@ +{ config, ... }: +{ + wayland.windowManager.hyprland.settings = { + general = { + "col.active_border" = "rgba(${config.look.colors.prime}FF)"; + "col.inactive_border" = "rgba(${config.look.colors.split}FF)"; + gaps_in = 4; + gaps_out = 10; + border_size = config.look.border.string; + allow_tearing = true; + layout = "hy3"; + }; + + misc = { + disable_hyprland_logo = true; + font_family = config.look.fonts.main; + middle_click_paste = false; + vrr = 2; + }; + + decoration.blur.enabled = false; + + animations = { + bezier = [ + "easeOutQuint,0.23,1,0.32,1" + "easeInOutCubic,0.65,0.05,0.36,1" + "linear,0,0,1,1" + "almostLinear,0.5,0.5,0.75,1.0" + "quick,0.15,0,0.1,1" + ]; + animation = [ + "global, 1, 10, default" + "border, 1, 5.39, easeOutQuint" + "windows, 1, 4.79, easeOutQuint" + "windowsIn, 1, 4.1, easeOutQuint, popin 87%" + "windowsOut, 1, 1.49, linear, popin 87%" + "fadeIn, 1, 1.73, almostLinear" + "fadeOut, 1, 1.46, almostLinear" + "fade, 1, 3.03, quick" + "layers, 1, 3.81, easeOutQuint" + "layersIn, 1, 4, easeOutQuint, fade" + "layersOut, 1, 1.5, linear, fade" + "fadeLayersIn, 1, 1.79, almostLinear" + "fadeLayersOut, 1, 1.39, almostLinear" + "workspaces, 1, 1.94, almostLinear, fade" + "workspacesIn, 1, 1.21, almostLinear, fade" + "workspacesOut, 1, 1.94, almostLinear, fade" + ]; + }; + }; +} diff --git a/modules/home/wms/niri/autostart/default.nix b/modules/home/wms/niri/autostart/default.nix index f0e048a..38c8473 100644 --- a/modules/home/wms/niri/autostart/default.nix +++ b/modules/home/wms/niri/autostart/default.nix @@ -1,23 +1,22 @@ { pkgs, ... }: { config.home.niri.settings.autostart = pkgs.writeText "autostart" '' - // Everpresent bar spawn-at-startup "waybar" - // Daemons and tray apps + // Daemons and tray spawn-at-startup "hyprpaper" spawn-at-startup "wl-paste" "-t" "text" "--watch" "clipman" "store" "-P" spawn-at-startup "wl-copy" spawn-at-startup "mako" spawn-at-startup "sunshine" - spawn-at-startup "xwayland-satellite" spawn-at-startup "${pkgs.mate.mate-polkit}/libexec/polkit-mate-authentication-agent-1" + spawn-at-startup "${pkgs.xwayland-satellite}/bin/xwayland-satellite" - // Foreground apps + // Foreground spawn-at-startup "librewolf" "-p" "Misc" "--name" "MiscBrowser" + spawn-at-startup "thunderbird" spawn-at-startup "vesktop" spawn-at-startup "fractal" spawn-at-startup "telegram-desktop" - spawn-at-startup "thunderbird" ''; } diff --git a/modules/home/wms/niri/hotkeys/default.nix b/modules/home/wms/niri/hotkeys/default.nix index 4c974e4..b2a67e8 100644 --- a/modules/home/wms/niri/hotkeys/default.nix +++ b/modules/home/wms/niri/hotkeys/default.nix @@ -17,21 +17,21 @@ ${primeMod}+F4 { spawn "sh" "-c" "virt-manager | notify-send \"Virtual Machines\""; } ${primeMod}+F5 { spawn "sh" "-c" "looking-glass-client input:rawMouse=yes | notify-send \"Looking Glass\""; } - // ${primeMod} + key + // Prime + key ${primeMod}+s { spawn "sh" "-c" "rofi -show run -p Command"; } ${primeMod}+c { spawn "sh" "-c" "clipman pick -t rofi"; } ${primeMod}+x { spawn "sh" "-c" "rofiscripts --power"; } ${primeMod}+b { spawn "sh" "-c" "pkill -USR1 waybar"; } ${primeMod}+Return { spawn "sh" "-c" "foot"; } - // ${primeMod} + shift + key + // Prime + shift + key ${primeMod}+Shift+s { spawn "sh" "-c" "rofi -show drun -modi drun -drun-display-format {name} -show-icons -disable-history"; } ${primeMod}+Shift+t { spawn "sh" "-c" "pcmanfm"; } ${primeMod}+Shift+e { spawn "sh" "-c" "bemoji -n -P 0"; } ${primeMod}+Shift+b { spawn "sh" "-c" "rofi-bluetooth"; } ${primeMod}+Shift+Return { spawn "sh" "-c" "foot ranger"; } - // ${primeMod} + ctrl + key + // Prime + ctrl + key ${primeMod}+Ctrl+s { spawn "sh" "-c" "rofiscripts --scratchpads"; } ${primeMod}+Ctrl+c { spawn "sh" "-c" "wlpicker && notify-send \"Color copied to clipboard\""; } diff --git a/modules/home/wms/programs/default.nix b/modules/home/wms/programs/default.nix index 312bd4e..51d4e42 100644 --- a/modules/home/wms/programs/default.nix +++ b/modules/home/wms/programs/default.nix @@ -12,11 +12,9 @@ clipman hyprpicker libnotify - grim - slurp + grimblast wl-clipboard wdisplays - xwayland-satellite jq ]; } diff --git a/modules/home/wms/programs/mako/makotoggle/default.nix b/modules/home/wms/programs/mako/makotoggle/default.nix index 996f4dd..522a9ad 100644 --- a/modules/home/wms/programs/mako/makotoggle/default.nix +++ b/modules/home/wms/programs/mako/makotoggle/default.nix @@ -11,10 +11,10 @@ if [[ "$mode_line" == "do-not-disturb" ]]; then # Notifications are disabled, so we enable them makoctl mode -r do-not-disturb - notify-send --expire-time=1500 'Notifications Enabled' + notify-send 'Notifications Enabled' else # Notifications are enabled, so we disable them - notify-send --expire-time=1500 'Notifications Disabled' + notify-send 'Notifications Disabled' sleep 2 makoctl mode -a do-not-disturb fi diff --git a/modules/home/wms/programs/waybar/default.nix b/modules/home/wms/programs/waybar/default.nix index b34838d..4fa8827 100644 --- a/modules/home/wms/programs/waybar/default.nix +++ b/modules/home/wms/programs/waybar/default.nix @@ -9,7 +9,7 @@ disable-scroll-wraparound = true; }; - swayWindowsModule = { + windowModule = { icon = true; icon-size = 15; all-outputs = true; @@ -219,6 +219,8 @@ "sway/window" "niri/workspaces" "niri/window" + "hyprland/workspaces" + "hyprland/window" ]; modules-right = [ "pulseaudio" @@ -234,8 +236,9 @@ "network" ]; "sway/workspaces" = swayWorkspaceModule; - "sway/window" = swayWindowsModule; - "niri/window" = swayWindowsModule; + "sway/window" = windowModule; + "niri/window" = windowModule; + "hyprland/window" = windowModule; "pulseaudio" = pulseModule; "cpu" = cpuModule; "memory" = ramModule; @@ -259,6 +262,8 @@ "sway/window" "niri/workspaces" "niri/window" + "hyprland/workspaces" + "hyprland/window" ]; modules-right = [ "pulseaudio" @@ -270,8 +275,9 @@ "custom/clock-long" ]; "sway/workspaces" = swayWorkspaceModule; - "sway/window" = swayWindowsModule; - "niri/window" = swayWindowsModule; + "sway/window" = windowModule; + "niri/window" = windowModule; + "hyprland/window" = windowModule; "pulseaudio" = pulseModule; "mpd" = mediaModule; "custom/notifs" = notificationModule; @@ -291,6 +297,8 @@ "sway/window" "niri/workspaces" "niri/window" + "hyprland/workspaces" + "hyprland/window" ]; modules-right = [ "pulseaudio" @@ -301,8 +309,9 @@ "custom/clock-short" ]; "sway/workspaces" = swayWorkspaceModule; - "sway/window" = swayWindowsModule; - "niri/window" = swayWindowsModule; + "sway/window" = windowModule; + "niri/window" = windowModule; + "hyprland/window" = windowModule; "pulseaudio" = pulseModule; "custom/weather" = weatherModule; "cpu" = cpuModule; @@ -325,6 +334,8 @@ "sway/window" "niri/workspaces" "niri/window" + "hyprland/workspaces" + "hyprland/window" ]; modules-right = [ "pulseaudio" @@ -344,8 +355,9 @@ "network" ]; "sway/workspaces" = swayWorkspaceModule; - "sway/window" = swayWindowsModule; - "niri/window" = swayWindowsModule; + "sway/window" = windowModule; + "niri/window" = windowModule; + "hyprland/window" = windowModule; "pulseaudio" = pulseModule; "mpd" = mediaModule; "custom/notifs" = notificationModule; diff --git a/modules/home/wms/sway/autostart/default.nix b/modules/home/wms/sway/autostart/default.nix index becb8ad..4be1270 100644 --- a/modules/home/wms/sway/autostart/default.nix +++ b/modules/home/wms/sway/autostart/default.nix @@ -9,21 +9,20 @@ { command = "foot -a music -T Music ncmpcpp"; } { command = "foot -a sound -T Sound pulsemixer"; } - # Daemons and tray apps + # Daemons and tray { command = "hyprpaper"; } { command = "wl-paste -t text --watch clipman store -P"; } { command = "wl-copy"; } { command = "mako"; } { command = "sunshine"; } - { command = "xwayland-satellite"; } { command = "${pkgs.mate.mate-polkit}/libexec/polkit-mate-authentication-agent-1"; } - # Foreground apps + # Foreground { command = "librewolf -P Misc --name=MiscBrowser"; } + { command = "thunderbird"; } { command = "vesktop"; } { command = "fractal"; } { command = "telegram-desktop"; } - { command = "thunderbird"; } ]; }; } diff --git a/modules/home/wms/sway/default.nix b/modules/home/wms/sway/default.nix index b83ba9a..ac78c3c 100644 --- a/modules/home/wms/sway/default.nix +++ b/modules/home/wms/sway/default.nix @@ -21,12 +21,6 @@ titlebar_padding 10 1 primary_selection disabled mouse_warping container - - # Include extra window icons - include ${pkgs.fetchurl { - url = "https://raw.githubusercontent.com/iguanajuice/sway-font-awesome/6b7a9d08974eea1b9cddb8d444e1c89d6837083a/icons"; - sha256 = "09ki5qw1h91kd33k3fwzq7cb6ck8sq4haswgizrsy387sfr2a75x"; - }} ''; }; } diff --git a/modules/home/wms/sway/hotkeys/default.nix b/modules/home/wms/sway/hotkeys/default.nix index 1aa4d0a..9b00543 100644 --- a/modules/home/wms/sway/hotkeys/default.nix +++ b/modules/home/wms/sway/hotkeys/default.nix @@ -20,23 +20,22 @@ "${primeMod}+F4" = ''exec virt-manager | notify-send "Virtual Machines"''; "${primeMod}+F5" = ''exec looking-glass-client input:rawMouse=yes | notify-send "Looking Glass"''; - # Mod + key + # Prime + key "${primeMod}+s" = ''exec rofi -show run -p Command''; "${primeMod}+c" = ''exec clipman pick -t rofi''; "${primeMod}+x" = ''exec rofiscripts --power''; "${primeMod}+b" = ''exec pkill -USR1 waybar''; "${primeMod}+Return" = ''exec foot''; - "${primeMod}+Escape" = ''exec tools-sway --kill''; - # Mod + shift + key + # Prime + shift + key "${primeMod}+Shift+s" = ''exec rofi -show drun -modi drun -drun-display-format {name} -show-icons -disable-history''; "${primeMod}+Shift+t" = ''exec pcmanfm''; "${primeMod}+Shift+e" = ''exec bemoji -n -P 0''; "${primeMod}+Shift+b" = ''exec rofi-bluetooth''; "${primeMod}+Shift+Return" = ''exec foot ranger''; - # Mod + ctrl + key - "${primeMod}+Ctrl+x" = ''exec tools-sway --prop''; + # Prime + ctrl + key + "${primeMod}+Ctrl+x" = ''exec prop-sway''; "${primeMod}+Ctrl+s" = ''exec rofiscripts --scratchpads''; "${primeMod}+Ctrl+c" = ''exec wlpicker && notify-send "Color copied to clipboard"''; @@ -61,8 +60,8 @@ "${primeMod}+Ctrl+n" = ''exec makoctl dismiss -a''; # Screenshots - "${secMod}+f" = ''exec screen-sway --swappy''; - "${secMod}+Shift+f" = ''exec screen-sway --screen''; + "${secMod}+f" = ''exec shot-sway --swappy''; + "${secMod}+Shift+f" = ''exec shot-sway --screen''; # Display and keyboard brightness "${primeMod}+equal" = ''exec light -A 5''; @@ -140,20 +139,15 @@ "${primeMod}+${secMod}+k" = ''resize grow height ${resizeAmount} px or 5 ppt''; "${primeMod}+${secMod}+l" = ''resize grow width ${resizeAmount} px or 5 ppt''; - # Change focus between floating/tiled, toggle floating + # Floating "${primeMod}+space" = ''focus mode_toggle''; "${primeMod}+Shift+space" = ''floating toggle''; - # Toggle fullscreen + # Change layout "${primeMod}+f" = ''fullscreen toggle''; - "${primeMod}+${secMod}+Ctrl+f" = ''fullscreen toggle global''; - - # Change container layout "${primeMod}+w" = ''layout toggle split''; - "${primeMod}+e" = ''layout toggle tabbed stacking''; - - # Change split direction "${primeMod}+v" = ''split v''; + "${primeMod}+e" = ''layout toggle tabbed stacking''; # Focus parent / child "${primeMod}+a" = ''focus parent''; diff --git a/modules/home/wms/sway/programs/default.nix b/modules/home/wms/sway/programs/default.nix index 1b89325..04d2e4c 100644 --- a/modules/home/wms/sway/programs/default.nix +++ b/modules/home/wms/sway/programs/default.nix @@ -1,8 +1,7 @@ { pkgs, ... }: { imports = [ - ./screen-sway + ./prop-sway ./sleep-sway - ./tools-sway ]; } diff --git a/modules/home/wms/sway/programs/prop-sway/default.nix b/modules/home/wms/sway/programs/prop-sway/default.nix new file mode 100644 index 0000000..fff38eb --- /dev/null +++ b/modules/home/wms/sway/programs/prop-sway/default.nix @@ -0,0 +1,13 @@ +{ pkgs, config, ... }: +{ + home.packages = with pkgs; [ + (pkgs.writeScriptBin "prop-sway" '' + selected_window=$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | "\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height)"' | ${pkgs.slurp}/bin/slurp -r -c ${config.look.colors.prime} -B 00000066 -b 00000000) + if [ -n "$selected_window" ]; then + app_id=$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | select("\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height)" == "'"$selected_window"'") | .app_id') + system=$(sed 's/xdg_shell/Wayland/g; s/xwayland/Xorg/g' < <(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | select("\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height)" == "'"$selected_window"'") | .shell')) + notify-send "$(echo -e "Window's app_id: $app_id\nWindow System: $system")" + fi + '') + ]; +} diff --git a/modules/home/wms/sway/programs/screen-sway/default.nix b/modules/home/wms/sway/programs/screen-sway/default.nix deleted file mode 100644 index 9018293..0000000 --- a/modules/home/wms/sway/programs/screen-sway/default.nix +++ /dev/null @@ -1,44 +0,0 @@ -{ pkgs, config, ... }: -{ - home.packages = with pkgs; [ - (pkgs.writeScriptBin "screen-sway" '' - swappy() { - # Create an imv window to act as a static screen - grim -t jpeg -q 90 - | imv -w "GlobalShot" - & imv_pid=$! - - # Capture the screenshot of the selected area and save to a temporary file - selected_area=$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | .rect | "\(.x),\(.y) \(.width)x\(.height)"'\ - | XCURSOR_SIZE=40 slurp -w ${config.look.border.string} -c ${config.look.colors.prime} -B 00000066 -b 00000099) - temp_file=$(mktemp -u).png - grim -g "$selected_area" "$temp_file" - kill $imv_pid - - # Copy the screenshot to the clipboard and clear the temp - ${pkgs.swappy}/bin/swappy -f - < "$temp_file" - rm "$temp_file" - } - - screen() { - temp_file=$(mktemp -u).png - grim -o $(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .name') "$temp_file" - - # Check if the screenshot was successfully taken - if [ $? -eq 0 ]; then - wl-copy < "$temp_file" - notify-send -i "$temp_file" "Current screen copied." - rm "$temp_file" - else - notify-send "Error: Unable to capture screenshot." - fi - } - - if [ "$1" == "--swappy" ]; then - swappy - elif [ "$1" == "--screen" ]; then - screen - else - echo "Please use the arguments --swappy or --screen." - fi - '') - ]; -} diff --git a/modules/home/wms/sway/programs/tools-sway/default.nix b/modules/home/wms/sway/programs/tools-sway/default.nix deleted file mode 100644 index c7186f5..0000000 --- a/modules/home/wms/sway/programs/tools-sway/default.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ pkgs, config, ... }: -{ - home.packages = with pkgs; [ - (pkgs.writeScriptBin "tools-sway" '' - # List the app name and whether or not it uses wayland - prop() { - selected_window=$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | "\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height)"' | slurp -r -c ${config.look.colors.prime} -B 00000066 -b 00000000) - if [ -n "$selected_window" ]; then - app_id=$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | select("\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height)" == "'"$selected_window"'") | .app_id') - system=$(sed 's/xdg_shell/Wayland/g; s/xwayland/Xorg/g' < <(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | select("\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height)" == "'"$selected_window"'") | .shell')) - notify-send "$(echo -e "Window's app_id: $app_id\nWindow System: $system")" - fi - } - - # Kill a selected window - kill() { - selected_window=$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | "\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height)"' | slurp -r -c ${config.look.colors.prime} -B 00000066 -b 00000000) - if [ -n "$selected_window" ]; then - pid=$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | select("\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height)" == "'"$selected_window"'") | .pid') - kill -9 "$pid" - fi - } - - if [ "$1" == "--prop" ]; then - prop - elif [ "$1" == "--kill" ]; then - kill - else - echo "Please use the arguments --prop or --kill." - fi - '') - ]; -} diff --git a/modules/home/wms/sway/rules/default.nix b/modules/home/wms/sway/rules/default.nix index b37195f..36f961e 100644 --- a/modules/home/wms/sway/rules/default.nix +++ b/modules/home/wms/sway/rules/default.nix @@ -67,7 +67,6 @@ "7:${config.ws.w7}" = [ { app_id = "MiscBrowser"; } { app_id = "vesktop"; } - { class = "vesktop"; } ]; "8:${config.ws.w8}" = [ { app_id = "org.gnome.Fractal"; } diff --git a/modules/home/wms/sway/theme/default.nix b/modules/home/wms/sway/theme/default.nix index b49af85..1fbbf7b 100644 --- a/modules/home/wms/sway/theme/default.nix +++ b/modules/home/wms/sway/theme/default.nix @@ -32,7 +32,7 @@ }; }; fonts = { - names = ["${config.look.fonts.main}"]; + names = [ config.look.fonts.main ]; size = 10.5; }; gaps = { diff --git a/modules/system/accounts/groups/admin/default.nix b/modules/system/accounts/groups/admin/default.nix new file mode 100644 index 0000000..0a5f02c --- /dev/null +++ b/modules/system/accounts/groups/admin/default.nix @@ -0,0 +1,6 @@ +{ ... }: +{ + users.groups.admin = { + gid = 515; + }; +} diff --git a/modules/system/accounts/groups/default.nix b/modules/system/accounts/groups/default.nix index 29a1695..c7c4339 100644 --- a/modules/system/accounts/groups/default.nix +++ b/modules/system/accounts/groups/default.nix @@ -1,6 +1,7 @@ { ... }: { imports = [ + ./admin ./nfsShare ]; } diff --git a/modules/system/accounts/users/default.nix b/modules/system/accounts/users/default.nix index 3794404..0233fe8 100644 --- a/modules/system/accounts/users/default.nix +++ b/modules/system/accounts/users/default.nix @@ -8,5 +8,8 @@ home-manager.nixosModules.home-manager ]; - users.mutableUsers = false; + users = { + mutableUsers = false; + allowNoPasswordLogin = true; + }; } diff --git a/modules/system/accounts/users/jimbo/default.nix b/modules/system/accounts/users/jimbo/default.nix index 50c5527..6d17cca 100644 --- a/modules/system/accounts/users/jimbo/default.nix +++ b/modules/system/accounts/users/jimbo/default.nix @@ -19,7 +19,7 @@ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJahAoF74BY6GCTsFkt1ADKaraFgJJozW1Y1aBTLK0j9 Pixel9" ]; extraGroups = [ - "wheel" + "admin" "audio" "video" "input" diff --git a/modules/system/devices/disks/impermanence/jimbo/default.nix b/modules/system/devices/disks/impermanence/jimbo/default.nix index 71c6071..90f3120 100644 --- a/modules/system/devices/disks/impermanence/jimbo/default.nix +++ b/modules/system/devices/disks/impermanence/jimbo/default.nix @@ -16,6 +16,7 @@ ".thunderbird" ".config/blender" + ".config/dconf" ".config/vesktop" ".config/sunshine" ".config/heroic" @@ -35,7 +36,6 @@ ".zsh_history" ".local/share/clipman.json" ".local/state/lazygit/state.yml" - ".local/share/applications" # Create this so nothing gets generated inside of it ]; }; diff --git a/modules/system/programs/desktops/default.nix b/modules/system/programs/desktops/default.nix index 3b0b672..77701b1 100644 --- a/modules/system/programs/desktops/default.nix +++ b/modules/system/programs/desktops/default.nix @@ -3,7 +3,8 @@ programs = { sway.enable = config.system.desktop.enable; niri.enable = config.system.desktop.enable; - xwayland.enable = false; + hyprland.enable = config.system.desktop.enable; + xwayland.enable = lib.mkForce true; }; services.dbus.enable = config.system.desktop.enable; diff --git a/modules/system/programs/security/default.nix b/modules/system/programs/security/default.nix index 1504339..c1e14e8 100644 --- a/modules/system/programs/security/default.nix +++ b/modules/system/programs/security/default.nix @@ -2,8 +2,8 @@ { imports = [ ./apparmor - ./doas ./polkit + ./privilege ./rtprio ]; } diff --git a/modules/system/programs/security/doas/default.nix b/modules/system/programs/security/doas/default.nix deleted file mode 100644 index b40d8ea..0000000 --- a/modules/system/programs/security/doas/default.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ ... }: -{ - security = { - sudo.enable = false; - doas = { - enable = true; - extraRules = [ - { # Give wheel root access - groups = [ "wheel" ]; - keepEnv = true; - persist = true; - } - ]; - }; - }; -} diff --git a/modules/system/programs/security/privilege/default.nix b/modules/system/programs/security/privilege/default.nix new file mode 100644 index 0000000..8afc222 --- /dev/null +++ b/modules/system/programs/security/privilege/default.nix @@ -0,0 +1,31 @@ +{ ... }: +{ + security.sudo-rs = { + enable = true; + extraRules = [ + { # Admin gets certain commands + groups = [ "admin" ]; + commands = [ + "/run/current-system/sw/bin/nix" + "/run/current-system/sw/bin/nh" + "/run/current-system/sw/bin/nixos-rebuild" + "/run/current-system/sw/bin/nixos-enter" + "/run/current-system/sw/bin/nix-collect-garbage" + "/run/current-system/sw/bin/nix-store" + + "/run/current-system/sw/bin/systemctl" + "/run/current-system/sw/bin/pkill" + + "/run/current-system/sw/bin/dd" + "/run/current-system/sw/bin/eject" + "/run/current-system/sw/bin/vgchange" + + "/run/current-system/sw/bin/cp" + "/run/current-system/sw/bin/ls" + "/run/current-system/sw/bin/cat" + "/run/current-system/sw/bin/mount" + ]; + } + ]; + }; +} diff --git a/modules/system/programs/security/privilege/default.nix~ b/modules/system/programs/security/privilege/default.nix~ new file mode 100644 index 0000000..8afc222 --- /dev/null +++ b/modules/system/programs/security/privilege/default.nix~ @@ -0,0 +1,31 @@ +{ ... }: +{ + security.sudo-rs = { + enable = true; + extraRules = [ + { # Admin gets certain commands + groups = [ "admin" ]; + commands = [ + "/run/current-system/sw/bin/nix" + "/run/current-system/sw/bin/nh" + "/run/current-system/sw/bin/nixos-rebuild" + "/run/current-system/sw/bin/nixos-enter" + "/run/current-system/sw/bin/nix-collect-garbage" + "/run/current-system/sw/bin/nix-store" + + "/run/current-system/sw/bin/systemctl" + "/run/current-system/sw/bin/pkill" + + "/run/current-system/sw/bin/dd" + "/run/current-system/sw/bin/eject" + "/run/current-system/sw/bin/vgchange" + + "/run/current-system/sw/bin/cp" + "/run/current-system/sw/bin/ls" + "/run/current-system/sw/bin/cat" + "/run/current-system/sw/bin/mount" + ]; + } + ]; + }; +} diff --git a/modules/system/services/general/displaymanager/default.nix b/modules/system/services/general/displaymanager/default.nix index d53f9f4..f3bdeee 100644 --- a/modules/system/services/general/displaymanager/default.nix +++ b/modules/system/services/general/displaymanager/default.nix @@ -25,5 +25,10 @@ Name=Niri Exec=niri-session ''; + "greetd/environments/hyprland.desktop".text = '' + [Desktop Entry] + Name=Hyprland + Exec=Hyprland + ''; }; } diff --git a/modules/system/services/general/displaymanager/uwsm/default.nix b/modules/system/services/general/displaymanager/uwsm/default.nix new file mode 100755 index 0000000..e69de29 diff --git a/modules/system/services/general/portals/default.nix b/modules/system/services/general/portals/default.nix index 67b03e0..659669b 100644 --- a/modules/system/services/general/portals/default.nix +++ b/modules/system/services/general/portals/default.nix @@ -9,6 +9,9 @@ chooser_cmd = "${pkgs.slurp}/bin/slurp -f %o -or -B 00000066 -b 00000099"; }; }; - extraPortals = with pkgs; [ xdg-desktop-portal-gnome ]; + extraPortals = with pkgs; [ + xdg-desktop-portal-gnome + xdg-desktop-portal-hyprland + ]; }; }