Skip to content

Instantly share code, notes, and snippets.

@navhaxs
Last active February 15, 2024 17:34
Show Gist options
  • Save navhaxs/156ea4ce4cd0b6f038898ce57e686d72 to your computer and use it in GitHub Desktop.
Save navhaxs/156ea4ce4cd0b6f038898ce57e686d72 to your computer and use it in GitHub Desktop.
Personal autohotkey scipt. Lenovo Thinkpad T450s media keys / Synaptics Task View gestures
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; THINKPAD T450s
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Right Ctrl + Right Shift to open App key (Menu key)
; since it's missing from the keyboard.
~RControl & RShift::Send {AppsKey}
Return
; For some reason, Lenovo's idea of media keys doesn't include Play/Pause,
; Next track and Previous track ¯\_(?)_/¯
;
; The following are inspired from some reddit thread (can't find the src for the life of me)
; KeyWait is there so that AHK plays nicely with the Streamkeys extension.
; TODO: Commented-out ones work with Chrome streamkeys, the others work with normal stuff (Spotify, ..)
;;;; ; Ctrl + Alt + \
;;;; ^!\::
;;;; KeyWait, \
;;;; Send {Media_Play_Pause}
;;;; Return
;;;;
;;;; ; Ctrl + Alt + [
;;;; ^![::
;;;; KeyWait, [
;;;; Send {Media_Prev}
;;;; Return
;;;;
;;;; ; Ctrl + Alt + ]
;;;; ^!]::
;;;; KeyWait, ]
;;;; Send {Media_Next}
;;;; Return
^!\::Media_Play_Pause
^![::Media_Prev
^!]::Media_Next
; Synaptics three finger tap / click --> Virtual Desktops
; http://imgur.com/a/6hoQc
<#s::
Send {LWin down}{Tab down}{LWin up}{Tab up}
Return
; Win + Spacebar --> Win + `
; (which is configured for Listary)
#Space::Send #``
; From the internet:
; Alt + ~
; to toggle between windows of the same app.
; !FIXME! Broken when UWP apps are in the foreground
!`:: ; Next window
WinGetClass, ActiveClass, A
WinGet, WinClassCount, Count, ahk_class %ActiveClass%
if (WinClassCount = 1) ; or %ActiveClass% == ApplicationFrameWindow)
{
Return
}
WinGet, List, List, % "ahk_class " ActiveClass
Loop, % List
{
index := List - A_Index + 1
WinGet, State, MinMax, % "ahk_id " List%index%
if (State <> -1)
{
WinID := List%index%
break
}
}
WinActivate, % "ahk_id " WinID
return
;!^`:: ; Last window
; WinGetClass, ActiveClass, A
; WinGet, WinClassCount, Count, ahk_class %ActiveClass%
; if (WinClassCount = 1 or %ActiveClass% == ApplicationFrameWindow)
; {
; Return
; }
; WinGet, List, List, % "ahk_class " ActiveClass
; Loop, % List
; {
; index := List - A_Index + 1
; WinGet, State, MinMax, % "ahk_id " List%index%
; if (State <> -1)
; {
; WinID := List%index%
; break
; }
; }
; WinActivate, % "ahk_id " WinID
; return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment