diff --git a/TODO.md b/TODO.md index 79ba836..ee7efc2 100644 --- a/TODO.md +++ b/TODO.md @@ -1,3 +1,8 @@ +### TODO + +- Make startpage fully generic for both Nord and Everforest +- Fix rofi transparency issue + ### Needs checking - Fix issue where wireless connection dies after suspend, even after restarting NetworkManager: not an issue on T430, still problem on X220? diff --git a/colors/default.nix b/colors/default.nix index 2c93fe5..7e8d926 100644 --- a/colors/default.nix +++ b/colors/default.nix @@ -1,4 +1,8 @@ +let + theme = import ./everforest; +in { undefined = "#ff00ff"; - foreground-bright = "#ffffff"; -} // import ./everforest + fg1 = "#ffffff"; + css = lib: lib.strings.concatStringsSep "\n" (lib.attrValues (lib.mapAttrs (k: v: " --${k}: ${v};") theme.colors)); +} // theme // theme.colors diff --git a/colors/everforest/default.nix b/colors/everforest/default.nix index 97e46f9..a5b4ce5 100644 --- a/colors/everforest/default.nix +++ b/colors/everforest/default.nix @@ -10,10 +10,13 @@ }; wallpaper = "306286.jpg"; - background = "#1e2326"; - background-alt = "#272e33"; - foreground = "#d3c6aa"; - primary = "#a7c080"; - alert = "#e67e80"; - disabled = "#2e383c"; + colors = { + bg0 = "#1e2326"; + bg1 = "#272e33"; + bg2 = "#2e383c"; + fg0 = "#d3c6aa"; + primary = "#a7c080"; + alert = "#e67e80"; + disabled = "#2e383c"; + }; } diff --git a/colors/nord/default.nix b/colors/nord/default.nix index 39806a8..af7f861 100644 --- a/colors/nord/default.nix +++ b/colors/nord/default.nix @@ -7,10 +7,13 @@ }; gtkIconTheme = pkgs: null; - background = "#2e3440"; - background-alt = "#3b4252"; - foreground = "#eceff4"; - primary = "#8fbcbb"; - alert = "#bf616a"; - disabled = "#434c5e"; + colors = { + bg0 = "#2e3440"; + bg1 = "#3b4252"; + bg2 = "#434c53"; + fg0 = "#eceff4"; + primary = "#8fbcbb"; + alert = "#bf616a"; + disabled = "#434c5e"; + }; } diff --git a/fcitx5/theme.nix b/fcitx5/theme.nix index b1705c7..764db5d 100644 --- a/fcitx5/theme.nix +++ b/fcitx5/theme.nix @@ -1,8 +1,8 @@ # Modified from https://github.com/tonyfettes/fcitx5-nord let colors = import ../colors; - background = "${colors.background-alt}80"; - highlight = "${colors.background}"; + background = "${colors.bg1}80"; + highlight = "${colors.bg0}"; in '' [Metadata] @@ -10,8 +10,8 @@ ScaleWithDPI=True [InputPanel] Font=Sans 13 -NormalColor=${colors.foreground} -HighlightCandidateColor=${colors.foreground-bright}; +NormalColor=${colors.fg0} +HighlightCandidateColor=${colors.fg1}; HighlightColor=${colors.undefined} HighlightBackgroundColor=${colors.undefined} Spacing=3 @@ -42,7 +42,7 @@ Bottom=7 [Menu] Font=Sans 10 -NormalColor=${colors.foreground} +NormalColor=${colors.fg0} Spacing=3 [Menu/Background] diff --git a/firefox.nix b/firefox.nix new file mode 100644 index 0000000..85bd2c5 --- /dev/null +++ b/firefox.nix @@ -0,0 +1,48 @@ +{ user, ... }: + +let + startpageDir = import ./startpage/dir.nix; + startpage = "file:///home/${user}/${startpageDir}/index.html"; +in +{ + nixpkgs = { + config.allowUnfree = true; + overlays = [ + (self: super: { + firefox = super.firefox.overrideAttrs (oa: { + buildCommand = oa.buildCommand + '' + cd lib/firefox + mkdir -p defaults/pref + cat > defaults/pref/autoconfig.js << 'EOL' + // + pref("general.config.filename", "autoconfig.cfg"); + pref("general.config.obscure_value", 0); + pref("general.config.sandbox_enabled", false); + EOL + cat > autoconfig.cfg << 'EOL' + // + var {classes:Cc,interfaces:Ci,utils:Cu} = Components; + + /* set new tab page */ + try { + Cu.import("resource:///modules/AboutNewTab.jsm"); + var newTabURL = "${startpage}"; + AboutNewTab.newTabURL = newTabURL; + } catch(e){Cu.reportError(e);} // report errors in the Browser Console + EOL + ''; + }); + }) + ]; + }; + + programs.firefox = { + enable = true; + profiles.${user} = { + isDefault = true; + settings = { + "browser.startup.homepage" = "${startpage}"; + }; + }; + }; +} diff --git a/hosts/default.nix b/hosts/default.nix index f3eed93..7b9e7f6 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -25,7 +25,6 @@ in } home-manager.nixosModules.home-manager { home-manager = { - useGlobalPkgs = true; useUserPackages = true; extraSpecialArgs = { inherit user; }; users.${user} = { @@ -52,7 +51,6 @@ in } home-manager.nixosModules.home-manager { home-manager = { - useGlobalPkgs = true; useUserPackages = true; extraSpecialArgs = { inherit user; }; users.${user} = { @@ -78,7 +76,6 @@ in } home-manager.nixosModules.home-manager { home-manager = { - useGlobalPkgs = true; useUserPackages = true; extraSpecialArgs = { inherit user; }; users.${user} = { diff --git a/hosts/desktop.nix b/hosts/desktop.nix index d4492e1..e95debc 100644 --- a/hosts/desktop.nix +++ b/hosts/desktop.nix @@ -1,4 +1,4 @@ -{ config, pkgs, ... }: +{ config, pkgs, lib, ... }: let colors = import ../colors; diff --git a/hosts/home.nix b/hosts/home.nix index 05d40a9..53e88f3 100644 --- a/hosts/home.nix +++ b/hosts/home.nix @@ -5,8 +5,7 @@ let in { imports = [ - ../neovim - ../ranger.nix + ../neovim ../ranger.nix ../fcitx5 ../picom.nix ../i3.nix @@ -14,6 +13,8 @@ in ../rofi ../git.nix ../terminal.nix + ../startpage + ../firefox.nix ]; home.file."./.background-image".source = ../wallpapers/${colors.wallpaper}; @@ -71,7 +72,7 @@ in #(pkgs.callPackage ../colors/everforest/gtk.nix {}) # GUI applications - firefox + #firefox discord gnome.nautilus gnome.file-roller diff --git a/i3.nix b/i3.nix index cf98fa0..1b32968 100644 --- a/i3.nix +++ b/i3.nix @@ -19,8 +19,8 @@ in { showStartupLaunchMessage = false; showHelp = false; showSidePanelButton = false; - uiColor = "${colors.background-alt}"; - contrastUiColor = "${colors.background}"; + uiColor = "${colors.bg1}"; + contrastUiColor = "${colors.bg0}"; drawColor = "#ffffff"; }; }; @@ -38,23 +38,23 @@ in { }; colors = { focused = { - border = "${colors.background-alt}"; - background = "${colors.background-alt}"; - text = "${colors.foreground}"; + border = "${colors.bg1}"; + background = "${colors.bg1}"; + text = "${colors.fg0}"; indicator = "${colors.undefined}"; childBorder = "${colors.undefined}"; }; focusedInactive = { - border = "${colors.background-alt}"; - background = "${colors.background-alt}"; - text = "${colors.foreground}"; + border = "${colors.bg1}"; + background = "${colors.bg1}"; + text = "${colors.fg0}"; indicator = "${colors.undefined}"; childBorder = "${colors.undefined}"; }; unfocused = { - border = "${colors.background}"; - background = "${colors.background}"; - text = "${colors.foreground}"; + border = "${colors.bg0}"; + background = "${colors.bg0}"; + text = "${colors.fg0}"; indicator = "${colors.undefined}"; childBorder = "${colors.undefined}"; }; diff --git a/polybar/default.nix b/polybar/default.nix index 999197d..fd13fa8 100644 --- a/polybar/default.nix +++ b/polybar/default.nix @@ -22,8 +22,8 @@ in tray-position = "right"; font-0 = "Noto Sans Mono;2"; font-1 = "Noto Sans CJK JP;2"; - background = "${colors.background}"; - foreground = "${colors.foreground}"; + background = "${colors.bg0}"; + foreground = "${colors.fg0}"; width = "100%"; height = "24pt"; line-size = "3pt"; @@ -52,7 +52,7 @@ in "module/xworkspaces" = { type = "internal/xworkspaces"; - label-active-background = "${colors.background-alt}"; + label-active-background = "${colors.bg1}"; label-active-underline = "${colors.primary}"; label-active-padding-right = 1; diff --git a/rofi/theme.nix b/rofi/theme.nix index 5389da9..3e04f6b 100644 --- a/rofi/theme.nix +++ b/rofi/theme.nix @@ -18,7 +18,7 @@ configuration { * { background-color: transparent; - highlight: underline bold ${colors.foreground-bright}; + highlight: underline bold ${colors.fg1}; } window { @@ -40,16 +40,16 @@ mainbox { } message { - color: ${colors.background}; + color: ${colors.bg0}; padding: 5; - border-color: ${colors.foreground}; + border-color: ${colors.fg0}; border: 0px 2px 2px 2px; } inputbar { - color: ${colors.foreground}; + color: ${colors.fg0}; padding: 11px; - background-color: ${colors.background-alt}; + background-color: ${colors.bg1}; } entry, prompt, case-indicator { @@ -64,19 +64,19 @@ prompt { listview { padding: 8px; border: 0; - background-color: ${colors.background}e5; + background-color: ${colors.bg0}e5; dynamic: false; } element { padding: 3px; border-radius: 4px; - text-color: ${colors.foreground}; + text-color: ${colors.fg0}; } element selected.normal { background-color: ${colors.primary}; - text-color: ${colors.background}; + text-color: ${colors.bg0}; } element-text, element-icon { diff --git a/startpage/.gitignore b/startpage/.gitignore new file mode 100644 index 0000000..96f5ffd --- /dev/null +++ b/startpage/.gitignore @@ -0,0 +1,3 @@ +# Link in generate colors file for testing +# ln -s ~/.startpage/colors.css . +colors.css diff --git a/startpage/anilist.svg b/startpage/anilist.svg new file mode 100644 index 0000000..fc387bc --- /dev/null +++ b/startpage/anilist.svg @@ -0,0 +1,66 @@ + + + + + + + + + + + diff --git a/startpage/default.nix b/startpage/default.nix new file mode 100644 index 0000000..f7fdfbb --- /dev/null +++ b/startpage/default.nix @@ -0,0 +1,29 @@ +{ pkgs, lib, ... }: + +let + colors = import ../colors; + startpageDir = import ./dir.nix; + out = "${startpageDir}.tmp/"; +in +{ + home.file = { + "${out}index.html".source = ./index.html; + "${out}colors.css".text = ":root {\n" + (colors.css lib) + "\n}"; + "${out}style.css".source = ./style.css; + "${out}anilist.svg".source = ./anilist.svg; + "${out}envelope-regular.svg".source = ./envelope-regular.svg; + "${out}git.svg".source = ./git.svg; + "${out}jellyfin.svg".source = ./jellyfin.svg; + "${out}nyaa.webp".source = ./nyaa.webp; + }; + # Make files not symlinks, this causes issues displaying in Firefox + home.activation.startpage = lib.hm.dag.entryAfter["writeBoundary"] '' + mkdir -p ${startpageDir} + mv ${out}* ${startpageDir} + rmdir ${out} + cd ${startpageDir} + for file in `find -type l`; do + cp --remove-destination `readlink $file` $file + done + ''; +} diff --git a/startpage/dir.nix b/startpage/dir.nix new file mode 100644 index 0000000..fa1c054 --- /dev/null +++ b/startpage/dir.nix @@ -0,0 +1 @@ +".startpage" diff --git a/startpage/envelope-regular.svg b/startpage/envelope-regular.svg new file mode 100644 index 0000000..14ff1de --- /dev/null +++ b/startpage/envelope-regular.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/startpage/git.svg b/startpage/git.svg new file mode 100644 index 0000000..c62b18c --- /dev/null +++ b/startpage/git.svg @@ -0,0 +1,41 @@ + + + + + + diff --git a/startpage/index.html b/startpage/index.html new file mode 100644 index 0000000..fda5a42 --- /dev/null +++ b/startpage/index.html @@ -0,0 +1,34 @@ + + + + + + + + +
+
+ AniList + Jellyfin + Nyaa + Git + + + + +
+
+ + + diff --git a/startpage/jellyfin.svg b/startpage/jellyfin.svg new file mode 100644 index 0000000..e0fb708 --- /dev/null +++ b/startpage/jellyfin.svg @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + diff --git a/startpage/nyaa.webp b/startpage/nyaa.webp new file mode 100644 index 0000000..7e31fa9 Binary files /dev/null and b/startpage/nyaa.webp differ diff --git a/startpage/style.css b/startpage/style.css new file mode 100644 index 0000000..2ae3ab4 --- /dev/null +++ b/startpage/style.css @@ -0,0 +1,115 @@ +:root { + --red: #e67e80; + --red-bg: #4c3743; + --orange: #e69875; + --orange-bg: #493b40; + --yellow: #dbbc7f; + --yellow-bg: #45443c; + --green: #a7c080; + --green-bg: #3c4841; + --aqua: #83c092; + --aqua-bg: var(--green-bg); + --blue: #7fbbb3; + --blue-bg: #384b55; +} + +.red { + --highlight: var(--red-bg); + --outline: var(--red); +} + +.orange { + --highlight: var(--orange-bg); + --outline: var(--orange); +} + +.yellow { + --highlight: var(--yellow-bg); + --outline: var(--yellow); +} + +.green { + --highlight: var(--green-bg); + --outline: var(--green); +} + +.aqua { + --highlight: var(--aqua-bg); + --outline: var(--aqua); +} + +.blue { + --highlight: var(--blue-bg); + --outline: var(--blue); +} + +body { + background: var(--bg1); + color: var(--fg0); + font-size: 1.5em; + display: flex; + align-items: center; + justify-content: center; + height: 100vh; + margin: 0; +} + +#content { + width: 40em; + max-height: 100vh; + margin: 1em; +} + +#cards { + display: grid; + gap: 1rem; + grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); + grid-auto-rows: 1fr; +} + +#cards::before { + content: ''; + width: 0; + padding-bottom: 100%; + grid-row: 1 / 1; + grid-column: 1 / 1; +} + +#cards > *:first-child{ + grid-row: 1 / 1; + grid-column: 1 / 1; +} + +#cards > * { + color: inherit; + text-decoration: none; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + background: linear-gradient(var(--bg2), var(--bg2), var(--highlight, var(--bg2))); + font-size: 2em; + outline: 1px solid var(--outline, var(--bg0)); + border-radius: 2px; + transition: 0.25s transform; +} + +#cards > * > * { + color: white; + display: inline; + height: 1em; +} + +#cards > :hover, #cards > :focus { + outline-width: 2px; + outline-color: var(--outline); +} + +#cards > :focus { + background: var(--highlight); + transform: translateY(-0.25rem); +} + +#cards > :hover *, #cards > :focus * { + font-size: 1.0625em; +}