{ lib, config, pkgs, ... }: with lib; let cfg = config.modules.desktop.sway; in { options.modules.desktop.sway = { enable = mkEnableOption "enable Sway Windows Manager"; kanshi = mkOption { type = types.bool; default = false; description = "configure laptop mode"; }; swaylock.useNullPackage = mkOption { type = types.bool; default = false; description = '' Use null package to not install swaylock with Nix Useful when using Home-Manager on third-party distribution to avoid problem with PAM ''; }; xdg.useDistributionPortals = mkOption { type = types.bool; default = false; description = '' This prevent installing xdg-desktop-portal from nixpkgs. These Useful when using Home-Manager on third-party distribution with old version of portals (coucou Ubuntu LTS) ''; }; wallpapers = { lockscreen = mkOption { type = types.str; default = ""; description = "path for lockscreen wallpaper"; }; desktop = mkOption { type = types.str; default = "#000000 solid_color"; description = "options for desktop wallpaper"; }; }; waybar = { laptop = mkOption { type = types.bool; default = false; description = "Enable laptop element on Waybar"; }; cpuThermal = { thermalZone = mkOption { type = types.str; default = ""; description = "CPU thermal hwmon thermal Zone"; }; hwmonPathAbs = mkOption { type = types.str; default = ""; description = "CPU thermal hwmon absolute path"; }; inputFilename = mkOption { type = types.str; default = ""; description = "CPU thermal hwmon file"; }; }; gpuThermal = { enable = mkOption { type = types.bool; default = false; description = "enable waybar GPU temperature"; }; hmonPath = mkOption { type = types.str; default = ""; description = "Thermal zone for CPU"; }; }; }; }; imports = [ ./includes/fuzzel.nix ./includes/kanshi.nix ./includes/mako.nix ./includes/sway.nix ./includes/swayidle.nix ./includes/swaylock.nix ./includes/waybar.nix ]; config = mkIf cfg.enable { programs.fuzzel.enable = true; home.packages = with pkgs; [ dejavu_fonts # emojione font-awesome grim lato liberation_ttf libertine libnotify nerd-fonts.fira-code nerd-fonts.fira-mono noto-fonts-emoji noto-fonts-cjk-sans slurp wl-clipboard xdg-utils ]; programs.zsh.loginExtra = '' if [ "$(tty)" = "/dev/tty1" ]; then exec sway &> /dev/null fi ''; gtk = { enable = true; theme = { name = "Arc-Dark"; package = pkgs.arc-theme; }; iconTheme = { name = "Papirus Dark"; package = pkgs.papirus-icon-theme; }; font = { name = "Deja Vu Sans"; package = "${pkgs.dejavu_fonts}"; size = 10; }; }; home.pointerCursor = { name = "Adwaita"; package = pkgs.adwaita-icon-theme; size = 24; x11 = { enable = true; defaultCursor = "Adwaita"; }; }; home.sessionVariables = { # Use wayland for chrom{e|ium} based crap NIXOS_OZONE_WL = "1"; # Avoid pixelated effect for QT application with fractionnal scaling QT_SCALE_FACTOR_ROUNDING_POLICY = "RoundPreferFloor"; }; qt = { enable = true; platformTheme.name = "adwaita"; style.name = "adwaita-dark"; }; xdg = { enable = true; mimeApps.enable = true; userDirs = { enable = true; createDirectories = true; documents = "${config.home.homeDirectory}/documents"; download = "${config.home.homeDirectory}/downloads"; music = "${config.home.homeDirectory}/medias/musics"; pictures = "${config.home.homeDirectory}/medias/images"; videos = "${config.home.homeDirectory}/medias/videos"; templates = "${config.home.homeDirectory}/tmp"; desktop = "${config.home.homeDirectory}/documents"; publicShare = "${config.home.homeDirectory}/tmp/public"; }; portal = mkIf (cfg.xdg.useDistributionPortals == false) { enable = true; extraPortals = with pkgs; [ xdg-desktop-portal-wlr xdg-desktop-portal-gtk ]; xdgOpenUsePortal = true; config = { sway = { default = [ "wlr" "gtk" ]; }; }; }; }; # When using `useDistributionPackage`, create wlr configuration to let user # choose the right screen. This is a workarount to not have to configure # it manually. home.file = mkIf cfg.xdg.useDistributionPortals { "${config.xdg.configHome}/xdg-desktop-portal-wlr/config".text = '' [screencast] max_fps=30 chooser_type=simple chooser_cmd=${pkgs.slurp}/bin/slurp -f %o -or ''; }; }; }