Add more function's and alises.

This commit is contained in:
CronyAkatsuki 2024-01-08 16:44:58 +01:00
parent 64de56b9fe
commit cb0e70d04e
2 changed files with 41 additions and 0 deletions

View File

@ -60,3 +60,7 @@ alias xboxdrv='tmux attach -t xboxdrv ||\
# config cleanup # config cleanup
alias mbsync='mbsync -c "$XDG_CONFIG_HOME"/isync/mbsyncrc' alias mbsync='mbsync -c "$XDG_CONFIG_HOME"/isync/mbsyncrc'
# My notebook aliases
alias notes="nvim $HOME/docs/vimwiki/notes.md"
alias wiki="nvim $HOME/docs/vimwiki/index.md"

View File

@ -126,3 +126,40 @@ mread() {
mflag -S $1 mflag -S $1
mseq -f : | mseq -S mseq -f : | mseq -S
} }
# Set the profile for mail management
mprofile() {
profiles=$(find "$HOME"/.config/mblaze -type f -exec basename "{}" \;)
currentMaildir=$(grep "^Maildir:" "$HOME"/.mblaze/profile | cut -d: -f 2 | sed 's/ //g')
[ -z "$1" ] && basename "$(grep -w "$currentMaildir" -l -R "$HOME"/.config/mblaze)" && exit 0
[ "$1" = "-l" ] && printf '%s\n' "$profiles" && exit 0
profile="$1"
if printf '%s\n' "$profiles" | grep -qw "$profile"; then
cp "$HOME"/.config/mblaze/"$profile" "$HOME"/.mblaze/profile
else
printf '%s\n' "This profile doesn't exist"
fi
}
# Mount a luks partition
mount-luks() {
# get the drive path
drive="$1"
# open the encrypted drive
sudo cryptsetup luksOpen $drive luks
# check if the /mnt/encrypted directory exists if not create it
[ -d "/mnt/encrypted/" ] || sudo mkdir -p /mnt/encrypted
# mount the decrypted drive to /mnt/encrypted/ directory
sudo mount /dev/mapper/luks /mnt/encrypted
}
umount-luks() {
sudo umount /dev/mapper/luks
sudo cryptsetup luksClose luks
}