1

I have a bash script for enabling and disabling wifi that I want to bind to shortcut:

#!/bin/bash
if [ $(rfkill list wifi | grep "Soft blocked: yes" | wc -l) -gt 0 ] ; then
    rfkill unblock wifi
    notify-send "Enabled Wireless"
else
    rfkill block wifi
    notify-send "Disabled Wireless"
fi

I have made the script executable by running:

chmod +x script.sh

In .xbindkeysrc I have:

"path/to/script.sh"
F1

After that I have run xbindkeys in terminal and tried to press F1 but nothing happens.

I verified that script does work when executed manually. I tried different bind keys like Alt + y etc.

What did I do wrong?

2
  • Have you checked the key F1 is correct? you can check with xbindkeys -k Commented Aug 15, 2020 at 19:22
  • @Akuseru it does now work when I set it to some combination like alt + y. So do I set a script to run xbindkeys on startup or is there a way to autostart it? Commented Aug 16, 2020 at 18:33

1 Answer 1

0

In my system is working by using Mod + F2

You can auto start xbindkeys by putting it in your .xinitrc/.xprofile file, or depending on your distro, there could be an auto start program that takes care of it, like gnome-session-properties in Ubuntu

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.