mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-31 08:21:59 +02:00
Add keyboard shortcuts window
This commit is contained in:
@@ -1,10 +1,13 @@
|
|||||||
|
const { Gtk } = imports.gi;
|
||||||
const Dialogs = imports.src.dialogs;
|
const Dialogs = imports.src.dialogs;
|
||||||
|
const Misc = imports.src.misc;
|
||||||
|
|
||||||
var actions = {
|
var actions = {
|
||||||
open_local: ['<Ctrl>O'],
|
open_local: ['<Ctrl>O'],
|
||||||
export_playlist: ['<Ctrl>E'],
|
export_playlist: ['<Ctrl>E'],
|
||||||
open_uri: ['<Ctrl>U'],
|
open_uri: ['<Ctrl>U'],
|
||||||
prefs: null,
|
prefs: null,
|
||||||
|
shortcuts: ['F1', '<Ctrl>question'],
|
||||||
about: null,
|
about: null,
|
||||||
progress_forward: ['Right'],
|
progress_forward: ['Right'],
|
||||||
progress_backward: ['Left'],
|
progress_backward: ['Left'],
|
||||||
@@ -40,6 +43,16 @@ function handleAction(action, window)
|
|||||||
case 'prefs':
|
case 'prefs':
|
||||||
new Dialogs.PrefsDialog(window);
|
new Dialogs.PrefsDialog(window);
|
||||||
break;
|
break;
|
||||||
|
case 'shortcuts':
|
||||||
|
if(!window.get_help_overlay()) {
|
||||||
|
const clapperPath = Misc.getClapperPath();
|
||||||
|
const helpBuilder = Gtk.Builder.new_from_file(
|
||||||
|
`${clapperPath}/ui/help-overlay.ui`
|
||||||
|
);
|
||||||
|
window.set_help_overlay(helpBuilder.get_object('help_overlay'));
|
||||||
|
}
|
||||||
|
clapperWidget.activate_action('win.show-help-overlay', null);
|
||||||
|
break;
|
||||||
case 'about':
|
case 'about':
|
||||||
new Dialogs.AboutDialog(window);
|
new Dialogs.AboutDialog(window);
|
||||||
break;
|
break;
|
||||||
|
@@ -16,14 +16,12 @@
|
|||||||
<attribute name="label" translatable="yes">Preferences</attribute>
|
<attribute name="label" translatable="yes">Preferences</attribute>
|
||||||
<attribute name="action">app.prefs</attribute>
|
<attribute name="action">app.prefs</attribute>
|
||||||
</item>
|
</item>
|
||||||
</section>
|
|
||||||
<section>
|
|
||||||
<!--
|
|
||||||
<item>
|
<item>
|
||||||
<attribute name="label" translatable="yes">Keyboard Shortcuts</attribute>
|
<attribute name="label" translatable="yes">Shortcuts</attribute>
|
||||||
<attribute name="action">app.shortcuts</attribute>
|
<attribute name="action">app.shortcuts</attribute>
|
||||||
</item>
|
</item>
|
||||||
-->
|
</section>
|
||||||
|
<section>
|
||||||
<item>
|
<item>
|
||||||
<attribute name="label" translatable="yes">About Clapper</attribute>
|
<attribute name="label" translatable="yes">About Clapper</attribute>
|
||||||
<attribute name="action">app.about</attribute>
|
<attribute name="action">app.about</attribute>
|
||||||
|
133
ui/help-overlay.ui
Normal file
133
ui/help-overlay.ui
Normal file
@@ -0,0 +1,133 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<interface>
|
||||||
|
<object class="GtkShortcutsWindow" id="help_overlay">
|
||||||
|
<property name="modal">True</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkShortcutsSection">
|
||||||
|
<property name="section-name">app</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkShortcutsGroup">
|
||||||
|
<property name="title" translatable="yes">General</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkShortcutsShortcut">
|
||||||
|
<property name="title" translatable="yes">Show shortcuts</property>
|
||||||
|
<property name="accelerator">F1 <Ctrl>question</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkShortcutsShortcut">
|
||||||
|
<property name="title" translatable="yes">Toggle fullscreen</property>
|
||||||
|
<property name="accelerator">F11 f</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkShortcutsShortcut">
|
||||||
|
<property name="title" translatable="yes">Reveal controls (fullscreen only)</property>
|
||||||
|
<property name="accelerator">Return</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkShortcutsShortcut">
|
||||||
|
<property name="title" translatable="yes">Quit</property>
|
||||||
|
<property name="accelerator"><Ctrl>Q Q</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkShortcutsGroup">
|
||||||
|
<property name="title" translatable="yes">Media</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkShortcutsShortcut">
|
||||||
|
<property name="title" translatable="yes">Open Local</property>
|
||||||
|
<property name="accelerator"><Ctrl>O</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkShortcutsShortcut">
|
||||||
|
<property name="title" translatable="yes">Open URI</property>
|
||||||
|
<property name="accelerator"><Ctrl>U</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkShortcutsGroup">
|
||||||
|
<property name="title" translatable="yes">Playlist</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkShortcutsShortcut">
|
||||||
|
<property name="title" translatable="yes">Next item</property>
|
||||||
|
<property name="accelerator"><Ctrl>Right</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkShortcutsShortcut">
|
||||||
|
<property name="title" translatable="yes">Previous item</property>
|
||||||
|
<property name="accelerator"><Ctrl>Left</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkShortcutsShortcut">
|
||||||
|
<property name="title" translatable="yes">Change repeat mode</property>
|
||||||
|
<property name="accelerator"><Ctrl>R</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkShortcutsShortcut">
|
||||||
|
<property name="title" translatable="yes">Export to file</property>
|
||||||
|
<property name="accelerator"><Ctrl>E</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkShortcutsGroup">
|
||||||
|
<property name="title" translatable="yes">Playback</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkShortcutsShortcut">
|
||||||
|
<property name="title" translatable="yes">Toggle play</property>
|
||||||
|
<property name="accelerator">space</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkShortcutsShortcut">
|
||||||
|
<property name="title" translatable="yes">Volume up</property>
|
||||||
|
<property name="accelerator">Up</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkShortcutsShortcut">
|
||||||
|
<property name="title" translatable="yes">Volume down</property>
|
||||||
|
<property name="accelerator">Down</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkShortcutsShortcut">
|
||||||
|
<property name="title" translatable="yes">Seek forward</property>
|
||||||
|
<property name="accelerator">Right</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkShortcutsShortcut">
|
||||||
|
<property name="title" translatable="yes">Seek backward</property>
|
||||||
|
<property name="accelerator">Left</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkShortcutsShortcut">
|
||||||
|
<property name="title" translatable="yes">Next chapter</property>
|
||||||
|
<property name="accelerator"><Shift>Right</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkShortcutsShortcut">
|
||||||
|
<property name="title" translatable="yes">Previous chapter</property>
|
||||||
|
<property name="accelerator"><Shift>Left</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</interface>
|
Reference in New Issue
Block a user