mirror of
https://github.com/harivansh-afk/nix.git
synced 2026-04-15 05:02:10 +00:00
feat: lazygit theme
This commit is contained in:
parent
a7acd0fb2d
commit
36f0e7d863
5 changed files with 84 additions and 23 deletions
|
|
@ -10,23 +10,3 @@ gui:
|
||||||
showRandomTip: false
|
showRandomTip: false
|
||||||
splitDiff: auto
|
splitDiff: auto
|
||||||
border: rounded
|
border: rounded
|
||||||
theme:
|
|
||||||
activeBorderColor:
|
|
||||||
- "#b8bb26"
|
|
||||||
- bold
|
|
||||||
inactiveBorderColor:
|
|
||||||
- "#504945"
|
|
||||||
selectedLineBgColor:
|
|
||||||
- "#3c3836"
|
|
||||||
optionsTextColor:
|
|
||||||
- "#fabd2f"
|
|
||||||
selectedRangeBgColor:
|
|
||||||
- "#504945"
|
|
||||||
cherryPickedCommitBgColor:
|
|
||||||
- "#689d6a"
|
|
||||||
cherryPickedCommitFgColor:
|
|
||||||
- "#282828"
|
|
||||||
unstagedChangesColor:
|
|
||||||
- "#fb4934"
|
|
||||||
defaultFgColor:
|
|
||||||
- "#ebdbb2"
|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,19 @@
|
||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
hostConfig,
|
hostConfig,
|
||||||
|
theme,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
let
|
||||||
|
baseConfig = builtins.readFile ../config/lazygit/config.yml;
|
||||||
|
mkFullConfig = mode: baseConfig + theme.renderLazygit mode;
|
||||||
|
in
|
||||||
{
|
{
|
||||||
xdg.configFile."lazygit/config.yml".source = ../config/lazygit/config.yml;
|
xdg.configFile."lazygit/config-dark.yml".text = mkFullConfig "dark";
|
||||||
|
xdg.configFile."lazygit/config-light.yml".text = mkFullConfig "light";
|
||||||
|
|
||||||
home.file = lib.mkIf hostConfig.isDarwin {
|
home.file = lib.mkIf hostConfig.isDarwin {
|
||||||
"Library/Application Support/lazygit/config.yml".source = ../config/lazygit/config.yml;
|
"Library/Application Support/lazygit/config-dark.yml".text = mkFullConfig "dark";
|
||||||
|
"Library/Application Support/lazygit/config-light.yml".text = mkFullConfig "light";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,8 @@ let
|
||||||
ghosttyCurrentFile = "${config.xdg.configHome}/ghostty/themes/cozybox-current";
|
ghosttyCurrentFile = "${config.xdg.configHome}/ghostty/themes/cozybox-current";
|
||||||
tmuxDir = "${config.xdg.configHome}/tmux/theme";
|
tmuxDir = "${config.xdg.configHome}/tmux/theme";
|
||||||
tmuxCurrentFile = "${config.xdg.configHome}/tmux/theme/current.conf";
|
tmuxCurrentFile = "${config.xdg.configHome}/tmux/theme/current.conf";
|
||||||
|
lazygitDir = "${config.xdg.configHome}/lazygit";
|
||||||
|
lazygitCurrentFile = "${config.xdg.configHome}/lazygit/config.yml";
|
||||||
};
|
};
|
||||||
|
|
||||||
themes = {
|
themes = {
|
||||||
|
|
@ -191,6 +193,59 @@ let
|
||||||
zstyle ':prompt:pure:user:root' color '${c.error}'
|
zstyle ':prompt:pure:user:root' color '${c.error}'
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
renderLazygit =
|
||||||
|
mode:
|
||||||
|
let
|
||||||
|
c =
|
||||||
|
if mode == "light" then
|
||||||
|
{
|
||||||
|
activeBorder = "#427b58";
|
||||||
|
inactiveBorder = "#c3c7c9";
|
||||||
|
selectedLineBg = "#e1e1e1";
|
||||||
|
optionsText = "#b57614";
|
||||||
|
selectedRangeBg = "#c3c7c9";
|
||||||
|
cherryPickedBg = "#427b58";
|
||||||
|
cherryPickedFg = "#e7e7e7";
|
||||||
|
unstaged = "#c5524a";
|
||||||
|
defaultFg = "#3c3836";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
activeBorder = "#b8bb26";
|
||||||
|
inactiveBorder = "#504945";
|
||||||
|
selectedLineBg = "#3c3836";
|
||||||
|
optionsText = "#fabd2f";
|
||||||
|
selectedRangeBg = "#504945";
|
||||||
|
cherryPickedBg = "#689d6a";
|
||||||
|
cherryPickedFg = "#282828";
|
||||||
|
unstaged = "#fb4934";
|
||||||
|
defaultFg = "#ebdbb2";
|
||||||
|
};
|
||||||
|
in
|
||||||
|
''
|
||||||
|
gui:
|
||||||
|
theme:
|
||||||
|
activeBorderColor:
|
||||||
|
- "${c.activeBorder}"
|
||||||
|
- bold
|
||||||
|
inactiveBorderColor:
|
||||||
|
- "${c.inactiveBorder}"
|
||||||
|
selectedLineBgColor:
|
||||||
|
- "${c.selectedLineBg}"
|
||||||
|
optionsTextColor:
|
||||||
|
- "${c.optionsText}"
|
||||||
|
selectedRangeBgColor:
|
||||||
|
- "${c.selectedRangeBg}"
|
||||||
|
cherryPickedCommitBgColor:
|
||||||
|
- "${c.cherryPickedBg}"
|
||||||
|
cherryPickedCommitFgColor:
|
||||||
|
- "${c.cherryPickedFg}"
|
||||||
|
unstagedChangesColor:
|
||||||
|
- "${c.unstaged}"
|
||||||
|
defaultFgColor:
|
||||||
|
- "${c.defaultFg}"
|
||||||
|
'';
|
||||||
|
|
||||||
batTheme = mode: if mode == "light" then "gruvbox-light" else "gruvbox-dark";
|
batTheme = mode: if mode == "light" then "gruvbox-light" else "gruvbox-dark";
|
||||||
|
|
||||||
deltaTheme = mode: if mode == "light" then "gruvbox-light" else "gruvbox-dark";
|
deltaTheme = mode: if mode == "light" then "gruvbox-light" else "gruvbox-dark";
|
||||||
|
|
@ -263,6 +318,7 @@ in
|
||||||
paths
|
paths
|
||||||
renderFzf
|
renderFzf
|
||||||
renderGhostty
|
renderGhostty
|
||||||
|
renderLazygit
|
||||||
renderPurePrompt
|
renderPurePrompt
|
||||||
renderTmux
|
renderTmux
|
||||||
renderZshHighlights
|
renderZshHighlights
|
||||||
|
|
|
||||||
|
|
@ -102,6 +102,14 @@ let
|
||||||
"@TMUX_DARK_FILE@" = "${tmuxConfigs.dark}";
|
"@TMUX_DARK_FILE@" = "${tmuxConfigs.dark}";
|
||||||
"@TMUX_LIGHT_FILE@" = "${tmuxConfigs.light}";
|
"@TMUX_LIGHT_FILE@" = "${tmuxConfigs.light}";
|
||||||
"@TMUX_CONFIG@" = "${config.xdg.configHome}/tmux/tmux.conf";
|
"@TMUX_CONFIG@" = "${config.xdg.configHome}/tmux/tmux.conf";
|
||||||
|
"@LAZYGIT_DIR@" = theme.paths.lazygitDir;
|
||||||
|
"@LAZYGIT_CURRENT_FILE@" = theme.paths.lazygitCurrentFile;
|
||||||
|
"@LAZYGIT_DARK_FILE@" = "${theme.paths.lazygitDir}/config-dark.yml";
|
||||||
|
"@LAZYGIT_LIGHT_FILE@" = "${theme.paths.lazygitDir}/config-light.yml";
|
||||||
|
"@LAZYGIT_DARWIN_DIR@" = "${config.home.homeDirectory}/Library/Application Support/lazygit";
|
||||||
|
"@LAZYGIT_DARWIN_FILE@" = "${config.home.homeDirectory}/Library/Application Support/lazygit/config.yml";
|
||||||
|
"@LAZYGIT_DARWIN_DARK_FILE@" = "${config.home.homeDirectory}/Library/Application Support/lazygit/config-dark.yml";
|
||||||
|
"@LAZYGIT_DARWIN_LIGHT_FILE@" = "${config.home.homeDirectory}/Library/Application Support/lazygit/config-light.yml";
|
||||||
"@WALLPAPER_DARK_FILE@" = "${theme.wallpapers.dark}";
|
"@WALLPAPER_DARK_FILE@" = "${theme.wallpapers.dark}";
|
||||||
"@WALLPAPER_LIGHT_FILE@" = "${theme.wallpapers.light}";
|
"@WALLPAPER_LIGHT_FILE@" = "${theme.wallpapers.light}";
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ link_mode_assets() {
|
||||||
fzf_target="@FZF_DARK_FILE@"
|
fzf_target="@FZF_DARK_FILE@"
|
||||||
ghostty_target="@GHOSTTY_DARK_FILE@"
|
ghostty_target="@GHOSTTY_DARK_FILE@"
|
||||||
tmux_target="@TMUX_DARK_FILE@"
|
tmux_target="@TMUX_DARK_FILE@"
|
||||||
|
lazygit_target="@LAZYGIT_DARK_FILE@"
|
||||||
wallpaper="@WALLPAPER_DARK_FILE@"
|
wallpaper="@WALLPAPER_DARK_FILE@"
|
||||||
apple_dark_mode=true
|
apple_dark_mode=true
|
||||||
;;
|
;;
|
||||||
|
|
@ -33,6 +34,7 @@ link_mode_assets() {
|
||||||
fzf_target="@FZF_LIGHT_FILE@"
|
fzf_target="@FZF_LIGHT_FILE@"
|
||||||
ghostty_target="@GHOSTTY_LIGHT_FILE@"
|
ghostty_target="@GHOSTTY_LIGHT_FILE@"
|
||||||
tmux_target="@TMUX_LIGHT_FILE@"
|
tmux_target="@TMUX_LIGHT_FILE@"
|
||||||
|
lazygit_target="@LAZYGIT_LIGHT_FILE@"
|
||||||
wallpaper="@WALLPAPER_LIGHT_FILE@"
|
wallpaper="@WALLPAPER_LIGHT_FILE@"
|
||||||
apple_dark_mode=false
|
apple_dark_mode=false
|
||||||
;;
|
;;
|
||||||
|
|
@ -42,17 +44,25 @@ link_mode_assets() {
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
mkdir -p "@STATE_DIR@" "@FZF_DIR@" "@GHOSTTY_DIR@" "@TMUX_DIR@"
|
mkdir -p "@STATE_DIR@" "@FZF_DIR@" "@GHOSTTY_DIR@" "@TMUX_DIR@" "@LAZYGIT_DIR@"
|
||||||
printf '%s\n' "$mode" > "@STATE_FILE@"
|
printf '%s\n' "$mode" > "@STATE_FILE@"
|
||||||
ln -sfn "$fzf_target" "@FZF_CURRENT_FILE@"
|
ln -sfn "$fzf_target" "@FZF_CURRENT_FILE@"
|
||||||
ln -sfn "$ghostty_target" "@GHOSTTY_CURRENT_FILE@"
|
ln -sfn "$ghostty_target" "@GHOSTTY_CURRENT_FILE@"
|
||||||
ln -sfn "$tmux_target" "@TMUX_CURRENT_FILE@"
|
ln -sfn "$tmux_target" "@TMUX_CURRENT_FILE@"
|
||||||
|
ln -sfn "$lazygit_target" "@LAZYGIT_CURRENT_FILE@"
|
||||||
|
|
||||||
if command -v tmux >/dev/null 2>&1 && tmux start-server >/dev/null 2>&1; then
|
if command -v tmux >/dev/null 2>&1 && tmux start-server >/dev/null 2>&1; then
|
||||||
tmux source-file "@TMUX_CONFIG@" >/dev/null 2>&1 || true
|
tmux source-file "@TMUX_CONFIG@" >/dev/null 2>&1 || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$(uname -s)" == "Darwin" ]] && command -v osascript >/dev/null 2>&1; then
|
if [[ "$(uname -s)" == "Darwin" ]] && command -v osascript >/dev/null 2>&1; then
|
||||||
|
mkdir -p "@LAZYGIT_DARWIN_DIR@"
|
||||||
|
if [[ "$mode" == "dark" ]]; then
|
||||||
|
ln -sfn "@LAZYGIT_DARWIN_DARK_FILE@" "@LAZYGIT_DARWIN_FILE@"
|
||||||
|
else
|
||||||
|
ln -sfn "@LAZYGIT_DARWIN_LIGHT_FILE@" "@LAZYGIT_DARWIN_FILE@"
|
||||||
|
fi
|
||||||
|
|
||||||
osascript -e "tell application \"System Events\" to tell appearance preferences to set dark mode to ${apple_dark_mode}" >/dev/null 2>&1 || true
|
osascript -e "tell application \"System Events\" to tell appearance preferences to set dark mode to ${apple_dark_mode}" >/dev/null 2>&1 || true
|
||||||
|
|
||||||
osascript -e "tell application \"System Events\" to tell every desktop to set picture to \"${wallpaper}\"" >/dev/null 2>&1 || true
|
osascript -e "tell application \"System Events\" to tell every desktop to set picture to \"${wallpaper}\"" >/dev/null 2>&1 || true
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue