dotfiles

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

commit 40a8841cbf17f7e2bbc83f6a2ec432450eaaf275
parent 2c2d2f049b5984ee25448418967424c420e89012
Author: Hayden Hamilton <hayden@haydenvh.com>
Date:   Mon, 23 Dec 2019 15:25:42 +0000

Fixed dfm a bit more

Diffstat:
M.bashrc | 0
M.config/irssi/away.log | 2++
M.ls_colors | 0
M.scripts/bin/dmenu/dfm | 46++++++++++++++++++++++++++--------------------
M.scripts/bin/dmenu/dmenurun | 2+-
5 files changed, 29 insertions(+), 21 deletions(-)

diff --git a/.bashrc b/.bashrc diff --git a/.config/irssi/away.log b/.config/irssi/away.log @@ -17,3 +17,5 @@ --- Log closed Sat Dec 21 11:01:32 2019 --- Log opened Mon Dec 23 01:53:33 2019 10:16 #GNU/matrix: 2/ n0a110wg8/ |g ehaydenh: i'd be interested in checking out your dmenu fm tool. and that center patch looks awesome... i wrote a script for managing and connecting to my wireless networks in dmenu, works good for me +12:24 #GNU/matrix: 2/ klausg8/ |g ehaydenh: you do c/cpp ? +--- Log closed Mon Dec 23 12:36:21 2019 diff --git a/.ls_colors b/.ls_colors diff --git a/.scripts/bin/dmenu/dfm b/.scripts/bin/dmenu/dfm @@ -12,8 +12,10 @@ then echo "dfm [fm for standard mode/name of program for file-selection] $(tput bold)CONFIG:$(tput sgr0) -DFM_DOT=\"[0 for no/1 for yes]\" -DFM_USE_HH_PATCH=\"[0 for no/1 to use the patched dmenu from haydenvh.com\" +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 Written by Hayden Hamilton <haydenvh.com>" exit 0 @@ -23,7 +25,9 @@ if [ "$1" == "" ] then export forn1="fm" fi +getconf(){ dmenu="dmenu" +DFM_CONF_DIR="$HOME/.config/dfm" . $HOME/.dmenurc . $HOME/.config/dfm/config if [ "$DFM_USE_HH_PATCH" == "1" ] @@ -31,26 +35,20 @@ then dmenu="$dmenu -c -w 1000" fi -confdir="$HOME/.config/dfm" +confdir="$DFM_CONF_DIR" conffile="$confdir/config" +} makeconfdir(){ - if [ -d $confdir ] - then - echo > /dev/null - else - mkdir -p $confdir - fi + [ ! -d $confdir ] && mkdir -p $confdir + [ ! -f $conffile ] && touch $conffile } sendconf(){ varname="$1" varcont="$2" makeconfdir - if [ -f $conffile ] - then - sed -i "/${varname}/d" $conffile - fi + [ -f $conffile ] && sed -i "/${varname}/d" $conffile echo "${varname}=\"${varcont}\"" >> $conffile . $conffile } @@ -60,18 +58,20 @@ fmornorm(){ then output2=$(echo "$fmcmd2" | $dmenu -l 30 -i -p "Select command:") fmspecial + argu="" else dooutput if [ "$doarg" == "true" ] then echo $forn1 $forn1 $argu + argu="" fi fi } dooutput(){ - enqueue=$(echo "DO ENQUEUE" | tr " " "\n" | $dmenu -i -p "What do you want to do?") + [ "$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 " @@ -83,7 +83,6 @@ dooutput(){ } getdot(){ - . $conffile if [ "$DFM_DOT" == "1" ] then lscommand="ls -A" @@ -116,6 +115,7 @@ fmspecial(){ 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 @@ -143,7 +143,6 @@ EDIT - Open with $EDITOR" touch $output2 elif [ "$output" == "BM - Bookmarks" ] then - mkdir ~/.config/dfm/ 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" ] @@ -153,9 +152,8 @@ EDIT - Open with $EDITOR" echo "$output $output2" >> ~/.config/dfm/bookmarks elif [ "$output" == "DEL" ] then - output=$(echo "$(cat ~/.config/dfm/bookmarks | awk '// {print $1}')" | $dmenu -l 30 -i -p "Select bookmark to delete:") - delete=$(cat ~/.config/dfm/bookmarks | awk "/$output/") - cat ~/.config/dfm/bookmarks | sed "/$delete/d" > ~/.config/dfm/bookmarks + 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:") @@ -164,7 +162,15 @@ EDIT - Open with $EDITOR" elif [ "$output" == "FND - Find" ] then output=$(echo "" | $dmenu -i -p "Enter name of file:") - output=$(echo "NONE $(find . | grep -i "$output")" | tr " " "\n" | $dmenu -i -l 30 -p "Select 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 diff --git a/.scripts/bin/dmenu/dmenurun b/.scripts/bin/dmenu/dmenurun @@ -1,4 +1,4 @@ #!/bin/bash . $HOME/.dmenurc -dir=$(echo $PATH | tr ":" " ") +dir=$(echo $PATH | tr ":" " " | sed 's/:.//g') find $dir -maxdepth 1 -executable -not -type d -printf "%f\n" | sort | $dmenu "$@" | ${SHELL:-"/bin/bash"} &