menu.sh: refactor with argc
Signed-off-by: Myned <dev@bjork.tech>
This commit is contained in:
parent
75b53c52b6
commit
228d238744
2 changed files with 86 additions and 52 deletions
|
@ -113,6 +113,7 @@ in {
|
|||
sway
|
||||
])
|
||||
(bash "menu" [
|
||||
argc
|
||||
coreutils
|
||||
hyprland
|
||||
jq
|
||||
|
|
|
@ -1,60 +1,93 @@
|
|||
#! /usr/bin/env bash
|
||||
|
||||
# Menu wrapper
|
||||
#?? menu
|
||||
# @describe Wrapper for menu commands
|
||||
#
|
||||
# https://github.com/sigoden/argc
|
||||
|
||||
command=walker
|
||||
|
||||
while (("$#" > 0)); do
|
||||
case "$1" in
|
||||
--applications)
|
||||
command="walker --modules applications"
|
||||
;;
|
||||
--calculator)
|
||||
command="walker --modules calc"
|
||||
;;
|
||||
--clipboard)
|
||||
command="walker --modules clipboard"
|
||||
;;
|
||||
--files)
|
||||
command="walker --modules finder"
|
||||
;;
|
||||
--input)
|
||||
command="walker --dmenu"
|
||||
;;
|
||||
--networks)
|
||||
command="networkmanager_dmenu"
|
||||
;;
|
||||
--passwords)
|
||||
command="rofi-rbw"
|
||||
;;
|
||||
--runner)
|
||||
command="walker --modules runner"
|
||||
;;
|
||||
--search)
|
||||
command="walker --modules websearch"
|
||||
;;
|
||||
--ssh)
|
||||
command="walker --modules ssh"
|
||||
;;
|
||||
--unicode)
|
||||
command="walker --modules emojis"
|
||||
;;
|
||||
--windows)
|
||||
command="walker --modules windows"
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
command+=" $*"
|
||||
break
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
# @meta combine-shorts
|
||||
|
||||
# HACK: Restart service to close existing menu
|
||||
if hyprctl -j layers | jq -e '.[][][][] | select(.namespace == "walker")'; then
|
||||
systemctl --user restart walker.service
|
||||
else
|
||||
$command
|
||||
exit
|
||||
fi
|
||||
|
||||
# @cmd Launch menu without modules
|
||||
# @meta default-subcommand
|
||||
menu() {
|
||||
walker
|
||||
}
|
||||
|
||||
# @cmd Launch menu with application module
|
||||
# @alias a,ap,app,appl,appli,applic,applica,applicat,applicati,applicatio,applications
|
||||
application() {
|
||||
walker --modules applications
|
||||
}
|
||||
|
||||
# @cmd Launch menu with calculator module
|
||||
# @alias c,ca,calc,calcu,calcul,calcula,calculat,calculato
|
||||
calculator() {
|
||||
walker --modules calc
|
||||
}
|
||||
|
||||
# @cmd Launch menu with clipboard module
|
||||
# @alias cl,cli,clip,clipb,clipbo,clipboa,clipboar
|
||||
clipboard() {
|
||||
walker --modules clipboard
|
||||
}
|
||||
|
||||
# @cmd Launch menu with emoji module
|
||||
# @alias e,em,emo,emoj,emot,emote
|
||||
emoji() {
|
||||
walker --modules emojis
|
||||
}
|
||||
|
||||
# @cmd Launch menu with file module
|
||||
# @alias f,fi,fil,files
|
||||
file() {
|
||||
walker --modules finder
|
||||
}
|
||||
|
||||
# @cmd Launch menu with input module
|
||||
# @alias i,in,inp,inpu,d,dm,dme,dmen,dmenu
|
||||
input() {
|
||||
walker --dmenu
|
||||
}
|
||||
|
||||
# @cmd Launch menu via networkmanager_dmenu
|
||||
# @alias n,ne,net,netw,netwo,networks
|
||||
network() {
|
||||
networkmanager_dmenu
|
||||
}
|
||||
|
||||
# @cmd Launch menu via rofi-rbw
|
||||
# @alias p,pa,pas,pass,passw,passwo,passwor,passwords
|
||||
password() {
|
||||
rofi-rbw
|
||||
}
|
||||
|
||||
# @cmd Launch menu with search module
|
||||
# @alias s,se,sea,sear,searc
|
||||
search() {
|
||||
walker --modules search
|
||||
}
|
||||
|
||||
# @cmd Launch menu with shell module
|
||||
# @alias sh,she,shel,co,com,comm,comma,comman,command,commands
|
||||
shell() {
|
||||
walker --modules runner
|
||||
}
|
||||
|
||||
# @cmd Launch menu with ssh module
|
||||
# @alias ss
|
||||
ssh() {
|
||||
walker --modules ssh
|
||||
}
|
||||
|
||||
# @cmd Launch menu with wm module
|
||||
# @alias w,wi,win,wind,windo,window,windows
|
||||
wm() {
|
||||
walker --modules windows
|
||||
}
|
||||
|
||||
eval "$(argc --argc-eval "$0" "$@")"
|
||||
|
|
Loading…
Reference in a new issue