reworked keybindings

This commit is contained in:
Martin Wagner 2022-10-19 11:38:52 +02:00
parent 220cc772b5
commit e46ec34ed5
2 changed files with 77 additions and 67 deletions

View File

@ -51,20 +51,6 @@
<object class="GtkShortcutsGroup">
<property name="visible">True</property>
<property name="title" translatable="yes">Window</property>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">True</property>
<property name="title" translatable="yes">Cycle through profiles</property>
<property name="accelerator">&lt;Control&gt;p</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">True</property>
<property name="title" translatable="yes">Cycle through profiles in reversed order</property>
<property name="accelerator">&lt;Shift&gt;&lt;Control&gt;p</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">True</property>
@ -124,35 +110,35 @@
<object class="GtkShortcutsShortcut">
<property name="visible">True</property>
<property name="title" translatable="yes">Stop after current title</property>
<property name="accelerator">&lt;Control&gt;space</property>
<property name="accelerator">&lt;Shift&gt;&lt;Control&gt;s</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">True</property>
<property name="title" translatable="yes">Next title</property>
<property name="accelerator">KP_Add</property>
<property name="accelerator">&lt;Alt&gt;Down</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">True</property>
<property name="title" translatable="yes">Previous title</property>
<property name="accelerator">KP_Subtract</property>
<property name="accelerator">&lt;Alt&gt;Up</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">True</property>
<property name="title" translatable="yes">Seek forward</property>
<property name="accelerator">KP_Multiply</property>
<property name="accelerator">&lt;Alt&gt;Right</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">True</property>
<property name="title" translatable="yes">Seek backward</property>
<property name="accelerator">KP_Divide</property>
<property name="accelerator">&lt;Alt&gt;Left</property>
</object>
</child>
<child>
@ -166,14 +152,14 @@
<object class="GtkShortcutsShortcut">
<property name="visible">True</property>
<property name="title" translatable="yes">Toggle random mode</property>
<property name="accelerator">&lt;Control&gt;s</property>
<property name="accelerator">&lt;Control&gt;n</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">True</property>
<property name="title" translatable="yes">Toggle single mode</property>
<property name="accelerator">&lt;Control&gt;1</property>
<property name="accelerator">&lt;Control&gt;s</property>
</object>
</child>
<child>
@ -185,6 +171,62 @@
</child>
</object>
</child>
<child>
<object class="GtkShortcutsGroup">
<property name="visible">True</property>
<property name="title" translatable="yes">Playlist</property>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">True</property>
<property name="title" translatable="yes">Remove selected song</property>
<property name="subtitle" translatable="yes">Middle-click</property>
<property name="accelerator">Delete</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">True</property>
<property name="title" translatable="yes">Clear playlist</property>
<property name="accelerator">&lt;Shift&gt;Delete</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">True</property>
<property name="title" translatable="yes">Show additional information</property>
<property name="subtitle" translatable="yes">Right-click</property>
<property name="accelerator">&lt;Control&gt;i Menu</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkShortcutsGroup">
<property name="visible">True</property>
<property name="title" translatable="yes">Profiles</property>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">True</property>
<property name="title" translatable="yes">Profile 1</property>
<property name="accelerator">&lt;Control&gt;1</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">True</property>
<property name="title" translatable="yes">Profile 2</property>
<property name="accelerator">&lt;Control&gt;2</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">True</property>
<property name="title" translatable="yes">Profile 3</property>
<property name="accelerator">&lt;Control&gt;3</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkShortcutsGroup">
<property name="visible">True</property>
@ -222,35 +264,6 @@
</child>
</object>
</child>
<child>
<object class="GtkShortcutsGroup">
<property name="visible">True</property>
<property name="title" translatable="yes">Playlist</property>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">True</property>
<property name="title" translatable="yes">Remove selected song</property>
<property name="subtitle" translatable="yes">Middle-click</property>
<property name="accelerator">Delete</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">True</property>
<property name="title" translatable="yes">Clear playlist</property>
<property name="accelerator">&lt;Shift&gt;Delete</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">True</property>
<property name="title" translatable="yes">Show additional information</property>
<property name="subtitle" translatable="yes">Right-click</property>
<property name="accelerator">&lt;Control&gt;i Menu</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>

View File

@ -3312,13 +3312,16 @@ class MainWindow(Gtk.ApplicationWindow):
# actions
simple_actions_data=(
"settings","profile-settings","stats","help","menu",
"toggle-lyrics","back-to-current-album","toggle-search",
"profile-next","profile-prev","show-info"
"toggle-lyrics","back-to-current-album","toggle-search","show-info"
)
for name in simple_actions_data:
action=Gio.SimpleAction.new(name, None)
action.connect("activate", getattr(self, ("_on_"+name.replace("-","_"))))
self.add_action(action)
for i, name in enumerate(("profile-1","profile-2","profile-3")):
action=Gio.SimpleAction.new(name, None)
action.connect("activate", self._on_profile, i)
self.add_action(action)
for name in ("append","play","enqueue"):
action=Gio.SimpleAction.new(name, None)
action.connect("activate", self._on_add_to_playlist, name)
@ -3517,13 +3520,8 @@ class MainWindow(Gtk.ApplicationWindow):
def _on_menu(self, action, param):
self._menu_button.emit("clicked")
def _on_profile_next(self, action, param):
current_profile=self._settings.get_int("active-profile")
self._settings.set_int("active-profile", ((current_profile+1)%3))
def _on_profile_prev(self, action, param):
current_profile=self._settings.get_int("active-profile")
self._settings.set_int("active-profile", ((current_profile-1)%3))
def _on_profile(self, action, param, profile):
self._settings.set_int("active-profile", profile)
def _on_show_info(self, action, param):
widget=self.get_focus()
@ -3648,14 +3646,13 @@ class mpdevil(Gtk.Application):
action_accels=(
("app.quit", ["<Control>q"]),("win.mini-player", ["<Control>m"]),("win.help", ["F1"]),("win.menu", ["F10"]),
("win.show-help-overlay", ["<Control>question"]),("win.toggle-lyrics", ["<Control>l"]),
("win.back-to-current-album", ["Escape"]),("win.toggle-search", ["<control>f"]),
("mpd.update", ["F5"]),("mpd.clear", ["<Shift>Delete"]),("mpd.toggle-play", ["space"]),
("mpd.stop", ["<Shift>space"]),("mpd.next", ["KP_Add"]),("mpd.prev", ["KP_Subtract"]),
("mpd.repeat", ["<Control>r"]),("mpd.random", ["<Control>s"]),("mpd.single", ["<Control>1"]),
("mpd.consume", ["<Control>o"]),("mpd.single-oneshot", ["<Control>space"]),("mpd.seek-forward", ["KP_Multiply"]),
("mpd.seek-backward", ["KP_Divide"]),("win.profile-next", ["<Control>p"]),("win.profile-prev", ["<Shift><Control>p"]),
("win.show-info", ["<Control>i","Menu"]),("win.append", ["<Control>plus"]),
("win.play", ["<Control>Return"]),("win.enqueue", ["<Control>e"]),("win.genre-filter", ["<Control>g"])
("win.profile-1", ["<Control>1"]),("win.profile-2", ["<Control>2"]),("win.profile-3", ["<Control>3"]),
("win.show-info", ["<Control>i","Menu"]),("win.append", ["<Control>plus"]),("win.play", ["<Control>Return"]),
("win.enqueue", ["<Control>e"]),("win.genre-filter", ["<Control>g"]),("win.back-to-current-album", ["Escape"]),
("win.toggle-search", ["<Control>f"]),("mpd.update", ["F5"]),("mpd.clear", ["<Shift>Delete"]),("mpd.toggle-play", ["space"]),
("mpd.stop", ["<Shift>space"]),("mpd.next", ["<Alt>Down"]),("mpd.prev", ["<Alt>Up"]),("mpd.repeat", ["<Control>r"]),
("mpd.random", ["<Control>n"]),("mpd.single", ["<Control>s"]),("mpd.consume", ["<Control>o"]),
("mpd.single-oneshot", ["<Shift><Control>s"]),("mpd.seek-forward", ["<Alt>Right"]),("mpd.seek-backward", ["<Alt>Left"])
)
for action, accels in action_accels:
self.set_accels_for_action(action, accels)