~wrm/dotfiles

009efab4c3e01846173fddfbfa698667b585aee8 — +wrm 4 months ago a8650b4
Add initial .local/bin scripts
4 files changed, 55 insertions(+), 0 deletions(-)

A .local/bin/dmenupass
A .local/bin/git-config-profile
A .local/bin/prompt
A .local/bin/wpa_switch
A .local/bin/dmenupass => .local/bin/dmenupass +8 -0
@@ 0,0 1,8 @@
#!/bin/sh

# From LukeSmithxyz/voidrice

# This script is the SUDO_ASKPASS variable, meaning that it will be used as a
# password prompt if needed.

dmenu -fn Monospace-13 -sb "#d79921" -sf "#1d2021" -nf "#000000" -nb "#000000" -p "$1" <&- && echo

A .local/bin/git-config-profile => .local/bin/git-config-profile +14 -0
@@ 0,0 1,14 @@
#!/bin/sh

if [ $# -ne 1 ]; then
	echo "Choose config to copy to local repo: "
	for f in $HOME/.config/git/*; do
		echo $(basename "$f")
	done
	exit 1
fi

[ ! -d ./.git ] && echo "Not in a git repository"

config_file="$HOME/.config/git/$1"
[ -f "$config_file" ] && cat "$config_file" >> ./.git/config || echo "invalid config file"

A .local/bin/prompt => .local/bin/prompt +5 -0
@@ 0,0 1,5 @@
#!/bin/sh

# From LukeSmithxyz/voidrice

[ "$(printf "No\\nYes" | dmenu -i -p "$1" -fn Monospace-13 -nb darkred -sb red -sf white -nf gray )" = "Yes" ] && $2

A .local/bin/wpa_switch => .local/bin/wpa_switch +28 -0
@@ 0,0 1,28 @@
#!/bin/sh

# TODO Allow to choose between killall or sv

list_confs () {
	for file in /etc/wpa_supplicant/*.conf; do
		basename "${file}" .conf
	done
}

[ -z "$1" ] && \
	echo "missing argument config-name" && \
	echo "configs available:" && list_confs && \
	exit 1

[ ! -f "/etc/wpa_supplicant/${1}.conf" ] && \
	echo "${1} is not a valid wpa_supplicant config" && \
	echo "configs available:" && list_confs && \
	exit 1

[ ! $( id -u ) = 0 ] && \
	echo "wpa_switch must be run as root" && \
	exit 1

echo "CONF_FILE=/etc/wpa_supplicant/${1}.conf" > /etc/runit/sv/wpa_supplicant/conf
sv restart wpa_supplicant
#killall wpa_supplicant
#wpa_supplicant -B -i wlp3s0 -c "/etc/wpa_supplicant/${1}.conf"