diff options
author | makefu <github@syntax-fehler.de> | 2023-01-30 23:43:04 +0100 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2023-01-30 23:43:04 +0100 |
commit | 369fa6b7eb3f0fa3e1034bcad438eeda017949f8 (patch) | |
tree | 22f7891595fba32a7e66b755617e0d49b91993f3 /tv/5pkgs/simple | |
parent | dbc3870841223051e4f617b4c06065c168c69c10 (diff) | |
parent | c7417c8bc1b50d466dae493ac3619d9f324f34f8 (diff) |
Merge remote-tracking branch 'lass/master'
Diffstat (limited to 'tv/5pkgs/simple')
-rw-r--r-- | tv/5pkgs/simple/alacritty-tv.nix | 100 | ||||
-rwxr-xr-x | tv/5pkgs/simple/fzmenu/bin/otpmenu | 2 | ||||
-rwxr-xr-x | tv/5pkgs/simple/fzmenu/bin/passmenu | 2 | ||||
-rw-r--r-- | tv/5pkgs/simple/fzmenu/default.nix | 14 | ||||
-rw-r--r-- | tv/5pkgs/simple/iosevka-tv-1.nix | 18 |
5 files changed, 112 insertions, 24 deletions
diff --git a/tv/5pkgs/simple/alacritty-tv.nix b/tv/5pkgs/simple/alacritty-tv.nix index d80c46cbb..1c7730a71 100644 --- a/tv/5pkgs/simple/alacritty-tv.nix +++ b/tv/5pkgs/simple/alacritty-tv.nix @@ -1,4 +1,6 @@ -{ pkgs }: +{ pkgs +, variant ? "x220" +}: let lib = import ./lib; @@ -6,7 +8,7 @@ let program = "${pkgs.font-size-alacritty}/bin/font-size-alacritty"; args = [arg]; }; - config = { + configs.default = lib.recursiveUpdate variants.${variant} { bell.animation = "EaseOut"; bell.duration = 50; bell.color = "#ff00ff"; @@ -30,10 +32,6 @@ let colors.bright.cyan = "#72fbfb"; colors.bright.white = "#fbfbfb"; draw_bold_text_with_bright_colors = true; - font.normal.family = "Clean"; - font.bold.family = "Clean"; - font.bold.style = "Regular"; - font.size = 10; hints.enabled = [ { regex = "(ipfs:|ipns:|magnet:|mailto:|gemini:|gopher:|https:|http:|news:|file:|git:|ssh:|ftp:)[^\\u0000-\\u001F\\u007F-\\u009F<>\"\\s{-}\\^⟨⟩`]+"; @@ -42,15 +40,73 @@ let action = "Select"; } ]; + scrolling.multiplier = 8; + }; + configs.root = lib.recursiveUpdate configs.default { + colors.primary.background = "#230000"; + colors.primary.foreground = "#e0c0c0"; + colors.normal.black = "#800000"; + }; + configs.fzmenu = lib.recursiveUpdate configs.default { + colors.primary.background = "#2A172A"; + window.dimensions.columns = 70; + window.dimensions.lines = 9; + }; + variants.hidpi = { + font.normal.family = "iosevka-tv-1"; + font.bold.family = "iosevka-tv-1"; + font.italic.family = "iosevka-tv-1"; + font.bold_italic.family = "iosevka-tv-1"; + font.size = 5; + key_bindings = [ + { key = "Up"; mods = "Control"; action = "IncreaseFontSize"; } + { key = "Down"; mods = "Control"; action = "DecreaseFontSize"; } + { key = "Down"; mods = "Shift|Control"; action = "ResetFontSize"; } + ]; + }; + variants.x220 = { + font.normal.family = "Clean"; + font.bold.family = "Clean"; + font.bold.style = "Regular"; + font.size = 10; key_bindings = [ { key = "Up"; mods = "Shift|Control"; command = font-size "=14"; } { key = "Up"; mods = "Control"; command = font-size "+1"; } { key = "Down"; mods = "Control"; command = font-size "-1"; } { key = "Down"; mods = "Shift|Control"; command = font-size "=0"; } ]; - scrolling.multiplier = 8; }; - config-file = pkgs.writeJSON "alacritty-tv.json" config; + writeProfile = name: config: let + config-file = + assert lib.types.filename.check name; + pkgs.writeJSON "alacritty-tv-${name}.json" config; + in pkgs.writeText "alacritty-tv-${name}.profile" /* sh */ '' + # Use home so Alacritty can find the configuration without arguments. + # HOME will be reset once in Alacritty. + HOME=$XDG_RUNTIME_DIR/Alacritty-${name} + export HOME + + # Tell Alacritty via XDG_RUNTIME_DIR where to create sockets. + # XDG_RUNTIME_DIR needs to be reset manually. + export ALACRITTY_XDG_RUNTIME_DIR="$XDG_RUNTIME_DIR" + export BASH_EXTRA_INIT=${pkgs.writeDash "alacritty-tv.cleanup.sh" '' + XDG_RUNTIME_DIR=$ALACRITTY_XDG_RUNTIME_DIR + unset ALACRITTY_XDG_RUNTIME_DIR + unset BASH_EXTRA_INIT + ''} + export XDG_RUNTIME_DIR="$HOME" + + # Install stored configuration if it has changed. + # This allows for both declarative updates and runtime modifications. + # rust-xdg requires XDG_RUNTIME_DIR to be secure: + # https://docs.rs/xdg/2.4.1/src/xdg/lib.rs.html#311 + ${pkgs.coreutils}/bin/mkdir -m 0700 -p "$HOME" + ref=$(! test -e "$HOME"/ref || ${pkgs.coreutils}/bin/cat "$HOME"/ref) + if test "$ref" != ${config-file}; then + echo ${config-file} > "$HOME"/ref + ${pkgs.coreutils}/bin/cp ${config-file} "$HOME"/.alacritty.yml + fi + ''; in pkgs.symlinkJoin { @@ -58,31 +114,35 @@ pkgs.symlinkJoin { paths = [ (pkgs.writeDashBin "alacritty" '' # usage: - # alacritty [--singleton] [ARGS...] + # alacritty [--profile=PROFILE] [--singleton] [ARGS...] + # where + # PROFILE one of ${lib.toJSON (lib.attrNames configs)} set -efu - # Use home so Alacritty can find the configuration without arguments. - # HOME will be reset once in Alacritty. - HOME=$TMPDIR/Alacritty - export HOME + case ''${1-} in + ${lib.concatMapStringsSep "\n" (name: /* sh */ '' + --${lib.shell.escape name}|--profile=${lib.shell.escape name}) + shift + profile=${writeProfile name configs.${name}} + ;; + '') (lib.attrNames configs)} + *) + profile=${writeProfile "default" configs.default} + ;; + esac - # Install stored configuration if it has changed. - # This allows for both declarative updates and runtime modifications. - ${pkgs.coreutils}/bin/mkdir -p "$HOME" - if test "$(${pkgs.coreutils}/bin/cat "$HOME"/ref)" != ${config-file}; then - echo ${config-file} > "$HOME"/ref - ${pkgs.coreutils}/bin/cp ${config-file} "$HOME"/.alacritty.yml - fi case ''${1-} in --singleton) shift if ! ${pkgs.alacritty}/bin/alacritty msg create-window "$@"; then + . "$profile" ${pkgs.alacritty}/bin/alacritty "$@" & fi ;; *) + . "$profile" exec ${pkgs.alacritty}/bin/alacritty "$@" ;; esac diff --git a/tv/5pkgs/simple/fzmenu/bin/otpmenu b/tv/5pkgs/simple/fzmenu/bin/otpmenu index ad8a0fda9..12bd60a9d 100755 --- a/tv/5pkgs/simple/fzmenu/bin/otpmenu +++ b/tv/5pkgs/simple/fzmenu/bin/otpmenu @@ -6,7 +6,7 @@ set -efu case ${FZMENU_PHASE-0} in 0) export FZMENU_PHASE=1 - exec setsid -f urxvt -name fzmenu-urxvt -e dash "$0" + exec setsid -f terminal dash "$0" ;; 1) if result=$( diff --git a/tv/5pkgs/simple/fzmenu/bin/passmenu b/tv/5pkgs/simple/fzmenu/bin/passmenu index 00b36c3af..da8e739ee 100755 --- a/tv/5pkgs/simple/fzmenu/bin/passmenu +++ b/tv/5pkgs/simple/fzmenu/bin/passmenu @@ -6,7 +6,7 @@ set -efu case ${FZMENU_PHASE-0} in 0) export FZMENU_PHASE=1 - exec setsid -f urxvt -name fzmenu-urxvt -e dash "$0" + exec setsid -f terminal dash "$0" ;; 1) if result=$( diff --git a/tv/5pkgs/simple/fzmenu/default.nix b/tv/5pkgs/simple/fzmenu/default.nix index 634d8338b..7e19505c1 100644 --- a/tv/5pkgs/simple/fzmenu/default.nix +++ b/tv/5pkgs/simple/fzmenu/default.nix @@ -1,5 +1,15 @@ { lib, pkgs, stdenv }: +let + terminal = pkgs.writeDashBin "terminal" '' + # usage: terminal COMMAND [ARGS...] + exec ${pkgs.alacritty-tv}/bin/alacritty \ + --profile=fzmenu \ + --class AlacrittyFzmenuFloat \ + -e "$@" + ''; +in + pkgs.runCommand "fzmenu" { } /* sh */ '' mkdir $out @@ -16,9 +26,9 @@ pkgs.runCommand "fzmenu" { (pkgs.pass.withExtensions (ext: [ ext.pass-otp ])) - pkgs.rxvt_unicode pkgs.utillinux pkgs.xdotool + terminal ]} substituteInPlace $out/bin/passmenu \ @@ -31,8 +41,8 @@ pkgs.runCommand "fzmenu" { (pkgs.pass.withExtensions (ext: [ ext.pass-otp ])) - pkgs.rxvt_unicode pkgs.utillinux pkgs.xdotool + terminal ]} '' diff --git a/tv/5pkgs/simple/iosevka-tv-1.nix b/tv/5pkgs/simple/iosevka-tv-1.nix new file mode 100644 index 000000000..f72565bc7 --- /dev/null +++ b/tv/5pkgs/simple/iosevka-tv-1.nix @@ -0,0 +1,18 @@ +{ pkgs }: + +pkgs.iosevka.override { + # https://typeof.net/Iosevka/customizer + privateBuildPlan = { + family = "iosevka-tv-1"; + spacing = "term"; + serifs = "sans"; + export-glyph-names = true; + no-ligation = true; + no-cv-ss = false; + + widths.normal.shape = 600; + widths.normal.menu = 5; + widths.normal.css = "normal"; + }; + set = "iosevka-tv-1"; +} |