Merge pull request #2 from richard134/origin/richard

Origin/richard
This commit is contained in:
richard134 2019-02-03 16:29:58 +01:00 committed by GitHub
commit 4a084542e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 76 additions and 71 deletions

31
.aliasrc Normal file
View File

@ -0,0 +1,31 @@
#!/bin/sh
alias ka="killall" \
mpv="mpv --input-ipc-server=/tmp/mpvsoc$(date +%s)" \
magit="nvim -c Magit" \
p="sudo pacman" \
SS="sudo systemctl" \
f="vifm" \
g="git" \
trem="transmission-remote" \
e="$EDITOR" \
v="$EDITOR" \
x="sxiv -ft *" \
sdn="sudo shutdown -h now" \
gua="git remote | xargs -L1 git push --all" \
ls="ls -hN --color=auto --group-directories-first" \
grep="grep --color=auto" \
diff="diff --color=auto" \
ccat="highlight --out-format=ansi" \
yt="youtube-dl --add-metadata -i -o '%(upload_date)s-%(title)s.%(ext)s'" \
yta="yt -x -f bestaudio/best" \
YT="youtube-viewer" \
ref="shortcuts >/dev/null; source ~/.shortcuts" \
upc="sudo pacman -Syu; pkill -RTMIN+8 i3blocks" \
lsp="pacman -Qett --color=always | less"
command -v nvim >/dev/null && alias vimdiff="nvim -d" # Use neovim for vimdiff if present.
shdl() { curl -O $(curl -s http://sci-hub.tw/"$@" | grep location.href | grep -o http.*pdf) ;}
se() { du -a ~/.scripts/* ~/.config/* | awk '{print $2}' | fzf | xargs -r $EDITOR ;}
sv() { vcopy "$(du -a ~/.scripts/* ~/.config/* | awk '{print $2}' | fzf)" ;}
vf() { fzf | xargs -r -I % $EDITOR % ;}

40
.bashrc
View File

@ -5,42 +5,4 @@ HISTSIZE= HISTFILESIZE= # Infinite history.
export PS1="\[$(tput bold)\]\[$(tput setaf 1)\][\[$(tput setaf 3)\]\u\[$(tput setaf 2)\]@\[$(tput setaf 4)\]\h \[$(tput setaf 5)\]\W\[$(tput setaf 1)\]]\[$(tput setaf 7)\]\\$ \[$(tput sgr0)\]" export PS1="\[$(tput bold)\]\[$(tput setaf 1)\][\[$(tput setaf 3)\]\u\[$(tput setaf 2)\]@\[$(tput setaf 4)\]\h \[$(tput setaf 5)\]\W\[$(tput setaf 1)\]]\[$(tput setaf 7)\]\\$ \[$(tput sgr0)\]"
[ -f "$HOME/.shortcuts" ] && source "$HOME/.shortcuts" # Load shortcut aliases [ -f "$HOME/.shortcuts" ] && source "$HOME/.shortcuts" # Load shortcut aliases
[ -f "$HOME/.aliasrc" ] && source "$HOME/.aliasrc"
# System Maintainence
alias mw="~/.config/mutt/mutt-wizard.sh"
alias sdn="sudo shutdown now"
alias psref="gpg-connect-agent RELOADAGENT /bye" # Refresh gpg
alias gua="git remote | xargs -L1 git push --all"
# Some aliases
alias e="$EDITOR"
alias p="sudo pacman"
alias SS="sudo systemctl"
alias v="$EDITOR"
alias f="vifm"
alias r="ranger"
alias sr="sudo ranger"
alias ka="killall"
alias g="git"
alias trem="transmission-remote"
alias mkd="mkdir -pv"
alias ref="shortcuts >/dev/null ; source ~/.bashrc" # Refresh shortcuts manually and reload bashrc
alias mpv="mpv --input-ipc-server=/tmp/mpvsoc$(date +%s)"
alias x="sxiv -ft *"
alias lsp="pacman -Qett --color=always | less"
# Adding color
alias ls='ls -hN --color=auto --group-directories-first'
alias grep="grep --color=auto"
alias diff="diff --color=auto"
alias ccat="highlight --out-format=ansi" # Color cat - print file with syntax highlighting.
# Internet
alias yt="youtube-dl --add-metadata -i" # Download video link
alias yta="yt -x -f bestaudio/best" # Download only audio
alias YT="youtube-viewer"
shdl() { curl -O $(curl -s http://sci-hub.tw/"$@" | grep location.href | grep -o http.*pdf) ;}
se() { du -a ~/.scripts/* ~/.config/* | awk '{print $2}' | fzf | xargs -r $EDITOR ;}
sv() { vcopy "$(du -a ~/.scripts/* ~/.config/* | awk '{print $2}' | fzf)" ;}
vf() { fzf | xargs -r -I % $EDITOR % ;}

View File

@ -1,22 +1,17 @@
bf ~/.bmfiles bf ~/.bmfiles
bd ~/.bmdirs bd ~/.bmdirs
cfb ~/.bashrc cfb ~/.bashrc
cfa ~/.aliasrc
cfz ~/.zshrc cfz ~/.zshrc
cfv ~/.vimrc cfv ~/.config/nvim/init.vim
cfr ~/.config/ranger/rc.conf cfr ~/.config/ranger/rc.conf
cfi ~/.config/i3/config cfi ~/.config/i3/config
cfq ~/.config/qutebrowser/config.py
cfm ~/.config/mutt/muttrc cfm ~/.config/mutt/muttrc
cft ~/.config/termite/config
eb ~/Documents/LaTeX/uni.bib eb ~/Documents/LaTeX/uni.bib
cv ~/Documents/LaTeX/cv.tex cv ~/Documents/LaTeX/cv.tex
cfp ~/.config/polybar/config
cfd ~/.Xdefaults cfd ~/.Xdefaults
cfu ~/.config/newsboat/urls cfu ~/.config/newsboat/urls
cfn ~/.config/newsboat/config cfn ~/.config/newsboat/config
cfA ~/.asoundrc
cfmb ~/.config/ncmpcpp/bindings cfmb ~/.config/ncmpcpp/bindings
cfmc ~/.config/ncmpcpp/config cfmc ~/.config/ncmpcpp/config
cfmpd ~/.config/mpd/mpd.conf
cfM ~/.config/mpd/mpd.conf
er ~/.referbib er ~/.referbib

View File

@ -44,6 +44,8 @@ for_window [instance="dropdown_dropdowncalc"] border pixel 2
for_window [instance="dropdown_*"] move position center for_window [instance="dropdown_*"] move position center
# #---Starting External Scripts---# # # #---Starting External Scripts---# #
# mpd startup
exec --no-startup-id mpd
# Setting the background: # Setting the background:
exec --no-startup-id setbg exec --no-startup-id setbg
# Starts dunst for notifications: # Starts dunst for notifications:
@ -56,8 +58,6 @@ exec --no-startup-id remaps
exec --no-startup-id unclutter exec --no-startup-id unclutter
# Run the script to update the mpd i3block on change. # Run the script to update the mpd i3block on change.
exec_always --no-startup-id mpdupdate exec_always --no-startup-id mpdupdate
# mpd startup
exec --no-startup-id mpd
# Podboat automatic queue and download # Podboat automatic queue and download
exec_always --no-startup-id podentr exec_always --no-startup-id podentr

View File

@ -28,7 +28,7 @@ set clipboard=unnamedplus
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
" Goyo plugin makes text more readable when writing prose: " Goyo plugin makes text more readable when writing prose:
map <leader>f :Goyo \| set linebreak<CR> map <leader>f :Goyo \| set bg=light \| set linebreak<CR>
" Spell-check set to <leader>o, 'o' for 'orthography': " Spell-check set to <leader>o, 'o' for 'orthography':
map <leader>o :setlocal spell! spelllang=en_us<CR> map <leader>o :setlocal spell! spelllang=en_us<CR>
@ -40,6 +40,13 @@ set clipboard=unnamedplus
map <C-n> :NERDTreeToggle<CR> map <C-n> :NERDTreeToggle<CR>
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
" vimling:
nm <leader>d :call ToggleDeadKeys()<CR>
imap <leader>d <esc>:call ToggleDeadKeys()<CR>a
nm <leader>i :call ToggleIPA()<CR>
imap <leader>i <esc>:call ToggleIPA()<CR>a
nm <leader>q :call ToggleProse()<CR>
" Shortcutting split navigation, saving a keypress: " Shortcutting split navigation, saving a keypress:
map <C-h> <C-w>h map <C-h> <C-w>h
map <C-j> <C-w>j map <C-j> <C-w>j
@ -79,7 +86,7 @@ set clipboard=unnamedplus
" Enable Goyo by default for mutt writting " Enable Goyo by default for mutt writting
" Goyo's width will be the line limit in mutt. " Goyo's width will be the line limit in mutt.
autocmd BufRead,BufNewFile /tmp/neomutt* let g:goyo_width=80 autocmd BufRead,BufNewFile /tmp/neomutt* let g:goyo_width=80
autocmd BufRead,BufNewFile /tmp/neomutt* :Goyo autocmd BufRead,BufNewFile /tmp/neomutt* :Goyo \| set bg=light
" Automatically deletes all trailing whitespace on save. " Automatically deletes all trailing whitespace on save.
autocmd BufWritePre * %s/\s\+$//e autocmd BufWritePre * %s/\s\+$//e
@ -97,7 +104,7 @@ set clipboard=unnamedplus
"""LATEX """LATEX
" Word count: " Word count:
autocmd FileType tex map <leader><leader>o :w !detex \| wc -w<CR> autocmd FileType tex map <leader>w :w !detex \| wc -w<CR>
" Code snippets " Code snippets
autocmd FileType tex inoremap ,fr \begin{frame}<Enter>\frametitle{}<Enter><Enter><++><Enter><Enter>\end{frame}<Enter><Enter><++><Esc>6kf}i autocmd FileType tex inoremap ,fr \begin{frame}<Enter>\frametitle{}<Enter><Enter><++><Enter><Enter>\end{frame}<Enter><Enter><++><Esc>6kf}i
autocmd FileType tex inoremap ,fi \begin{fitch}<Enter><Enter>\end{fitch}<Enter><Enter><++><Esc>3kA autocmd FileType tex inoremap ,fi \begin{fitch}<Enter><Enter>\end{fitch}<Enter><Enter><++><Esc>3kA

View File

@ -2,6 +2,10 @@ $include /etc/inputrc
set editing-mode vi set editing-mode vi
$if mode=vi $if mode=vi
set show-mode-in-prompt on
set vi-ins-mode-string \1\e[6 q\2
set vi-cmd-mode-string \1\e[2 q\2
set keymap vi-command set keymap vi-command
# these are for vi-command mode # these are for vi-command mode
Control-l: clear-screen Control-l: clear-screen

View File

@ -172,7 +172,7 @@ Naturally, you can use \f(CWyay\fP to look for and install any you want to add.
.ITEM .ITEM
\f(CWMod+w\fP \(en nmtui (for connecting to wireless internet) \f(CWMod+w\fP \(en nmtui (for connecting to wireless internet)
.ITEM .ITEM
\f(CWMod+a\fP \(en R/Python calculator (hide with \f(CWmod+a\fP) \f(CWMod+a\fP \(en Dropdown calculator (hide with \f(CWmod+a\fP)
.ITEM .ITEM
\f(CWMod+i\fP \(en htop (system info) \f(CWMod+i\fP \(en htop (system info)
.ITEM .ITEM
@ -258,7 +258,7 @@ I use ncmpcpp as a music player, which is a front end for mpd.
.ITEM .ITEM
\f(CWMod+]\fP \(en Forward 10 seconds (holding shift increases amount) \f(CWMod+]\fP \(en Forward 10 seconds (holding shift increases amount)
.ITEM .ITEM
\f(CWMod+A\fP \(en ncpamixer (general volume sink/source control) \f(CWMod+A\fP \(en pulsemixer (general volume sink/source control)
.LIST OFF .LIST OFF
.HEADING 2 "Workspaces" .HEADING 2 "Workspaces"
.PP .PP
@ -287,9 +287,9 @@ All of these recording shortcuts will output into \f(CW~\fP, and will not overwr
previous recordings as their names are based on their exact times. previous recordings as their names are based on their exact times.
.LI .LI
.ITEM .ITEM
\f(CWPrintScreen\fP \(en Take a scrot screenshot \f(CWPrintScreen\fP \(en Take a screenshot
.ITEM .ITEM
\f(CWShift+PrintScreen\fP \(en Take a scrot screenshot of only selected window \f(CWShift+PrintScreen\fP \(en Select area to screenshot
.ITEM .ITEM
\f(CWMod+PrintScreen\fP \(en Opens dmenu menu to select kind of audio/video recording \f(CWMod+PrintScreen\fP \(en Opens dmenu menu to select kind of audio/video recording
.ITEM .ITEM

View File

@ -34,8 +34,13 @@ twoscreen() { # If multi-monitor is selected and there are two screens.
primary=$(echo "$screens" | dmenu -i -p "Select primary display:") primary=$(echo "$screens" | dmenu -i -p "Select primary display:")
secondary=$(echo "$screens" | grep -v "$primary") secondary=$(echo "$screens" | grep -v "$primary")
direction=$(printf "left\\nright" | dmenu -i -p "What side of $primary should $secondary be on?") direction=$(printf "left\\nright\\nabove\\nbelow" | dmenu -i -p "What side of $primary should $secondary be on?")
xrandr --output "$primary" --auto --scale 1.0x1.0 --output "$secondary" --"$direction"-of "$primary" --auto --scale 1.0x1.0
# xrandr uses -of as ending for left and right
if [ "$direction" = "left" ] || [ "$direction" = "right" ]; then
direction=$(printf "%s-of" "$direction")
fi
xrandr --output "$primary" --auto --scale 1.0x1.0 --output "$secondary" --"$direction" "$primary" --auto --scale 1.0x1.0
fi fi
} }

View File

@ -13,7 +13,7 @@ unmountusb() {
unmountandroid() { \ unmountandroid() { \
chosen=$(awk '/simple-mtpfs/ {print $2}' /etc/mtab | dmenu -i -p "Unmount which device?") chosen=$(awk '/simple-mtpfs/ {print $2}' /etc/mtab | dmenu -i -p "Unmount which device?")
[ -z "$chosen" ] && exit [ -z "$chosen" ] && exit
fusermount -u "$chosen" && pgrep -x dunst && notify-send -i "$PIX/android.svg" "$chosen unmounted." sudo -A umount -l "$chosen" && pgrep -x dunst && notify-send -i "$PIX/android.svg" "$chosen unmounted."
} }
asktype() { \ asktype() { \

View File

@ -1,5 +1,2 @@
#!/bin/sh #!/bin/sh
# This script ensures that i3 will spawn a calculator. ifinstalled bc && echo "Welcome to the Calculator." && bc -lq
# If R is installed, it will run R, otherwise it will run
# Python.
([ -e /usr/bin/R ] && R -q --no-save) || python -q

View File

@ -3,6 +3,16 @@
mpc pause >/dev/null 2>&1 mpc pause >/dev/null 2>&1
pauseallmpv >/dev/null 2>&1 pauseallmpv >/dev/null 2>&1
# If `imagemagick` is not installed, use a colored screen.
[ -f /usr/bin/convert ] &&
rm -f /tmp/locked.png && # remove old lock img
scrot -m -z /tmp/base.png && # Take a screen shot
pgrep -x dunst && notify-send -i ~/.scripts/pix/lock.png "Locking computer..." &&
convert /tmp/base.png -blur 0x8 /tmp/locked.png &&
i3lock -e -f -c 000000 -i /tmp/locked.png
i3lock -e -f -c 1d2021 i3lock -e -f -c 1d2021
# In five seconds, turn off display unless key press in last 4 seconds. # In five seconds, turn off display unless key press in last 4 seconds.

View File

@ -1,8 +1,7 @@
#!/bin/sh #!/bin/sh
[ "$(pgrep -x "$(basename "$0")" | wc -l)" -gt 2 ] && exit [ "$(pgrep -x "$(basename "$0")" | wc -l)" -gt 2 ] && exit
while : ; do sleep 5 && while : ; do
pgrep -x mpd || exit pgrep -x mpd || exit
mpc idle > /dev/null mpc idle > /dev/null
pkill -RTMIN+11 i3blocks ; pkill -RTMIN+11 i3blocks ;

View File

@ -1,14 +1,11 @@
#!/bin/sh #!/bin/sh
# Feed script a url or file location. # Feed script a url or file location.
# If an image, it will view in feh, # If an image, it will view in sxiv,
# if a video or gif, it will view in mpv # if a video or gif, it will view in mpv
# if a music file or pdf, it will download, # if a music file or pdf, it will download,
# otherwise it opens link in browser. # otherwise it opens link in browser.
# Sci-Hub's domain occasionally changes due to shutdowns:
scihub="http://sci-hub.tw/"
# If no url given. Opens browser. For using script as $BROWSER. # If no url given. Opens browser. For using script as $BROWSER.
[ -z "$1" ] && { "$BROWSER"; exit; } [ -z "$1" ] && { "$BROWSER"; exit; }
@ -16,11 +13,9 @@ case "$1" in
*mkv|*webm|*mp4|*youtube.com*|*youtu.be*|*hooktube.com*|*bitchute.com*) *mkv|*webm|*mp4|*youtube.com*|*youtu.be*|*hooktube.com*|*bitchute.com*)
setsid mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) -quiet "$1" >/dev/null 2>&1 & ;; setsid mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) -quiet "$1" >/dev/null 2>&1 & ;;
*png|*jpg|*jpe|*jpeg|*gif) *png|*jpg|*jpe|*jpeg|*gif)
setsid sxiv -a "$1" >/dev/null 2>&1 & ;; curl -sL "$1" > "/tmp/$(echo "$1" | sed "s/.*\///")" && sxiv -a "/tmp/$(echo "$1" | sed "s/.*\///")" >/dev/null 2>&1 & ;;
*mp3|*flac|*opus|*mp3?source*) *mp3|*flac|*opus|*mp3?source*)
setsid tsp curl -LO "$1" >/dev/null 2>&1 & ;; setsid tsp curl -LO "$1" >/dev/null 2>&1 & ;;
*springer.com*)
setsid curl -sO "$(curl -s "$scihub$*" | grep -Po "(?<=location.href=').+.pdf")" >/dev/null 2>&1 & ;;
*) *)
if [ -f "$1" ]; then "$TERMINAL" -e "$EDITOR $1" if [ -f "$1" ]; then "$TERMINAL" -e "$EDITOR $1"
else setsid "$BROWSER" "$1" >/dev/null 2>&1 & fi ;; else setsid "$BROWSER" "$1" >/dev/null 2>&1 & fi ;;