From 04c04517e564303250f50cf8ec69088f640d5fab Mon Sep 17 00:00:00 2001 From: pks Date: Tue, 23 Feb 2021 11:39:48 +0100 Subject: zsh: improvements --- zsh/.zshrc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'zsh/.zshrc') diff --git a/zsh/.zshrc b/zsh/.zshrc index 120b6bb..50cb603 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -41,6 +41,8 @@ if [[ $? != 0 ]]; then _HOSTNAME=$HOST # $HOST is set by zsh fi +_USERNAME=$(whoami) + # ############################################################################# # ssh-agent # ############################################################################# @@ -57,7 +59,7 @@ function start_agent { } -if [[ $(whoami) != "root" ]]; then +if [[ $_USERNAME != "root" ]]; then if [ -f "${SSH_ENV}" ]; then . "${SSH_ENV}" > /dev/null ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || { @@ -159,7 +161,7 @@ zstyle ':prompt:rtab' nameddirs yes # exports # ############################################################################# -if [[ $(whoami) == "root" ]]; then +if [[ $_USERNAME == "root" ]]; then umask 0022 else umask 0077 @@ -214,7 +216,7 @@ export CCACHE_PATH=/usr/bin case $_HOST_TYPE in Linux) - case `whoami` in + case $_USERNAME in root) export PATH=/home/pks/.local/bin:$PATH ;; @@ -287,7 +289,7 @@ chpwd zstyle ':prompt:rtab' fish yes zstyle ':prompt:rtab' nameddirs yes -case `whoami` in +case $_USERNAME in root) PROMPT="%{$bg[red]%}%{$fg[black]%}%m:%1v#%{$reset_color%} " ;; @@ -364,8 +366,7 @@ if [[ $_HOST_TYPE == "Linux" ]]; then ;; esac alias vgaext='xrandr --output VGA1 --mode 1024x768 --left-of LVDS1 --rotate right' - alias vga21='xrandr --output VGA1 --mode 1600x1200 --rate 60 --rotate right && xrandr --output LVDS1 --off' - alias vga22w='xrandr --output VGA1 --mode 1680x1050 --rate 60 --rotate left && xrandr --output LVDS1 --off' + alias vga21='xrandr --output VGA1 --mode 1600x1200 --rate 60 --rotate left && xrandr --output LVDS1 --off' alias reboot='sudo shutdown -r now' alias halt='sudo shutdown -h now' alias lp2p='/usr/bin/lp -o sides=two-sided-long-edge' -- cgit v1.2.3