Files
z-bar-qt/Plugins/ZShell/Config/launcher.hpp

137 lines
4.0 KiB
C++

#pragma once
#include "common.hpp"
#include <QStringList>
namespace ZShell::config {
using Qt::StringLiterals::operator""_s;
using settings::vmap;
class LauncherActionEntry : public settings::ObjectNode {
CONFIG_NODE(LauncherActionEntry, settings::ObjectNode)
CONFIG_PROPERTY(QVariantList, command, {})
CONFIG_PROPERTY(bool, dangerous, false)
CONFIG_PROPERTY(QString, description, {})
CONFIG_PROPERTY(bool, enabled, true)
CONFIG_PROPERTY(QString, icon, {})
CONFIG_PROPERTY(QString, name, {})
};
CONFIG_LIST_TYPE(LauncherActionEntry, LauncherActionList)
class LauncherSizes : public settings::ObjectNode {
CONFIG_NODE(LauncherSizes, settings::ObjectNode)
CONFIG_PROPERTY(int, itemHeight, 50)
CONFIG_PROPERTY(int, itemWidth, 600)
CONFIG_PROPERTY(int, wallpaperHeight, 200)
CONFIG_PROPERTY(int, wallpaperWidth, 280)
};
class UseFuzzy : public settings::ObjectNode {
CONFIG_NODE(UseFuzzy, settings::ObjectNode)
CONFIG_PROPERTY(bool, actions, true)
CONFIG_PROPERTY(bool, apps, true)
CONFIG_PROPERTY(bool, schemes, true)
CONFIG_PROPERTY(bool, variants, true)
CONFIG_PROPERTY(bool, wallpapers, true)
};
class Launcher : public settings::ObjectNode {
CONFIG_NODE(Launcher, settings::ObjectNode)
CONFIG_PROPERTY(QString, actionPrefix, QStringLiteral("<"))
CONFIG_LIST(
LauncherActionList,
actions,
DEFAULT_ARG({
vmap(
{{"command", QVariantList{"autocomplete", "calc"}},
{"dangerous", false},
{"description", "Do simple math equations"},
{"enabled", true},
{"icon", "calculate"},
{"name", "Calculator"}}),
vmap(
{{"command", QVariantList{"setMode", "light"}},
{"dangerous", false},
{"description", "Change to light mode"},
{"enabled", true},
{"icon", "light_mode"},
{"name", "Light"}}),
vmap(
{{"command", QVariantList{"setMode", "dark"}},
{"dangerous", false},
{"description", "Change to dark mode"},
{"enabled", true},
{"icon", "dark_mode"},
{"name", "Dark"}}),
vmap(
{{"command", QVariantList{"autocomplete", "wallpaper"}},
{"dangerous", false},
{"description", "Change the current wallpaper"},
{"enabled", true},
{"icon", "image"},
{"name", "Wallpaper"}}),
vmap(
{{"command", QVariantList{"autocomplete", "variant"}},
{"dangerous", false},
{"description", "Change the current scheme variant"},
{"enabled", true},
{"icon", "colors"},
{"name", "Variant"}}),
vmap(
{{"command", QVariantList{"systemctl", "poweroff"}},
{"dangerous", true},
{"description", "Shutdown the system"},
{"enabled", true},
{"icon", "power_settings_new"},
{"name", "Shutdown"}}),
vmap(
{{"command", QVariantList{"systemctl", "reboot"}},
{"dangerous", true},
{"description", "Reboot the system"},
{"enabled", true},
{"icon", "cached"},
{"name", "Reboot"}}),
vmap(
{{"command", QVariantList{"loginctl", "terminate-user", ""}},
{"dangerous", true},
{"description", "Log out of the current session"},
{"enabled", true},
{"icon", "logout"},
{"name", "Logout"}}),
vmap(
{{"command", QVariantList{"loginctl", "lock-session"}},
{"dangerous", false},
{"description", "Lock the current session"},
{"enabled", true},
{"icon", "lock"},
{"name", "Lock"}}),
vmap(
{{"command",
QVariantList{"systemctl", "suspend-then-hibernate"}},
{"dangerous", false},
{"description", "Suspend then hibernate"},
{"enabled", true},
{"icon", "bedtime"},
{"name", "Sleep"}}),
}))
CONFIG_PROPERTY(int, dragThreshold, 150)
CONFIG_PROPERTY(bool, enableDangerousActions, true)
CONFIG_PROPERTY(bool, enabled, true)
CONFIG_PROPERTY(QStringList, favoriteApps, {})
CONFIG_PROPERTY(QStringList, hiddenApps, {})
CONFIG_PROPERTY(int, maxAppsShown, 18)
CONFIG_PROPERTY(int, maxWallpapers, 7)
CONFIG_SUBOBJECT(LauncherSizes, sizes)
CONFIG_PROPERTY(QString, specialPrefix, QStringLiteral("@"))
CONFIG_SUBOBJECT(UseFuzzy, useFuzzy)
CONFIG_PROPERTY(bool, uwsm, true)
};
} // namespace ZShell::config