dotfiles

<-- duh.
Log | Files | Refs | LICENSE

commit b1d42361b8f5f5a51595b3c617442a32a0fb6712
parent a5927021261d22de3d6a1a96a766dcc99bfcdaca
Author: Hayden Hamilton <hayden@haydenvh.com>
Date:   Mon, 30 Mar 2020 14:47:24 +0100

organization of some stuff

Diffstat:
A.config/nvim/ftdetect/sxhkd.vim | 1+
A.config/nvim/ftplugin/sxhkd.vim | 19+++++++++++++++++++
A.config/nvim/indent/sxhkd.vim | 31+++++++++++++++++++++++++++++++
M.config/nvim/init.vim | 2+-
A.config/nvim/syntax/sxhkd.vim | 26++++++++++++++++++++++++++
A.config/sxhkd/sxhkdrc | 68++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
M.config/vimb/config | 3+--
M.config/zsh/.zshrc | 5+++--
D.scripts/bash/web.func.sh | 40----------------------------------------
D.scripts/bin/display/cmon | 19-------------------
M.scripts/bin/display/rfeh | 17++++++-----------
R.scripts/bin/dmenu/userinput -> .scripts/bin/dmenu/dinput | 0
A.scripts/bin/dmenu/dmon | 19+++++++++++++++++++
D.scripts/bin/dmenu/dmount | 57---------------------------------------------------------
D.scripts/bin/dmenu/dumount | 40----------------------------------------
R.scripts/bin/i3/crefresh -> .scripts/bin/genman/crefresh | 0
R.scripts/bin/misc/cvrestart -> .scripts/bin/genman/cvrestart | 0
R.scripts/bin/i3/ffflaunch -> .scripts/bin/genman/ffflaunch | 0
R.scripts/bin/i3/hvol -> .scripts/bin/genman/hvol | 0
R.scripts/bin/i3/mpvlisten -> .scripts/bin/genman/mpvlisten | 0
R.scripts/bin/i3/scratcher -> .scripts/bin/genman/scratcher | 0
R.scripts/bin/misc/slock_mod -> .scripts/bin/genman/slock_mod | 0
R.scripts/bin/i3/wallvar -> .scripts/bin/genman/wallvar | 0
D.scripts/bin/i3/locker | 8--------
D.scripts/bin/i3/lockerexit | 27---------------------------
D.scripts/bin/i3/makegrid | 15---------------
D.scripts/bin/i3/moveentire | 9---------
D.scripts/bin/i3/moveone | 5-----
D.scripts/bin/misc/.convf.swp | 0
D.scripts/bin/misc/drefresh | 4----
A.scripts/bin/misc/queuevid | 3+++
M.scripts/bin/misc/urlhand | 5+++--
A.scripts/custom/xrandr | 9+++++++++
D.scripts/input/ttymaps.kmap | 2--
D.xinitrc | 13-------------
M.zprofile | 1+
36 files changed, 191 insertions(+), 257 deletions(-)

diff --git a/.config/nvim/ftdetect/sxhkd.vim b/.config/nvim/ftdetect/sxhkd.vim @@ -0,0 +1 @@ +au BufNewFile,BufRead sxhkdrc set filetype=sxhkd diff --git a/.config/nvim/ftplugin/sxhkd.vim b/.config/nvim/ftplugin/sxhkd.vim @@ -0,0 +1,19 @@ +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +let b:undo_ftplugin = "setl et< sts< fo< com< cms< inc<" + +" Make sure a hard tab is used, required for most make programs +setlocal noexpandtab softtabstop=0 + +" Set 'formatoptions' to break comment lines but not other lines, +" and insert the comment leader when hitting <CR> or using "o". +setlocal fo-=t fo+=croql + +" Set 'comments' to format dashed lists in comments +setlocal com=sO:#\ -,mO:#\ \ ,b:# + +" Set 'commentstring' to put the marker after a #. +setlocal commentstring=#\ %s diff --git a/.config/nvim/indent/sxhkd.vim b/.config/nvim/indent/sxhkd.vim @@ -0,0 +1,31 @@ +if exists("b:did_indent") + finish +endif + +let b:did_indent = 1 + +setlocal indentexpr=GetIndentSXHKD() + +" Only define the function once: +if exists("*GetIndentSXHKD") + finish +endif + +function GetIndentSXHKD() + " Find a non-blank line above the current line: + let lnum = prevnonblank(v:lnum - 1) + + " No indent for the start of the file: + if lnum == 0 + return 0 + endif + + let prev_line = getline(lnum) + if prev_line =~ '^\s*#' + return 0 + elseif prev_line =~ '\v^\s+' + return 0 + else + return &sw + endif +endfunction diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim @@ -173,7 +173,7 @@ ino <Right> <Nop> nnoremap <leader>CS :let @/=''<CR> "Registers -nnoremap y "*y +noremap <c-y> "* "Terminals nnoremap <leader>Tt :vsplit term://zsh<CR><c-h><c-l> diff --git a/.config/nvim/syntax/sxhkd.vim b/.config/nvim/syntax/sxhkd.vim @@ -0,0 +1,26 @@ +if exists("b:current_syntax") + finish +endif + +let b:current_syntax = "sxhkd" + +syntax match sxhkd_binding "\v^.*$" contains=sxhkd_on_release,sxhkd_binding_pass +syntax match sxhkd_on_release "\v^\@" contained +syntax match sxhkd_binding_pass "\v^\~" contained +syntax match sxhkd_exec "\v^\s+.*" contains=@sxhkd_shell +syntax match sxhkd_comment "\v#.*$" + +highlight link sxhkd_comment Comment +highlight link sxhkd_binding Identifier +highlight link sxhkd_binding_on_release Conditional +highlight link sxhkd_binding_pass Constant +highlight link sxhkd_exec Macro + +" match shell command +let s:current_syntax = b:current_syntax +unlet b:current_syntax + +syntax include @sxhkd_shell syntax/sh.vim +let b:current_syntax = s:current_syntax + +syntax region shLine matchgroup=sxhkd_exec start=/\v^\s+\s/ end=/\v$/ contains=@sxhkd_shell diff --git a/.config/sxhkd/sxhkdrc b/.config/sxhkd/sxhkdrc @@ -0,0 +1,68 @@ +super + {shift, ctrl, alt, shift + ctrl} + bracketright + dinput "Are you sure?" "{sudo zzz, sudo ZZZ, sudo halt, sudo reboot}" + +super + return + st + +super + b + tabbed -c vimb -e + +super + shift + b + dmpvurl + +super + ctrl + b + queuevid + +super + c + st -e slock_mod /tmp/mpv-socket /tmp/mpv-socket2 + +super + d + dmenu_run + +super + e + st -e tmux + +super + ctrl + e + rfeh ~/images/wallpapers/ auto right + +super + m + dmon + +super + ctrl + q + rfeh ~/images/wallpapers/ auto left + +super + s + dpass + +super + ctrl + s + maim -s > ~/tmp.png + +super + w + rfeh ~/images/wallpapers/ + +super + ctrl + w + wallblur + +super + alt + w + fehffile ~/.cache/rfeh/prev + +super + ctrl + y + dmpv ~/general/videos/ /tmp/mpv-socket2 /tmp/mpv-socket --fs fuzz + +super + ctrl + u + dmpv ~/general/music/ /tmp/mpv-socket /tmp/mpv-socket2 --no-video fuzz + +super + alt + {y,u} + rmpv ~/general/{videos,music}/ 50 + +super + ctrl + {i,p} + hmpv {back,forward} /tmp/mpv-socket + +super + alt + {i,p} + hmpv {prev,next} /tmp/mpv-socket + +super + {ctrl,alt} + o + hmpv {toggle,quit} /tmp/mpv-socket + +super + bracketright + {0-9} + {,shift} + hvol {0-9}%{-,+} diff --git a/.config/vimb/config b/.config/vimb/config @@ -36,5 +36,4 @@ shortcut-add karta=https://minkarta.lantmateriet.se/ shortcut-add map=https://map.openaerialmap.org/#/ shortcut-add ebay=https://www.ebay.co.uk/sch/$0 shortcut-add am=https://www.amazon.co.uk/s?k=$0 -shortcut-add 8g=https://8kun.top/g/catalog.html -shortcut-add 8b=https://8kun.top/brit/catalog.html +shortcut-add 8=https://8kun.top/$0/catalog.html diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc @@ -5,13 +5,14 @@ mkalias precmd(){ prev="$?" branch=$(git branch 2>/dev/null | grep "\*" | tr -d '\*') - dir=$(pwd | sed "s~$HOME~~") + #dir=$(pwd | sed "s~$HOME~~") + dir=$(pwd) prompt="%{$(tput setab 3)%0G%} %{$(tput sgr0)%0G%} " [ "$prev" != "0" ] && prompt+="%F{10}$prev " prompt+="%F{4}" prompt+="%n" prompt+=" %F{6}" - prompt+="~$dir" + prompt+="$dir" prompt+="%F{5}" prompt+="$branch" prompt+="%F{5}" diff --git a/.scripts/bash/web.func.sh b/.scripts/bash/web.func.sh @@ -1,40 +0,0 @@ -#!/bin/bash - -hostfile() { - if [ "$(echo "$1" | sed 's/ /qqq/g' | awk '/qqq/')" == "" ] - then - name=$(curl -F "file=@$newfile" http://0x0.st) - echo "Your file has been hosted at $name" - else - newfile=$(echo $1 | tr ' ' '.') - mv "$1" $newfile - name=$(curl -F "file=@$newfile" http://0x0.st) - echo "Your file has been hosted at $name" - mv $newfile "$1" &&>/dev/null 2>/dev/null 1>/dev/null - fi -} -rickroll(){ - curl -s -L https://raw.githubusercontent.com/keroseren/rickrollrc/master/roll.sh | bash -} -weather(){ - curl wttr.in/$1 -} -iploc(){ - curl ifconfig.co/$1 -} -getnews(){ - if [ "$1" != "" ] - then - arg=$(echo "$1" | sed 's/ /+/g') - fi - curl getnews.tech/$arg -} -cheatsh(){ - curl cheat.sh/$1 -} -dict(){ - curl "dict://dict.org/d:$1" -} -parrot(){ - curl parrot.live/$1 -} diff --git a/.scripts/bin/display/cmon b/.scripts/bin/display/cmon @@ -1,19 +0,0 @@ -#!/bin/bash - -choice=$(xrandr --listmonitors | tail -n +2 | dmenu -i -p "Choose primary monitor:" | awk '//{print $4}') -cmd="xrandr --output $choice --primary" -while true -do - bchoice="$choice" - choice=$(printf "DONE\nRight\nLeft\nAbove\nBelow" | dmenu -i -p "Add monitor to:") - case $choice in - Right) direction="right-of" ;; - Left) direction="left-of" ;; - Above) direction="above" ;; - Below) direction="below" ;; - DONE) $cmd; exit 0 ;; - esac - choice2=$(xrandr --listmonitors | tail -n +2 | dmenu -i -p "Select monitor:" | awk '//{printf $4}') - cmd="$cmd --output $choice2 --$direction $bchoice" - setup=$(($setup+1)) -done diff --git a/.scripts/bin/display/rfeh b/.scripts/bin/display/rfeh @@ -71,14 +71,9 @@ fi }; echo $files echo $files > $HOME/.cache/rfeh/prev -[ "$backend" = "xwallpaper" ] && { - files=$(echo "$files" | tr " " "\n" | sed "s~^~--output OUTPUT --zoom ~g" | tr "\n" " ") - for OUTPUT in $(xrandr --listactivemonitors | awk '$4 {print $4}') - do - files=$(echo "$files" | sed "s/OUTPUT/$OUTPUT/") - done - xwallpaper $files -} || { - files=$(echo "$files" | tr " " "\n" | sed "s~^~--bg-fill ~g" | tr "\n" " ") - feh $files -} +files=$(echo "$files" | tr " " "\n" | sed "s~^~--output OUTPUT --zoom ~g" | tr "\n" " ") +for OUTPUT in $(xrandr --listactivemonitors | awk '$4 {print $4}') +do + files=$(echo "$files" | sed "s/OUTPUT/$OUTPUT/") +done +xwallpaper $files diff --git a/.scripts/bin/dmenu/userinput b/.scripts/bin/dmenu/dinput diff --git a/.scripts/bin/dmenu/dmon b/.scripts/bin/dmenu/dmon @@ -0,0 +1,19 @@ +#!/bin/bash + +choice=$(xrandr -q | grep "[A-Z]* con" | dmenu -i -p "Choose primary monitor:" | awk '//{print $1}') +cmd="xrandr --output $choice --primary" +while true +do + bchoice="$choice" + choice=$(printf "DONE\nRight\nLeft\nAbove\nBelow" | dmenu -i -p "Add monitor to:") + case $choice in + Right) direction="right-of" ;; + Left) direction="left-of" ;; + Above) direction="above" ;; + Below) direction="below" ;; + DONE) $cmd; exit 0 ;; + esac + choice2=$(xrandr -q | grep "[A-Z]* con" | dmenu -i -p "Select monitor:" | awk '//{print $1}') + cmd="$cmd --output $choice2 --$direction $bchoice" + setup=$(($setup+1)) +done diff --git a/.scripts/bin/dmenu/dmount b/.scripts/bin/dmenu/dmount @@ -1,57 +0,0 @@ -#!/bin/bash -dmenu="dmenu" -. $HOME/.dmenurc - -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." - } - -mountandroid() { \ - chosen=$(echo "$anddrives" | $dmenu -i -p "Which Android device?" | cut -d : -f 1) - getmount "$HOME -maxdepth 3 -type d" - simple-mtpfs --device "$chosen" "$mp" - notify-send "Android Mounting" "Android device mounted to $mp." - } - -asktype() { \ - case $(printf "USB\\nAndroid" | $dmenu -i -p "Mount a USB drive or Android device?") in - USB) mountusb ;; - Android) mountandroid ;; - esac - } - -anddrives=$(simple-mtpfs -l 2>/dev/null) -usbdrives="$(lsblk -rpo "name,type,size,mountpoint" | awk '$2=="part"&&$4==""{printf "%s (%s)\n",$1,$3}')" - -if [ -z "$usbdrives" ]; then - [ -z "$anddrives" ] && echo "No USB drive or Android device detected" && exit - echo "Android device(s) detected." - mountandroid -else - if [ -z "$anddrives" ]; then - echo "USB drive(s) detected." - mountusb - else - echo "Mountable USB drive(s) and Android device(s) detected." - asktype - fi -fi diff --git a/.scripts/bin/dmenu/dumount b/.scripts/bin/dmenu/dumount @@ -1,40 +0,0 @@ -#!/bin/bash -dmenu="dmenu" -. $HOME/.dmenurc - -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." - } - -unmountandroid() { \ - chosen=$(awk '/simple-mtpfs/ {print $2}' /etc/mtab | $dmenu -i -p "Unmount which device?") - [ -z "$chosen" ] && exit - sudo -A umount -l "$chosen" && notify-send "Android unmounting" "$chosen unmounted." - } - -asktype() { \ - case "$(printf "USB\\nAndroid" | $dmenu -i -p "Unmount a USB drive or Android device?")" in - USB) unmountusb ;; - Android) unmountandroid ;; - esac - } - -drives=$(lsblk -nrpo "name,type,size,mountpoint" | awk '$2=="part"&&$4!~/\/boot|\/home$|SWAP/&&length($4)>1{printf "%s (%s)\n",$4,$3}') - -if ! grep simple-mtpfs /etc/mtab; then - [ -z "$drives" ] && echo "No drives to unmount." && exit - echo "Unmountable USB drive detected." - unmountusb -else - if [ -z "$drives" ] - then - echo "Unmountable Android device detected." - unmountandroid - else - echo "Unmountable USB drive(s) and Android device(s) detected." - asktype - fi -fi diff --git a/.scripts/bin/i3/crefresh b/.scripts/bin/genman/crefresh diff --git a/.scripts/bin/misc/cvrestart b/.scripts/bin/genman/cvrestart diff --git a/.scripts/bin/i3/ffflaunch b/.scripts/bin/genman/ffflaunch diff --git a/.scripts/bin/i3/hvol b/.scripts/bin/genman/hvol diff --git a/.scripts/bin/i3/mpvlisten b/.scripts/bin/genman/mpvlisten diff --git a/.scripts/bin/i3/scratcher b/.scripts/bin/genman/scratcher diff --git a/.scripts/bin/misc/slock_mod b/.scripts/bin/genman/slock_mod diff --git a/.scripts/bin/i3/wallvar b/.scripts/bin/genman/wallvar diff --git a/.scripts/bin/i3/locker b/.scripts/bin/i3/locker @@ -1,8 +0,0 @@ -#!/bin/bash -socket1="$1" -socket2="$2" - - -echo "dmpv/rmpv: $(hmpv state $socket1)" > ~/.cache/socket; echo "dmpvurl: $(hmpv state $socket2)" >> ~/.cache/socket -hmpv pause $socket1; sleep 0.1; hmpv pause $socket2; sleep 0.1; hmpv pause $socket2; sleep 0.1; hmpv pause $socket2 -hlock; lockerexit /tmp/mpv-socket2 /tmp/mpv-socket diff --git a/.scripts/bin/i3/lockerexit b/.scripts/bin/i3/lockerexit @@ -1,27 +0,0 @@ -#!/bin/bash -socket1="$1" -socket2="$2" - -i3lock=$(ps -e | grep 'i3lock') -until [ "$i3lock" == "" ] -do - sleep 0.5 - i3lock=$(ps -e | grep 'i3lock') -done - -state=$(cat ~/.cache/socket | awk '/:/') -state1=$(echo "$state" | head -n -1 | awk '{print $2}') -echo $state1 -state2=$(echo "$state" | tail +2 | awk '{print $2}') -echo $state2 - -if [ "$state1" == "playing" ] -then - hmpv unpause $socket1 -elif [ "$state2" == "playing" ] -then - hmpv unpause $socket2 -else - echo "None playing, starting first socket..." - hmpv unpause $socket1 -fi diff --git a/.scripts/bin/i3/makegrid b/.scripts/bin/i3/makegrid @@ -1,15 +0,0 @@ -#!/bin/bash -term="$1" - -i3-msg "split h" -i3-msg "exec $term" -i3-msg "exec $term" -sleep 0.5 -i3-msg "split v" -i3-msg "exec $term" -sleep 0.5 -i3-msg "focus left" -sleep 0.1 -i3-msg "split v" -sleep 0.1 -i3-msg "exec $term" diff --git a/.scripts/bin/i3/moveentire b/.scripts/bin/i3/moveentire @@ -1,9 +0,0 @@ -#!/bin/bash -ws="$1" - -for i in `seq 5` -do -i3-msg focus parent -done -i3-msg move container to workspace $ws -i3-msg workspace $ws diff --git a/.scripts/bin/i3/moveone b/.scripts/bin/i3/moveone @@ -1,5 +0,0 @@ -#!/bin/bash -ws="$1" - -i3-msg move container to workspace "$ws" -i3-msg workspace "$ws" diff --git a/.scripts/bin/misc/.convf.swp b/.scripts/bin/misc/.convf.swp Binary files differ. diff --git a/.scripts/bin/misc/drefresh b/.scripts/bin/misc/drefresh @@ -1,4 +0,0 @@ -#!/bin/sh - -hkill dunst -dunst & diff --git a/.scripts/bin/misc/queuevid b/.scripts/bin/misc/queuevid @@ -0,0 +1,3 @@ +#!/bin/sh + +ts youtube-dl --add-metadata -ic $(xclip -o) diff --git a/.scripts/bin/misc/urlhand b/.scripts/bin/misc/urlhand @@ -1,6 +1,6 @@ #!/bin/bash -link=$(awk '/http/' < /dev/stdin | sed 's/.*http/http/g;s/\[.*\]//g' | awk '{print $1}' | sort | dmenu -i -p "Select a url:") +link=$(awk '/http.:\/\/|gopher:\/\//' < /dev/stdin | sed 's/.*http/http/g;s/.*gopher/gopher/g' | tr -d '<[]>' | awk '{print $1}' | sort | dmenu -i -p "Select a url:") IFS=$'\n' @@ -8,7 +8,8 @@ hand=$(printf "mpv popupmpv youtube-dl --add-metadata -ic youtube-dl --add-metadata -xic -vimb --no-maximize" | dmenu -i -p "Select a handler:") +vimb --no-maximize +xclip" | dmenu -i -p "Select a handler:") pkill mpvlisten hmpv pause /tmp/mpv-socket diff --git a/.scripts/custom/xrandr b/.scripts/custom/xrandr @@ -0,0 +1,9 @@ +#!/bin/sh + +cmons=$(xrandr | grep "[A-Z]* con" | wc -l) + +[ "$cmons" = "3" ] && xrandr --output LVDS1 --off --output VGA1 --primary --output HDMI2 --right-of || +[ "$cmons" = "2" ] && { + mon2=$(xrandr | grep "[A-Z]* con" | sed '/^LVDS/d' | awk '//{print $1}') + xrandr --output $mon2 --primary --output LVDS1 --left-of +} || xrandr --output LVDS1 --primary diff --git a/.scripts/input/ttymaps.kmap b/.scripts/input/ttymaps.kmap @@ -1,2 +0,0 @@ -keycode 1 = Caps_Lock -keycode 58 = Escape diff --git a/.xinitrc b/.xinitrc @@ -1,13 +0,0 @@ -#!/bin/bash - -xrdb ~/.local/xres -setxkbmap haydenh -xsetroot -cursor_name sailboat - -while true; do - dwm -done - -#while true; do -# sowm -#done diff --git a/.zprofile b/.zprofile @@ -42,3 +42,4 @@ export XDG_RUNTIME_DIR=/tmp export XAUTHORITY=$HOME/.local/.xauth export LESSHISTFILE=- export GNUPGHOME=$HOME/.local/gnupg +export XINITRC=$HOME/.config/x11/xinitrc