Skip to content

Instantly share code, notes, and snippets.

@romgrk
Last active December 17, 2017 22:38
Show Gist options
  • Save romgrk/f0c0eec5a46d0e8f53cc to your computer and use it in GitHub Desktop.
Save romgrk/f0c0eec5a46d0e8f53cc to your computer and use it in GitHub Desktop.
# For usage with https://gist.github.com/romgrk/0ba7a864a4e6c76eefd3
# drop-down-terminal gnome extension configuration
# F11/A-F11/C-F11 size-down/medium/up the terminal
# F12 + [0-9] sets background opacity
# F11 & M-F11 = sizeup/sizedown
function _dropdown_h_normal () {
dropdownterminal h 50%
}
function _dropdown_h_expand () {
dropdownterminal h 80%
}
function _dropdown_h_full () {
dropdownterminal h 100%
}
zle -N _dropdown_h_normal
zle -N _dropdown_h_expand
zle -N _dropdown_h_full
function _dropdown_light () {
dropdownterminal bg 'rgba(0,0,0,0.4)'
}
function _dropdown_dark () {
dropdownterminal bg 'rgba(0,0,0,0.7)'
}
function _dropdown_bg () {
echo 'Opacity [0-9]?'
read -s -k 1 char
if [[ "$char" == '-' ]]; then
dropdownterminal bg 'rgba(0,0,0,0.4)'
elif [[ "$char" == '=' ]]; then
dropdownterminal bg 'rgba(0,0,0,0.7)'
elif [[ "$char" == '0' ]]; then
dropdownterminal bg 'rgba(0,0,0,1.0)'
elif [[ $char =~ '\d' ]]; then
eval "dropdownterminal bg 'rgba(0,0,0,0.$char)'"
else
echo "Invalid value: $char\n"
fi
zle reset-prompt
}
zle -N _dropdown_bg
zle -N _dropdown_dark
zle -N _dropdown_light
kmap () {
# SET YOUR ZSH KEY MODES HERE
# see with:
# bindkey -l
modes=(insert main)
for k in $modes
do
bindkey -M $k $@
done
}
kmap "^[[23~" _dropdown_h_normal
kmap "^[[23;3~" _dropdown_h_expand
kmap "^[[23;5~" _dropdown_h_full
kmap "^[[24~" _dropdown_bg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment