Add theme-set/switching logic, and minor nvim, tmux, obsidian changes
This commit is contained in:
26
src_files/.local/scripts/theme-update-wallpaper
Executable file
26
src_files/.local/scripts/theme-update-wallpaper
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/bin/zsh
|
||||
|
||||
|
||||
set_wallpaper_linux() {
|
||||
echo "TODO: theme_update_wallpaper_linux not yet implemented"
|
||||
}
|
||||
|
||||
set_wallpaper_macos() {
|
||||
# after back and forth with gpt and failing approaches, landing on this swift snippet
|
||||
swift <(cat << NESTED_SWIFT_BLOCK
|
||||
import AppKit
|
||||
let url = URL(fileURLWithPath: "$1")
|
||||
try NSWorkspace.shared.setDesktopImageURL(url, for: NSScreen.main!, options: [:])
|
||||
NESTED_SWIFT_BLOCK
|
||||
)
|
||||
}
|
||||
|
||||
# TODO: decide if and how to make this work for cycling through wallpapers per theme
|
||||
|
||||
wallpaper_dir=$DIR_THEME_SETTINGS/.current-theme/wallpaper
|
||||
image_paths=($(find $wallpaper_dir -type f | sort)) 2> /dev/null
|
||||
target_wallpaper=${image_paths[@]:0:1}
|
||||
[[ -z $target_wallpaper ]] && exit 0
|
||||
|
||||
[[ "$OSTYPE" = *"darwin"* ]] && set_wallpaper_macos $target_wallpaper ||
|
||||
set_wallpaper_linux $target_wallpaper
|
||||
Reference in New Issue
Block a user