     Return
 
  ; }}}
+; Multiple monitors handling {{{
+
+GetCurrentMonitor()
+{
+  SysGet, numberOfMonitors, MonitorCount
+  WinGetPos, winX, winY, winWidth, winHeight, A
+  winMidX := winX + winWidth / 2
+  winMidY := winY + winHeight / 2
+  Loop %numberOfMonitors%
+  {
+    SysGet, monArea, Monitor, %A_Index%
+    if (winMidX > monAreaLeft && winMidX < monAreaRight && winMidY < monAreaBottom && winMidY > monAreaTop)
+      Return A_Index
+  }
+}
+
+; }}}
 ; Window handling {{{
 
 LeftHalfWindow()
 {
-	SysGet, area, MonitorWorkArea
+    currMon := GetCurrentMonitor()
+	SysGet, area, MonitorWorkArea, %currMon%
 	w:=((areaRight-areaLeft)/2)
 	h:=(areaBottom-areaTop)
-
-	WinRestore, A
-	WinMove, A, , 0, 0,%w%,%h%
+    x := 0
+    y := 0
+    if (currMon = 2) {
+        x := -1920
+        y := -300
+    }
+
+    WinRestore, A
+    WinMove, A, , x, y,%w%,%h%
 }
 
 RightHalfWindow()
 {
-	SysGet, area, MonitorWorkArea
+    currMon := GetCurrentMonitor()
+	SysGet, area, MonitorWorkArea, %currMon%
 	w:=((areaRight-areaLeft)/2)
 	h:=(areaBottom-areaTop)
-
-	WinRestore, A
-	WinMove, A, , w, 0, w, h
+    x := w
+    y := 0
+    if (currMon = 2) {
+        x := w -1920
+        y := -300
+    }
+
+	WinRestore, A
+	WinMove, A, , x, y, w, h
 }
 
 TopHalfWindow()
 {
-	SysGet, area, MonitorWorkArea
+    currMon := GetCurrentMonitor()
+	SysGet, area, MonitorWorkArea, %currMon%
 	w:=(areaRight-areaLeft)
 	h:=((areaBottom-areaTop)/2)
-
-	WinRestore, A
-	WinMove, A, , 0, 0, w, h
+    x := 0
+    y := 0
+    if (currMon = 2) {
+        x := -1920
+        y := -300
+    }
+
+	WinRestore, A
+	WinMove, A, , x, y, w, h
 }
 
 BottomHalfWindow()
 {
-	SysGet, area, MonitorWorkArea
+    currMon := GetCurrentMonitor()
+	SysGet, area, MonitorWorkArea, %currMon%
 	w:=(areaRight-areaLeft)
 	h:=((areaBottom-areaTop)/2)
-
-	WinRestore, A
-	WinMove, A, , 0, h, w, h
+    x := 0
+    y := h
+    if (currMon = 2) {
+        x := -1920
+        y := h -300
+    }
+
+	WinRestore, A
+	WinMove, A, , x, y, w, h
 }
 
 TopLeftQuarterfWindow()
 {
-	SysGet, area, MonitorWorkArea
-	w:=((areaRight-areaLeft)/2)
-	h:=((areaBottom-areaTop)/2)
-
-	WinRestore, A
-	WinMove, A, , 0, 0,%w%,%h%
+    currMon := GetCurrentMonitor()
+	SysGet, area, MonitorWorkArea, %currMon%
+	w:=((areaRight-areaLeft)/2)
+	h:=((areaBottom-areaTop)/2)
+    x := 0
+    y := 0
+    if (currMon = 2) {
+        x := -1920
+        y := -300
+    }
+
+	WinRestore, A
+	WinMove, A, , x, y,%w%,%h%
 }
 
 BottomLeftQuarterfWindow()
 {
-	SysGet, area, MonitorWorkArea
-	w:=((areaRight-areaLeft)/2)
-	h:=((areaBottom-areaTop)/2)
-
-	WinRestore, A
-	WinMove, A, , 0, h, w, h
+    currMon := GetCurrentMonitor()
+	SysGet, area, MonitorWorkArea, %currMon%
+	w:=((areaRight-areaLeft)/2)
+	h:=((areaBottom-areaTop)/2)
+    x := 0
+    y := h
+    if (currMon = 2) {
+        x := -1920
+        y := h -300
+    }
+
+	WinRestore, A
+	WinMove, A, , x, y, w, h
 }
 
 TopRightQuarterfWindow()
 {
-	SysGet, area, MonitorWorkArea
-	w:=((areaRight-areaLeft)/2)
-	h:=((areaBottom-areaTop)/2)
-
-	WinRestore, A
-	WinMove, A, , w, 0, w, h
+    currMon := GetCurrentMonitor()
+	SysGet, area, MonitorWorkArea, %currMon%
+	w:=((areaRight-areaLeft)/2)
+	h:=((areaBottom-areaTop)/2)
+    x := w
+    y := 0
+    if (currMon = 2) {
+        x := w -1920
+        y := -300
+    }
+
+	WinRestore, A
+	WinMove, A, , x, y, w, h
 }
 
 BottomRightQuarterfWindow()
 {
-	SysGet, area, MonitorWorkArea
-	w:=((areaRight-areaLeft)/2)
-	h:=((areaBottom-areaTop)/2)
-
-	WinRestore, A
-	WinMove, A, , w, h, w, h
+    currMon := GetCurrentMonitor()
+	SysGet, area, MonitorWorkArea, %currMon%
+	w:=((areaRight-areaLeft)/2)
+	h:=((areaBottom-areaTop)/2)
+    x := w
+    y := h
+    if (currMon = 2) {
+        x := w -1920
+        y := h -300
+    }
+
+	WinRestore, A
+	WinMove, A, , x, y, w, h
 }
 
 MiddleWindow()
 {
-	SysGet, area, MonitorWorkArea
-	w:=((areaRight-areaLeft)/2)
-	h:=((areaBottom-areaTop)/2)
-
-	WinRestore, A
-	WinMove, A, , w/2, h/2, w, h
+    currMon := GetCurrentMonitor()
+	SysGet, area, MonitorWorkArea, %currMon%
+	w:=((areaRight-areaLeft)/2)
+	h:=((areaBottom-areaTop)/2)
+    x := w / 2
+    y := h /2
+    if (currMon = 2) {
+        x := (-1920 - w) / 2
+        y := (-300 / 2)
+    }
+
+	WinRestore, A
+	WinMove, A, , x, y, w, h
 }
 
 ; Mapppings
-^#Left::  LeftHalfWindow()  ; Default in Windows 10 is #Left
-^#Right:: RightHalfWindow() ; Default in Windows 10 is #Right
+#Left::  LeftHalfWindow()  ; Default in Windows 10 is #Left
+#Right:: RightHalfWindow() ; Default in Windows 10 is #Right
 ^#Up::   TopHalfWindow()
 ^#Down:: BottomHalfWindow()
 ^#1:: TopLeftQuarterfWindow()

^#4:: BottomRightQuarterfWindow()
^#5:: MiddleWindow()

; TODO: Send window to next monitor

; }}}
; Run or activate app and kill process {{{

    Return

; Open Gvim sourcing the minimal vimrc
; ^#m:: Run, gvim -u C:/OD/OneDrive/vimfiles/vimrc_min, C:/OD/OneDrive/vimfiles, max

; }}}
; Spotify and Volume {{{

; Spotify
#+p::Media_Play_Pause
#+j::Media_Next
#+k::Media_Prev
#+t::
{
    DetectHiddenWindows, On
    WinGetTitle, now_playing, ahk_class SpotifyMainWindow
    StringTrimLeft, playing, now_playing, 0
    Msgbox,,Spotify Current Track, %playing%, 1.5
    DetectHiddenWindows, Off
    Return
}

; Volume control
#+-::SoundSet -5
#+=::SoundSet +5
#+m:: SoundSet, +1, , mute

; }}}
; Toggle hidden files {{{
