├── .gitattributes ├── .gitignore ├── Television.ico ├── TilingWindowManager -1440.ahk ├── TilingWindowManager -1440.ahk.bak ├── TilingWindowManager.ahk ├── TilingWindowManager.ahk.bak ├── TilingWindowManagerMonitorRight.ahk ├── TilingWindowManagerMonitorRight.ahk.bak ├── TilingWindowManagerSurface.ahk ├── TilingWindowManagerSurface.ahk.bak ├── TilingWindowManagerSurfaceVert.ahk ├── icon.ico └── readme.md /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Windows image file caches 2 | Thumbs.db 3 | ehthumbs.db 4 | 5 | # Folder config file 6 | Desktop.ini 7 | 8 | # Recycle Bin used on file shares 9 | $RECYCLE.BIN/ 10 | 11 | # Windows Installer files 12 | *.cab 13 | *.msi 14 | *.msm 15 | *.msp 16 | 17 | # Windows shortcuts 18 | *.lnk 19 | 20 | # ========================= 21 | # Operating System Files 22 | # ========================= 23 | 24 | # OSX 25 | # ========================= 26 | 27 | .DS_Store 28 | .AppleDouble 29 | .LSOverride 30 | 31 | # Thumbnails 32 | ._* 33 | 34 | # Files that might appear on external disk 35 | .Spotlight-V100 36 | .Trashes 37 | 38 | # Directories potentially created on remote AFP share 39 | .AppleDB 40 | .AppleDesktop 41 | Network Trash Folder 42 | Temporary Items 43 | .apdisk 44 | -------------------------------------------------------------------------------- /Television.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/math0ne/windows-tiling-window-manager/fe5c315dd785722b80c2dbf4f6f00574a7585e1e/Television.ico -------------------------------------------------------------------------------- /TilingWindowManager -1440.ahk: -------------------------------------------------------------------------------- 1 | #Persistent 2 | #SingleInstance force 3 | 4 | ;; tiling window manager for windows 7-10 designed for 1 or 2 monitors arranging 5 | ;; windows in the following pattern with configurable window sizes and borders: 6 | ;; _________ _________ 7 | ;; | | | | |___| <- primary monitor 8 | ;; | | | | | | 9 | ;; '---i-----' '-----i---' 10 | 11 | ;; todo override windows move keys, eg, win + left 12 | 13 | ;; -- window sizing options 14 | 15 | 16 | 17 | ;; override system, here you can define a default offset and specific program offsets 18 | ;; this will allow you to setup for custom themes and programs that wont behave 19 | ;; I tried to make this work with WinGetPosEx but even that had many faults 20 | global windowOverrides := Object() 21 | 22 | windowOverrides["default"] := Object() 23 | windowOverrides["default"]["left"] := -8 24 | windowOverrides["default"]["top"] := 0 25 | windowOverrides["default"]["width"] := +16 26 | windowOverrides["default"]["height"] := +8 27 | 28 | windowOverrides["ONENOTE.EXE"] := Object() 29 | windowOverrides["ONENOTE.EXE"]["left"] := 0 30 | windowOverrides["ONENOTE.EXE"]["top"] := 0 31 | windowOverrides["ONENOTE.EXE"]["width"] := 0 32 | windowOverrides["ONENOTE.EXE"]["height"] := 0 33 | 34 | windowOverrides["Steam.exe"] := Object() 35 | windowOverrides["Steam.exe"]["left"] := 1 36 | windowOverrides["Steam.exe"]["top"] := 1 37 | windowOverrides["Steam.exe"]["width"] := -2 38 | windowOverrides["Steam.exe"]["height"] := -2 39 | 40 | windowOverrides["explorer.exe"] := Object() 41 | windowOverrides["explorer.exe"]["left"] := -8 42 | windowOverrides["explorer.exe"]["top"] := 0 43 | windowOverrides["explorer.exe"]["width"] := +16 44 | windowOverrides["explorer.exe"]["height"] := +8 45 | 46 | windowOverrides["atom.exe"] := Object() 47 | windowOverrides["atom.exe"]["left"] := -8 48 | windowOverrides["atom.exe"]["top"] := 0 49 | windowOverrides["atom.exe"]["width"] := +16 50 | windowOverrides["atom.exe"]["height"] := +8 51 | 52 | windowOverrides["chrome.exe"] := Object() 53 | windowOverrides["chrome.exe"]["left"] := -8 54 | windowOverrides["chrome.exe"]["top"] := 0 55 | windowOverrides["chrome.exe"]["width"] := +16 56 | windowOverrides["chrome.exe"]["height"] := +8 57 | 58 | windowOverrides["firefox.exe"] := Object() 59 | windowOverrides["firefox.exe"]["left"] := -6 60 | windowOverrides["firefox.exe"]["top"] := 0 61 | windowOverrides["firefox.exe"]["width"] := +12 62 | windowOverrides["firefox.exe"]["height"] := +6 63 | 64 | windowOverrides["putty.exe"] := Object() 65 | windowOverrides["putty.exe"]["left"] := -4 66 | windowOverrides["putty.exe"]["top"] := 0 67 | windowOverrides["putty.exe"]["width"] := +8 68 | windowOverrides["putty.exe"]["height"] := +4 69 | 70 | windowOverrides["WinSCP.exe"] := Object() 71 | windowOverrides["WinSCP.exe"]["left"] := -8 72 | windowOverrides["WinSCP.exe"]["top"] := 0 73 | windowOverrides["WinSCP.exe"]["width"] := +16 74 | windowOverrides["WinSCP.exe"]["height"] := +8 75 | 76 | windowOverrides["pidgin.exe"] := Object() 77 | windowOverrides["pidgin.exe"]["left"] := -8 78 | windowOverrides["pidgin.exe"]["top"] := 0 79 | windowOverrides["pidgin.exe"]["width"] := +16 80 | windowOverrides["pidgin.exe"]["height"] := +8 81 | 82 | windowOverrides["ApplicationFrameHost.exe"] := Object() 83 | windowOverrides["ApplicationFrameHost.exe"]["left"] := -8 84 | windowOverrides["ApplicationFrameHost.exe"]["top"] := 0 85 | windowOverrides["ApplicationFrameHost.exe"]["width"] := +16 86 | windowOverrides["ApplicationFrameHost.exe"]["height"] := +8 87 | 88 | windowOverrides["Code.exe"] := Object() 89 | windowOverrides["Code.exe"]["left"] := 0 90 | windowOverrides["Code.exe"]["top"] := 0 91 | windowOverrides["Code.exe"]["width"] := 0 92 | windowOverrides["Code.exe"]["height"] := 0 93 | 94 | windowOverrides["Code - Insiders.exe"] := Object() 95 | windowOverrides["Code - Insiders.exe"]["left"] := 0 96 | windowOverrides["Code - Insiders.exe"]["top"] := 0 97 | windowOverrides["Code - Insiders.exe"]["width"] := 0 98 | windowOverrides["Code - Insiders.exe"]["height"] := 0 99 | 100 | windowOverrides["slack.exe"] := Object() 101 | windowOverrides["slack.exe"]["left"] := 0 102 | windowOverrides["slack.exe"]["top"] := 0 103 | windowOverrides["slack.exe"]["width"] := 0 104 | windowOverrides["slack.exe"]["height"] := 0 105 | 106 | windowOverrides["Spotify.exe"] := Object() 107 | windowOverrides["Spotify.exe"]["left"] := 0 108 | windowOverrides["Spotify.exe"]["top"] := 0 109 | windowOverrides["Spotify.exe"]["width"] := 0 110 | windowOverrides["Spotify.exe"]["height"] := 0 111 | 112 | windowOverrides["Photoshop.exe"] := Object() 113 | windowOverrides["Photoshop.exe"]["left"] := 0 114 | windowOverrides["Photoshop.exe"]["top"] := 0 115 | windowOverrides["Photoshop.exe"]["width"] := 0 116 | windowOverrides["Photoshop.exe"]["height"] := 0 117 | 118 | windowOverrides["EXCEL.EXE"] := Object() 119 | windowOverrides["EXCEL.EXE"]["left"] := 0 120 | windowOverrides["EXCEL.EXE"]["top"] := 0 121 | windowOverrides["EXCEL.EXE"]["width"] := 0 122 | windowOverrides["EXCEL.EXE"]["height"] := 0 123 | 124 | windowOverrides["Discord.exe"] := Object() 125 | windowOverrides["Discord.exe"]["left"] := 0 126 | windowOverrides["Discord.exe"]["top"] := 0 127 | windowOverrides["Discord.exe"]["width"] := 0 128 | windowOverrides["Discord.exe"]["height"] := 0 129 | 130 | windowOverrides["Ripcord.exe"] := Object() 131 | windowOverrides["Ripcord.exe"]["left"] := 0 132 | windowOverrides["Ripcord.exe"]["top"] := 0 133 | windowOverrides["Ripcord.exe"]["width"] := 0 134 | windowOverrides["Ripcord.exe"]["height"] := 0 135 | 136 | windowOverrides["Battle.net.exe"] := Object() 137 | windowOverrides["Battle.net.exe"]["left"] := 0 138 | windowOverrides["Battle.net.exe"]["top"] := 0 139 | windowOverrides["Battle.net.exe"]["width"] := 0 140 | windowOverrides["Battle.net.exe"]["height"] := 0 141 | 142 | windowOverrides["Messenger.exe"] := Object() 143 | windowOverrides["Messenger.exe"]["left"] := 0 144 | windowOverrides["Messenger.exe"]["top"] := 0 145 | windowOverrides["Messenger.exe"]["width"] := 0 146 | windowOverrides["Messenger.exe"]["height"] := 0 147 | 148 | windowOverrides["Tweeten.exe"] := Object() 149 | windowOverrides["Tweeten.exe"]["left"] := 0 150 | windowOverrides["Tweeten.exe"]["top"] := 0 151 | windowOverrides["Tweeten.exe"]["width"] := 0 152 | windowOverrides["Tweeten.exe"]["height"] := 0 153 | 154 | SysGet, MonitorCount, MonitorCount 155 | SysGet, MonitorPrimary, MonitorPrimary 156 | ;;MsgBox, Monitor Count:`t%MonitorCount%`nPrimary Monitor:`t%MonitorPrimary% 157 | Loop, %MonitorCount% 158 | { 159 | SysGet, MonitorName, MonitorName, %A_Index% 160 | SysGet, Monitor, Monitor, %A_Index% 161 | SysGet, MonitorWorkArea, MonitorWorkArea, %A_Index% 162 | ;;MsgBox, Monitor:`t#%A_Index%`nName:`t%MonitorName%`nLeft:`t%MonitorLeft% (%MonitorWorkAreaLeft% work)`nTop:`t%MonitorTop% (%MonitorWorkAreaTop% work)`nRight:`t%MonitorRight% (%MonitorWorkAreaRight% work)`nBottom:`t%MonitorBottom% (%MonitorWorkAreaBottom% work) 163 | } 164 | 165 | ;; what happens when: 166 | 167 | ;; -- TaskbarMontior1 Montitor2 168 | ;; -- TaskbarMonitor2 Monitor1 169 | 170 | ;; -- Monitor1 TaskbarMonitor2 171 | ;; -- Monitor2 TaskbarMontior1 172 | ;; * Monitor2: -1920 173 | ;; * Monitor1: 0 174 | 175 | ;; size of space between windows 176 | windowBorder = 10 177 | ;; width of the large windows that appear closest to the center of the screen 178 | windowLeftWidth = 1260 179 | ;; height of the small top right window 180 | windowRightSmallTopHeight = 700 181 | 182 | topWindowTriWidth = 843 183 | 184 | ;; monitor geometry 185 | ;; todo: automate this 186 | monitorWidth = 2560 187 | monitorHeight = 1440 188 | taskbarHeight = 30 189 | 190 | ;;calculated variables used below 191 | windowHeightTall := monitorHeight - (windowBorder * 2) 192 | windowHeightTallTaskbar := monitorHeight - (windowBorder * 2) - taskbarHeight 193 | windowRightWidth := monitorWidth - windowLeftWidth - (windowBorder * 3) 194 | 195 | newZero := 0 196 | 197 | ;; _________ 198 | ;; | | | -- BotLeft 199 | ;; | | | 200 | ;; '----i----' 201 | ;; _________ 202 | ;; | xx | | 203 | ;; | xx | | 204 | ;; '----i----' 205 | botLeftWidth := windowLeftWidth 206 | botLeftHeight := windowHeightTallTaskbar 207 | botLeftLeft := windowBorder 208 | botLeftTop := windowBorder 209 | 210 | ;; _________ 211 | ;; | | | -- BotRight 212 | ;; | | | 213 | ;; '----i----' 214 | ;; _________ 215 | ;; | | xx | 216 | ;; | | xx | 217 | ;; '----i----' 218 | botRightWidth := monitorWidth - windowLeftWidth - (windowBorder * 3) 219 | botRightHeight := windowHeightTallTaskbar 220 | botRightLeft := windowLeftWidth + (windowBorder * 2) 221 | botRightTop := windowBorder 222 | 223 | ;; _________ 224 | ;; | | | -- BotRightTop 225 | ;; | | | 226 | ;; '----i----' 227 | ;; _________ 228 | ;; | |_xx_| 229 | ;; | | | 230 | ;; '----i----' 231 | BotRightTopWidth := monitorWidth - windowLeftWidth - (windowBorder * 3) 232 | BotRightTopHeight := windowRightSmallTopHeight 233 | BotRightTopLeft := windowLeftWidth + (windowBorder * 2) 234 | BotRightTopTop := windowBorder 235 | 236 | ;; _________ 237 | ;; | | | -- BotRightBottom 238 | ;; | | | 239 | ;; '----i----' 240 | ;; _________ 241 | ;; | |____| 242 | ;; | | xx | 243 | ;; '----i----' 244 | BotRightBottomtWidth := monitorWidth - windowLeftWidth - (windowBorder * 3) 245 | BotRightBottomHeight := monitorHeight - windowRightSmallTopHeight - (windowBorder * 3) - taskbarHeight 246 | BotRightBottomLeft := windowLeftWidth + (windowBorder * 2) 247 | BotRightBottomTop := windowRightSmallTopHeight + (windowBorder * 2) 248 | 249 | ;; _________ 250 | ;; | xx | | -- TopLeft 251 | ;; | xx | | 252 | ;; '----i----' 253 | ;; _________ 254 | ;; | | | 255 | ;; | | | 256 | ;; '----i----' 257 | TopLeftWidth := windowLeftWidth 258 | TopLeftHeight := windowHeightTall 259 | TopLeftLeft := windowBorder 260 | TopLeftTop := windowBorder - monitorHeight 261 | 262 | ;; _________ 263 | ;; | | xx | -- TopRight 264 | ;; | | xx | 265 | ;; '----i----' 266 | ;; _________ 267 | ;; | | | 268 | ;; | | | 269 | ;; '----i----' 270 | TopRightWidth := monitorWidth - windowLeftWidth - (windowBorder * 3) 271 | TopRightHeight := windowHeightTall 272 | TopRightLeft := windowLeftWidth + (windowBorder * 2) 273 | TopRightTop := windowBorder - monitorHeight 274 | 275 | ;; _________ 276 | ;; | x| | | -- TriTopLeft 277 | ;; | | | | 278 | ;; '---------' 279 | ;; _________ 280 | ;; | | | 281 | ;; | | | 282 | ;; '----i----' 283 | TriTopLeftWidth := topWindowTriWidth 284 | TriTopLeftHeight := windowHeightTall 285 | TriTopLeftLeft := windowBorder 286 | TriTopLeftTop := windowBorder - monitorHeight 287 | 288 | ;; _________ 289 | ;; | | x | | -- TriTopMiddle 290 | ;; | | | | 291 | ;; '---------' 292 | ;; _________ 293 | ;; | | | 294 | ;; | | | 295 | ;; '----i----' 296 | TriTopMiddleWidth := topWindowTriWidth - windowBorder 297 | TriTopMiddleHeight := windowHeightTall 298 | TriTopMiddleLeft := (windowBorder * 2) + topWindowTriWidth 299 | TriTopMiddleTop := windowBorder - monitorHeight 300 | 301 | ;; _________ 302 | ;; | | | x| -- TriTopRight 303 | ;; | | | | 304 | ;; '---------' 305 | ;; _________ 306 | ;; | | | 307 | ;; | | | 308 | ;; '----i----' 309 | TriTopRightWidth := topWindowTriWidth 310 | TriTopRightHeight := windowHeightTall 311 | TriTopRightLeft := (windowBorder * 2) + (topWindowTriWidth * 2) 312 | TriTopRightTop := windowBorder - monitorHeight 313 | 314 | ;; simplified winmove function call 315 | ResizeWinMine(Width = 0,Height = 0, MyLeft = 0, MyTop = 0) 316 | { 317 | WinGetPos,X,Y,W,H,A 318 | 319 | If %Width% = 0 320 | Width := W 321 | 322 | If %Height% = 0 323 | Height := H 324 | 325 | 326 | tmpArray := windowOverrides 327 | ;;PrintArray(tmpArray) 328 | 329 | noOverrides = 1 330 | 331 | For index, value in tmpArray{ 332 | ;;MsgBox, index:`t%index%`n 333 | if(WinActive("ahk_exe" . index)){ 334 | MyLeft := MyLeft + windowOverrides[index]["left"] 335 | MyTop := MyTop + windowOverrides[index]["top"] 336 | Width := Width + windowOverrides[index]["width"] 337 | Height := Height + windowOverrides[index]["height"] 338 | noOverrides = 0 339 | ;;MsgBox, MyLeft:`t%MyLeft%`n | MyTop:`t%MyTop% | Width:`t%Width% | Height:`t%Height% 340 | } 341 | } 342 | 343 | if(noOverrides == 1) { 344 | MyLeft := MyLeft + windowOverrides["default"]["left"] 345 | MyTop := MyTop + windowOverrides["default"]["top"] 346 | Width := Width + windowOverrides["default"]["width"] 347 | Height := Height + windowOverrides["default"]["height"] 348 | ;;MsgBox, test2 349 | } 350 | 351 | WinMove,A,,%MyLeft%,%MyTop%,%Width%,%Height% 352 | 353 | } 354 | 355 | ;; configure menu 356 | Menu, Tray, Icon , icon.ico 357 | Menu, tray, NoStandard 358 | Menu, Tray, Add, Exit, Exit 359 | Menu, Tray, Add 360 | Menu, Tray, Add, &Left Left Small, LeftLeft 361 | Menu, Tray, Add, &Left Right Large, LeftRight 362 | Menu, Tray, Add 363 | Menu, Tray, Add, &Right Left Large, LeftLarge 364 | Menu, Tray, Add, &Right Right Small, RightSmall 365 | Menu, Tray, Add 366 | Menu, Tray, Add, &Right Right Small Top, RightSmallTop 367 | Menu, Tray, Add, &Right Right Small Bottom, RightSmallBottom 368 | 369 | #1::ResizeWinMine(TriTopLeftWidth, TriTopLeftHeight, TriTopLeftLeft, TriTopLeftTop) 370 | #2::ResizeWinMine(TriTopMiddleWidth, TriTopMiddleHeight, TriTopMiddleLeft, TriTopMiddleTop) 371 | #3::ResizeWinMine(TriTopRightWidth, TriTopRightHeight, TriTopRightLeft, TriTopRightTop) 372 | 373 | #q::ResizeWinMine(TopLeftWidth, TopLeftHeight, TopLeftLeft, TopLeftTop) 374 | #w::ResizeWinMine(TopRightWidth, TopRightHeight, TopRightLeft, TopRightTop) 375 | 376 | #a::ResizeWinMine(botLeftWidth, botLeftHeight, botLeftLeft, botLeftTop) 377 | #s::ResizeWinMine(botRightWidth, botRightHeight, botRightLeft, botRightTop) 378 | 379 | #e::ResizeWinMine(BotRightTopWidth, BotRightTopHeight, BotRightTopLeft, BotRightTopTop) 380 | #d::ResizeWinMine(BotRightBottomtWidth, BotRightBottomHeight, BotRightBottomLeft, BotRightBottomTop) 381 | 382 | ;; menu items 383 | ;; for the menu we have to activate the previos window (may not be perfect in all case) 384 | ;; because the tray popup itself counts as a window 385 | Exit: 386 | ExitApp 387 | 388 | LeftLeft: 389 | Send !{Esc} ; Activate previous window 390 | ResizeWinMine(LeftLeftWidth,LeftLeftHeight, LeftLeftLeft, LeftLeftTop) 391 | return 392 | 393 | LeftRight: 394 | Send !{Esc} ; Activate previous window 395 | ResizeWinMine(LeftRightWidth,LeftRightHeight, LeftRightLeft, LeftRightTop) 396 | return 397 | 398 | LeftLarge: 399 | Send !{Esc} ; Activate previous window 400 | ResizeWinMine(RightLeftWidth,RightLeftHeight, RightLeftLeft, RightLeftTop) 401 | return 402 | 403 | RightSmall: 404 | Send !{Esc} ; Activate previous window 405 | ResizeWinMine(RightRightWidth,RightRightHeight, RightRightLeft, RightRightTop) 406 | return 407 | 408 | RightSmallTop: 409 | Send !{Esc} ; Activate previous window 410 | ResizeWinMine(RightRightTopWidth,RightRightTopHeight, RightRightTopLeft, RightRightTopTop) 411 | return 412 | 413 | RightSmallBottom: 414 | Send !{Esc} ; Activate previous window 415 | ResizeWinMine(RightRightBotWidth,RightRightBotHeight, RightRightBotLeft, RightRightBotTop) 416 | return 417 | -------------------------------------------------------------------------------- /TilingWindowManager -1440.ahk.bak: -------------------------------------------------------------------------------- 1 | #Persistent 2 | #SingleInstance force 3 | 4 | ;; tiling window manager for windows 7-10 designed for 1 or 2 monitors arranging 5 | ;; windows in the following pattern with configurable window sizes and borders: 6 | ;; _________ _________ 7 | ;; | | | | |___| <- primary monitor 8 | ;; | | | | | | 9 | ;; '---i-----' '-----i---' 10 | 11 | ;; todo override windows move keys, eg, win + left 12 | 13 | ;; -- window sizing options 14 | 15 | 16 | 17 | ;; override system, here you can define a default offset and specific program offsets 18 | ;; this will allow you to setup for custom themes and programs that wont behave 19 | ;; I tried to make this work with WinGetPosEx but even that had many faults 20 | global windowOverrides := Object() 21 | 22 | windowOverrides["default"] := Object() 23 | windowOverrides["default"]["left"] := -8 24 | windowOverrides["default"]["top"] := 0 25 | windowOverrides["default"]["width"] := +16 26 | windowOverrides["default"]["height"] := +8 27 | 28 | windowOverrides["ONENOTE.EXE"] := Object() 29 | windowOverrides["ONENOTE.EXE"]["left"] := 0 30 | windowOverrides["ONENOTE.EXE"]["top"] := 0 31 | windowOverrides["ONENOTE.EXE"]["width"] := 0 32 | windowOverrides["ONENOTE.EXE"]["height"] := 0 33 | 34 | windowOverrides["Steam.exe"] := Object() 35 | windowOverrides["Steam.exe"]["left"] := 1 36 | windowOverrides["Steam.exe"]["top"] := 1 37 | windowOverrides["Steam.exe"]["width"] := -2 38 | windowOverrides["Steam.exe"]["height"] := -2 39 | 40 | windowOverrides["explorer.exe"] := Object() 41 | windowOverrides["explorer.exe"]["left"] := -8 42 | windowOverrides["explorer.exe"]["top"] := 0 43 | windowOverrides["explorer.exe"]["width"] := +16 44 | windowOverrides["explorer.exe"]["height"] := +8 45 | 46 | windowOverrides["atom.exe"] := Object() 47 | windowOverrides["atom.exe"]["left"] := -8 48 | windowOverrides["atom.exe"]["top"] := 0 49 | windowOverrides["atom.exe"]["width"] := +16 50 | windowOverrides["atom.exe"]["height"] := +8 51 | 52 | windowOverrides["chrome.exe"] := Object() 53 | windowOverrides["chrome.exe"]["left"] := -8 54 | windowOverrides["chrome.exe"]["top"] := 0 55 | windowOverrides["chrome.exe"]["width"] := +16 56 | windowOverrides["chrome.exe"]["height"] := +8 57 | 58 | windowOverrides["firefox.exe"] := Object() 59 | windowOverrides["firefox.exe"]["left"] := -6 60 | windowOverrides["firefox.exe"]["top"] := 0 61 | windowOverrides["firefox.exe"]["width"] := +12 62 | windowOverrides["firefox.exe"]["height"] := +6 63 | 64 | windowOverrides["putty.exe"] := Object() 65 | windowOverrides["putty.exe"]["left"] := -4 66 | windowOverrides["putty.exe"]["top"] := 0 67 | windowOverrides["putty.exe"]["width"] := +8 68 | windowOverrides["putty.exe"]["height"] := +4 69 | 70 | windowOverrides["WinSCP.exe"] := Object() 71 | windowOverrides["WinSCP.exe"]["left"] := -8 72 | windowOverrides["WinSCP.exe"]["top"] := 0 73 | windowOverrides["WinSCP.exe"]["width"] := +16 74 | windowOverrides["WinSCP.exe"]["height"] := +8 75 | 76 | windowOverrides["pidgin.exe"] := Object() 77 | windowOverrides["pidgin.exe"]["left"] := -8 78 | windowOverrides["pidgin.exe"]["top"] := 0 79 | windowOverrides["pidgin.exe"]["width"] := +16 80 | windowOverrides["pidgin.exe"]["height"] := +8 81 | 82 | windowOverrides["ApplicationFrameHost.exe"] := Object() 83 | windowOverrides["ApplicationFrameHost.exe"]["left"] := -8 84 | windowOverrides["ApplicationFrameHost.exe"]["top"] := 0 85 | windowOverrides["ApplicationFrameHost.exe"]["width"] := +16 86 | windowOverrides["ApplicationFrameHost.exe"]["height"] := +8 87 | 88 | windowOverrides["Code.exe"] := Object() 89 | windowOverrides["Code.exe"]["left"] := 0 90 | windowOverrides["Code.exe"]["top"] := 0 91 | windowOverrides["Code.exe"]["width"] := 0 92 | windowOverrides["Code.exe"]["height"] := 0 93 | 94 | windowOverrides["Code - Insiders.exe"] := Object() 95 | windowOverrides["Code - Insiders.exe"]["left"] := 0 96 | windowOverrides["Code - Insiders.exe"]["top"] := 0 97 | windowOverrides["Code - Insiders.exe"]["width"] := 0 98 | windowOverrides["Code - Insiders.exe"]["height"] := 0 99 | 100 | windowOverrides["slack.exe"] := Object() 101 | windowOverrides["slack.exe"]["left"] := 0 102 | windowOverrides["slack.exe"]["top"] := 0 103 | windowOverrides["slack.exe"]["width"] := 0 104 | windowOverrides["slack.exe"]["height"] := 0 105 | 106 | windowOverrides["Spotify.exe"] := Object() 107 | windowOverrides["Spotify.exe"]["left"] := 0 108 | windowOverrides["Spotify.exe"]["top"] := 0 109 | windowOverrides["Spotify.exe"]["width"] := 0 110 | windowOverrides["Spotify.exe"]["height"] := 0 111 | 112 | windowOverrides["Photoshop.exe"] := Object() 113 | windowOverrides["Photoshop.exe"]["left"] := 0 114 | windowOverrides["Photoshop.exe"]["top"] := 0 115 | windowOverrides["Photoshop.exe"]["width"] := 0 116 | windowOverrides["Photoshop.exe"]["height"] := 0 117 | 118 | windowOverrides["EXCEL.EXE"] := Object() 119 | windowOverrides["EXCEL.EXE"]["left"] := 0 120 | windowOverrides["EXCEL.EXE"]["top"] := 0 121 | windowOverrides["EXCEL.EXE"]["width"] := 0 122 | windowOverrides["EXCEL.EXE"]["height"] := 0 123 | 124 | windowOverrides["Discord.exe"] := Object() 125 | windowOverrides["Discord.exe"]["left"] := 0 126 | windowOverrides["Discord.exe"]["top"] := 0 127 | windowOverrides["Discord.exe"]["width"] := 0 128 | windowOverrides["Discord.exe"]["height"] := 0 129 | 130 | windowOverrides["Ripcord.exe"] := Object() 131 | windowOverrides["Ripcord.exe"]["left"] := 0 132 | windowOverrides["Ripcord.exe"]["top"] := 0 133 | windowOverrides["Ripcord.exe"]["width"] := 0 134 | windowOverrides["Ripcord.exe"]["height"] := 0 135 | 136 | windowOverrides["Battle.net.exe"] := Object() 137 | windowOverrides["Battle.net.exe"]["left"] := 0 138 | windowOverrides["Battle.net.exe"]["top"] := 0 139 | windowOverrides["Battle.net.exe"]["width"] := 0 140 | windowOverrides["Battle.net.exe"]["height"] := 0 141 | 142 | windowOverrides["Messenger.exe"] := Object() 143 | windowOverrides["Messenger.exe"]["left"] := 0 144 | windowOverrides["Messenger.exe"]["top"] := 0 145 | windowOverrides["Messenger.exe"]["width"] := 0 146 | windowOverrides["Messenger.exe"]["height"] := 0 147 | 148 | SysGet, MonitorCount, MonitorCount 149 | SysGet, MonitorPrimary, MonitorPrimary 150 | ;;MsgBox, Monitor Count:`t%MonitorCount%`nPrimary Monitor:`t%MonitorPrimary% 151 | Loop, %MonitorCount% 152 | { 153 | SysGet, MonitorName, MonitorName, %A_Index% 154 | SysGet, Monitor, Monitor, %A_Index% 155 | SysGet, MonitorWorkArea, MonitorWorkArea, %A_Index% 156 | ;;MsgBox, Monitor:`t#%A_Index%`nName:`t%MonitorName%`nLeft:`t%MonitorLeft% (%MonitorWorkAreaLeft% work)`nTop:`t%MonitorTop% (%MonitorWorkAreaTop% work)`nRight:`t%MonitorRight% (%MonitorWorkAreaRight% work)`nBottom:`t%MonitorBottom% (%MonitorWorkAreaBottom% work) 157 | } 158 | 159 | ;; what happens when: 160 | 161 | ;; -- TaskbarMontior1 Montitor2 162 | ;; -- TaskbarMonitor2 Monitor1 163 | 164 | ;; -- Monitor1 TaskbarMonitor2 165 | ;; -- Monitor2 TaskbarMontior1 166 | ;; * Monitor2: -1920 167 | ;; * Monitor1: 0 168 | 169 | ;; size of space between windows 170 | windowBorder = 10 171 | ;; width of the large windows that appear closest to the center of the screen 172 | windowLeftWidth = 1260 173 | ;; height of the small top right window 174 | windowRightSmallTopHeight = 700 175 | 176 | topWindowTriWidth = 843 177 | 178 | ;; monitor geometry 179 | ;; todo: automate this 180 | monitorWidth = 2560 181 | monitorHeight = 1440 182 | taskbarHeight = 30 183 | 184 | ;;calculated variables used below 185 | windowHeightTall := monitorHeight - (windowBorder * 2) 186 | windowHeightTallTaskbar := monitorHeight - (windowBorder * 2) - taskbarHeight 187 | windowRightWidth := monitorWidth - windowLeftWidth - (windowBorder * 3) 188 | 189 | newZero := 0 190 | 191 | ;; _________ 192 | ;; | | | -- BotLeft 193 | ;; | | | 194 | ;; '----i----' 195 | ;; _________ 196 | ;; | xx | | 197 | ;; | xx | | 198 | ;; '----i----' 199 | botLeftWidth := windowLeftWidth 200 | botLeftHeight := windowHeightTallTaskbar 201 | botLeftLeft := windowBorder 202 | botLeftTop := windowBorder 203 | 204 | ;; _________ 205 | ;; | | | -- BotRight 206 | ;; | | | 207 | ;; '----i----' 208 | ;; _________ 209 | ;; | | xx | 210 | ;; | | xx | 211 | ;; '----i----' 212 | botRightWidth := monitorWidth - windowLeftWidth - (windowBorder * 3) 213 | botRightHeight := windowHeightTallTaskbar 214 | botRightLeft := windowLeftWidth + (windowBorder * 2) 215 | botRightTop := windowBorder 216 | 217 | ;; _________ 218 | ;; | | | -- BotRightTop 219 | ;; | | | 220 | ;; '----i----' 221 | ;; _________ 222 | ;; | |_xx_| 223 | ;; | | | 224 | ;; '----i----' 225 | BotRightTopWidth := monitorWidth - windowLeftWidth - (windowBorder * 3) 226 | BotRightTopHeight := windowRightSmallTopHeight 227 | BotRightTopLeft := windowLeftWidth + (windowBorder * 2) 228 | BotRightTopTop := windowBorder 229 | 230 | ;; _________ 231 | ;; | | | -- BotRightBottom 232 | ;; | | | 233 | ;; '----i----' 234 | ;; _________ 235 | ;; | |____| 236 | ;; | | xx | 237 | ;; '----i----' 238 | BotRightBottomtWidth := monitorWidth - windowLeftWidth - (windowBorder * 3) 239 | BotRightBottomHeight := monitorHeight - windowRightSmallTopHeight - (windowBorder * 3) - taskbarHeight 240 | BotRightBottomLeft := windowLeftWidth + (windowBorder * 2) 241 | BotRightBottomTop := windowRightSmallTopHeight + (windowBorder * 2) 242 | 243 | ;; _________ 244 | ;; | xx | | -- TopLeft 245 | ;; | xx | | 246 | ;; '----i----' 247 | ;; _________ 248 | ;; | | | 249 | ;; | | | 250 | ;; '----i----' 251 | TopLeftWidth := windowLeftWidth 252 | TopLeftHeight := windowHeightTall 253 | TopLeftLeft := windowBorder 254 | TopLeftTop := windowBorder - monitorHeight 255 | 256 | ;; _________ 257 | ;; | | xx | -- TopRight 258 | ;; | | xx | 259 | ;; '----i----' 260 | ;; _________ 261 | ;; | | | 262 | ;; | | | 263 | ;; '----i----' 264 | TopRightWidth := monitorWidth - windowLeftWidth - (windowBorder * 3) 265 | TopRightHeight := windowHeightTall 266 | TopRightLeft := windowLeftWidth + (windowBorder * 2) 267 | TopRightTop := windowBorder - monitorHeight 268 | 269 | ;; _________ 270 | ;; | x| | | -- TriTopLeft 271 | ;; | | | | 272 | ;; '---------' 273 | ;; _________ 274 | ;; | | | 275 | ;; | | | 276 | ;; '----i----' 277 | TriTopLeftWidth := topWindowTriWidth 278 | TriTopLeftHeight := windowHeightTall 279 | TriTopLeftLeft := windowBorder 280 | TriTopLeftTop := windowBorder - monitorHeight 281 | 282 | ;; _________ 283 | ;; | | x | | -- TriTopMiddle 284 | ;; | | | | 285 | ;; '---------' 286 | ;; _________ 287 | ;; | | | 288 | ;; | | | 289 | ;; '----i----' 290 | TriTopMiddleWidth := topWindowTriWidth - windowBorder 291 | TriTopMiddleHeight := windowHeightTall 292 | TriTopMiddleLeft := (windowBorder * 2) + topWindowTriWidth 293 | TriTopMiddleTop := windowBorder - monitorHeight 294 | 295 | ;; _________ 296 | ;; | | | x| -- TriTopRight 297 | ;; | | | | 298 | ;; '---------' 299 | ;; _________ 300 | ;; | | | 301 | ;; | | | 302 | ;; '----i----' 303 | TriTopRightWidth := topWindowTriWidth 304 | TriTopRightHeight := windowHeightTall 305 | TriTopRightLeft := (windowBorder * 2) + (topWindowTriWidth * 2) 306 | TriTopRightTop := windowBorder - monitorHeight 307 | 308 | ;; simplified winmove function call 309 | ResizeWinMine(Width = 0,Height = 0, MyLeft = 0, MyTop = 0) 310 | { 311 | WinGetPos,X,Y,W,H,A 312 | 313 | If %Width% = 0 314 | Width := W 315 | 316 | If %Height% = 0 317 | Height := H 318 | 319 | 320 | tmpArray := windowOverrides 321 | ;;PrintArray(tmpArray) 322 | 323 | noOverrides = 1 324 | 325 | For index, value in tmpArray{ 326 | ;;MsgBox, index:`t%index%`n 327 | if(WinActive("ahk_exe" . index)){ 328 | MyLeft := MyLeft + windowOverrides[index]["left"] 329 | MyTop := MyTop + windowOverrides[index]["top"] 330 | Width := Width + windowOverrides[index]["width"] 331 | Height := Height + windowOverrides[index]["height"] 332 | noOverrides = 0 333 | ;;MsgBox, MyLeft:`t%MyLeft%`n | MyTop:`t%MyTop% | Width:`t%Width% | Height:`t%Height% 334 | } 335 | } 336 | 337 | if(noOverrides == 1) { 338 | MyLeft := MyLeft + windowOverrides["default"]["left"] 339 | MyTop := MyTop + windowOverrides["default"]["top"] 340 | Width := Width + windowOverrides["default"]["width"] 341 | Height := Height + windowOverrides["default"]["height"] 342 | ;;MsgBox, test2 343 | } 344 | 345 | WinMove,A,,%MyLeft%,%MyTop%,%Width%,%Height% 346 | 347 | } 348 | 349 | ;; configure menu 350 | Menu, Tray, Icon , icon.ico 351 | Menu, tray, NoStandard 352 | Menu, Tray, Add, Exit, Exit 353 | Menu, Tray, Add 354 | Menu, Tray, Add, &Left Left Small, LeftLeft 355 | Menu, Tray, Add, &Left Right Large, LeftRight 356 | Menu, Tray, Add 357 | Menu, Tray, Add, &Right Left Large, LeftLarge 358 | Menu, Tray, Add, &Right Right Small, RightSmall 359 | Menu, Tray, Add 360 | Menu, Tray, Add, &Right Right Small Top, RightSmallTop 361 | Menu, Tray, Add, &Right Right Small Bottom, RightSmallBottom 362 | 363 | #1::ResizeWinMine(TriTopLeftWidth, TriTopLeftHeight, TriTopLeftLeft, TriTopLeftTop) 364 | #2::ResizeWinMine(TriTopMiddleWidth, TriTopMiddleHeight, TriTopMiddleLeft, TriTopMiddleTop) 365 | #3::ResizeWinMine(TriTopRightWidth, TriTopRightHeight, TriTopRightLeft, TriTopRightTop) 366 | 367 | #q::ResizeWinMine(TopLeftWidth, TopLeftHeight, TopLeftLeft, TopLeftTop) 368 | #w::ResizeWinMine(TopRightWidth, TopRightHeight, TopRightLeft, TopRightTop) 369 | 370 | #a::ResizeWinMine(botLeftWidth, botLeftHeight, botLeftLeft, botLeftTop) 371 | #s::ResizeWinMine(botRightWidth, botRightHeight, botRightLeft, botRightTop) 372 | 373 | #e::ResizeWinMine(BotRightTopWidth, BotRightTopHeight, BotRightTopLeft, BotRightTopTop) 374 | #d::ResizeWinMine(BotRightBottomtWidth, BotRightBottomHeight, BotRightBottomLeft, BotRightBottomTop) 375 | 376 | ;; menu items 377 | ;; for the menu we have to activate the previos window (may not be perfect in all case) 378 | ;; because the tray popup itself counts as a window 379 | Exit: 380 | ExitApp 381 | 382 | LeftLeft: 383 | Send !{Esc} ; Activate previous window 384 | ResizeWinMine(LeftLeftWidth,LeftLeftHeight, LeftLeftLeft, LeftLeftTop) 385 | return 386 | 387 | LeftRight: 388 | Send !{Esc} ; Activate previous window 389 | ResizeWinMine(LeftRightWidth,LeftRightHeight, LeftRightLeft, LeftRightTop) 390 | return 391 | 392 | LeftLarge: 393 | Send !{Esc} ; Activate previous window 394 | ResizeWinMine(RightLeftWidth,RightLeftHeight, RightLeftLeft, RightLeftTop) 395 | return 396 | 397 | RightSmall: 398 | Send !{Esc} ; Activate previous window 399 | ResizeWinMine(RightRightWidth,RightRightHeight, RightRightLeft, RightRightTop) 400 | return 401 | 402 | RightSmallTop: 403 | Send !{Esc} ; Activate previous window 404 | ResizeWinMine(RightRightTopWidth,RightRightTopHeight, RightRightTopLeft, RightRightTopTop) 405 | return 406 | 407 | RightSmallBottom: 408 | Send !{Esc} ; Activate previous window 409 | ResizeWinMine(RightRightBotWidth,RightRightBotHeight, RightRightBotLeft, RightRightBotTop) 410 | return 411 | -------------------------------------------------------------------------------- /TilingWindowManager.ahk: -------------------------------------------------------------------------------- 1 | #Persistent 2 | #SingleInstance force 3 | 4 | ;; tiling window manager for windows 7-10 designed for 1 or 2 monitors arranging 5 | ;; windows in the following pattern with configurable window sizes and borders: 6 | ;; _________ _________ 7 | ;; | | | | |___| <- primary monitor 8 | ;; | | | | | | 9 | ;; '---i-----' '-----i---' 10 | 11 | ;; todo override windows move keys, eg, win + left 12 | 13 | ;; -- window sizing options 14 | 15 | ;; size of space between windows 16 | windowBorder = 10 17 | ;; width of the large windows that appear closest to the center of the screen 18 | windowLeftWidth = 1200 19 | ;; height of the small top right window 20 | windowRightSmallTopHeight = 550 21 | 22 | ;; monitor geometry 23 | ;; todo: automate this 24 | monitorBorderRight = 1920 25 | monitorBorderLeft = 0 26 | monitorWidth = 1920 27 | monitorHeight = 1080 28 | taskbarHeight = 30 29 | 30 | monitorWidthLeft = 1440 31 | monitorheightRight = 2560 32 | 33 | ;; override system, here you can define a default offset and specific program offsets 34 | ;; this will allow you to setup for custom themes and programs that wont behave 35 | ;; I tried to make this work with WinGetPosEx but even that had many faults 36 | global windowOverrides := Object() 37 | 38 | windowOverrides["default"] := Object() 39 | windowOverrides["default"]["left"] := -8 40 | windowOverrides["default"]["top"] := 0 41 | windowOverrides["default"]["width"] := +16 42 | windowOverrides["default"]["height"] := +8 43 | 44 | windowOverrides["ONENOTE.EXE"] := Object() 45 | windowOverrides["ONENOTE.EXE"]["left"] := 0 46 | windowOverrides["ONENOTE.EXE"]["top"] := 0 47 | windowOverrides["ONENOTE.EXE"]["width"] := 0 48 | windowOverrides["ONENOTE.EXE"]["height"] := 0 49 | 50 | windowOverrides["Steam.exe"] := Object() 51 | windowOverrides["Steam.exe"]["left"] := 1 52 | windowOverrides["Steam.exe"]["top"] := 1 53 | windowOverrides["Steam.exe"]["width"] := -2 54 | windowOverrides["Steam.exe"]["height"] := -2 55 | 56 | windowOverrides["explorer.exe"] := Object() 57 | windowOverrides["explorer.exe"]["left"] := -8 58 | windowOverrides["explorer.exe"]["top"] := 0 59 | windowOverrides["explorer.exe"]["width"] := +16 60 | windowOverrides["explorer.exe"]["height"] := +8 61 | 62 | windowOverrides["atom.exe"] := Object() 63 | windowOverrides["atom.exe"]["left"] := -8 64 | windowOverrides["atom.exe"]["top"] := 0 65 | windowOverrides["atom.exe"]["width"] := +16 66 | windowOverrides["atom.exe"]["height"] := +8 67 | 68 | windowOverrides["chrome.exe"] := Object() 69 | windowOverrides["chrome.exe"]["left"] := -8 70 | windowOverrides["chrome.exe"]["top"] := 0 71 | windowOverrides["chrome.exe"]["width"] := +16 72 | windowOverrides["chrome.exe"]["height"] := +8 73 | 74 | windowOverrides["firefox.exe"] := Object() 75 | windowOverrides["firefox.exe"]["left"] := -6 76 | windowOverrides["firefox.exe"]["top"] := 0 77 | windowOverrides["firefox.exe"]["width"] := +12 78 | windowOverrides["firefox.exe"]["height"] := +6 79 | 80 | windowOverrides["putty.exe"] := Object() 81 | windowOverrides["putty.exe"]["left"] := -4 82 | windowOverrides["putty.exe"]["top"] := 0 83 | windowOverrides["putty.exe"]["width"] := +8 84 | windowOverrides["putty.exe"]["height"] := +4 85 | 86 | windowOverrides["WinSCP.exe"] := Object() 87 | windowOverrides["WinSCP.exe"]["left"] := -8 88 | windowOverrides["WinSCP.exe"]["top"] := 0 89 | windowOverrides["WinSCP.exe"]["width"] := +16 90 | windowOverrides["WinSCP.exe"]["height"] := +8 91 | 92 | windowOverrides["pidgin.exe"] := Object() 93 | windowOverrides["pidgin.exe"]["left"] := -8 94 | windowOverrides["pidgin.exe"]["top"] := 0 95 | windowOverrides["pidgin.exe"]["width"] := +16 96 | windowOverrides["pidgin.exe"]["height"] := +8 97 | 98 | windowOverrides["ApplicationFrameHost.exe"] := Object() 99 | windowOverrides["ApplicationFrameHost.exe"]["left"] := -8 100 | windowOverrides["ApplicationFrameHost.exe"]["top"] := 0 101 | windowOverrides["ApplicationFrameHost.exe"]["width"] := +16 102 | windowOverrides["ApplicationFrameHost.exe"]["height"] := +8 103 | 104 | windowOverrides["Code.exe"] := Object() 105 | windowOverrides["Code.exe"]["left"] := 0 106 | windowOverrides["Code.exe"]["top"] := 0 107 | windowOverrides["Code.exe"]["width"] := 0 108 | windowOverrides["Code.exe"]["height"] := 0 109 | 110 | windowOverrides["slack.exe"] := Object() 111 | windowOverrides["slack.exe"]["left"] := 0 112 | windowOverrides["slack.exe"]["top"] := 0 113 | windowOverrides["slack.exe"]["width"] := 0 114 | windowOverrides["slack.exe"]["height"] := 0 115 | 116 | windowOverrides["Spotify.exe"] := Object() 117 | windowOverrides["Spotify.exe"]["left"] := 0 118 | windowOverrides["Spotify.exe"]["top"] := 0 119 | windowOverrides["Spotify.exe"]["width"] := 0 120 | windowOverrides["Spotify.exe"]["height"] := 0 121 | 122 | windowOverrides["Photoshop.exe"] := Object() 123 | windowOverrides["Photoshop.exe"]["left"] := 0 124 | windowOverrides["Photoshop.exe"]["top"] := 0 125 | windowOverrides["Photoshop.exe"]["width"] := 0 126 | windowOverrides["Photoshop.exe"]["height"] := 0 127 | 128 | windowOverrides["EXCEL.EXE"] := Object() 129 | windowOverrides["EXCEL.EXE"]["left"] := 0 130 | windowOverrides["EXCEL.EXE"]["top"] := 0 131 | windowOverrides["EXCEL.EXE"]["width"] := 0 132 | windowOverrides["EXCEL.EXE"]["height"] := 0 133 | 134 | windowOverrides["Discord.exe"] := Object() 135 | windowOverrides["Discord.exe"]["left"] := 0 136 | windowOverrides["Discord.exe"]["top"] := 0 137 | windowOverrides["Discord.exe"]["width"] := 0 138 | windowOverrides["Discord.exe"]["height"] := 0 139 | 140 | 141 | SysGet, MonitorCount, MonitorCount 142 | SysGet, MonitorPrimary, MonitorPrimary 143 | ;;MsgBox, Monitor Count:`t%MonitorCount%`nPrimary Monitor:`t%MonitorPrimary% 144 | Loop, %MonitorCount% 145 | { 146 | SysGet, MonitorName, MonitorName, %A_Index% 147 | SysGet, Monitor, Monitor, %A_Index% 148 | SysGet, MonitorWorkArea, MonitorWorkArea, %A_Index% 149 | ;;MsgBox, Monitor:`t#%A_Index%`nName:`t%MonitorName%`nLeft:`t%MonitorLeft% (%MonitorWorkAreaLeft% work)`nTop:`t%MonitorTop% (%MonitorWorkAreaTop% work)`nRight:`t%MonitorRight% (%MonitorWorkAreaRight% work)`nBottom:`t%MonitorBottom% (%MonitorWorkAreaBottom% work) 150 | } 151 | 152 | ;; what happens when: 153 | 154 | ;; -- TaskbarMontior1 Montitor2 155 | ;; -- TaskbarMonitor2 Monitor1 156 | 157 | ;; -- Monitor1 TaskbarMonitor2 158 | ;; -- Monitor2 TaskbarMontior1 159 | ;; * Monitor2: -1920 160 | ;; * Monitor1: 0 161 | 162 | 163 | ;;calculated variables used below 164 | windowHeightTall := monitorHeight - (windowBorder * 2) 165 | windowHeightTallTaskbar := monitorHeight - (windowBorder * 2) - taskbarHeight 166 | windowRightWidth := monitorWidth - windowLeftWidth - (windowBorder * 3) 167 | 168 | newLeftWindowWidth := monitorWidthLeft - (windowBorder * 2) 169 | newLeftWindowTopHeight := 800 170 | newLeftWindowBotHeight := 1715 171 | 172 | vertWindowWidth := monitorHeight - (windowBorder * 2) 173 | vertWindowWTopHeight := 2000 174 | vertWindowWBotHeight := monitorWidth - vertWindowWTopHeight - (windowBorder * 2) - taskbarHeight 175 | 176 | newZero := 0 177 | 178 | ;; ___ _________ 179 | ;; | x | | |___| -- LeftLeft 180 | ;; | | | | | 181 | ;; '---i '-----i---' 182 | LeftLeftWidth := monitorWidthLeft - (windowBorder * 2) 183 | LeftLeftHeight := newLeftWindowTopHeight 184 | LeftLeftLeft := (newZero - monitorWidthLeft + 10) 185 | LeftLeftTop := - 510 186 | 187 | ;; ____ _________ 188 | ;; | | | |___| -- LeftRight 189 | ;; | x | | | | 190 | ;; '---i '-----i---' 191 | LeftRightWidth := monitorWidthLeft - (windowBorder * 2) 192 | LeftRightHeight := newLeftWindowBotHeight + windowBorder * 2 - 5 193 | LeftRighteft := (newZero - monitorWidthLeft + 10) 194 | LeftRightTop := - 510 + newLeftWindowTopHeight + windowBorder 195 | 196 | ;; _________ _________ 197 | ;; | | | | |___| -- RightLeft 198 | ;; | | | | X | | 199 | ;; '---i-----' '-----i---' 200 | RightLeftWidth := windowLeftWidth 201 | RightLeftHeight := windowHeightTallTaskbar 202 | RightLeftLeft := windowBorder 203 | RightLeftTop := windowBorder 204 | 205 | ;; _________ _________ 206 | ;; | | | | | | -- RightRight 207 | ;; | | | | | X | 208 | ;; '---i-----' '-----i---' 209 | RightRightWidth := windowRightWidth 210 | RightRightHeight := windowHeightTallTaskbar 211 | RightRightLeft := windowLeftWidth + (windowBorder * 2) 212 | RightRightTop := windowBorder 213 | 214 | ;; _________ _________ 215 | ;; | | | | |_X_| -- RightRightTop 216 | ;; | | | | | | 217 | ;; '---i-----' '-----i---' 218 | RightRightTopWidth := windowRightWidth 219 | RightRightTopHeight := windowRightSmallTopHeight 220 | RightRightTopLeft := windowLeftWidth + (windowBorder * 2) 221 | RightRightTopTop := windowBorder 222 | 223 | ;; _________ _________ 224 | ;; | | | | |___| -- RightRightTop 225 | ;; | | | | | X | 226 | ;; '---i-----' '-----i---' 227 | RightRightBotWidth := windowRightWidth 228 | RightRightBotHeight := monitorHeight - taskbarHeight - (windowBorder * 3) - windowRightSmallTopHeight 229 | RightRightBotLeft := windowLeftWidth + (windowBorder * 2) 230 | RightRightBotTop := windowRightSmallTopHeight + (windowBorder * 2) 231 | 232 | ;; simplified winmove function call 233 | ResizeWinMine(Width = 0,Height = 0, MyLeft = 0, MyTop = 0) 234 | { 235 | WinGetPos,X,Y,W,H,A 236 | 237 | If %Width% = 0 238 | Width := W 239 | 240 | If %Height% = 0 241 | Height := H 242 | 243 | 244 | tmpArray := windowOverrides 245 | ;;PrintArray(tmpArray) 246 | 247 | noOverrides = 1 248 | 249 | For index, value in tmpArray{ 250 | ;;MsgBox, index:`t%index%`n 251 | if(WinActive("ahk_exe" . index)){ 252 | MyLeft := MyLeft + windowOverrides[index]["left"] 253 | MyTop := MyTop + windowOverrides[index]["top"] 254 | Width := Width + windowOverrides[index]["width"] 255 | Height := Height + windowOverrides[index]["height"] 256 | noOverrides = 0 257 | ;;MsgBox, MyLeft:`t%MyLeft%`n | MyTop:`t%MyTop% | Width:`t%Width% | Height:`t%Height% 258 | } 259 | } 260 | 261 | if(noOverrides == 1) { 262 | MyLeft := MyLeft + windowOverrides["default"]["left"] 263 | MyTop := MyTop + windowOverrides["default"]["top"] 264 | Width := Width + windowOverrides["default"]["width"] 265 | Height := Height + windowOverrides["default"]["height"] 266 | ;;MsgBox, test2 267 | } 268 | 269 | WinMove,A,,%MyLeft%,%MyTop%,%Width%,%Height% 270 | 271 | } 272 | 273 | ;; configure menu 274 | Menu, Tray, Icon , icon.ico 275 | Menu, tray, NoStandard 276 | Menu, Tray, Add, Exit, Exit 277 | Menu, Tray, Add 278 | Menu, Tray, Add, &Left Left Small, LeftLeft 279 | Menu, Tray, Add, &Left Right Large, LeftRight 280 | Menu, Tray, Add 281 | Menu, Tray, Add, &Right Left Large, LeftLarge 282 | Menu, Tray, Add, &Right Right Small, RightSmall 283 | Menu, Tray, Add 284 | Menu, Tray, Add, &Right Right Small Top, RightSmallTop 285 | Menu, Tray, Add, &Right Right Small Bottom, RightSmallBottom 286 | 287 | ;; keyboard shortcuts 288 | #a::ResizeWinMine(LeftLeftWidth,LeftLeftHeight, LeftLeftLeft, LeftLeftTop) 289 | #s::ResizeWinMine(LeftRightWidth,LeftRightHeight, LeftRightLeft, LeftRightTop) 290 | 291 | #q::ResizeWinMine(RightLeftWidth,RightLeftHeight, RightLeftLeft, RightLeftTop) 292 | #w::ResizeWinMine(RightRightWidth,RightRightHeight, RightRightLeft, RightRightTop) 293 | #e::ResizeWinMine(RightRightTopWidth,RightRightTopHeight, RightRightTopLeft, RightRightTopTop) 294 | #d::ResizeWinMine(RightRightBotWidth,RightRightBotHeight, RightRightBotLeft, RightRightBotTop) 295 | 296 | #z::ResizeWinMine(LeftLeftWidth,LeftLeftHeight, LeftLeftLeft, LeftLeftTop) 297 | #x::ResizeWinMine(LeftRightWidth,LeftRightHeight, LeftRighteft, LeftRightTop) 298 | 299 | ;; menu items 300 | ;; for the menu we have to activate the previos window (may not be perfect in all case) 301 | ;; because the tray popup itself counts as a window 302 | Exit: 303 | ExitApp 304 | 305 | LeftLeft: 306 | Send !{Esc} ; Activate previous window 307 | ResizeWinMine(LeftLeftWidth,LeftLeftHeight, LeftLeftLeft, LeftLeftTop) 308 | return 309 | 310 | LeftRight: 311 | Send !{Esc} ; Activate previous window 312 | ResizeWinMine(LeftRightWidth,LeftRightHeight, LeftRightLeft, LeftRightTop) 313 | return 314 | 315 | LeftLarge: 316 | Send !{Esc} ; Activate previous window 317 | ResizeWinMine(RightLeftWidth,RightLeftHeight, RightLeftLeft, RightLeftTop) 318 | return 319 | 320 | RightSmall: 321 | Send !{Esc} ; Activate previous window 322 | ResizeWinMine(RightRightWidth,RightRightHeight, RightRightLeft, RightRightTop) 323 | return 324 | 325 | RightSmallTop: 326 | Send !{Esc} ; Activate previous window 327 | ResizeWinMine(RightRightTopWidth,RightRightTopHeight, RightRightTopLeft, RightRightTopTop) 328 | return 329 | 330 | RightSmallBottom: 331 | Send !{Esc} ; Activate previous window 332 | ResizeWinMine(RightRightBotWidth,RightRightBotHeight, RightRightBotLeft, RightRightBotTop) 333 | return 334 | -------------------------------------------------------------------------------- /TilingWindowManager.ahk.bak: -------------------------------------------------------------------------------- 1 | #Persistent 2 | #SingleInstance force 3 | 4 | ;; tiling window manager for windows 7-10 designed for 1 or 2 monitors arranging 5 | ;; windows in the following pattern with configurable window sizes and borders: 6 | ;; _________ _________ 7 | ;; | | | | |___| <- primary monitor 8 | ;; | | | | | | 9 | ;; '---i-----' '-----i---' 10 | 11 | ;; todo override windows move keys, eg, win + left 12 | 13 | ;; -- window sizing options 14 | 15 | ;; size of space between windows 16 | windowBorder = 10 17 | ;; width of the large windows that appear closest to the center of the screen 18 | windowLeftWidth = 1200 19 | ;; height of the small top right window 20 | windowRightSmallTopHeight = 550 21 | 22 | ;; monitor geometry 23 | ;; todo: automate this 24 | monitorBorderRight = 1920 25 | monitorBorderLeft = 0 26 | monitorWidth = 1920 27 | monitorHeight = 1080 28 | taskbarHeight = 30 29 | 30 | monitorWidthLeft = 1440 31 | monitorheightRight = 2560 32 | 33 | ;; override system, here you can define a default offset and specific program offsets 34 | ;; this will allow you to setup for custom themes and programs that wont behave 35 | ;; I tried to make this work with WinGetPosEx but even that had many faults 36 | global windowOverrides := Object() 37 | 38 | windowOverrides["default"] := Object() 39 | windowOverrides["default"]["left"] := -8 40 | windowOverrides["default"]["top"] := 0 41 | windowOverrides["default"]["width"] := +16 42 | windowOverrides["default"]["height"] := +8 43 | 44 | windowOverrides["ONENOTE.EXE"] := Object() 45 | windowOverrides["ONENOTE.EXE"]["left"] := 0 46 | windowOverrides["ONENOTE.EXE"]["top"] := 0 47 | windowOverrides["ONENOTE.EXE"]["width"] := 0 48 | windowOverrides["ONENOTE.EXE"]["height"] := 0 49 | 50 | windowOverrides["Steam.exe"] := Object() 51 | windowOverrides["Steam.exe"]["left"] := 1 52 | windowOverrides["Steam.exe"]["top"] := 1 53 | windowOverrides["Steam.exe"]["width"] := -2 54 | windowOverrides["Steam.exe"]["height"] := -2 55 | 56 | windowOverrides["explorer.exe"] := Object() 57 | windowOverrides["explorer.exe"]["left"] := -8 58 | windowOverrides["explorer.exe"]["top"] := 0 59 | windowOverrides["explorer.exe"]["width"] := +16 60 | windowOverrides["explorer.exe"]["height"] := +8 61 | 62 | windowOverrides["atom.exe"] := Object() 63 | windowOverrides["atom.exe"]["left"] := -8 64 | windowOverrides["atom.exe"]["top"] := 0 65 | windowOverrides["atom.exe"]["width"] := +16 66 | windowOverrides["atom.exe"]["height"] := +8 67 | 68 | windowOverrides["chrome.exe"] := Object() 69 | windowOverrides["chrome.exe"]["left"] := -8 70 | windowOverrides["chrome.exe"]["top"] := 0 71 | windowOverrides["chrome.exe"]["width"] := +16 72 | windowOverrides["chrome.exe"]["height"] := +8 73 | 74 | windowOverrides["firefox.exe"] := Object() 75 | windowOverrides["firefox.exe"]["left"] := -6 76 | windowOverrides["firefox.exe"]["top"] := 0 77 | windowOverrides["firefox.exe"]["width"] := +12 78 | windowOverrides["firefox.exe"]["height"] := +6 79 | 80 | windowOverrides["putty.exe"] := Object() 81 | windowOverrides["putty.exe"]["left"] := -4 82 | windowOverrides["putty.exe"]["top"] := 0 83 | windowOverrides["putty.exe"]["width"] := +8 84 | windowOverrides["putty.exe"]["height"] := +4 85 | 86 | windowOverrides["WinSCP.exe"] := Object() 87 | windowOverrides["WinSCP.exe"]["left"] := -8 88 | windowOverrides["WinSCP.exe"]["top"] := 0 89 | windowOverrides["WinSCP.exe"]["width"] := +16 90 | windowOverrides["WinSCP.exe"]["height"] := +8 91 | 92 | windowOverrides["pidgin.exe"] := Object() 93 | windowOverrides["pidgin.exe"]["left"] := -8 94 | windowOverrides["pidgin.exe"]["top"] := 0 95 | windowOverrides["pidgin.exe"]["width"] := +16 96 | windowOverrides["pidgin.exe"]["height"] := +8 97 | 98 | windowOverrides["ApplicationFrameHost.exe"] := Object() 99 | windowOverrides["ApplicationFrameHost.exe"]["left"] := -8 100 | windowOverrides["ApplicationFrameHost.exe"]["top"] := 0 101 | windowOverrides["ApplicationFrameHost.exe"]["width"] := +16 102 | windowOverrides["ApplicationFrameHost.exe"]["height"] := +8 103 | 104 | windowOverrides["Code.exe"] := Object() 105 | windowOverrides["Code.exe"]["left"] := 0 106 | windowOverrides["Code.exe"]["top"] := 0 107 | windowOverrides["Code.exe"]["width"] := 0 108 | windowOverrides["Code.exe"]["height"] := 0 109 | 110 | windowOverrides["slack.exe"] := Object() 111 | windowOverrides["slack.exe"]["left"] := 0 112 | windowOverrides["slack.exe"]["top"] := 0 113 | windowOverrides["slack.exe"]["width"] := 0 114 | windowOverrides["slack.exe"]["height"] := 0 115 | 116 | windowOverrides["Spotify.exe"] := Object() 117 | windowOverrides["Spotify.exe"]["left"] := 0 118 | windowOverrides["Spotify.exe"]["top"] := 0 119 | windowOverrides["Spotify.exe"]["width"] := 0 120 | windowOverrides["Spotify.exe"]["height"] := 0 121 | 122 | windowOverrides["Photoshop.exe"] := Object() 123 | windowOverrides["Photoshop.exe"]["left"] := 0 124 | windowOverrides["Photoshop.exe"]["top"] := 0 125 | windowOverrides["Photoshop.exe"]["width"] := 0 126 | windowOverrides["Photoshop.exe"]["height"] := 0 127 | 128 | windowOverrides["EXCEL.EXE"] := Object() 129 | windowOverrides["EXCEL.EXE"]["left"] := 0 130 | windowOverrides["EXCEL.EXE"]["top"] := 0 131 | windowOverrides["EXCEL.EXE"]["width"] := 0 132 | windowOverrides["EXCEL.EXE"]["height"] := 0 133 | 134 | windowOverrides["Discord.exe"] := Object() 135 | windowOverrides["Discord.exe"]["left"] := 0 136 | windowOverrides["Discord.exe"]["top"] := 0 137 | windowOverrides["Discord.exe"]["width"] := 0 138 | windowOverrides["Discord.exe"]["height"] := 0 139 | 140 | 141 | SysGet, MonitorCount, MonitorCount 142 | SysGet, MonitorPrimary, MonitorPrimary 143 | ;;MsgBox, Monitor Count:`t%MonitorCount%`nPrimary Monitor:`t%MonitorPrimary% 144 | Loop, %MonitorCount% 145 | { 146 | SysGet, MonitorName, MonitorName, %A_Index% 147 | SysGet, Monitor, Monitor, %A_Index% 148 | SysGet, MonitorWorkArea, MonitorWorkArea, %A_Index% 149 | ;;MsgBox, Monitor:`t#%A_Index%`nName:`t%MonitorName%`nLeft:`t%MonitorLeft% (%MonitorWorkAreaLeft% work)`nTop:`t%MonitorTop% (%MonitorWorkAreaTop% work)`nRight:`t%MonitorRight% (%MonitorWorkAreaRight% work)`nBottom:`t%MonitorBottom% (%MonitorWorkAreaBottom% work) 150 | } 151 | 152 | ;; what happens when: 153 | 154 | ;; -- TaskbarMontior1 Montitor2 155 | ;; -- TaskbarMonitor2 Monitor1 156 | 157 | ;; -- Monitor1 TaskbarMonitor2 158 | ;; -- Monitor2 TaskbarMontior1 159 | ;; * Monitor2: -1920 160 | ;; * Monitor1: 0 161 | 162 | 163 | ;;calculated variables used below 164 | windowHeightTall := monitorHeight - (windowBorder * 2) 165 | windowHeightTallTaskbar := monitorHeight - (windowBorder * 2) - taskbarHeight 166 | windowRightWidth := monitorWidth - windowLeftWidth - (windowBorder * 3) 167 | 168 | newLeftWindowWidth := monitorWidthLeft - (windowBorder * 2) 169 | newLeftWindowTopHeight := 800 170 | newLeftWindowBotHeight := 1715 171 | 172 | vertWindowWidth := monitorHeight - (windowBorder * 2) 173 | vertWindowWTopHeight := 2000 174 | vertWindowWBotHeight := monitorWidth - vertWindowWTopHeight - (windowBorder * 2) - taskbarHeight 175 | 176 | newZero := 0 177 | 178 | ;; ___ _________ 179 | ;; | x | | |___| -- LeftLeft 180 | ;; | | | | | 181 | ;; '---i '-----i---' 182 | LeftLeftWidth := monitorWidthLeft - (windowBorder * 2) 183 | LeftLeftHeight := newLeftWindowTopHeight 184 | LeftLeftLeft := (newZero - monitorWidthLeft + 10) 185 | LeftLeftTop := - 506 186 | 187 | ;; ____ _________ 188 | ;; | | | |___| -- LeftRight 189 | ;; | x | | | | 190 | ;; '---i '-----i---' 191 | LeftRightWidth := monitorWidthLeft - (windowBorder * 2) 192 | LeftRightHeight := newLeftWindowBotHeight + windowBorder * 2 - 5 193 | LeftRighteft := (newZero - monitorWidthLeft + 10) 194 | LeftRightTop := - 506 + newLeftWindowTopHeight + windowBorder 195 | 196 | ;; _________ _________ 197 | ;; | | | | |___| -- RightLeft 198 | ;; | | | | X | | 199 | ;; '---i-----' '-----i---' 200 | RightLeftWidth := windowLeftWidth 201 | RightLeftHeight := windowHeightTallTaskbar 202 | RightLeftLeft := windowBorder 203 | RightLeftTop := windowBorder 204 | 205 | ;; _________ _________ 206 | ;; | | | | | | -- RightRight 207 | ;; | | | | | X | 208 | ;; '---i-----' '-----i---' 209 | RightRightWidth := windowRightWidth 210 | RightRightHeight := windowHeightTallTaskbar 211 | RightRightLeft := windowLeftWidth + (windowBorder * 2) 212 | RightRightTop := windowBorder 213 | 214 | ;; _________ _________ 215 | ;; | | | | |_X_| -- RightRightTop 216 | ;; | | | | | | 217 | ;; '---i-----' '-----i---' 218 | RightRightTopWidth := windowRightWidth 219 | RightRightTopHeight := windowRightSmallTopHeight 220 | RightRightTopLeft := windowLeftWidth + (windowBorder * 2) 221 | RightRightTopTop := windowBorder 222 | 223 | ;; _________ _________ 224 | ;; | | | | |___| -- RightRightTop 225 | ;; | | | | | X | 226 | ;; '---i-----' '-----i---' 227 | RightRightBotWidth := windowRightWidth 228 | RightRightBotHeight := monitorHeight - taskbarHeight - (windowBorder * 3) - windowRightSmallTopHeight 229 | RightRightBotLeft := windowLeftWidth + (windowBorder * 2) 230 | RightRightBotTop := windowRightSmallTopHeight + (windowBorder * 2) 231 | 232 | ;; simplified winmove function call 233 | ResizeWinMine(Width = 0,Height = 0, MyLeft = 0, MyTop = 0) 234 | { 235 | WinGetPos,X,Y,W,H,A 236 | 237 | If %Width% = 0 238 | Width := W 239 | 240 | If %Height% = 0 241 | Height := H 242 | 243 | 244 | tmpArray := windowOverrides 245 | ;;PrintArray(tmpArray) 246 | 247 | noOverrides = 1 248 | 249 | For index, value in tmpArray{ 250 | ;;MsgBox, index:`t%index%`n 251 | if(WinActive("ahk_exe" . index)){ 252 | MyLeft := MyLeft + windowOverrides[index]["left"] 253 | MyTop := MyTop + windowOverrides[index]["top"] 254 | Width := Width + windowOverrides[index]["width"] 255 | Height := Height + windowOverrides[index]["height"] 256 | noOverrides = 0 257 | ;;MsgBox, MyLeft:`t%MyLeft%`n | MyTop:`t%MyTop% | Width:`t%Width% | Height:`t%Height% 258 | } 259 | } 260 | 261 | if(noOverrides == 1) { 262 | MyLeft := MyLeft + windowOverrides["default"]["left"] 263 | MyTop := MyTop + windowOverrides["default"]["top"] 264 | Width := Width + windowOverrides["default"]["width"] 265 | Height := Height + windowOverrides["default"]["height"] 266 | ;;MsgBox, test2 267 | } 268 | 269 | WinMove,A,,%MyLeft%,%MyTop%,%Width%,%Height% 270 | 271 | } 272 | 273 | ;; configure menu 274 | Menu, Tray, Icon , icon.ico 275 | Menu, tray, NoStandard 276 | Menu, Tray, Add, Exit, Exit 277 | Menu, Tray, Add 278 | Menu, Tray, Add, &Left Left Small, LeftLeft 279 | Menu, Tray, Add, &Left Right Large, LeftRight 280 | Menu, Tray, Add 281 | Menu, Tray, Add, &Right Left Large, LeftLarge 282 | Menu, Tray, Add, &Right Right Small, RightSmall 283 | Menu, Tray, Add 284 | Menu, Tray, Add, &Right Right Small Top, RightSmallTop 285 | Menu, Tray, Add, &Right Right Small Bottom, RightSmallBottom 286 | 287 | ;; keyboard shortcuts 288 | #a::ResizeWinMine(LeftLeftWidth,LeftLeftHeight, LeftLeftLeft, LeftLeftTop) 289 | #s::ResizeWinMine(LeftRightWidth,LeftRightHeight, LeftRightLeft, LeftRightTop) 290 | 291 | #q::ResizeWinMine(RightLeftWidth,RightLeftHeight, RightLeftLeft, RightLeftTop) 292 | #w::ResizeWinMine(RightRightWidth,RightRightHeight, RightRightLeft, RightRightTop) 293 | #e::ResizeWinMine(RightRightTopWidth,RightRightTopHeight, RightRightTopLeft, RightRightTopTop) 294 | #d::ResizeWinMine(RightRightBotWidth,RightRightBotHeight, RightRightBotLeft, RightRightBotTop) 295 | 296 | #z::ResizeWinMine(LeftLeftWidth,LeftLeftHeight, LeftLeftLeft, LeftLeftTop) 297 | #x::ResizeWinMine(LeftRightWidth,LeftRightHeight, LeftRighteft, LeftRightTop) 298 | 299 | ;; menu items 300 | ;; for the menu we have to activate the previos window (may not be perfect in all case) 301 | ;; because the tray popup itself counts as a window 302 | Exit: 303 | ExitApp 304 | 305 | LeftLeft: 306 | Send !{Esc} ; Activate previous window 307 | ResizeWinMine(LeftLeftWidth,LeftLeftHeight, LeftLeftLeft, LeftLeftTop) 308 | return 309 | 310 | LeftRight: 311 | Send !{Esc} ; Activate previous window 312 | ResizeWinMine(LeftRightWidth,LeftRightHeight, LeftRightLeft, LeftRightTop) 313 | return 314 | 315 | LeftLarge: 316 | Send !{Esc} ; Activate previous window 317 | ResizeWinMine(RightLeftWidth,RightLeftHeight, RightLeftLeft, RightLeftTop) 318 | return 319 | 320 | RightSmall: 321 | Send !{Esc} ; Activate previous window 322 | ResizeWinMine(RightRightWidth,RightRightHeight, RightRightLeft, RightRightTop) 323 | return 324 | 325 | RightSmallTop: 326 | Send !{Esc} ; Activate previous window 327 | ResizeWinMine(RightRightTopWidth,RightRightTopHeight, RightRightTopLeft, RightRightTopTop) 328 | return 329 | 330 | RightSmallBottom: 331 | Send !{Esc} ; Activate previous window 332 | ResizeWinMine(RightRightBotWidth,RightRightBotHeight, RightRightBotLeft, RightRightBotTop) 333 | return 334 | -------------------------------------------------------------------------------- /TilingWindowManagerMonitorRight.ahk: -------------------------------------------------------------------------------- 1 | #Persistent 2 | #SingleInstance force 3 | 4 | ;; tiling window manager for windows 7-10 designed for 1 or 2 monitors arranging 5 | ;; windows in the following pattern with configurable window sizes and borders: 6 | ;; _________ _________ 7 | ;; | | | | |___| <- primary monitor 8 | ;; | | | | | | 9 | ;; '---i-----' '-----i---' 10 | 11 | ;; todo override windows move keys, eg, win + left 12 | 13 | ;; -- window sizing options 14 | 15 | ;; size of space between windows 16 | windowBorder = 10 17 | ;; width of the large windows that appear closest to the center of the screen 18 | windowLeftWidth = 1200 19 | ;; height of the small top right window 20 | windowRightSmallTopHeight = 550 21 | 22 | ;; monitor geometry 23 | ;; todo: automate this 24 | monitorBorderRight = 1920 25 | monitorBorderLeft = 0 26 | monitorWidth = 1920 27 | monitorHeight = 1080 28 | taskbarHeight = 30 29 | 30 | ;; override system, here you can define a default offset and specific program offsets 31 | ;; this will allow you to setup for custom themes and programs that wont behave 32 | ;; I tried to make this work with WinGetPosEx but even that had many faults 33 | global windowOverrides := Object() 34 | 35 | windowOverrides["default"] := Object() 36 | windowOverrides["default"]["left"] := -8 37 | windowOverrides["default"]["top"] := 0 38 | windowOverrides["default"]["width"] := +16 39 | windowOverrides["default"]["height"] := +8 40 | 41 | windowOverrides["ONENOTE.EXE"] := Object() 42 | windowOverrides["ONENOTE.EXE"]["left"] := 0 43 | windowOverrides["ONENOTE.EXE"]["top"] := 0 44 | windowOverrides["ONENOTE.EXE"]["width"] := 0 45 | windowOverrides["ONENOTE.EXE"]["height"] := 0 46 | 47 | windowOverrides["Steam.exe"] := Object() 48 | windowOverrides["Steam.exe"]["left"] := 1 49 | windowOverrides["Steam.exe"]["top"] := 1 50 | windowOverrides["Steam.exe"]["width"] := -2 51 | windowOverrides["Steam.exe"]["height"] := -2 52 | 53 | windowOverrides["explorer.exe"] := Object() 54 | windowOverrides["explorer.exe"]["left"] := -8 55 | windowOverrides["explorer.exe"]["top"] := 0 56 | windowOverrides["explorer.exe"]["width"] := +16 57 | windowOverrides["explorer.exe"]["height"] := +8 58 | 59 | windowOverrides["atom.exe"] := Object() 60 | windowOverrides["atom.exe"]["left"] := -8 61 | windowOverrides["atom.exe"]["top"] := 0 62 | windowOverrides["atom.exe"]["width"] := +16 63 | windowOverrides["atom.exe"]["height"] := +8 64 | 65 | windowOverrides["chrome.exe"] := Object() 66 | windowOverrides["chrome.exe"]["left"] := -8 67 | windowOverrides["chrome.exe"]["top"] := 0 68 | windowOverrides["chrome.exe"]["width"] := +16 69 | windowOverrides["chrome.exe"]["height"] := +8 70 | 71 | windowOverrides["firefox.exe"] := Object() 72 | windowOverrides["firefox.exe"]["left"] := -6 73 | windowOverrides["firefox.exe"]["top"] := 0 74 | windowOverrides["firefox.exe"]["width"] := +12 75 | windowOverrides["firefox.exe"]["height"] := +6 76 | 77 | windowOverrides["putty.exe"] := Object() 78 | windowOverrides["putty.exe"]["left"] := -4 79 | windowOverrides["putty.exe"]["top"] := 0 80 | windowOverrides["putty.exe"]["width"] := +8 81 | windowOverrides["putty.exe"]["height"] := +4 82 | 83 | windowOverrides["WinSCP.exe"] := Object() 84 | windowOverrides["WinSCP.exe"]["left"] := -8 85 | windowOverrides["WinSCP.exe"]["top"] := 0 86 | windowOverrides["WinSCP.exe"]["width"] := +16 87 | windowOverrides["WinSCP.exe"]["height"] := +8 88 | 89 | windowOverrides["pidgin.exe"] := Object() 90 | windowOverrides["pidgin.exe"]["left"] := -8 91 | windowOverrides["pidgin.exe"]["top"] := 0 92 | windowOverrides["pidgin.exe"]["width"] := +16 93 | windowOverrides["pidgin.exe"]["height"] := +8 94 | 95 | windowOverrides["ApplicationFrameHost.exe"] := Object() 96 | windowOverrides["ApplicationFrameHost.exe"]["left"] := -8 97 | windowOverrides["ApplicationFrameHost.exe"]["top"] := 0 98 | windowOverrides["ApplicationFrameHost.exe"]["width"] := +16 99 | windowOverrides["ApplicationFrameHost.exe"]["height"] := +8 100 | 101 | SysGet, MonitorCount, MonitorCount 102 | SysGet, MonitorPrimary, MonitorPrimary 103 | ;;MsgBox, Monitor Count:`t%MonitorCount%`nPrimary Monitor:`t%MonitorPrimary% 104 | Loop, %MonitorCount% 105 | { 106 | SysGet, MonitorName, MonitorName, %A_Index% 107 | SysGet, Monitor, Monitor, %A_Index% 108 | SysGet, MonitorWorkArea, MonitorWorkArea, %A_Index% 109 | ;;MsgBox, Monitor:`t#%A_Index%`nName:`t%MonitorName%`nLeft:`t%MonitorLeft% (%MonitorWorkAreaLeft% work)`nTop:`t%MonitorTop% (%MonitorWorkAreaTop% work)`nRight:`t%MonitorRight% (%MonitorWorkAreaRight% work)`nBottom:`t%MonitorBottom% (%MonitorWorkAreaBottom% work) 110 | } 111 | 112 | ;; what happens when: 113 | 114 | ;; -- TaskbarMontior1 Montitor2 115 | ;; -- TaskbarMonitor2 Monitor1 116 | 117 | ;; -- Monitor1 TaskbarMonitor2 118 | ;; -- Monitor2 TaskbarMontior1 119 | ;; * Monitor2: -1920 120 | ;; * Monitor1: 0 121 | 122 | 123 | ;;calculated variables used below 124 | windowHeightTall := monitorHeight - (windowBorder * 2) 125 | windowHeightTallTaskbar := monitorHeight - (windowBorder * 2) - taskbarHeight 126 | windowRightWidth := monitorWidth - windowLeftWidth - (windowBorder * 3) 127 | 128 | ;; _________ _________ 129 | ;; | | | | |___| -- LeftLeft 130 | ;; | X | | | | | 131 | ;; '---i-----' '-----i---' 132 | LeftLeftWidth := windowLeftWidth 133 | LeftLeftHeight := windowHeightTall 134 | LeftLeftLeft := monitorBorderLeft + windowBorder + monitorWidth 135 | LeftLeftTop := windowBorder 136 | 137 | ;; _________ _________ 138 | ;; | | | | |___| -- LeftRight 139 | ;; | | X | | | | 140 | ;; '---i-----' '-----i---' 141 | LeftRightWidth := windowRightWidth 142 | LeftRightHeight := windowHeightTall 143 | LeftRightLeft := windowLeftWidth + (windowBorder * 2) + monitorWidth 144 | LeftRightTop := windowBorder 145 | 146 | LeftRightLeftNEW := windowRightWidth + (windowBorder * 2) + monitorWidth 147 | 148 | ;; _________ _________ 149 | ;; | | | | |___| -- RightLeft 150 | ;; | | | | X | | 151 | ;; '---i-----' '-----i---' 152 | RightLeftWidth := windowLeftWidth 153 | RightLeftHeight := windowHeightTallTaskbar 154 | RightLeftLeft := windowBorder 155 | RightLeftTop := windowBorder 156 | 157 | ;; _________ _________ 158 | ;; | | | | | | -- RightRight 159 | ;; | | | | | X | 160 | ;; '---i-----' '-----i---' 161 | RightRightWidth := windowRightWidth 162 | RightRightHeight := windowHeightTallTaskbar 163 | RightRightLeft := windowLeftWidth + (windowBorder * 2) 164 | RightRightTop := windowBorder 165 | 166 | ;; _________ _________ 167 | ;; | | | | |_X_| -- RightRightTop 168 | ;; | | | | | | 169 | ;; '---i-----' '-----i---' 170 | RightRightTopWidth := windowRightWidth 171 | RightRightTopHeight := windowRightSmallTopHeight 172 | RightRightTopLeft := windowLeftWidth + (windowBorder * 2) 173 | RightRightTopTop := windowBorder 174 | 175 | ;; _________ _________ 176 | ;; | | | | |___| -- RightRightTop 177 | ;; | | | | | X | 178 | ;; '---i-----' '-----i---' 179 | RightRightBotWidth := windowRightWidth 180 | RightRightBotHeight := monitorHeight - taskbarHeight - (windowBorder * 3) - windowRightSmallTopHeight 181 | RightRightBotLeft := windowLeftWidth + (windowBorder * 2) 182 | RightRightBotTop := windowRightSmallTopHeight + (windowBorder * 2) 183 | 184 | ;; simplified winmove function call 185 | ResizeWinMine(Width = 0,Height = 0, MyLeft = 0, MyTop = 0) 186 | { 187 | WinGetPos,X,Y,W,H,A 188 | 189 | If %Width% = 0 190 | Width := W 191 | 192 | If %Height% = 0 193 | Height := H 194 | 195 | 196 | tmpArray := windowOverrides 197 | ;;PrintArray(tmpArray) 198 | 199 | noOverrides = 1 200 | 201 | For index, value in tmpArray{ 202 | ;;MsgBox, index:`t%index%`n 203 | if(WinActive("ahk_exe" . index)){ 204 | MyLeft := MyLeft + windowOverrides[index]["left"] 205 | MyTop := MyTop + windowOverrides[index]["top"] 206 | Width := Width + windowOverrides[index]["width"] 207 | Height := Height + windowOverrides[index]["height"] 208 | noOverrides = 0 209 | ;;MsgBox, MyLeft:`t%MyLeft%`n | MyTop:`t%MyTop% | Width:`t%Width% | Height:`t%Height% 210 | } 211 | } 212 | 213 | if(noOverrides == 1) { 214 | MyLeft := MyLeft + windowOverrides["default"]["left"] 215 | MyTop := MyTop + windowOverrides["default"]["top"] 216 | Width := Width + windowOverrides["default"]["width"] 217 | Height := Height + windowOverrides["default"]["height"] 218 | ;;MsgBox, test2 219 | } 220 | 221 | WinMove,A,,%MyLeft%,%MyTop%,%Width%,%Height% 222 | 223 | } 224 | 225 | ;; configure menu 226 | Menu, Tray, Icon , icon.ico 227 | Menu, tray, NoStandard 228 | Menu, Tray, Add, Exit, Exit 229 | Menu, Tray, Add 230 | Menu, Tray, Add, &Left Left Small, LeftLeft 231 | Menu, Tray, Add, &Left Right Large, LeftRight 232 | Menu, Tray, Add 233 | Menu, Tray, Add, &Right Left Large, LeftLarge 234 | Menu, Tray, Add, &Right Right Small, RightSmall 235 | Menu, Tray, Add 236 | Menu, Tray, Add, &Right Right Small Top, RightSmallTop 237 | Menu, Tray, Add, &Right Right Small Bottom, RightSmallBottom 238 | 239 | ;; keyboard shortcuts 240 | #a::ResizeWinMine(LeftLeftWidth,LeftLeftHeight, LeftLeftLeft, LeftLeftTop) 241 | #s::ResizeWinMine(LeftRightWidth,LeftRightHeight, LeftRightLeft, LeftRightTop) 242 | 243 | #q::ResizeWinMine(RightLeftWidth,RightLeftHeight, RightLeftLeft, RightLeftTop) 244 | #w::ResizeWinMine(RightRightWidth,RightRightHeight, RightRightLeft, RightRightTop) 245 | #e::ResizeWinMine(RightRightTopWidth,RightRightTopHeight, RightRightTopLeft, RightRightTopTop) 246 | #d::ResizeWinMine(RightRightBotWidth,RightRightBotHeight, RightRightBotLeft, RightRightBotTop) 247 | 248 | ;; no borders 249 | #z::ResizeWinMine(RightLeftWidth + (windowBorder),RightLeftHeight + (windowBorder * 2), RightLeftLeft - windowBorder, RightLeftTop - windowBorder) 250 | #x::ResizeWinMine(RightRightWidth + (windowBorder * 2),RightRightHeight + (windowBorder * 2), RightRightLeft - windowBorder, RightRightTop - windowBorder) 251 | #c::ResizeWinMine(LeftLeftWidth + (windowBorder),LeftLeftHeight + (windowBorder * 2), LeftLeftLeft - windowBorder, LeftLeftTop - windowBorder) 252 | #v::ResizeWinMine(LeftRightWidth + (windowBorder * 2),LeftRightHeight + (windowBorder * 2), LeftRightLeft - windowBorder, LeftRightTop - windowBorder) 253 | 254 | ;; second change 255 | #b::ResizeWinMine(LeftRightWidth + (windowBorder) + 150,LeftLeftHeight + (windowBorder * 2), LeftLeftLeft - windowBorder, LeftLeftTop - windowBorder) 256 | #n::ResizeWinMine(LeftLeftWidth + (windowBorder * 2) - 150,LeftRightHeight + (windowBorder * 2), LeftRightLeftNEW - windowBorder + 150, LeftRightTop - windowBorder) 257 | 258 | 259 | ;; menu items 260 | ;; for the menu we have to activate the previos window (may not be perfect in all case) 261 | ;; because the tray popup itself counts as a window 262 | Exit: 263 | ExitApp 264 | 265 | LeftLeft: 266 | Send !{Esc} ; Activate previous window 267 | ResizeWinMine(LeftLeftWidth,LeftLeftHeight, LeftLeftLeft, LeftLeftTop) 268 | return 269 | 270 | LeftRight: 271 | Send !{Esc} ; Activate previous window 272 | ResizeWinMine(LeftRightWidth,LeftRightHeight, LeftRightLeft, LeftRightTop) 273 | return 274 | 275 | LeftLarge: 276 | Send !{Esc} ; Activate previous window 277 | ResizeWinMine(RightLeftWidth,RightLeftHeight, RightLeftLeft, RightLeftTop) 278 | return 279 | 280 | RightSmall: 281 | Send !{Esc} ; Activate previous window 282 | ResizeWinMine(RightRightWidth,RightRightHeight, RightRightLeft, RightRightTop) 283 | return 284 | 285 | RightSmallTop: 286 | Send !{Esc} ; Activate previous window 287 | ResizeWinMine(RightRightTopWidth,RightRightTopHeight, RightRightTopLeft, RightRightTopTop) 288 | return 289 | 290 | RightSmallBottom: 291 | Send !{Esc} ; Activate previous window 292 | ResizeWinMine(RightRightBotWidth,RightRightBotHeight, RightRightBotLeft, RightRightBotTop) 293 | return 294 | -------------------------------------------------------------------------------- /TilingWindowManagerMonitorRight.ahk.bak: -------------------------------------------------------------------------------- 1 | #Persistent 2 | #SingleInstance force 3 | 4 | ;; tiling window manager for windows 7-10 designed for 1 or 2 monitors arranging 5 | ;; windows in the following pattern with configurable window sizes and borders: 6 | ;; _________ _________ 7 | ;; | | | | |___| <- primary monitor 8 | ;; | | | | | | 9 | ;; '---i-----' '-----i---' 10 | 11 | ;; todo override windows move keys, eg, win + left 12 | 13 | ;; -- window sizing options 14 | 15 | ;; size of space between windows 16 | windowBorder = 10 17 | ;; width of the large windows that appear closest to the center of the screen 18 | windowLeftWidth = 1200 19 | ;; height of the small top right window 20 | windowRightSmallTopHeight = 550 21 | 22 | ;; monitor geometry 23 | ;; todo: automate this 24 | monitorBorderRight = 1920 25 | monitorBorderLeft = 0 26 | monitorWidth = 1920 27 | monitorHeight = 1080 28 | taskbarHeight = 30 29 | 30 | ;; override system, here you can define a default offset and specific program offsets 31 | ;; this will allow you to setup for custom themes and programs that wont behave 32 | ;; I tried to make this work with WinGetPosEx but even that had many faults 33 | global windowOverrides := Object() 34 | 35 | windowOverrides["default"] := Object() 36 | windowOverrides["default"]["left"] := -8 37 | windowOverrides["default"]["top"] := 0 38 | windowOverrides["default"]["width"] := +16 39 | windowOverrides["default"]["height"] := +8 40 | 41 | windowOverrides["ONENOTE.EXE"] := Object() 42 | windowOverrides["ONENOTE.EXE"]["left"] := 0 43 | windowOverrides["ONENOTE.EXE"]["top"] := 0 44 | windowOverrides["ONENOTE.EXE"]["width"] := 0 45 | windowOverrides["ONENOTE.EXE"]["height"] := 0 46 | 47 | windowOverrides["Steam.exe"] := Object() 48 | windowOverrides["Steam.exe"]["left"] := 1 49 | windowOverrides["Steam.exe"]["top"] := 1 50 | windowOverrides["Steam.exe"]["width"] := -2 51 | windowOverrides["Steam.exe"]["height"] := -2 52 | 53 | windowOverrides["explorer.exe"] := Object() 54 | windowOverrides["explorer.exe"]["left"] := -8 55 | windowOverrides["explorer.exe"]["top"] := 0 56 | windowOverrides["explorer.exe"]["width"] := +16 57 | windowOverrides["explorer.exe"]["height"] := +8 58 | 59 | windowOverrides["atom.exe"] := Object() 60 | windowOverrides["atom.exe"]["left"] := -8 61 | windowOverrides["atom.exe"]["top"] := 0 62 | windowOverrides["atom.exe"]["width"] := +16 63 | windowOverrides["atom.exe"]["height"] := +8 64 | 65 | windowOverrides["chrome.exe"] := Object() 66 | windowOverrides["chrome.exe"]["left"] := -8 67 | windowOverrides["chrome.exe"]["top"] := 0 68 | windowOverrides["chrome.exe"]["width"] := +16 69 | windowOverrides["chrome.exe"]["height"] := +8 70 | 71 | windowOverrides["firefox.exe"] := Object() 72 | windowOverrides["firefox.exe"]["left"] := -6 73 | windowOverrides["firefox.exe"]["top"] := 0 74 | windowOverrides["firefox.exe"]["width"] := +12 75 | windowOverrides["firefox.exe"]["height"] := +6 76 | 77 | windowOverrides["putty.exe"] := Object() 78 | windowOverrides["putty.exe"]["left"] := -4 79 | windowOverrides["putty.exe"]["top"] := 0 80 | windowOverrides["putty.exe"]["width"] := +8 81 | windowOverrides["putty.exe"]["height"] := +4 82 | 83 | windowOverrides["WinSCP.exe"] := Object() 84 | windowOverrides["WinSCP.exe"]["left"] := -8 85 | windowOverrides["WinSCP.exe"]["top"] := 0 86 | windowOverrides["WinSCP.exe"]["width"] := +16 87 | windowOverrides["WinSCP.exe"]["height"] := +8 88 | 89 | windowOverrides["pidgin.exe"] := Object() 90 | windowOverrides["pidgin.exe"]["left"] := -8 91 | windowOverrides["pidgin.exe"]["top"] := 0 92 | windowOverrides["pidgin.exe"]["width"] := +16 93 | windowOverrides["pidgin.exe"]["height"] := +8 94 | 95 | windowOverrides["ApplicationFrameHost.exe"] := Object() 96 | windowOverrides["ApplicationFrameHost.exe"]["left"] := -8 97 | windowOverrides["ApplicationFrameHost.exe"]["top"] := 0 98 | windowOverrides["ApplicationFrameHost.exe"]["width"] := +16 99 | windowOverrides["ApplicationFrameHost.exe"]["height"] := +8 100 | 101 | SysGet, MonitorCount, MonitorCount 102 | SysGet, MonitorPrimary, MonitorPrimary 103 | ;;MsgBox, Monitor Count:`t%MonitorCount%`nPrimary Monitor:`t%MonitorPrimary% 104 | Loop, %MonitorCount% 105 | { 106 | SysGet, MonitorName, MonitorName, %A_Index% 107 | SysGet, Monitor, Monitor, %A_Index% 108 | SysGet, MonitorWorkArea, MonitorWorkArea, %A_Index% 109 | ;;MsgBox, Monitor:`t#%A_Index%`nName:`t%MonitorName%`nLeft:`t%MonitorLeft% (%MonitorWorkAreaLeft% work)`nTop:`t%MonitorTop% (%MonitorWorkAreaTop% work)`nRight:`t%MonitorRight% (%MonitorWorkAreaRight% work)`nBottom:`t%MonitorBottom% (%MonitorWorkAreaBottom% work) 110 | } 111 | 112 | ;; what happens when: 113 | 114 | ;; -- TaskbarMontior1 Montitor2 115 | ;; -- TaskbarMonitor2 Monitor1 116 | 117 | ;; -- Monitor1 TaskbarMonitor2 118 | ;; -- Monitor2 TaskbarMontior1 119 | ;; * Monitor2: -1920 120 | ;; * Monitor1: 0 121 | 122 | 123 | ;;calculated variables used below 124 | windowHeightTall := monitorHeight - (windowBorder * 2) 125 | windowHeightTallTaskbar := monitorHeight - (windowBorder * 2) - taskbarHeight 126 | windowRightWidth := monitorWidth - windowLeftWidth - (windowBorder * 3) 127 | 128 | ;; _________ _________ 129 | ;; | | | | |___| -- LeftLeft 130 | ;; | X | | | | | 131 | ;; '---i-----' '-----i---' 132 | LeftLeftWidth := windowLeftWidth 133 | LeftLeftHeight := windowHeightTall 134 | LeftLeftLeft := monitorBorderLeft + windowBorder + monitorWidth 135 | LeftLeftTop := windowBorder 136 | 137 | ;; _________ _________ 138 | ;; | | | | |___| -- LeftRight 139 | ;; | | X | | | | 140 | ;; '---i-----' '-----i---' 141 | LeftRightWidth := windowRightWidth 142 | LeftRightHeight := windowHeightTall 143 | LeftRightLeft := windowLeftWidth + (windowBorder * 2) + monitorWidth 144 | LeftRightTop := windowBorder 145 | 146 | LeftRightLeftNEW := windowRightWidth + (windowBorder * 2) + monitorWidth 147 | 148 | ;; _________ _________ 149 | ;; | | | | |___| -- RightLeft 150 | ;; | | | | X | | 151 | ;; '---i-----' '-----i---' 152 | RightLeftWidth := windowLeftWidth 153 | RightLeftHeight := windowHeightTallTaskbar 154 | RightLeftLeft := windowBorder 155 | RightLeftTop := windowBorder 156 | 157 | ;; _________ _________ 158 | ;; | | | | | | -- RightRight 159 | ;; | | | | | X | 160 | ;; '---i-----' '-----i---' 161 | RightRightWidth := windowRightWidth 162 | RightRightHeight := windowHeightTallTaskbar 163 | RightRightLeft := windowLeftWidth + (windowBorder * 2) 164 | RightRightTop := windowBorder 165 | 166 | ;; _________ _________ 167 | ;; | | | | |_X_| -- RightRightTop 168 | ;; | | | | | | 169 | ;; '---i-----' '-----i---' 170 | RightRightTopWidth := windowRightWidth 171 | RightRightTopHeight := windowRightSmallTopHeight 172 | RightRightTopLeft := windowLeftWidth + (windowBorder * 2) 173 | RightRightTopTop := windowBorder 174 | 175 | ;; _________ _________ 176 | ;; | | | | |___| -- RightRightTop 177 | ;; | | | | | X | 178 | ;; '---i-----' '-----i---' 179 | RightRightBotWidth := windowRightWidth 180 | RightRightBotHeight := monitorHeight - taskbarHeight - (windowBorder * 3) - windowRightSmallTopHeight 181 | RightRightBotLeft := windowLeftWidth + (windowBorder * 2) 182 | RightRightBotTop := windowRightSmallTopHeight + (windowBorder * 2) 183 | 184 | ;; simplified winmove function call 185 | ResizeWinMine(Width = 0,Height = 0, MyLeft = 0, MyTop = 0) 186 | { 187 | WinGetPos,X,Y,W,H,A 188 | 189 | If %Width% = 0 190 | Width := W 191 | 192 | If %Height% = 0 193 | Height := H 194 | 195 | 196 | tmpArray := windowOverrides 197 | ;;PrintArray(tmpArray) 198 | 199 | noOverrides = 1 200 | 201 | For index, value in tmpArray{ 202 | ;;MsgBox, index:`t%index%`n 203 | if(WinActive("ahk_exe" . index)){ 204 | MyLeft := MyLeft + windowOverrides[index]["left"] 205 | MyTop := MyTop + windowOverrides[index]["top"] 206 | Width := Width + windowOverrides[index]["width"] 207 | Height := Height + windowOverrides[index]["height"] 208 | noOverrides = 0 209 | ;;MsgBox, MyLeft:`t%MyLeft%`n | MyTop:`t%MyTop% | Width:`t%Width% | Height:`t%Height% 210 | } 211 | } 212 | 213 | if(noOverrides == 1) { 214 | MyLeft := MyLeft + windowOverrides["default"]["left"] 215 | MyTop := MyTop + windowOverrides["default"]["top"] 216 | Width := Width + windowOverrides["default"]["width"] 217 | Height := Height + windowOverrides["default"]["height"] 218 | ;;MsgBox, test2 219 | } 220 | 221 | WinMove,A,,%MyLeft%,%MyTop%,%Width%,%Height% 222 | 223 | } 224 | 225 | ;; configure menu 226 | Menu, Tray, Icon , icon.ico 227 | Menu, tray, NoStandard 228 | Menu, Tray, Add, Exit, Exit 229 | Menu, Tray, Add 230 | Menu, Tray, Add, &Left Left Small, LeftLeft 231 | Menu, Tray, Add, &Left Right Large, LeftRight 232 | Menu, Tray, Add 233 | Menu, Tray, Add, &Right Left Large, LeftLarge 234 | Menu, Tray, Add, &Right Right Small, RightSmall 235 | Menu, Tray, Add 236 | Menu, Tray, Add, &Right Right Small Top, RightSmallTop 237 | Menu, Tray, Add, &Right Right Small Bottom, RightSmallBottom 238 | 239 | ;; keyboard shortcuts 240 | #a::ResizeWinMine(LeftLeftWidth,LeftLeftHeight, LeftLeftLeft, LeftLeftTop) 241 | #s::ResizeWinMine(LeftRightWidth,LeftRightHeight, LeftRightLeft, LeftRightTop) 242 | 243 | #q::ResizeWinMine(RightLeftWidth,RightLeftHeight, RightLeftLeft, RightLeftTop) 244 | #w::ResizeWinMine(RightRightWidth,RightRightHeight, RightRightLeft, RightRightTop) 245 | #e::ResizeWinMine(RightRightTopWidth,RightRightTopHeight, RightRightTopLeft, RightRightTopTop) 246 | #d::ResizeWinMine(RightRightBotWidth,RightRightBotHeight, RightRightBotLeft, RightRightBotTop) 247 | 248 | ;; no borders 249 | #z::ResizeWinMine(RightLeftWidth,RightLeftHeight + (windowBorder * 2), RightLeftLeft - windowBorder, RightLeftTop - windowBorder) 250 | #x::ResizeWinMine(RightRightWidth + (windowBorder * 2),RightRightHeight + (windowBorder * 2), RightRightLeft - windowBorder, RightRightTop - windowBorder) 251 | #c::ResizeWinMine(LeftLeftWidth,LeftLeftHeight + (windowBorder * 2), LeftLeftLeft - windowBorder, LeftLeftTop - windowBorder) 252 | #v::ResizeWinMine(LeftRightWidth + (windowBorder * 2),LeftRightHeight + (windowBorder * 2), LeftRightLeft - windowBorder, LeftRightTop - windowBorder) 253 | 254 | ;; second change 255 | #b::ResizeWinMine(LeftRightWidth + 150,LeftLeftHeight + (windowBorder * 2), LeftLeftLeft - windowBorder, LeftLeftTop - windowBorder) 256 | #n::ResizeWinMine(LeftLeftWidth + (windowBorder * 2) - 150,LeftRightHeight + (windowBorder * 2), LeftRightLeftNEW - windowBorder + 150, LeftRightTop - windowBorder) 257 | 258 | 259 | ;; menu items 260 | ;; for the menu we have to activate the previos window (may not be perfect in all case) 261 | ;; because the tray popup itself counts as a window 262 | Exit: 263 | ExitApp 264 | 265 | LeftLeft: 266 | Send !{Esc} ; Activate previous window 267 | ResizeWinMine(LeftLeftWidth,LeftLeftHeight, LeftLeftLeft, LeftLeftTop) 268 | return 269 | 270 | LeftRight: 271 | Send !{Esc} ; Activate previous window 272 | ResizeWinMine(LeftRightWidth,LeftRightHeight, LeftRightLeft, LeftRightTop) 273 | return 274 | 275 | LeftLarge: 276 | Send !{Esc} ; Activate previous window 277 | ResizeWinMine(RightLeftWidth,RightLeftHeight, RightLeftLeft, RightLeftTop) 278 | return 279 | 280 | RightSmall: 281 | Send !{Esc} ; Activate previous window 282 | ResizeWinMine(RightRightWidth,RightRightHeight, RightRightLeft, RightRightTop) 283 | return 284 | 285 | RightSmallTop: 286 | Send !{Esc} ; Activate previous window 287 | ResizeWinMine(RightRightTopWidth,RightRightTopHeight, RightRightTopLeft, RightRightTopTop) 288 | return 289 | 290 | RightSmallBottom: 291 | Send !{Esc} ; Activate previous window 292 | ResizeWinMine(RightRightBotWidth,RightRightBotHeight, RightRightBotLeft, RightRightBotTop) 293 | return 294 | -------------------------------------------------------------------------------- /TilingWindowManagerSurface.ahk: -------------------------------------------------------------------------------- 1 | #Persistent 2 | #SingleInstance force 3 | 4 | ;; tiling window manager for windows 7-10 designed for 1 or 2 monitors arranging 5 | ;; windows in the following pattern with configurable window sizes and borders: 6 | ;; _________ _________ 7 | ;; | | | | |___| <- primary monitor 8 | ;; | | | |_____| | 9 | ;; '---i-----' '-----i---' 10 | 11 | ;; todo override windows move keys, eg, win + left 12 | 13 | ;; -- window sizing options 14 | 15 | ;; size of space between windows 16 | windowBorder = 15 17 | ;; width of the large windows that appear closest to the center of the screen 18 | windowLeftWidth = 1770 19 | ;; height of the small top right window 20 | windowRightSmallTopHeight = 1100 21 | ;; height of the top left main window 22 | windowLeftSmallTopHeight = 1500 23 | 24 | ;; monitor geometry 25 | ;; todo: automate this 26 | monitorBorderRight = 1920 27 | monitorBorderLeft = 0 28 | monitorWidth = 3000 29 | monitorHeight = 2000 30 | taskbarHeight = 52 31 | 32 | monitorWidthLeft = 1440 33 | monitorheightRight = 2560 34 | 35 | ;; override system, here you can define a default offset and specific program offsets 36 | ;; this will allow you to setup for custom themes and programs that wont behave 37 | ;; I tried to make this work with WinGetPosEx but even that had many faults 38 | global windowOverrides := Object() 39 | 40 | windowOverrides["default"] := Object() 41 | windowOverrides["default"]["left"] := -11 42 | windowOverrides["default"]["top"] := 0 43 | windowOverrides["default"]["width"] := +23 44 | windowOverrides["default"]["height"] := 0 45 | 46 | 47 | windowOverrides["firefox.exe"] := Object() 48 | windowOverrides["firefox.exe"]["left"] := -9 49 | windowOverrides["firefox.exe"]["top"] := 0 50 | windowOverrides["firefox.exe"]["width"] := +19 51 | windowOverrides["firefox.exe"]["height"] := +10 52 | 53 | windowOverrides["Spotify.exe"] := Object() 54 | windowOverrides["Spotify.exe"]["left"] := +4 55 | windowOverrides["Spotify.exe"]["top"] := 0 56 | windowOverrides["Spotify.exe"]["width"] := -4 57 | windowOverrides["Spotify.exe"]["height"] := -12 58 | 59 | windowOverrides["pidgin.exe"] := Object() 60 | windowOverrides["pidgin.exe"]["left"] := -15 61 | windowOverrides["pidgin.exe"]["top"] := 0 62 | windowOverrides["pidgin.exe"]["width"] := +33 63 | windowOverrides["pidgin.exe"]["height"] := +12 64 | 65 | windowOverrides["Photoshop.exe"] := Object() 66 | windowOverrides["Photoshop.exe"]["left"] := -2 67 | windowOverrides["Photoshop.exe"]["top"] := -2 68 | windowOverrides["Photoshop.exe"]["width"] := 0 69 | windowOverrides["Photoshop.exe"]["height"] := -10 70 | 71 | 72 | windowOverrides["ONENOTE.EXE"] := Object() 73 | windowOverrides["ONENOTE.EXE"]["left"] := 0 74 | windowOverrides["ONENOTE.EXE"]["top"] := 0 75 | windowOverrides["ONENOTE.EXE"]["width"] := 0 76 | windowOverrides["ONENOTE.EXE"]["height"] := 0 77 | 78 | windowOverrides["slack.exe"] := Object() 79 | windowOverrides["slack.exe"]["left"] := 0 80 | windowOverrides["slack.exe"]["top"] := 0 81 | windowOverrides["slack.exe"]["width"] := -2 82 | windowOverrides["slack.exe"]["height"] := -14 83 | 84 | windowOverrides["ConEmu64.exe"] := Object() 85 | windowOverrides["ConEmu64.exe"]["left"] := -15 86 | windowOverrides["ConEmu64.exe"]["top"] := 0 87 | windowOverrides["ConEmu64.exe"]["width"] := +30 88 | windowOverrides["ConEmu64.exe"]["height"] := +2 89 | 90 | windowOverrides["emacs.exe"] := Object() 91 | windowOverrides["emacs.exe"]["left"] := -15 92 | windowOverrides["emacs.exe"]["top"] := 0 93 | windowOverrides["emacs.exe"]["width"] := +30 94 | windowOverrides["emacs.exe"]["height"] := +2 95 | 96 | windowOverrides["Code.exe"] := Object() 97 | windowOverrides["Code.exe"]["left"] := -12 98 | windowOverrides["Code.exe"]["top"] := 0 99 | windowOverrides["Code.exe"]["width"] := +24 100 | windowOverrides["Code.exe"]["height"] := 0 101 | 102 | 103 | 104 | 105 | /* 106 | windowOverrides["Steam.exe"] := Object() 107 | windowOverrides["Steam.exe"]["left"] := 1 108 | windowOverrides["Steam.exe"]["top"] := 1 109 | windowOverrides["Steam.exe"]["width"] := -2 110 | windowOverrides["Steam.exe"]["height"] := -2 111 | 112 | windowOverrides["explorer.exe"] := Object() 113 | windowOverrides["explorer.exe"]["left"] := -16 114 | windowOverrides["explorer.exe"]["top"] := 0 115 | windowOverrides["explorer.exe"]["width"] := +32 116 | windowOverrides["explorer.exe"]["height"] := +10 117 | 118 | windowOverrides["atom.exe"] := Object() 119 | windowOverrides["atom.exe"]["left"] := -16 120 | windowOverrides["atom.exe"]["top"] := 0 121 | windowOverrides["atom.exe"]["width"] := +32 122 | windowOverrides["atom.exe"]["height"] := +10 123 | 124 | windowOverrides["chrome.exe"] := Object() 125 | windowOverrides["chrome.exe"]["left"] := -16 126 | windowOverrides["chrome.exe"]["top"] := 0 127 | windowOverrides["chrome.exe"]["width"] := +32 128 | windowOverrides["chrome.exe"]["height"] := +10 129 | 130 | windowOverrides["firefox.exe"] := Object() 131 | windowOverrides["firefox.exe"]["left"] := -12 132 | windowOverrides["firefox.exe"]["top"] := 0 133 | windowOverrides["firefox.exe"]["width"] := +20 134 | windowOverrides["firefox.exe"]["height"] := +6 135 | 136 | windowOverrides["putty.exe"] := Object() 137 | windowOverrides["putty.exe"]["left"] := -4 138 | windowOverrides["putty.exe"]["top"] := 0 139 | windowOverrides["putty.exe"]["width"] := +8 140 | windowOverrides["putty.exe"]["height"] := +4 141 | 142 | windowOverrides["WinSCP.exe"] := Object() 143 | windowOverrides["WinSCP.exe"]["left"] := -16 144 | windowOverrides["WinSCP.exe"]["top"] := 0 145 | windowOverrides["WinSCP.exe"]["width"] := +32 146 | windowOverrides["WinSCP.exe"]["height"] := +10 147 | 148 | windowOverrides["pidgin.exe"] := Object() 149 | windowOverrides["pidgin.exe"]["left"] := -16 150 | windowOverrides["pidgin.exe"]["top"] := 0 151 | windowOverrides["pidgin.exe"]["width"] := +32 152 | windowOverrides["pidgin.exe"]["height"] := +10 153 | 154 | 155 | */ 156 | SysGet, MonitorCount, MonitorCount 157 | SysGet, MonitorPrimary, MonitorPrimary 158 | ;;MsgBox, Monitor Count:`t%MonitorCount%`nPrimary Monitor:`t%MonitorPrimary% 159 | Loop, %MonitorCount% 160 | { 161 | SysGet, MonitorName, MonitorName, %A_Index% 162 | SysGet, Monitor, Monitor, %A_Index% 163 | SysGet, MonitorWorkArea, MonitorWorkArea, %A_Index% 164 | ;;MsgBox, Monitor:`t#%A_Index%`nName:`t%MonitorName%`nLeft:`t%MonitorLeft% (%MonitorWorkAreaLeft% work)`nTop:`t%MonitorTop% (%MonitorWorkAreaTop% work)`nRight:`t%MonitorRight% (%MonitorWorkAreaRight% work)`nBottom:`t%MonitorBottom% (%MonitorWorkAreaBottom% work) 165 | } 166 | 167 | ;; what happens when: 168 | 169 | ;; -- TaskbarMontior1 Montitor2 170 | ;; -- TaskbarMonitor2 Monitor1 171 | 172 | ;; -- Monitor1 TaskbarMonitor2 173 | ;; -- Monitor2 TaskbarMontior1 174 | ;; * Monitor2: -1920 175 | ;; * Monitor1: 0 176 | 177 | 178 | ;;calculated variables used below 179 | windowHeightTall := monitorHeight - (windowBorder * 2) 180 | windowHeightTallTaskbar := monitorHeight - (windowBorder * 2) - taskbarHeight 181 | windowRightWidth := monitorWidth - windowLeftWidth - (windowBorder * 3) 182 | 183 | newLeftWindowWidth := monitorWidthLeft - (windowBorder * 2) 184 | newLeftWindowTopHeight := 800 185 | newLeftWindowBotHeight := 1715 186 | 187 | vertWindowWidth := monitorHeight - (windowBorder * 2) 188 | vertWindowWTopHeight := 2000 189 | vertWindowWBotHeight := monitorWidth - vertWindowWTopHeight - (windowBorder * 2) - taskbarHeight 190 | 191 | newZero := 0 192 | 193 | ;; ___ _________ 194 | ;; | x | | |___| -- LeftLeft 195 | ;; | | | | | 196 | ;; '---i '-----i---' 197 | LeftLeftWidth := (monitorWidthLeft * 2) - (windowBorder * 2) 198 | LeftLeftHeight := newLeftWindowTopHeight * 2 199 | LeftLeftLeft := (newZero - (monitorWidthLeft * 2) + 15) 200 | LeftLeftTop := - 600 201 | 202 | ;; ____ _________ 203 | ;; | | | |___| -- LeftRight 204 | ;; | x | | | | 205 | ;; '---i '-----i---' 206 | LeftRightWidth := (monitorWidthLeft * 2) - (windowBorder * 2) 207 | LeftRightHeight := newLeftWindowBotHeight * 2 + (windowBorder * 3) 208 | LeftRighteft := (newZero - (monitorWidthLeft * 2) + 15) 209 | LeftRightTop := - 600 + (newLeftWindowTopHeight * 2) + windowBorder 210 | 211 | ;; _________ _________ 212 | ;; | | | | |___| -- RightLeft 213 | ;; | | | | X | | 214 | ;; '---i-----' '-----i---' 215 | RightLeftWidth := windowLeftWidth 216 | RightLeftHeight := windowHeightTallTaskbar 217 | RightLeftLeft := windowBorder 218 | RightLeftTop := windowBorder 219 | 220 | ;; _________ _________ 221 | ;; | | | | x |___| -- RightLeftTop 222 | ;; | | | |_____| | 223 | ;; '---i-----' '-----i---' 224 | RightLeftTopWidth := windowLeftWidth 225 | RightLeftTopHeight := windowLeftSmallTopHeight 226 | RightLeftTopLeft := windowBorder 227 | RightLeftTopTop := windowBorder 228 | 229 | ;; _________ _________ 230 | ;; | | | | |___| -- RightLeftBottom 231 | ;; | | | |_____| | 232 | ;; '---i-----' '--X--i---' 233 | RightLeftBotWidth := windowLeftWidth 234 | RightLeftBotHeight := monitorHeight - taskbarHeight - (windowBorder * 3) - windowLeftSmallTopHeight 235 | RightLeftBotLeft := windowBorder 236 | RightLeftBotTop := windowLeftSmallTopHeight + (windowBorder * 2) 237 | 238 | ;; _________ _________ 239 | ;; | | | | | | -- RightRight 240 | ;; | | | | | X | 241 | ;; '---i-----' '-----i---' 242 | RightRightWidth := windowRightWidth 243 | RightRightHeight := windowHeightTallTaskbar 244 | RightRightLeft := windowLeftWidth + (windowBorder * 2) 245 | RightRightTop := windowBorder 246 | 247 | ;; _________ _________ 248 | ;; | | | | |_X_| -- RightRightTop 249 | ;; | | | | | | 250 | ;; '---i-----' '-----i---' 251 | RightRightTopWidth := windowRightWidth 252 | RightRightTopHeight := windowRightSmallTopHeight 253 | RightRightTopLeft := windowLeftWidth + (windowBorder * 2) 254 | RightRightTopTop := windowBorder 255 | 256 | ;; _________ _________ 257 | ;; | | | | |___| -- RightRightTop 258 | ;; | | | | | X | 259 | ;; '---i-----' '-----i---' 260 | RightRightBotWidth := windowRightWidth 261 | RightRightBotHeight := monitorHeight - taskbarHeight - (windowBorder * 3) - windowRightSmallTopHeight 262 | RightRightBotLeft := windowLeftWidth + (windowBorder * 2) 263 | RightRightBotTop := windowRightSmallTopHeight + (windowBorder * 2) 264 | 265 | ;; simplified winmove function call 266 | ResizeWinMine(Width = 0,Height = 0, MyLeft = 0, MyTop = 0) 267 | { 268 | WinGetPos,X,Y,W,H,A 269 | 270 | If %Width% = 0 271 | Width := W 272 | 273 | If %Height% = 0 274 | Height := H 275 | 276 | 277 | tmpArray := windowOverrides 278 | ;;PrintArray(tmpArray) 279 | 280 | noOverrides = 1 281 | 282 | For index, value in tmpArray{ 283 | ;;MsgBox, index:`t%index%`n 284 | if(WinActive("ahk_exe" . index)){ 285 | MyLeft := MyLeft + windowOverrides[index]["left"] 286 | MyTop := MyTop + windowOverrides[index]["top"] 287 | Width := Width + windowOverrides[index]["width"] 288 | Height := Height + windowOverrides[index]["height"] 289 | noOverrides = 0 290 | ;;MsgBox, MyLeft:`t%MyLeft%`n | MyTop:`t%MyTop% | Width:`t%Width% | Height:`t%Height% 291 | } 292 | } 293 | 294 | if(noOverrides == 1) { 295 | MyLeft := MyLeft + windowOverrides["default"]["left"] 296 | MyTop := MyTop + windowOverrides["default"]["top"] 297 | Width := Width + windowOverrides["default"]["width"] 298 | Height := Height + windowOverrides["default"]["height"] 299 | ;;MsgBox, test2 300 | } 301 | 302 | WinMove,A,,%MyLeft%,%MyTop%,%Width%,%Height% 303 | 304 | } 305 | 306 | ;; configure menu 307 | Menu, Tray, Icon , Television.ico 308 | Menu, tray, NoStandard 309 | Menu, Tray, Add, Exit, Exit 310 | Menu, Tray, Add 311 | Menu, Tray, Add, &Left Left Small, LeftLeft 312 | Menu, Tray, Add, &Left Right Large, LeftRight 313 | Menu, Tray, Add 314 | Menu, Tray, Add, &Right Left Large, LeftLarge 315 | Menu, Tray, Add, &Right Right Small, RightSmall 316 | Menu, Tray, Add 317 | Menu, Tray, Add, &Right Right Small Top, RightSmallTop 318 | Menu, Tray, Add, &Right Right Small Bottom, RightSmallBottom 319 | 320 | ;; _________ _________ 321 | ;; | | | | e |_r_| 322 | ;; | q | w | |_____| f | 323 | ;; '-----i---' '--d--i---' 324 | 325 | ;; keyboard shortcuts 326 | #q::ResizeWinMine(RightLeftWidth,RightLeftHeight, RightLeftLeft, RightLeftTop) 327 | #w::ResizeWinMine(RightRightWidth,RightRightHeight, RightRightLeft, RightRightTop) 328 | ;#r::ResizeWinMine(RightRightTopWidth,RightRightTopHeight, RightRightTopLeft, RightRightTopTop) 329 | ;#f::ResizeWinMine(RightRightBotWidth,RightRightBotHeight, RightRightBotLeft, RightRightBotTop) 330 | 331 | 332 | #e::ResizeWinMine(RightLeftTopWidth,RightLeftTopHeight, RightLeftTopLeft, RightLeftTopTop) 333 | #d::ResizeWinMine(RightLeftBotWidth,RightLeftBotHeight, RightLeftBotLeft, RightLeftBotTop) 334 | 335 | #z::ResizeWinMine(LeftLeftWidth,LeftLeftHeight, LeftLeftLeft, LeftLeftTop) 336 | #x::ResizeWinMine(LeftRightWidth,LeftRightHeight, LeftRighteft, LeftRightTop) 337 | 338 | #r::ResizeWinMine(vertWindowWidth, vertWindowWTopHeight, 15, 15) 339 | #f::ResizeWinMine(vertWindowWidth, vertWindowWBotHeight, 15, (vertWindowWTopHeight + (windowBorder))) 340 | 341 | ;; menu items 342 | ;; for the menu we have to activate the previos window (may not be perfect in all case) 343 | ;; because the tray popup itself counts as a window 344 | Exit: 345 | ExitApp 346 | 347 | LeftLeft: 348 | Send !{Esc} ; Activate previous window 349 | ResizeWinMine(LeftLeftWidth,LeftLeftHeight, LeftLeftLeft, LeftLeftTop) 350 | return 351 | 352 | LeftRight: 353 | Send !{Esc} ; Activate previous window 354 | ResizeWinMine(LeftRightWidth,LeftRightHeight, LeftRightLeft, LeftRightTop) 355 | return 356 | 357 | LeftLarge: 358 | Send !{Esc} ; Activate previous window 359 | ResizeWinMine(RightLeftWidth,RightLeftHeight, RightLeftLeft, RightLeftTop) 360 | return 361 | 362 | RightSmall: 363 | Send !{Esc} ; Activate previous window 364 | ResizeWinMine(RightRightWidth,RightRightHeight, RightRightLeft, RightRightTop) 365 | return 366 | 367 | RightSmallTop: 368 | Send !{Esc} ; Activate previous window 369 | ResizeWinMine(RightRightTopWidth,RightRightTopHeight, RightRightTopLeft, RightRightTopTop) 370 | return 371 | 372 | RightSmallBottom: 373 | Send !{Esc} ; Activate previous window 374 | ResizeWinMine(RightRightBotWidth,RightRightBotHeight, RightRightBotLeft, RightRightBotTop) 375 | return 376 | -------------------------------------------------------------------------------- /TilingWindowManagerSurface.ahk.bak: -------------------------------------------------------------------------------- 1 | #Persistent 2 | #SingleInstance force 3 | 4 | ;; tiling window manager for windows 7-10 designed for 1 or 2 monitors arranging 5 | ;; windows in the following pattern with configurable window sizes and borders: 6 | ;; _________ _________ 7 | ;; | | | | |___| <- primary monitor 8 | ;; | | | |_____| | 9 | ;; '---i-----' '-----i---' 10 | 11 | ;; todo override windows move keys, eg, win + left 12 | 13 | ;; -- window sizing options 14 | 15 | ;; size of space between windows 16 | windowBorder = 15 17 | ;; width of the large windows that appear closest to the center of the screen 18 | windowLeftWidth = 1770 19 | ;; height of the small top right window 20 | windowRightSmallTopHeight = 1100 21 | ;; height of the top left main window 22 | windowLeftSmallTopHeight = 1500 23 | 24 | ;; monitor geometry 25 | ;; todo: automate this 26 | monitorBorderRight = 1920 27 | monitorBorderLeft = 0 28 | monitorWidth = 3000 29 | monitorHeight = 2000 30 | taskbarHeight = 52 31 | 32 | monitorWidthLeft = 1440 33 | monitorheightRight = 2560 34 | 35 | ;; override system, here you can define a default offset and specific program offsets 36 | ;; this will allow you to setup for custom themes and programs that wont behave 37 | ;; I tried to make this work with WinGetPosEx but even that had many faults 38 | global windowOverrides := Object() 39 | 40 | windowOverrides["default"] := Object() 41 | windowOverrides["default"]["left"] := -11 42 | windowOverrides["default"]["top"] := 0 43 | windowOverrides["default"]["width"] := +23 44 | windowOverrides["default"]["height"] := 0 45 | 46 | 47 | windowOverrides["firefox.exe"] := Object() 48 | windowOverrides["firefox.exe"]["left"] := -9 49 | windowOverrides["firefox.exe"]["top"] := 0 50 | windowOverrides["firefox.exe"]["width"] := +19 51 | windowOverrides["firefox.exe"]["height"] := +10 52 | 53 | windowOverrides["Spotify.exe"] := Object() 54 | windowOverrides["Spotify.exe"]["left"] := +4 55 | windowOverrides["Spotify.exe"]["top"] := 0 56 | windowOverrides["Spotify.exe"]["width"] := -4 57 | windowOverrides["Spotify.exe"]["height"] := -12 58 | 59 | windowOverrides["pidgin.exe"] := Object() 60 | windowOverrides["pidgin.exe"]["left"] := -15 61 | windowOverrides["pidgin.exe"]["top"] := 0 62 | windowOverrides["pidgin.exe"]["width"] := +33 63 | windowOverrides["pidgin.exe"]["height"] := +12 64 | 65 | windowOverrides["Photoshop.exe"] := Object() 66 | windowOverrides["Photoshop.exe"]["left"] := -2 67 | windowOverrides["Photoshop.exe"]["top"] := -2 68 | windowOverrides["Photoshop.exe"]["width"] := 0 69 | windowOverrides["Photoshop.exe"]["height"] := -10 70 | 71 | 72 | windowOverrides["ONENOTE.EXE"] := Object() 73 | windowOverrides["ONENOTE.EXE"]["left"] := 0 74 | windowOverrides["ONENOTE.EXE"]["top"] := 0 75 | windowOverrides["ONENOTE.EXE"]["width"] := 0 76 | windowOverrides["ONENOTE.EXE"]["height"] := 0 77 | 78 | windowOverrides["slack.exe"] := Object() 79 | windowOverrides["slack.exe"]["left"] := 0 80 | windowOverrides["slack.exe"]["top"] := 0 81 | windowOverrides["slack.exe"]["width"] := -2 82 | windowOverrides["slack.exe"]["height"] := -14 83 | 84 | windowOverrides["ConEmu64.exe"] := Object() 85 | windowOverrides["ConEmu64.exe"]["left"] := -15 86 | windowOverrides["ConEmu64.exe"]["top"] := 0 87 | windowOverrides["ConEmu64.exe"]["width"] := +30 88 | windowOverrides["ConEmu64.exe"]["height"] := +2 89 | 90 | windowOverrides["emacs.exe"] := Object() 91 | windowOverrides["emacs.exe"]["left"] := -15 92 | windowOverrides["emacs.exe"]["top"] := 0 93 | windowOverrides["emacs.exe"]["width"] := +30 94 | windowOverrides["emacs.exe"]["height"] := +2 95 | 96 | windowOverrides["Code.exe"] := Object() 97 | windowOverrides["Code.exe"]["left"] := -12 98 | windowOverrides["Code.exe"]["top"] := 0 99 | windowOverrides["Code.exe"]["width"] := +24 100 | windowOverrides["Code.exe"]["height"] := 0 101 | 102 | 103 | 104 | 105 | /* 106 | windowOverrides["Steam.exe"] := Object() 107 | windowOverrides["Steam.exe"]["left"] := 1 108 | windowOverrides["Steam.exe"]["top"] := 1 109 | windowOverrides["Steam.exe"]["width"] := -2 110 | windowOverrides["Steam.exe"]["height"] := -2 111 | 112 | windowOverrides["explorer.exe"] := Object() 113 | windowOverrides["explorer.exe"]["left"] := -16 114 | windowOverrides["explorer.exe"]["top"] := 0 115 | windowOverrides["explorer.exe"]["width"] := +32 116 | windowOverrides["explorer.exe"]["height"] := +10 117 | 118 | windowOverrides["atom.exe"] := Object() 119 | windowOverrides["atom.exe"]["left"] := -16 120 | windowOverrides["atom.exe"]["top"] := 0 121 | windowOverrides["atom.exe"]["width"] := +32 122 | windowOverrides["atom.exe"]["height"] := +10 123 | 124 | windowOverrides["chrome.exe"] := Object() 125 | windowOverrides["chrome.exe"]["left"] := -16 126 | windowOverrides["chrome.exe"]["top"] := 0 127 | windowOverrides["chrome.exe"]["width"] := +32 128 | windowOverrides["chrome.exe"]["height"] := +10 129 | 130 | windowOverrides["firefox.exe"] := Object() 131 | windowOverrides["firefox.exe"]["left"] := -12 132 | windowOverrides["firefox.exe"]["top"] := 0 133 | windowOverrides["firefox.exe"]["width"] := +20 134 | windowOverrides["firefox.exe"]["height"] := +6 135 | 136 | windowOverrides["putty.exe"] := Object() 137 | windowOverrides["putty.exe"]["left"] := -4 138 | windowOverrides["putty.exe"]["top"] := 0 139 | windowOverrides["putty.exe"]["width"] := +8 140 | windowOverrides["putty.exe"]["height"] := +4 141 | 142 | windowOverrides["WinSCP.exe"] := Object() 143 | windowOverrides["WinSCP.exe"]["left"] := -16 144 | windowOverrides["WinSCP.exe"]["top"] := 0 145 | windowOverrides["WinSCP.exe"]["width"] := +32 146 | windowOverrides["WinSCP.exe"]["height"] := +10 147 | 148 | windowOverrides["pidgin.exe"] := Object() 149 | windowOverrides["pidgin.exe"]["left"] := -16 150 | windowOverrides["pidgin.exe"]["top"] := 0 151 | windowOverrides["pidgin.exe"]["width"] := +32 152 | windowOverrides["pidgin.exe"]["height"] := +10 153 | 154 | 155 | */ 156 | SysGet, MonitorCount, MonitorCount 157 | SysGet, MonitorPrimary, MonitorPrimary 158 | ;;MsgBox, Monitor Count:`t%MonitorCount%`nPrimary Monitor:`t%MonitorPrimary% 159 | Loop, %MonitorCount% 160 | { 161 | SysGet, MonitorName, MonitorName, %A_Index% 162 | SysGet, Monitor, Monitor, %A_Index% 163 | SysGet, MonitorWorkArea, MonitorWorkArea, %A_Index% 164 | ;;MsgBox, Monitor:`t#%A_Index%`nName:`t%MonitorName%`nLeft:`t%MonitorLeft% (%MonitorWorkAreaLeft% work)`nTop:`t%MonitorTop% (%MonitorWorkAreaTop% work)`nRight:`t%MonitorRight% (%MonitorWorkAreaRight% work)`nBottom:`t%MonitorBottom% (%MonitorWorkAreaBottom% work) 165 | } 166 | 167 | ;; what happens when: 168 | 169 | ;; -- TaskbarMontior1 Montitor2 170 | ;; -- TaskbarMonitor2 Monitor1 171 | 172 | ;; -- Monitor1 TaskbarMonitor2 173 | ;; -- Monitor2 TaskbarMontior1 174 | ;; * Monitor2: -1920 175 | ;; * Monitor1: 0 176 | 177 | 178 | ;;calculated variables used below 179 | windowHeightTall := monitorHeight - (windowBorder * 2) 180 | windowHeightTallTaskbar := monitorHeight - (windowBorder * 2) - taskbarHeight 181 | windowRightWidth := monitorWidth - windowLeftWidth - (windowBorder * 3) 182 | 183 | newLeftWindowWidth := monitorWidthLeft - (windowBorder * 2) 184 | newLeftWindowTopHeight := 800 185 | newLeftWindowBotHeight := 1715 186 | 187 | vertWindowWidth := monitorHeight - (windowBorder * 2) 188 | vertWindowWTopHeight := 2000 189 | vertWindowWBotHeight := monitorWidth - vertWindowWTopHeight - (windowBorder * 2) - taskbarHeight 190 | 191 | newZero := 0 192 | 193 | ;; ___ _________ 194 | ;; | x | | |___| -- LeftLeft 195 | ;; | | | | | 196 | ;; '---i '-----i---' 197 | LeftLeftWidth := (monitorWidthLeft * 2) - (windowBorder * 2) 198 | LeftLeftHeight := newLeftWindowTopHeight * 2 199 | LeftLeftLeft := (newZero - (monitorWidthLeft * 2) + 15) 200 | LeftLeftTop := - 600 201 | 202 | ;; ____ _________ 203 | ;; | | | |___| -- LeftRight 204 | ;; | x | | | | 205 | ;; '---i '-----i---' 206 | LeftRightWidth := (monitorWidthLeft * 2) - (windowBorder * 2) 207 | LeftRightHeight := newLeftWindowBotHeight * 2 + (windowBorder * 3) 208 | LeftRighteft := (newZero - (monitorWidthLeft * 2) + 15) 209 | LeftRightTop := - 600 + (newLeftWindowTopHeight * 2) + windowBorder 210 | 211 | ;; _________ _________ 212 | ;; | | | | |___| -- RightLeft 213 | ;; | | | | X | | 214 | ;; '---i-----' '-----i---' 215 | RightLeftWidth := windowLeftWidth 216 | RightLeftHeight := windowHeightTallTaskbar 217 | RightLeftLeft := windowBorder 218 | RightLeftTop := windowBorder 219 | 220 | ;; _________ _________ 221 | ;; | | | | x |___| -- RightLeftTop 222 | ;; | | | |_____| | 223 | ;; '---i-----' '-----i---' 224 | RightLeftTopWidth := windowLeftWidth 225 | RightLeftTopHeight := windowLeftSmallTopHeight 226 | RightLeftTopLeft := windowBorder 227 | RightLeftTopTop := windowBorder 228 | 229 | ;; _________ _________ 230 | ;; | | | | |___| -- RightLeftBottom 231 | ;; | | | |_____| | 232 | ;; '---i-----' '--X--i---' 233 | RightLeftBotWidth := windowLeftWidth 234 | RightLeftBotHeight := monitorHeight - taskbarHeight - (windowBorder * 3) - windowLeftSmallTopHeight 235 | RightLeftBotLeft := windowBorder 236 | RightLeftBotTop := windowLeftSmallTopHeight + (windowBorder * 2) 237 | 238 | ;; _________ _________ 239 | ;; | | | | | | -- RightRight 240 | ;; | | | | | X | 241 | ;; '---i-----' '-----i---' 242 | RightRightWidth := windowRightWidth 243 | RightRightHeight := windowHeightTallTaskbar 244 | RightRightLeft := windowLeftWidth + (windowBorder * 2) 245 | RightRightTop := windowBorder 246 | 247 | ;; _________ _________ 248 | ;; | | | | |_X_| -- RightRightTop 249 | ;; | | | | | | 250 | ;; '---i-----' '-----i---' 251 | RightRightTopWidth := windowRightWidth 252 | RightRightTopHeight := windowRightSmallTopHeight 253 | RightRightTopLeft := windowLeftWidth + (windowBorder * 2) 254 | RightRightTopTop := windowBorder 255 | 256 | ;; _________ _________ 257 | ;; | | | | |___| -- RightRightTop 258 | ;; | | | | | X | 259 | ;; '---i-----' '-----i---' 260 | RightRightBotWidth := windowRightWidth 261 | RightRightBotHeight := monitorHeight - taskbarHeight - (windowBorder * 3) - windowRightSmallTopHeight 262 | RightRightBotLeft := windowLeftWidth + (windowBorder * 2) 263 | RightRightBotTop := windowRightSmallTopHeight + (windowBorder * 2) 264 | 265 | ;; simplified winmove function call 266 | ResizeWinMine(Width = 0,Height = 0, MyLeft = 0, MyTop = 0) 267 | { 268 | WinGetPos,X,Y,W,H,A 269 | 270 | If %Width% = 0 271 | Width := W 272 | 273 | If %Height% = 0 274 | Height := H 275 | 276 | 277 | tmpArray := windowOverrides 278 | ;;PrintArray(tmpArray) 279 | 280 | noOverrides = 1 281 | 282 | For index, value in tmpArray{ 283 | ;;MsgBox, index:`t%index%`n 284 | if(WinActive("ahk_exe" . index)){ 285 | MyLeft := MyLeft + windowOverrides[index]["left"] 286 | MyTop := MyTop + windowOverrides[index]["top"] 287 | Width := Width + windowOverrides[index]["width"] 288 | Height := Height + windowOverrides[index]["height"] 289 | noOverrides = 0 290 | ;;MsgBox, MyLeft:`t%MyLeft%`n | MyTop:`t%MyTop% | Width:`t%Width% | Height:`t%Height% 291 | } 292 | } 293 | 294 | if(noOverrides == 1) { 295 | MyLeft := MyLeft + windowOverrides["default"]["left"] 296 | MyTop := MyTop + windowOverrides["default"]["top"] 297 | Width := Width + windowOverrides["default"]["width"] 298 | Height := Height + windowOverrides["default"]["height"] 299 | ;;MsgBox, test2 300 | } 301 | 302 | WinMove,A,,%MyLeft%,%MyTop%,%Width%,%Height% 303 | 304 | } 305 | 306 | ;; configure menu 307 | Menu, Tray, Icon , Television.ico 308 | Menu, tray, NoStandard 309 | Menu, Tray, Add, Exit, Exit 310 | Menu, Tray, Add 311 | Menu, Tray, Add, &Left Left Small, LeftLeft 312 | Menu, Tray, Add, &Left Right Large, LeftRight 313 | Menu, Tray, Add 314 | Menu, Tray, Add, &Right Left Large, LeftLarge 315 | Menu, Tray, Add, &Right Right Small, RightSmall 316 | Menu, Tray, Add 317 | Menu, Tray, Add, &Right Right Small Top, RightSmallTop 318 | Menu, Tray, Add, &Right Right Small Bottom, RightSmallBottom 319 | 320 | ;; _________ _________ 321 | ;; | | | | e |_r_| 322 | ;; | q | w | |_____| f | 323 | ;; '-----i---' '--d--i---' 324 | 325 | ;; keyboard shortcuts 326 | #q::ResizeWinMine(RightLeftWidth,RightLeftHeight, RightLeftLeft, RightLeftTop) 327 | #w::ResizeWinMine(RightRightWidth,RightRightHeight, RightRightLeft, RightRightTop) 328 | ;#r::ResizeWinMine(RightRightTopWidth,RightRightTopHeight, RightRightTopLeft, RightRightTopTop) 329 | ;#f::ResizeWinMine(RightRightBotWidth,RightRightBotHeight, RightRightBotLeft, RightRightBotTop) 330 | 331 | 332 | #e::ResizeWinMine(RightLeftTopWidth,RightLeftTopHeight, RightLeftTopLeft, RightLeftTopTop) 333 | #d::ResizeWinMine(RightLeftBotWidth,RightLeftBotHeight, RightLeftBotLeft, RightLeftBotTop) 334 | 335 | #z::ResizeWinMine(LeftLeftWidth,LeftLeftHeight, LeftLeftLeft, LeftLeftTop) 336 | #x::ResizeWinMine(LeftRightWidth,LeftRightHeight, LeftRighteft, LeftRightTop) 337 | 338 | #r::ResizeWinMine(vertWindowWidth, vertWindowWTopHeight, 15, 15) 339 | #f::ResizeWinMine(vertWindowWidth, vertWindowWBotHeight, 15, (vertWindowWTopHeight + (windowBorder * 2))) 340 | 341 | ;; menu items 342 | ;; for the menu we have to activate the previos window (may not be perfect in all case) 343 | ;; because the tray popup itself counts as a window 344 | Exit: 345 | ExitApp 346 | 347 | LeftLeft: 348 | Send !{Esc} ; Activate previous window 349 | ResizeWinMine(LeftLeftWidth,LeftLeftHeight, LeftLeftLeft, LeftLeftTop) 350 | return 351 | 352 | LeftRight: 353 | Send !{Esc} ; Activate previous window 354 | ResizeWinMine(LeftRightWidth,LeftRightHeight, LeftRightLeft, LeftRightTop) 355 | return 356 | 357 | LeftLarge: 358 | Send !{Esc} ; Activate previous window 359 | ResizeWinMine(RightLeftWidth,RightLeftHeight, RightLeftLeft, RightLeftTop) 360 | return 361 | 362 | RightSmall: 363 | Send !{Esc} ; Activate previous window 364 | ResizeWinMine(RightRightWidth,RightRightHeight, RightRightLeft, RightRightTop) 365 | return 366 | 367 | RightSmallTop: 368 | Send !{Esc} ; Activate previous window 369 | ResizeWinMine(RightRightTopWidth,RightRightTopHeight, RightRightTopLeft, RightRightTopTop) 370 | return 371 | 372 | RightSmallBottom: 373 | Send !{Esc} ; Activate previous window 374 | ResizeWinMine(RightRightBotWidth,RightRightBotHeight, RightRightBotLeft, RightRightBotTop) 375 | return 376 | -------------------------------------------------------------------------------- /TilingWindowManagerSurfaceVert.ahk: -------------------------------------------------------------------------------- 1 | #Persistent 2 | #SingleInstance force 3 | 4 | ;; tiling window manager for windows 7-10 designed for 1 or 2 monitors arranging 5 | ;; windows in the following pattern with configurable window sizes and borders: 6 | ;; _________ _________ 7 | ;; | | | | |___| <- primary monitor 8 | ;; | | | |_____| | 9 | ;; '---i-----' '-----i---' 10 | 11 | ;; todo override windows move keys, eg, win + left 12 | 13 | ;; -- window sizing options 14 | 15 | ;; size of space between windows 16 | windowBorder = 15 17 | ;; width of the large windows that appear closest to the center of the screen 18 | windowLeftWidth = 1770 19 | ;; height of the small top right window 20 | windowRightSmallTopHeight = 1100 21 | ;; height of the top left main window 22 | windowLeftSmallTopHeight = 1500 23 | 24 | ;; monitor geometry 25 | ;; todo: automate this 26 | monitorBorderRight = 1920 27 | monitorBorderLeft = 0 28 | monitorWidth = 3000 29 | monitorHeight = 2000 30 | taskbarHeight = 52 31 | 32 | monitorWidthLeft = 1440 33 | monitorheightRight = 2560 34 | 35 | ;; override system, here you can define a default offset and specific program offsets 36 | ;; this will allow you to setup for custom themes and programs that wont behave 37 | ;; I tried to make this work with WinGetPosEx but even that had many faults 38 | global windowOverrides := Object() 39 | 40 | windowOverrides["default"] := Object() 41 | windowOverrides["default"]["left"] := -11 42 | windowOverrides["default"]["top"] := 0 43 | windowOverrides["default"]["width"] := +23 44 | windowOverrides["default"]["height"] := 0 45 | 46 | 47 | windowOverrides["firefox.exe"] := Object() 48 | windowOverrides["firefox.exe"]["left"] := -9 49 | windowOverrides["firefox.exe"]["top"] := 0 50 | windowOverrides["firefox.exe"]["width"] := +19 51 | windowOverrides["firefox.exe"]["height"] := +10 52 | 53 | windowOverrides["Spotify.exe"] := Object() 54 | windowOverrides["Spotify.exe"]["left"] := +4 55 | windowOverrides["Spotify.exe"]["top"] := 0 56 | windowOverrides["Spotify.exe"]["width"] := -4 57 | windowOverrides["Spotify.exe"]["height"] := -12 58 | 59 | windowOverrides["pidgin.exe"] := Object() 60 | windowOverrides["pidgin.exe"]["left"] := -15 61 | windowOverrides["pidgin.exe"]["top"] := 0 62 | windowOverrides["pidgin.exe"]["width"] := +33 63 | windowOverrides["pidgin.exe"]["height"] := +12 64 | 65 | windowOverrides["Photoshop.exe"] := Object() 66 | windowOverrides["Photoshop.exe"]["left"] := -2 67 | windowOverrides["Photoshop.exe"]["top"] := -2 68 | windowOverrides["Photoshop.exe"]["width"] := 0 69 | windowOverrides["Photoshop.exe"]["height"] := -10 70 | 71 | 72 | windowOverrides["ONENOTE.EXE"] := Object() 73 | windowOverrides["ONENOTE.EXE"]["left"] := 0 74 | windowOverrides["ONENOTE.EXE"]["top"] := 0 75 | windowOverrides["ONENOTE.EXE"]["width"] := 0 76 | windowOverrides["ONENOTE.EXE"]["height"] := 0 77 | 78 | windowOverrides["slack.exe"] := Object() 79 | windowOverrides["slack.exe"]["left"] := 0 80 | windowOverrides["slack.exe"]["top"] := 0 81 | windowOverrides["slack.exe"]["width"] := -2 82 | windowOverrides["slack.exe"]["height"] := -14 83 | 84 | windowOverrides["ConEmu64.exe"] := Object() 85 | windowOverrides["ConEmu64.exe"]["left"] := -15 86 | windowOverrides["ConEmu64.exe"]["top"] := 0 87 | windowOverrides["ConEmu64.exe"]["width"] := +30 88 | windowOverrides["ConEmu64.exe"]["height"] := +2 89 | 90 | windowOverrides["emacs.exe"] := Object() 91 | windowOverrides["emacs.exe"]["left"] := -15 92 | windowOverrides["emacs.exe"]["top"] := 0 93 | windowOverrides["emacs.exe"]["width"] := +30 94 | windowOverrides["emacs.exe"]["height"] := +2 95 | 96 | windowOverrides["Code.exe"] := Object() 97 | windowOverrides["Code.exe"]["left"] := -12 98 | windowOverrides["Code.exe"]["top"] := 0 99 | windowOverrides["Code.exe"]["width"] := +24 100 | windowOverrides["Code.exe"]["height"] := 0 101 | 102 | 103 | 104 | 105 | /* 106 | windowOverrides["Steam.exe"] := Object() 107 | windowOverrides["Steam.exe"]["left"] := 1 108 | windowOverrides["Steam.exe"]["top"] := 1 109 | windowOverrides["Steam.exe"]["width"] := -2 110 | windowOverrides["Steam.exe"]["height"] := -2 111 | 112 | windowOverrides["explorer.exe"] := Object() 113 | windowOverrides["explorer.exe"]["left"] := -16 114 | windowOverrides["explorer.exe"]["top"] := 0 115 | windowOverrides["explorer.exe"]["width"] := +32 116 | windowOverrides["explorer.exe"]["height"] := +10 117 | 118 | windowOverrides["atom.exe"] := Object() 119 | windowOverrides["atom.exe"]["left"] := -16 120 | windowOverrides["atom.exe"]["top"] := 0 121 | windowOverrides["atom.exe"]["width"] := +32 122 | windowOverrides["atom.exe"]["height"] := +10 123 | 124 | windowOverrides["chrome.exe"] := Object() 125 | windowOverrides["chrome.exe"]["left"] := -16 126 | windowOverrides["chrome.exe"]["top"] := 0 127 | windowOverrides["chrome.exe"]["width"] := +32 128 | windowOverrides["chrome.exe"]["height"] := +10 129 | 130 | windowOverrides["firefox.exe"] := Object() 131 | windowOverrides["firefox.exe"]["left"] := -12 132 | windowOverrides["firefox.exe"]["top"] := 0 133 | windowOverrides["firefox.exe"]["width"] := +20 134 | windowOverrides["firefox.exe"]["height"] := +6 135 | 136 | windowOverrides["putty.exe"] := Object() 137 | windowOverrides["putty.exe"]["left"] := -4 138 | windowOverrides["putty.exe"]["top"] := 0 139 | windowOverrides["putty.exe"]["width"] := +8 140 | windowOverrides["putty.exe"]["height"] := +4 141 | 142 | windowOverrides["WinSCP.exe"] := Object() 143 | windowOverrides["WinSCP.exe"]["left"] := -16 144 | windowOverrides["WinSCP.exe"]["top"] := 0 145 | windowOverrides["WinSCP.exe"]["width"] := +32 146 | windowOverrides["WinSCP.exe"]["height"] := +10 147 | 148 | windowOverrides["pidgin.exe"] := Object() 149 | windowOverrides["pidgin.exe"]["left"] := -16 150 | windowOverrides["pidgin.exe"]["top"] := 0 151 | windowOverrides["pidgin.exe"]["width"] := +32 152 | windowOverrides["pidgin.exe"]["height"] := +10 153 | 154 | 155 | */ 156 | SysGet, MonitorCount, MonitorCount 157 | SysGet, MonitorPrimary, MonitorPrimary 158 | ;;MsgBox, Monitor Count:`t%MonitorCount%`nPrimary Monitor:`t%MonitorPrimary% 159 | Loop, %MonitorCount% 160 | { 161 | SysGet, MonitorName, MonitorName, %A_Index% 162 | SysGet, Monitor, Monitor, %A_Index% 163 | SysGet, MonitorWorkArea, MonitorWorkArea, %A_Index% 164 | ;;MsgBox, Monitor:`t#%A_Index%`nName:`t%MonitorName%`nLeft:`t%MonitorLeft% (%MonitorWorkAreaLeft% work)`nTop:`t%MonitorTop% (%MonitorWorkAreaTop% work)`nRight:`t%MonitorRight% (%MonitorWorkAreaRight% work)`nBottom:`t%MonitorBottom% (%MonitorWorkAreaBottom% work) 165 | } 166 | 167 | ;; what happens when: 168 | 169 | ;; -- TaskbarMontior1 Montitor2 170 | ;; -- TaskbarMonitor2 Monitor1 171 | 172 | ;; -- Monitor1 TaskbarMonitor2 173 | ;; -- Monitor2 TaskbarMontior1 174 | ;; * Monitor2: -1920 175 | ;; * Monitor1: 0 176 | 177 | 178 | ;;calculated variables used below 179 | windowHeightTall := monitorHeight - (windowBorder * 2) 180 | windowHeightTallTaskbar := monitorHeight - (windowBorder * 2) - taskbarHeight 181 | windowRightWidth := monitorWidth - windowLeftWidth - (windowBorder * 3) 182 | 183 | newLeftWindowWidth := monitorWidthLeft - (windowBorder * 2) 184 | newLeftWindowTopHeight := 800 185 | newLeftWindowBotHeight := 1715 186 | 187 | newZero := 0 188 | 189 | ;; ___ _________ 190 | ;; | x | | |___| -- LeftLeft 191 | ;; | | | | | 192 | ;; '---i '-----i---' 193 | LeftLeftWidth := (monitorWidthLeft * 2) - (windowBorder * 2) 194 | LeftLeftHeight := newLeftWindowTopHeight * 2 195 | LeftLeftLeft := (newZero - (monitorWidthLeft * 2) + 15) 196 | LeftLeftTop := - 600 197 | 198 | ;; ____ _________ 199 | ;; | | | |___| -- LeftRight 200 | ;; | x | | | | 201 | ;; '---i '-----i---' 202 | LeftRightWidth := (monitorWidthLeft * 2) - (windowBorder * 2) 203 | LeftRightHeight := newLeftWindowBotHeight * 2 + (windowBorder * 3) 204 | LeftRighteft := (newZero - (monitorWidthLeft * 2) + 15) 205 | LeftRightTop := - 600 + (newLeftWindowTopHeight * 2) + windowBorder 206 | 207 | ;; _________ _________ 208 | ;; | | | | |___| -- RightLeft 209 | ;; | | | | X | | 210 | ;; '---i-----' '-----i---' 211 | RightLeftWidth := windowLeftWidth 212 | RightLeftHeight := windowHeightTallTaskbar 213 | RightLeftLeft := windowBorder 214 | RightLeftTop := windowBorder 215 | 216 | ;; _________ _________ 217 | ;; | | | | x |___| -- RightLeftTop 218 | ;; | | | |_____| | 219 | ;; '---i-----' '-----i---' 220 | RightLeftTopWidth := windowLeftWidth 221 | RightLeftTopHeight := windowLeftSmallTopHeight 222 | RightLeftTopLeft := windowBorder 223 | RightLeftTopTop := windowBorder 224 | 225 | ;; _________ _________ 226 | ;; | | | | |___| -- RightLeftBottom 227 | ;; | | | |_____| | 228 | ;; '---i-----' '--X--i---' 229 | RightLeftBotWidth := windowLeftWidth 230 | RightLeftBotHeight := monitorHeight - taskbarHeight - (windowBorder * 3) - windowLeftSmallTopHeight 231 | RightLeftBotLeft := windowBorder 232 | RightLeftBotTop := windowLeftSmallTopHeight + (windowBorder * 2) 233 | 234 | ;; _________ _________ 235 | ;; | | | | | | -- RightRight 236 | ;; | | | | | X | 237 | ;; '---i-----' '-----i---' 238 | RightRightWidth := windowRightWidth 239 | RightRightHeight := windowHeightTallTaskbar 240 | RightRightLeft := windowLeftWidth + (windowBorder * 2) 241 | RightRightTop := windowBorder 242 | 243 | ;; _________ _________ 244 | ;; | | | | |_X_| -- RightRightTop 245 | ;; | | | | | | 246 | ;; '---i-----' '-----i---' 247 | RightRightTopWidth := windowRightWidth 248 | RightRightTopHeight := windowRightSmallTopHeight 249 | RightRightTopLeft := windowLeftWidth + (windowBorder * 2) 250 | RightRightTopTop := windowBorder 251 | 252 | ;; _________ _________ 253 | ;; | | | | |___| -- RightRightTop 254 | ;; | | | | | X | 255 | ;; '---i-----' '-----i---' 256 | RightRightBotWidth := windowRightWidth 257 | RightRightBotHeight := monitorHeight - taskbarHeight - (windowBorder * 3) - windowRightSmallTopHeight 258 | RightRightBotLeft := windowLeftWidth + (windowBorder * 2) 259 | RightRightBotTop := windowRightSmallTopHeight + (windowBorder * 2) 260 | 261 | ;; simplified winmove function call 262 | ResizeWinMine(Width = 0,Height = 0, MyLeft = 0, MyTop = 0) 263 | { 264 | WinGetPos,X,Y,W,H,A 265 | 266 | If %Width% = 0 267 | Width := W 268 | 269 | If %Height% = 0 270 | Height := H 271 | 272 | 273 | tmpArray := windowOverrides 274 | ;;PrintArray(tmpArray) 275 | 276 | noOverrides = 1 277 | 278 | For index, value in tmpArray{ 279 | ;;MsgBox, index:`t%index%`n 280 | if(WinActive("ahk_exe" . index)){ 281 | MyLeft := MyLeft + windowOverrides[index]["left"] 282 | MyTop := MyTop + windowOverrides[index]["top"] 283 | Width := Width + windowOverrides[index]["width"] 284 | Height := Height + windowOverrides[index]["height"] 285 | noOverrides = 0 286 | ;;MsgBox, MyLeft:`t%MyLeft%`n | MyTop:`t%MyTop% | Width:`t%Width% | Height:`t%Height% 287 | } 288 | } 289 | 290 | if(noOverrides == 1) { 291 | MyLeft := MyLeft + windowOverrides["default"]["left"] 292 | MyTop := MyTop + windowOverrides["default"]["top"] 293 | Width := Width + windowOverrides["default"]["width"] 294 | Height := Height + windowOverrides["default"]["height"] 295 | ;;MsgBox, test2 296 | } 297 | 298 | WinMove,A,,%MyLeft%,%MyTop%,%Width%,%Height% 299 | 300 | } 301 | 302 | ;; configure menu 303 | Menu, Tray, Icon , Television.ico 304 | Menu, tray, NoStandard 305 | Menu, Tray, Add, Exit, Exit 306 | Menu, Tray, Add 307 | Menu, Tray, Add, &Left Left Small, LeftLeft 308 | Menu, Tray, Add, &Left Right Large, LeftRight 309 | Menu, Tray, Add 310 | Menu, Tray, Add, &Right Left Large, LeftLarge 311 | Menu, Tray, Add, &Right Right Small, RightSmall 312 | Menu, Tray, Add 313 | Menu, Tray, Add, &Right Right Small Top, RightSmallTop 314 | Menu, Tray, Add, &Right Right Small Bottom, RightSmallBottom 315 | 316 | ;; _________ _________ 317 | ;; | | | | e |_r_| 318 | ;; | q | w | |_____| f | 319 | ;; '-----i---' '--d--i---' 320 | 321 | ;; keyboard shortcuts 322 | #q::ResizeWinMine(RightLeftWidth,RightLeftHeight, RightLeftLeft, RightLeftTop) 323 | #w::ResizeWinMine(RightRightWidth,RightRightHeight, RightRightLeft, RightRightTop) 324 | #r::ResizeWinMine(RightRightTopWidth,RightRightTopHeight, RightRightTopLeft, RightRightTopTop) 325 | #f::ResizeWinMine(RightRightBotWidth,RightRightBotHeight, RightRightBotLeft, RightRightBotTop) 326 | 327 | 328 | #e::ResizeWinMine(RightLeftTopWidth,RightLeftTopHeight, RightLeftTopLeft, RightLeftTopTop) 329 | #d::ResizeWinMine(RightLeftBotWidth,RightLeftBotHeight, RightLeftBotLeft, RightLeftBotTop) 330 | 331 | #z::ResizeWinMine(LeftLeftWidth,LeftLeftHeight, LeftLeftLeft, LeftLeftTop) 332 | #x::ResizeWinMine(LeftRightWidth,LeftRightHeight, LeftRighteft, LeftRightTop) 333 | ;; menu items 334 | ;; for the menu we have to activate the previos window (may not be perfect in all case) 335 | ;; because the tray popup itself counts as a window 336 | Exit: 337 | ExitApp 338 | 339 | LeftLeft: 340 | Send !{Esc} ; Activate previous window 341 | ResizeWinMine(LeftLeftWidth,LeftLeftHeight, LeftLeftLeft, LeftLeftTop) 342 | return 343 | 344 | LeftRight: 345 | Send !{Esc} ; Activate previous window 346 | ResizeWinMine(LeftRightWidth,LeftRightHeight, LeftRightLeft, LeftRightTop) 347 | return 348 | 349 | LeftLarge: 350 | Send !{Esc} ; Activate previous window 351 | ResizeWinMine(RightLeftWidth,RightLeftHeight, RightLeftLeft, RightLeftTop) 352 | return 353 | 354 | RightSmall: 355 | Send !{Esc} ; Activate previous window 356 | ResizeWinMine(RightRightWidth,RightRightHeight, RightRightLeft, RightRightTop) 357 | return 358 | 359 | RightSmallTop: 360 | Send !{Esc} ; Activate previous window 361 | ResizeWinMine(RightRightTopWidth,RightRightTopHeight, RightRightTopLeft, RightRightTopTop) 362 | return 363 | 364 | RightSmallBottom: 365 | Send !{Esc} ; Activate previous window 366 | ResizeWinMine(RightRightBotWidth,RightRightBotHeight, RightRightBotLeft, RightRightBotTop) 367 | return 368 | -------------------------------------------------------------------------------- /icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/math0ne/windows-tiling-window-manager/fe5c315dd785722b80c2dbf4f6f00574a7585e1e/icon.ico -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | ############################################################################## 2 | # Copyright 2015 Aidan McQuay 3 | # 4 | # This work is licenced under the Creative Commons BSD License License. To 5 | # view a copy of this licence, visit http://creativecommons.org/licenses/BSD/ 6 | # or send a letter to Creative Commons, 171 Second Street, Suite 300, 7 | # San Francisco, California 94105, USA. 8 | ############################################################################## 9 | 10 | ![screenshots](http://orig14.deviantart.net/a070/f/2015/051/8/9/windows_8_2015___custom_tiling_window_manager_by_math0ne-d8isqcr.png) 11 | 12 | 13 | A very simple tiling window manager for Windows 7 and 8. This is 14 | prob not ready to use out of the box but if you have some basic 15 | Autohotkey knowledge you should be able to get it working. By default the window arrangment looks like this: 16 | 17 | ;; _________ _________ 18 | ;; | | | | |___| <- primary monitor 19 | ;; | | | | | | 20 | ;; '---i-----' '-----i---' 21 | 22 | The main functions are in hotkeys and to get it working for your 23 | specfic resolution / taskbar size you may have to adjust some of the 24 | numbers in the assigned functions. There is a tray icon as well so its usable without keyboard shoprtcuts 25 | for windows 8 touch. The keys are: win + qwedas 26 | 27 | ;; _________ _________ | _________ 28 | ;; | | | | | | | | |_e_| <- primary monitor 29 | ;; | a | s | | q | w | | | q | d | 30 | ;; '---i-----' '-----i---' | '-----i---' 31 | 32 | I have added support for program based offsets, in windows 10 there is no way to 100% accuratly size a window. There is a way to measure windows though so you can find the offset. This prob could be automated in the future using WinGetPosEx, for now you can configure the default offset using: 33 | 34 | windowOverrides["default"] := Object() 35 | windowOverrides["default"]["left"] := -8 36 | windowOverrides["default"]["top"] := 0 37 | windowOverrides["default"]["width"] := +16 38 | windowOverrides["default"]["height"] := +8 39 | 40 | And program specifics offsets using: 41 | 42 | windowOverrides["putty.exe"] := Object() 43 | windowOverrides["putty.exe"]["left"] := -4 44 | windowOverrides["putty.exe"]["top"] := 0 45 | windowOverrides["putty.exe"]["width"] := +8 46 | windowOverrides["putty.exe"]["height"] := +4 47 | --------------------------------------------------------------------------------