diff --git a/modules/home-manager/hypr/default.nix b/modules/home-manager/hypr/default.nix index e1f030a..f2ee9e5 100644 --- a/modules/home-manager/hypr/default.nix +++ b/modules/home-manager/hypr/default.nix @@ -1,9 +1,23 @@ { + config, + lib, + ... +}: +let + cfg = config.nix-config.hypr; +in +{ + options = { + nix-config.hypr.enable = lib.mkOption { + type = lib.types.bool; + default = true; + description = "Enable an opinionated hyprland+quickshell setup as a desktop environment."; + }; + }; + imports = [ ./hyprland - ./hyprpaper.nix ./hyprlock.nix ./hypridle.nix - ./waybar.nix ]; } diff --git a/modules/home-manager/hypr/hyprland/general.nix b/modules/home-manager/hypr/hyprland/general.nix index c6b0311..c81cc51 100644 --- a/modules/home-manager/hypr/hyprland/general.nix +++ b/modules/home-manager/hypr/hyprland/general.nix @@ -19,7 +19,8 @@ in }; config = { - wayland.windowManager.hyprland = { + + wayland.windowManager.hyprland = lib.mkIf cfg.enable { enable = true; systemd.enable = true; settings = { @@ -28,10 +29,11 @@ in # }; general = { resize_on_border = true; - gaps_in = 5; - gaps_out = 5; + gaps_in = 3; + gaps_out = 3; border_size = 1; "col.active_border" = "rgb(98971A) rgb(CC241D) 45deg"; + "col.inactive_border" = "rgba(595959aa)"; layout = "master"; }; @@ -61,9 +63,10 @@ in }; decoration = { - rounding = 7; - # active_opacity = 0.95; + rounding = 10; inactive_opacity = 0.9; + dim_inactive = false; + dim_strength = 0.1; shadow = { enabled = false; @@ -94,6 +97,16 @@ in "float, class:org.gnome.Nautilus" # when there is a single window, deactivate border and gaps # "border_size 0, onworkspace:w[tv1], " + + # File pickers and dialogs + "float, title:^(Save As)$" + "float, title:^(Open File)$" + "size 50% 50%, title:^(Open File)$" + "center, title:^(Open File)$" + + # Disable idle when gaming + "idleinhibit always, class:^(steam_app_)" + "idleinhibit always, class:^(gamescope)$" ]; }; diff --git a/modules/home-manager/hypr/hyprland/keybinds.nix b/modules/home-manager/hypr/hyprland/keybinds.nix index 94a5cfc..b49323b 100644 --- a/modules/home-manager/hypr/hyprland/keybinds.nix +++ b/modules/home-manager/hypr/hyprland/keybinds.nix @@ -17,7 +17,7 @@ in "$mod, return, exec, kitty" "$mod, b, exec, ${cfg.browser}" "$mod, s, exec, ${cfg.ide}" - "$mod, e, exec, nautilus" + "$mod, e, exec, ${lib.getExe pkgs.nautilus}" # Lock screen "$mod, l, exec, loginctl lock-session" @@ -54,10 +54,10 @@ in "$mod+Ctrl, right, movetoworkspace, +1" # Switch workspace - "$mod, left, workspace, -1" - "$mod, right, workspace, +1" - "$mod, mouse_down, workspace, -1" - "$mod, mouse_up, workspace, +1" + "$mod, left, workspace, prev" + "$mod, right, workspace, next" + "$mod, mouse_down, workspace, prev" + "$mod, mouse_up, workspace, next" # move to scratch workspace @@ -101,8 +101,6 @@ in "$mod, KP_Subtract, resizeactive, -2% -2%" "$mod, PLUS, resizeactive, 2% 2%" "$mod, KP_Add, resizeactive, 2% 2%" - - ]; # lock-screen bindings diff --git a/modules/home-manager/hypr/hyprland/layouts.nix b/modules/home-manager/hypr/hyprland/layouts.nix index 5b80174..fe03a8d 100644 --- a/modules/home-manager/hypr/hyprland/layouts.nix +++ b/modules/home-manager/hypr/hyprland/layouts.nix @@ -8,35 +8,33 @@ in settings = { master = { - # TODO - I am not yet happy about the layout + toggle keybinds - orientation = "center"; - # equivalent toalways_center_master = true; - slave_count_for_center_master = 0; - # new_is_master = false; - # allow_small_split = true; - # special_scale_factor = 0.80; - mfact = 0.34; + # no_gaps_when_only = true; + + # default: single app is centered/fullscreen; when more apps are added it splits + orientation = "right"; + # keep center-master behaviour when there is exactly 1 slave (i.e. single app appears fullscreen) + slave_count_for_center_master = 1; + # only split in two columns + mfact = 0.6; inherit_fullscreen = false; - # always_center_master = false; - # allow a maximum of 3 windows in the master area for 3-column layout }; - #create special workspaces with no gaps - workspace = [ - "w[t1], gapsout:0, gapsin:0" - "w[tg1], gapsout:0, gapsin:0" - "f[1], gapsout:0, gapsin:0" - ]; + # #create special workspaces with no gaps + # workspace = [ + # "w[t1], gapsout:0, gapsin:0" + # "w[tg1], gapsout:0, gapsin:0" + # "f[1], gapsout:0, gapsin:0" + # ]; - # automatically assign windows to workspaces when there is only one window - windowrulev2 = [ - "bordersize 0, floating:0, onworkspace:w[t1]" - "rounding 0, floating:0, onworkspace:w[t1]" - "bordersize 0, floating:0, onworkspace:w[tg1]" - "rounding 0, floating:0, onworkspace:w[tg1]" - "bordersize 0, floating:0, onworkspace:f[1]" - "rounding 0, floating:0, onworkspace:f[1]" - ]; + # # automatically assign windows to workspaces when there is only one window + # windowrulev2 = [ + # "bordersize 0, floating:0, onworkspace:w[t1]" + # "rounding 0, floating:0, onworkspace:w[t1]" + # "bordersize 0, floating:0, onworkspace:w[tg1]" + # "rounding 0, floating:0, onworkspace:w[tg1]" + # "bordersize 0, floating:0, onworkspace:f[1]" + # "rounding 0, floating:0, onworkspace:f[1]" + # ]; misc = { vfr = false; @@ -45,12 +43,14 @@ in # Keybind to toggle between 2 and 3 column master layout bind = [ - # Toggle master layout between 2 and 3 columns - "$mod, m, exec, hyprctl dispatch layoutmsg orientationleft" - "$mod, m, exec, hyprctl dispatch layoutmsg mfact exact 0.5" - # "SUPER_SHIFT,C,exec,hyprctl dispatch layoutmsg swap_master_count 2 3" - ]; + # Toggle master layout between 2 and 3 columns (press $mod + m) + "$mod, m, exec, hyprctl dispatch layoutmsg orientationcenter" + "$mod, m, exec, hyprctl dispatch layoutmsg mfact exact 0.34" + # Toggle master layout between 3 and 2 columns (press $mod + Shift + m) + "$mod, Shift+m, exec, hyprctl dispatch layoutmsg orientationright" + "$mod, Shift+m, exec, hyprctl dispatch layoutmsg mfact exact 0.6" + ]; }; }; }; diff --git a/modules/home-manager/hypr/hyprland/packages.nix b/modules/home-manager/hypr/hyprland/packages.nix index a638791..e456002 100644 --- a/modules/home-manager/hypr/hyprland/packages.nix +++ b/modules/home-manager/hypr/hyprland/packages.nix @@ -9,7 +9,6 @@ in pkgs.nautilus pkgs.gnome-control-center pkgs.gnome-bluetooth # needed by gnome-control-center to manage bluetooth - pkgs.brightnessctl pkgs.cliphist pkgs.wl-clipboard pkgs.gcr # Provides org.gnome.keyring.SystemPrompter diff --git a/modules/home-manager/hypr/hyprpaper.nix b/modules/home-manager/hypr/hyprpaper.nix deleted file mode 100644 index 285028a..0000000 --- a/modules/home-manager/hypr/hyprpaper.nix +++ /dev/null @@ -1,66 +0,0 @@ -{ - pkgs, - lib, - ... -}: -let - - wallpapers = [ - ../../../wallpapers/codioful-formerly-gradienta-lweK7Wme_jo-unsplash.jpg - ../../../wallpapers/codioful-formerly-gradienta-n2XqPm7Bqhk-unsplash.jpg - ../../../wallpapers/luke-chesser-eICUFSeirc0-unsplash.jpg - ../../../wallpapers/luke-chesser-pJadQetzTkI-unsplash.jpg - ../../../wallpapers/magicpattern-87PP9Zd7MNo-unsplash.jpg - ]; - - monitor = ""; # leave empty to set the wallpaper on all monitors - - wallpaperPicker = pkgs.writeShellScriptBin "wallpaper-picker" '' - #!/usr/bin/env bash - # use an array of wallpapers to randomly select one - wallpapers=(${pkgs.lib.concatStringsSep " " (map (p: "${p}") wallpapers)}) - # select a random wallpaper from the array - index=$((RANDOM % ${toString (builtins.length wallpapers)})) - wallpaper="''${wallpapers[index]}" - echo "Setting wallpaper to: $wallpaper" - - hyprctl hyprpaper unload all - hyprctl hyprpaper reload "${monitor},$wallpaper" - ''; - -in { - home.packages = [wallpaperPicker]; - - services.hyprpaper = { - enable = true; - settings = { - ipc = "on"; - }; - }; - - # systemd.user = { - # services.wallpaperRandomizer = { - # Install = {WantedBy = ["graphical-session.target"];}; - - # Unit = { - # Description = "Set random desktop background using hyprpaper"; - # After = ["graphical-session-pre.target"]; - # PartOf = ["graphical-session.target"]; - # }; - - # Service = { - # Type = "oneshot"; - # ExecStart = "${wallpaperRandomizer}/bin/wallpaperRandomizer"; - # IOSchedulingClass = "idle"; - # }; - # }; - - # timers.wallpaperRandomizer = { - # Unit = {Description = "Set random desktop background using hyprpaper on an interval";}; - - # Timer = {OnUnitActiveSec = "6h";}; - - # Install = {WantedBy = ["timers.target"];}; - # }; - # }; -} diff --git a/modules/home-manager/hypr/waybar.nix b/modules/home-manager/hypr/waybar.nix deleted file mode 100644 index 2cce98d..0000000 --- a/modules/home-manager/hypr/waybar.nix +++ /dev/null @@ -1,331 +0,0 @@ -{inputs, pkgs, lib, config, ...}: -let - cfg = config.nix-config.style; -in -{ - options.nix-config.waybar = { - burninPrevention = lib.mkOption { - type = lib.types.bool; - default = true; - description = "Enable burn-in prevention for Waybar"; - example = '' - burninPrevention = true; - ''; - - }; - }; - - config = { - - # required to autoload fonts from packages installed via Home Manager - fonts.fontconfig.enable = true; - - # waybar requires font-awesome - home.packages = [ - pkgs.pavucontrol - ]; - - # enable waybar - programs.waybar.enable = false; - programs.waybar = { - settings = { - - mainBar = { - layer = "top"; - position = "top"; - - margin-top = 5; - # margin-bottom = 2; - # margin-left = 5; - # margin-right = 5; - - # margin between the modules - spacing = 2; - - modules-left = [ - "hyprland/workspaces" - "hyprland/window" - ]; - - modules-center = [ - "clock" - "custom/notification" - ]; - - modules-right = [ - "tray" - "privacy" - "network" - "bluetooth" - "wireplumber" - "battery" - "backlight" - "idle_inhibitor" - ]; - - - # module specific settings - "hyprland/workspaces" = { - format = "{icon}"; - format-icons = { - active = "●"; - default = "○"; - }; - }; - "hyprland/window"= { - "icon" = true; - "separate-outputs" = true; - "format" = "{}"; - "rewrite" = { - "(.*) — Mozilla Firefox" = "$1"; - "(.*) — Zen Browser" = "$1"; - "(.*) - fish" = "> [$1]"; - "(.*) - Visual Studio Code" = "$1"; - }; - }; - "clock" = { - format = "{:%H:%M}"; - interval = 1; - tooltip-format = "{calendar}"; - # calendar = { - # format = "%Y-%m-%d\n󰃰 %A\n\n%H:%M"; - # start-day = 1; # Monday - # first-weekday = 1; # Monday - # week-number = false; - # long-weekdays = true; - # hide-if-empty = false; - # }; - }; - "idle_inhibitor" = { - format = "{icon}"; - format-icons = { - activated = ""; - deactivated = "☕"; - }; - tooltip = "true"; - }; - "bluetooth" = { - format-on = "󰂯"; - format-off = "󰂲"; - format-disabled = "󰂲"; - format-connected-battery = "{device_battery_percentage}% 󰂯"; - format-alt = "{device_alias} 󰂯"; - tooltip-format = "{controller_alias}\t{controller_address}\n\n{num_connections} connected"; - tooltip-format-connected = "{controller_alias}\t{controller_address}\n\n{num_connections} connected\n\n{device_enumerate}"; - tooltip-format-enumerate-connected = "{device_alias}\n{device_address}"; - tooltip-format-enumerate-connected-battery = "{device_alias}\n{device_address}\n{device_battery_percentage}%"; - on-click-right = "XDG_CURRENT_DESKTOP=GNOME gnome-control-center bluetooth"; - }; - "battery" = { - interval = 60; - states = { - good = 80; - warning = 30; - critical = 10; - }; - format = "{capacity}% {icon}"; - format-charging = "{capacity}% 󰂄"; - format-plugged = "{capacity}% 󰂄"; - format-icons = [ "󰁻" "󰁼" "󰁾" "󰂀" "󰂂" "󰁹" ]; - }; - "backlight" = { - # format = "{percent}% {icon}"; - format = "{icon}"; - tooltip-format = "{percent}%"; - format-icons = [ "" "" "" "" "" "" "" "" "" ]; - }; - "wireplumber" = { - scroll-step = 1; - format = "{volume}% {icon}";# {format_source}"; - format-bluetooth = "{volume}% {icon}";# {format_source}"; - format-bluetooth-muted = " {icon}";# {format_source}"; - format-muted = "";# {format_source}"; - format-alt = "{format_source} {icon}"; - # format-source = " {volume}%"; - # format-source-muted = ""; - format-icons = { - headphone = ""; - hands-free = ""; - headset = ""; - phone = ""; - portable = ""; - default = [ - "" - "" - "" - ]; - }; - on-click = "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"; - on-click-right = "XDG_CURRENT_DESKTOP=GNOME gnome-control-center sound"; - }; - "memory" = { - interval = 5; - format = "󰍛 {}%"; - max-length = 10; - }; - "tray" = { - spacing = 5; - }; - "custom/notification" = { - format = "{icon} {}"; - format-icons = { - notification = ""; - none = ""; - dnd-notification = ""; - dnd-none = ""; - inhibited-notification = ""; - inhibited-none = ""; - dnd-inhibited-notification = ""; - dnd-inhibited-none = ""; - }; - return-type = "json"; - exec-if = "which swaync-client"; - exec = "swaync-client -swb"; - on-click = "swaync-client -t -sw"; - on-click-right = "swaync-client -d -sw"; - escape = true; - }; - "network" = { - format = "󰤭"; - format-ethernet = " {ipaddr}"; - format-wifi = "{icon}"; - format-icons = [ "󰤯" "󰤟" "󰤢" "󰤥" "󰤨" ]; - format-disconnected = "󰤭"; - tooltip-format = " {ifname} via {gwaddr}"; - tooltip-format-wifi = '' - 󰤨 {essid}({signalStrength}%), {frequency} GHz (Interface: {ifname}) - IP: {ipaddr} GW: {gwaddr} - - {bandwidthUpBits} {bandwidthDownBits} 󰹹{bandwidthTotalBits} - ''; - tooltip-format-ethernet = '' -  {ifname} - {ipaddr}/{cidr} - - {bandwidthUpBits} {bandwidthDownBits} 󰹹{bandwidthTotalBits} - ''; - tooltip-format-disconnected = "Disconnected"; - on-click = "XDG_CURRENT_DESKTOP=GNOME gnome-control-center wifi"; - }; - "privacy" = { - icon-spacing = 4; - # icon-size" = 18; - transition-duration = 250; - modules = [ - { - type = "screenshare"; - tooltip = true; - # tooltip-icon-size = 24 - } - { - type = "audio-out"; - tooltip = true; - # tooltip-icon-size = 24 - } - { - type = "audio-in"; - tooltip = true; - # tooltip-icon-size = 24 - } - ]; - }; - }; - }; - - style = '' - * { - font-family: "${cfg.monospaceFont}"; - font-weight: bold; - font-size: ${builtins.toString (cfg.fontSizes.desktop + 5)}px; - } - - window#waybar { - background-color: transparent; - } - - .module { - background: rgba(0, 0, 0, 0.6); - color: white; - border-radius: 7px; - margin: 1px 3px; - padding: 1px 6px; - animation: bgFade 3600s infinite alternate, textColorFade 3600s infinite alternate; - } - - box.module button:hover { - box-shadow: inset 0 -3px #ffffff; - } - - /*.modules-left { - padding: 3px; - } - - .modules-right { - padding: 3px; - } - - .modules-center { - padding: 3px; - }*/ - - #workspaces button { - color: white; - background: none; - animation: textColorFade 3600s infinite alternate; - } - - #battery.warning { - background:rgba(240, 165, 0, 0.6); - } - #battery.critical { - background:rgba(255, 0, 0, 0.6); - } - #battery.charging { - background-color:rgba(14, 173, 0, 0.6); - } - - - #privacy { - color: #ffffff; - background:rgba(240, 165, 0, 0.6); - border-radius: 7px; - margin: 1px 3px; - padding: 1px 6px; - - } - - - - - - @keyframes bgFade { - 0% { - background-color: white; - } - 100% { - background-color: black; - } - } - - @keyframes textColorFade { - 0% { - color: black; - } - /* 45% { - color: black; - } */ - 60% { - color: rgb(29, 38, 96); - } - /* 55% { - color: white; - } */ - 100% { - color: white; - } - } - - ''; - }; - }; -} - diff --git a/modules/home-manager/notifications.nix b/modules/home-manager/notifications.nix deleted file mode 100644 index c451f1a..0000000 --- a/modules/home-manager/notifications.nix +++ /dev/null @@ -1,110 +0,0 @@ -{ config, pkgs, lib, ... }: -let - cfg = config.nix-config.style; -in -{ - services.swaync = { - enable = true; - - settings = { - control-center-margin-top = 13; - control-center-margin-bottom = 0; - control-center-margin-right = 14; - control-center-margin-left = 0; - notification-2fa-action = true; - notification-inline-replies = true; - notification-icon-size = 48; - notification-body-image-height = 160; - notification-body-image-width = 200; - notification-window-width = 400; - timeout = 6; - timeout-low = 3; - timeout-critical = 0; - - image-visibility = "when-available"; - transition-time = 200; - hide-on-clear = false; - hide-on-action = true; - script-fail-notify = true; - widgets = [ - "dnd" - "buttons-grid" - "mpris" - "volume" - "backlight" - "title" - "notifications" - ]; - widget-config = { - title = { - text = "Notifications"; - clear-all-button = true; - button-text = ""; - }; - dnd = { - text = "Do Not Disturb"; - }; - label = { - max-lines = 1; - text = "Notification"; - }; - mpris = { - image-size = 50; - image-radius = 0; - }; - volume = { - label = ""; - }; - backlight = { - label = "󰃠"; - device = "amdgpu_bl2"; - }; - buttons-grid = { - actions = [ - { - label = ""; - command = "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"; - type = "toggle"; - } - { - label = ""; - command = "wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"; - type = "toggle"; - } - { - label = "󰤨"; - command = "nm-connection-editor"; - } - { - label = "󰂯"; - command = "blueman-manager"; - } - { - label = "󱡽"; - command = "bash -c $HOME/.config/hypr/scripts/airplaneMode.sh"; - type = "toggle"; - } - { - label = ""; - command = "shutdown now"; - } - { - label = ""; - command = "hyprlock"; - } - { - label = ""; - command = "~/.config/hypr/scripts/wlogout.sh"; - } - ]; - }; - }; - }; - - style = '' - * { - font-family: "monospace"; - } - ''; - }; -} diff --git a/modules/home-manager/stylix.nix b/modules/home-manager/stylix.nix index 4385c64..2025667 100644 --- a/modules/home-manager/stylix.nix +++ b/modules/home-manager/stylix.nix @@ -90,7 +90,7 @@ in }; emoji = { - package = pkgs.noto-fonts-emoji; + package = pkgs.noto-fonts-color-emoji; name = "Noto Color Emoji"; }; diff --git a/modules/nixos/hyprland.nix b/modules/nixos/hyprland.nix index 4727ec2..f1ada20 100644 --- a/modules/nixos/hyprland.nix +++ b/modules/nixos/hyprland.nix @@ -22,7 +22,7 @@ in defaultSession = "hyprland"; }; - services.xserver.displayManager.gdm = { + services.displayManager.gdm = { enable = true; wayland = true; };