From b1562f952cbb78b49e0d33f759c0a004c59e0b41 Mon Sep 17 00:00:00 2001 From: Ian Ynda-Hummel Date: Fri, 24 Jan 2025 22:14:43 -0500 Subject: [PATCH] Treat `false` as disabling a command in config (#1736) --- Amethyst/Preferences/UserConfiguration.swift | 3 +++ docs/configuration-files.md | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Amethyst/Preferences/UserConfiguration.swift b/Amethyst/Preferences/UserConfiguration.swift index 17b5a7d6..5a0d2c5f 100644 --- a/Amethyst/Preferences/UserConfiguration.swift +++ b/Amethyst/Preferences/UserConfiguration.swift @@ -415,6 +415,9 @@ class UserConfiguration: NSObject { var command: [String: String]? = configurationValue(forKeyValue: commandKey, fallbackToDefault: false) if command != nil { override = true + } else if let enabled: Bool = configurationValue(forKeyValue: commandKey, fallbackToDefault: false), !enabled { + override = true + command = nil } else { let mod1: [String]? = configurationValueForKey(.mod1, fallbackToDefault: false) let mod2: [String]? = configurationValueForKey(.mod2, fallbackToDefault: false) diff --git a/docs/configuration-files.md b/docs/configuration-files.md index 0574c584..a3450ec5 100644 --- a/docs/configuration-files.md +++ b/docs/configuration-files.md @@ -42,7 +42,7 @@ Amethyst will pick up a config file located at `~/.amethyst.yml` or `~/.config/a ## Commands -Commands are defined at the root of the config file, and have a `mod` and a `key`. +Commands are defined at the root of the config file, as either an object with `mod` and `key` values to customize the command or is `false` to entirely disable it. | Key | Description | | --- | ----------- |