X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=.bashrc;h=814c9af63136b822811da9ba20c1af02beaa1ff4;hb=refs%2Fheads%2Fmaster;hp=81853d0b548c6db8bd1978dcafc61e54c7858723;hpb=50f25d1eec109c4596cfc638c9a7c98da0f0b5d0;p=distro-setup diff --git a/.bashrc b/.bashrc index 81853d0..ac78814 100644 --- a/.bashrc +++ b/.bashrc @@ -20,6 +20,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +# shellcheck disable=SC2317 # to debug #set -x @@ -54,6 +55,17 @@ HISTIGNORE='pass *:otp *:oathtool *:histrm *' umask 022 +if [[ $EUID == 1000 && $TERM == linux && ! $DISPLAY && $(tty) = /dev/tty1 && -x /usr/bin/startx ]]; then + if tmp=$(systemctl status |& head) && \ + grep -qi '^ *state: running' <<<"$tmp" && grep -qi '^ *failed: 0' <<<"$tmp" && grep -qi '^ *jobs: 0' <<<"$tmp"; then + startx + else + echo "systemctl status |& head:" + printf "%s\n" "$tmp" + echo: systemctl list-jobs: + systemctl list-jobs + fi +fi #### if (in # noninteractive ssh shells or tty). tty because often i use it when @@ -128,7 +140,7 @@ return 0 # Automatically added by the Guix install script. if [ -n "$GUIX_ENVIRONMENT" ]; then - if [[ $PS1 =~ (.*)"\\$" ]]; then - PS1="${BASH_REMATCH[1]} [env]\\\$ " - fi + if [[ $PS1 =~ (.*)"\\$" ]]; then + PS1="${BASH_REMATCH[1]} [env]\\\$ " + fi fi