1

I can now open Qjackctl using the terminal. This is the code that I am using.

pulseaudio --kill
jack_control  start

This will open the program successfully. Then when I am finished I can type this code:

jack_control exit
pulseaudio --start

It takes a little bit of typing, but it works. How do I save the commands and make it work automatically? Thanks in advance for all of your help.

2 Answers 2

1

You can create a .desktop file for doing this.

First, create a script using terminal:

mkdir -p bin
gedit ~/bin/jack_control.sh

In the new opened file, add the following lines:

#!/bin/bash

pid=$(pgrep -x jack_control)

if [ "$pid" = "" ]; then 
    pulseaudio --kill
    jack_control  start
else
    jack_control exit
    pulseaudio --start
fi

Save the file, close it and make it executable:

chmod +x ~/bin/jack_control.sh

Now you can create your .desktop file:

gedit ~/Desktop/jack_control.desktop

In the new opened file, add the following lines:

[Desktop Entry]
Version=1.0
Name=Qjackctl
Comment=Start or stop jack_control
Exec=/home/your_username/bin/jack_control.sh
Icon=/path/to/icon.png    # <-- this line is optional
Terminal=false
Type=Application
Categories=Utility;Application;

Save the file, close it and make it executable:

chmod +x ~/Desktop/jack_control.desktop

Finally, go to desktop and test your new .desktop file.

More about: https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles

8
  • Hello, I really appreciate your help. I did what you said but got this error message- Could not find the home/brian/-Desktop/~jack_control.esktop. Please check that you typed the location correctly and try again. On the line Icon-/path/to/icon.png, are there three spaces between that and # <-- or two? Also, the the words this line is optional, is the for me or part of the text? Sep 5, 2013 at 14:50
  • @BJsgoodlife Be careful with the paths. home/brian/-Desktop/~jack_control.esktop it's wrong at all. In desktop file use: Exec=/home/brian/bin/jack_control.sh. That line Icon=/path/to/icon.png # <-- this line is optional as says is optional. This is a comment: # <-- this line is optional, so delete it. If you want to assign an icon to your desktop file, then change /path/to/icon.png with the path to the icon; if you don't want, delete that line. Sep 5, 2013 at 15:10
  • Ok I got it to work but then it stopped working again. I have done it a number of times, so maybe what I need to do is delete all the files and start over. How do you do that? Sep 6, 2013 at 4:29
  • @BJsgoodlife There are only 2 files: ~/bin/jack_control.sh and ~/Desktop/jack_control.desktop; ~ stands for /home/brian (in your case) - these are equivalent. Sep 6, 2013 at 4:37
  • 1
    @BJsgoodlife Are you so noob? You can get some basic help here and here Sep 7, 2013 at 7:48
0

I wrote this to be as fast and simple to use as possible - this script will work great in tandem with a quick access terminal like Yakuake or Guake:

#!/bin/bash

####################################################
#
# Use this CLI util to toggle pulse audio <--> jackd
#
# This program will start by shutting down the
# pulseaudio systems and starting up a jack daemon.
# It'll then wait for you to press any key. When you
# do, it'll close the jack daemon and restart pulse.
#
####################################################

function write() {
  echo -e "\033[036m`basename $0:`#\033[0m $1"
}

pulseaudio --kill
jack_control start

write 'press any key to toggle back to pulseaudio..'
read

jack_control exit
pulseaudio --start

Save this to a file named qjack (or whatever) that's in your $PATH, chmod 755 qjack to make it executable.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.