From bda6b363a1edd174891fd9da91132dee5c52f927 Mon Sep 17 00:00:00 2001 From: ElnuDev Date: Tue, 10 Jan 2023 20:19:20 -0800 Subject: [PATCH] Set up startpage --- TODO.md | 5 ++ colors/default.nix | 8 ++- colors/everforest/default.nix | 15 +++-- colors/nord/default.nix | 15 +++-- fcitx5/theme.nix | 10 +-- firefox.nix | 48 ++++++++++++++ hosts/default.nix | 3 - hosts/desktop.nix | 2 +- hosts/home.nix | 7 +- i3.nix | 22 +++---- polybar/default.nix | 6 +- rofi/theme.nix | 16 ++--- startpage/.gitignore | 3 + startpage/anilist.svg | 66 +++++++++++++++++++ startpage/default.nix | 29 +++++++++ startpage/dir.nix | 1 + startpage/envelope-regular.svg | 1 + startpage/git.svg | 41 ++++++++++++ startpage/index.html | 34 ++++++++++ startpage/jellyfin.svg | 89 +++++++++++++++++++++++++ startpage/nyaa.webp | Bin 0 -> 2794 bytes startpage/style.css | 115 +++++++++++++++++++++++++++++++++ 22 files changed, 488 insertions(+), 48 deletions(-) create mode 100644 firefox.nix create mode 100644 startpage/.gitignore create mode 100644 startpage/anilist.svg create mode 100644 startpage/default.nix create mode 100644 startpage/dir.nix create mode 100644 startpage/envelope-regular.svg create mode 100644 startpage/git.svg create mode 100644 startpage/index.html create mode 100644 startpage/jellyfin.svg create mode 100644 startpage/nyaa.webp create mode 100644 startpage/style.css 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 0000000000000000000000000000000000000000..7e31fa9279024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OeTvZ#j2-yBkF z??))>_^Uj?U14+xG#6t0dXEUny1|EU4#}0uJP}C^+}R~d2bFnk)(Vm%mA@@?_xF{x z$UFHzD0uWKJfx##FM=#^7=~B7CRsjTayn3q{#iC@z=4xK9!Y2p%9jeQ=T#TC5I6wN zEDjoKIUEw27f%s~UOhDcu*?P5yaWe;1b~I;8RrpM9-M~S3S2R&uZ{}<66g{vmnL51 zb|XTyVB2AQNPPDDen@=G2QYd$m-6r9q8RIak#w4lE@udiwms!NID>1y+f1O zq=6y|s|w>FiSOltkegt^UReC7vk{_lEZkYvL-z<7;#lP`kAw0=p?{#|R=%&g7(e8R za-TfFCnEAbZ8_fyiEF2Srq!O%2!Hhss}c7N)D0~a6;SH^rrls4o2kgm<&rQ1s0kXiXIy9vEq z$qMzM6`D2s_mJRG;`f0Q z8sPas8)vtD@GAGMaKnrPuJ&>_a+Dcf_i&KlQDU8s0!8s>-6#D5`s;quD^4Rl!5du9 zFsF9{aC&OsQQT?ee*l2gk^oNp?(;hOI`jcm_*LLgNP&}&eAjh-KgxRnmE7*b2Xax0 z*}fOXrQEx$_YIOT@>8!nb=I-}I=E=LE55bg4IZo>v+`Z5Keg5yGk<^hPIDl6z?kLE zPDr~flNc^Qy#K-WH~y!+ha72_XN@Xy{!vNAYeWFI#=hWf)$(=ur$)Unb%O05Atjy8r+H literal 0 HcmV?d00001 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; +}