From 3cd390bb1cff2947d87ff28e7c77d3775e08fe8f Mon Sep 17 00:00:00 2001 From: Swarsel Date: Thu, 11 Jul 2024 11:11:30 +0200 Subject: [PATCH] feat: add tridactyl configuration to NixOS --- SwarselSystems.org | 12 ++ profiles/common/home.nix | 6 + programs/firefox/chrome/userChrome.css | 83 ++++++++++ .../tridactyl/themes/base16-codeschool.css | 153 ++++++++++++++++++ programs/firefox/tridactyl/tridactylrc | 36 +++++ 5 files changed, 290 insertions(+) create mode 100644 programs/firefox/chrome/userChrome.css create mode 100644 programs/firefox/tridactyl/themes/base16-codeschool.css create mode 100644 programs/firefox/tridactyl/tridactylrc diff --git a/SwarselSystems.org b/SwarselSystems.org index b9dc885..eb59bec 100644 --- a/SwarselSystems.org +++ b/SwarselSystems.org @@ -5660,6 +5660,17 @@ As for the `home.sessionVariables`, it should be noted that environment variable #+end_src +Also, we link some files to the users XDG configuration home: + +#+begin_src nix :tangle profiles/common/home.nix + + xdg.configFile = { + "tridactyl/tridactylrc".source = ../../programs/firefox/tridactyl/tridactylrc; + "tridactyl/themes/base16-codeschool.css".source = ../../programs/firefox/tridactyl/themes/base16-codeschool.css; + }; + +#+end_src + *** Sourcing environment variables :PROPERTIES: :CUSTOM_ID: h:4486b02f-4fb8-432b-bfa2-2e786206341d @@ -6704,6 +6715,7 @@ I used to build the firefox addon =bypass-paywalls-clean= myself here, but the m }; profiles.default = { isDefault = true; + userChrome = (builtins.readFile ../../programs/firefox/chrome/userChrome.css); extensions = with pkgs.nur.repos.rycee.firefox-addons; [ tridactyl browserpass diff --git a/profiles/common/home.nix b/profiles/common/home.nix index 6c6006f..35922af 100644 --- a/profiles/common/home.nix +++ b/profiles/common/home.nix @@ -499,6 +499,11 @@ home.file = { }; }; +xdg.configFile = { + "tridactyl/tridactylrc".source = ../../programs/firefox/tridactyl/tridactylrc; + "tridactyl/themes/base16-codeschool.css".source = ../../programs/firefox/tridactyl/themes/base16-codeschool.css; + }; + home.sessionVariables = { EDITOR = "bash ~/.dotfiles/scripts/editor.sh"; }; @@ -1370,6 +1375,7 @@ programs.firefox = { }; profiles.default = { isDefault = true; + userChrome = (builtins.readFile ../../programs/firefox/chrome/userChrome.css); extensions = with pkgs.nur.repos.rycee.firefox-addons; [ tridactyl browserpass diff --git a/programs/firefox/chrome/userChrome.css b/programs/firefox/chrome/userChrome.css new file mode 100644 index 0000000..74e851d --- /dev/null +++ b/programs/firefox/chrome/userChrome.css @@ -0,0 +1,83 @@ +/* Source file https://github.com/MrOtherGuy/firefox-csshacks/tree/master/chrome/autohide_toolbox.css made available under Mozilla Public License v. 2.0 +See the above repository for updates as well as full license text. */ + +/* Hide the whole toolbar area unless urlbar is focused or cursor is over the toolbar */ +/* Dimensions on non-Win10 OS probably needs to be adjusted */ + +/* Compatibility options for hide_tabs_toolbar.css and tabs_on_bottom.css at the end of this file */ + +:root{ + --uc-autohide-toolbox-delay: 200ms; /* Wait 0.1s before hiding toolbars */ + --uc-toolbox-rotation: 82deg; /* This may need to be lower on mac - like 75 or so */ +} + +:root[sizemode="maximized"]{ + --uc-toolbox-rotation: 88.5deg; +} + +@media (-moz-platform: windows){ + :root:not([lwtheme]) #navigator-toolbox{ background-color: -moz-dialog !important; } +} + +:root[sizemode="fullscreen"], +:root[sizemode="fullscreen"] #navigator-toolbox{ margin-top: 0 !important; } + +#navigator-toolbox{ + position: fixed !important; + display: block; + background-color: var(--lwt-accent-color,black) !important; + transition: transform 82ms linear, opacity 82ms linear !important; + transition-delay: var(--uc-autohide-toolbox-delay) !important; + transform-origin: top; + transform: rotateX(var(--uc-toolbox-rotation)); + opacity: 0; + line-height: 0; + z-index: 1; + pointer-events: none; +} + +#navigator-toolbox:hover, +#navigator-toolbox:focus-within{ + transition-delay: 33ms !important; + transform: rotateX(0); + opacity: 1; +} +/* This ruleset is separate, because not having :has support breaks other selectors as well */ +#mainPopupSet:has(> #appMenu-popup:hover) ~ toolbox{ + transition-delay: 33ms !important; + transform: rotateX(0); + opacity: 1; +} + +#navigator-toolbox > *{ line-height: normal; pointer-events: auto } + +#navigator-toolbox, +#navigator-toolbox > *{ + width: 100vw; + -moz-appearance: none !important; +} + +/* These two exist for oneliner compatibility */ +#nav-bar{ width: var(--uc-navigationbar-width,100vw) } +#TabsToolbar{ width: calc(100vw - var(--uc-navigationbar-width,0px)) } + +/* Don't apply transform before window has been fully created */ +:root:not([sessionrestored]) #navigator-toolbox{ transform:none !important } + +:root[customizing] #navigator-toolbox{ + position: relative !important; + transform: none !important; + opacity: 1 !important; +} + +#navigator-toolbox[inFullscreen] > #PersonalToolbar, +#PersonalToolbar[collapsed="true"]{ display: none } + +/* Uncomment this if tabs toolbar is hidden with hide_tabs_toolbar.css */ + /*#titlebar{ margin-bottom: -9px }*/ + +/* Uncomment the following for compatibility with tabs_on_bottom.css - this isn't well tested though */ +/* +#navigator-toolbox{ flex-direction: column; display: flex; } +#titlebar{ order: 2 } +*/ diff --git a/programs/firefox/tridactyl/themes/base16-codeschool.css b/programs/firefox/tridactyl/themes/base16-codeschool.css new file mode 100644 index 0000000..6e478bd --- /dev/null +++ b/programs/firefox/tridactyl/themes/base16-codeschool.css @@ -0,0 +1,153 @@ +:root { /* Codeschool by Chris Kempson (http://chriskempson.com) */ + --base00: #232c31; + --base01: #1c3657; + --base02: #2a343a; + --base03: #3f4944; + --base04: #84898c; + --base05: #9ea7a6; + --base06: #a7cfa3; + --base07: #b5d8f6; + --base08: #2a5491; + --base09: #43820d; + --base0A: #a03b1e; + --base0B: #237986; + --base0C: #b02f30; + --base0D: #484d79; + --base0E: #c59820; + --base0F: #c98344; + + --tridactyl-fg: var(--base05); + --tridactyl-bg: var(--base00); + --tridactyl-url-fg: var(--base08); + --tridactyl-url-bg: var(--base00); + --tridactyl-highlight-box-bg: var(--base0B); + --tridactyl-highlight-box-fg: var(--base00); + + /* Hint character tags */ + --tridactyl-hintspan-fg: var(--base00) !important; + --tridactyl-hintspan-bg: var(--base0A) !important; + + /* Element Highlights */ + --tridactyl-hint-active-fg: none; + --tridactyl-hint-active-bg: none; + --tridactyl-hint-active-outline: none; + --tridactyl-hint-bg: none; + --tridactyl-hint-outline: none; +} + +#command-line-holder { order: 1; + border: 2px solid var(--base0B); + color: var(--tridactyl-bg); +} + +#tridactyl-input { padding: 1rem; + color: var(--tridactyl-fg); + width: 90%; + font-size: 1.5rem; + line-height: 1.5; + background: var(--tridactyl-bg); + padding-left: unset; + padding: 1rem; +} + +#completions table { font-size: 0.8rem; + font-weight: 200; + border-spacing: 0; + table-layout: fixed; + padding: 1rem; + padding-top: 1rem; + padding-bottom: 1rem; +} + +#completions > div { max-height: calc(20 * var(--option-height)); + min-height: calc(10 * var(--option-height)); +} + +/* COMPLETIONS */ + +#completions { --option-height: 1.4em; + color: var(--tridactyl-fg); + background: var(--tridactyl-bg); + display: inline-block; + font-size: unset; + font-weight: 200; + overflow: hidden; + width: 100%; + border-top: unset; + order: 2; +} + +/* Olie doesn't know how CSS inheritance works */ +#completions .HistoryCompletionSource { max-height: unset; + min-height: unset; +} + +#completions .HistoryCompletionSource table { width: 100%; + font-size: 9pt; + border-spacing: 0; + table-layout: fixed; +} + +/* redundancy 2: redundancy 2: more redundancy */ +#completions .BmarkCompletionSource { max-height: unset; + min-height: unset; +} + +#completions table tr td.prefix,#completions table tr td.privatewindow,#completions table tr td.container,#completions table tr td.icon { display: none; +} + +#completions .BufferCompletionSource table { width: unset; + font-size: unset; + border-spacing: unset; + table-layout: unset; +} + +#completions table tr .title { width: 50%; +} + +#completions table tr { white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +#completions .sectionHeader { background: unset; + font-weight: 200; + border-bottom: unset; + padding: 1rem !important; + padding-left: unset; + padding-bottom: 0.2rem; +} + +#cmdline_iframe { position: fixed !important; + bottom: unset; + top: 25% !important; + left: 10% !important; + z-index: 2147483647 !important; + width: 80% !important; + box-shadow: rgba(0, 0, 0, 0.5) 0px 0px 20px !important; +} + +.TridactylStatusIndicator { position: fixed !important; + bottom: 0 !important; + background: var(--tridactyl-bg) !important; + border: unset !important; + border: 1px var(--base0B) solid !important; + font-size: 12pt !important; + /*font-weight: 200 !important;*/ + padding: 0.8ex !important; +} + +#completions .focused { background: var(--base0B); + color: var(--base00); +} + +#completions .focused .url { background: var(--base0B); + color: var(--base00); +} +/* #Ocean-normal { */ +/* border-color: green !important; */ +/* } */ + +/* #Ocean-insert { */ +/* border-color: yellow !important; */ +/* } */ diff --git a/programs/firefox/tridactyl/tridactylrc b/programs/firefox/tridactyl/tridactylrc new file mode 100644 index 0000000..3e03089 --- /dev/null +++ b/programs/firefox/tridactyl/tridactylrc @@ -0,0 +1,36 @@ +sanitise tridactyllocal tridactylsync + +colourscheme base16-codeschool + +" General Settings +set update.lastchecktime 1720629386560 +set update.lastnaggedversion 1.24.1 +set update.nag true +set update.nagwait 7 +set update.checkintervalsecs 86400 +set configversion 2.0 +set searchurls.no https://search.nixos.org/options?query= +set searchurls.np https://search.nixos.org/packages?query= +set searchurls.hm https://home-manager-options.extranix.com/?query= +set hintfiltermode vimperator-reflow +set hintnames numeric + +" Binds +bind gd tabdetach +bind gD composite tabduplicate; tabdetach +bind d composite tabprev; tabclose # +bind D tabclose +bind c hint +bindurl ^http(s)?://www\.google\.com c hint -Jc [class="LC20lb MBeuO DKV0Md"],[class="YmvwI"],[class="YyVfkd"],[class="fl"] +bindurl ^http(s)?://www\.google\.com gi composite focusinput -l ; text.end_of_line + +" Subconfig Settings +seturl www.google.com followpagepatterns.next Next +seturl www.google.com followpagepatterns.prev Previous + +" Autocmds +autocmd DocStart undefined mode ignore +autocmd DocStart pokerogue.net mode ignore + +" For syntax highlighting see https://github.com/tridactyl/vim-tridactyl +" vim: set filetype=tridactyl