fish: add macOS dark mode to theme function

This commit is contained in:
Charles Gould 2025-04-24 11:16:25 -05:00
parent f2d4a91579
commit fd18985e0a

View File

@ -1,8 +1,14 @@
function theme function theme
if test (count $argv) -eq 1 if test (count $argv) -eq 1
if test "$argv[1]" = "dark" if test "$argv[1]" = "dark"
if command -q osascript
command osascript -e 'tell application "System Events" to set dark mode of appearance preferences to true'
end
fish_config theme choose "Catppuccin Frappe" fish_config theme choose "Catppuccin Frappe"
else if test "$argv[1]" = "light" else if test "$argv[1]" = "light"
if command -q osascript
command osascript -e 'tell application "System Events" to set dark mode of appearance preferences to false'
end
fish_config theme choose "Catppuccin Latte" fish_config theme choose "Catppuccin Latte"
else else
echo "Error: Invalid theme. Use 'dark' or 'light'." >&2 echo "Error: Invalid theme. Use 'dark' or 'light'." >&2