Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; =================== Keymaps to use without bug.n ========================
- ; ===================================================================
- #HotkeyModifierTimeout 100
- RaiseWindowBelowCursor() {
- ; '''Activates window below the cursor'''
- MouseGetPos, , , id, control
- WinActivate, ahk_id %id%
- return
- }
- FF_tabgroup_back() {
- WinActivate, ahk_class MozillaWindowClass
- ;if WinActive("ahk_class MozillaWindowClass")
- caps()
- Send, ^+p
- return
- }
- FF_tabgroup_fwd() {
- WinActivate, ahk_class MozillaWindowClass
- ;if WinActive("ahk_class MozillaWindowClass")
- ;Send, {Esc}^+n ; The {Esc} key is for exiting possible Insert mode <-- old solution when not using caps-esc switching
- caps()
- Send, ^+n
- return
- }
- SkypeConversationUp() {
- Send, {AltDown}2{AltUp}
- Sleep, 10
- Send, {Up}{Enter}
- return
- }
- SkypeConversationDown() {
- Send, {AltDown}2{AltUp}
- Sleep, 10
- Send, {Down}{Enter}
- return
- }
- HistoryBack() {
- RaiseWindowBelowCursor()
- Send, !{Left}
- return
- }
- HistoryFwd() {
- RaiseWindowBelowCursor()
- Send, !{Right}
- return
- }
- TabBack() {
- RaiseWindowBelowCursor()
- if WinActive("ahk_class tSkMainForm")
- SkypeConversationUp()
- else
- Send, ^+{Tab}
- return
- }
- TabFwd() {
- RaiseWindowBelowCursor()
- if WinActive("ahk_class tSkMainForm")
- SkypeConversationDown()
- else
- Send, ^{Tab}
- return
- }
- ; Maximize active window and restore already maximized window:
- max_restore() {
- WinGet, winstate, MinMax, A
- if winstate = 1
- WinRestore, A
- else
- WinMaximize, A
- return
- }
- caps() {
- ;suspend to prevent calling esc
- Suspend on
- Send, {ESC}
- Suspend off
- return
- }
- ; ==============================================================
- ; SKYPE HACK: (dirty, dirty hack, but works)
- one() {
- if WinActive("ahk_class tSkMainForm") {
- Send, {AltDown}2{AltUp}
- Sleep, 10
- Send, {PgUp}{Enter}
- }
- else
- Send, ^1
- return
- }
- two() {
- if WinActive("ahk_class tSkMainForm") {
- Send, {AltDown}2{AltUp}
- Sleep, 10
- Send, {PgUp}{Down}{Enter}
- }
- else
- Send, ^2
- return
- }
- three() {
- if WinActive("ahk_class tSkMainForm") {
- Send, {AltDown}2{AltUp}
- Sleep, 10
- Send, {PgUp}{Down}{Down}{Enter}
- }
- else
- Send, ^3
- return
- }
- four() {
- if WinActive("ahk_class tSkMainForm") {
- Send, {AltDown}2{AltUp}
- Sleep, 10
- Send, {PgUp}{Down}{Down}{Down}{Enter}
- }
- else
- Send, ^4
- return
- }
- five() {
- if WinActive("ahk_class tSkMainForm") {
- Send, {AltDown}2{AltUp}
- Sleep, 10
- Send, {PgUp}{Down}{Down}{Down}{Down}{Enter}
- }
- else
- Send, ^5
- return
- }
- six() {
- if WinActive("ahk_class tSkMainForm") {
- Send, {AltDown}2{AltUp}
- Sleep, 10
- Send, {PgUp}{Down}{Down}{Down}{Down}{Down}{Enter}
- }
- else
- Send, ^6
- return
- }
- seven() {
- if WinActive("ahk_class tSkMainForm") {
- Send, {AltDown}2{AltUp}
- Sleep, 10
- Send, {PgUp}{Down}{Down}{Down}{Down}{Down}{Down}{Enter}
- }
- else
- Send, ^7
- return
- }
- eight() {
- if WinActive("ahk_class tSkMainForm") {
- Send, {AltDown}2{AltUp}
- Sleep, 10
- Send, {PgUp}{Down}{Down}{Down}{Down}{Down}{Down}{Down}{Enter}
- }
- else
- Send, ^8
- return
- }
- nine() {
- if WinActive("ahk_class tSkMainForm") {
- Send, {AltDown}2{AltUp}
- Sleep, 10
- Send, {PgUp}{Down}{Down}{Down}{Down}{Down}{Down}{Down}{Down}{Enter}
- }
- else
- Send, ^9
- return
- }
- ; =========== End of functions =====================================
- ; Tab Back & Forward:
- *^WheelLeft::TabBack()
- *^WheelRight::TabFwd()
- *^Left::TabBack()
- *^Right::TabFwd()
- ; Skype only tab switching:
- *^Down::SkypeConversationDown()
- *^Up::SkypeConversationUp()
- ; History Back & Forward:
- LAlt & WheelLeft::HistoryBack()
- LAlt & WheelRight::HistoryFwd()
- ; Switch tabs using alt+nr instead of ctrl; in case of Skype, switch chat windows (uses different function):
- LAlt & 1::one()
- LAlt & 2::two()
- LAlt & 3::three()
- LAlt & 4::four()
- LAlt & 5::five()
- LAlt & 6::six()
- LAlt & 7::seven()
- LAlt & 8::eight()
- LAlt & 9::nine()
- ; Firefox tabgroup movement:
- ^+WheelLeft::FF_tabgroup_back()
- ^+WheelRight::FF_tabgroup_fwd()
- ; Close active window witn Win + c
- LWin & c::Send !{F4}
- ; Maximize or restore window:
- LWin & x::max_restore()
- ; ==============================================================
- ; ======== Swap Esc and Caps Lock ========
- CapsOn=false
- Capslock::caps()
- Esc::
- ;use global variable to keep track of state
- if CapsOn = false
- {
- CapsOn = true
- SetCapsLockState, on
- }
- else
- {
- CapsOn = false
- SetCapsLockState, off
- }
- return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement