dotfiles

Cem's Dotfiles
git clone git://git.ckyln.com/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

commit bb123498da973c34fda74050a23a89cec2510a3a
parent a34b799eda269808db5d3355799ab9602657e7d7
Author: Cem Keylan <warc1998@gmail.com>
Date:   Mon,  3 Jun 2019 22:44:26 +0300

I leik treins

Diffstat:
M.bashrc | 46+++++++++++++++++++++++++++++++++++++++++-----
M.config/i3/config | 6++++++
M.vimrc | 2++
Mbin/checkmail | 2+-
Abin/dmenumount | 40++++++++++++++++++++++++++++++++++++++++
Abin/dmenuumount | 17+++++++++++++++++
6 files changed, 107 insertions(+), 6 deletions(-)

diff --git a/.bashrc b/.bashrc @@ -33,6 +33,40 @@ colors() { done } +# Make colorcoding available for everyone + +Black='\e[0;30m' # Black +Red='\e[0;31m' # Red +Green='\e[0;32m' # Green +Yellow='\e[0;33m' # Yellow +Blue='\e[0;34m' # Blue +Purple='\e[0;35m' # Purple +Cyan='\e[0;36m' # Cyan +White='\e[0;37m' # White + +# Bold +BBlack='\e[1;30m' # Black +BRed='\e[1;31m' # Red +BGreen='\e[1;32m' # Green +BYellow='\e[1;33m' # Yellow +BBlue='\e[1;34m' # Blue +BPurple='\e[1;35m' # Purple +BCyan='\e[1;36m' # Cyan +BWhite='\e[1;37m' # White + +# Background +On_Black='\e[40m' # Black +On_Red='\e[41m' # Red +On_Green='\e[42m' # Green +On_Yellow='\e[43m' # Yellow +On_Blue='\e[44m' # Blue +On_Purple='\e[45m' # Purple +On_Cyan='\e[46m' # Cyan +On_White='\e[47m' # White + +NC="\e[m" # Color Reset + + [ -r /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion # Change the window title of X terminals @@ -74,7 +108,7 @@ if ${use_color} ; then if [[ ${EUID} == 0 ]] ; then PS1='\[\033[01;31m\][\h\[\033[01;36m\] \W\[\033[01;31m\]]\$\[\033[00m\] ' else - PS1='\[\033[01;32m\][\u@\h\[\033[01;37m\] \W\[\033[01;32m\]]\$\[\033[00m\] ' + PS1="${BCyan}\u${BGreen}@${BCyan}\h${BWhite} \W${BGreen} \$\[\033[00m\] " fi alias ls='ls --color=auto' @@ -155,14 +189,16 @@ ex () export YAOURT_COLORS="nb=1:pkg=1:ver=1;32:lver=1;45:installed=1;42:grp=1;34:od=1;41;5:votes=1;44:dsc=0:other=1;35" export PATH=$HOME/.gem/ruby/2.6.0/bin/:$PATH +# Default Applications and Configuration Directory +export EDITOR="/usr/bin/nvim" +export TERMINAL="terminator" +export BROWSER="qutebrowser" +export XDG_CONFIG_HOME=$HOME/.config + # Personal Scripts export PATH=$HOME/bin/:$PATH export PATH=$HOME/.scripts/:$PATH export PATH=/usr/local/bin/:$PATH -export EDITOR="/usr/bin/vim" -export TERMINAL="terminator" -export BROWSER="qutebrowser" -export XDG_CONFIG_HOME=$HOME/.config export PATH=$HOME/.vim/bundle/vim-live-latex-preview/bin/:$PATH set -o vi export VIMUP=TRUE diff --git a/.config/i3/config b/.config/i3/config @@ -229,6 +229,12 @@ bindsym $mod+Shift+m exec --no-startup-id $term -e "neomutt && exit" # Launch Calcurse bindsym $mod+c exec --no-startup-id $term -e "calcurse && exit" + +# Mount USB +bindsym $altmod+m exec --no-startup-id $HOME/bin/dmenumount + +# Unmount USB +bindsym $altmod+u exec --no-startup-id $HOME/bin/dmenuumount ######################################## diff --git a/.vimrc b/.vimrc @@ -136,3 +136,5 @@ endif set number relativenumber execute pathogen#infect() filetype plugin indent on +vnoremap <silent><Leader>y "yy <Bar> :call system('xclip', @y)<CR> +set clipboard=unnamedplus diff --git a/bin/checkmail b/bin/checkmail @@ -2,7 +2,7 @@ if [ -d $HOME/.local/share/mail ] then - echo -e " $(echo "$(du -a ~/.local/share/mail/*/INBOX/new/* 2>/dev/null | sed -n '$=')$(cat /tmp/imapsyncicon_$USER 2>/dev/null)" + echo -e " $(echo "$(du -a ~/.local/share/mail/*/INBOX/new/* 2>/dev/null | sed -n '$=')$(cat /tmp/imapsyncicon_$USER 2>/dev/null || echo 0)" ) " else Mailbox cannot be found diff --git a/bin/dmenumount b/bin/dmenumount @@ -0,0 +1,40 @@ +#!/bin/sh +# Cem Keylan's modification of Luke's dmenumount script +# I have 3 Arch systems on my computer so I usually won't be +# mounting my hard drive partitions. Thus, I disabled '/dev/nvme0n1' and '/dev/sda'. +# I also disabled mounting Android, because I don't have an Android device. + +getmount() { \ + [ -z "$chosen" ] && exit 1 + mp="$(find $1 2>/dev/null | dmenu -i -p "Type in mount point.")" + [ "$mp" = "" ] && exit 1 + if [ ! -d "$mp" ]; then + mkdiryn=$(printf "No\\nYes" | dmenu -i -p "$mp does not exist. Create it?") + [ "$mkdiryn" = "Yes" ] && (mkdir -p "$mp" || sudo -A mkdir -p "$mp") + fi + } + +mountusb() { \ + chosen="$(echo "$usbdrives" | dmenu -i -p "Mount which drive?" | awk '{print $1}')" + sudo -A mount "$chosen" 2>/dev/null && notify-send "💻 USB mounting" "$chosen mounted." && exit 0 + alreadymounted=$(lsblk -nrpo "name,type,mountpoint" | awk '$2=="part"&&$3!~/\/boot|\/home$|SWAP/&&length($3)>1{printf "-not \\( -path *%s -prune \\) \\ \n",$3}') + getmount "/mnt /media /mount /home -maxdepth 5 -type d $alreadymounted" + partitiontype="$(lsblk -no "fstype" "$chosen")" + case "$partitiontype" in + "vfat") sudo -A mount -t vfat "$chosen" "$mp" -o rw,umask=0000;; + *) sudo -A mount "$chosen" "$mp"; user="$(whoami)"; ug="$(groups | awk '{print $1}')"; sudo -A chown "$user":"$ug" "$mp";; + esac + notify-send "USB mounting" "$chosen mounted to $mp." + } + +anddrives=$(simple-mtpfs -l 2>/dev/null) +usbdrives="$(lsblk -rpo "name,type,size,mountpoint" | awk '$2=="part"&&$4==""{printf "%s (%s)\n",$1,$3}' | sed '/\/dev\/sda/d' - | sed '/\/dev\/nvme0n1/d' -)" + +if [ -z "$usbdrives" ]; then + echo "No USB drive detected" && exit +else + if [ -z "$anddrives" ]; then + echo "USB drive(s) detected." + mountusb + fi +fi diff --git a/bin/dmenuumount b/bin/dmenuumount @@ -0,0 +1,17 @@ +#!/bin/sh +# A dmenu prompt to unmount drives. +# Provides you with mounted partitions, select one to unmount. +# Drives mounted at /, /boot and /home will not be options to unmount. + +unmountusb() { + [ -z "$drives" ] && exit + chosen=$(echo "$drives" | dmenu -i -p "Unmount which drive?" | awk '{print $1}') + [ -z "$chosen" ] && exit + sudo -A umount "$chosen" && notify-send "USB unmounting" "$chosen unmounted." + } + +drives=$(lsblk -nrpo "name,type,size,mountpoint" | awk '$2=="part"&&$4!~/\/boot|\/home$|SWAP/&&length($4)>1{printf "%s (%s)\n",$4,$3}') + +[ -z "$drives" ] && echo "No drives to unmount." && exit +echo "Unmountable USB drive detected." +unmountusb