Add utilities to check if X11 or Wayland is running
This commit is contained in:
parent
3f0f0815e1
commit
c4b6ed747f
1 changed files with 20 additions and 1 deletions
|
@ -15,10 +15,29 @@ _init_pyenv () { # used in ~/.config/shell/utils.d/python.sh as well
|
||||||
_init_pyenv
|
_init_pyenv
|
||||||
|
|
||||||
|
|
||||||
|
_in_x11 () {
|
||||||
|
_result=$(loginctl show-session $(loginctl | grep $(whoami) | awk '{print $1}') -p Type --value)
|
||||||
|
if [[ $_result == "x11" ]]; then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
_in_wayland () {
|
||||||
|
_result=$(loginctl show-session $(loginctl | grep $(whoami) | awk '{print $1}') -p Type --value)
|
||||||
|
if [[ $_result == "wayland" ]]; then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# Configure the keyboard:
|
# Configure the keyboard:
|
||||||
# - make right alt and menu keys the compose key, e.g., for German Umlauts
|
# - make right alt and menu keys the compose key, e.g., for German Umlauts
|
||||||
# - make caps lock a ctrl modifier and Esc key
|
# - make caps lock a ctrl modifier and Esc key
|
||||||
setxkbmap us -option 'compose:menu,compose:ralt,caps:ctrl_modifier'
|
_in_x11 && setxkbmap us -option 'compose:menu,compose:ralt,caps:ctrl_modifier,lv3:ralt_switch'
|
||||||
_command_exists xcape && xcape -e "Caps_Lock=Escape"
|
_command_exists xcape && xcape -e "Caps_Lock=Escape"
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue