This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Name: Toggle System Theme | |
// Author: arkatsy | |
// Description: Toggles the system theme between light and dark mode. | |
import "@johnlindquist/kit"; | |
import * as _regedit from "regedit"; | |
import { exec } from "child_process"; | |
const regedit = _regedit.promisified; | |
const REGISTRY_PATH = "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useSyncExternalStore } from "react"; | |
// For more on the useSyncExternalStore hook, see https://react.dev/reference/react/useSyncExternalStore | |
// The code is almost identical to the source code of zustand, without types and some features stripped out. | |
// Check the links to see the references in the source code. | |
// The links are referencing the v5 of the library. If you plan on reading the source code yourself v5 is the best way to start. | |
// The current v4 version contains lot of deprecated code and extra stuff that makes it hard to reason about if you're new to this. | |
// https://github.com/pmndrs/zustand/blob/fe47d3e6c6671dbfb9856fda52cb5a3a855d97a6/src/vanilla.ts#L57-L94 | |
function createStore(createState) { |