-
Notifications
You must be signed in to change notification settings - Fork 22
/
Toggle AE Brightness.jsx
45 lines (41 loc) · 994 Bytes
/
Toggle AE Brightness.jsx
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
/**
* Toggles app brightness
*
* @author Zack Lovatt <[email protected]>
* @version 0.2.1
*/
(function toggleAppBrightness() {
var prefInfo = {
section: 'Main Pref Section v2',
key: 'User Interface Brightness (4) [0.0..1.0]',
file: PREFType.PREF_Type_MACHINE_INDEPENDENT,
};
var newSetting;
try {
// Toggle the pref, save to disk, and reload so it's active in the current session
if (parseFloat(app.version) >= 12.0) {
newSetting = +!(
app.preferences.getPrefAsLong(
prefInfo.section,
prefInfo.key,
prefInfo.file
) === 1
);
app.preferences.savePrefAsLong(
prefInfo.section,
prefInfo.key,
newSetting,
prefInfo.file
);
}
app.preferences.saveToDisk();
app.preferences.reload();
if (newSetting === 0) {
alert('AE Now Dark!');
} else {
alert('AE Now Light!');
}
} catch (e) {
alert('Can\'t change prefs!\n' + e);
}
})();