1

I've got a setup-notebook-keyboard.sh script that I run everytime after logging in because I like my keyboard with the

  • CapsLock -> Esc,
  • CapsLock+Key -> Ctrl+Key

setting.

I've tried to set this up before, but wasn't able to.
I think I've tried setting it up in init.d and also with ubuntu "run on startup". I guess both cases didn't work because they are not run on a shell environment or something...

But anyway, I got stuck with running the script every time after startup and after closing the lid of the Notebook. Can somebody help?

Edit: I don't think this is a duplicate of 'how to persistently remap keys in Ubuntu', I have a script which does two things and I'm happy with it since I've been using it since last year, I just wasn't able to get it to run automatically and I have researched and tried it in different ways.

Edit 2: Please remove the duplicate tag. I've tried the suggestion on the question and none of them worked. I've now tried just adding a simple echo "(profanity) (location)" >> ~/file in:

  • ~/.profile
  • ~/.xinitrc
  • ~/.xsession
  • ~/.gnomerc

The machine is just not doing nothing on the files, or I've done something very wrong.

I've tried adding a (profanity).desktop entry in ~/.config/autostart, tried using the full paths, tried /etc/X11/Xsession.d/00_xx file, tried 00 and 100, closing the lid and opening, rebooting, etc.

I test it by checking if the CapsLock key lights up or not when I press it, because after I execute setup-notebook-keyboard.sh it doesn't light up anymore.

Aditional info that may be important: I'm using gnome shell and it's a graphic user interface.

Version: 10:37:34 ~$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 16.04.4 LTS Release: 16.04 Codename: xenial

Ps.: Now I tried adding echo "(profanity)" >> file on ~/.bashrc, it runs when I open a terminal(and sorry in advance if you thought I was running ubuntu on a terminal in the first place). So... Why is it so hard to just have a script execute after I log in? No wonder I gave up on it 1 year ago x(

1 Answers1

1

Add a command to run this script in ~/.profile file. It’ll run as user every time you log in.

If you want to execute some command every time you open new tty(for example every time you open new terminal) you can add command to ~/.bashrc file.

Dysproz
  • 161
  • 7