Create a gist now

Instantly share code, notes, and snippets.

AutoHotKey script for they who, being Mac Users with an Apple keyboard, yet still insist on using Windows. Also some arrange-windows-on-a-big-screen keys . Takes a similar approach as Parallels to keyboard mapping: rather than a wholesale swap of Cmd <-> Ctrl, instead duplicate favourite ctrl-key shortcuts to the Cmd key. For the big screen: som…
; Language: English
; https://gist.github.com/chrisfcarroll/dddf32fea1f29e75f564
;
; Uses unicode. Save this file as utf-8 with BOM.
; Else it shall not work.
;
#NoEnv ; Recommended
;SendMode Input ; Recommended
SendMode Event
SetWorkingDir %userprofile% ; Ensures a consistent starting directory.
; === autotexts ========================================================
;
::ccuu::chris.carroll@myemailaddress
::ccws::chris.carroll@myotheremailaddress
; === Liquid, Launcher and Widget Hotkeys ========================================================
;
; Put a little [Liquid|Flow][http://www.liquid.info/] core functionality on Cmd-Alt-'
#!'::
clipboard = ;
Send ^c
Clipwait
MsgBox, 0, Launcher, % " websearch: " Clipboard, 0.2
if (clipboard != "") {
url:= "https://google.co.uk/search?q=" . StrReplace(Clipboard, "`%", "`%25")
Run % url
}
return
; Use Cmd-' as my launcher key. http://conemu.github.io/ made me do it.
#'::
SplashTextOn 200, 130
, Launcher
, % " Press 2nd Key: `r`n `r`n ' : ConsoleEmu `r`n s : Sublime text `r`n e : Edge Browser `r`n w : Windows Explorer "
Input Key, L1 T4
if (Key="'") {
Run, "C:\Program Files\ConEmu\ConEmu64.exe"
} else if (Key="s") {
Run, "C:\Program Files\Sublime Text 3\sublime_text.exe"
} else if (Key="e") {
Run, microsoft-edge:
;Run, http://127.0.0.2
} else if (Key="w") {
Run, "explorer", %UserProfile%
} else {
}
SplashTextOff
return
;
#F4::
SplashTextOn 300,200
, Widgets
, % " 3 : Calendar `r`n 4 : Calculator "
Input Key, L1 T5
if (Key="3") {
Run, outlookcal:
} else if (Key="4") {
Run, calc
} else {
}
SplashTextOff
return
; === Unixisms ==========================================================
;
; Because you've come from using a Mac command line
;
^a::Send {Home} ; May drive you crazy because you're used to ^a == select all. Cmd-A get mapped below though so sanity restored.
^e::Send {End}
; === Windowsisms =======================================================
; Because there's no right-click menu key on an apple keyboard
RWin::AppsKey
; === macOSisms ========================================================
#$::Run, C:\WINDOWS\system32\SnippingTool.exe
; === Mac Keyboard for a Mac User on Windows ===================================================
;
; a) Use Command-key for favourite Ctrl-key shortcuts
; b) Where (a) removes a favourite Windows-key shortcut, replace it with Command-Alt-Ctrl-key
; c) Some the function keys e.g. volume control
; d) a subset of the characters available on a Mac keyboard via the alt key
;
; NB some of these may be specific to the Apple UK Extended keyboard layout.
; (Alt-2 & Alt-3 are the only thing that comes to mind but anyway...);
; My keyboard layout is at http://www.cafe-encounter.net/p84/apple-uk-keyboard-layout-for-windows
;
;
!-::–
!+-::—
!=::!=
!+=::±
![::“
!+[::”
!]::‘
!+]::’
!;::…
!'::æ
!+'::Æ
!\::«
!+\::»
!,::<=
!+,::¯
!.::>=
;!+.::breve
!/::÷
!+/::¿
!_::—
; Put alt-letters entirely on RightAlt to avoid menu shortcut clashes
>!a::å
>!+a::Å
>!b::∫
;!+b::i
>!c::ç
>!+c::Ç
>!d::∂
!+d::Î
>!e::´
>!+e::‰
>!f::ƒ
>!+f::Ï
>!g::©
>!+g::Ì
;!h::overdot
>!+h::Ó
>!i::^
>!+i::È
>!j::δ
>!+j::Ô
>!k::°
>!+k::⌘
>!l::¬
>!+l::Ò
>!m::µ
>!+m::˜
>!n::~
>!+n::ˆ
>!o::ø
>!+o::Ø
>!p::π
>!+p::Π
>!q::œ
>!+q::Œ
>!r::®
>!+r::Â
>!s::ß
>!+s::Í
>!t::†
>!+t::Ê
>!u::¨
>!+u::Ë
>!v::v
;!+v::lozenge
>!w::ε
>!+w::„
>!x::≅
>!+x::Ù
>!y::¥
>!+y::Á
>!z::ω
>!+z::Ω
; === Function 1 to 12: Use win-F rather than raw F-keys à la MacOS because so many Windows apps use them. =======
; No equivalent to most of the keys but this works for me. I don't have screen brightness controls.
#F1::Run powercfg.cpl
#F2::Run desk.cpl
#F3::#Tab
;"Launch_App2" didn't work for me. See above for F4 key
#F7::Media_Prev
#F8::Media_Play_Pause
#F9::Media_Next
#F10::volume_mute
#F11::volume_down
#!F12::Run, SndVol.exe
#+F12::Run, "C:\Program Files (x86)\TuneBlade\TuneBlade\TuneBlade.exe" ;TuneBlade—airplay on your PC!
#F12::volume_up
; === Functions 13 to 19 =======
F13::PrintScreen
; -- Sleep. Maybe. Google it if you want to know about the problems with this line ---
#!F15::DllCall("PowrProf\SetSuspendState", "int", 0, "int", 0, "int", 0)
; "F15::Sleep" did not work on my machine
F16::Send {Pause}
^F16::Send {CtrlBreak}
;Win-F16 on my machine does a quite cool graphical cancelable shutdown
;Win-F17 does something weird to the screen for 2 seconds
; === Basic Cmd <-> Ctrl key swapping with cherry-picking of my favourite exceptions =====
#LButton::^LButton
#RButton::^RButton
#a::^a
#b::^b
#c::^c
#d::^d
#e::^e
#f::^f
#g::^g
#h::WinMinimize, A
#i::^i
#j::^j
#k::^k
;#l is for lockscreen
#m::^m
#n::^n
#o::^o
;Win-P is for projectors and screen
#p::^p
#^!p::#p
#q::^q
;Win-R is for the run menu
#+R::Run, "C:\Users\Chris\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup"
#s::^s
#t::^t
#u::^u
#v::^v
#w::Send ^{F4}
#x::^x
;Win-X is for Windows Tools Menu
#^!x::#x
#y::^y
#z::^z
#1::^1
#2::^2
#3::^3
#4::^4
#5::^5
#6::^6
#7::^7
#8::^8
#9::^9
#0::^0
#-::^-
#=::^=
#+::^+
;;#[:: Safari back and forwards
#[::Send !{Left}
#]::Send !{Right}
#{::^{
#}::^}
#\::^\
#|::^|
#`::^`
#~::^~
#,::^,
#<::^<
#.::^.
#>::^>
#/::^/
#?::^?
;<#LButton::^LButton ; This doesn't seem to work. Is there no such thing as Windows-Click?
; Mac Keyboard has lots of characters available on the alt-keys. Who can live without ellipses and m-dashes? Especially in 140 characters
; However. Windows apps use alt-key combos for menu shortcuts, so
; - You may prefer to remove or comment out most of these.
; - I put many of them on Right-Alt specifically.
;
!1::¡
!+1::/
!2::€
!+2::™
!3::Send {#} ; I use a UK keyboard which has Shift-3 == £
!+3::‹
!4::¢
!+4::›
!5::∞
!6::§
!+6::fl
!7::¶
!+7::‡
!8::•
!+8::°
!9::ª
!+9::·
!0::º
!+0::‚
;
; === Large screen shortcuts ===================================================================
;
ResizeWin(Width = 0,Height = 0, newX = 1, newY = 1)
{
WinGetPos,X,Y,W,H,A
If %Width% = 0
Width := W
If %Height% = 0
Height := H
If %newX% = 1
newX := X
If %newY% = 1
newY := Y
WinMove,A,,%newX%,%newY%,%Width%,%Height%
}
; Change these numbers to match the 3rds on your screen. Or whatever works for you.
#Numpad1::ResizeWin( 600, 1440, 60)
#Numpad2::ResizeWin( 600, 1440, 1390)
#Numpad3::ResizeWin( 600, 1440, 2840)
#Numpad4::ResizeWin(1050, 1440, 60)
#Numpad5::ResizeWin(1295, 1440, 1091)
#Numpad6::ResizeWin(1050, 1440, 2371)
#Numpad7::ResizeWin(2200, 1440, 60)
#Numpad8::ResizeWin(2220, 1440, 640)
#Numpad9::ResizeWin(2200, 1440, 1240)
!#Numpad1::ResizeWin( 600, 720, 60, 720)
!#Numpad2::ResizeWin( 600, 720, 1390, 720)
!#Numpad3::ResizeWin( 600, 720, 2840, 720)
!#Numpad4::ResizeWin(1050, 720, 60, 720)
!#Numpad5::ResizeWin(1295, 720, 1091, 720)
!#Numpad6::ResizeWin(1050, 720, 2371, 720)
!#Numpad7::ResizeWin( 600, 720, 60)
!#Numpad8::ResizeWin( 600, 720, 1390)
!#Numpad9::ResizeWin( 600, 720, 2840)
@chrisfcarroll
Owner
chrisfcarroll commented Jan 3, 2017 edited

Other stuff I did for Windows-Mac swappers, (UK keyboard driver; BootCamp download help) on www.cafe-encounter.net

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment