Compare commits

..

3 commits

Author SHA1 Message Date
fd356cdc61 Replace Firefox with Librewolf
I had to switch to using `ahk_exe` for identifying the windows rather
than `ahk_class` because Librewolf's windows' class is
`MozillaWindowClass`, just like Firefox. That means that, if there was
already a Firefox window open, my shortcut would activate that window
instead of launching Librewolf.
2025-03-14 15:12:55 +01:00
93997c2cdf Make window full screen with launch key 2024-07-15 09:32:57 +02:00
5bfca82c4d Use local Firefox installation
Installing Firefox at this location avoids annoyances with admin
privileges as Firefox regularly wants to update itself on launch.
2024-03-18 11:32:32 +01:00

View file

@ -7,7 +7,7 @@
try TraySetIcon("img\win_manager.ico") try TraySetIcon("img\win_manager.ico")
TERMINAL_WIN := "ahk_class mintty" TERMINAL_EXE := "ahk_exe mintty.exe"
TERMINAL_CMD := " TERMINAL_CMD := "
(LTrim Join`s (LTrim Join`s
C:\Users\fernando.schauenburg\AppData\Local\wsltty\bin\mintty.exe C:\Users\fernando.schauenburg\AppData\Local\wsltty\bin\mintty.exe
@ -17,9 +17,8 @@ TERMINAL_CMD := "
- -
)" )"
BROWSER_WIN:= "ahk_class MozillaWindowClass" BROWSER_EXE := "ahk_exe librewolf.exe"
; BROWSER_CMD:= "C:\Program Files\Mozilla Firefox\firefox.exe" BROWSER_CMD := "C:\Program Files\LibreWolf\librewolf.exe"
BROWSER_CMD:= "C:\Users\fernando.schauenburg\AppData\Local\Mozilla\Firefox\firefox.exe"
; Returns the rectangle (position & size) of a given monitor. ; Returns the rectangle (position & size) of a given monitor.
MonitorGetRect(N) MonitorGetRect(N)
@ -109,41 +108,40 @@ WinSetMonitor(target, WinTitle:="A")
WinSetRelativeRect(WinGetRelativeRect(WinTitle), target, WinTitle) WinSetRelativeRect(WinGetRelativeRect(WinTitle), target, WinTitle)
} }
openProgram(WinTitle, Target, WorkingDir, rect?) openProgram(WinExe, Target, WorkingDir, rect?)
{ {
if WinExist(WinTitle) { if WinExist(WinExe) {
WinActivate(WinTitle) WinActivate(WinExe)
} else { } else {
Run(Target, WorkingDir) Run(Target, WorkingDir)
if IsSet(rect) if IsSet(rect)
if WinWait(WinTitle,,5) if WinWait(WinExe,,5)
WinSetRelativeRect(rect, 1, WinTitle) WinSetRelativeRect(rect, 1, WinExe)
} }
} }
POS := { POS := {
; 2x3 matrix ; 2x3 matrix
upperLeft : {pos: {x: 0, y: 0}, size: {width: 1/4, height: 1/2 }}, upperLeft : {pos: {x: 0, y: 0}, size: {width: 1/3, height: 1/2 }},
upperMidLeft : {pos: {x: 1/4, y: 0}, size: {width: 1/4, height: 1/2 }}, upperMiddle : {pos: {x: 1/3, y: 0}, size: {width: 1/3, height: 1/2 }},
upperMidRight : {pos: {x: 2/4, y: 0}, size: {width: 1/4, height: 1/2 }}, upperRight : {pos: {x: 2/3, y: 0}, size: {width: 1/3, height: 1/2 }},
upperRight : {pos: {x: 3/4, y: 0}, size: {width: 1/4, height: 1/2 }}, lowerLeft : {pos: {x: 0, y: 1/2}, size: {width: 1/3, height: 1/2 }},
lowerLeft : {pos: {x: 0, y: 1/2}, size: {width: 1/4, height: 1/2 }}, lowerMiddle : {pos: {x: 1/3, y: 1/2}, size: {width: 1/3, height: 1/2 }},
lowerMidLeft : {pos: {x: 1/4, y: 1/2}, size: {width: 1/4, height: 1/2 }}, lowerRight : {pos: {x: 2/3, y: 1/2}, size: {width: 1/3, height: 1/2 }},
lowerMidRight : {pos: {x: 2/4, y: 1/2}, size: {width: 1/4, height: 1/2 }},
lowerRight : {pos: {x: 3/4, y: 1/2}, size: {width: 1/4, height: 1/2 }},
; Full Height Thirds & Quarters ; Full Height Thirds
leftNarrow : {pos: {x: 0, y: 0}, size: {width: 1/4, height: 1 }}, thirdLeft : {pos: {x: 0, y: 0}, size: {width: 1/3, height: 1 }},
leftNormal : {pos: {x: 0, y: 0}, size: {width: 1/3, height: 1 }}, doubleLeft : {pos: {x: 0, y: 0}, size: {width: 2/3, height: 1 }},
rightNormal : {pos: {x: 2/3, y: 0}, size: {width: 1/3, height: 1 }}, thirdRight : {pos: {x: 2/3, y: 0}, size: {width: 1/3, height: 1 }},
rightNarrow : {pos: {x: 3/4, y: 0}, size: {width: 1/4, height: 1 }}, doubleRight : {pos: {x: 1/3, y: 0}, size: {width: 2/3, height: 1 }},
; Full Height Halves ; Full Height Halves
halfLeft : {pos: {x: 0, y: 0}, size: {width: 1/2, height: 1 }}, halfLeft : {pos: {x: 0, y: 0}, size: {width: 1/2, height: 1 }},
halfRight : {pos: {x: 1/2, y: 0}, size: {width: 1/2, height: 1 }}, halfRight : {pos: {x: 1/2, y: 0}, size: {width: 1/2, height: 1 }},
; Center ; Center
mainFocus : {pos: {x: 0.25, y: 0}, size: {width: 0.5, height: 1 }}, mainFocus : {pos: {x: 0.18, y: 0}, size: {width: 0.64, height: 1 }},
fullScreen : {pos: {x: 0, y: 0}, size: {width: 1, height: 1 }},
} }
; Uncomment the following line while making changes for easy reload. ; Uncomment the following line while making changes for easy reload.
@ -152,28 +150,28 @@ POS := {
; Make sure NumLock is active so that Numpad mappinfs below will work. ; Make sure NumLock is active so that Numpad mappinfs below will work.
SetNumLockState True SetNumLockState True
; 2x4 matrix ; 2x3 matrix
!#Numpad7:: WinSetRelativeRect(POS.upperLeft) !#Numpad7:: WinSetRelativeRect(POS.upperLeft)
!#NumpadDiv:: WinSetRelativeRect(POS.upperMidLeft) !#NumpadDiv:: WinSetRelativeRect(POS.upperMiddle)
!#Numpad8:: WinSetRelativeRect(POS.upperMidRight) !#Numpad8:: WinSetRelativeRect(POS.upperMiddle)
!#Numpad9:: WinSetRelativeRect(POS.upperRight) !#Numpad9:: WinSetRelativeRect(POS.upperRight)
!#Numpad1:: WinSetRelativeRect(POS.lowerLeft) !#Numpad1:: WinSetRelativeRect(POS.lowerLeft)
!#NumpadSub:: WinSetRelativeRect(POS.lowerMidLeft) !#NumpadSub:: WinSetRelativeRect(POS.lowerMiddle)
!#Numpad2:: WinSetRelativeRect(POS.lowerMidRight) !#Numpad2:: WinSetRelativeRect(POS.lowerMiddle)
!#Numpad3:: WinSetRelativeRect(POS.lowerRight) !#Numpad3:: WinSetRelativeRect(POS.lowerRight)
; Full height thirds ; Full height thirds
!#Numpad4:: WinSetRelativeRect(POS.leftNarrow) !#Numpad4:: WinSetRelativeRect(POS.thirdLeft)
!#NumpadMult:: WinSetRelativeRect(POS.leftNormal) !#NumpadMult:: WinSetRelativeRect(POS.doubleLeft)
!#Numpad5:: WinSetRelativeRect(POS.rightNormal) !#Numpad5:: WinSetRelativeRect(POS.doubleRight)
!#Numpad6:: WinSetRelativeRect(POS.rightNarrow) !#Numpad6:: WinSetRelativeRect(POS.thirdRight)
; Full height halves ; Full height halves
!^Numpad1:: WinSetRelativeRect(POS.halfLeft) !^Numpad1:: WinSetRelativeRect(POS.halfLeft)
!^Numpad3:: WinSetRelativeRect(POS.halfRight) !^Numpad3:: WinSetRelativeRect(POS.halfRight)
; Center and... ; Center and...
!#NumpadAdd:: WinSetRelativeRect(POS.mainFocus) ; ... resize to default. !#NumpadAdd:: WinSetRelativeRect(POS.fullScreen) ; ... make full screen.
!^Numpad5:: WinCenter() ; ... keep size. !^Numpad5:: WinCenter() ; ... keep size.
; Move to other monitor (FIXME this is a hack, but works on my current setup) ; Move to other monitor (FIXME this is a hack, but works on my current setup)
@ -188,6 +186,6 @@ step := 50 ; dx dy
!^Numpad6:: WinTranslate( step, 0) ; right (L) !^Numpad6:: WinTranslate( step, 0) ; right (L)
; Launch programs ; Launch programs
!^+t::openProgram(TERMINAL_WIN, TERMINAL_CMD, A_Temp, POS.mainFocus) !^+t::openProgram(TERMINAL_EXE, TERMINAL_CMD, A_Temp, POS.mainFocus)
!^+b::openProgram(BROWSER_WIN, BROWSER_CMD, A_Temp, POS.mainFocus) !^+b::openProgram(BROWSER_EXE, BROWSER_CMD, A_Temp, POS.mainFocus)