Skip to content

Commit

Permalink
Use vk codes instead of key names for hotkey strings
Browse files Browse the repository at this point in the history
Fixes #91
  • Loading branch information
SaifAqqad committed Sep 9, 2023
1 parent 25493ee commit 42405bd
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/UI/config/HotkeyPanel.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
if (this.isModifier(value) && !isModifierHotkey)
str .= this.modifierToSymbol(value)
else ; else => append the part
str .= value . " & "
str .= Format("VK{:x}", GetKeyVK(value)) " & "
}
; remove trailing " & "
if(SubStr(str, -2) = " & ")
Expand All @@ -116,18 +116,18 @@
;match modifier symbols
str:= StrReplace(str, symbol, "",, 1)
modifier:= this.symbolToModifier(symbol)
finalStr.= (useNeutralModifers? this.modifierToNeutral(modifier) : modifier) . " + "
finalStr.= (useNeutralModifers? this.modifierToNeutral(modifier) : this.GetHKeyName(modifier)) . " + "
}else if(RegExMatch(str, this.modifier_regex, modifier)){ ; no more symbols
;match modifiers
str:= StrReplace(str, modifier, "",, 1)
finalStr.= (useNeutralModifers? this.modifierToNeutral(modifier) : modifier) . " + "
finalStr.= (useNeutralModifers? this.modifierToNeutral(modifier) : this.GetHKeyName(modifier)) . " + "
}else{ ;no more modifiers
;match keys
Loop, Parse, str, % "&", %A_Space%%A_Tab%
{
if(A_LoopField){
str:= StrReplace(str, A_LoopField, "",, 1)
finalStr.= A_LoopField . " + "
finalStr.= this.GetHKeyName(A_LoopField) . " + "
}
}
;remove spaces and '&' from str
Expand All @@ -138,6 +138,15 @@
return SubStr(finalStr,1,-3)
}

GetHKeyName(key){
key:= GetKeyName(key)

if(StrLen(key) == 1)
key:= Format("{:U}", key)

return key
}

modifierToSymbol(modifier){
out:= str:= ""
RegExMatch(modifier, this.modifier_regex, out)
Expand Down

0 comments on commit 42405bd

Please sign in to comment.