72 lines
3.0 KiB
C++
72 lines
3.0 KiB
C++
#include "Launcher.hpp"
|
|
|
|
namespace {
|
|
QVariantList strList(std::initializer_list<const char *> items) {
|
|
QVariantList list;
|
|
for (auto *item : items) list << QString::fromLatin1(item);
|
|
return list;
|
|
}
|
|
|
|
QVariantMap action(QVariantList command, bool dangerous, const char *description,
|
|
bool enabled, const char *icon, const char *name) {
|
|
QVariantMap m;
|
|
m["command"] = std::move(command);
|
|
m["dangerous"] = dangerous;
|
|
m["description"] = QString::fromLatin1(description);
|
|
m["enabled"] = enabled;
|
|
m["icon"] = QString::fromLatin1(icon);
|
|
m["name"] = QString::fromLatin1(name);
|
|
return m;
|
|
}
|
|
}
|
|
|
|
LauncherSizes::LauncherSizes(QObject *parent) : ConfigSection(parent) {
|
|
m_itemHeight = 50;
|
|
m_itemWidth = 600;
|
|
m_wallpaperHeight = 200;
|
|
m_wallpaperWidth = 280;
|
|
wireSignals();
|
|
}
|
|
|
|
UseFuzzy::UseFuzzy(QObject *parent) : ConfigSection(parent) {
|
|
m_actions = true;
|
|
m_apps = true;
|
|
m_schemes = true;
|
|
m_variants = true;
|
|
m_wallpapers = true;
|
|
wireSignals();
|
|
}
|
|
|
|
Launcher::Launcher(QObject *parent) : ConfigSection(parent) {
|
|
m_actionPrefix = QStringLiteral("<");
|
|
m_actions = {
|
|
action(strList({"autocomplete", "calc"}), false, "Do simple math equations", true, "calculate", "Calculator"),
|
|
action(strList({"setMode", "light"}), false, "Change to light mode", true, "light_mode", "Light"),
|
|
action(strList({"setMode", "dark"}), false, "Change to dark mode", true, "dark_mode", "Dark"),
|
|
action(strList({"autocomplete", "wallpaper"}), false, "Change the current wallpaper", true, "image", "Wallpaper"),
|
|
action(strList({"autocomplete", "variant"}), false, "Change the current scheme variant", true, "colors", "Variant"),
|
|
action(strList({"systemctl", "poweroff"}), true, "Shutdown the system", true, "power_settings_new", "Shutdown"),
|
|
action(strList({"systemctl", "reboot"}), true, "Reboot the system", true, "cached", "Reboot"),
|
|
action(strList({"loginctl", "terminate-user", ""}), true, "Log out of the current session", true, "logout", "Logout"),
|
|
action(strList({"loginctl", "lock-session"}), false, "Lock the current session", true, "lock", "Lock"),
|
|
action(strList({"systemctl", "suspend-then-hibernate"}), false, "Suspend then hibernate", true, "bedtime", "Sleep"),
|
|
};
|
|
m_dragThreshold = 150;
|
|
m_enableDangerousActions = true;
|
|
m_enabled = true;
|
|
m_favoriteApps = strList({"Balatro", "Slay the Spire 2", "com.obsproject.Studio"});
|
|
m_hiddenApps = strList({
|
|
"zellij", "vim", "jshell-java-openjdk", "jconsole-java-openjdk",
|
|
"jshell-java21-openjdk", "jconsole-java21-openjdk", "jshell-java17-openjdk",
|
|
"jconsole-java17-openjdk", "org.neovim.nvim", "avahi-discover", "bvnc",
|
|
"bssh", "nm-connection-editor",
|
|
});
|
|
m_maxAppsShown = 18;
|
|
m_maxWallpapers = 7;
|
|
m_sizes = new LauncherSizes(this);
|
|
m_specialPrefix = QStringLiteral("@");
|
|
m_useFuzzy = new UseFuzzy(this);
|
|
m_uwsm = true;
|
|
wireSignals();
|
|
}
|