How to link a custom keyboard shortcut to a bash script in Ubuntu 13.04?

As an Ubuntu 13.04 user I had myself as well various problems and incompatibilities with this newest version of Ubuntu. One of these is that the Brightness bar has suddenly disappeared from the 'System Settings --> Brightness & Lock' tab after I installed some packages (which I don't really remember what it was). I found out that a workaround is to use xbacklight.

As an exercise for myself, I wrote a short script in order to easily increase and decrease the brightness using xbacklight from terminal. The script is executable (has permission to execute), is an a directory that is included in $PATH in my .bashrc file and is linked to an alias ('blup' to increase and 'bldn' to decrease screen brightness). So, my two aliases (blup/bldn) work perfectly fine from a terminal line. Next, I wanted to link these to some keyboard shortcuts (for instance F2/F3). I did so in 'System Settings --> Keyboard --> Shortcuts --> Custom Shortcuts', but it did not work.

enter image description here

Why?

Furthermore, is there a way to 'discover' where and how other (non-custom) keyboard-shortcut commands are executed? For instance, the volume-up shortcut what terminal line does it execute, what alias is connected to (if any) and what directory are they put at (/usr/bin, something else...)?

As a newbie in script-writing I would appreciate any kind of help!

Thanks

P.S.1 Of course, simply one can paste the command 'xbacklight -inc/-dec 10' to the custom keyboard shortcuts and it will work fine. I just want to seize the opportunity and get to know a bit more about script writing and executing.

P.S.2 My problem is not the same as this one: How do I launch a bash script using a keyboard shortcut?, ie, I use no '~/' for '/home/user/'.


First of all, aliases are not expanded in non-interactive shells. Read the ALIASES section from man bash in this sense. So, you can't use an alias in 'Command' field when you add/edit a custom shortcut.

Second, as geirha said in this comment, if you changed PATH in .bashrc file, that change will not be available in non-interactive shells. So, you need to change the PATH in ~/.profile file instead.

Third, if you still want to use only bldn in 'Command' field when you add/edit a custom shortcut, you can rename your script with this name and add the script path to the PATH in ~/.profile file, as I said above.