From: Daniel Liu Date: Wed, 14 Apr 2021 03:18:53 +0000 (-0400) Subject: emote shell scripts X-Git-Url: https://git.danieliu.xyz/?p=dotfiles.git;a=commitdiff_plain;h=2894bed4452f6e6f781f8d3b84f6ad6bd40a1e62 emote shell scripts --- diff --git a/.config/sxhkd/sxhkdrc b/.config/sxhkd/sxhkdrc index bfaf73f..de63487 100644 --- a/.config/sxhkd/sxhkdrc +++ b/.config/sxhkd/sxhkdrc @@ -33,6 +33,12 @@ super + l super + {Down,Left,Right} mpc {toggle,prev,next} +super + e + emoter + +super + shift + e + emoter -g + alt + s screenshot -f diff --git a/.vim/mysnippets/tex.snippets b/.vim/mysnippets/tex.snippets index 6d68b16..d563262 100644 --- a/.vim/mysnippets/tex.snippets +++ b/.vim/mysnippets/tex.snippets @@ -187,6 +187,14 @@ snippet ... "elpises" iA \ldots endsnippet +snippet big) "Big paren" w +\left( $1 \right) $0 +endsnippet + +snippet big| "Big abs" w +\left| $1 \right| $0 +endsnippet + # text snippet span "Span" w \text{span}($0) diff --git a/.vimrc b/.vimrc index 62c1fb4..ade2675 100644 --- a/.vimrc +++ b/.vimrc @@ -23,11 +23,6 @@ let &t_EI = "\[2 q" "normal mode let &t_SI = "\[6 q" "insert mode let &t_SR = "\[4 q" "replace mode -" spell check -setlocal spell -set spelllang=en_us -set spellcapcheck= - " conceal set conceallevel=2 @@ -44,9 +39,17 @@ let g:netrw_liststyle = 3 let g:netrw_banner = 0 let g:netrw_winsize = 25 +" spell check +setlocal spell +set spelllang=en_us +set spellcapcheck= + +" accept first spell check fix +map z 1z= + " View whitespace map s :set list! -set lcs=space:· +set listchars=tab:▸\ ,space:·,eol:¬ " colors hi Conceal ctermbg=Black @@ -65,7 +68,7 @@ function! StatusModeColor() else hi StatusLine cterm=None gui=None ctermfg=black ctermbg=DarkGrey endif - + return '' endfunction diff --git a/Scripts/emote_format b/Scripts/emote_format new file mode 100755 index 0000000..6945e36 --- /dev/null +++ b/Scripts/emote_format @@ -0,0 +1,7 @@ +#!/bin/sh + +# format images to be discord size + +mv "$1" "$1_temp" && \ + ffmpeg -i "$1_temp" -vf scale=48:-1 "$1" && \ + rm "$1_temp" diff --git a/Scripts/emoter b/Scripts/emoter new file mode 100755 index 0000000..c7f199e --- /dev/null +++ b/Scripts/emoter @@ -0,0 +1,17 @@ +#!/bin/sh + +emote_dir="$HOME/Downloads/emotes" + +mode="image/png" +[ "$1" = "-g" ] && mode="image/gif" + +emote_name="$(ls $emote_dir | grep -E '\.png$|\.jpeg$|\.jpg' | dmenu)" +[ ! -f "$emote_dir/$emote_name" ] && exit 0 + +echo "$emote_dir/$emote_name" | \ + xargs xclip -selection clipboard -t "$mode" -i + +# now paste the image +xdotool getactivewindow key ctrl+v +xdotool getactivewindow key --delay 250 KP_Enter + diff --git a/Scripts/statusbar/blocks_bat b/Scripts/statusbar/blocks_bat index f785cdf..d5e8e51 100755 --- a/Scripts/statusbar/blocks_bat +++ b/Scripts/statusbar/blocks_bat @@ -1,6 +1,11 @@ #!/bin/sh bat="$(cat /sys/class/power_supply/BAT0/capacity)" +stat="$(cat /sys/class/power_supply/BAT0/status)" + +status="?" +[ "$stat" = "Charging" ] && status="C" +[ "$stat" = "Discharging" ] && status="D" icon="" [ $bat -gt "13" ] && icon="" @@ -8,4 +13,4 @@ icon="" [ $bat -gt "63" ] && icon="" [ $bat -gt "88" ] && icon="" -echo "$icon $bat%" +echo "$icon $status$bat%" diff --git a/Scripts/vish b/Scripts/vish new file mode 100755 index 0000000..6587c34 --- /dev/null +++ b/Scripts/vish @@ -0,0 +1,7 @@ +#!/bin/sh + +## creates a new shell script and chmods it + +[ -f "$1" ] && echo "File already exists, aborting" && return 1 + +echo '#!/bin/sh' > "$1" && chmod +x "$1" && $EDITOR "$1"