From 48d230a1083c58f920385782859b850f3a84aeb9 Mon Sep 17 00:00:00 2001 From: Fabian Montero Date: Tue, 28 Jan 2025 12:28:28 -0600 Subject: [PATCH] improve firefox module --- home/modules/browsers.nix | 26 ----------------- home/modules/default.nix | 2 +- home/modules/defaultDesktopPack.nix | 1 + home/modules/firefox.nix | 29 +++++++++++++++++++ .../fabian@posixlycorrect/default.nix | 5 +++- 5 files changed, 35 insertions(+), 28 deletions(-) delete mode 100644 home/modules/browsers.nix create mode 100644 home/modules/firefox.nix diff --git a/home/modules/browsers.nix b/home/modules/browsers.nix deleted file mode 100644 index 96fe8ee..0000000 --- a/home/modules/browsers.nix +++ /dev/null @@ -1,26 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: -with lib; let - cfg = config.local.apps.browsers; -in { - options.local.apps.browsers = { - enable = mkEnableOption "Browser home settings"; - }; - config = mkIf cfg.enable { - home.packages = with pkgs; [ - chromium - firefox - ]; - - # create an option for this - xsession.windowManager.i3.config.startup = [ - { - command = "${lib.getExe pkgs.i3-gaps} 'workspace 1; exec ${lib.getExe pkgs.firefox}'"; - } - ]; - }; -} diff --git a/home/modules/default.nix b/home/modules/default.nix index fb90319..1ff208d 100644 --- a/home/modules/default.nix +++ b/home/modules/default.nix @@ -10,7 +10,7 @@ ./baseline.nix ./gaming.nix ./yubikey.nix - ./browsers.nix + ./firefox.nix ./gui ./zsh ./gpg.nix diff --git a/home/modules/defaultDesktopPack.nix b/home/modules/defaultDesktopPack.nix index 29fbf7a..a43fca7 100644 --- a/home/modules/defaultDesktopPack.nix +++ b/home/modules/defaultDesktopPack.nix @@ -13,6 +13,7 @@ in { config = mkIf cfg.enable { home.packages = with pkgs; [ calibre + chromium discord gwenview libreoffice-fresh diff --git a/home/modules/firefox.nix b/home/modules/firefox.nix new file mode 100644 index 0000000..43a0c92 --- /dev/null +++ b/home/modules/firefox.nix @@ -0,0 +1,29 @@ +{ + config, + lib, + pkgs, + ... +}: +with lib; let + cfg = config.local.apps.browsers; +in { + options.local.apps.browsers = { + enable = mkEnableOption "firefox settings"; + + workspace = mkOption { + type = types.nullOr types.str; + default = null; + description = '' + Workspace in which Firefox should open. If not set, Firefox will not open at startup. + ''; + }; + }; + + config = mkIf cfg.enable { + 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}'"; + }; + }; +} diff --git a/home/platforms/fabian@posixlycorrect/default.nix b/home/platforms/fabian@posixlycorrect/default.nix index dc01dbe..13167d9 100644 --- a/home/platforms/fabian@posixlycorrect/default.nix +++ b/home/platforms/fabian@posixlycorrect/default.nix @@ -40,8 +40,11 @@ neovim.enable = true; gaming.enable = true; yubikey.enable = true; - browsers.enable = true; defaultDesktopPack.enable = true; + firefox = { + enable = true; + workspace = 1; + }; }; gui = {