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

View File

@ -12,7 +12,7 @@
#Created: #Created:
# Wed 10 March 2021, 12:34:47 PM [GMT+1] # Wed 10 March 2021, 12:34:47 PM [GMT+1]
#Modified: #Modified:
# Sun 30 October 2022, 03:32:36 PM [GMT] # Sat 05 November 2022, 04:25:20 PM [GMT]
# #
#Description: #Description:
# <Todo> # <Todo>
@ -22,6 +22,11 @@
# #
# shellcheck disable=all # shellcheck disable=all
## Script metadata
SCRIPTNAME=${0##*/}
DESCRIPTION="A bash and fzf run script for terminal."
AUTHOR="The-Repo-Club <wayne6324@gmail.com>"
command='' command=''
width='' width=''
height='' 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() { error() {
local mesg=$1 local mesg=$1
printf "${red}${bld}==> ERROR:${wht} %b${del}\n" "$mesg" printf "${red}${bld}==> ERROR:${wht} %b${del}\n" "$mesg"
exit 0
} }
run_program() { run_program() {
if command -v $command &>/dev/null; then if command -v $command &>/dev/null; then
cmd='alacritty' cmd="xterm"
if [[ -n $term ]]; then if [[ -n $term ]]; then
cmd="$term" cmd="$term"
fi fi
@ -79,12 +83,24 @@ run_program() {
if [[ -n $command ]]; then if [[ -n $command ]]; then
cmd+=" -e $command" cmd+=" -e $command"
fi fi
exec nohup $cmd >&/dev/null exec $cmd >&/dev/null
exit 0
fi fi
} }
show_help() { 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 while [[ "$1" ]]; do
@ -107,11 +123,16 @@ while [[ "$1" ]]; do
;; ;;
-*) -*)
error 'Incorrect option(s) specified.' error 'Incorrect option(s) specified.'
show_help
;; ;;
*) *)
error 'Incorrect option(s) specified.' error 'Incorrect option(s) specified.'
show_help
;; ;;
esac esac
shift shift
done done
run_program run_program
error 'Incorrect option(s) specified.'
show_help