Home

dotnix @main - refs - log -
-
https://git.jolheiser.com/dotnix.git
My nix dotfiles
tree log patch
feat: omp->nix Signed-off-by: jolheiser <git@jolheiser.com>
Signature
-----BEGIN SSH SIGNATURE----- U1NIU0lHAAAAAQAAADMAAAALc3NoLWVkMjU1MTkAAAAgBTEvCQk6VqUAdN2RuH6bj1dNkY oOpbPWj+jw4ua1B1cAAAADZ2l0AAAAAAAAAAZzaGE1MTIAAABTAAAAC3NzaC1lZDI1NTE5 AAAAQDH2jkoNdbExHZWdlOhl50nbsS85jMV7vlYAFqgVaGJjiVIA6Kla6iMIj5SYL3gJr1 qg9xXIJRIVWbP+ELc/+gE= -----END SSH SIGNATURE-----
jolheiser <git@jolheiser.com>
4 weeks ago
3 changed files, 150 additions(+), 96 deletions(-)
M apps/nogui/nushell/config.nu -> apps/nogui/nushell/config.nu
diff --git a/apps/nogui/nushell/config.nu b/apps/nogui/nushell/config.nu
index 7a387c767183f4545bcd1760c8e48b6dc08b6af3..fadb6cea7d9cf88242428421f9515d5b9aa8d5f5 100644
--- a/apps/nogui/nushell/config.nu
+++ b/apps/nogui/nushell/config.nu
@@ -393,7 +393,7 @@     metric: true # true => KB, MB, GB (ISO standard), false => KiB, MiB, GiB (Windows standard)
     format: "auto" # b, kb, kib, mb, mib, gb, gib, tb, tib, pb, pib, eb, eib, zb, zib, auto
   }
   color_config: $dark_theme   # if you want a light theme, replace `$dark_theme` to `$light_theme`
-  footer_mode: "25" # always, never, number_of_rows, auto
+  footer_mode: 25 # always, never, number_of_rows, auto
   float_precision: 2
   # buffer_editor: "emacs" # command that will be used to edit the current line buffer with ctrl+o, if unset fallback to $env.EDITOR and $env.VISUAL
   use_ansi_coloring: true
M apps/nogui/oh-my-posh.nix -> apps/nogui/oh-my-posh.nix
diff --git a/apps/nogui/oh-my-posh.nix b/apps/nogui/oh-my-posh.nix
index b1848ce3615998f896ad013b5a671565fe4363fd..67b396d2f395abda49e504437e12c219ab59c5b6 100644
--- a/apps/nogui/oh-my-posh.nix
+++ b/apps/nogui/oh-my-posh.nix
@@ -1,8 +1,157 @@
+{ pkgs, ... }:
 {
+  unicode = x: builtins.fromJSON ''"${x}"'';
+{
   programs.oh-my-posh = {
+{
     enable = true;
+{
     settings = builtins.fromJSON (
+{
       builtins.unsafeDiscardStringContext (builtins.readFile ./ohmyposh/config.json)
+      let
+        bookmarkMax = 10;
+        tagMax = 10;
+        descriptionMax = 24;
+      in
+      ''
+        jj log -r@ -n1 --ignore-working-copy --no-graph --color never -T '
+                separate(" ",
+                  bookmarks.map(|x| if(
+                    x.name().substr(0, ${builtins.toString bookmarkMax}).starts_with(x.name()),
+                    "󰃀 " ++ x.name().substr(0, ${builtins.toString bookmarkMax}),
+                    "󰃀 " ++ x.name().substr(0, ${builtins.toString (bookmarkMax - 1)}) ++ "…")
+                  ).join(" "),
+                  tags.map(|x| if(
+                    x.name().substr(0, ${builtins.toString tagMax}).starts_with(x.name()),
+                    "󰓹 " ++ x.name().substr(0, ${builtins.toString tagMax}),
+                    "󰓹 " ++ x.name().substr(0, ${builtins.toString (tagMax - 1)}) ++ "…")
+                  ).join(" "),
+                  if(
+                    description.first_line().substr(0, ${builtins.toString descriptionMax}).starts_with(description.first_line()),
+                    "󰍡 " ++ description.first_line().substr(0, ${builtins.toString descriptionMax}),
+                    "󰍡 " ++ description.first_line().substr(0, ${
+                      builtins.toString (descriptionMax - 1)
+                    }) ++ "…"
+                  ),
+                  "•",
+                  change_id.shortest(),
+                  commit_id.shortest(),
+                  if(empty, "(empty)"),
+                  if(conflict, "(conflict)"),
+                  if(divergent, "(divergent)"),
+                  if(hidden, "(hidden)"),
+                )
+              '
+      '';
+  };
+in
+{
+  programs.oh-my-posh = {
+    enable = true;
+    settings = {
+      "$schema" = "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json";
+      blocks = [
+        {
+          alignment = "left";
+          segments = [
+            {
+              background = "p:lavender";
+              foreground = "p:black";
+              leading_diamond = unicode "\\ue0b6";
+              properties = {
+                display_host = false;
+              };
+              style = "diamond";
+              template = " {{ if .SSHSession }}${unicode "\\udb80\\udf18"} {{ end }}{{ if .Env.IN_NIX_SHELL }}${unicode "\\udb84\\udd05"} {{ end }}{{ .UserName }}@{{ .HostName }} ";
+              trailing_diamond = unicode "\\ue0b0";
+              type = "session";
+            }
+            {
+              background = "p:orange";
+              foreground = "p:black";
+              powerline_symbol = unicode "\\ue0b0";
+              properties = {
+                home_icon = "~";
+                style = "folder";
+              };
+              style = "powerline";
+              template = " ${unicode "\\ue613"} {{ path .Path .Location }} ";
+              type = "path";
+            }
+            {
+              background = "p:green";
+              background_templates = [
+                "{{ if or (.Working.Changed) (.Staging.Changed) }}p:yellow{{ end }}"
+                "{{ if and (gt .Ahead 0) (gt .Behind 0) }}p:red{{ end }}"
+                "{{ if gt .Ahead 0 }}#49416D{{ end }}"
+                "{{ if gt .Behind 0 }}#7A306C{{ end }}"
+              ];
+              foreground = "p:black";
+              foreground_templates = [
+                "{{ if or (.Working.Changed) (.Staging.Changed) }}p:black{{ end }}"
+                "{{ if and (gt .Ahead 0) (gt .Behind 0) }}p:white{{ end }}"
+                "{{ if gt .Ahead 0 }}p:white{{ end }}"
+              ];
+              powerline_symbol = unicode "\\ue0b0";
+              properties = {
+                branch_max_length = 25;
+                fetch_status = true;
+                fetch_upstream_icon = true;
+                git_icon = unicode "\\ue702";
+                github_icon = unicode "\\uf408";
+                upstream_icons = {
+                  "codeberg.org" = unicode "\\ue2a6";
+                  "git.jojodev.com" = unicode "\\udb83\\udd9e";
+                  "gitea.com" = unicode "\\udb83\\udd9e";
+                };
+              };
+              style = "powerline";
+              template = "{{ if not (glob \".jj\")}} {{ if .UpstreamURL }}{{ url .UpstreamIcon .UpstreamURL }} {{ end }}{{ .HEAD }}{{if .BranchStatus }} {{ .BranchStatus }}{{ end }}{{ if .Working.Changed }} ${unicode "\\uf044"} {{ .Working.String }}{{ end }}{{ if .Staging.Changed }} ${unicode "\\uf046"} {{ .Staging.String }}{{ end }} {{ end }}";
+              type = "git";
+            }
+            {
+              background = "p:green";
+              foreground = "p:black";
+              powerline_symbol = unicode "\\ue0b0";
+              properties = {
+                script = "${script}/bin/jj-prompt";
+              };
+              style = "powerline";
+              template = "{{ if (glob \".jj\")}} {{ .Output }} {{ end }}";
+              type = "command";
+            }
+            {
+              background = "p:blue";
+              background_templates = [ "{{ if gt .Code 0 }}p:red{{ end }}" ];
+              foreground = "p:black";
+              leading_diamond = "<transparent,background>${unicode "\\ue0b0"}</>";
+              properties = {
+                always_enabled = true;
+              };
+              style = "diamond";
+              template = " {{ if gt .Code 0 }}${unicode "\\uf00d"}{{ else }}${unicode "\\uf00c"}{{ end }} ";
+              trailing_diamond = unicode "\\ue0b4";
+              type = "exit";
+            }
+          ];
+          type = "prompt";
+        }
+      ];
+      console_title_template = "{{ .Folder }}";
+      final_space = true;
+      palette = {
+        black = "#1E1E1E";
+        blue = "#89B4FA";
+        green = "#A6E3A1";
+        lavender = "#B4BEFE";
+        orange = "#FAB387";
+        red = "#F38BA8";
+        white = "#CDD6F4";
+        yellow = "#F9E2AF";
+      };
+      version = 2;
+  script = pkgs.writeShellApplication {
     );
   };
 }
D apps/nogui/ohmyposh/config.json
diff --git a/apps/nogui/ohmyposh/config.json b/apps/nogui/ohmyposh/config.json
deleted file mode 100644
index 22a95bf7c8b839d9e1c1596ff13b62898210d805..0000000000000000000000000000000000000000
--- a/apps/nogui/ohmyposh/config.json
+++ /dev/null
@@ -1,95 +0,0 @@
-{
-  "$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
-  "blocks": [
-    {
-      "alignment": "left",
-      "segments": [
-        {
-          "background": "p:lavender",
-          "foreground": "p:black",
-          "leading_diamond": "\ue0b6",
-          "properties": {
-            "display_host": false
-          },
-          "style": "diamond",
-          "template": " {{ if .SSHSession }}\udb80\udf18 {{ end }}{{ if .Env.IN_NIX_SHELL }}\udb84\udd05 {{ end }}{{ .UserName }}@{{ .HostName }} ",
-          "trailing_diamond": "\ue0b0",
-          "type": "session"
-        },
-        {
-          "background": "p:orange",
-          "foreground": "p:black",
-          "powerline_symbol": "\ue0b0",
-          "properties": {
-            "home_icon": "~",
-            "style": "folder"
-          },
-          "style": "powerline",
-          "template": " \ue613 {{ path .Path .Location }} ",
-          "type": "path"
-        },
-        {
-          "background": "p:green",
-          "background_templates": [
-            "{{ if or (.Working.Changed) (.Staging.Changed) }}p:yellow{{ end }}",
-            "{{ if and (gt .Ahead 0) (gt .Behind 0) }}p:red{{ end }}",
-            "{{ if gt .Ahead 0 }}#49416D{{ end }}",
-            "{{ if gt .Behind 0 }}#7A306C{{ end }}"
-          ],
-          "foreground": "p:black",
-          "foreground_templates": [
-            "{{ if or (.Working.Changed) (.Staging.Changed) }}p:black{{ end }}",
-            "{{ if and (gt .Ahead 0) (gt .Behind 0) }}p:white{{ end }}",
-            "{{ if gt .Ahead 0 }}p:white{{ end }}"
-          ],
-          "powerline_symbol": "\ue0b0",
-          "properties": {
-            "branch_max_length": 25,
-            "fetch_status": true,
-            "fetch_upstream_icon": true,
-            "github_icon": "\uf408",
-            "git_icon": "\ue702",
-            "upstream_icons": {
-              "gitea.com": "\udb83\udd9e",
-              "git.jojodev.com": "\udb83\udd9e",
-              "codeberg.org": "\ue2a6"
-            }
-          },
-          "style": "powerline",
-          "template": "{{ if not (glob \".jj\")}} {{ if .UpstreamURL }}{{ url .UpstreamIcon .UpstreamURL }} {{ end }}{{ .HEAD }}{{if .BranchStatus }} {{ .BranchStatus }}{{ end }}{{ if .Working.Changed }} \uf044 {{ .Working.String }}{{ end }}{{ if .Staging.Changed }} \uf046 {{ .Staging.String }}{{ end }} {{ end }}",
-          "type": "git"
-        },
-        {
-          "background": "p:blue",
-          "background_templates": [
-            "{{ if gt .Code 0 }}p:red{{ end }}"
-          ],
-          "foreground": "p:black",
-          "leading_diamond": "<transparent,background>\ue0b0</>",
-          "properties": {
-            "always_enabled": true
-          },
-          "style": "diamond",
-          "template": " {{ if gt .Code 0 }}\uf00d{{ else }}\uf00c{{ end }} ",
-          "trailing_diamond": "\ue0b4",
-          "type": "exit"
-        }
-      ],
-      "type": "prompt"
-    }
-  ],
-  "console_title_template": "{{ .Folder }}",
-  "final_space": true,
-  "palette": {
-    "black": "#1E1E1E",
-    "blue": "#89B4FA",
-    "green": "#A6E3A1",
-    "orange": "#FAB387",
-    "red": "#F38BA8",
-    "white": "#CDD6F4",
-    "yellow": "#F9E2AF",
-    "lavender": "#B4BEFE"
-  },
-  "version": 2
-}
-