-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathControl Key Repeat.applescript
50 lines (42 loc) · 1.27 KB
/
Control Key Repeat.applescript
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
###################################################
# Control Key Repeat
#
# Enables/Disables macOS Key Repeat
#
# 2019-03-19
# Timo Kahle
#
#
# Changes
#
# v1.0 (2019-03-19)
# -Initial version
#
###################################################
# Properties
property appIcon : "applet.icns"
property appName : "ControlKeyRepeat"
property appVersion : "1.0"
property dlgText : "Enable or Disable Press And Hold."
property CMD_EnablePressAndHold : "defaults write -g ApplePressAndHoldEnabled -bool true"
property CMD_DisablePressAndHold : "defaults write -g ApplePressAndHoldEnabled -bool false"
###################################################
# Main
on run
# Set resources
set applicationIcon to (path to resource appIcon)
set dlgTitle to appName & " (" & appVersion & ")"
# User interaction
set myAnswer to display dialog dlgText with title dlgTitle buttons {"Cancel", "Press And Hold", "Key Repeat"} default button {"Press And Hold"} cancel button "Cancel" with icon applicationIcon
set myResult to button returned of myAnswer
# Call change function
changeFlag(myResult)
end run
# Apply the changes
on changeFlag(myState)
if myState = "Press And Hold" then
do shell script CMD_EnablePressAndHold
else
do shell script CMD_DisablePressAndHold
end if
end changeFlag