I am fuzzy about how to set a command in a script to be run only when the shell is running within an X session.
basically, in ~/.bashrc I set my keyboard maps as
setxkbmap -layout 'us,gr' -variant 'altgr-intl,extended' -option grp:alt_shift_toggle
If I am connecting through putty , or otherwise, and i just open a command prompt window, I DONT want this command to run. If on the other hand, i have an X session running (locally or remotely) I want this command to run.
how can I do this checking in a bash script? Is there a bash environment variable I can be looking at? some other way?
Thank you for your help
you can add it to ~/.xinitrc (when an X is about to start, whatever is included in this file is executed)
-or /etc/xinitrc for global -
the other way you can do it is to add the configuration inside xorg.conf (check how to change layout)