🐛 Include gitmojis in build

This commit is contained in:
2026-03-01 11:06:57 +01:00
parent 6a182a0025
commit 3a5ecc9ff2
3 changed files with 29 additions and 6 deletions

View File

@@ -4,6 +4,15 @@ project(gitmoji VERSION 1.0.0)
find_package(Albert REQUIRED) find_package(Albert REQUIRED)
albert_plugin( albert_plugin(
INCLUDE
INTERFACE include
PRIVATE include/albert/plugin
QT QT
Concurrent Widgets Concurrent Widgets
) )
# Add the resource file manually
qt6_add_resources(RESOURCES src/gitmojis.qrc)
# Add resources to the target
target_sources(gitmoji PRIVATE ${RESOURCES})

View File

@@ -9,6 +9,7 @@ A fast and efficient C++ implementation of the Gitmoji picker for Albert launche
- Configurable copy format via settings - Configurable copy format via settings
- Fast indexing and fuzzy search - Fast indexing and fuzzy search
- Native Albert C++ plugin - Native Albert C++ plugin
- Gitmoji data embedded as Qt resource (no external files needed)
## Installation ## Installation
@@ -26,12 +27,14 @@ Copy the built library to your Albert plugins directory:
```bash ```bash
# Local installation # Local installation
cp build/libgitmoji.so ~/.local/lib/albert/ cp build/gitmoji.so ~/.local/lib/albert/
# Or system-wide # Or system-wide
sudo cp build/libgitmoji.so /usr/lib/albert/ sudo cp build/gitmoji.so /usr/lib/albert/
``` ```
Restart Albert to load the plugin.
## Usage ## Usage
Trigger the plugin with `gm ` followed by your search query. Trigger the plugin with `gm ` followed by your search query.
@@ -43,17 +46,20 @@ Examples:
## Configuration ## Configuration
Access the plugin settings in Albert to choose what to copy: Access plugin settings in Albert to choose what to copy:
- **Emoji**: Copy the emoji character (e.g., 🎨) - **Emoji**: Copy emoji character (e.g., 🎨)
- **Gitmoji code**: Copy the code (e.g., :art:) - **Gitmoji code**: Copy code (e.g., :art:)
Settings are persisted using QSettings.
## Development ## Development
This plugin uses: This plugin uses:
- Albert C++ API - Albert C++ API
- Qt6 framework - Qt6 framework with embedded resources
- CMake build system - CMake build system
- IndexQueryHandler for efficient search - IndexQueryHandler for efficient search
- BackgroundExecutor for async indexing
## License ## License

View File

@@ -15,6 +15,8 @@ using namespace Qt::StringLiterals;
using namespace albert; using namespace albert;
using namespace std; using namespace std;
static bool resourcesInitialized = false;
static const QString CONFIG_KEY = u"copy_format"_s; static const QString CONFIG_KEY = u"copy_format"_s;
static const QString VALUE_EMOJI = u"emoji"_s; static const QString VALUE_EMOJI = u"emoji"_s;
static const QString VALUE_CODE = u"code"_s; static const QString VALUE_CODE = u"code"_s;
@@ -73,6 +75,12 @@ struct GitmojiItem : Item
Plugin::Plugin() Plugin::Plugin()
{ {
if (!resourcesInitialized)
{
Q_INIT_RESOURCE(gitmojis);
resourcesInitialized = true;
}
indexer.parallel = [this](const bool &abort) indexer.parallel = [this](const bool &abort)
{ {
vector<IndexItem> r; vector<IndexItem> r;