3

When using Audacity in Ubuntu, you'll find that the menu bar is placed inside the window, and not in the usual location. This means it takes up more space than it should, and it makes it impossible to use the Alt menu to search for menubar items.

enter image description here

I figured I would share my solution!

Luka Kotar
  • 283
  • 3
  • 17

2 Answers2

2

Solution:

  1. Rename (move) the original file: sudo mv /usr/bin/audacity /usr/bin/audacity_orig
  2. Create a custom script to launch Audacity: sudo nano /usr/bin/audacity_mod and add the following contents:

    #!/bin/sh
    
    export UBUNTU_MENUPROXY=1
    
    # Preform a check if there is an argument to avoid launching Audacity twice.
    # Audacity has to be opened without an argument first,
    # otherwise the "alt" menu doesn't show results from the menu bar.
    if [-z "$1"]; then
        audacity_orig
    else
        audacity_orig | (sleep 1 && audacity_orig "$1")
    fi
    

    Explanation:

    • First, enable the native menus by running export UBUNTU_MENUPROXY=1
    • By doing audacity_orig, we are launching the original Audacity program (which we renamed in the previous step). We then wait one second and use audacity_orig "$file" to load the file into the program instance that was launched previously. Running audacity_org "$1" will pass the file path as an argument to the program. The reason we need to run both, is because the Alt menu (menubar search) doesn't seem to work unless Audacity is launched without arguments.

    Note: If you don't use the Alt menu, you can replace the last 5 lines with: audacity_orig "$file"

    Note: You can alternatively leave out the export UBUNTU_MENUPROXY=1 line from the above script, and change the Exec=env UBUNTU_MENUPROXY=0 audacity %F line in /usr/share/applications/audacity.desktop instead (change 0 to 1, or remove the env UBUNTU_MENU_PROXY=0 part).

  3. Finally, link the bash script to Audacity's original location and make it executable:

    • sudo ln /usr/bin/audacity_mod /usr/bin/audacity
    • sudo chmod +x /usr/bin/audacity

Done!

You can now enjoy Audacity with the native Unity menus:

enter image description here

The Alt menu works too:

enter image description here

Note: You may need to log out and back in for the Alt menu to work again after changing the OS theme through Unity Tweak Tool.


If you wish to revert:

  • A: Link the original program:
    1. Remove the link: sudo rm /usr/bin/audacity
    2. Link the original file: sudo ln /usr/bin/audacity_orig /usr/bin/audacity
    3. Make the link executable again: sudo chmod +x /usr/bin/audacity
    4. Optionally, remove the script: sudo rm /usr/bin/audacity_mod, or
  • B: Put the original program back where it was:
    1. Remove the link: sudo rm /usr/bin/audacity
    2. Move (rename) the original file: sudo ln /usr/bin/audacity_orig /usr/bin/audacity
    3. Optionally, remove the script: sudo rm /usr/bin/audacity_mod
Luka Kotar
  • 283
  • 3
  • 17
  • Thank you so much! Does this work with other apps like Krita? –  Jul 30 '16 at 16:44
  • Krita should already be using the Unity menubar, however version 3 has its own menubar as well. I don't think you can do much about that, unfortunately. I am currently still using Krita 2 for that reason. – Luka Kotar Jul 31 '16 at 05:09
  • I see... a similar thing happens with kdenlive too... –  Aug 01 '16 at 03:23
1

It looks like the shell script may not be necessary. According to this thread, that environment var was changed to work around some kind of bug on some systems, so they changed the .desktop entry for Audacity.

It works on my 16.04 system to make Audacity use global menus by just changing UBUNTU_MENUPROXY=0 to UBUNTU_MENUPROXY=1 in /usr/share/applications/audacity.desktop.