From 5d1408254a4189ff369a290973728b0e15ea4a33 Mon Sep 17 00:00:00 2001 From: Fabian Montero Date: Thu, 7 Aug 2025 16:48:34 -0600 Subject: [PATCH] configure sway (this is a huge rice) --- home/modules/firefox.nix | 12 - home/modules/gui/autorandr.nix | 32 -- home/modules/gui/default.nix | 109 +---- home/modules/gui/fonts.nix | 31 +- home/modules/gui/i3.nix | 104 ---- home/modules/gui/picom.nix | 41 -- home/modules/gui/polybar.nix | 460 ------------------ home/modules/gui/startx.nix | 16 - home/modules/gui/sway.nix | 81 ++- home/modules/gui/waybar.nix | 172 +++++++ home/modules/gui/wofi.nix | 74 +++ .../fabian@posixlycorrect/default.nix | 27 +- home/platforms/fabian@t14/default.nix | 7 +- sys/modules/default.nix | 10 + sys/modules/yubikey.nix | 2 - sys/platforms/posixlycorrect/default.nix | 2 - 16 files changed, 381 insertions(+), 799 deletions(-) delete mode 100644 home/modules/gui/autorandr.nix delete mode 100644 home/modules/gui/i3.nix delete mode 100644 home/modules/gui/picom.nix delete mode 100644 home/modules/gui/polybar.nix delete mode 100644 home/modules/gui/startx.nix create mode 100644 home/modules/gui/waybar.nix create mode 100644 home/modules/gui/wofi.nix diff --git a/home/modules/firefox.nix b/home/modules/firefox.nix index b2c7f10..93feb80 100644 --- a/home/modules/firefox.nix +++ b/home/modules/firefox.nix @@ -10,14 +10,6 @@ in { options.local.apps.firefox = { enable = mkEnableOption "firefox settings"; - workspace = mkOption { - type = types.nullOr types.str; - default = null; - description = '' - i3 Workspace in which Firefox should open. If not set, Firefox will not open at startup - ''; - }; - makeDefaultBrowser = mkOption { type = types.bool; default = true; @@ -30,10 +22,6 @@ in { config = mkIf cfg.enable (mkMerge [ { programs.firefox.enable = true; - - xsession.windowManager.i3.config.startup = optional (cfg.workspace != null) { - command = "${lib.getExe pkgs.i3-gaps} 'workspace ${cfg.workspace}; exec ${lib.getExe pkgs.firefox}'"; - }; } (mkIf cfg.makeDefaultBrowser { diff --git a/home/modules/gui/autorandr.nix b/home/modules/gui/autorandr.nix deleted file mode 100644 index ed35e99..0000000 --- a/home/modules/gui/autorandr.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: -with lib; let - cfg = config.local.gui; -in { - programs.autorandr = { - profiles."default" = { - fingerprint = - mapAttrs - (monitorId: monitor: monitor.fingerprint) - cfg.monitors; - - config = - mapAttrs ( - monitorId: - filterAttrs - (k: v: - !elem k [ - #list of options to exclude from this list - "fingerprint" - "initialI3Workspace" - "monitorId" - ]) - ) - cfg.monitors; - }; - }; -} diff --git a/home/modules/gui/default.nix b/home/modules/gui/default.nix index ad61a54..8e19063 100644 --- a/home/modules/gui/default.nix +++ b/home/modules/gui/default.nix @@ -9,121 +9,66 @@ with lib; let monitorType = {setName}: ( types.submodule ({name ? null, ...}: { options = { - monitorId = mkOption { + width = mkOption { type = types.str; - example = "DP-1"; - readOnly = true; - internal = true; + default = "1920"; + example = "1920"; }; - primary = mkOption { - type = types.bool; - default = false; - description = "is primary monitor"; - example = "true"; - }; - position = mkOption { + height = mkOption { type = types.str; - example = "0x0"; - }; - mode = mkOption { - type = types.str; - description = "resolution"; - default = "1920x1080"; - example = "1920x1080"; + default = "1080"; + example = "1080"; }; rate = mkOption { type = types.str; description = "refresh rate"; example = "143.85"; }; - rotate = mkOption { + posX = mkOption { type = types.str; - default = "normal"; - example = "left"; + description = "x axis position"; + default = "0"; + example = "0"; }; - fingerprint = mkOption { + posY = mkOption { type = types.str; - example = "00ffffffffffff003669a03bd4040000231e0104a5341d783bd005ac5048a627125054bfcf00814081809500714f81c0b30001010101023a801871382d40582c450009252100001e0882805070384d400820f80c09252100001a000000fd003090b4b422010a202020202020000000fc004d53492047323443340a20202001a2020320f14d010304131f120211900e0f1d1e230907078301000065030c001000866f80a0703840403020350009252100001a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e9"; + description = "y axis position"; + default = "0"; + example = "0"; }; - initialI3Workspace = mkOption { - type = types.nullOr types.int; - default = null; - example = 1; - }; - }; - config = optionalAttrs setName { - # make this better later - monitorId = name; }; }) ); in { options.local.gui = { enable = mkEnableOption "GUI settings"; - primaryMonitor = mkOption { - type = monitorType {setName = false;}; - readOnly = true; - internal = true; - }; monitors = mkOption { type = types.attrsOf (monitorType {setName = true;}); }; - displayBatteryLevel = mkOption { - type = types.bool; - default = false; - description = "show battery level on polybar"; - example = "true"; - }; }; imports = [ - ./autorandr.nix ./fonts.nix - ./i3.nix - ./polybar.nix - ./startx.nix - ./picom.nix ./theme.nix ./sway.nix + ./waybar.nix + ./wofi.nix ]; - config = let - primaryMonitors = - filter (monitor: monitor.primary) - (attrValues cfg.monitors); - in - mkIf cfg.enable { - assertions = [ - { - assertion = length primaryMonitors == 1; - message = "Exactly one (1) primary monitor is requiered."; - } - ]; + config = mkIf cfg.enable { + services = { + mako.enable = true; + }; - local.gui.primaryMonitor = head primaryMonitors; - - xsession = { + xdg = { + enable = true; + mimeApps = { enable = true; - windowManager.i3.enable = true; - }; - - programs.autorandr.enable = true; - services = { - dunst.enable = true; - betterlockscreen.enable = true; - polybar.enable = true; - picom.enable = true; - }; - - xdg = { - enable = true; - mimeApps = { - enable = true; - defaultApplications = { - "application/pdf" = with pkgs; ["qpdfview"]; - "x-scheme-handler/file" = with pkgs; ["kitty"]; - }; + defaultApplications = { + "application/pdf" = with pkgs; ["qpdfview"]; + "x-scheme-handler/file" = with pkgs; ["kitty"]; }; }; }; + }; } diff --git a/home/modules/gui/fonts.nix b/home/modules/gui/fonts.nix index 375145a..1830208 100644 --- a/home/modules/gui/fonts.nix +++ b/home/modules/gui/fonts.nix @@ -4,9 +4,38 @@ pkgs, ... }: { - fonts.fontconfig.enable = true; + fonts.fontconfig = { + enable = true; + defaultFonts = { + monospace = [ + "JetBrains Mono" + "Noto Sans Mono CJK SC" + "Noto Sans Mono" + "Noto Color Emoji" + ]; + sansSerif = [ + "Noto Sans" + "Noto Sans CJK SC" + "Noto Color Emoji" + ]; + serif = [ + "Noto Serif" + "Noto Serif CJK SC" + "Noto Color Emoji" + ]; + emoji = ["Noto Color Emoji"]; + }; + }; + # this is probably not necessary since they are already installed in sys + # with fonts.packages buy im too lazy to check home.packages = with pkgs; [ jetbrains-mono + noto-fonts + noto-fonts-cjk-sans + noto-fonts-emoji + noto-fonts-extra + nerd-fonts.fira-code + nerd-fonts.droid-sans-mono ]; } diff --git a/home/modules/gui/i3.nix b/home/modules/gui/i3.nix deleted file mode 100644 index 29c9507..0000000 --- a/home/modules/gui/i3.nix +++ /dev/null @@ -1,104 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: -with lib; { - xsession.windowManager.i3 = { - package = pkgs.i3-gaps; - - config = let - mod = "Mod4"; - in { - modifier = mod; - - fonts = { - names = ["JetBrains Mono"]; - style = "Regular"; - size = 8.0; - }; - - gaps = { - inner = 10; - outer = -10; - }; - - window = { - hideEdgeBorders = "both"; - titlebar = false; - }; - - workspaceLayout = "tabbed"; - - colors = { - focused = { - background = "#222222"; - border = "#4c7899"; - childBorder = "#222222"; - indicator = "#292d2e"; - text = "#888888"; - }; - }; - - # mkOptionDefault hace que se ponga la config por default - # y se sobreescriba las cosas que pongo acá - # NO QUITARLO. ver man home-configuration.nix - keybindings = mkOptionDefault { - "${mod}+Return" = "exec ${lib.getExe pkgs.kitty} ${lib.getExe pkgs.tmux}"; - "${mod}+Tab" = "focus right"; - "${mod}+Shift+Tab" = "focus left"; - "${mod}+Shift+s" = "exec ${lib.getExe pkgs.maim} -s -u | ${lib.getExe pkgs.xclip} -selection clipboard -t image/png -i"; - "${mod}+Shift+w" = "move workspace to output right"; - "${mod}+l" = "exec ${lib.getExe pkgs.betterlockscreen} -l"; - }; - - startup = [ - { - command = "${lib.getExe pkgs.xss-lock} --transfer-sleep-lock -- ${lib.getExe pkgs.i3lock} --nofork"; - notification = false; - } - { - command = "${lib.getExe pkgs.networkmanagerapplet}"; - notification = false; - } - #todo: sería nice hostear esta imagen en el server y fetchearla si no existe - { - command = "${lib.getExe pkgs.feh} --bg-fill ${config.home.homeDirectory}/Pictures/wallpapers/jupiter.png"; - notification = false; - always = true; - } - { - #todo: move this to telegram module - command = "${lib.getExe pkgs.i3-gaps} 'workspace 2; exec ${lib.getExe pkgs.tdesktop}'"; - } - { - command = "${lib.getExe pkgs.i3-gaps} 'workspace 2; exec ${lib.getExe pkgs.gajim}'"; - } - { - command = "${pkgs.systemd}/bin/systemctl --user restart polybar.service"; - notification = false; - always = true; - } - { - command = "${lib.getExe pkgs.autorandr} -c"; - notification = false; - always = true; - } - ]; - - workspaceOutputAssign = - mapAttrsToList ( - monitorId: v: - { - output = monitorId; - } - // optionalAttrs (v.initialI3Workspace != null) { - workspace = toString v.initialI3Workspace; - } - ) - config.local.gui.monitors; - bars = []; - }; - }; -} diff --git a/home/modules/gui/picom.nix b/home/modules/gui/picom.nix deleted file mode 100644 index 8807f67..0000000 --- a/home/modules/gui/picom.nix +++ /dev/null @@ -1,41 +0,0 @@ -{ - config, - pkgs, - lib, - ... -}: { - services.picom = { - fade = true; - fadeSteps = [0.1 0.1]; - fadeDelta = 10; - settings = { - animations = [ - { - triggers = [ - "open" - "show" - ]; - - preset = "appear"; - duration = "1"; - } - { - triggers = [ - "close" - "hide" - ]; - - preset = "disappear"; - duration = "1"; - } - { - triggers = [ - "geometry" - ]; - preset = "geometry-change"; - duration = "1"; - } - ]; - }; - }; -} diff --git a/home/modules/gui/polybar.nix b/home/modules/gui/polybar.nix deleted file mode 100644 index 8012b3b..0000000 --- a/home/modules/gui/polybar.nix +++ /dev/null @@ -1,460 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: -with lib; { - services.polybar = { - package = pkgs.polybarFull; - script = '' - # Terminate already running bar instances - killall -q polybar - - # Wait until the processes have been shut down - while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done - - # Launch Polybar, using default config location ~/.config/polybar/config - polybar -r main & polybar -r secondary & - ''; - - settings = { - "colors" = { - # background = "\${xrdb:color0:#222}"; - background = "#AA000000"; - background-alt = "#00000000"; - # foreground = "\${xrdb:color7:#222}"; - foreground = "#ffffff"; - foreground-alt = "#ffffff"; - primary = "#ffffff"; - secondary = "#e60053"; - alert = "#bd2c40"; - }; - - "bar/main" = { - monitor = config.local.gui.primaryMonitor.monitorId; - width = "100%"; - height = 30; - offset-x = "0%"; - offset-y = "0%"; - radius = 0.0; - fixed-center = false; - - background = "\${colors.background}"; - foreground = "\${colors.foreground}"; - - line-size = 1; - line-color = "#f0000000"; - - border-size = 0; - border-color = "#00000000"; - - padding-left = 0; - padding-right = 0; - - module-margin-left = 1; - module-margin-right = 1; - - # font-0 = "fixed:pixelsize=10;1"; - font-0 = "JetBrains Mono Light:size=10;0"; - font-1 = "unifont:fontformat=truetype:size=8:antialias=false;0"; - font-2 = "siji:pixelsize=10;1"; - # font-2 = "FontAwesome5Free:style=Regular:size=10;4"; - - modules-left = "i3"; - modules-center = "xwindow"; - modules-right = "xkeyboard pulseaudio filesystem memory cpu temperature gputemperature nvmetemperature wlan eth date semanatec"; - separator = "|"; - - tray-position = "right"; - tray-padding = 2; - - # To allow other windows to be placed above the bar, or to avoid having the bar visible when in fullscreen mode, - # you need to use the following two parameters. Note that it will tell the window manager to back off so no - # area will be reserved, etc. - # - # wm-restack = "i3"; - # override-redirect = true; - - cursor-click = "pointer"; - cursor-scroll = "ns-resize"; - }; - - "bar/secondary" = { - monitor = head (attrNames (filterAttrs (monitorId: v: - !v.primary) - config.local.gui.monitors)); # this is bad. will fail if more than 2 monitors. this sets all monitors other than the primary one for this bar. - "inherit" = "bar/main"; - - modules-left = "i3"; - modules-center = "xwindow"; - modules-right = "xkeyboard pulseaudio date"; - tray-position = "none"; - }; - - "module/xwindow" = { - type = "internal/xwindow"; - label = "%title:0:30:...%"; - }; - - "module/xkeyboard" = { - type = "internal/xkeyboard"; - blacklist-0 = "num lock"; - - format-prefix = ""; - format-prefix-foreground = "\${colors.foreground-alt}"; - - label-layout = "%layout%"; - - label-indicator-padding = 2; - label-indicator-margin = 1; - label-indicator-background = "\${colors.secondary}"; - }; - - "module/filesystem" = { - type = "internal/fs"; - interval = 10; - - mount-0 = "/"; - - label-mounted = "%{F#0a81f5}%mountpoint%%{F-}: %used%/%total%"; - label-unmounted = ""; - }; - - "module/i3" = { - type = "internal/i3"; - format = " "; - index-sort = true; - wrapping-scroll = false; - - # Only show workspaces on the same output as the bar - # pin-workspaces = true - - label-mode-padding = 1; - label-mode-foreground = "#000"; - label-mode-background = "\${colors.primary}"; - - # focused = Active workspace on focused monitor - label-focused = "%index%"; - label-focused-background = "\${colors.background}"; - label-focused-underline = "\${colors.primary}"; - label-focused-padding = 1; - - # unfocused = Inactive workspace on any monitor - label-unfocused = "%index%"; - label-unfocused-padding = 1; - - # visible = Active workspace on unfocused monitor - label-visible = "%index%"; - label-visible-background = "\${self.label-focused-background}"; - label-visible-underline = "\${self.label-focused-underline}"; - label-visible-padding = "\${self.label-focused-padding}"; - - # urgent = Workspace with urgency hint set - label-urgent = "%index%"; - label-urgent-background = "\${colors.alert}"; - label-urgent-padding = 1; - }; - - "module/xbacklight" = { - type = "internal/xbacklight"; - - format = "