Skip to content

Commit 30c22f5

Browse files
committed
feat(cli): add toggle-window-based-work-area-offset cmd
This commit adds a command to toggle the application of a monitor's window-based work area offset for the focused workspace. resolve LGUG2Z#1285
1 parent c095f8a commit 30c22f5

File tree

5 files changed

+27
-0
lines changed

5 files changed

+27
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# toggle-window-based-work-area-offset
2+
3+
```
4+
Toggle application of the window-based work area offset for the focused workspace
5+
6+
Usage: komorebic.exe toggle-window-based-work-area-offset
7+
8+
Options:
9+
-h, --help
10+
Print help
11+
12+
```

komorebi/src/core/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ pub enum SocketMessage {
185185
StackbarFontFamily(Option<String>),
186186
WorkAreaOffset(Rect),
187187
MonitorWorkAreaOffset(usize, Rect),
188+
ToggleWindowBasedWorkAreaOffset,
188189
ResizeDelta(i32),
189190
InitialWorkspaceRule(ApplicationIdentifier, String, usize, usize),
190191
InitialNamedWorkspaceRule(ApplicationIdentifier, String, String),

komorebi/src/process_command.rs

+8
Original file line numberDiff line numberDiff line change
@@ -1458,6 +1458,14 @@ impl WindowManager {
14581458
self.retile_all(false)?;
14591459
}
14601460
}
1461+
SocketMessage::ToggleWindowBasedWorkAreaOffset => {
1462+
let workspace = self.focused_workspace_mut()?;
1463+
workspace.set_apply_window_based_work_area_offset(
1464+
!workspace.apply_window_based_work_area_offset(),
1465+
);
1466+
1467+
self.retile_all(false)?;
1468+
}
14611469
SocketMessage::QuickSave => {
14621470
let workspace = self.focused_workspace()?;
14631471
let resize = workspace.resize_dimensions();

komorebic/src/main.rs

+5
Original file line numberDiff line numberDiff line change
@@ -1155,6 +1155,8 @@ enum SubCommand {
11551155
/// Set offsets for a monitor to exclude parts of the work area from tiling
11561156
#[clap(arg_required_else_help = true)]
11571157
MonitorWorkAreaOffset(MonitorWorkAreaOffset),
1158+
/// Toggle application of the window-based work area offset for the focused workspace
1159+
ToggleWindowBasedWorkAreaOffset,
11581160
/// Set container padding on the focused workspace
11591161
#[clap(arg_required_else_help = true)]
11601162
FocusedWorkspaceContainerPadding(FocusedWorkspaceContainerPadding),
@@ -1878,6 +1880,9 @@ fn main() -> Result<()> {
18781880
bottom: arg.bottom,
18791881
}))?;
18801882
}
1883+
SubCommand::ToggleWindowBasedWorkAreaOffset => {
1884+
send_message(&SocketMessage::ToggleWindowBasedWorkAreaOffset)?;
1885+
}
18811886
SubCommand::ContainerPadding(arg) => {
18821887
send_message(&SocketMessage::ContainerPadding(
18831888
arg.monitor,

mkdocs.yml

+1
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ nav:
144144
- cli/invisible-borders.md
145145
- cli/global-work-area-offset.md
146146
- cli/monitor-work-area-offset.md
147+
- cli/toggle-window-based-work-area-offset.md
147148
- cli/focused-workspace-container-padding.md
148149
- cli/focused-workspace-padding.md
149150
- cli/adjust-container-padding.md

0 commit comments

Comments
 (0)