Added wayland support for bw helper functions.

Also removed an old wsl related section from .bashrc.
This commit is contained in:
2023-01-11 09:06:47 +13:00
parent e6903c4074
commit d5efc3c7cf

17
.bashrc
View File

@ -29,14 +29,15 @@ fi
# Custom git alias for pushing to all remotes at once # Custom git alias for pushing to all remotes at once
alias gpa='git remote | xargs -L1 git push --all' alias gpa='git remote | xargs -L1 git push --all'
# simplify bitwarden cli usage # simplify bitwarden cli usage
cpcmd="xclip -selection -c"; if [[ "$XDG_SESSION_TYPE" == "wayland" ]]; then cpcmd="wl-copy"; fi
alias bwu='export BW_SESSION=$(bw unlock --raw > ~/.bw_session && cat ~/.bw_session)' alias bwu='export BW_SESSION=$(bw unlock --raw > ~/.bw_session && cat ~/.bw_session)'
function bwgp () { local test=$(export BW_SESSION=~/.bw_session) && bw get password "$1" | xclip -selection c; } function bwgp () { local test=$(export BW_SESSION=~/.bw_session) && bw get password "$1" | $cpcmd; }
function bwgt () { local test=$(export BW_SESSION=~/.bw_session) && bw get totp "$1" | xclip -selection c; } function bwgt () { local test=$(export BW_SESSION=~/.bw_session) && bw get totp "$1" | $cpcmd; }
function bwgi () { local test=$(export BW_SESSION=~/.bw_session) && bw get item --pretty "$1"; } function bwgi () { local test=$(export BW_SESSION=~/.bw_session) && bw get item --pretty "$1"; }
function bwli () { local test=$(export BW_SESSION=~/.bw_session) && bw list items --search "$1" --pretty | egrep -i 'name|"id":'; } function bwli () { local test=$(export BW_SESSION=~/.bw_session) && bw list items --search "$1" --pretty | egrep -i 'name|"id":'; }
function bwol () { local test=$(export BW_SESSION=~/.bw_session) && bw get item --pretty "$1" | grep https | awk '{print $2}' | xclip -selection c; } function bwol () { local test=$(export BW_SESSION=~/.bw_session) && bw get item --pretty "$1" | grep https | awk '{print $2}' | $cpcmd; }
function bwgu () { local test=$(export BW_SESSION=~/.bw_session) && bw get username "$1" | xclip -selection c; } function bwgu () { local test=$(export BW_SESSION=~/.bw_session) && bw get username "$1" | $cpcmd; }
# automate multimonitor command # automate multimonitor command
alias hdmioff='xrandr --output HDMI-0 --off' alias hdmioff='xrandr --output HDMI-0 --off'
@ -53,12 +54,6 @@ if ! shopt -oq posix; then
fi fi
fi fi
# Configure display and browser for wsl
if [ $(uname -r | sed -n 's/.*\( *Microsoft *\).*/\1/ip') ]; then
export DISPLAY=`grep -oP "(?<=nameserver ).+" /etc/resolv.conf`:0.0
export BROWSER="explorer.exe"
fi
# Configure emacs location # Configure emacs location
export EMACSLOADPATH=~/Downloads/humacs: export EMACSLOADPATH=~/Downloads/humacs: