Introduce a "developer mode" toggle

At the moment, all it does is show and hide some pre-installed dev
tools. In the future, we could make it more comprehensive and
sophisticated.

Resolves #33
This commit is contained in:
Nate Graham
2026-06-25 19:24:42 -04:00
parent 9b119f1c3e
commit 8aa53df2db
2 changed files with 69 additions and 0 deletions

View File

@@ -0,0 +1,57 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
# SPDX-FileCopyrightText: 2026 Nate Graham <nate@kde.org>
# Turn "developer mode" on or off.
set -e
USR_APPS_LOCATION="/usr/share/applications/"
OPT_APPS_LOCATION="/opt/local/share/applications/"
PREINSTALLED_DEV_APPS="GammaRay.desktop \
org.kde.heaptrack.desktop \
org.kde.plasma.lookandfeelexplorer.desktop \
org.kde.plasma.themeexplorer.desktop \
org.kde.plasmaengineexplorer.desktop"
function enable_dev_apps
{
echo "Enabling development apps…"
run0 mkdir -p "$OPT_APPS_LOCATION" 1> /dev/null
for ITEM in $PREINSTALLED_DEV_APPS; do
run0 cp "${USR_APPS_LOCATION}${ITEM}" "${OPT_APPS_LOCATION}${ITEM}" 1> /dev/null
run0 sed -i "/NoDisplay=true/d" "${OPT_APPS_LOCATION}${ITEM}" 1> /dev/null
echo "- Enabled ${ITEM}"
done
echo "Refreshing app cache…"
kbuildsycoca6
echo "Done; development apps are now visible in the “Development” category of your launcher widget."
echo "files were installed in ${OPT_APPS_LOCATION}."
}
function disable_dev_apps
{
echo "Hiding development apps…"
for ITEM in $PREINSTALLED_DEV_APPS; do
run0 rm "${OPT_APPS_LOCATION}${ITEM}" 1> /dev/null
done
echo "Refreshing app cache…"
kbuildsycoca6
run0 rmdir --ignore-fail-on-non-empty "$OPT_APPS_LOCATION" 1> /dev/null
echo "Done; development apps are now hidden."
}
if [ -f "${OPT_APPS_LOCATION}GammaRay.desktop" ]; then
disable_dev_apps
else
enable_dev_apps
fi

View File

@@ -65,6 +65,18 @@ rm -rf \
/usr/bin/qvidcap \
/usr/share/applications/qvidcap.desktop \
# Development tools that are useful enough to pre-install, but that we
# don't want made visible to the user until they ask for them. Don't
# delete; just hide. The user can show them again with
# `toggle-developer-mode`.
# (audit once everything in plasma-sdk is on Flathub)
echo "NoDisplay=true" | tee -a \
/usr/share/applications/GammaRay.desktop \
/usr/share/applications/org.kde.heaptrack.desktop \
/usr/share/applications/org.kde.plasma.lookandfeelexplorer.desktop \
/usr/share/applications/org.kde.plasma.themeexplorer.desktop \
/usr/share/applications/org.kde.plasmaengineexplorer.desktop \
# Parts of plasma-sdk that are on Flathub now, so you can just get them from there
# (once everything is on Flathub, we can stop building plasma-sdk, and remove these lines)
rm -rf \