Function: auto-dark--is-dark-mode-powershell

auto-dark--is-dark-mode-powershell is a natively compiled function defined in auto-dark.el.

Signature

(auto-dark--is-dark-mode-powershell)

Documentation

Invoke PowerShell and detect dark mode.

Compatible with both bash pure output and zsh mixed output.

Source Code

;; Defined in /nix/store/fxsazwcy8jcsigjhcydkb81ip47xqcw0-emacs-packages-deps/share/emacs/site-lisp/elpa/auto-dark-20260313.2356/auto-dark.el
(defun auto-dark--is-dark-mode-powershell ()
  "Invoke PowerShell and detect dark mode.
Compatible with both bash pure output and zsh mixed output."
  (let* ((raw-output
          (shell-command-to-string
           "powershell.exe -noprofile -noninteractive -nologo -ex bypass -command \
Get-ItemPropertyValue 'HKCU:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize' \
-Name AppsUseLightTheme"))
         (lines (split-string raw-output "\n" t))
         (numeric-result
          (catch 'found
            (dolist (line lines)
              (let ((trimmed (string-trim line)))
                (when (string-match-p "^[0-9]+$" trimmed)
                  (throw 'found trimmed))))
            nil)))
    (and numeric-result (string-equal "0" numeric-result))))