Skip to content

armgit / nota

Public Imported from GitHub
0

Nota — a free DAW for macOS, Windows and Linux. No subscription, no account — just open it and make music.

(fix) Menu shortcuts use Ctrl on Windows and Linux

Egor Khindikaynen63eec9f45c67
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 435468e8..760708da 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -28,6 +28,10 @@ Entry categories: `Added`, `Changed`, `Fixed`, `Removed`.
- **The Mixer shows your track names:** a track renamed to "Drums" used to read "Inst 2" in
its mixer strip. Strips now carry the same name as the Arrangement — or the instrument's
name, "Group" or "Return N" — and a group strip's I/O reads "Group in → Master".
+- **Menu shortcuts use Ctrl on Windows and Linux:** the menu bar showed File ▸ Save, Undo,
+ Record and the rest as Win+S, Win+Z…, and Ctrl+S, Ctrl+Z and most of the others did
+ nothing. They now read and work as Ctrl+S, Ctrl+Z, Ctrl+Shift+Z and so on, and Settings ▸ Shortcuts, the Session inspector
+ and the other on-screen hints spell keys as Ctrl / Alt / Shift instead of ⌘ ⌥ ⇧.
## [0.50.1] — 2026-10-07
diff --git a/src/managed/Nota.App/BrowserView.cs b/src/managed/Nota.App/BrowserView.cs
index c2c8291b..95255e65 100644
--- a/src/managed/Nota.App/BrowserView.cs
+++ b/src/managed/Nota.App/BrowserView.cs
@@ -615,7 +615,7 @@ public sealed class BrowserView : UserControl
2 => ("No MIDI effects yet", "Arpeggiator, chord, scale and more — they process notes before an instrument; drop one to the left of an instrument in a track."),
3 => ("No samples yet", "Add audio files to your Samples folder (Settings → Library) or install free packs from Settings → Downloads → Sample Packs, then browse them here as a folder tree. You can also drag files in from Finder."),
4 => ("No presets yet", "Right-click a device header and choose Save preset; it appears here grouped by category and device."),
- _ => ("No projects yet", "Save a project (⌘S) into your Projects folder (Settings → Library) and it shows up here."),
+ _ => ("No projects yet", MenuKit.Keys("Save a project (⌘S) into your Projects folder (Settings → Library) and it shows up here.")),
};
}
diff --git a/src/managed/Nota.App/MainWindow.Input.cs b/src/managed/Nota.App/MainWindow.Input.cs
index 729a3ef8..cd9e8a11 100644
--- a/src/managed/Nota.App/MainWindow.Input.cs
+++ b/src/managed/Nota.App/MainWindow.Input.cs
@@ -138,16 +138,16 @@ public partial class MainWindow
}
}
bool plainMod = mod && (e.KeyModifiers & (KeyModifiers.Alt | KeyModifiers.Shift)) == 0;
- if (plainMod && e.Key == Key.R && _heldKeys.Add(e.Key))
+ if (plainMod && e.Key == Key.R)
{
- _vm.Transport.RecordOn = !_vm.Transport.RecordOn;
- e.Handled = true;
+ if (_heldKeys.Add(e.Key)) _vm.Transport.RecordOn = !_vm.Transport.RecordOn;
+ e.Handled = true; // an auto-repeat is swallowed, not passed on to the menu
return;
}
- if (plainMod && e.Key == Key.M && _heldKeys.Add(e.Key))
+ if (plainMod && e.Key == Key.M)
{
- _vm.Transport.MetronomeOn = !_vm.Transport.MetronomeOn;
- e.Handled = true;
+ if (_heldKeys.Add(e.Key)) _vm.Transport.MetronomeOn = !_vm.Transport.MetronomeOn;
+ e.Handled = true; // an auto-repeat is swallowed, not passed on to the menu
return;
}
@@ -273,6 +273,13 @@ public partial class MainWindow
return;
}
+ // Nothing above took it: the menu's shortcuts (Ctrl+S, Ctrl+Z…) on Windows / Linux.
+ if (mod && TryMenuShortcut(e))
+ {
+ e.Handled = true;
+ return;
+ }
+
if (!mod && KeyToPitch.TryGetValue(e.Key, out int basePitch) && _heldKeys.Add(e.Key))
{
int pitch = Math.Clamp(basePitch + _typingOctave * 12, 0, 127);
diff --git a/src/managed/Nota.App/MainWindow.MenuKeys.cs b/src/managed/Nota.App/MainWindow.MenuKeys.cs
new file mode 100644
index 00000000..ea1781f7
--- /dev/null
+++ b/src/managed/Nota.App/MainWindow.MenuKeys.cs
@@ -0,0 +1,54 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.
+//
+// Menu shortcuts on Windows / Linux. MainWindow.axaml writes them as "Cmd+…", which is the
+// Meta (Win) key off macOS, and the in-window menu bar (NativeMenuBar) only draws a
+// NativeMenuItem's gesture — it doesn't bind it. So there the gestures are rewritten to Ctrl
+// and HandleKeyDown dispatches them itself once the focused view has passed on the key,
+// the way AppKit fires the menu's key equivalents on macOS.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Avalonia.Controls;
+using Avalonia.Input;
+
+namespace Nota.App;
+
+public partial class MainWindow
+{
+ private readonly List<NativeMenuItem> _menuShortcuts = new();
+
+ private void InitMenuShortcuts()
+ {
+ ToolTip.SetTip(AutomationToggle, MenuKit.Keys("Show parameter-automation lanes (⌘⇧A)"));
+ if (OperatingSystem.IsMacOS() || NativeMenu.GetMenu(this) is not { } menu) return;
+ Collect(menu);
+
+ void Collect(NativeMenu m)
+ {
+ foreach (var item in m.Items.OfType<NativeMenuItem>())
+ {
+ if (item.Gesture is { } g)
+ {
+ if ((g.KeyModifiers & KeyModifiers.Meta) != 0)
+ item.Gesture = new KeyGesture(g.Key, (g.KeyModifiers & ~KeyModifiers.Meta) | KeyModifiers.Control);
+ _menuShortcuts.Add(item);
+ }
+ if (item.Menu is { } sub) Collect(sub);
+ }
+ }
+ }
+
+ /// <summary>Runs the menu command whose gesture the key matches (Windows / Linux only).</summary>
+ private bool TryMenuShortcut(KeyEventArgs e)
+ {
+ foreach (var item in _menuShortcuts)
+ if (item.IsEnabled && item.Gesture!.Matches(e))
+ {
+ ((INativeMenuItemExporterEventsImplBridge)item).RaiseClicked();
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/src/managed/Nota.App/MainWindow.axaml b/src/managed/Nota.App/MainWindow.axaml
index 5d842524..61cbdfaa 100644
--- a/src/managed/Nota.App/MainWindow.axaml
+++ b/src/managed/Nota.App/MainWindow.axaml
@@ -279,8 +279,7 @@
</Viewbox>
</ToggleButton>
<!-- Automation: a breakpoint envelope — the ramp and handles the lanes draw -->
- <ToggleButton x:Name="AutomationToggle" Classes="tp-icon" Click="OnToggleAutomation"
- ToolTip.Tip="Show parameter-automation lanes (⌘⇧A)">
+ <ToggleButton x:Name="AutomationToggle" Classes="tp-icon" Click="OnToggleAutomation">
<Viewbox Width="15" Height="15">
<Canvas Width="24" Height="24">
<Path Stroke="{Binding $parent[ToggleButton].Foreground}" StrokeThickness="1.8"
diff --git a/src/managed/Nota.App/MainWindow.axaml.cs b/src/managed/Nota.App/MainWindow.axaml.cs
index 8453bc1c..9c8c3174 100644
--- a/src/managed/Nota.App/MainWindow.axaml.cs
+++ b/src/managed/Nota.App/MainWindow.axaml.cs
@@ -83,6 +83,7 @@ public partial class MainWindow : Window
public MainWindow()
{
InitializeComponent();
+ InitMenuShortcuts(); // Ctrl instead of Win on Windows / Linux, and bound there
UpdateWindowTitle(); // "Nota — Untitled" until a project is opened/saved
// Custom frameless title bar (Phase 2): extend the client area under the
// decorations on macOS/Windows (traffic lights / caption buttons overlay it).
diff --git a/src/managed/Nota.App/MenuKit.cs b/src/managed/Nota.App/MenuKit.cs
index 41f20737..8a9d207d 100644
--- a/src/managed/Nota.App/MenuKit.cs
+++ b/src/managed/Nota.App/MenuKit.cs
@@ -7,6 +7,8 @@
// list a gesture here when one of those actually performs the same command.
using System;
+using System.Collections.Generic;
+using System.Text;
using Avalonia.Controls;
using Avalonia.Input;
@@ -39,6 +41,41 @@ internal static class MenuKit
// Delete and Backspace both delete; show the key the platform calls "delete".
public static readonly KeyGesture DeleteKey = new(OperatingSystem.IsMacOS() ? Key.Back : Key.Delete);
+ /// <summary>Shortcut text written with the macOS glyphs ("⌘⇧Z", "⇧-click", "hold ⌘") as this
+ /// platform spells it: unchanged on macOS, "Ctrl+Shift+Z" / "Shift-click" / "hold Ctrl"
+ /// elsewhere.</summary>
+ public static string Keys(string text) => OperatingSystem.IsMacOS() ? text : SpellKeys(text);
+
+ internal static string SpellKeys(string text)
+ {
+ static bool IsMod(char c) => c is '⌘' or '⌃' or '⌥' or '⇧';
+ var sb = new StringBuilder(text.Length + 16);
+ for (int i = 0; i < text.Length;)
+ {
+ if (!IsMod(text[i]))
+ {
+ if (text[i] == '⌫') sb.Append("Del"); else sb.Append(text[i]);
+ i++;
+ continue;
+ }
+ bool ctrl = false, alt = false, shift = false;
+ for (; i < text.Length && IsMod(text[i]); i++)
+ {
+ ctrl |= text[i] is '⌘' or '⌃';
+ alt |= text[i] == '⌥';
+ shift |= text[i] == '⇧';
+ }
+ var names = new List<string>(3);
+ if (ctrl) names.Add("Ctrl");
+ if (alt) names.Add("Alt");
+ if (shift) names.Add("Shift");
+ sb.Append(string.Join("+", names));
+ // "⌘S" → "Ctrl+S", but "⌘ + wheel" / "⇧-click" keep their own joiner.
+ if (i < text.Length && !char.IsWhiteSpace(text[i]) && text[i] != '-') sb.Append('+');
+ }
+ return sb.ToString();
+ }
+
/// <summary>A menu icon. Its ink inherits the item's foreground, so it follows hover and
/// disabled like the label does.</summary>
public static Control Icon(GlyphKind kind) => new Glyph(kind, 11);
diff --git a/src/managed/Nota.App/ModularView.cs b/src/managed/Nota.App/ModularView.cs
index dea05d7d..9c1c6e4e 100644
--- a/src/managed/Nota.App/ModularView.cs
+++ b/src/managed/Nota.App/ModularView.cs
@@ -119,7 +119,7 @@ public sealed class ModularView : UserControl
// hint + minimap overlays (screen-space, not transformed)
var hint = new TextBlock
{
- Text = "Space + drag — pan · ⌘ + wheel — zoom · F — fit",
+ Text = MenuKit.Keys("Space + drag — pan · ⌘ + wheel — zoom · F — fit"),
FontSize = 9, Foreground = Text4,
HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Bottom,
Margin = new Thickness(14, 0, 0, 14),
diff --git a/src/managed/Nota.App/PreferencesWindow.cs b/src/managed/Nota.App/PreferencesWindow.cs
index e7def246..c15fab09 100644
--- a/src/managed/Nota.App/PreferencesWindow.cs
+++ b/src/managed/Nota.App/PreferencesWindow.cs
@@ -941,7 +941,8 @@ public sealed partial class PreferencesWindow : NotaWindow
// NB: this list mirrors the real key handlers — keep the two in sync (see the
// `nota-shortcuts` skill). Bindings live in MainWindow.Input.cs (transport, global
// editing, computer-keyboard notes), PianoRollView.cs (note editing) and PreviewPlayer.cs
- // (the Files tab's sample player). ⌘ = Meta on macOS / Ctrl on Windows. A Key made only of
+ // (the Files tab's sample player). Written with the macOS glyphs; MenuKit.Keys spells them
+ // Ctrl / Alt / Shift on Windows and Linux. A Key made only of
// keys (see IsKeyToken) is drawn as one key-cap per token; a gesture is plain text.
private static readonly (string Title, (string Key, string Action)[] Rows)[] ShortcutGroups =
{
@@ -1081,8 +1082,8 @@ public sealed partial class PreferencesWindow : NotaWindow
foreach (var (title, rows) in ShortcutGroups)
{
var shown = rows.Where(r => q.Length == 0
- || r.Action.Contains(q, StringComparison.OrdinalIgnoreCase)
- || r.Key.Contains(q, StringComparison.OrdinalIgnoreCase)).ToList();
+ || MenuKit.Keys(r.Action).Contains(q, StringComparison.OrdinalIgnoreCase)
+ || MenuKit.Keys(r.Key).Contains(q, StringComparison.OrdinalIgnoreCase)).ToList();
if (shown.Count == 0) continue;
var head = new StackPanel
{
@@ -1118,17 +1119,17 @@ public sealed partial class PreferencesWindow : NotaWindow
foreach (var t in tokens)
wrap.Children.Add(t is "/" or "·"
? new TextBlock { Text = t, FontSize = 11, Foreground = TextTertiary, Margin = new Thickness(0, 0, 4, 0), VerticalAlignment = VerticalAlignment.Center }
- : KeyCap(t));
+ : KeyCap(MenuKit.Keys(t)));
keys = wrap;
}
else
{
- keys = new TextBlock { Text = key, FontSize = 12, Foreground = TextPrimary, TextWrapping = TextWrapping.Wrap, VerticalAlignment = VerticalAlignment.Center };
+ keys = new TextBlock { Text = MenuKit.Keys(key), FontSize = 12, Foreground = TextPrimary, TextWrapping = TextWrapping.Wrap, VerticalAlignment = VerticalAlignment.Center };
}
var grid = new Grid { ColumnDefinitions = new ColumnDefinitions($"{LabelCol},*"), ColumnSpacing = 12, MinHeight = 20, Margin = new Thickness(12, 7) }; // 34 with the margin
grid.Children.Add(keys);
- var a = new TextBlock { Text = action, FontSize = 12, LineHeight = 17, Foreground = TextSecondary, VerticalAlignment = VerticalAlignment.Center, TextWrapping = TextWrapping.Wrap };
+ var a = new TextBlock { Text = MenuKit.Keys(action), FontSize = 12, LineHeight = 17, Foreground = TextSecondary, VerticalAlignment = VerticalAlignment.Center, TextWrapping = TextWrapping.Wrap };
Grid.SetColumn(a, 1);
grid.Children.Add(a);
return grid;
diff --git a/src/managed/Nota.App/SessionView.Inspector.cs b/src/managed/Nota.App/SessionView.Inspector.cs
index 90f9f1ff..b321162e 100644
--- a/src/managed/Nota.App/SessionView.Inspector.cs
+++ b/src/managed/Nota.App/SessionView.Inspector.cs
@@ -54,7 +54,7 @@ public sealed partial class SessionView
var hint = new TextBlock
{
- Text = "Click selects · the triangle launches · Enter launches the selection\n←↑↓→ move · ⌘C ⌘V ⌘D · ⌫ delete · ⌘I insert scene\n⌘⇧C copy to arrangement · ⌘V pastes clips copied there",
+ Text = MenuKit.Keys("Click selects · the triangle launches · Enter launches the selection\n←↑↓→ move · ⌘C ⌘V ⌘D · ⌫ delete · ⌘I insert scene\n⌘⇧C copy to arrangement · ⌘V pastes clips copied there"),
FontSize = 9, LineHeight = 15, Foreground = NotaPalette.TextDisabled, TextWrapping = TextWrapping.Wrap, Margin = new Thickness(16),
};
hint.BindResource(TextBlock.FontFamilyProperty, "Font.Mono");
@@ -171,7 +171,7 @@ public sealed partial class SessionView
foreach (var (label, key, click) in actions)
{
var content = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 8, Children = { new TextBlock { Text = label, FontSize = 11, FontWeight = FontWeight.Medium } } };
- if (key.Length > 0) content.Children.Add(Mono(key, 9, NotaPalette.TextDisabled));
+ if (key.Length > 0) content.Children.Add(Mono(MenuKit.Keys(key), 9, NotaPalette.TextDisabled));
var b = new Button { Height = NotaSize.Shell, Padding = new Thickness(10, 0), Margin = new Thickness(0, 0, 6, 6), Content = content };
b.Click += (_, _) => click();
wrap.Children.Add(b);