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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aJYwg-M1q1qA8Mb-wP%@2uzyW&*b_s{jU07reCk?E@}HI+a8pTId8DM zoT;EH>p|e1%%}AX4Ob>H`2BhJ+3J_o7sk*Zp$`H)8YlPHTraJ)KUK{*_0GG)>_vfH zH}{DjTY6{rn(w@m3_b;~w=TW5@xRrMjGfy1w%+HJTO+smQ|xN{t=FWD>+65`6)RL8 znDO+SpT};U$r5@Fd;TB%X8v#a-gcSH>FK>%MgIb$5;wf?xbgK6GuN9v4?aAOzIpO@ zq;6>Fi*(U{=}`;s2S_XAdNH~0&kos}Z)bakMe*e-EvEBQS#x32@;uoJLl(EW8^bfw{7(M-G=~VSgE=&G6D-1}8CEuI{9=6>O=ci-B#-dpI9&u3~Jt&!Ei8aUyh-kbQOUh$Z{ z3%0#cUU+)KxesUm1#|^^Ke;5eYS$0>HXhr90W%pGO1LL;b$Tpq4>jSeZBvLl|3P~9 zZTYC1r!LE^Z#(k-pzGO3IwD_=#C#NO%l@(aZ{o$um;6_!ReumQj6ZVHfR(dgcA}_- z$@UrQJt-PVH*%{#y`5by!lnG2Ya{nzqqgm3WsB#(Q93f=Q9_HEv;1M7Hd&tS5^+W~ ZwY-P*qifHmO2qAX5y%r9ul9(Q0RS)uOS=F7 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; +}