Skip to content

Commit

Permalink
Prefer absolutepath for basename except fish
Browse files Browse the repository at this point in the history
  • Loading branch information
kachick committed Aug 4, 2023
1 parent b9585e5 commit e6ce3a3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
11 changes: 9 additions & 2 deletions home-manager/bash.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ config, ... }:
{ config, lib, pkgs, ... }:

{
programs.starship.enableBashIntegration = true;
Expand Down Expand Up @@ -65,7 +65,14 @@
historyIgnore = [ "ls" "cd" "z" ];

# Extracting because embedded here requires complex escape with nix multiline.
initExtra = builtins.readFile ./initExtra.bash;
initExtra = ''
# https://github.com/starship/starship/blob/0d98c4c0b7999f5a8bd6e7db68fd27b0696b3bef/docs/uk-UA/advanced-config/README.md#change-window-title
function set_win_title() {
echo -ne "\033]0; $(${lib.getBin pkgs.coreutils}/bin/basename "$PWD") \007"
}
# shellcheck disable=SC2034
starship_precmd_user_func="set_win_title"
'' + builtins.readFile ./initExtra.bash;

logoutExtra = ''
# when leaving the console clear the screen to increase privacy
Expand Down
7 changes: 0 additions & 7 deletions home-manager/initExtra.bash
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,3 @@ xterm* | rxvt*)
*) ;;

esac

# https://github.com/starship/starship/blob/0d98c4c0b7999f5a8bd6e7db68fd27b0696b3bef/docs/uk-UA/advanced-config/README.md#change-window-title
function set_win_title() {
echo -ne "\033]0; $(basename "$PWD") \007"
}
# shellcheck disable=SC2034
starship_precmd_user_func="set_win_title"
2 changes: 1 addition & 1 deletion home-manager/zsh.nix
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
# https://github.com/starship/starship/blob/0d98c4c0b7999f5a8bd6e7db68fd27b0696b3bef/docs/uk-UA/advanced-config/README.md#change-window-title
function set_win_title() {
echo -ne "\033]0; $(basename "$PWD") \007"
echo -ne "\033]0; $(${lib.getBin pkgs.coreutils}/bin/basename "$PWD") \007"
}
precmd_functions+=(set_win_title)
Expand Down

0 comments on commit e6ce3a3

Please sign in to comment.