mirror of
https://github.com/m-housh/dotfiles.git
synced 2026-02-14 14:12:41 +00:00
feat: Adds launch option to install-webapp script, to launch it in a new terminal window.
This commit is contained in:
16
env/.local/scripts/hypr/install-webapp
vendored
16
env/.local/scripts/hypr/install-webapp
vendored
@@ -2,6 +2,8 @@
|
||||
|
||||
# Adapted from https://github.com/basecamp/omarchy/tree/master?tab=readme-ov-file
|
||||
|
||||
# TODO: Use bash and only allow options, not positional arguments to make easier.
|
||||
|
||||
function usage() {
|
||||
cat <<EOF
|
||||
Generates a '.desktop' file for a web application, so that it
|
||||
@@ -72,9 +74,13 @@ declare -a custom_exec # Optional custom exec command
|
||||
declare -a mime_types # Optional mime types
|
||||
declare -a help_flag
|
||||
declare -a file_mode
|
||||
declare -a launch_flag
|
||||
declare INTERACTIVE_MODE=false
|
||||
SCRIPTS="${SCRIPTS}"
|
||||
|
||||
window_class="com.ghostty.launch-webapp"
|
||||
window_padding_x="2"
|
||||
|
||||
if [[ -z "$SCRIPTS" ]]; then
|
||||
echo "SCRIPTS not set"
|
||||
echo "using ~/.local/scripts"
|
||||
@@ -88,10 +94,18 @@ zparseopts -D -F -K -- \
|
||||
{e,-exec}:=custom_exec \
|
||||
{m,-mime-types}:=mime_types \
|
||||
{f,-file}:=file_mode \
|
||||
{h,-help}=help_flag
|
||||
{h,-help}=help_flag \
|
||||
{l,-launch}=launch_flag
|
||||
|
||||
[ ${#help_flag[@]} -gt 0 ] && usage && exit 0
|
||||
|
||||
if [[ ${#launch_flag[@]} -gt 0 ]]; then
|
||||
ghostty --class=$window_class --window-padding-x=$window_padding_x \
|
||||
--keybind="ctrl+c=quit" \
|
||||
-e $SCRIPTS/hypr/install-webapp
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# If passed in as positional arguments, without flags.
|
||||
[ -n "$1" ] && app_name+=("$1")
|
||||
[ -n "$2" ] && app_url+=("$2")
|
||||
|
||||
Reference in New Issue
Block a user