Created
April 10, 2018 08:56
-
-
Save alanxoc3/c242b895959f740c9c707ec067f95fcd to your computer and use it in GitHub Desktop.
Dmenu alias integration with xterm!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# For running commands on xterm startup. | |
# The newline is needed, because bash does weird things with aliases. Bash | |
# needs a line before the shopt command takes effect. That was a wild goose | |
# chase! | |
# http://www.delorie.com/gnu/docs/bash/bashref_72.html | |
xtermcmd() { | |
xterm -e "bash --rcfile <(echo -e \"shopt -s expand_aliases; . ~/.bashrc;\n$*\")" | |
} | |
xtermcmd "$*" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
So, I really wanted aliases to work with dmenu and for my aliases to pull up xterm when you run it through dmenu. I got it working after quite a few hours. There were some little quirks with xterm that I had to get by. I would have used this script, but it is way outdated and didn't work 🙁.
You can modify this gist to work with any terminal emulator. To do so, just replace the
xtermcmd
near the bottom of thedmenu_alias
file with your command to open up a terminal emulator (with alias support from opening it up).And to install, just make sure you put both these scripts in your path (if you aren't using xterm, then you only need the
dmenu_alias
file. Reply if you got questions/feed back!