fzf menus

This commit is contained in:
The-Repo-Club 2022-11-06 18:56:19 +00:00
parent 0f359f35f8
commit d3b5fb26a6
No known key found for this signature in database
GPG Key ID: E30EC2FBFB05C44F
2 changed files with 29 additions and 6 deletions

View File

@ -12,7 +12,7 @@
#Created:
# Wed 10 March 2021, 12:34:47 PM [GMT+1]
#Modified:
# Fri 28 October 2022, 05:00:50 PM [GMT+1]
# Tue 01 November 2022, 06:45:08 AM [GMT]
#
#Description:
# <Todo>
@ -76,6 +76,8 @@ while [ -n "$LOOPSETTING" ]; do
*Logout)
if [[ "$DESKTOP_SESSION" == "i3" ]]; then
i3-msg exit
elif [[ "$DESKTOP_SESSION" == "herbstluftwm" ]]; then
herbstclient quit
else
pkill -KILL -u "$USER"
fi

View File

@ -12,7 +12,7 @@
#Created:
# Wed 10 March 2021, 12:34:47 PM [GMT+1]
#Modified:
# Sun 30 October 2022, 03:32:36 PM [GMT]
# Sat 05 November 2022, 04:25:20 PM [GMT]
#
#Description:
# <Todo>
@ -22,6 +22,11 @@
#
# shellcheck disable=all
## Script metadata
SCRIPTNAME=${0##*/}
DESCRIPTION="A bash and fzf run script for terminal."
AUTHOR="The-Repo-Club <wayne6324@gmail.com>"
command=''
width=''
height=''
@ -62,12 +67,11 @@ readonly b_blk b_red b_grn b_yel b_blu b_mag b_cyn b_wht blk red grn yel blu mag
error() {
local mesg=$1
printf "${red}${bld}==> ERROR:${wht} %b${del}\n" "$mesg"
exit 0
}
run_program() {
if command -v $command &>/dev/null; then
cmd='alacritty'
cmd="xterm"
if [[ -n $term ]]; then
cmd="$term"
fi
@ -79,12 +83,24 @@ run_program() {
if [[ -n $command ]]; then
cmd+=" -e $command"
fi
exec nohup $cmd >&/dev/null
exec $cmd >&/dev/null
exit 0
fi
}
show_help() {
echo "HELP"
printf "
%b
Usage:
%b...
%b [options]...
Options:
-h, --help Display help.
-c, --command Set the command to be ran..
-i, --instance Set the WM_CLASS for the program thats ran.
-t, --term Override the terminal you would like to use.
\n" "$DESCRIPTION" "$SCRIPTNAME" "$SCRIPTNAME"
exit 0
}
while [[ "$1" ]]; do
@ -107,11 +123,16 @@ while [[ "$1" ]]; do
;;
-*)
error 'Incorrect option(s) specified.'
show_help
;;
*)
error 'Incorrect option(s) specified.'
show_help
;;
esac
shift
done
run_program
error 'Incorrect option(s) specified.'
show_help