Ubuntu: How to remove right click format option to a disk icon in the launcher?



Question:

How to remove right click "format" option from a disk icon in the launcher as it can lead to formatting by mistake.


Solution:1

As far as I know...the Format option is hardcoded in the Unity source.
You can try to edit source code to remove the format item.


NOTE: I recommend you to do this in a Virtual Machine or in a Test Machine to see is everything is OK. (In this example I'm running Ubuntu 12.04 with Unity 5.20.0).


1) Make sure you have enable the Source code repository

  • Open the Ubuntu Software Center.
  • In the Menu Bar choose Edit -> Software Sources. Click to enable "Source code repository". Just in case I use the "Main Server" to Download.

enter image description here

Open a Terminal window Ctrl+Alt+T and type:

  • sudo apt-get update

2) In the Terminal type the following to install the necessary packages.

  • sudo apt-get install build-essential quilt

3) Install build dependencies.

  • sudo apt-get build-dep unity

4) Create a folder to download the source code.

  • mkdir ~/Downloads/src

  • cd ~/Downloads/src

5) Download the source code & Export variables.

  • apt-get source unity

  • export QUILT_PATCHES=debian/patches

  • export EDITOR=gedit

6) Create the patch and Edit the source code.

  • cd unity-5.20.0/

  • quilt new 99_no_format_option.patch

  • quilt edit plugins/unityshell/src/DeviceLauncherIcon.cpp

Remove the lines... from 171 to 185.

enter image description here

Save the changes.

7) Build the deb packages.

  • quilt refresh
  • fakeroot dpkg-buildpackage

8) Install the deb packages.

  • cd ..

  • sudo dpkg -i *deb

9) Finally you can logout and Login to see the changes.

Before:

enter image description here

After:

enter image description here

Hope this helps.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »