Notification when bluetooth is on?

Forum rules
Before you post please read how to get help
Post Reply
Level 1
Level 1
Posts: 12
Joined: Wed Feb 27, 2019 2:17 am

Notification when bluetooth is on?

Post by neek » Sat Aug 03, 2019 12:48 am

I'm trying to set up a cron job via GNOME Schedule to notify me if bluetooth is on.

Code: Select all


export DISPLAY=:0

if rfkill list 0 | grep "Soft blocked: no"; then /usr/bin/notify-send 'Bluetooth is ON'; fi
I have two questions;
1) Is there a more reliable way than checking 'rfkill list 0 | grep "Soft blocked: no"' to check if bluetooth is on? I assume the list index number could potentially change from 0.
2) How can I get this to work with GNOME Schedule? The script runs fine when I run it manually, but doesn't work when scheduled. I've tried everything in this thread, but nothing has worked.

Thanks in advance!

[Edit: forgot to mention, I'm running 19.1 Cinnamon]

Level 4
Level 4
Posts: 312
Joined: Tue Jul 18, 2017 5:57 am

Re: Notification when bluetooth is on?

Post by TI58C » Sun Aug 11, 2019 11:16 am

As for checking bluetooth status: you might try

Code: Select all

service bluetooth status | awk '/Active:/{print $2}' ; rfkill list bluetooth | tail -n2 
That would tell you the status of bluetooth and tell you if it was blocked by rfkill (soft-blocked) or by switch (hard-blocked).
My laptop has switch that kills/enables both wifi and bluetooth.
Do not know anything about gnome scheduler, sorry.


Gnome-schedule is NOT in the Mint-repositories. Just googled a bit. There are some .deb files available, but they all seem to be for earlier Ubuntu-versions.
If you use a .deb-file for Ubuntu 16.04 (Xenial), they may work or not.....
The safest way would be to download the tar.gz file and compile. And even then there are no guarantees.

Linux is like my late labrador lady-dog: loyal and loving if you treat her lady-like, disbehaving princess if you don't.

Post Reply

Return to “Scripts & Bash”