dotfiles

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

commit 01c9f41d97c8230e7a33a08bd2f2147cc18cc027
parent 9b0f7da955be9429db01a2c70665e987dba5e313
Author: hhvn <dev@hhvn.uk>
Date:   Sat, 24 Apr 2021 11:39:56 +0100

clean out /bin/bash

Diffstat:
D.scripts/bin/crefresh | 4----
D.scripts/bin/dbrowse | 3---
D.scripts/bin/dfm | 268-------------------------------------------------------------------------------
D.scripts/bin/dmpv | 13-------------
M.scripts/bin/dmpvurl | 2+-
D.scripts/bin/ffflaunch | 13-------------
D.scripts/bin/hlock | 39---------------------------------------
M.scripts/bin/hmpv | 8++++----
D.scripts/bin/mpvlisten | 26--------------------------
M.scripts/bin/mpvrcp-keys | 4++--
M.scripts/bin/sxhkdrestart | 2+-
D.scripts/bin/terminalimg | 81-------------------------------------------------------------------------------
D.scripts/bin/trimfiles | 20--------------------
M.scripts/bin/wallblur | 2+-
M.scripts/bin/wallp | 2+-
D.scripts/bin/wallvar | 9---------
16 files changed, 10 insertions(+), 486 deletions(-)

diff --git a/.scripts/bin/crefresh b/.scripts/bin/crefresh @@ -1,4 +0,0 @@ -#!/bin/bash - -sleep 0.1 -pkill picom; picom --config ~/.config/picom/config -b -f diff --git a/.scripts/bin/dbrowse b/.scripts/bin/dbrowse @@ -1,3 +0,0 @@ -#!/bin/bash - -dfm $1 ~/general/documents diff --git a/.scripts/bin/dfm b/.scripts/bin/dfm @@ -1,268 +0,0 @@ -#!/bin/bash -# -# dfm - Hayden's Dmenu File Manager -# Created by Hayden Hamilton -# -# hayden@haydenvh.com -# Copyright (c) 2019-2020 Hayden Hamilton. -# - -if [ "$(echo $1 | awk '/help/ {print}')" != "" ] -then - echo "dfm <fm for standard mode/name of program for file-selection> </path/to/dir - enter at start> -$(tput bold)CONFIG:$(tput sgr0) -DFM_CONF_DIR=[insert /path/to/confdir] <-- Default: $HOME/.config/dfm -DFM_DOT=[0/1 to show dotfiles] <-- Default: 1 -DFM_USE_HH_PATCH=[0/1 to use the patched dmenu from haydenvh.com] <-- Default: 0 -DFM_DISABLE_ENQUEUE=[0/1 to never enqueue input] <-- Default: 0 -DFM_SCREENSHOT_CMD=\"[insert program name]\" <-- Default: \"maim -s\" -DFM_CLIPBOARD_TYPE=\"[PRIMARY/CLIPBOARD/CUSTOM]\" <-- Default: \"PRIMARY\" -DFM_CLIPBOARD_CUSTOM=\"[insert program for clipboard]\" <-- Default: \"xclip\" -$(tput bold)CONFIGURING COMMANDS FOR FILE TYPES:$(tput sgr0) Syntax - DFM_FILETYPE_[insert filetype in all caps]=\"[insert program name]\" - ^ For example, .mkv is MKV ^ For example mpv -When in standard file management mode, you will now get the option to automatically select a program to launch. -Written by Hayden Hamilton <haydenvh.com>" - exit 0 -fi - -forn1="$1" -lsforce="$3" -if [ "$1" = "" ] -then - export forn1="fm" -fi - -getconf(){ - dmenu="dmenu" - DFM_SCREENSHOT_CMD="maim -s" - DFM_CONF_DIR="$HOME/.config/dfm" - DFM_CLIPBOARD_CUSTOM="xclip" - DFM_CLIPBOARD_TYPE="PRIMARY" - . $HOME/.dmenurc - . $HOME/.config/dfm/config - if [ "$DFM_USE_HH_PATCH" = "1" ] - then - dmenu="$dmenu -c -w 1000" - fi - if [ "$DFM_CLIPBOARD_TYPE" = "PRIMARY" ] - then - clipboard="xclip" - elif [ "$DFM_CLIPBOARD_TYPE" = "CLIPBOARD" ] - then - clipboard="xclip -selection clipboard" - elif [ "$DFM_CLIPBOARD_TYPE" = "CUSTOM" ] - then - clipboard="$DFM_CLIPBOARD_CUSTOM" - else - clipboard="xclip" - fi - echo $clipboard - confdir="$DFM_CONF_DIR" - conffile="$confdir/config" -} - -makeconfdir(){ - [ ! -d $confdir ] && mkdir -p $confdir - [ ! -f $conffile ] && touch $conffile -} - -sendconf(){ - varname="$1" - varcont="$2" - makeconfdir - [ -f $conffile ] && sed -i "/${varname}/d" $conffile - echo "${varname}=\"${varcont}\"" >> $conffile - . $conffile -} - -fmornorm(){ - if [ "$forn1" = "fm" ] - then - output2=$(echo "$fmcmd2" | $dmenu -l 30 -i -p "Select command:") - fmspecial - else - dooutput - if [ "$doarg" = "true" ] - then - echo $forn1 - $forn1 $argu - argu="" - fi - fi -} - -dooutput(){ - [ "$DFM_DISABLE_ENQUEUE" != "1" ] && enqueue=$(echo "DO ENQUEUE" | tr " " "\n" | $dmenu -i -p "What do you want to do?") - if [ "$enqueue" = "ENQUEUE" ] - then - argu+="$(pwd)/$output " - doarg="false" - else - argu+="$(pwd)/$output " - doarg="true" - fi -} - -getdot(){ - if [ "$lsforce" != "" ] - then - lscommand="$lsforce" - elif [ "$DFM_DOT" = "1" ] - then - lscommand="ls -A" - elif [ "$DFM_DOT" = "0" ] - then - lscommand="ls" - else - lscommand="ls -A" - fi -} - -getprog(){ - varout=$(echo "$1" | sed 's/\./ /g' | tr '[:lower:]' '[:upper:]' | awk '// {print $NF}' | sed 's/^/DFM_FILETYPE_/g') - commandout=${!varout} -} - -send0x0(){ - send=$(curl -F "file=@$output" https://0x0.st) - send2=$(echo "$send" | awk '/http/') - [ "$send2" = "" ] && echo "Failed" | $dmenu -i -p "Hit enter to continue" - [ "$send2" != "" ] && echo $send | $dmenu -i -p "Hit enter to continue" | $clipboard -} - -sendscrn0x0(){ - output="/tmp/ss" - $DFM_SCREENSHOT_CMD > /tmp/ss && send0x0 -} - -fmspecial(){ - if [ "$output2" = "AUTO - Check config for program to use" ] - then - getprog "$output" - [ "$commandout" != "" ] && $commandout $output $argu - [ "$commandout" = "" ] && echo "No program set..." - elif [ "$output2" = "RM - Remove file" ] - then - rm $output - elif [ "$output2" = "CMD - Specific command" ] - then - output3=$(dmenu_path | $dmenu -i -p "Select program") - $output3 $output $argu - argu="" - elif [ "$output2" = "MV - Move file" ] - then - output3=$(echo "" | $dmenu -i -p "Move to:") - mv $output $output3 - elif [ "$output2" = "EDIT - Open with $EDITOR" ] - then - $EDITOR $output $argu - argu="" - elif [ "$output2" = "QUE - Enqueue" ] - then - argu+="$output " - elif [ "$output2" = "SND - Send to 0x0.st" ] - then - send0x0 - fi -} - -cd $2 -while true -do - getconf - getdot - output=$(echo "FM * .. $($lscommand)" | tr "\n" " " | tr " " "\n" | $dmenu -l 30 -i -p "Select file/directory:") - fmcmd1="CCL - CANCEL -MD - Make dir -MF - Make file -BM - Bookmarks -FND - Find -HIDE - Toggle Dotfiles -SCRN - Host screenshot on 0x0.st" - fmcmd2="AUTO - Check config for program to use -CCL - CANCEL -MV - Move file -RM - Remove file -CMD - Specific command -EDIT - Open with $EDITOR -QUE - Enqueue -SND - Send to 0x0.st" - if [ "$output" = "FM" ] - then - output=$(echo "$fmcmd1" | $dmenu -l 30 -i -p "Select command:") - if [ "$output" = "MD - Make dir" ] - then - output2=$(echo "" | $dmenu -i -p "Name dir:") - mkdir $output2 - elif [ "$output" = "MF - Make file" ] - then - output2=$(echo "" | $dmenu -i -p "Name file:") - touch $output2 - elif [ "$output" = "BM - Bookmarks" ] - then - touch ~/.config/dfm/bookmarks - output=$(echo "MK DEL $(cat ~/.config/dfm/bookmarks | awk '// {print $1}')" | tr "\n" " " | tr " " "\n" | $dmenu -l 30 -i -p "Select file/directory:") - if [ "$output" = "MK" ] - then - output=$(echo "" | $dmenu -i -p "Choose bookmark name(no spaces):") - output2=$(echo "" | $dmenu -i -p "Choose bookmark path(absolute):") - echo "$output $output2" >> ~/.config/dfm/bookmarks - elif [ "$output" = "DEL" ] - then - output=$(echo "$(cat $confdir/bookmarks | awk '// {print $1}')" | $dmenu -l 30 -i -p "Select bookmark to delete:") - [ "$(cat $confdir/bookmarks | awk "/$output/ {print"' $1}')" = "$output" ] && sed -i "/$output/d" $confdir/bookmarks - else - output=$(cat ~/.config/dfm/bookmarks | awk "/$output/"' {print $2}') - output2=$(echo "$fmcmd2" | $dmenu -l 30 -i -p "Select command:") - fmspecial - fi - elif [ "$output" = "FND - Find" ] - then - output=$(echo "" | $dmenu -i -p "Enter name of file:") - output2=$(printf "ROOT (Takes a while)\nLOCALLY" | $dmenu -i -p "Find option") - if [ "$(echo $output2 | awk '/ROOT/')" != "" ] - then - echo "May take a while..." - output3="/" - else - output3="." - fi - output=$(echo "NONE $(find $output3 | grep -i "$output")" | tr " " "\n" | $dmenu -i -l 30 -p "Select file:") - if [ "$output" = "NONE" ] - then - echo > /dev/null - else - fmornorm - fi - elif [ "$output" = "HIDE - Toggle Dotfiles" ] - then - if [ "$DFM_DOT" = "0" ] - then - export DFM_DOT="1" - sendconf "DFM_DOT" "1" - elif [ "$DFM_DOT" = "1" ] - then - export DFM_DOT="0" - sendconf "DFM_DOT" "0" - else - export DFM_DOT="0" - sendconf "DFM_DOT" "0" - fi - elif [ "$output" = "SCRN - Host screenshot on 0x0.st" ] - then - sendscrn0x0 - fi - elif [ -d "$output" ] - then - cd $output - elif [ "$output" = "exit" ] - then - exit 1 - elif [ "$output" = "" ] - then - exit 1 - else - fmornorm - fi -done diff --git a/.scripts/bin/dmpv b/.scripts/bin/dmpv @@ -1,13 +0,0 @@ -#!/bin/bash -dmenu="dmenu" -. $HOME/.dmenurc - -if [ "$5" = "fuzz" ] -then - com="find" -else - com="ls" -fi - -hmpv pause $3 -dfm "mpv --input-ipc-server=$2 $4" ~/$1 $com dotspace diff --git a/.scripts/bin/dmpvurl b/.scripts/bin/dmpvurl @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # dmenu/dmpvurl socket="$1" diff --git a/.scripts/bin/ffflaunch b/.scripts/bin/ffflaunch @@ -1,13 +0,0 @@ -#!/bin/bash - -. ~/.ls_colors - -export FFF_LS_COLORS=1 -export FFF_COL2=5 -export FFF_COL4=8 - -export FFF_FAV1=~/work -export FFF_FAV2=~/.wallpapers -export FFF_FAV3=~/music - -fff diff --git a/.scripts/bin/hlock b/.scripts/bin/hlock @@ -1,39 +0,0 @@ -#!/bin/bash -# -# hlock -# Created by Hayden Hamilton -# -# hayden@haydenvh.com -# Copyright (c) 2019-2020 Hayden Hamilton. -# -image="/tmp/screen.png" -locker="i3lock -i" - -while getopts ":n:i:l:h:b:p:r" o; do case "${o}" in - i) image=${OPTARG} ;; - r) resolution=${OPTARG} ;; - b) blur=${OPTARG} ;; - p) locker=${OPTARG} ;; - n) convert="off" ;; - h) printf "Specify an image with -i, resolution with -r, imagemagick effects with -b, and the program used for locking with -p." ;; -esac done - -if [ "$convert" = "off" ] -then - echo "All image manipulation off..." - if [ "$image" = "" ] - then - echo "No image, please specify one..." - exit 1 - fi - echo "Getting image..." - cp $image /tmp/screen.png -else - res=$(xrandr | grep 'current' | sed -E 's/.*current\s([0-9]+)\sx\s([0-9]+).*/\1x\2/') - convert -size 320x85 canvas:none -pointsize 72 -draw "text 25,60 'Locked...'" -channel RGBA -blur 0x6 -fill white -stroke white -draw "text 20,55 'Locked...'" /tmp/lock.png - echo "Resizing & blurring..." - ffmpeg -f x11grab -video_size $res -y -i $DISPLAY -i /tmp/lock.png -filter_complex "boxblur=8:1,overlay=(main_w-overlay_w)/12:(main_h-overlay_h)/2" -vframes 1 /tmp/screen.png -loglevel quiet - convert /tmp/screen.png $blur /tmp/screen.png -fi -echo "Locking..." -$locker /tmp/screen.png -t diff --git a/.scripts/bin/hmpv b/.scripts/bin/hmpv @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # hmpv # Created by Hayden Hamilton @@ -56,9 +56,9 @@ seek() { fi } convertsecs() { - ((h=${1}/3600)) - ((m=(${1}%3600)/60)) - ((s=${1}%60)) + h=$((${1}/3600)) + m=$(((${1}%3600)/60)) + s=$((${1}%60)) printf "%02d:%02d:%02d\n" $h $m $s } gettime() { diff --git a/.scripts/bin/mpvlisten b/.scripts/bin/mpvlisten @@ -1,26 +0,0 @@ -#!/bin/bash -socket1="$1" -socket2="$2" -apause="false" - -while true -do - state=$(hmpv state $socket1) - sleep 0.1 - if [ "$state" = "playing" ] - then - if [ "$aplay" = "false" ] - then - hmpv pause $socket2 2>/dev/null >/dev/null - apause="false" - aplay="true" - fi - else - if [ "$apause" = "false" ] - then - hmpv unpause $socket2 2>/dev/null >/dev/null - apause="true" - aplay="false" - fi - fi -done diff --git a/.scripts/bin/mpvrcp-keys b/.scripts/bin/mpvrcp-keys @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh trap 'drawgui' 28 #SIGWINCH trap 'stty icanon' 2 #SIGINT @@ -32,7 +32,7 @@ drawgui(){ stty -icanon getchar(){ drawgui - key=$(dd bs=1 count=1 2>/dev/null) + key=$(dd if=/dev/stdin bs=1 count=1 2>/dev/null) } while getchar diff --git a/.scripts/bin/sxhkdrestart b/.scripts/bin/sxhkdrestart @@ -1,3 +1,3 @@ -#!/bin/bash +#!/bin/sh pkill -SIGUSR1 sxhkd diff --git a/.scripts/bin/terminalimg b/.scripts/bin/terminalimg @@ -1,81 +0,0 @@ -#!/bin/bash - -trap 'tput cnorm' 2 - -[ -f /usr/lib/w3m/w3mimgdisplay ] && w3m="/usr/lib/w3m/w3mimgdisplay" -[ -f /usr/loca/lib/w3m/w3mimgdisplay ] && w3m="/usr/local/lib/w3m/w3mimgdisplay" - -LINES=$(tput lines) -HEIGHT=$(tput cols) - -display(){ - clear - image="$1" - IFS=$'\n' read -d "" -ra win_info \ - < <(xdotool getactivewindow getwindowgeometry --shell) - - export "${win_info[@]}" &>/dev/null - - echo $w3m - exit 1 - read -r img_width img_height <("$w3m" <<< "5;$image") - - ((HEIGHT=HEIGHT-HEIGHT*5/LINES)) - - ((img_width > WIDTH)) && { - ((img_height=img_height*WIDTH/img_width)) - ((img_width=WIDTH)) - }; - - ((img_height > HEIGHT)) && { - ((img_width=img_width*HEIGHT/img_height-40)) - ((img_height=HEIGHT-40)) - }; - - str="$(tput setaf 10)$(tput setab 0)$image | ${number}/${#array[@]}$(tput sgr0)" - length=$(printf "$str" | wc -c) - printf "$(tput sgr0)" - col=$(tput cols) - tput setab 0; tput cup $LINES 0 - for void in $(seq $col) - do - printf " " - done - tput cup $LINES 5 - printf "$str" - printf '0;1;%s;%s;%s;%s;;;;;%s\n3;\n4\n' \ - "0" \ - "0" \ - "$img_width" \ - "$img_height" \ - "$image" | "$w3m" &>/dev/null -} - -input=$(tr " " "\n" < /dev/stdin) -IFS=$'\n' -array=( $input ) -unset IFS -number="0" -tput civis - -display ${array[$number]} -clear -while true -do - read -rsn 1 -t 10000 key < /dev/tty - [ "$key" = "k" ] || [ "$key" = "l" ] &&{ - number=$(($number+1)) - display ${array[$number]} - }; [ "$key" = "j" ] || [ "$key" = "h" ] || [ "$key" = " " ] || [ "$key" = '\b' ] &&{ - number=$(($number-1)) - display ${array[$number]} - }; [ "$key" = "q" ] && { - tput cnorm - exit 1 - }; [ "$key" = "0" ] && { - number=0 - display ${array[$number]} - }; [ "$key" = "r" ] && { - display ${array[$number]} - }; -done diff --git a/.scripts/bin/trimfiles b/.scripts/bin/trimfiles @@ -1,20 +0,0 @@ -#!/bin/bash -# -# trimfiles -# Created by Hayden Hamilton -# -# hayden@haydenvh.com -# Copyright (c) 2019 Hayden Hamilton. - -bkp=$(pwd) - -IFS=$'\n' -for d in $(find . -type d) -do - cd $d - for f in $(find . -maxdepth 1 -type f) - do - mv "$f" $(echo "$f" | tr " " ".") - done - cd $bkp -done diff --git a/.scripts/bin/wallblur b/.scripts/bin/wallblur @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # wallblur # Created by Hayden Hamilton diff --git a/.scripts/bin/wallp b/.scripts/bin/wallp @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # wallp # Created by Hayden Hamilton diff --git a/.scripts/bin/wallvar b/.scripts/bin/wallvar @@ -1,9 +0,0 @@ -#!/bin/bash -dir="$1" -time="$2" - -while true -do - sleep $time - rfeh $dir -done