Skip to content

Commit 61325e3

Browse files
authored
Merge pull request #433 from Open-Less/feat/wayland-callout-three-commands
feat(wayland): callout 补全 --toggle-qa / --cancel-dictation
2 parents 38f202a + 15c2ce5 commit 61325e3

6 files changed

Lines changed: 132 additions & 74 deletions

File tree

openless-all/app/src/i18n/en.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -354,18 +354,21 @@ export const en: typeof zhCN = {
354354
startupAtBootError: 'Failed to toggle launch at login: {{message}}',
355355
wayland: {
356356
calloutTitle: 'Wayland desktop detected',
357-
calloutBody: 'Wayland forbids apps from listening for global shortcuts. Please bind the following command to a custom shortcut in your system settings:',
357+
calloutBody: 'Wayland forbids apps from listening for global shortcuts. Please create a custom shortcut for each command below in your system settings (QA and cancel commands are optional):',
358358
copyButton: 'Copy',
359359
copyButtonCopied: 'Copied',
360+
commandToggleDictationLabel: 'Start / stop dictation',
361+
commandToggleQaLabel: 'Open / close QA panel',
362+
commandCancelDictationLabel: 'Cancel current dictation',
360363
helpToggle: 'Setup steps for each desktop environment',
361364
gnomeTitle: 'GNOME',
362-
gnomeSteps: 'Settings → Keyboard → View and Customize Shortcuts → Custom Shortcuts → Add Shortcut. Paste the command above and record the key combination you want.',
365+
gnomeSteps: 'Settings → Keyboard → View and Customize Shortcuts → Custom Shortcuts → Add Shortcut. Repeat 1–3 times, pasting each command above and recording the key combination you want.',
363366
kdeTitle: 'KDE Plasma',
364-
kdeSteps: 'System Settings → Keyboard → Shortcuts → Add New → Command/URL. Record any trigger keys you like, paste the command above, then Apply.',
367+
kdeSteps: 'System Settings → Keyboard → Shortcuts → Add New → Command/URL. Repeat for each command above, recording different trigger keys, then Apply.',
365368
hyprlandTitle: 'Hyprland',
366-
hyprlandSteps: 'Edit ~/.config/hypr/hyprland.conf, add bind = SUPER, Y, exec, openless --toggle-dictation, then run hyprctl reload.',
369+
hyprlandSteps: 'Edit ~/.config/hypr/hyprland.conf, add any 1–3 of the lines below, then run hyprctl reload:\nbind = SUPER, Y, exec, openless --toggle-dictation\nbind = SUPER, U, exec, openless --toggle-qa\nbind = SUPER, I, exec, openless --cancel-dictation',
367370
swayTitle: 'sway',
368-
swaySteps: 'Edit ~/.config/sway/config, add bindsym $mod+y exec openless --toggle-dictation, then run swaymsg reload.',
371+
swaySteps: 'Edit ~/.config/sway/config, add any 1–3 of the lines below, then run swaymsg reload:\nbindsym $mod+y exec openless --toggle-dictation\nbindsym $mod+u exec openless --toggle-qa\nbindsym $mod+i exec openless --cancel-dictation',
369372
},
370373
},
371374
providers: {

openless-all/app/src/i18n/ja.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -356,18 +356,21 @@ export const ja: typeof zhCN = {
356356
startupAtBootError: '自動起動の切り替えに失敗:{{message}}',
357357
wayland: {
358358
calloutTitle: 'Wayland デスクトップを検出',
359-
calloutBody: 'Wayland はセキュリティ上、アプリのグローバルショートカット監視を許可していません。システム設定でカスタムショートカットを作成し、以下のコマンドにバインドしてください:',
359+
calloutBody: 'Wayland はセキュリティ上、アプリのグローバルショートカット監視を許可していません。システム設定で以下の各コマンド用にカスタムショートカットを作成してください(QA と録音キャンセルは任意):',
360360
copyButton: 'コピー',
361361
copyButtonCopied: 'コピー済み',
362+
commandToggleDictationLabel: '録音の開始 / 停止',
363+
commandToggleQaLabel: 'QA パネルの表示 / 非表示',
364+
commandCancelDictationLabel: '現在の録音をキャンセル',
362365
helpToggle: '各デスクトップ環境の設定手順',
363366
gnomeTitle: 'GNOME',
364-
gnomeSteps: '設定 → キーボード → ショートカットの表示とカスタマイズ → カスタムショートカット → 追加。コマンド欄に上記コマンドを貼り付け、希望のキー組み合わせを入力。',
367+
gnomeSteps: '設定 → キーボード → ショートカットの表示とカスタマイズ → カスタムショートカット → 追加。1〜3 回繰り返し、コマンド欄に上記の各コマンドを貼り付け、希望のキー組み合わせを入力。',
365368
kdeTitle: 'KDE Plasma',
366-
kdeSteps: 'システム設定 → キーボード → ショートカット → 新規追加 → コマンド/URL。任意のトリガーキーを記録し、アクションに上記コマンドを貼り付けて保存。',
369+
kdeSteps: 'システム設定 → キーボード → ショートカット → 新規追加 → コマンド/URL。上記の各コマンドに対してトリガーキーを別々に記録し、保存。',
367370
hyprlandTitle: 'Hyprland',
368-
hyprlandSteps: '~/.config/hypr/hyprland.conf に bind = SUPER, Y, exec, openless --toggle-dictation を追加し、hyprctl reload を実行。',
371+
hyprlandSteps: '~/.config/hypr/hyprland.conf に以下から 1〜3 行を追加し、hyprctl reload を実行:\nbind = SUPER, Y, exec, openless --toggle-dictation\nbind = SUPER, U, exec, openless --toggle-qa\nbind = SUPER, I, exec, openless --cancel-dictation',
369372
swayTitle: 'sway',
370-
swaySteps: '~/.config/sway/config に bindsym $mod+y exec openless --toggle-dictation を追加し、swaymsg reload を実行。',
373+
swaySteps: '~/.config/sway/config に以下から 1〜3 行を追加し、swaymsg reload を実行:\nbindsym $mod+y exec openless --toggle-dictation\nbindsym $mod+u exec openless --toggle-qa\nbindsym $mod+i exec openless --cancel-dictation',
371374
},
372375
},
373376
providers: {

openless-all/app/src/i18n/ko.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -356,18 +356,21 @@ export const ko: typeof zhCN = {
356356
startupAtBootError: '자동 시작 전환 실패: {{message}}',
357357
wayland: {
358358
calloutTitle: 'Wayland 데스크톱 환경 감지됨',
359-
calloutBody: 'Wayland는 보안상 앱의 전역 단축키 감지를 허용하지 않습니다. 시스템 설정에서 사용자 지정 단축키를 만들고 다음 명령에 바인딩하세요:',
359+
calloutBody: 'Wayland는 보안상 앱의 전역 단축키 감지를 허용하지 않습니다. 시스템 설정에서 아래 각 명령에 대해 사용자 지정 단축키를 만드세요 (QA와 취소 명령은 선택 사항):',
360360
copyButton: '복사',
361361
copyButtonCopied: '복사됨',
362+
commandToggleDictationLabel: '녹음 시작 / 중지',
363+
commandToggleQaLabel: 'QA 패널 열기 / 닫기',
364+
commandCancelDictationLabel: '현재 녹음 취소',
362365
helpToggle: '각 데스크톱 환경별 설정 단계',
363366
gnomeTitle: 'GNOME',
364-
gnomeSteps: '설정 → 키보드 → 단축키 보기 및 사용자 지정 → 사용자 지정 단축키 → 추가. 명령 칸에 위 명령을 붙여넣고 원하는 키 조합을 기록.',
367+
gnomeSteps: '설정 → 키보드 → 단축키 보기 및 사용자 지정 → 사용자 지정 단축키 → 추가. 1-3회 반복하여 명령 칸에 위 명령을 붙여넣고 원하는 키 조합을 기록.',
365368
kdeTitle: 'KDE Plasma',
366-
kdeSteps: '시스템 설정 → 키보드 → 단축키 → 새로 추가 → 명령/URL. 트리거 키를 기록하고 작업란에 위 명령을 붙여넣은 후 저장.',
369+
kdeSteps: '시스템 설정 → 키보드 → 단축키 → 새로 추가 → 명령/URL. 위 각 명령에 대해 다른 트리거 키를 기록하고 저장.',
367370
hyprlandTitle: 'Hyprland',
368-
hyprlandSteps: '~/.config/hypr/hyprland.conf 파일에 bind = SUPER, Y, exec, openless --toggle-dictation 을 추가하고 hyprctl reload 실행.',
371+
hyprlandSteps: '~/.config/hypr/hyprland.conf 파일에 아래 1-3 줄을 추가하고 hyprctl reload 실행:\nbind = SUPER, Y, exec, openless --toggle-dictation\nbind = SUPER, U, exec, openless --toggle-qa\nbind = SUPER, I, exec, openless --cancel-dictation',
369372
swayTitle: 'sway',
370-
swaySteps: '~/.config/sway/config 파일에 bindsym $mod+y exec openless --toggle-dictation 을 추가하고 swaymsg reload 실행.',
373+
swaySteps: '~/.config/sway/config 파일에 아래 1-3 줄을 추가하고 swaymsg reload 실행:\nbindsym $mod+y exec openless --toggle-dictation\nbindsym $mod+u exec openless --toggle-qa\nbindsym $mod+i exec openless --cancel-dictation',
371374
},
372375
},
373376
providers: {

openless-all/app/src/i18n/zh-CN.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -352,18 +352,21 @@ export const zhCN = {
352352
startupAtBootError: '开机自启切换失败:{{message}}',
353353
wayland: {
354354
calloutTitle: '检测到 Wayland 桌面环境',
355-
calloutBody: 'Wayland 出于安全考虑不允许应用监听全局快捷键。请在系统设置中创建一个自定义快捷键,绑定下面这条命令:',
355+
calloutBody: 'Wayland 出于安全考虑不允许应用监听全局快捷键。请在系统设置中为下面的命令分别创建自定义快捷键(QA 与取消录音命令可选):',
356356
copyButton: '复制',
357357
copyButtonCopied: '已复制',
358+
commandToggleDictationLabel: '开始 / 停止录音',
359+
commandToggleQaLabel: '打开 / 关闭 QA 面板',
360+
commandCancelDictationLabel: '取消当前录音',
358361
helpToggle: '查看各桌面环境配置步骤',
359362
gnomeTitle: 'GNOME',
360-
gnomeSteps: '设置 → 键盘 → 查看和自定义快捷键 → 自定义快捷键 → 添加快捷键,命令处填入上方命令,再录入想用的按键组合。',
363+
gnomeSteps: '设置 → 键盘 → 查看和自定义快捷键 → 自定义快捷键 → 添加快捷键。重复添加 1-3 组,命令处分别填入上方命令,再录入想用的按键组合。',
361364
kdeTitle: 'KDE Plasma',
362-
kdeSteps: '系统设置 → 键盘 → 快捷键 → 添加新的 → 命令/URL,触发按键随意录入,动作处粘贴上方命令并保存。',
365+
kdeSteps: '系统设置 → 键盘 → 快捷键 → 添加新的 → 命令/URL,动作处分别粘贴上方命令并录入不同触发键,保存即可。',
363366
hyprlandTitle: 'Hyprland',
364-
hyprlandSteps: '编辑 ~/.config/hypr/hyprland.conf,加入 bind = SUPER, Y, exec, openless --toggle-dictation,然后执行 hyprctl reload。',
367+
hyprlandSteps: '编辑 ~/.config/hypr/hyprland.conf,加入下面任意 1-3 行后执行 hyprctl reload:\nbind = SUPER, Y, exec, openless --toggle-dictation\nbind = SUPER, U, exec, openless --toggle-qa\nbind = SUPER, I, exec, openless --cancel-dictation',
365368
swayTitle: 'sway',
366-
swaySteps: '编辑 ~/.config/sway/config,加入 bindsym $mod+y exec openless --toggle-dictation,然后执行 swaymsg reload。',
369+
swaySteps: '编辑 ~/.config/sway/config,加入下面任意 1-3 行后执行 swaymsg reload:\nbindsym $mod+y exec openless --toggle-dictation\nbindsym $mod+u exec openless --toggle-qa\nbindsym $mod+i exec openless --cancel-dictation',
367370
},
368371
},
369372
providers: {

openless-all/app/src/i18n/zh-TW.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -354,18 +354,21 @@ export const zhTW: typeof zhCN = {
354354
startupAtBootError: '開機自啓切換失敗:{{message}}',
355355
wayland: {
356356
calloutTitle: '偵測到 Wayland 桌面環境',
357-
calloutBody: 'Wayland 出於安全考慮不允許應用監聽全域快速鍵。請在系統設定中建立一個自訂快速鍵,繫結下面這條命令:',
357+
calloutBody: 'Wayland 出於安全考慮不允許應用監聽全域快速鍵。請在系統設定中為下面的命令分別建立自訂快速鍵(QA 與取消錄音命令可選):',
358358
copyButton: '複製',
359359
copyButtonCopied: '已複製',
360+
commandToggleDictationLabel: '開始 / 停止錄音',
361+
commandToggleQaLabel: '開啟 / 關閉 QA 面板',
362+
commandCancelDictationLabel: '取消目前錄音',
360363
helpToggle: '查看各桌面環境設定步驟',
361364
gnomeTitle: 'GNOME',
362-
gnomeSteps: '設定 → 鍵盤 → 檢視並自訂快速鍵 → 自訂快速鍵 → 新增快速鍵,命令處填入上方命令,再錄入想用的按鍵組合。',
365+
gnomeSteps: '設定 → 鍵盤 → 檢視並自訂快速鍵 → 自訂快速鍵 → 新增快速鍵。重複新增 1-3 組,命令處分別填入上方命令,再錄入想用的按鍵組合。',
363366
kdeTitle: 'KDE Plasma',
364-
kdeSteps: '系統設定 → 鍵盤 → 快速鍵 → 新增 → 命令/URL,觸發按鍵隨意錄入,動作處貼上上方命令並儲存。',
367+
kdeSteps: '系統設定 → 鍵盤 → 快速鍵 → 新增 → 命令/URL,動作處分別貼上上方命令並錄入不同觸發鍵,儲存即可。',
365368
hyprlandTitle: 'Hyprland',
366-
hyprlandSteps: '編輯 ~/.config/hypr/hyprland.conf,加入 bind = SUPER, Y, exec, openless --toggle-dictation,然後執行 hyprctl reload。',
369+
hyprlandSteps: '編輯 ~/.config/hypr/hyprland.conf,加入下面任意 1-3 行後執行 hyprctl reload:\nbind = SUPER, Y, exec, openless --toggle-dictation\nbind = SUPER, U, exec, openless --toggle-qa\nbind = SUPER, I, exec, openless --cancel-dictation',
367370
swayTitle: 'sway',
368-
swaySteps: '編輯 ~/.config/sway/config,加入 bindsym $mod+y exec openless --toggle-dictation,然後執行 swaymsg reload。',
371+
swaySteps: '編輯 ~/.config/sway/config,加入下面任意 1-3 行後執行 swaymsg reload:\nbindsym $mod+y exec openless --toggle-dictation\nbindsym $mod+u exec openless --toggle-qa\nbindsym $mod+i exec openless --cancel-dictation',
369372
},
370373
},
371374
providers: {

openless-all/app/src/pages/Settings.tsx

Lines changed: 92 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -556,20 +556,31 @@ function RecordingSection() {
556556
function WaylandHotkeyCallout() {
557557
const { t } = useTranslation();
558558
const [helpOpen, setHelpOpen] = useState(false);
559-
const [copied, setCopied] = useState(false);
560-
const command = 'openless --toggle-dictation';
559+
// 三条命令各自独立的"已复制"反馈。用 string 而非 boolean 数组,
560+
// 避免 stale state(重复点击不同按钮时旧 timer 把别人擦掉)。
561+
const [copiedCommand, setCopiedCommand] = useState<string | null>(null);
561562

562-
const onCopy = useCallback(async () => {
563+
const onCopy = useCallback(async (command: string) => {
563564
try {
564565
await navigator.clipboard.writeText(command);
565-
setCopied(true);
566-
// 1.5s 后还原按钮文案。用户可重复点击;状态机简单到不必上 useRef cleanup。
567-
setTimeout(() => setCopied(false), 1500);
566+
setCopiedCommand(command);
567+
// 1.5s 后还原按钮文案;同时校验仍是这条命令,避免被后点的覆盖。
568+
setTimeout(() => {
569+
setCopiedCommand(prev => (prev === command ? null : prev));
570+
}, 1500);
568571
} catch (err) {
569572
console.warn('[wayland-callout] clipboard write failed', err);
570573
}
571574
}, []);
572575

576+
// 三条 CLI 命令 + 用途短标签。aeoform 在 #420 反馈 1.3.1-19 没提
577+
// --toggle-qa / --cancel-dictation,本次补全。
578+
const commandRows: Array<readonly [string, string]> = [
579+
['openless --toggle-dictation', t('settings.recording.wayland.commandToggleDictationLabel')],
580+
['openless --toggle-qa', t('settings.recording.wayland.commandToggleQaLabel')],
581+
['openless --cancel-dictation', t('settings.recording.wayland.commandCancelDictationLabel')],
582+
];
583+
573584
const helpEntries: Array<readonly [string, string]> = [
574585
[t('settings.recording.wayland.gnomeTitle'), t('settings.recording.wayland.gnomeSteps')],
575586
[t('settings.recording.wayland.kdeTitle'), t('settings.recording.wayland.kdeSteps')],
@@ -594,48 +605,73 @@ function WaylandHotkeyCallout() {
594605
<div style={{ fontSize: 11.5, color: 'var(--ol-ink-3)', lineHeight: 1.55, marginBottom: 8 }}>
595606
{t('settings.recording.wayland.calloutBody')}
596607
</div>
597-
<div
598-
style={{
599-
display: 'flex',
600-
alignItems: 'center',
601-
gap: 8,
602-
padding: '8px 10px',
603-
borderRadius: 8,
604-
background: 'rgba(255,255,255,0.7)',
605-
border: '0.5px solid rgba(0,0,0,0.08)',
606-
marginBottom: 8,
607-
}}
608-
>
609-
<code
610-
style={{
611-
flex: 1,
612-
fontSize: 12,
613-
fontFamily: 'ui-monospace, SF Mono, Menlo, Consolas, monospace',
614-
color: 'var(--ol-ink)',
615-
userSelect: 'all',
616-
}}
617-
>
618-
{command}
619-
</code>
620-
<button
621-
type="button"
622-
onClick={onCopy}
623-
style={{
624-
padding: '4px 10px',
625-
fontSize: 11,
626-
fontWeight: 500,
627-
border: '0.5px solid rgba(0,0,0,0.12)',
628-
borderRadius: 6,
629-
background: '#fff',
630-
color: 'var(--ol-ink-2)',
631-
cursor: 'pointer',
632-
fontFamily: 'inherit',
633-
}}
634-
>
635-
{copied
636-
? t('settings.recording.wayland.copyButtonCopied')
637-
: t('settings.recording.wayland.copyButton')}
638-
</button>
608+
<div style={{ display: 'flex', flexDirection: 'column', gap: 6, marginBottom: 8 }}>
609+
{commandRows.map(([command, label]) => (
610+
<div
611+
key={command}
612+
style={{ display: 'flex', alignItems: 'center', gap: 10 }}
613+
>
614+
<div
615+
style={{
616+
display: 'flex',
617+
alignItems: 'center',
618+
gap: 8,
619+
padding: '8px 10px',
620+
borderRadius: 8,
621+
background: 'rgba(255,255,255,0.7)',
622+
border: '0.5px solid rgba(0,0,0,0.08)',
623+
flex: 1,
624+
minWidth: 0,
625+
}}
626+
>
627+
<code
628+
style={{
629+
flex: 1,
630+
minWidth: 0,
631+
fontSize: 12,
632+
fontFamily: 'ui-monospace, SF Mono, Menlo, Consolas, monospace',
633+
color: 'var(--ol-ink)',
634+
userSelect: 'all',
635+
overflow: 'hidden',
636+
textOverflow: 'ellipsis',
637+
whiteSpace: 'nowrap',
638+
}}
639+
>
640+
{command}
641+
</code>
642+
<button
643+
type="button"
644+
onClick={() => onCopy(command)}
645+
style={{
646+
padding: '4px 10px',
647+
fontSize: 11,
648+
fontWeight: 500,
649+
border: '0.5px solid rgba(0,0,0,0.12)',
650+
borderRadius: 6,
651+
background: '#fff',
652+
color: 'var(--ol-ink-2)',
653+
cursor: 'pointer',
654+
fontFamily: 'inherit',
655+
flexShrink: 0,
656+
}}
657+
>
658+
{copiedCommand === command
659+
? t('settings.recording.wayland.copyButtonCopied')
660+
: t('settings.recording.wayland.copyButton')}
661+
</button>
662+
</div>
663+
<span
664+
style={{
665+
fontSize: 11,
666+
color: 'var(--ol-ink-3)',
667+
whiteSpace: 'nowrap',
668+
flexShrink: 0,
669+
}}
670+
>
671+
{label}
672+
</span>
673+
</div>
674+
))}
639675
</div>
640676
<button
641677
type="button"
@@ -661,7 +697,14 @@ function WaylandHotkeyCallout() {
661697
<div style={{ fontSize: 11.5, fontWeight: 600, color: 'var(--ol-ink-2)', marginBottom: 2 }}>
662698
{title}
663699
</div>
664-
<div style={{ fontSize: 11, color: 'var(--ol-ink-3)', lineHeight: 1.55 }}>
700+
<div
701+
style={{
702+
fontSize: 11,
703+
color: 'var(--ol-ink-3)',
704+
lineHeight: 1.55,
705+
whiteSpace: 'pre-line',
706+
}}
707+
>
665708
{body}
666709
</div>
667710
</div>

0 commit comments

Comments
 (0)