Fix dead menu entries

This commit is contained in:
JeremyStar™ 2024-10-20 04:07:58 +02:00
parent 5ebbceeaf2
commit c47aa40daa
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D
11 changed files with 212 additions and 159 deletions

View file

@ -1,10 +1,58 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eo pipefail
# Define associative array # Define associative array
declare -A apps=() declare -A apps=()
# Utility methods
# -> Checking
function is_binary() {
if ! which "${1}" &>/dev/null; then
return 1
else
return 0
fi
}
function is_file() {
if [ ! -f "${1}" ]; then
return 1
else
return 0
fi
}
function is_not_file() {
if [ -f "${1}" ]; then
return 1
else
return 0
fi
}
function is_flatpak() {
if ! flatpak info "${1}" &>/dev/null; then
return 1
else
return 0
fi
}
# -> Adding
function add_app() {
apps+=( ["${1}"]="${2}" )
}
function add_binary() {
is_binary "${2}" && add_app "${1}" "${2}"
}
function add_flatpak() {
is_flatpak "${2}" && add_app "${1}" "flatpak run ${2}"
}
if [ -f "/tmp/launch-menu-apps_appcache.tmp" ]; then
# Load cache
echo ":: Loading cache"
chmod +x "/tmp/launch-menu-apps_appcache.tmp"
source "/tmp/launch-menu-apps_appcache.tmp"
else
# Create template
[[ ! -d "${HOME:?}/.config/launch-menu-apps.d" ]] && ( [[ ! -d "${HOME:?}/.config/launch-menu-apps.d" ]] && (
echo ":: Creating template script"
mkdir -p "${HOME}/.config/launch-menu-apps.d" mkdir -p "${HOME}/.config/launch-menu-apps.d"
cat << EOF >> "${HOME}/.config/launch-menu-apps.d/template.sh.disabled" cat << EOF >> "${HOME}/.config/launch-menu-apps.d/template.sh.disabled"
#!/usr/bin/env bash #!/usr/bin/env bash
@ -15,18 +63,35 @@ apps+=(
) )
EOF EOF
) )
# Do nothing if no scripts could be found to source
# shellcheck disable=SC2012 # shellcheck disable=SC2012
[[ "$(ls -1 "${HOME}"/.config/launch-menu-apps.d/*.sh 2>/dev/null | wc -l)" == "0" ]] && exit 0 [[ "$(ls -1 "${HOME}"/.config/launch-menu-apps.d/*.sh 2>/dev/null | wc -l)" == "0" ]] && exit 0
# Append entries # Append entries by sourcing all scripts
for script in "${HOME}"/.config/launch-menu-apps.d/*.sh; do for script in "${HOME}"/.config/launch-menu-apps.d/*.sh; do
echo ":: Sourcing script ${script}" echo ":: Sourcing script ${script}"
# shellcheck disable=SC1090 # shellcheck disable=SC1090
source "${script}" source "${script}"
done done
# Enable failure detection
# Enabling this before sourcing all scripts will
# cause issues, that's why we're doing it here.
set -eo pipefail
# Cache entries
echo ":: Caching entries"
echo "apps+=(" > /tmp/launch-menu-apps_appcache.tmp
for app in "${!apps[@]}"; do
echo " [\"${app}\"]=\"${apps[${app}]}\"" >> /tmp/launch-menu-apps_appcache.tmp
done
echo ")" >> /tmp/launch-menu-apps_appcache.tmp
fi
# Sort entries # Sort entries
if [ -n "${MENU_SORT}" ]; then if [ -n "${MENU_SORT}" ]; then
echo ":: Sorting entries"
echo ":: Warning: Sorting is currently broken and is considered experimental" echo ":: Warning: Sorting is currently broken and is considered experimental"
declare -a apps_sorted=($( declare -a apps_sorted=($(
@ -62,8 +127,13 @@ for app in "${!apps[@]}"; do
done done
# Make selection # Make selection
echo ":: Invoking 'launch-menu'"
selection=$(echo -e "${apps_keys}" | ${HOME}/.local/bin/launch-menu "start") selection=$(echo -e "${apps_keys}" | ${HOME}/.local/bin/launch-menu "start")
# Terminate if no selection was made
[ -z "${selection}" ] && exit 0
# Execute # Execute
echo ":: Executing"
# shellcheck disable=SC2086 # shellcheck disable=SC2086
( eval ${apps[${selection}]} ) ( eval ${apps[${selection}]} )

View file

@ -1,9 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
apps+=( is_binary "librewolf" && add_app "LibreWolf" "librewolf"
["LibreWolf"]="librewolf" is_binary "epiphany" && add_app "Epiphany" "epiphany"
["Epiphany"]="epiphany" is_binary "dolphin" && add_app "Dolphin" "dolphin"
["Dolphin"]="dolphin" is_binary "gwenview" && add_app "Gwenview" "gwenview"
["Gwenview"]="gwenview" is_binary "konsole" && add_app "Konsole" "konsole"
["Konsole"]="konsole"
)

View file

@ -1,5 +0,0 @@
#!/usr/bin/env bash
apps+=(
["UltraISO"]="flatpak run --command=bottles-cli com.usebottles.bottles run -p UltraISO -b 'UltraISO'"
)

View file

@ -1,12 +1,10 @@
#!/usr/bin/env bash #!/usr/bin/env bash
apps+=( is_flatpak "com.google.AndroidStudio" && add_app "Android Studio" "flatpak run com.google.AndroidStudio"
["Android Studio"]="source ${HOME}/.bashrc.d/programs.d/sdkman.sh;flatpak run com.google.AndroidStudio" is_binary "bytecodeviewer" && add_app "Bytecode Viewer" "bytecodeviewer"
["Bytecode Viewer"]="bytecodeviewer" is_binary "idea" && add_app "IntelliJ IDEA" "idea"
["IntelliJ IDEA"]="source ${HOME}/.bashrc.d/programs.d/sdkman.sh;idea" is_binary "visualvm" && add_app "VisualVM" "visualvm"
["VisualVM"]="source ${HOME}/.bashrc.d/programs.d/sdkman.sh;visualvm" is_binary "godot" && add_app "Godot Engine 4 (native)" "godot"
["Godot Engine (native)"]="godot" is_flatpak "org.godotengine.Godot" && add_app "Godot Engine 4" "flatpak run org.godotengine.Godot"
["Godot Engine 4"]="flatpak run org.godotengine.Godot" is_flatpak "org.godotengine.Godot3" && add_app "Godot Engine 3" "flatpak run org.godotengine.Godot3"
["Godot Engine 3"]="flatpak run org.godotengine.Godot3" is_binary "codium" && add_app "VSCodium" "codium --enable-features=UseOzonePlatform,WaylandWindowDecorations --ozone-platform=wayland"
["VSCodium"]="codium --enable-features=UseOzonePlatform,WaylandWindowDecorations --ozone-platform=wayland"
)

View file

@ -1,18 +1,16 @@
#!/usr/bin/env bash #!/usr/bin/env bash
apps+=( is_file "~/.apps/ClassiCube/ClassiCube" && add_app "ClassiCube" "~/.apps/ClassiCube/ClassiCube"
["ClassiCube"]="~/.apps/ClassiCube/ClassiCube" is_flatpak "net.minetest.Minetest" && add_app "Minetest" "flatpak run net.minetest.Minetest"
["Minetest"]="flatpak run net.minetest.Minetest" add_app "osu!lazer" "[[ ! -d /tmp/osuboot-repo ]] && git clone --depth=1 https://git.staropensource.de/JeremyStarTM/osuboot.git /tmp/osuboot-repo; /tmp/osuboot-repo/osuboot.sh"
["osu!lazer"]="[[ ! -d /tmp/osuboot-repo ]] && git clone --depth=1 https://git.staropensource.de/JeremyStarTM/osuboot.git /tmp/osuboot-repo; /tmp/osuboot-repo/osuboot.sh" is_file "${HOME}/.cache/osu.AppImage" && add_app "osu!lazer (direct)" "${HOME}/.cache/osu.AppImage"
["osu!lazer (direct)"]="${HOME}/.cache/osu.AppImage" is_binary "prismlauncher" && add_app "PrismLauncher" "prismlauncher"
["Prism Launcher"]="prismlauncher" is_flatpak "com.github.Rosalie241.RMG" && add_app "Rosalie's Mupen GUI" "flatpak run com.github.Rosalie241.RMG"
["Rosalie's Mupen GUI"]="flatpak run com.github.Rosalie241.RMG" is_flatpak "org.srb2.SRB2" && add_app "Sonic Robo Blast 2" "flatpak run org.srb2.SRB2"
["Sonic Robo Blast 2"]="flatpak run org.srb2.SRB2" is_binary "steam-runtime" && add_app "Steam" "steam-runtime"
["Steam"]="steam-runtime" is_flatpak "com.heroicgameslauncher.hgl" && add_app "Heroic" "flatpak run com.heroicgameslauncher.hgl"
["Heroic"]="flatpak run com.heroicgameslauncher.hgl" is_flatpak "net.veloren.airshipper" && add_app "Veloren (Airshipper)" "konsole -e \"flatpak run net.veloren.airshipper update\";flatpak run net.veloren.airshipper start"
["Veloren (Airshipper)"]="konsole -e \"flatpak run net.veloren.airshipper update\";flatpak run net.veloren.airshipper start" is_flatpak "io.itch.itch" && add_app "itch" "flatpak run io.itch.itch"
["itch"]="flatpak run io.itch.itch" is_flatpak "org.ryujinx.Ryujinx" && add_app "Ryujinx" "flatpak run org.ryujinx.Ryujinx"
["Ryujinx"]="flatpak run org.ryujinx.Ryujinx" is_binary "tipp10" && add_app "Tipp10" "tipp10"
["Tipp10"]="tipp10" is_flatpak "rs.ruffle.Ruffle" && add_app "Ruffle" "flatpak run rs.ruffle.Ruffle"
["Ruffle"]="flatpak run rs.ruffle.Ruffle"
)

View file

@ -1,5 +1,3 @@
#!/usr/bin/env bash #!/usr/bin/env bash
apps+=( pgrep "Hyprland" &> /dev/null && add_app "Reload Hyprland" "hyprctl reload"
["Reload Hyprland"]="hyprctl reload"
)

View file

@ -1,6 +1,4 @@
#!/usr/bin/env bash #!/usr/bin/env bash
apps+=( is_flatpak "dev.serebit.Waycheck" && add_app "Waycheck" "flatpak run dev.serebit.Waycheck"
["Waycheck"]="flatpak run dev.serebit.Waycheck" is_flatpak "io.github.thetumultuousunicornofdarkness.cpu-x" && add_app "CPU-X" "io.github.thetumultuousunicornofdarkness.cpu-x"
["CPU-X"]="flatpak run io.github.thetumultuousunicornofdarkness.cpu-x"
)

View file

@ -1,15 +1,13 @@
#!/usr/bin/env bash #!/usr/bin/env bash
apps+=( is_flatpak "app.kaiteki.Kaiteki" && add_app "Kaiteki" "app.kaiteki.Kaiteki"
["Kaiteki"]="flatpak run app.kaiteki.Kaiteki" is_flatpak "chat.revolt.RevoltDesktop" && add_app "Revolt" "chat.revolt.RevoltDesktop"
["Revolt"]="flatpak run chat.revolt.RevoltDesktop" is_flatpak "com.ktechpit.whatsie" && add_app "WhatSie" "com.ktechpit.whatsie"
["WhatSie"]="flatpak run com.ktechpit.whatsie" is_flatpak "dev.vencord.Vesktop" && add_app "Vesktop" "dev.vencord.Vesktop"
["Vesktop"]="flatpak run dev.vencord.Vesktop" is_binary "media-downloader" && add_app "Media Downloader" "media-downloader"
["Media Downloader"]="media-downloader" is_flatpak "org.filezillaproject.Filezilla" && add_app "Filezilla" "org.filezillaproject.Filezilla"
["FileZilla"]="flatpak run org.filezillaproject.Filezilla" is_flatpak "org.mozilla.Thunderbird" && add_app "Thunderbird" "org.mozilla.Thunderbird"
["Thunderbird"]="flatpak run org.mozilla.Thunderbird" is_flatpak "org.qbittorrent.qBittorrent" && add_app "qBittorrent" "org.qbittorrent.qBittorrent"
["qBittorrent"]="flatpak run org.qbittorrent.qBittorrent" is_flatpak "org.signal.Signal" && add_app "Signal" "org.signal.Signal"
["Signal"]="flatpak run org.signal.Signal" is_binary "vncviewer" && add_app "TigerVNC Viewer" "vncviewer"
["TigerVNC Viewer"]="vncviewer" is_flatpak "io.github.ungoogled_software.ungoogled_chromium" && add_app "Ungoogled Chromium" "flatpak run io.github.ungoogled_software.ungoogled_chromium"
["Ungoogled Chromium"]="io.github.ungoogled_software.ungoogled_chromium"
)

View file

@ -1,17 +1,15 @@
#!/usr/bin/env bash #!/usr/bin/env bash
apps+=( is_flatpak "com.github.libresprite.LibreSprite" && add_app "LibreSprite" "flatpak run com.github.libresprite.LibreSprite"
["LibreSprite"]="flatpak run com.github.libresprite.LibreSprite" is_binary "obs" && add_app "OBS Studio" "obs"
["OBS Studio"]="obs" is_binary "gimp" && add_app "GIMP" "gimp"
["GIMP"]="gimp" is_binary "mpv" && add_app "mpv" "mpv --player-operation-mode=pseudo-gui"
["mpv"]="mpv --player-operation-mode=pseudo-gui" is_binary "mystiq" && add_app "MystiQ" "mystiq"
["MystiQ"]="mystiq" is_flatpak "org.blender.Blender" && add_app "Blender" "flatpak run org.blender.Blender"
["Blender"]="flatpak run org.blender.Blender" is_flatpak "net.blockbench.Blockbench" && add_app "Blockbench" "flatpak run net.blockbench.Blockbench"
["Blockbench"]="flatpak run net.blockbench.Blockbench" is_flatpak "org.inkscape.Inkscape" && add_app "Inkscape" "flatpak run org.inkscape.Inkscape"
["Inkscape"]="flatpak run org.inkscape.Inkscape" is_flatpak "org.kde.kdenlive" && add_app "Kdenlive" "flatpak run org.kde.kdenlive"
["Kdenlive"]="flatpak run org.kde.kdenlive" is_flatpak "org.mattbas.Glaxnimate" && add_app "Glaxnimate" "flatpak run org.mattbas.Glaxnimate"
["Glaxnimate"]="flatpak run org.mattbas.Glaxnimate" is_flatpak "org.tenacityaudio.Tenacity" && add_app "Tenacity" "flatpak run org.tenacityaudio.Tenacity"
["Tenacity"]="flatpak run org.tenacityaudio.Tenacity" is_flatpak "org.kde.krita" && add_app "Krita" "flatpak run org.kde.krita"
["Krita"]="flatpak run org.kde.krita" is_flatpak "org.videolan.VLC" && add_app "VLC" "flatpak run org.videolan.VLC"
["VLC"]="flatpak run org.videolan.VLC"
)

View file

@ -1,29 +1,31 @@
#!/usr/bin/env bash #!/usr/bin/env bash
apps+=( # Binaries
["OpenRGB"]="openrgb" is_binary "companion" && add_app "Companion" "pkill companion node;sleep 5s;pkill -9 companion node;companion"
["Companion"]="pkill companion node;sleep 5s;pkill -9 companion node;companion" is_binary "cupsctl" && add_app "CUPS" "xdg-open http://localhost:631/"
["Cubiomes Viewer"]="flatpak run com.github.cubitect.cubiomes-viewer" add_binary "OpenRGB" "openrgb"
["QR Scanner"]="flatpak run dev.lasheen.qr" add_binary "ISOMaster" "isomaster"
["Cavasik"]="flatpak run io.github.TheWisker.Cavasik" add_binary "Universal Android Debloater" "uad_gui"
["Mousai"]="flatpak run io.github.seadve.Mousai" add_binary "CraftOS PC" "craftos"
["ISOMaster"]="isomaster" add_binary "CraftOS PC (JIT)" "craftos-luajit"
["Font Viewer"]="flatpak run org.gnome.font-viewer" add_binary "Charmap" "gucharmap"
["Seahorse"]="flatpak run org.gnome.seahorse.Application" add_binary "Ark" "ark"
["LibreOffice"]="flatpak run org.libreoffice.LibreOffice" add_binary "virt-manager" "virt-manager"
["qBittorrent"]="flatpak run org.qbittorrent.qBittorrent" add_binary "JamesDSP" "jamesdsp"
["Stellarium"]="flatpak run org.stellarium.Stellarium"
["jdNBTExplorer"]="flatpak run page.codeberg.JakobDev.jdNBTExplorer" # Flatpaks
["Universal Android Debloater"]="uad_gui" add_flatpak "Cubiomes Viewer" "com.github.cubitect.cubiomes-viewer"
["Speedtest"]="flatpak run xyz.ketok.Speedtest" add_flatpak "QR Scanner" "flatpak run dev.lasheen.qr"
["CraftOS PC"]="craftos-luajit" add_flatpak "Cavasik" "flatpak run io.github.TheWisker.Cavasik"
["Charmap"]="gucharmap" add_flatpak "Mousai" "io.github.seadve.Mousai"
["Ark"]="ark" add_flatpak "Font Viewer" "org.gnome.font-viewer"
["Ghostwriter"]="flatpak run org.kde.ghostwriter" add_flatpak "Seahorse" "org.gnome.seahorse.Application"
["Kalzium"]="flatpak run org.kde.kalzium" add_flatpak "LibreOffice" "org.libreoffice.LibreOffice"
["KCalc"]="flatpak run org.kde.kcalc" add_flatpak "qBittorrent" "org.qbittorrent.qBittorrent"
["Okteta"]="flatpak run org.kde.okteta" add_flatpak "Stellarium" "org.stellarium.Stellarium"
["virt-manager"]="virt-manager" add_flatpak "jdNBTExplorer" "page.codeberg.JakobDev.jdNBTExplorer"
["CUPS"]="xdg-open http://localhost:631/" add_flatpak "Speedtest" "xyz.ketok.Speedtest"
["JamesDSP"]="jamesdsp" add_flatpak "Ghostwriter" "org.kde.ghostwriter"
) add_flatpak "Kalzium" "org.kde.kalzium"
add_flatpak "KCalc" "org.kde.kcalc"
add_flatpak "Okteta" "org.kde.okteta"

View file

@ -1,19 +1,19 @@
#!/usr/bin/env bash #!/usr/bin/env bash
apps+=( # Binaries
["OpenRGB"]="openrgb" add_binary "GParted" "gparted"
["Flatseal"]="flatpak run com.github.tchx84.Flatseal" add_binary "GSmartControl" "gsmartcontrol"
["Bottles"]="flatpak run com.usebottles.bottles" add_binary "Heimdall" "heimdall-frontend"
["GParted"]="gparted" add_binary "Ventoy" "ventoygui"
["GSmartControl"]="gsmartcontrol" add_binary "Winetricks" "winetricks --gui"
["Heimdall"]="heimdall-frontend"
["Flatsweep"]="flatpak run io.github.giantpinkrobots.flatsweep" # Flatpaks
["ProtonUp-Qt"]="flatpak run net.davidotek.pupgui2" add_flatpak "Flatseal" "flatpak run com.github.tchx84.Flatseal"
["BleachBit"]="flatpak run org.bleachbit.BleachBit" add_flatpak "Bottles" "flatpak run com.usebottles.bottles"
["Filelight"]="flatpak run org.kde.filelight" add_flatpak "Flatsweep" "flatpak run io.github.giantpinkrobots.flatsweep"
["Imager"]="flatpak run org.raspberrypi.rpi-imager" add_flatpak "ProtonUp-Qt" "flatpak run net.davidotek.pupgui2"
["jdNBTExplorer"]="flatpak run page.codeberg.JakobDev.jdNBTExplorer" add_flatpak "BleachBit" "flatpak run org.bleachbit.BleachBit"
["Ventoy"]="ventoygui" add_flatpak "Filelight" "flatpak run org.kde.filelight"
["Cubiomes Viewer"]="flatpak run com.github.cubitect.cubiomes-viewer" add_flatpak "Imager" "flatpak run org.raspberrypi.rpi-imager"
["Winetricks"]="winetricks --gui" add_flatpak "jdNBTExplorer" "flatpak run page.codeberg.JakobDev.jdNBTExplorer"
) add_flatpak "Cubiomes Viewer" "flatpak run com.github.cubitect.cubiomes-viewer"