Skip to content

GlazeWM is a tiling window manager for macOS and Windows inspired by i3wm.

feat: rename `cursor_follows_focus` -> `cursor_jump`

Lars Berger0a2c3855e9d7
diff --git a/packages/wm/src/containers/commands/center_cursor_on_container.rs b/packages/wm/src/containers/commands/center_cursor_on_container.rs
index 6d2b9c8a..4b8e65da 100644
--- a/packages/wm/src/containers/commands/center_cursor_on_container.rs
+++ b/packages/wm/src/containers/commands/center_cursor_on_container.rs
@@ -8,8 +8,7 @@ pub fn center_cursor_on_container(
target: &Container,
config: &UserConfig,
) -> Result<(), Error> {
- if !config.value.general.cursor_follows_focus
- {
+ if !config.value.general.cursor_jump.enabled {
return Ok(());
}
diff --git a/packages/wm/src/user_config.rs b/packages/wm/src/user_config.rs
index 42d8af4d..d8d9c9e9 100644
--- a/packages/wm/src/user_config.rs
+++ b/packages/wm/src/user_config.rs
@@ -177,24 +177,44 @@ pub struct GapsConfig {
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(rename_all(serialize = "camelCase"))]
pub struct GeneralConfig {
- /// Center the cursor in the middle of a newly focused window.
- #[serde(default = "default_bool::<false>")]
- pub cursor_follows_focus: bool,
+ /// Config for automatically moving the cursor.
+ pub cursor_jump: CursorJumpConfig,
- /// Focus the window directly under the cursor at all times.
+ /// Whether to automatically focus windows underneath the cursor.
#[serde(default = "default_bool::<false>")]
pub focus_follows_cursor: bool,
- /// If activated, by switching to the current workspace the previous
- /// focused workspace is activated.
+ /// Whether to switch back and forth between the previously focused
+ /// workspace when focusing the current workspace.
#[serde(default = "default_bool::<true>")]
pub toggle_workspace_on_refocus: bool,
- /// WM commands to run once on startup.
+ /// Commands to run when the WM has started (e.g. to run a script or
+ /// launch another application).
#[serde(default)]
pub startup_commands: Vec<InvokeCommand>,
}
+#[derive(Clone, Debug, Deserialize, Serialize)]
+#[serde(rename_all(serialize = "camelCase"))]
+pub struct CursorJumpConfig {
+ /// Whether to automatically move the cursor on the specified trigger.
+ #[serde(default = "default_bool::<true>")]
+ pub enabled: bool,
+
+ /// Trigger for cursor jump.
+ #[serde(default)]
+ pub trigger: CursorJumpTrigger,
+}
+
+#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
+#[serde(rename_all = "snake_case")]
+pub enum CursorJumpTrigger {
+ #[default]
+ MonitorFocus,
+ WindowFocus,
+}
+
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(rename_all(serialize = "camelCase"))]
pub struct KeybindingConfig {
@@ -217,9 +237,10 @@ pub struct WindowBehaviorConfig {
pub state_defaults: WindowStateDefaultsConfig,
}
-#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
+#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
#[serde(rename_all = "snake_case")]
pub enum InitialWindowState {
+ #[default]
Tiling,
Floating,
}
diff --git a/resources/sample-config.yaml b/resources/sample-config.yaml
index fed8d1b3..0a0bd25f 100644
--- a/resources/sample-config.yaml
+++ b/resources/sample-config.yaml
@@ -1,16 +1,23 @@
general:
+ # Commands to run when the WM has started (e.g. to run a script or launch
+ # another application).
+ startup_commands: []
+
# Whether to automatically focus windows underneath the cursor.
focus_follows_cursor: false
- # Whether to jump the cursor between windows focused by the WM.
- cursor_follows_focus: false
-
# Whether to switch back and forth between the previously focused
# workspace when focusing the current workspace.
toggle_workspace_on_refocus: true
- # Commands to run once when the WM has started.
- startup_commands: []
+ cursor_jump:
+ # Whether to automatically move the cursor on the specified trigger.
+ enabled: true
+
+ # Trigger for cursor jump:
+ # - 'monitor_focus': Jump when focus changes between monitors.
+ # - 'window_focus': Jump when focus changes between windows.
+ trigger: 'monitor_focus'
gaps:
# Gap between adjacent windows.
@@ -19,20 +26,20 @@ gaps:
# Gap between windows and the screen edge.
outer_gap: '20px'
-# Visual effects to apply to windows. Separate effects can be configured
-# for the focused window vs. other windows.
window_effects:
+ # Visual effects to apply to the focused window.
focused_window:
# Highlight the window with a colored border. Exclusive to Windows 11.
# Set to `null` to disable the effect.
border_color: '#0000ff'
+ # Visual effects to apply to non-focused windows.
other_windows:
border_color: null
window_behavior:
# New windows are created in this state whenever possible.
- # Possible values: 'tiling', 'floating'.
+ # Allowed values: 'tiling', 'floating'.
initial_state: 'tiling'
# Sets the default options for when a new window is created. This also