Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add JSON schema for GlazeWM configuration #885

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
357 changes: 357 additions & 0 deletions .schemas/glazewm.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,357 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"keybinding": {
"type": "object",
"description": "Keyboard shortcut configuration",
"properties": {
"commands": {
"type": "array",
"items": {
"type": "string"
},
"description": "Commands to execute when the keybinding is triggered. Multiple commands can be run in sequence"
},
"bindings": {
"type": "array",
"items": {
"type": "string"
},
"description": "Key combinations that trigger the commands. For German/US international keyboards, use 'ralt+ctrl' instead of 'ralt' for right-side alt key"
}
},
"required": ["commands", "bindings"]
},
"windowEffect": {
"type": "object",
"description": "Visual effects that can be applied to windows (Windows 11 only)",
"properties": {
"border": {
"type": "object",
"description": "Window border settings (Windows 11 only)",
"properties": {
"enabled": {
"type": "boolean",
"default": false
},
"color": {
"type": "string",
"description": "Color of the window border in hex format (e.g. '#8dbcff')",
"pattern": "^#[0-9a-fA-F]{6}$"
}
}
},
"hide_title_bar": {
"type": "object",
"description": "Remove the title bar from the window's frame. Note that this can cause rendering issues for some applications",
"properties": {
"enabled": {
"type": "boolean",
"default": false
}
}
},
"corner_style": {
"type": "object",
"description": "Window corner style settings (Windows 11 only)",
"properties": {
"enabled": {
"type": "boolean",
"default": false
},
"style": {
"type": "string",
"enum": ["square", "rounded", "small_rounded"],
"description": "Corner style of the window frame",
"default": "square"
}
}
}
}
}
},
"properties": {
"gaps": {
"type": "object",
"description": "Settings for gaps between windows",
"properties": {
"scale_with_dpi": {
"type": "boolean",
"description": "Whether to scale the gaps with the DPI of the monitor",
"default": true
},
"inner_gap": {
"type": "string",
"description": "Gap between adjacent windows",
"pattern": "^\\d+px$",
"examples": ["20px"],
"default": "20px"
},
"outer_gap": {
"type": "object",
"description": "Gap between windows and the screen edge",
"properties": {
"top": {
"type": "string",
"pattern": "^\\d+px$",
"default": "60px"
},
"right": {
"type": "string",
"pattern": "^\\d+px$",
"default": "20px"
},
"bottom": {
"type": "string",
"pattern": "^\\d+px$",
"default": "20px"
},
"left": {
"type": "string",
"pattern": "^\\d+px$",
"default": "20px"
}
},
"required": ["top", "right", "bottom", "left"]
}
},
"required": ["scale_with_dpi", "inner_gap", "outer_gap"]
},
"general": {
"type": "object",
"description": "General window manager settings",
"properties": {
"startup_commands": {
"type": "array",
"items": {
"type": "string"
},
"description": "Commands to run when the WM has started (e.g. 'shell-exec zebar' to launch Zebar)"
},
"shutdown_commands": {
"type": "array",
"items": {
"type": "string"
},
"description": "Commands to run just before the WM is shutdown (e.g. 'shell-exec taskkill /IM zebar.exe /F')"
},
"config_reload_commands": {
"type": "array",
"items": {
"type": "string"
},
"description": "Commands to run after the WM config is reloaded"
},
"focus_follows_cursor": {
"type": "boolean",
"description": "Whether to automatically focus windows underneath the cursor",
"default": false
},
"toggle_workspace_on_refocus": {
"type": "boolean",
"description": "Whether to switch back and forth between previously focused workspace when focusing current workspace",
"default": false
},
"cursor_jump": {
"type": "object",
"properties": {
"enabled": {
"type": "boolean",
"description": "Whether to automatically move the cursor on the specified trigger",
"default": true
},
"trigger": {
"type": "string",
"enum": ["monitor_focus", "window_focus"],
"description": "Trigger for cursor jump: 'monitor_focus' (jump when focus changes between monitors) or 'window_focus' (jump when focus changes between windows)",
"default": "monitor_focus"
}
},
"required": ["enabled", "trigger"]
},
"hide_method": {
"type": "string",
"enum": ["cloak", "hide"],
"description": "How windows should be hidden when switching workspaces. 'cloak' is recommended and hides windows with no animation. 'hide' is a legacy method that has a brief animation but has stability issues with some apps",
"default": "cloak"
},
"show_all_in_taskbar": {
"type": "boolean",
"description": "Affects which windows get shown in the native Windows taskbar. Has no effect if hide_method is 'hide'. When true, shows all windows regardless of workspace. When false, only shows windows from currently shown workspaces",
"default": false
}
}
},
"keybindings": {
"type": "array",
"description": "Global keyboard shortcuts configuration. It's recommended to use alt key for keybindings since Windows key is problematic due to OS-reserved shortcuts",
"items": {
"$ref": "#/definitions/keybinding"
},
"examples": [
{
"commands": ["focus --workspace 1"],
"bindings": ["alt+1"]
},
{
"commands": ["move --workspace 1", "focus --workspace 1"],
"bindings": ["alt+shift+1"]
}
]
},
"window_behavior": {
"type": "object",
"description": "Settings that control how windows behave",
"properties": {
"initial_state": {
"type": "string",
"enum": ["tiling", "floating"],
"description": "New windows are created in this state whenever possible",
"default": "tiling"
},
"state_defaults": {
"type": "object",
"description": "Default options for when a new window is created or when state change commands are used without flags",
"properties": {
"floating": {
"type": "object",
"properties": {
"centered": {
"type": "boolean",
"description": "Whether to center floating windows by default",
"default": true
},
"shown_on_top": {
"type": "boolean",
"description": "Whether to show floating windows as always on top",
"default": false
}
}
},
"fullscreen": {
"type": "object",
"properties": {
"maximized": {
"type": "boolean",
"description": "Maximize the window if possible. If the window doesn't have a maximize button, then it'll be fullscreen'ed normally instead",
"default": false
},
"shown_on_top": {
"type": "boolean",
"description": "Whether to show fullscreen windows as always on top",
"default": false
}
}
}
}
}
}
},
"window_effects": {
"type": "object",
"description": "Visual effects settings for windows (Windows 11 only)",
"properties": {
"focused_window": {
"$ref": "#/definitions/windowEffect",
"description": "Visual effects to apply to the focused window"
},
"other_windows": {
"$ref": "#/definitions/windowEffect",
"description": "Visual effects to apply to non-focused windows"
}
}
},
"workspaces": {
"type": "array",
"description": "List of workspace configurations. Workspaces need to be predefined and are automatically assigned to each monitor on startup. Used for organizing windows and can be targeted by keybindings",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Unique ID for the workspace. Used in keybinding commands (e.g. 'focus --workspace 1') and shown in 3rd-party apps if display_name is not provided",
"examples": ["1", "2", "3", "4", "5", "6", "7", "8", "9"]
},
"display_name": {
"type": "string",
"description": "Optional override for the workspace label used in 3rd-party apps (e.g. Zebar). Does not need to be unique"
},
"bind_to_monitor": {
"type": "integer",
"description": "Optionally force the workspace on a specific monitor if it exists. 0 is leftmost screen, 1 is next one to right, etc",
"minimum": 0
},
"keep_alive": {
"type": "boolean",
"description": "Optionally prevent workspace from being deactivated when empty",
"default": false
}
},
"required": ["name"]
},
"examples": [[{ "name": "1" }, { "name": "2" }, { "name": "3" }]]
},
"binding_modes": {
"type": "array",
"description": "Alternative keybinding modes that can be enabled/disabled while GlazeWM is running. Enable with 'wm-enable-binding-mode --name <name>' and disable with 'wm-disable-binding-mode --name <name>'",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Unique identifier for the binding mode, used in enable/disable commands",
"examples": ["resize"]
},
"display_name": {
"type": "string",
"description": "Optional display name for the binding mode shown in 3rd-party apps"
},
"keybindings": {
"type": "array",
"description": "Keybindings that will be active when this binding mode is enabled",
"items": { "$ref": "#/definitions/keybinding" }
}
},
"required": ["name", "keybindings"],
"examples": [
{
"name": "resize",
"keybindings": [
{
"commands": ["resize --width -2%"],
"bindings": ["h", "left"]
},
{
"commands": ["resize --width +2%"],
"bindings": ["l", "right"]
},
{
"commands": ["resize --height +2%"],
"bindings": ["k", "up"]
},
{
"commands": ["resize --height -2%"],
"bindings": ["j", "down"]
},
{
"commands": ["wm-disable-binding-mode --name resize"],
"bindings": ["escape", "enter"]
}
]
}
]
}
}
},
"required": [
"gaps",
"general",
"keybindings",
"window_behavior",
"window_effects",
"window_rules",
"workspaces",
"binding_modes"
],
"type": "object"
}
Loading