Skip to content

Commit 8afac84

Browse files
committed
Display Alt key as Option on Mac
1 parent 7a9aeba commit 8afac84

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

js/interface/actions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import MolangParser from "molangjs";
2-
import { Keybinds } from "./keyboard";
2+
import { isMac, Keybinds } from "./keyboard";
33
import tinycolor from "tinycolor2";
44

55
type ActionEventName =
@@ -524,7 +524,7 @@ export class Action extends BarItem {
524524
updateKeybindingLabel(): this {
525525
let keybind_text = this.keybind?.toString() || '';
526526
if (!keybind_text && this.id == 'color_picker') {
527-
keybind_text = tl('keys.alt');
527+
keybind_text = tl(isMac ? 'keys.option' : 'keys.alt');
528528
}
529529
this.menu_node.querySelector('.keybinding_label').textContent = keybind_text;
530530
this.nodes.forEach(node => {

js/interface/interface.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Blockbench } from "../api";
22
import { translateUI } from "../languages";
33
import { currentwindow } from "../native_apis";
4+
import { isMac } from "./keyboard";
45
import { ResizeLine, setupResizeLines } from "./resize_lines";
56

67

@@ -754,7 +755,7 @@ onVueSetup(function() {
754755
<span>{{ tl(modifier_keys.shift.last()) }}</span>
755756
</div>
756757
<div class="status_bar_modifier_key" v-if="modifier_keys.alt.length" @click="clickModifiers()">
757-
<kbd>${tl('keys.alt')}</kbd>
758+
<kbd>${tl(isMac ? 'keys.option' : 'keys.alt')}</kbd>
758759
<span>{{ tl(modifier_keys.alt.last()) }}</span>
759760
</div>
760761
</template>

js/interface/keyboard.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const KeymapPresets = {
1010
cinema4d,
1111
maya,
1212
}
13-
const isMac = window.SystemInfo?.platform == 'darwin' || navigator.userAgent.includes('Mac OS');
13+
export const isMac = window.SystemInfo?.platform == 'darwin' || navigator.userAgent.includes('Mac OS');
1414

1515
export const Keybinds = {
1616
actions: [],
@@ -162,8 +162,8 @@ export class Keybind {
162162
if (this.ctrl === null) modifiers.push(`[${tl('keys.ctrl')}]`)
163163
if (this.shift) modifiers.push(tl('keys.shift'))
164164
if (this.shift === null) modifiers.push(`[${tl('keys.shift')}]`)
165-
if (this.alt) modifiers.push(tl('keys.alt'))
166-
if (this.alt === null) modifiers.push(`[${tl('keys.alt')}]`)
165+
if (this.alt) modifiers.push(tl(isMac ? 'keys.option' : 'keys.alt'))
166+
if (this.alt === null) modifiers.push(`[${tl(isMac ? 'keys.option' : 'keys.alt')}]`)
167167
if (this.meta) modifiers.push(tl('keys.meta'))
168168
if (this.meta === null) modifiers.push(`[${tl('keys.meta')}]`)
169169

@@ -451,7 +451,7 @@ export class Keybind {
451451
let modifiers = [];
452452
if (event.ctrlKey) modifiers.push(tl('keys.ctrl'))
453453
if (event.shiftKey) modifiers.push(tl('keys.shift'))
454-
if (event.altKey) modifiers.push(tl('keys.alt'))
454+
if (event.altKey) modifiers.push(tl(isMac ? 'keys.option' : 'keys.alt'))
455455
if (event.metaKey) modifiers.push(tl('keys.meta'))
456456

457457
modifiers.forEach((text, i) => {

lang/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@
185185
"keys.ctrl": "Ctrl",
186186
"keys.shift": "Shift",
187187
"keys.alt": "Alt",
188+
"keys.option": "Option",
188189
"keys.meta": "Cmd",
189190
"keys.delete": "Delete",
190191
"keys.space": "Space",

0 commit comments

Comments
 (0)