diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000..38b33a2 --- /dev/null +++ b/TODO.md @@ -0,0 +1,8 @@ +### TODO + +- Make startpage fully generic for both Nord and Everforest + +### Needs checking + +- Fix issue where wireless connection dies after suspend, even after restarting NetworkManager: not an issue on T430, still problem on X220? +- Fix/map media keys (already declared within [`i3.nix`](i3.nix) but are non-functional: not an issue on T430, still problem on X220? diff --git a/theme/default.nix b/colors/default.nix similarity index 67% rename from theme/default.nix rename to colors/default.nix index c79489e..d221312 100644 --- a/theme/default.nix +++ b/colors/default.nix @@ -8,4 +8,5 @@ in { css = lib: lib.strings.concatStringsSep "\n" (lib.attrValues (lib.mapAttrs (k: v: " --${k}: ${v};") theme.colors)); } -// theme // { colors = theme.colors // colors; } +// colors // theme.colors # Root colors +// theme // { colors = theme.colors // colors; } # Dedicated color set diff --git a/theme/everforest/default.nix b/colors/everforest/default.nix similarity index 100% rename from theme/everforest/default.nix rename to colors/everforest/default.nix diff --git a/theme/everforest/gtk.nix b/colors/everforest/gtk.nix similarity index 100% rename from theme/everforest/gtk.nix rename to colors/everforest/gtk.nix diff --git a/theme/nord/default.nix b/colors/nord/default.nix similarity index 100% rename from theme/nord/default.nix rename to colors/nord/default.nix diff --git a/fcitx5/default.nix b/fcitx5/default.nix index adb4c33..4ad50e5 100644 --- a/fcitx5/default.nix +++ b/fcitx5/default.nix @@ -1,7 +1,7 @@ { pkgs, ... }: -with import ../theme; let - themeFolder = ".local/share/fcitx5/themes/${theme}/"; +let + themeFolder = ".local/share/fcitx5/themes/Theme/"; in { i18n.inputMethod = { @@ -10,13 +10,9 @@ in }; home.file = { - "${themeFolder}theme.conf".source = with colors; pkgs.substituteAll ({ - src = ./theme.conf; - background = "${bg1}80"; - highlight = bg0; - } // colors); + "${themeFolder}theme.conf".text = import ./theme.nix; "${themeFolder}arrow.png".source = ./arrow.png; "${themeFolder}radio.png".source = ./radio.png; - ".config/fcitx5/conf/classicui.conf".text = "Theme=${theme}"; + ".config/fcitx5/conf/classicui.conf".text = "Theme=Theme"; }; } diff --git a/fcitx5/theme.conf b/fcitx5/theme.nix similarity index 60% rename from fcitx5/theme.conf rename to fcitx5/theme.nix index ac6f54e..764db5d 100644 --- a/fcitx5/theme.conf +++ b/fcitx5/theme.nix @@ -1,12 +1,19 @@ +# Modified from https://github.com/tonyfettes/fcitx5-nord +let + colors = import ../colors; + background = "${colors.bg1}80"; + highlight = "${colors.bg0}"; +in +'' [Metadata] ScaleWithDPI=True [InputPanel] Font=Sans 13 -NormalColor=@fg0@ -HighlightCandidateColor=@fg1@; -HighlightColor=@undefined@ -HighlightBackgroundColor=@undefined@ +NormalColor=${colors.fg0} +HighlightCandidateColor=${colors.fg1}; +HighlightColor=${colors.undefined} +HighlightBackgroundColor=${colors.undefined} Spacing=3 [InputPanel/TextMargin] @@ -16,7 +23,7 @@ Top=6 Bottom=6 [InputPanel/Background] -Color=@background@ +Color=${background} [InputPanel/Background/Margin] Left=2 @@ -25,7 +32,7 @@ Top=2 Bottom=2 [InputPanel/Highlight] -Color=@highlight@ +Color=${highlight} [InputPanel/Highlight/Margin] Left=10 @@ -35,11 +42,11 @@ Bottom=7 [Menu] Font=Sans 10 -NormalColor=@fg0@ +NormalColor=${colors.fg0} Spacing=3 [Menu/Background] -Color=@background@ +Color=${background} [Menu/Background/Margin] Left=2 @@ -54,7 +61,7 @@ Top=2 Bottom=2 [Menu/Highlight] -Color=@highlight@ +Color=${highlight} [Menu/Highlight/Margin] Left=10 @@ -63,7 +70,7 @@ Top=5 Bottom=5 [Menu/Separator] -Color=@highlight@ +Color=${highlight} [Menu/CheckBox] Image=radio.png @@ -76,3 +83,4 @@ Left=5 Right=5 Top=5 Bottom=5 +'' diff --git a/flake.lock b/flake.lock index 5e10b6b..1377feb 100644 --- a/flake.lock +++ b/flake.lock @@ -8,11 +8,11 @@ "utils": "utils" }, "locked": { - "lastModified": 1674556204, - "narHash": "sha256-HCRmkZsq01h2Evch08zpgE9jeHdMtGdT1okWotyvuhY=", + "lastModified": 1674250603, + "narHash": "sha256-SBolFspxBHpW3hCCDNAFXUiO2mucmkVmf17UmSIK3Cs=", "owner": "nix-community", "repo": "home-manager", - "rev": "c59f0eac51da91c6989fd13a68e156f63c0e60b6", + "rev": "275ab728912006eecb549338a50f24f294a7cfb7", "type": "github" }, "original": { @@ -23,11 +23,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1674459583, - "narHash": "sha256-L0UZl/u2H3HGsrhN+by42c5kNYeKtdmJiPzIRvEVeiM=", + "lastModified": 1674120619, + "narHash": "sha256-xLT1FQl7/jNPOEq5q/vmc3AExt1V9LtcjM+QY2+MUpA=", "owner": "nixos", "repo": "nixpkgs", - "rev": "1b1f50645af2a70dc93eae18bfd88d330bfbcf7f", + "rev": "d7705c01ef0a39c8ef532d1033bace8845a07d35", "type": "github" }, "original": { diff --git a/hosts/desktop.nix b/hosts/desktop.nix index a63fdbe..002cd0b 100644 --- a/hosts/desktop.nix +++ b/hosts/desktop.nix @@ -1,7 +1,7 @@ { config, pkgs, lib, ... }: let - theme = import ../theme; + colors = import ../colors; in { services = { @@ -13,9 +13,9 @@ in enable = true; greeters.gtk = { enable = true; - theme = theme.gtkTheme pkgs; + theme = colors.gtkTheme pkgs; }; - background = ../wallpapers/${theme.wallpaper}; + background = ../wallpapers/${colors.wallpaper}; }; defaultSession = "none+i3"; }; @@ -32,7 +32,7 @@ in environment.sessionVariables = { # GTK Theme won't display with GTK4 (e.g. nautilus) otherwise # Doesn't work in some scenarios, such as open containing folder in Firefox, when declared in home.sessionVariables - GTK_THEME = (theme.gtkTheme pkgs).name; + GTK_THEME = (colors.gtkTheme pkgs).name; }; # Enable OpenTabletDriver, GUI configurator is otd-gui diff --git a/hosts/home.nix b/hosts/home.nix index 38081c9..69f05db 100644 --- a/hosts/home.nix +++ b/hosts/home.nix @@ -1,7 +1,7 @@ { config, pkgs, user, ... }: let - theme = import ../theme; + colors = import ../colors; in { imports = [ @@ -19,7 +19,7 @@ in ../emacs ]; - home.file."./.background-image".source = ../wallpapers/${theme.wallpaper}; + home.file."./.background-image".source = ../wallpapers/${colors.wallpaper}; programs.home-manager.enable = true; @@ -49,8 +49,8 @@ in gtk = { enable = true; - iconTheme = theme.gtkIconTheme pkgs; - theme = theme.gtkTheme pkgs; + iconTheme = colors.gtkIconTheme pkgs; + theme = colors.gtkTheme pkgs; gtk3 = { bookmarks = let home = "file://${config.home.homeDirectory}/"; @@ -114,7 +114,7 @@ in inkscape obs-studio qbittorrent - pureref + (pkgs.callPackage ../pureref.nix { }) libreoffice gnome.ghex tudu diff --git a/i3.nix b/i3.nix index ed79147..a215b8f 100644 --- a/i3.nix +++ b/i3.nix @@ -1,9 +1,9 @@ { pkgs, lib, ... }: let - theme = import ./theme; + colors = import ./colors; mod = "Mod4"; -in with theme.colors; { +in { # Dependencies home.packages = with pkgs; [ playerctl # pactl comes with PulseAudio @@ -19,8 +19,8 @@ in with theme.colors; { showStartupLaunchMessage = false; showHelp = false; showSidePanelButton = false; - uiColor = "${bg1}"; - contrastUiColor = "${bg0}"; + uiColor = "${colors.bg1}"; + contrastUiColor = "${colors.bg0}"; drawColor = "#ffffff"; }; }; @@ -37,25 +37,25 @@ in with theme.colors; { }; colors = { focused = { - border = "${bg1}"; - background = "${bg1}"; - text = "${fg0}"; - indicator = "${undefined}"; - childBorder = "${undefined}"; + border = "${colors.bg1}"; + background = "${colors.bg1}"; + text = "${colors.fg0}"; + indicator = "${colors.undefined}"; + childBorder = "${colors.undefined}"; }; focusedInactive = { - border = "${bg1}"; - background = "${bg1}"; - text = "${fg0}"; - indicator = "${undefined}"; - childBorder = "${undefined}"; + border = "${colors.bg1}"; + background = "${colors.bg1}"; + text = "${colors.fg0}"; + indicator = "${colors.undefined}"; + childBorder = "${colors.undefined}"; }; unfocused = { - border = "${bg0}"; - background = "${bg0}"; - text = "${fg0}"; - indicator = "${undefined}"; - childBorder = "${undefined}"; + border = "${colors.bg0}"; + background = "${colors.bg0}"; + text = "${colors.fg0}"; + indicator = "${colors.undefined}"; + childBorder = "${colors.undefined}"; }; }; startup = [ diff --git a/polybar/default.nix b/polybar/default.nix index c0fcf6d..e7bbd33 100644 --- a/polybar/default.nix +++ b/polybar/default.nix @@ -1,8 +1,8 @@ { pkgs, lib, ... }: let - theme = import ../theme; -in with theme.colors; + colors = import ../colors; +in { # Dependencies home.packages = with pkgs; [ @@ -21,15 +21,15 @@ in with theme.colors; tray-position = "right"; font-0 = "Noto Sans Mono;2"; font-1 = "M+ 2p;2"; - background = "${bg0}"; - foreground = "${fg0}"; + background = "${colors.bg0}"; + foreground = "${colors.fg0}"; width = "100%"; height = "24pt"; line-size = "3pt"; padding-right = 1; module-margin = 1; separator = "|"; - separator-foreground = "${disabled}"; + separator-foreground = "${colors.disabled}"; cursor-click = "pointer"; cursor-scroll = "ns-resize"; modules-left = [ @@ -51,16 +51,16 @@ in with theme.colors; "module/xworkspaces" = { type = "internal/xworkspaces"; - label-active-background = "${bg1}"; - label-active-underline = "${primary}"; + label-active-background = "${colors.bg1}"; + label-active-underline = "${colors.primary}"; label-active-padding-right = 1; label-occupied-padding-right = 1; - label-urgent-background = "${alert}"; + label-urgent-background = "${colors.alert}"; label-urgent-padding-right = 1; - label-empty-foreground = "${disabled}"; + label-empty-foreground = "${colors.disabled}"; label-empty-padding-right = 1; }; "module/xwindow" = { @@ -88,18 +88,18 @@ in with theme.colors; interval = 25; mount-0 = "/"; - label-mounted = "%{F${primary}}%mountpoint%%{F-} %percentage_used%%"; + label-mounted = "%{F${colors.primary}}%mountpoint%%{F-} %percentage_used%%"; label-unmounted = "%mountpoint% not mounted"; - label-unmounted-foreground = "${disabled}"; + label-unmounted-foreground = "${colors.disabled}"; }; "module/pulseaudio" = { type = "internal/pulseaudio"; format-volume-prefix = "VOL "; - format-volume-prefix-foreground = "${primary}"; + format-volume-prefix-foreground = "${colors.primary}"; label-muted = "muted"; - label-muted-foreground = "${disabled}"; + label-muted-foreground = "${colors.disabled}"; }; "module/memory" = { type = "internal/memory"; @@ -107,7 +107,7 @@ in with theme.colors; interval = 2; format-prefix = "RAM "; - format-prefix-foreground = "${primary}"; + format-prefix-foreground = "${colors.primary}"; }; "module/cpu" = { type = "internal/cpu"; @@ -115,7 +115,7 @@ in with theme.colors; interval = 2; format-prefix = "CPU "; - format-prefix-foreground = "${primary}"; + format-prefix-foreground = "${colors.primary}"; }; "module/date" = { type = "internal/date"; @@ -125,7 +125,7 @@ in with theme.colors; date = "%H:%M"; date-alt = "%Y-%m-%d %H:%M:%S"; - label-foreground = "${primary}"; + label-foreground = "${colors.primary}"; }; }; }; diff --git a/pureref.nix b/pureref.nix new file mode 100644 index 0000000..5a0774a --- /dev/null +++ b/pureref.nix @@ -0,0 +1,25 @@ +{ lib, appimageTools, requireFile }: + +appimageTools.wrapType1 rec { + pname = "pureref"; + version = "1.11.1"; + + src = requireFile { + name = "PureRef-${version}_x64.Appimage"; + sha256 = "05naywdgykqrsgc3xybskr418cyvbx7vqs994yv9w8zf98gxvbvm"; + url = "https://www.pureref.com/download.php"; + }; + + extraInstallCommands = '' + mv $out/bin/${pname}-${version} $out/bin/${pname} + ''; + + meta = with lib; { + description = "Reference Image Viewer"; + homepage = "https://www.pureref.com"; + license = licenses.unfree; + maintainers = with maintainers; [ elnudev ]; + platforms = [ "x86_64-linux" ]; + sourceProvenance = [ lib.sourceTypes.binaryNativeCode ]; + }; +} diff --git a/rofi/default.nix b/rofi/default.nix index 527740e..a1948be 100644 --- a/rofi/default.nix +++ b/rofi/default.nix @@ -1,8 +1,8 @@ { pkgs, ... }: let - _theme = import ../theme; - theme = _theme.theme; # Theme name + colors = import ../colors; + theme = colors.theme; in { home.packages = with pkgs; [ (pkgs.callPackage ./power.nix { }) @@ -14,5 +14,5 @@ in { }; home.file.".config/rofi/${theme}.rasi".source = pkgs.substituteAll ({ src = ./theme.rasi; - } // _theme.colors); + } // colors.colors); } diff --git a/startpage/default.nix b/startpage/default.nix index 535e343..18fdde6 100644 --- a/startpage/default.nix +++ b/startpage/default.nix @@ -1,7 +1,7 @@ { pkgs, lib, ... }: let - theme = import ../theme; + colors = import ../colors; startpageDir = import ./dir.nix; out = "${startpageDir}.tmp/"; in @@ -11,7 +11,7 @@ in source = ./html; recursive = true; }; - "${out}colors.css".text = ":root {\n" + (theme.css lib) + "\n}"; + "${out}colors.css".text = ":root {\n" + (colors.css lib) + "\n}"; }; # Make files not symlinks, this causes issues displaying in Firefox home.activation.startpage = lib.hm.dag.entryAfter["writeBoundary"] '' diff --git a/terminal.nix b/terminal.nix index 96c9e89..c92ef6f 100644 --- a/terminal.nix +++ b/terminal.nix @@ -1,13 +1,13 @@ { ... }: let - theme = import ./theme; + colors = import ./colors; in { programs.kitty = { enable = true; # https://github.com/kovidgoyal/kitty-themes/blob/master/themes.json - theme = "${theme.kitty-theme}"; + theme = "${colors.kitty-theme}"; font = { name = "FiraCode Nerd Font Mono"; size = 12;