Clean up scripts and use sh instead of bash

Deleted: mpv, makepkg, openlink
This commit is contained in:
Érico Rolim 2020-06-04 01:10:31 -03:00
parent 08e21a0649
commit e2002df0ce
29 changed files with 69 additions and 105 deletions

View File

@ -1,8 +1,7 @@
#!/usr/bin/env bash
#!/bin/sh
# taken from https://stackoverflow.com/questions/21022749/how-to-create-virtual-can-port-on-linux-c
sudo modprobe vcan
sudo ip link add dev vcan0 type vcan
sudo ip link set up vcan0

View File

@ -1,5 +0,0 @@
#!/usr/bin/env bash
MPRIS="$(fd mpris.so /usr/lib/mpv*)"
exec /usr/bin/mpv --script=$MPRIS "$@"

View File

@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/bin/sh
swaysv up spotifyd
exec swaysv reload spotifyd

View File

@ -1,6 +1,5 @@
#!/usr/bin/env bash
command -v spotify-tui > /dev/null && SPT="spotify-tui"
SPT="${SPT:-/usr/bin/spt}"
#!/bin/sh
SPT=/usr/bin/spt
command -v spotify-tui && SPT=spotify-tui
exec $SPT

View File

@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/bin/sh
# start spotify session on tmux
@ -10,7 +10,7 @@ then
tmux new-window -tmusic -n spotify fish -C spt
fi
if [ -z $TMUX ]
if [ -z "$TMUX" ]
then
exec tmux attach -tmusic:spotify.1
fi

View File

@ -1,10 +1,9 @@
#!/usr/bin/env bash
#!/bin/sh
tmux new-session -d -s standard
STATUS=$?
if [ $STATUS -eq 0 ]
then
if [ $STATUS -eq 0 ] ; then
tmux new-window -tstandard -n multishell
tmux split-window -h
tmux split-window -v

View File

@ -1,43 +1,23 @@
#!/usr/bin/env bash
#!/bin/sh
# Formatting:
# https://stackoverflow.com/questions/2924697/how-does-one-output-bold-text-in-bash
bold=$(tput bold)
normal=$(tput sgr0)
function bold_echo() {
echo "${bold}$1${normal}"
bold_echo() {
echo "${bold}$1${normal}"
}
function print_help() {
echo "This command allows you to quickly run a few adminstrative tasks!"
}
# run fwupmgr
function firmware() {
bold_echo "Devices available:"
fwupdmgr get-devices
bold_echo "Updates available:"
fwupdmgr get-updates
bold_echo "Use 'fwupdmgr update' to update all firmware"
firmware() {
bold_echo "Devices available:"
fwupdmgr get-devices
bold_echo "Updates available:"
fwupdmgr get-updates
bold_echo "Use 'fwupdmgr update' to update all firmware"
}
# Run function from script:
# https://stackoverflow.com/questions/8818119/how-can-i-run-a-function-from-a-script-in-command-line
# Check if the function exists (bash specific)
if declare -f "$1" > /dev/null
then
# call arguments verbatim
"$@"
else
# Show a helpful error
echo "'$1' is not a known function name" >&2
print_help
exit 1
fi
firmware

View File

@ -1,3 +1,3 @@
#!/usr/bin/env bash
#!/bin/sh
xset b off

View File

@ -1,5 +1,4 @@
#!/usr/bin/env bash
#!/bin/sh
# Uses copy setttings beneficial to Btrfs
exec /usr/bin/cp --reflink=auto --sparse=always "$@"

View File

@ -1,11 +1,11 @@
#!/usr/bin/env bash
#!/bin/sh
# ericonr's script for system tasks
# detect session manager;
# systemd -> systemctl
# non-systemd -> loginctl
command -v systemctl >/dev/null 2>&1 && CTL=systemctl
CTL=${CTL:-loginctl}
CTL=loginctl
command -v systemctl && CTL=systemctl
exec $CTL "$@"

View File

@ -1,4 +0,0 @@
#!/usr/bin/env bash
RUSTFLAGS="-Clink-arg=-fuse-ld=lld" CC="clang" CXX="clang++" /usr/bin/makepkg "$@"

View File

@ -1,24 +1,24 @@
#!/usr/bin/env bash
#!/bin/sh
# script to automate generation of executable shell scripts
FILE=$1
SHELL=$2
FILE="$1"
SHELL="$2"
if [ -z $FILE ]
if [ -z "$FILE" ]
then
echo "No file name specified."
exit
fi
if [ -e $FILE ]
if [ -e "$FILE" ]
then
echo "File already exists."
exit
fi
printf "#!/usr/bin/env ${SHELL:-bash}\n\n\n" > $FILE
printf "#!/bin/%s\n\n\n" "${SHELL:-sh}" > "$FILE"
touch $FILE
chmod +x $FILE
exec ${EDITOR:-nvim} $FILE '+$'
touch "$FILE"
chmod +x "$FILE"
exec "${EDITOR:-nvim}" "$FILE" '+$'

View File

@ -1,9 +1,9 @@
#!/usr/bin/env bash
#!/bin/sh
NEW_DIR="$(mktemp -d)"
echo "New dir created in $NEW_DIR"
ln -s $NEW_DIR $1
ln -s "$NEW_DIR" "$1"
echo "$1 linked to $NEW_DIR"

View File

@ -1,4 +0,0 @@
#!/usr/bin/env bash
firejail --join=firefox firefox "$@"

View File

@ -1,4 +1,3 @@
#!/usr/bin/env bash
mimic_time $(date +"%H:%M")
#!/bin/sh
mimic_time "$(date +'%H:%M')"

View File

@ -1,5 +1,5 @@
#!/usr/bin/env bash
#!/bin/sh
# generic launcher for floating alacritty with size WIDTH X LENGTH
exec ${TERMEMU:-alacritty} --class generic-launcher --command "${@:-fish}"
exec "${TERMEMU:-alacritty}" --class generic-launcher --command "${@:-fish}"

View File

@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/bin/sh
# prints the current keyboard layout and then any layout changes
# taken from https://github.com/Alexays/Waybar/pull/85

View File

@ -1,3 +1,3 @@
#!/usr/bin/env bash
#!/bin/sh
pkill -HUP -f "^runsvdir /home/ericonr/.local/share/wayland-services"

View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash
#!/bin/sh
# ericonr's script for launching applications with the appropriate env
source ~/.local/bin/wayland-vars
. "$HOME/.local/bin/wayland-vars"
exec generic-launcher bash -c 'compgen -c | sort -u | fzf --border | xargs lnch'
exec generic-launcher /bin/sh -c 'compgen -c | sort -u | fzf --border | xargs lnch'

View File

@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/bin/sh
# floating editor launcher

View File

@ -1,3 +1,3 @@
#!/usr/bin/env bash
#!/bin/sh
exec generic-launcher iwctl

View File

@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/bin/sh
SAVEPATH="$HOME/Pictures/Screenshots/$(date +'%Y-%m-%d-%H%M%S_grim.png')"
mkdir -p "$HOME/Pictures/Screenshots"
@ -8,23 +8,23 @@ COPIED="Screenshot copied!"
NOTIFICATION="notify-send -a Grim"
if [ -z $1 ]
if [ -z "$1" ]
then
grim "${SAVEPATH}"
${NOTIFICATION} "${SAVED}" "${SAVEPATH}"
else
if [ $1 = COPY ]
if [ "$1" = COPY ]
then
grim - | wl-copy
${NOTIFICATION} "${COPIED}"
elif [ $1 = CROP ]
elif [ "$1" = CROP ]
then
GEOMETRY=$(slurp)
if [ -z $2 ]
if [ -z "$2" ]
then
grim -g "${GEOMETRY}" "${SAVEPATH}"
${NOTIFICATION} "${SAVED}" "${SAVEPATH}"
elif [ $2 = COPY ]
elif [ "$2" = COPY ]
then
grim -g "${GEOMETRY}" - | wl-copy
${NOTIFICATION} "${COPIED}"

View File

@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/bin/sh
# created by elogind, usually
if test -z "${XDG_RUNTIME_DIR}"; then
@ -10,4 +10,5 @@ if test -z "${XDG_RUNTIME_DIR}"; then
fi
# start the compositor itself
exec dbus-run-session runsvdir $HOME/.local/share/wayland-services 'log: ...........................................................................................................................................................................................................................................................................................................................................................................................................'
exec dbus-run-session runsvdir "$HOME/.local/share/wayland-services" \
'log: ...........................................................................................................................................................................................................................................................................................................................................................................................................'

View File

@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/bin/sh
exec swaynag \
-t warning \

View File

@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/bin/sh
export SVDIR=$HOME/.local/share/wayland-services
export SVDIR="$HOME/.local/share/wayland-services"
exec sv "$@"

View File

@ -1,4 +1,4 @@
#!/bin/sh
export SVDIR=$HOME/.local/share/wayland-services
export SVDIR="$HOME/.local/share/wayland-services"
exec vsv "$@"

View File

@ -1,11 +1,11 @@
# ericonr's script for launching applications with the appropriate env
# ericonr's environment for launching applications
if [ $XDG_SESSION_TYPE = wayland ]
if [ "$XDG_SESSION_TYPE" = wayland ]
then
# Qt
export QT_QPA_PLATFORM=wayland-egl
export QT_WAYLAND_FORCE_DPI=physical
export QT_QPA_PLATFORMTHEME="qt5ct"
export QT_QPA_PLATFORMTHEME=qt5ct
# Firefox
export MOZ_ENABLE_WAYLAND=1
# Java
@ -15,6 +15,7 @@ then
# Vulkan should use the Intel GPU
export VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/intel_icd.x86_64.json
else
# useful for KDE
export GTK_USE_PORTAL=1
fi

View File

@ -1,9 +1,9 @@
#!/usr/bin/env bash
#!/bin/sh
# ericonr's script for launching applications with the appropriate env
source ~/.local/bin/wayland-vars
. "$HOME/.local/bin/wayland-vars"
export GTK_THEME=Breeze
exec wofi -i -t alacritty $@
exec wofi -i -t alacritty "$@"

View File

@ -1,3 +1,3 @@
#!/usr/bin/env bash
#!/bin/sh
exec mpv "$(wl-paste)"