@@ -49,6 +49,8 @@ type PresetId =
4949 | 'center'
5050 | 'center-80'
5151 | 'fill'
52+ | 'maximize-width'
53+ | 'maximize-height'
5254 | 'auto-organize'
5355 | 'increase-size-10'
5456 | 'decrease-size-10'
@@ -89,6 +91,8 @@ export const WINDOW_MANAGEMENT_PRESET_COMMANDS: WindowManagementPresetCommand[]
8991 { commandId : 'system-window-management-center' , presetId : 'center' } ,
9092 { commandId : 'system-window-management-center-80' , presetId : 'center-80' } ,
9193 { commandId : 'system-window-management-fill' , presetId : 'fill' } ,
94+ { commandId : 'system-window-management-maximize-width' , presetId : 'maximize-width' } ,
95+ { commandId : 'system-window-management-maximize-height' , presetId : 'maximize-height' } ,
9296 { commandId : 'system-window-management-top-left' , presetId : 'top-left' } ,
9397 { commandId : 'system-window-management-top-right' , presetId : 'top-right' } ,
9498 { commandId : 'system-window-management-bottom-left' , presetId : 'bottom-left' } ,
@@ -143,6 +147,8 @@ const PRESETS: Array<{ id: PresetId; label: string; subtitle: string }> = [
143147 { id : 'center' , label : 'Center' , subtitle : 'Current window' } ,
144148 { id : 'center-80' , label : 'Almost Maximize' , subtitle : 'Current window' } ,
145149 { id : 'fill' , label : 'Maximize' , subtitle : 'Current window' } ,
150+ { id : 'maximize-width' , label : 'Maximize Width' , subtitle : 'Current window' } ,
151+ { id : 'maximize-height' , label : 'Maximize Height' , subtitle : 'Current window' } ,
146152 { id : 'top-left' , label : 'Top Left' , subtitle : 'Current window' } ,
147153 { id : 'top-right' , label : 'Top Right' , subtitle : 'Current window' } ,
148154 { id : 'bottom-right' , label : 'Bottom Right' , subtitle : 'Current window' } ,
@@ -183,6 +189,7 @@ const PRESETS: Array<{ id: PresetId; label: string; subtitle: string }> = [
183189] ;
184190
185191const MULTI_WINDOW_PRESETS = new Set < PresetId > ( [ 'auto-organize' ] ) ;
192+ const DIMENSION_MAXIMIZE_PRESETS = new Set < PresetId > ( [ 'maximize-width' , 'maximize-height' ] ) ;
186193const SHIFT_ENTER_ONLY_PRESETS = new Set < PresetId > ( [
187194 'increase-size-10' ,
188195 'decrease-size-10' ,
@@ -302,6 +309,12 @@ function renderPresetIcon(id: PresetId): JSX.Element {
302309 case 'fill' :
303310 cells . push ( { x : 1 , y : 1 , w : 18 , h : 12 } ) ;
304311 break ;
312+ case 'maximize-width' :
313+ cells . push ( { x : 1 , y : 4 , w : 18 , h : 6 } ) ;
314+ break ;
315+ case 'maximize-height' :
316+ cells . push ( { x : 7 , y : 1 , w : 6 , h : 12 } ) ;
317+ break ;
305318 case 'center' :
306319 cells . push ( { x : 4 , y : 3 , w : 12 , h : 8 } ) ;
307320 break ;
@@ -381,6 +394,29 @@ function getWindowRect(win: ManagedWindow | null | undefined): Rect | null {
381394 } ;
382395}
383396
397+ function applyMaximizeDimensionPreset ( presetId : PresetId , target : ManagedWindow , area : ScreenArea ) : Rect | null {
398+ if ( ! DIMENSION_MAXIMIZE_PRESETS . has ( presetId ) ) return null ;
399+ const base = getWindowRect ( target ) ;
400+ if ( ! base ) return null ;
401+
402+ const areaRight = area . left + area . width ;
403+ const areaBottom = area . top + area . height ;
404+ let next : Rect ;
405+ if ( presetId === 'maximize-width' ) {
406+ // Span the full work-area width, keep the current vertical position/height.
407+ next = { x : area . left , y : base . y , width : area . width , height : base . height } ;
408+ } else {
409+ // Span the full work-area height, keep the current horizontal position/width.
410+ next = { x : base . x , y : area . top , width : base . width , height : area . height } ;
411+ }
412+
413+ next . width = clamp ( Math . round ( next . width ) , MIN_WINDOW_WIDTH , area . width ) ;
414+ next . height = clamp ( Math . round ( next . height ) , MIN_WINDOW_HEIGHT , area . height ) ;
415+ next . x = clamp ( Math . round ( next . x ) , area . left , areaRight - next . width ) ;
416+ next . y = clamp ( Math . round ( next . y ) , area . top , areaBottom - next . height ) ;
417+ return next ;
418+ }
419+
384420function applyFineTunePreset ( presetId : PresetId , target : ManagedWindow , area : ScreenArea ) : Rect | null {
385421 if ( ! isShiftEnterOnlyPreset ( presetId ) ) return null ;
386422 const base = getWindowRect ( target ) ;
@@ -1312,6 +1348,11 @@ export async function executeWindowManagementPreset(presetId: PresetId): Promise
13121348 } else {
13131349 moves = buildAutoLayout ( layoutTargets , layoutArea ) ;
13141350 }
1351+ } else if ( DIMENSION_MAXIMIZE_PRESETS . has ( presetId ) && target ) {
1352+ const adjusted = applyMaximizeDimensionPreset ( presetId , target , layoutArea ) ;
1353+ if ( adjusted ) {
1354+ moves = [ { id : target . id , bounds : rectToBounds ( adjusted ) } ] ;
1355+ }
13151356 } else {
13161357 const region = getPresetRegion ( presetId , layoutArea ) ;
13171358 if ( region && target ) {
0 commit comments