From 5cae43ef5160a4e404bd2cd7b2fdb0b57b4d6751 Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Mon, 19 Aug 2024 21:40:31 -0400 Subject: [PATCH] add 'laptopMode' option and user config (#92) * aly: special sway and hyprland configs for mauville * add 'laptopMode' option and config * nixfmt --- homeManagerModules/options.nix | 6 +++++ homes/aly/windowManagers/default.nix | 21 ++------------- homes/aly/windowManagers/laptop.nix | 38 ++++++++++++++++++++++++++++ hosts/fallarbor/default.nix | 1 + hosts/lavaridge/default.nix | 2 ++ hosts/petalburg/default.nix | 2 ++ hosts/rustboro/default.nix | 2 ++ nixosModules/options.nix | 2 ++ 8 files changed, 55 insertions(+), 19 deletions(-) create mode 100644 homes/aly/windowManagers/laptop.nix diff --git a/homeManagerModules/options.nix b/homeManagerModules/options.nix index b7b62a11..10ce5f2f 100644 --- a/homeManagerModules/options.nix +++ b/homeManagerModules/options.nix @@ -167,6 +167,12 @@ in { }; }; + laptopMode = lib.mkOption { + description = "Enable laptop configuration."; + default = osConfig.ar.laptopMode; + type = lib.types.bool; + }; + services = { easyeffects = { enable = lib.mkEnableOption "EasyEffects user service."; diff --git a/homes/aly/windowManagers/default.nix b/homes/aly/windowManagers/default.nix index 9f8533bf..6f83fa5a 100644 --- a/homes/aly/windowManagers/default.nix +++ b/homes/aly/windowManagers/default.nix @@ -4,20 +4,14 @@ pkgs, ... }: { + imports = [./laptop.nix]; + programs.waybar.settings.mainBar."bluetooth" = { "on-click" = lib.mkForce "${lib.getExe pkgs.rofi-bluetooth} -i"; }; wayland.windowManager = { sway.config = { - assigns = { - "workspace 1:web" = [{app_id = "firefox";} {app_id = "brave-browser";}]; - "workspace 2:note" = [{app_id = "obsidian";}]; - "workspace 3:code" = [{app_id = "codium-url-handler";} {app_id = "dev.zed.Zed";}]; - "workspace 4:mail" = [{app_id = "thunderbird";}]; - "workspace 5:work" = [{app_id = "firework";}]; - }; - floating.criteria = [{app_id = "Bitwarden";} {app_id = "org.keepassxc.KeePassXC";}]; gaps = { @@ -33,7 +27,6 @@ }; startup = [ - {command = "sleep 2 && ${lib.getExe' config.wayland.windowManager.sway.package "swaymsg"} workspace 1:web";} {command = lib.getExe config.ar.home.defaultApps.editor;} {command = lib.getExe config.ar.home.defaultApps.webBrowser;} {command = lib.getExe pkgs.fractal;} @@ -77,10 +70,6 @@ dwindle.no_gaps_when_only = "1"; - exec-once = [ - "sleep 2 && hyprctl dispatch workspace 2 && sleep 2 && hyprctl dispatch workspace 3 && sleep 2 && hyprctl dispatch workspace 4 && sleep 2 && hyprctl dispatch workspace 1;" - ]; - input.kb_options = "ctrl:nocaps"; windowrulev2 = [ @@ -90,17 +79,11 @@ "float,class:(org.keepassxc.KeePassXC)" "size 80% 80%,class:(Bitwarden)" "size 80% 80%,class:(org.keepassxc.KeePassXC)" - "workspace 1,class:(brave-browser)" - "workspace 5,class:(firework)" "workspace special:magic,class:(WebCord)" "workspace special:magic,class:(org.gnome.Fractal)" ]; workspace = [ - "1,defaultName:web,on-created-empty:${lib.getExe config.ar.home.defaultApps.webBrowser}" - "2,defaultName:note,on-created-empty:${lib.getExe' pkgs.obsidian "obsidian"}" - "3,defaultName:code,on-created-empty:${lib.getExe config.ar.home.defaultApps.editor}" - "4,defaultName:mail,on-created-empty:${lib.getExe pkgs.thunderbird}" "special:magic,on-created-empty:${lib.getExe pkgs.fractal}" ]; }; diff --git a/homes/aly/windowManagers/laptop.nix b/homes/aly/windowManagers/laptop.nix new file mode 100644 index 00000000..ec172316 --- /dev/null +++ b/homes/aly/windowManagers/laptop.nix @@ -0,0 +1,38 @@ +{ + config, + lib, + pkgs, + ... +}: { + config = lib.mkIf config.ar.home.laptopMode { + wayland.windowManager = { + sway.config = { + assigns = { + "workspace 1:web" = [{app_id = "firefox";} {app_id = "brave-browser";}]; + "workspace 2:note" = [{app_id = "obsidian";}]; + "workspace 3:code" = [{app_id = "codium-url-handler";} {app_id = "dev.zed.Zed";}]; + "workspace 4:mail" = [{app_id = "thunderbird";}]; + "workspace 5:work" = [{app_id = "firework";}]; + }; + + startup = [ + {command = "sleep 2 && ${lib.getExe' config.wayland.windowManager.sway.package "swaymsg"} workspace 1:web";} + ]; + }; + + hyprland.settings = { + exec-once = [ + "sleep 2 && hyprctl dispatch workspace 2 && sleep 2 && hyprctl dispatch workspace 3 && sleep 2 && hyprctl dispatch workspace 4 && sleep 2 && hyprctl dispatch workspace 1;" + ]; + + workspace = [ + "1,defaultName:web,on-created-empty:${lib.getExe config.ar.home.defaultApps.webBrowser}" + "2,defaultName:note,on-created-empty:${lib.getExe' pkgs.obsidian "obsidian"}" + "3,defaultName:code,on-created-empty:${lib.getExe config.ar.home.defaultApps.editor}" + "4,defaultName:mail,on-created-empty:${lib.getExe pkgs.thunderbird}" + "special:magic,on-created-empty:${lib.getExe pkgs.fractal}" + ]; + }; + }; + }; +} diff --git a/hosts/fallarbor/default.nix b/hosts/fallarbor/default.nix index babf1912..2a746010 100644 --- a/hosts/fallarbor/default.nix +++ b/hosts/fallarbor/default.nix @@ -42,6 +42,7 @@ sway.enable = true; }; + laptopMode = true; services.flatpak.enable = true; users = { diff --git a/hosts/lavaridge/default.nix b/hosts/lavaridge/default.nix index 6b2891a2..7b14f1ff 100644 --- a/hosts/lavaridge/default.nix +++ b/hosts/lavaridge/default.nix @@ -46,6 +46,8 @@ sway.enable = true; }; + laptopMode = true; + users.aly = { enable = true; password = "$y$j9T$NSS7QcEtN4yiigPyofwlI/$nxdgz0lpySa0heDMjGlHe1gX3BWf48jK6Tkfg4xMEs6"; diff --git a/hosts/petalburg/default.nix b/hosts/petalburg/default.nix index 84adc1eb..9e414588 100644 --- a/hosts/petalburg/default.nix +++ b/hosts/petalburg/default.nix @@ -66,6 +66,8 @@ sway.enable = true; }; + laptopMode = true; + users.aly = { enable = true; password = "$y$j9T$TitXX3J690cnK41XciNMg/$APKHM/os6FKd9H9aXGxaHaQ8zP5SenO9EO94VYafl43"; diff --git a/hosts/rustboro/default.nix b/hosts/rustboro/default.nix index ad911fd4..c77a930b 100644 --- a/hosts/rustboro/default.nix +++ b/hosts/rustboro/default.nix @@ -41,6 +41,8 @@ sway.enable = true; }; + laptopMode = true; + users.aly = { enable = true; password = "$y$j9T$VdtiEyMOegHpcUwgmCVFD0$K8Ne6.zk//VJNq2zxVQ0xE0Wg3LohvAQd3Xm9aXdM15"; diff --git a/nixosModules/options.nix b/nixosModules/options.nix index 98ebe9a4..61cf0b90 100644 --- a/nixosModules/options.nix +++ b/nixosModules/options.nix @@ -34,6 +34,8 @@ sway.enable = lib.mkEnableOption "Sway wayland session."; }; + laptopMode = lib.mkEnableOption "Enable laptop configuration."; + services.flatpak.enable = lib.mkEnableOption "Flatpak support with GUI."; }; }