diff --git a/home/default.nix b/home/default.nix index cc7cb84..22ffb90 100644 --- a/home/default.nix +++ b/home/default.nix @@ -4,6 +4,7 @@ ./emacs.nix ./flameshot.nix ./secrets + ./themes ./tmux.nix ./x ]; diff --git a/home/themes/color.nix b/home/themes/color.nix new file mode 100644 index 0000000..46ce77e --- /dev/null +++ b/home/themes/color.nix @@ -0,0 +1,9 @@ +{ lib }: +let + mkColorOption = with lib; {default ? "#000000", description ? "" }: mkOption { + inherit description default; + example = "#abcdef"; + type = types.strMatching "#[0-9a-f]{6}"; + }; +in +mkColorOption diff --git a/home/themes/default.nix b/home/themes/default.nix new file mode 100644 index 0000000..2f7e73d --- /dev/null +++ b/home/themes/default.nix @@ -0,0 +1,22 @@ +{ config, lib, ... }: +with lib; +let + themeType = types.submodule { + options = { + i3Theme = mkOption { + type = import ./i3.nix { inherit lib; }; + }; + }; + }; +in +{ + options.my.home = { + theme = mkOption { + type = themeType; + }; + + themes = mkOption { + type = with types; attrsOf themeType; + }; + }; +} diff --git a/home/themes/i3.nix b/home/themes/i3.nix new file mode 100644 index 0000000..9e9d72d --- /dev/null +++ b/home/themes/i3.nix @@ -0,0 +1,183 @@ +{ lib }: +with lib; +let + mkColorOption = import ./color.nix { inherit lib; }; + + barColorSetModule = types.submodule { + options = { + border = mkColorOption {}; + background = mkColorOption {}; + text = mkColorOption {}; + }; + }; + + colorSetModule = types.submodule { + options = { + border = mkColorOption {}; + childBorder = mkColorOption {}; + background = mkColorOption {}; + text = mkColorOption {}; + indicator = mkColorOption {}; + }; + }; +in +types.submodule { + options = { + bar = mkOption { + type = types.submodule { + options = { + background = mkColorOption { + default = "#000000"; + description = "Background color of the bar."; + }; + + statusline = mkColorOption { + default = "#ffffff"; + description = "Text color to be used for the statusline."; + }; + + separator = mkColorOption { + default = "#666666"; + description = "Text color to be used for the separator."; + }; + + focusedWorkspace = mkOption { + type = barColorSetModule; + default = { + border = "#4c7899"; + background = "#285577"; + text = "#ffffff"; + }; + description = '' + Border, background and text color for a workspace button when the workspace has focus. + ''; + }; + + activeWorkspace = mkOption { + type = barColorSetModule; + default = { + border = "#333333"; + background = "#5f676a"; + text = "#ffffff"; + }; + description = '' + Border, background and text color for a workspace button when the workspace is active. + ''; + }; + + inactiveWorkspace = mkOption { + type = barColorSetModule; + default = { + border = "#333333"; + background = "#222222"; + text = "#888888"; + }; + description = '' + Border, background and text color for a workspace button when the workspace does not + have focus and is not active. + ''; + }; + + urgentWorkspace = mkOption { + type = barColorSetModule; + default = { + border = "#2f343a"; + background = "#900000"; + text = "#ffffff"; + }; + description = '' + Border, background and text color for a workspace button when the workspace contains + a window with the urgency hint set. + ''; + }; + + bindingMode = mkOption { + type = barColorSetModule; + default = { + border = "#2f343a"; + background = "#900000"; + text = "#ffffff"; + }; + description = + "Border, background and text color for the binding mode indicator"; + }; + }; + }; + }; + + background = mkOption { + type = types.str; + default = "#ffffff"; + description = '' + Background color of the window. Only applications which do not cover + the whole area expose the color. + ''; + }; + + focused = mkOption { + type = colorSetModule; + default = { + border = "#4c7899"; + background = "#285577"; + text = "#ffffff"; + indicator = "#2e9ef4"; + childBorder = "#285577"; + }; + description = "A window which currently has the focus."; + }; + + focusedInactive = mkOption { + type = colorSetModule; + default = { + border = "#333333"; + background = "#5f676a"; + text = "#ffffff"; + indicator = "#484e50"; + childBorder = "#5f676a"; + }; + description = '' + A window which is the focused one of its container, + but it does not have the focus at the moment. + ''; + }; + + unfocused = mkOption { + type = colorSetModule; + default = { + border = "#333333"; + background = "#222222"; + text = "#888888"; + indicator = "#292d2e"; + childBorder = "#222222"; + }; + description = "A window which is not focused."; + }; + + urgent = mkOption { + type = colorSetModule; + default = { + border = "#2f343a"; + background = "#900000"; + text = "#ffffff"; + indicator = "#900000"; + childBorder = "#900000"; + }; + description = "A window which has its urgency hint activated."; + }; + + placeholder = mkOption { + type = colorSetModule; + default = { + border = "#000000"; + background = "#0c0c0c"; + text = "#ffffff"; + indicator = "#000000"; + childBorder = "#0c0c0c"; + }; + description = '' + Background and text color are used to draw placeholder window + contents (when restoring layouts). Border and indicator are ignored. + ''; + }; + }; +}