mirror of
https://github.com/harivansh-afk/nix.git
synced 2026-04-15 06:04:42 +00:00
feat: init dynamic wallpaper ($theme gen)
This commit is contained in:
parent
38c096dbc1
commit
af19b1e78b
6 changed files with 489 additions and 11 deletions
|
|
@ -14,7 +14,12 @@ in
|
|||
++ lib.optionals hostConfig.isDarwin (builtins.attrValues customScripts.darwinPackages);
|
||||
|
||||
home.activation.initializeThemeState = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
||||
mkdir -p "${customScripts.theme.paths.stateDir}" "${customScripts.theme.paths.fzfDir}" "${customScripts.theme.paths.ghosttyDir}" "${customScripts.theme.paths.tmuxDir}"
|
||||
mkdir -p "${customScripts.theme.paths.stateDir}" \
|
||||
"${customScripts.theme.paths.fzfDir}" \
|
||||
"${customScripts.theme.paths.ghosttyDir}" \
|
||||
"${customScripts.theme.paths.tmuxDir}" \
|
||||
"${customScripts.theme.paths.lazygitDir}" \
|
||||
"${customScripts.theme.wallpapers.dir}"
|
||||
|
||||
if [[ -f "${customScripts.theme.paths.stateFile}" ]]; then
|
||||
mode=$(tr -d '[:space:]' < "${customScripts.theme.paths.stateFile}")
|
||||
|
|
@ -28,17 +33,43 @@ in
|
|||
fzf_target="${customScripts.theme.paths.fzfDir}/cozybox-light"
|
||||
ghostty_target="${customScripts.theme.paths.ghosttyDir}/cozybox-light"
|
||||
tmux_target="${customScripts.tmuxConfigs.light}"
|
||||
lazygit_target="${customScripts.theme.paths.lazygitDir}/config-light.yml"
|
||||
;;
|
||||
*)
|
||||
printf '%s\n' "${customScripts.theme.defaultMode}" > "${customScripts.theme.paths.stateFile}"
|
||||
fzf_target="${customScripts.theme.paths.fzfDir}/cozybox-dark"
|
||||
ghostty_target="${customScripts.theme.paths.ghosttyDir}/cozybox-dark"
|
||||
tmux_target="${customScripts.tmuxConfigs.dark}"
|
||||
lazygit_target="${customScripts.theme.paths.lazygitDir}/config-dark.yml"
|
||||
;;
|
||||
esac
|
||||
|
||||
ln -sfn "$fzf_target" "${customScripts.theme.paths.fzfCurrentFile}"
|
||||
ln -sfn "$ghostty_target" "${customScripts.theme.paths.ghosttyCurrentFile}"
|
||||
ln -sfn "$tmux_target" "${customScripts.theme.paths.tmuxCurrentFile}"
|
||||
ln -sfn "$lazygit_target" "${customScripts.theme.paths.lazygitCurrentFile}"
|
||||
${lib.optionalString hostConfig.isDarwin ''
|
||||
lg_darwin="${config.home.homeDirectory}/Library/Application Support/lazygit"
|
||||
mkdir -p "$lg_darwin"
|
||||
case "$mode" in
|
||||
light) ln -sfn "$lg_darwin/config-light.yml" "$lg_darwin/config.yml" ;;
|
||||
*) ln -sfn "$lg_darwin/config-dark.yml" "$lg_darwin/config.yml" ;;
|
||||
esac
|
||||
''}
|
||||
|
||||
# seed wallpapers from static assets if no generated ones exist yet
|
||||
if [[ ! -f "${customScripts.theme.wallpapers.dark}" ]]; then
|
||||
cp "${customScripts.theme.wallpapers.staticDark}" "${customScripts.theme.wallpapers.dark}"
|
||||
fi
|
||||
if [[ ! -f "${customScripts.theme.wallpapers.light}" ]]; then
|
||||
cp "${customScripts.theme.wallpapers.staticLight}" "${customScripts.theme.wallpapers.light}"
|
||||
fi
|
||||
|
||||
# ensure wallpaper symlink points to active mode
|
||||
case "$mode" in
|
||||
light) wp_target="${customScripts.theme.wallpapers.light}" ;;
|
||||
*) wp_target="${customScripts.theme.wallpapers.dark}" ;;
|
||||
esac
|
||||
ln -sfn "$wp_target" "${customScripts.theme.wallpapers.current}"
|
||||
'';
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue