diff --git a/common/nixos.nix b/common/nixos.nix index b8a1fde..0a53864 100644 --- a/common/nixos.nix +++ b/common/nixos.nix @@ -86,9 +86,9 @@ programs.screen = { screenrc = '' - defscrollback 10000 - termcapinfo xterm* ti@:te@ - maptimeout 5 + defscrollback 10000 + termcapinfo xterm* ti@:te@ + maptimeout 5 ''; } // (if config.system.nixos.release == "23.11" then { } else { enable = true; }); diff --git a/common/shell/ps1.nix b/common/shell/ps1.nix index 6f68f73..12a0e26 100644 --- a/common/shell/ps1.nix +++ b/common/shell/ps1.nix @@ -8,6 +8,44 @@ let cfg = config.vacu.shell; # https://en.wikipedia.org/wiki/ANSI_escape_code#Colors colors = vaculib.shellColors; + + # thanks colin https://git.uninsane.org/colin/nix-files/src/commit/7f5b2628016c8ca1beec417766157c7676a9c5e5/hosts/common/programs/zsh/starship.nix#L24 + x1b = builtins.fromJSON '' "\u001b" ''; # i.e `^[` + set = opt: "${x1b}\\[?${opt}h"; + clear = opt: "${x1b}\\[?${opt}l"; + reset_without_clear = builtins.concatStringsSep "" [ + # reset terminal mode (in case the previous command screwed with it) + # 'l' = turn option of, 'h' = turn option on. + # + # options are enumerated in Alacritty's VTE library's `PrivateMode` type: + # - + # see also the reset code path (does a bit too much, like clearing the screen): + # - + # and the crucial TermMode::default: + # + # query the state of any mode bit `` with `printf '\033[?$p'` + # e.g. `printf '\033[?7$p'` returns `^[[?7;1$y` with the `1` indicating it's **set**, + # `printf '\033[?1000$p'` returns `^[[?1000;2$y` with the `2` indicating it's **unset**. + # + # TODO: unset Line mode and Insert mode? + (clear "1") # Cursor Keys + # (clear "3") # Column Mode (i.e. clear screen/history) + (clear "6") # Origin + (set "7") # Line Wrap + (clear "12") # Blinking Cursor + (set "25") # Show Cursor + (clear "1000") # Report Mouse Clicks + (clear "1002") # Report Cell Mouse Motion + (clear "1003") # Report All Mouse Motion + (clear "1004") # Report Focus In/Out + (clear "1005") # UTF8 Mouse + (clear "1006") # Sgr Mouse + (set "1007") # Alternate Scroll + (set "1042") # Urgency Hints + # (clear "1049") # Swap Screen And Set Restore Cursor + (clear "2004") # Bracketed Paste + (clear "2026") # Sync Update + ]; # https://man.archlinux.org/man/bash.1#PROMPTING # \[ and \] begins and ends "a sequence of non-printing characters" set_color = colornum: ''\[\e[1;${toString colornum}m\]''; @@ -19,6 +57,7 @@ let default_ps1 = root: ''\n'' + + reset_without_clear + (set_color colornum) + ''${root_text root}${config.vacu.shortHostName}:\w'' + (final root) diff --git a/legtop/default.nix b/legtop/default.nix index 7a3e004..1ed6542 100644 --- a/legtop/default.nix +++ b/legtop/default.nix @@ -49,6 +49,7 @@ wineWowPackages.stableFull wineWowPackages.fonts winetricks + lutris ]) ++ [ inputs.self.packages.${pkgs.system}.sm64coopdx ];