Skip to content

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

feat: add option to toggle workspace on refocus (#274)

s-v-o82053f6dfcc5
diff --git a/GlazeWM.Bootstrapper/Resources/sample-config.yaml b/GlazeWM.Bootstrapper/Resources/sample-config.yaml
index fa142fc7..1e002488 100644
--- a/GlazeWM.Bootstrapper/Resources/sample-config.yaml
+++ b/GlazeWM.Bootstrapper/Resources/sample-config.yaml
@@ -6,6 +6,8 @@ general:
# Whether to show floating windows as always on top.
show_floating_on_top: false
floating_window_move_amount: "5%"
+ # When enabled, switching to the current workspace activates the previously focused workspace
+ toggle_workspace_on_refocus: false
bar:
height: "30px"
diff --git a/GlazeWM.Domain/UserConfigs/GeneralConfig.cs b/GlazeWM.Domain/UserConfigs/GeneralConfig.cs
index 6bd1c6c0..bc27dd00 100644
--- a/GlazeWM.Domain/UserConfigs/GeneralConfig.cs
+++ b/GlazeWM.Domain/UserConfigs/GeneralConfig.cs
@@ -15,5 +15,9 @@ namespace GlazeWM.Domain.UserConfigs
/// Amount by which to move floating windows
/// </summary>
public string FloatingWindowMoveAmount { get; set; } = "5%";
+ /// <summary>
+ /// If activated, by switching to the current workspace the previous focused workspace is activated.
+ /// </summary>
+ public bool ToggleWorkspaceOnRefocus { get; set; }
}
}
diff --git a/GlazeWM.Domain/Workspaces/CommandHandlers/FocusWorkspaceHandler.cs b/GlazeWM.Domain/Workspaces/CommandHandlers/FocusWorkspaceHandler.cs
index f8a38964..9cff5b22 100644
--- a/GlazeWM.Domain/Workspaces/CommandHandlers/FocusWorkspaceHandler.cs
+++ b/GlazeWM.Domain/Workspaces/CommandHandlers/FocusWorkspaceHandler.cs
@@ -44,7 +44,11 @@ namespace GlazeWM.Domain.Workspaces.CommandHandlers
var displayedWorkspace = (workspaceToFocus.Parent as Monitor).DisplayedWorkspace;
if (focusedWorkspace == workspaceToFocus)
- return CommandResponse.Ok;
+ {
+ if (!_userConfigService.GeneralConfig.ToggleWorkspaceOnRefocus)
+ return CommandResponse.Ok;
+ workspaceToFocus = _workspaceService.MostRecentWorkspace;
+ }
// Save currently focused workspace as recent for command "recent"
_workspaceService.MostRecentWorkspace = focusedWorkspace;
diff --git a/README.md b/README.md
index 28863520..0eefca95 100644
--- a/README.md
+++ b/README.md
@@ -62,10 +62,20 @@ The configuration file for GlazeWM can be found at `C:\Users\<YOUR_USER>\.glaze-
To use a different config file location, you can launch the GlazeWM executable with the CLI argument `--config="..."`, like so:
-```
+```console
./GlazeWM.exe --config="C:\<PATH_TO_CONFIG>\config.yaml"
```
+## General
+
+```yaml
+general:
+ show_floating_on_top: false
+ floating_window_move_amount: "5%"
+ # When enabled, switching to the current workspace activates the previously focused workspace
+ toggle_workspace_on_refocus: false
+```
+
## Keybindings
The available keybindings can be customized via the `keybindings` property in the config file. A keybinding consists of one or more key combinations and one or more commands to run when pressed.