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
set -eo pipefail
# Define associative array
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" ]] && (
echo ":: Creating template script"
mkdir -p "${HOME}/.config/launch-menu-apps.d"
cat << EOF >> "${HOME}/.config/launch-menu-apps.d/template.sh.disabled"
#!/usr/bin/env bash
@ -15,18 +63,35 @@ apps+=(
)
EOF
)
# Do nothing if no scripts could be found to source
# shellcheck disable=SC2012
[[ "$(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
echo ":: Sourcing script ${script}"
# shellcheck disable=SC1090
source "${script}"
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
if [ -n "${MENU_SORT}" ]; then
echo ":: Sorting entries"
echo ":: Warning: Sorting is currently broken and is considered experimental"
declare -a apps_sorted=($(
@ -62,8 +127,13 @@ for app in "${!apps[@]}"; do
done
# Make selection
echo ":: Invoking 'launch-menu'"
selection=$(echo -e "${apps_keys}" | ${HOME}/.local/bin/launch-menu "start")
# Terminate if no selection was made
[ -z "${selection}" ] && exit 0
# Execute
echo ":: Executing"
# shellcheck disable=SC2086
( eval ${apps[${selection}]} )

View file

@ -1,9 +1,7 @@
#!/usr/bin/env bash
apps+=(
["LibreWolf"]="librewolf"
["Epiphany"]="epiphany"
["Dolphin"]="dolphin"
["Gwenview"]="gwenview"
["Konsole"]="konsole"
)
is_binary "librewolf" && add_app "LibreWolf" "librewolf"
is_binary "epiphany" && add_app "Epiphany" "epiphany"
is_binary "dolphin" && add_app "Dolphin" "dolphin"
is_binary "gwenview" && add_app "Gwenview" "gwenview"
is_binary "konsole" && add_app "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
apps+=(
["Android Studio"]="source ${HOME}/.bashrc.d/programs.d/sdkman.sh;flatpak run com.google.AndroidStudio"
["Bytecode Viewer"]="bytecodeviewer"
["IntelliJ IDEA"]="source ${HOME}/.bashrc.d/programs.d/sdkman.sh;idea"
["VisualVM"]="source ${HOME}/.bashrc.d/programs.d/sdkman.sh;visualvm"
["Godot Engine (native)"]="godot"
["Godot Engine 4"]="flatpak run org.godotengine.Godot"
["Godot Engine 3"]="flatpak run org.godotengine.Godot3"
["VSCodium"]="codium --enable-features=UseOzonePlatform,WaylandWindowDecorations --ozone-platform=wayland"
)
is_flatpak "com.google.AndroidStudio" && add_app "Android Studio" "flatpak run com.google.AndroidStudio"
is_binary "bytecodeviewer" && add_app "Bytecode Viewer" "bytecodeviewer"
is_binary "idea" && add_app "IntelliJ IDEA" "idea"
is_binary "visualvm" && add_app "VisualVM" "visualvm"
is_binary "godot" && add_app "Godot Engine 4 (native)" "godot"
is_flatpak "org.godotengine.Godot" && add_app "Godot Engine 4" "flatpak run org.godotengine.Godot"
is_flatpak "org.godotengine.Godot3" && add_app "Godot Engine 3" "flatpak run org.godotengine.Godot3"
is_binary "codium" && add_app "VSCodium" "codium --enable-features=UseOzonePlatform,WaylandWindowDecorations --ozone-platform=wayland"

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,29 +1,31 @@
#!/usr/bin/env bash
apps+=(
["OpenRGB"]="openrgb"
["Companion"]="pkill companion node;sleep 5s;pkill -9 companion node;companion"
["Cubiomes Viewer"]="flatpak run com.github.cubitect.cubiomes-viewer"
["QR Scanner"]="flatpak run dev.lasheen.qr"
["Cavasik"]="flatpak run io.github.TheWisker.Cavasik"
["Mousai"]="flatpak run io.github.seadve.Mousai"
["ISOMaster"]="isomaster"
["Font Viewer"]="flatpak run org.gnome.font-viewer"
["Seahorse"]="flatpak run org.gnome.seahorse.Application"
["LibreOffice"]="flatpak run org.libreoffice.LibreOffice"
["qBittorrent"]="flatpak run org.qbittorrent.qBittorrent"
["Stellarium"]="flatpak run org.stellarium.Stellarium"
["jdNBTExplorer"]="flatpak run page.codeberg.JakobDev.jdNBTExplorer"
["Universal Android Debloater"]="uad_gui"
["Speedtest"]="flatpak run xyz.ketok.Speedtest"
["CraftOS PC"]="craftos-luajit"
["Charmap"]="gucharmap"
["Ark"]="ark"
["Ghostwriter"]="flatpak run org.kde.ghostwriter"
["Kalzium"]="flatpak run org.kde.kalzium"
["KCalc"]="flatpak run org.kde.kcalc"
["Okteta"]="flatpak run org.kde.okteta"
["virt-manager"]="virt-manager"
["CUPS"]="xdg-open http://localhost:631/"
["JamesDSP"]="jamesdsp"
)
# Binaries
is_binary "companion" && add_app "Companion" "pkill companion node;sleep 5s;pkill -9 companion node;companion"
is_binary "cupsctl" && add_app "CUPS" "xdg-open http://localhost:631/"
add_binary "OpenRGB" "openrgb"
add_binary "ISOMaster" "isomaster"
add_binary "Universal Android Debloater" "uad_gui"
add_binary "CraftOS PC" "craftos"
add_binary "CraftOS PC (JIT)" "craftos-luajit"
add_binary "Charmap" "gucharmap"
add_binary "Ark" "ark"
add_binary "virt-manager" "virt-manager"
add_binary "JamesDSP" "jamesdsp"
# Flatpaks
add_flatpak "Cubiomes Viewer" "com.github.cubitect.cubiomes-viewer"
add_flatpak "QR Scanner" "flatpak run dev.lasheen.qr"
add_flatpak "Cavasik" "flatpak run io.github.TheWisker.Cavasik"
add_flatpak "Mousai" "io.github.seadve.Mousai"
add_flatpak "Font Viewer" "org.gnome.font-viewer"
add_flatpak "Seahorse" "org.gnome.seahorse.Application"
add_flatpak "LibreOffice" "org.libreoffice.LibreOffice"
add_flatpak "qBittorrent" "org.qbittorrent.qBittorrent"
add_flatpak "Stellarium" "org.stellarium.Stellarium"
add_flatpak "jdNBTExplorer" "page.codeberg.JakobDev.jdNBTExplorer"
add_flatpak "Speedtest" "xyz.ketok.Speedtest"
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
apps+=(
["OpenRGB"]="openrgb"
["Flatseal"]="flatpak run com.github.tchx84.Flatseal"
["Bottles"]="flatpak run com.usebottles.bottles"
["GParted"]="gparted"
["GSmartControl"]="gsmartcontrol"
["Heimdall"]="heimdall-frontend"
["Flatsweep"]="flatpak run io.github.giantpinkrobots.flatsweep"
["ProtonUp-Qt"]="flatpak run net.davidotek.pupgui2"
["BleachBit"]="flatpak run org.bleachbit.BleachBit"
["Filelight"]="flatpak run org.kde.filelight"
["Imager"]="flatpak run org.raspberrypi.rpi-imager"
["jdNBTExplorer"]="flatpak run page.codeberg.JakobDev.jdNBTExplorer"
["Ventoy"]="ventoygui"
["Cubiomes Viewer"]="flatpak run com.github.cubitect.cubiomes-viewer"
["Winetricks"]="winetricks --gui"
)
# Binaries
add_binary "GParted" "gparted"
add_binary "GSmartControl" "gsmartcontrol"
add_binary "Heimdall" "heimdall-frontend"
add_binary "Ventoy" "ventoygui"
add_binary "Winetricks" "winetricks --gui"
# Flatpaks
add_flatpak "Flatseal" "flatpak run com.github.tchx84.Flatseal"
add_flatpak "Bottles" "flatpak run com.usebottles.bottles"
add_flatpak "Flatsweep" "flatpak run io.github.giantpinkrobots.flatsweep"
add_flatpak "ProtonUp-Qt" "flatpak run net.davidotek.pupgui2"
add_flatpak "BleachBit" "flatpak run org.bleachbit.BleachBit"
add_flatpak "Filelight" "flatpak run org.kde.filelight"
add_flatpak "Imager" "flatpak run org.raspberrypi.rpi-imager"
add_flatpak "jdNBTExplorer" "flatpak run page.codeberg.JakobDev.jdNBTExplorer"
add_flatpak "Cubiomes Viewer" "flatpak run com.github.cubitect.cubiomes-viewer"