summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Bruhin <git@the-compiler.org>2013-10-17 15:39:45 +0200
committerFlorian Bruhin <git@the-compiler.org>2013-10-17 15:39:45 +0200
commit1888c354d6d8e77e02f9ec03be1b4e88a6ca9296 (patch)
tree34e10da74a77e1980ff51898dc304f1e6b8c7e54
parente3d3b881c9048b22ef8f027766fc62837440486e (diff)
downloadwinunsuck-1888c354d6d8e77e02f9ec03be1b4e88a6ca9296.tar.gz
winunsuck-1888c354d6d8e77e02f9ec03be1b4e88a6ca9296.zip
Fix trailing whitespace
-rw-r--r--winunsuck.ahk592
1 files changed, 296 insertions, 296 deletions
diff --git a/winunsuck.ahk b/winunsuck.ahk
index 0696b8f..6a82ae1 100644
--- a/winunsuck.ahk
+++ b/winunsuck.ahk
@@ -5,21 +5,21 @@
; Avoids checking empty variables to see if they are environment variables (recommended for all new scripts).
#NoEnv
; Use SendInput instead of Send
-SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
+SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
; Change PWD to the dir the script is in
;SetWorkingDir %A_ScriptDir%
-; Skips the gentle method of activating a window and goes straight to the forceful method.
+; Skips the gentle method of activating a window and goes straight to the forceful method.
#WinActivateForce
; Don't display a tray icon
-; #NoTrayIcon
+; #NoTrayIcon
-SetBatchLines, 10ms ; maximize script speed!
-SetWinDelay, 0
-OnExit, CleanUp ;clean up in case of error (otherwise some windows will get lost)
+SetBatchLines, 10ms ; maximize script speed!
+SetWinDelay, 0
+OnExit, CleanUp ;clean up in case of error (otherwise some windows will get lost)
-numDesktops := 9 ; maximum number of desktops
-curDesktop := 1 ; index number of current desktop
-lock = 0 ; lock to prevent running both hotkeys at same time
+numDesktops := 9 ; maximum number of desktops
+curDesktop := 1 ; index number of current desktop
+lock = 0 ; lock to prevent running both hotkeys at same time
;;;;;;;;;;;;;;;;;;;;;;;;;
;; Focus follows mouse ;;
@@ -115,15 +115,15 @@ return
or abs(cos_mousedrag_y2 - cos_mousedrag_y) > 20)
{
if (!WinActive("ahk_class KiTTY"))
- and (!WinActive("ahk_class Console_2_Main"))
- and (!WinActive("ahk_class mintty"))
- and (!WinActive("ahk_class rxvt00000298"))
- and (!WinActive("ahk_class ConsoleWindowClass"))
+ and (!WinActive("ahk_class Console_2_Main"))
+ and (!WinActive("ahk_class mintty"))
+ and (!WinActive("ahk_class rxvt00000298"))
+ and (!WinActive("ahk_class ConsoleWindowClass"))
and (!WinActive("ahk_class VNCviewer"))
and (!WinActive("ahk_class PuTTY"))
{
oldclipboard := ClipboardAll
- Clipboard =
+ Clipboard =
sendinput ^c
ClipWait
primarysel := Clipboard
@@ -146,11 +146,11 @@ mButton::
;;; Compose ;;;
;;;;;;;;;;;;;;;
-AppsKey::
+AppsKey::
Input, composekeys, "BL2"
if composekeys = "u
{
- Send
+ Send
}
if composekeys = "a
{
@@ -198,285 +198,285 @@ return
;;; Desktops ;;;
;;;;;;;;;;;;;;;;
-#1::
- if(lock = 0)
- {
- lock = 1
- SwitchToDesktop(1)
- }
-return
-
-#2::
- if(lock = 0)
- {
- lock = 1
- SwitchToDesktop(2)
- }
-return
-
-#3::
- if(lock = 0)
- {
- lock = 1
- SwitchToDesktop(3)
- }
-return
-
-#4::
- if(lock = 0)
- {
- lock = 1
- SwitchToDesktop(4)
- }
-return
-
-#5::
- if(lock = 0)
- {
- lock = 1
- SwitchToDesktop(5)
- }
-return
-
-#6::
- if(lock = 0)
- {
- lock = 1
- SwitchToDesktop(6)
- }
-return
-
-#7::
- if(lock = 0)
- {
- lock = 1
- SwitchToDesktop(7)
- }
-return
-
-#8::
- if(lock = 0)
- {
- lock = 1
- SwitchToDesktop(8)
- }
-return
-
-#9::
- if(lock = 0)
- {
- lock = 1
- SwitchToDesktop(9)
- }
-return
-
-+#1::
- if(lock = 0)
- {
- lock = 1
- SendActiveToDesktop(1)
- }
-return
-
-+#2::
- if(lock = 0)
- {
- lock = 1
- SendActiveToDesktop(2)
- }
-return
-
-+#3::
- if(lock = 0)
- {
- lock = 1
- SendActiveToDesktop(3)
- }
-return
-
-+#4::
- if(lock = 0)
- {
- lock = 1
- SendActiveToDesktop(4)
- }
-return
-
-+#5::
- if(lock = 0)
- {
- lock = 1
- SendActiveToDesktop(5)
- }
-return
-
-+#6::
- if(lock = 0)
- {
- lock = 1
- SendActiveToDesktop(6)
- }
-return
-
-+#7::
- if(lock = 0)
- {
- lock = 1
- SendActiveToDesktop(7)
- }
-return
-
-+#8::
- if(lock = 0)
- {
- lock = 1
- SendActiveToDesktop(8)
- }
-return
-
-+#9::
- if(lock = 0)
- {
- lock = 1
- SendActiveToDesktop(9)
- }
-return
-
-; switch to the desktop with the given index number
-SwitchToDesktop(newDesktop)
-{
- global
-
- WinGetActiveTitle, curWin
-
- ; Removes the chance of getting Start Menu Shadow Frozen on Screen
- if(curWin = "")
- WinActivate, Program Manager
-
- ; Removes the chance of getting Tray or Tooltip shadows frozen on screen
- ToolTip
- TrayTip
+#1::
+ if(lock = 0)
+ {
+ lock = 1
+ SwitchToDesktop(1)
+ }
+return
+
+#2::
+ if(lock = 0)
+ {
+ lock = 1
+ SwitchToDesktop(2)
+ }
+return
+
+#3::
+ if(lock = 0)
+ {
+ lock = 1
+ SwitchToDesktop(3)
+ }
+return
+
+#4::
+ if(lock = 0)
+ {
+ lock = 1
+ SwitchToDesktop(4)
+ }
+return
+
+#5::
+ if(lock = 0)
+ {
+ lock = 1
+ SwitchToDesktop(5)
+ }
+return
+
+#6::
+ if(lock = 0)
+ {
+ lock = 1
+ SwitchToDesktop(6)
+ }
+return
+
+#7::
+ if(lock = 0)
+ {
+ lock = 1
+ SwitchToDesktop(7)
+ }
+return
+
+#8::
+ if(lock = 0)
+ {
+ lock = 1
+ SwitchToDesktop(8)
+ }
+return
+
+#9::
+ if(lock = 0)
+ {
+ lock = 1
+ SwitchToDesktop(9)
+ }
+return
+
++#1::
+ if(lock = 0)
+ {
+ lock = 1
+ SendActiveToDesktop(1)
+ }
+return
+
++#2::
+ if(lock = 0)
+ {
+ lock = 1
+ SendActiveToDesktop(2)
+ }
+return
+
++#3::
+ if(lock = 0)
+ {
+ lock = 1
+ SendActiveToDesktop(3)
+ }
+return
+
++#4::
+ if(lock = 0)
+ {
+ lock = 1
+ SendActiveToDesktop(4)
+ }
+return
+
++#5::
+ if(lock = 0)
+ {
+ lock = 1
+ SendActiveToDesktop(5)
+ }
+return
+
++#6::
+ if(lock = 0)
+ {
+ lock = 1
+ SendActiveToDesktop(6)
+ }
+return
+
++#7::
+ if(lock = 0)
+ {
+ lock = 1
+ SendActiveToDesktop(7)
+ }
+return
+
++#8::
+ if(lock = 0)
+ {
+ lock = 1
+ SendActiveToDesktop(8)
+ }
+return
+
++#9::
+ if(lock = 0)
+ {
+ lock = 1
+ SendActiveToDesktop(9)
+ }
+return
+
+; switch to the desktop with the given index number
+SwitchToDesktop(newDesktop)
+{
+ global
+
+ WinGetActiveTitle, curWin
+
+ ; Removes the chance of getting Start Menu Shadow Frozen on Screen
+ if(curWin = "")
+ WinActivate, Program Manager
+
+ ; Removes the chance of getting Tray or Tooltip shadows frozen on screen
+ ToolTip
+ TrayTip
WinClose, ahk_class SysShadow
-
- if (curDesktop <> newDesktop)
- {
- GetCurrentWindows(curDesktop)
- ShowHideWindows(curDesktop, false)
- ShowHideWindows(newDesktop, true)
- activate_window := % active_id%newDesktop%
- WinActivate, ahk_id %activate_window%
- curDesktop := newDesktop
- }
-
- lock = 0
- return
-}
-
-; sends the given window from the current desktop to the given desktop
-SendToDesktop(windowID, newDesktop)
-{
- global
- if (curDesktop <> newDesktop)
- {
- RemoveWindowID(curDesktop, windowID)
-
- ; add window to destination desktop
- windows%newDesktop% += 1
- i := windows%newDesktop%
-
- windows%newDesktop%%i% := windowID
-
- WinHide, ahk_id %windowID%
- Send, {ALT DOWN}{TAB}{ALT UP} ; activate the right window
- }
-}
-
-; sends the currently active window to the given desktop
-SendActiveToDesktop(newDesktop)
-{
-
- global
-
- WinGet, id, ID, A
-
- WinGetActiveTitle, curWin
-
- ; sleep, 20
-
- ; If Window Does not have a title, do not send it
- if( (curWin = "") || (curWin = "Program Manager"))
- {
- lock = 0
- ; sleep, 100
- return
- }
-
- SendToDesktop(id, newDesktop)
- ; sleep, 100
- lock = 0
-}
-
-; removes the given window id from the desktop <desktopIdx>
-RemoveWindowID(desktopIdx, ID)
-{
- global
- Loop, % windows%desktopIdx%
- {
- if (windows%desktopIdx%%A_Index% = ID)
- {
- windows%desktopIdx%%A_Index%= ;Emiel: just empty the array element, array will be emptied by next switch anyway
- Break
- }
- }
-}
-
-; this builds a list of all currently visible windows in stores it in desktop <index>
-GetCurrentWindows(index)
-{
- global
- WinGet, active_id%index%, ID, A ; get the current active window
- emptyString =
- StringSplit, windows%index%, emptyString ; delete the entire windows_index_ array
- WinGet, windows%index%, List,,, Program Manager ; get list of all visible windows
-
- ; remove windows which we want to see on all virtual desktops
- Loop, % windows%index%
- {
- id := % windows%index%%A_Index%
- WinGetClass, windowClass, ahk_id %id%
- if windowClass = Shell_TrayWnd ; remove task bar window id
- windows%index%%A_Index%= ; just empty the array element, array will be emptied by next switch anyway
- if windowClass = #32770 ; we also want multimontaskbar on all virtual desktops
- windows%index%%A_Index%= ; just empty the array element, array will be emptied by next switch anyway
- if windowClass = cygwin/x X rl-xosview-XOsview-0 ; xosviews e.d.
- windows%index%%A_Index%=
- if windowClass = cygwin/x X rl-xosview-XOsview-1 ; xosviews e.d.
- windows%index%%A_Index%=
- if windowClass = MozillaUIWindowClass ; Mozilla thunderbird
- {
- WinGet, ExStyle, ExStyle, ahk_id %id%
- if (ExStyle & 0x8) ; 0x8 is WS_EX_TOPMOST.
- windows%index%%A_Index%=
+
+ if (curDesktop <> newDesktop)
+ {
+ GetCurrentWindows(curDesktop)
+ ShowHideWindows(curDesktop, false)
+ ShowHideWindows(newDesktop, true)
+ activate_window := % active_id%newDesktop%
+ WinActivate, ahk_id %activate_window%
+ curDesktop := newDesktop
+ }
+
+ lock = 0
+ return
+}
+
+; sends the given window from the current desktop to the given desktop
+SendToDesktop(windowID, newDesktop)
+{
+ global
+ if (curDesktop <> newDesktop)
+ {
+ RemoveWindowID(curDesktop, windowID)
+
+ ; add window to destination desktop
+ windows%newDesktop% += 1
+ i := windows%newDesktop%
+
+ windows%newDesktop%%i% := windowID
+
+ WinHide, ahk_id %windowID%
+ Send, {ALT DOWN}{TAB}{ALT UP} ; activate the right window
+ }
+}
+
+; sends the currently active window to the given desktop
+SendActiveToDesktop(newDesktop)
+{
+
+ global
+
+ WinGet, id, ID, A
+
+ WinGetActiveTitle, curWin
+
+ ; sleep, 20
+
+ ; If Window Does not have a title, do not send it
+ if( (curWin = "") || (curWin = "Program Manager"))
+ {
+ lock = 0
+ ; sleep, 100
+ return
+ }
+
+ SendToDesktop(id, newDesktop)
+ ; sleep, 100
+ lock = 0
+}
+
+; removes the given window id from the desktop <desktopIdx>
+RemoveWindowID(desktopIdx, ID)
+{
+ global
+ Loop, % windows%desktopIdx%
+ {
+ if (windows%desktopIdx%%A_Index% = ID)
+ {
+ windows%desktopIdx%%A_Index%= ;Emiel: just empty the array element, array will be emptied by next switch anyway
+ Break
+ }
+ }
+}
+
+; this builds a list of all currently visible windows in stores it in desktop <index>
+GetCurrentWindows(index)
+{
+ global
+ WinGet, active_id%index%, ID, A ; get the current active window
+ emptyString =
+ StringSplit, windows%index%, emptyString ; delete the entire windows_index_ array
+ WinGet, windows%index%, List,,, Program Manager ; get list of all visible windows
+
+ ; remove windows which we want to see on all virtual desktops
+ Loop, % windows%index%
+ {
+ id := % windows%index%%A_Index%
+ WinGetClass, windowClass, ahk_id %id%
+ if windowClass = Shell_TrayWnd ; remove task bar window id
+ windows%index%%A_Index%= ; just empty the array element, array will be emptied by next switch anyway
+ if windowClass = #32770 ; we also want multimontaskbar on all virtual desktops
+ windows%index%%A_Index%= ; just empty the array element, array will be emptied by next switch anyway
+ if windowClass = cygwin/x X rl-xosview-XOsview-0 ; xosviews e.d.
+ windows%index%%A_Index%=
+ if windowClass = cygwin/x X rl-xosview-XOsview-1 ; xosviews e.d.
+ windows%index%%A_Index%=
+ if windowClass = MozillaUIWindowClass ; Mozilla thunderbird
+ {
+ WinGet, ExStyle, ExStyle, ahk_id %id%
+ if (ExStyle & 0x8) ; 0x8 is WS_EX_TOPMOST.
+ windows%index%%A_Index%=
}
if alwaysShow%id% = 1
- windows%index%%A_Index%=
- }
-}
-
-; if show=true then shows windows of desktop %index%, otherwise hides them
-ShowHideWindows(index, show)
-{
- global
-
- Loop, % windows%index%
- {
- id := % windows%index%%A_Index%
- if show
- WinShow, ahk_id %id%
- else
- WinHide, ahk_id %id%
- }
-}
+ windows%index%%A_Index%=
+ }
+}
+
+; if show=true then shows windows of desktop %index%, otherwise hides them
+ShowHideWindows(index, show)
+{
+ global
+
+ Loop, % windows%index%
+ {
+ id := % windows%index%%A_Index%
+ if show
+ WinShow, ahk_id %id%
+ else
+ WinHide, ahk_id %id%
+ }
+}
;;;;;;;;;;;
@@ -484,9 +484,9 @@ ShowHideWindows(index, show)
;;;;;;;;;;;
CleanUp:
- ; show all windows from all desktops on exit
- Loop, %numDesktops%
- ShowHideWindows(A_Index, true)
+ ; show all windows from all desktops on exit
+ Loop, %numDesktops%
+ ShowHideWindows(A_Index, true)
; Unset focus follows mouse
DllCall("SystemParametersInfo",UInt,0x1001,UInt,0,UInt,0,UInt,1 | 2)
; Display message
@@ -494,4 +494,4 @@ CleanUp:
{
MsgBox, 0x1030, USB-Stick, Stick nicht vergessen!, 5
}
- ExitApp
+ ExitApp