#pragma once #include #include #include #include #include #include namespace Waylight { struct ApplicationCache { enum class Type { Application, Link, Directory, }; struct Action { std::string name; // May not exist if DBusActivable=true std::optional exec; // Freedesktop Desktop Entry Spec 11.2 Table 3 says: // // If the name is an absolute path, the given file will be used. // If the name is not an absolute path, the algorithm described in // the Icon Theme Specification will be used to locate the icon. // // Thus, when deserializing, we will just check if it starts with / // to determine type. std::optional> icon; }; int id; std::filesystem::path desktop_entry_path; Type type { Type::Application }; bool terminal { false }; bool no_display { false }; std::optional path; std::optional comment; std::vector actions; // There should always be at least 1. bool dbus_activatable {}; // Unimplemented for now. }; struct Cache { explicit Cache(std::shared_ptr db); void rescan(); void dump(); void load(); private: std::vector m_apps; std::vector m_app_dirs; std::shared_ptr m_db; }; } // namespace Cache