Skip to content

Commit

Permalink
feat(chezmoi): get wallpaper from init input
Browse files Browse the repository at this point in the history
  • Loading branch information
scottames committed Nov 16, 2024
1 parent 6fcd252 commit 02e5b94
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/pr_chezmoi_init.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,18 @@ jobs:
- name: Extract branch name
shell: bash
run: |
echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" \
>> "${GITHUB_OUTPUT}"
id: extract_branch
- name: Run chezmoi init in container
# yamllint disable-line rule:line-length
uses: addnab/docker-run-action@4f65fabd2431ebc8d299f8e5a018d79a769ae185 # v3
with:
# https://github.com/scottames/boxes
image: ghcr.io/scottames/fedora-toolbox:latest
# yamllint disable-line rule:line-length
options: -v ${{ github.workspace }}:/home/container/src/github.com/scottames/dots/main
run: |
/home/container/src/github.com/scottames/dots/main/scripts/init.sh \
--no-tty --branch "${{ steps.extract_branch.outputs.branch }}"
--no-tty --branch "${{ steps.extract_branch.outputs.branch }}" \
--promptDefaults
13 changes: 7 additions & 6 deletions home/.chezmoi.toml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
{{- $osVersion := "" -}}
{{- $ublueImageInfo := "" -}}
{{- $useGitWorktrees := true -}}
{{- $wallpaper := "" -}}

{{- if $useGitWorktrees -}}
{{- $dotsStr = printf "%s/main" $dotsStr -}}
Expand Down Expand Up @@ -101,13 +102,13 @@ output "sh" "-c" "printf '[email protected]' | md5sum - | cut -d' ' -f1"
{{- $srcDir := printf "%s/src" .chezmoi.homeDir -}}
{{- $srcGitHubDir := printf "%s/github.com/%s" $srcDir $githubUser -}}
{{- $dots := printf "%s/%s" $srcGitHubDir $dotsStr -}}
{{- /* TODO: get from user input */ -}}
{{-
$wallpaper := printf
"%s/walls/main/wide/foggy-peaks-valley_catppuccin-oled_16_GaussianV1_0_20_512.png"
$srcGitHubDir
-}}
{{- $chezmoiSourceDir := printf "%s/home" $dots -}}
{{- if lstat (joinPath .chezmoi.homeDir ".wallpaper") -}}
{{- $wallpaper = trim (include (printf "%s/.wallpaper" .chezmoi.homeDir)) -}}
{{- else -}}
{{- $wallpaperDefault := "/usr/share/backgrounds/gnome/adwaita-d.jxl" -}}
{{- $wallpaper = promptStringOnce . "desktop.wallpaper" "path to desktop wallpaper" $wallpaperDefault -}}
{{- end -}}

sourceDir = "{{ $chezmoiSourceDir }}"
progress = true
Expand Down
1 change: 1 addition & 0 deletions home/dot_wallpaper.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{ .desktop.wallpaper }}

0 comments on commit 02e5b94

Please sign in to comment.