0

I have cmus music player installed and I really like it.

I need to run a command by pressing a key, for example CTRL+F so it will open browser and search a lyrics for currently playing song.

The command might be something like:

/usr/bin/google-chrome --new-tab http://search.azlyrics.com/search.php?q=[name-of-the-song]

Is it possible and if so where and how can I define such command ?

UPDATE:

Sorry for not being clear enough. This has nothing to do with global system keyboard shortcuts (as I know how to made them). Let me explain:

I am running cmus music player and within it I am selecting a song to play and play it. Then I want to run an "external command" for this song. By running some key shortcut (while this song is played) I want to run a command that will search lyrics for this song.

2 Answers2

2

To setup a macro, go to SystemSettings > Keyboard > Shortcuts

Click on + and name your macro & add the command associated with it.

Click again and press your keys to associate it with the command- in your case,

google-chrome http://search.azlyrics.com/search.php?q=[name-of-the-song]

Melcalc
  • 21
  • How can I get the [name-of-the-song] from cmus also how can I run it from within the cmus ? Please see my updated question - it's not about global keyboard shortcuts! – Michal Przybylowicz Jan 23 '17 at 10:45
0

You can use the Ubuntu's keyboard key assignment.

Create the script. Then assign a keyboard shortcut to it.

The script

Example (findsong.sh):

#!/bin/bash

/usr/bin/google-chrome --new-tab http://search.azlyrics.com/search.php?q=backpack

Assign Key shortcut:

Type keyboard in the Ubuntu Launch Button.

  • On the GUI interface click keyboard then click the + key to Add a new Shortcut.
  • Type in a Description and a full path to the script; then click apply
  • Click on the right column (disabled by default) then hit the key sequence you want to run the script. For the test I hit Ctrl+Shift+F. This is because Ctrl+F is already taken.

Now when you hit the shortcut will run.

L. D. James
  • 25,036
  • How can I get the [backpack] from cmus also how can I run it from within the cmus ? Please see my updated question - it's not about global keyboard shortcuts! – Michal Przybylowicz Jan 23 '17 at 10:45