mirror of
https://github.com/m-housh/dotfiles.git
synced 2026-02-14 06:12:34 +00:00
feat: Adds arch specific scripts and removes raycast (macOS) specific scripts.
This commit is contained in:
7
scripts/arch/launch-webapp
Executable file
7
scripts/arch/launch-webapp
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Adapted from https://github.com/basecamp/omarchy/tree/master?tab=readme-ov-file
|
||||
#
|
||||
browser="chromium.desktop"
|
||||
|
||||
exec setsid uwsm app -- $(sed -n 's/^Exec=\([^ ]*\).*/\1/p' {~/.local,~/.nix-profile,/usr}/share/applications/$browser 2>/dev/null | head -1) --app="$1" "${@:2}"
|
||||
12
scripts/arch/toggle-internal-monitor
Executable file
12
scripts/arch/toggle-internal-monitor
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/bin/zsh
|
||||
#
|
||||
# Toggles the state of the internal laptop monitor, which is useful
|
||||
# when I'm connected to an external monitor / docks.
|
||||
|
||||
monitor="eDP-1"
|
||||
|
||||
if hyprctl monitors | grep -q "$monitor"; then
|
||||
hyprctl keyword monitor "$monitor,disable" 1>/dev/null
|
||||
else
|
||||
hyprctl keyword monitor "$monitor,enable" 1>/dev/null
|
||||
fi
|
||||
11
scripts/arch/toggle-waybar
Executable file
11
scripts/arch/toggle-waybar
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
WAYBAR_PID=$(pgrep -x waybar)
|
||||
|
||||
if [ -n "$WAYBAR_PID" ]; then
|
||||
# kill waybar process if it's running.
|
||||
kill "$WAYBAR_PID"
|
||||
else
|
||||
# start waybar in the background.
|
||||
waybar &
|
||||
fi
|
||||
73
scripts/arch/webapp-install
Executable file
73
scripts/arch/webapp-install
Executable file
@@ -0,0 +1,73 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Adapted from https://github.com/basecamp/omarchy/tree/master?tab=readme-ov-file
|
||||
#
|
||||
if [ "$#" -lt 3 ]; then
|
||||
echo -e "\e[32mLet's create a new web app you can start with the app launcher.\n\e[0m"
|
||||
APP_NAME=$(gum input --prompt "Name> " --placeholder "My favorite web app")
|
||||
APP_URL=$(gum input --prompt "URL> " --placeholder "https://example.com")
|
||||
ICON_REF=$(gum input --prompt "Icon URL> " --placeholder "See https://dashboardicons.com (must use PNG!)")
|
||||
CUSTOM_EXEC=""
|
||||
MIME_TYPES=""
|
||||
INTERACTIVE_MODE=true
|
||||
else
|
||||
APP_NAME="$1"
|
||||
APP_URL="$2"
|
||||
ICON_REF="$3"
|
||||
CUSTOM_EXEC="$4" # Optional custom exec command
|
||||
MIME_TYPES="$5" # Optional mime types
|
||||
INTERACTIVE_MODE=false
|
||||
fi
|
||||
|
||||
# Ensure valid execution
|
||||
if [[ -z "$APP_NAME" || -z "$APP_URL" || -z "$ICON_REF" ]]; then
|
||||
echo "You must set app name, app URL, and icon URL!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Refer to local icon or fetch remotely from URL
|
||||
ICON_DIR="$HOME/.local/share/applications/icons"
|
||||
if [[ $ICON_REF =~ ^https?:// ]]; then
|
||||
ICON_PATH="$ICON_DIR/$APP_NAME.png"
|
||||
if curl -sL -o "$ICON_PATH" "$ICON_REF"; then
|
||||
ICON_PATH="$ICON_DIR/$APP_NAME.png"
|
||||
else
|
||||
echo "Error: Failed to download icon."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
ICON_PATH="$ICON_DIR/$ICON_REF"
|
||||
fi
|
||||
|
||||
# Use custom exec if provided, otherwise default behavior
|
||||
if [[ -n $CUSTOM_EXEC ]]; then
|
||||
EXEC_COMMAND="$CUSTOM_EXEC"
|
||||
else
|
||||
EXEC_COMMAND="$HOME/.local/bin/launch-webapp $APP_URL"
|
||||
fi
|
||||
|
||||
# Create application .desktop file
|
||||
DESKTOP_FILE="$HOME/.local/share/applications/$APP_NAME.desktop"
|
||||
|
||||
cat >"$DESKTOP_FILE" <<EOF
|
||||
[Desktop Entry]
|
||||
Version=1.0
|
||||
Name=$APP_NAME
|
||||
Comment=$APP_NAME
|
||||
Exec=$EXEC_COMMAND
|
||||
Terminal=false
|
||||
Type=Application
|
||||
Icon=$ICON_PATH
|
||||
StartupNotify=true
|
||||
EOF
|
||||
|
||||
# Add mime types if provided
|
||||
if [[ -n $MIME_TYPES ]]; then
|
||||
echo "MimeType=$MIME_TYPES" >>"$DESKTOP_FILE"
|
||||
fi
|
||||
|
||||
chmod +x "$DESKTOP_FILE"
|
||||
|
||||
if [[ $INTERACTIVE_MODE == true ]]; then
|
||||
echo -e "You can now find $APP_NAME using the app launcher (SUPER + SPACE)\n"
|
||||
fi
|
||||
Reference in New Issue
Block a user