all repos — nixfiles @ e73ff2535a3b0c5fe837ea439003961b4c5c87d4

System and user configuration, managed by nix and home-manager

move Apple Terminal theme switcher to per-term function

Alin
commit

e73ff2535a3b0c5fe837ea439003961b4c5c87d4

parent

0deb085c8fd582166a39e01656c2933974d74acd

1 file changed, 42 insertions(+), 0 deletions(-)

changed files
A user/settings/fish/per-term/set-terminal-theme.applescript
@@ -0,0 +1,42 @@
+#!/usr/bin/env osascript +use scripting additions + +to getSystemAppearance() + tell application "System Events" + set isDark to dark mode of appearance preferences + end tell + + if isDark then + return "dark" + else + return "light" + end if +end getSystemAppearance + +to setTerminalProfile(targetProfile) + tell application "Terminal" + set default settings to settings set targetProfile + set startup settings to settings set targetProfile + + repeat with existingWindow in windows + set current settings of existingWindow to settings set targetProfile + end repeat + end tell +end setTerminalProfile + +on run argv + set lightProfile to "Flexoki Light" + set darkProfile to "Flexoki Dark" + + if length of argv is 0 then + set targetMode to getSystemAppearance() + else + set targetMode to item 1 of argv + end if + + if targetMode = "dark" then + setTerminalProfile(darkProfile) + else + setTerminalProfile(lightProfile) + end if +end run