Can I use a Bash alias in a keyboard shortcut?
Yes, you can. You just need to ask the command for an interactive shell.
Let's say your alias is:
alias myalias='some cool command here'
Your shortcut command must be:
bash -i -c "myalias"
No, the commands run by keyboard bindings are not parsed via a shell. Your best bet is to create a directory bin
in your homedir (mkdir -p ~/bin
). Write a script named cal that runs your command, save it in ~/bin
and make it executable.
$ mkdir -p ~/bin
$ cat > ~/bin/cal << 'EOF'
#!/bin/sh
exec google-chrome --new-window calendar.google.com
EOF
$ chmod +x ~/bin/cal
If you didn't have a bin
directory in your homedir already, you need to log out and back in again for it to be added to your PATH. Once that is done, binding a keyboard binding to run "cal" should do what you want.