0

I am using an Xenial Xerus minimal Ubuntu install.

I want a command ("antimicro") to be run on boot/login (doesn't matter) to map my Bluetooth controller buttons to keyboard keys. The farthest I could get is:

DISPLAY=":0" antimicro --hidden

Which does not work as a cron job, gdm postlogin commands or ~/.profile (gdm and Kodi not running), it seems to require a logged in terminal. It worked well when I execute it manually on tty1, it will display log and "occupies" the terminal until the application is closed.

I don't mind turning on auto login or disabling password etc. It's a HTPC running Kodi, and that's why I want it to be run automatically on each boot.

I am quite new on Linux and this may just be a stupid question, sorry if that's the case. I have tried my best to find information online.

EDIT: it's probably not a duplicate, none of the solutions worked.

5
  • You can NOT run a graphical command at boot. In cron you need to use the full path to commands.
    – Panther
    May 27, 2016 at 17:27
  • Are you running lightdm with Kodi?
    – Delorean
    May 27, 2016 at 17:29
  • I will try the solutions given in the posts later, thank you for your help.
    – Fei Kuan
    May 27, 2016 at 17:32
  • @XToro I'm using gdm with gnome, xfce and kodi installed.
    – Fei Kuan
    May 27, 2016 at 17:35
  • Is it possible to autologin into tty1, run the command and switch to tty7?
    – Fei Kuan
    May 28, 2016 at 2:50

1 Answer 1

0

Create a script with the editor of your choice.

For my example, let's call it btmap and place it in /home/username/scripts/

Of course you would change username in the path with your actual username.

Put DISPLAY=":0" antimicro in the editor, save and close.

Open a terminal in the scripts folder where the btmap file is. Type in chmod 755 btmap to make it executable.

Now sudo su and type password in if asked.

Type in echo "/home/username/scripts/btmap" >> /etc/gdm/PostLogin/Default

This will append your Default file with the execution of btmap.

Now reboot and see if it worked.

3
  • Does not work, seems like nothing has happened.
    – Fei Kuan
    May 28, 2016 at 2:21
  • So your bluetooth controller doesn't connect? Does the DISPLAY=":0" antimicro normally work for you when you type it in a terminal? If not, you'll have to find the right command that makes it work for you.
    – Delorean
    May 28, 2016 at 3:19
  • My controller can connect and function as I want it to when executing the command manually. The only solution that "worked" is to put it in ~/.profile but that prevented gdm from loading.
    – Fei Kuan
    May 28, 2016 at 7:10

Not the answer you're looking for? Browse other questions tagged .