Skip to content

Commit

Permalink
Fix media keys (closes #13)
Browse files Browse the repository at this point in the history
  • Loading branch information
innir committed Aug 26, 2020
1 parent 0e26be2 commit 99b1958
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions bin/gtranscribe
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class gTranscribeWindow:
try:
session_bus = dbus.SessionBus()
settings_daemon_proxy = session_bus.get_object(
'org.gnome.SettingsDaemon',
'org.gnome.SettingsDaemon.MediaKeys',
'/org/gnome/SettingsDaemon/MediaKeys')
self.settings_daemon = dbus.Interface(
settings_daemon_proxy, 'org.gnome.SettingsDaemon.MediaKeys')
Expand Down Expand Up @@ -267,13 +267,16 @@ class gTranscribeWindow:
logger.debug('Received media key %s for %s', key, application)
if application == 'gTranscribe':
if key == 'Play':
self.play_action.activate()
if self.slider.is_sensitive():
self.play_action.activate()
elif key in ('Stop', 'Pause'):
self.play_action.set_active(False)
elif key == 'Next':
self.forward(None)
if self.forward_button.is_sensitive():
self.forward(None)
elif key == 'Previous':
self.rewind(None)
if self.rewind_button.is_sensitive():
self.rewind(None)

# pylint: disable=unused-argument
def on_focus(self, widget, event):
Expand Down Expand Up @@ -511,7 +514,8 @@ class gTranscribeWindow:
self.text_buffer.insert_at_cursor(pos_str)
# handling for yellow foot switch "science" from cleware
if keyname == 'F9':
self.play_action.activate()
if self.slider.is_sensitive():
self.play_action.activate()
elif keyname == 'F4':
self.play_action.set_active(False)

Expand Down

0 comments on commit 99b1958

Please sign in to comment.