From cb0e70d04ef440672d26b3e8f277e7b54eb014d8 Mon Sep 17 00:00:00 2001 From: CronyAkatsuki Date: Mon, 8 Jan 2024 16:44:58 +0100 Subject: [PATCH] Add more function's and alises. --- .config/zsh/aliases.zsh | 4 ++++ .config/zsh/functions.zsh | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/.config/zsh/aliases.zsh b/.config/zsh/aliases.zsh index 41d27ab..56fea10 100755 --- a/.config/zsh/aliases.zsh +++ b/.config/zsh/aliases.zsh @@ -60,3 +60,7 @@ alias xboxdrv='tmux attach -t xboxdrv ||\ # config cleanup 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" diff --git a/.config/zsh/functions.zsh b/.config/zsh/functions.zsh index 5d98681..2f54b5a 100755 --- a/.config/zsh/functions.zsh +++ b/.config/zsh/functions.zsh @@ -126,3 +126,40 @@ mread() { mflag -S $1 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 +}