Sunday, 21 July 2013

How to disable bluetooth in gnome3 arch linux

It have been some 2 weeks approximately since i started to try out arch linux. I was a rhel, fedora and ubuntu user in the past. I tried to remove bluetooth functionality and the icon from my gnome 3 desktop. I googled for 2 days and finally did it. Here is one way to do it:
First disable bluetooth service upon login, maybe you can use it in system wide location if you want that. For me it makes no difference since i am the only user in this system. Create a file like this
~username/.config/autostart/bluetooth.desktop
and its content like this
[Desktop Entry]
Type=Application
Name=Disable bluetooth
Comment=Turn off bluetooth by default
Exec=/usr/sbin/rfkill block bluetooth
StartupNotify=false
Terminal=false
Hidden=false

ensure that you have installed the package rfkill.

Now when you restart your PC or your gnome session, bluetooth icon will show disabled. Now to remove the bluetooth since we have already disabled it.

Open  /usr/share/gnome-shell/js/ui/panel.js in vim (or your favorite editor) 

find this line

const PANEL_ITEM_IMPLEMENTATIONS = {

and a few lines after this you will find this line

 if (Config.HAVE_BLUETOOTH)
    PANEL_ITEM_IMPLEMENTATIONS['bluetooth'] =
        imports.ui.status.bluetooth.Indicator;

Comment them all out by prepending the comment charater //
Now restart your gnome session by 
alt+f2
r
enter

Now you can bluetooth icon is gone.

I learnt that bluetooth is a system special service, which is controlled by systemd. So if you think you can disable the service and bluetooth will be stopped , you are wrong. This service starts as soon as it detects the hardware. So you cant just disable it like other service. 
Second difficulty i faced. I thought on removing the bluetooth icon from menu bar at the top. I did ps -ef to see any bluetooth word mentioned, sadly no. Then looked in to see any package with name bluetooth in it. Like this:
pacman -Q | grep -i bluetooth
I see gnome-bluetooth.
and you might think you have now near solving it, but unfortunately you are far from it. gnome-bluetooth as i read from arch forum posts and in gnome website is a integral part of gnome-shell so you cant remove it , unless you are ready to recompile gnome-shell without. Way to much thing for a simple thing. 
gnome 3 is a mess and the *&^%)(*& developer who designed it surely wanted to the users to suffer, so that they will switch to other DE or Windows. Anyway gnome was a bloat ware from the beginning. In my next Linux distro i use , i would ensure there is no gnome. The problem is , I know how difficult is gnome 3, but i am not sure if other DE are any easier. Certainly i dont want to use KDE either. In the begining of my linux journey in 2004 i tried KDE and it was trying to look like windows and from what i read recently , it still trying the same thing. I read that gnome is trying to look like mac and KDE like windows. I am not sure of KDE part , I know gnome part is true, so i assume KDE part must be true.

No comments:

Post a Comment