Pushing several updates.

This commit is contained in:
Derek Taylor
2019-05-27 21:05:24 -05:00
parent 2a179d4cac
commit fc9beffc5e
12 changed files with 12 additions and 154 deletions

View File

@@ -1,18 +0,0 @@
#!/bin/sh
# dmenu-based directory browser
# to run from terminal:
# source /path/to/dbdb.sh
# or bind it to shortcut:
# echo bind \'\"\\C-o\":\"source /path/to/dbdb.sh\\n\"\' >> ~/.bashrc
chosen="placeholder"
while [ ! -z "$chosen" ]; do
DIRs=$( ls -a1p | grep -P '^\w[^\$/]+/$' | awk -vRS="\n" -vORS="\t" '1')
DOTDs=$( ls -a1p | grep -P '^\.[^\$/]+/$' | awk -vRS="\n" -vORS="\t" '1')
FILEs=$( ls -a1p | grep -P '^\w[^\$/]+$' | awk -vRS="\n" -vORS=" \t" '1')
DOTFs=$( ls -a1p | grep -P '^\.[^\$/]+$' | awk -vRS="\n" -vORS=" \t" '1')
clear && printf "\e[1;7;33m $(pwd) \e[0m\n$FILEs\n\e[0;38;5;238m$DOTFs\e[0m\n"
chosen=`( ( echo -e "$DIRs$DOTDs" | awk -vRS="\t" -vORS="\n" '1' ) | dmenu -i )`
cd "$chosen"
done

View File

@@ -1,29 +0,0 @@
#!/bin/sh
# TODO: multisel
target="$1"
[ -z "$target" ] && target="$(realpath .)"
prompt="$2"
while true; do
p="$prompt"
[ -z "$p" ] && p="$target"
sel="$(ls -1a "$target" |grep -v '^\.$' | dmenu -p "$p" -l 25)"
ec=$?
[ "$ec" -ne 0 ] && exit $ec
c="$(echo "$sel" |cut -b1)"
if [ "$c" = "/" ]; then
newt="$sel"
else
newt="$(realpath "${target}/${sel}")"
fi
if [ -e "$newt" ]; then
target="$newt"
if [ ! -d "$target" ]; then
echo "$target"
exit 0
fi
fi
done

View File

@@ -1,22 +0,0 @@
#!/bin/bash
# ____ _____
# | _ \_ _| Derek Taylor (DistroTube)
# | | | || | http://www.youtube.com/c/DistroTube
# | |_| || | http://www.gitlab.com/dwt1/
# |____/ |_|
#
# Use dmenu to open and edit a file from a given list.
# I use this to quickly open my dwm source files in vim.
source $HOME/.dmenurc
# Global variables:
FILES=${1:-"/home/dt/dwm"}
DMENU='dmenu -l -i'
EDITOR='st -e vim'
# Show list of options
choice=$(ls -a "${FILES}" | $DMENU -p "« dwm » source code:")
if [ $choice ]; then
$EDITOR ${FILES}/${choice}
fi

View File

@@ -1,20 +0,0 @@
#!/bin/bash
# ____ _____
# | _ \_ _| Derek Taylor (DistroTube)
# | | | || | http://www.youtube.com/c/DistroTube
# | |_| || | http://www.gitlab.com/dwt1/
# |____/ |_|
#
# Use dmenu to open and edit a file from a given list.
# I use this to quickly open my st source files in vim.
# Global variables:
FILES=${1:-"/home/dt/st"}
DMENU='dmenu -nb #1D2330 -nf #AD69AF -sb #84598D -sf #d1d7e1 -l -i'
EDITOR='st -e vim'
# Show list of options
choice=$(ls -a "${FILES}" | $DMENU -p "« st » source code:")
if [ $choice ]; then
$EDITOR ${FILES}/${choice}
fi

View File

@@ -1,31 +0,0 @@
#!/bin/bash
# ____ _____
# | _ \_ _| Derek Taylor (DistroTube)
# | | | || | http://www.youtube.com/c/DistroTube
# | |_| || | http://www.gitlab.com/dwt1/
# |____/ |_|
#
# Search through open programs and switch to their tag in dwm.
# The package xorg-xlsclients is required!
application=$(
# List all running programs
xlsclients |\
# Fix Virtualbox and LibreOffice
sed -e 's/.*VirtualBox/foobar virtualbox/g' -e 's/.*soffice/foobar libreoffice/g' |\
# Remove flash from results
grep -v "plugin-container" |\
# Show only app-names
cut -d" " -f3 |\
# Pipe to dmenu ($@ to include font settings from dwm/config.h)
dmenu -i -p "switch to:" $@
)
# Switch to chosen application
case $application in
gimp | truecrypt)
xdotool search --onlyvisible -classname "$application" windowactivate &> /dev/null
;;
*)
xdotool search ".*${application}.*" windowactivate &> /dev/null
;;

View File

@@ -1,28 +0,0 @@
#!/bin/sh
#
# Write/remove a task to do later.
#
# Select an existing entry to remove it from the file, or type a new entry to
# add it.
#
file="$HOME/.todo"
touch "$file"
height=$(wc -l "$file" | awk '{print $1}')
prompt="Add/delete a task: "
cmd=$(dmenu -l "$height" -p "$prompt" "$@" < "$file")
while [ -n "$cmd" ]; do
if grep -q "^$cmd\$" "$file"; then
grep -v "^$cmd\$" "$file" > "$file.$$"
mv "$file.$$" "$file"
height=$(( height - 1 ))
else
echo "$cmd" >> "$file"
height=$(( height + 1 ))
fi
cmd=$(dmenu -l "$height" -p "$prompt" "$@" < "$file")
done
exit 0