Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Build directories
build/
dist/

# CMake generated files
CMakeFiles/
CMakeCache.txt
cmake_install.cmake
Makefile

# Qt generated files
*.moc
moc_*.cpp
ui_*.h
*.qrc.cpp

# Object files
*.o
*.obj

# Executables
*.exe
DLauncher

# IDE files
.vscode/
.idea/
*.user
*.pro.user

# Temporary files
*.tmp
*.temp

# OS generated files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ DLauncher is a lightweight C++ application designed to serve as a launcher. It p
- Make or Ninja (depending on your platform)

## Dependencies
- Qt 5 or higher (for GUI components)
- Qt 6 or higher (for GUI components)

### Building

Expand Down
16 changes: 6 additions & 10 deletions main.cpp
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@

#include "LockedLineEdit.h"
#include "list/list.h"
#include "components/list/list.h"
#include "listeners/kb.h"
#include "src/components/appRow/appRow.h"
#include "src/utils/readApps.h"
#include "utils.h"
#include "components/appRow/appRow.h"
#include "utils/readApps.h"
#include "utils/utils.h"
#include <QApplication>
#include <QIcon>
#include <QLabel>
#include <QLineEdit>
#include <QProcess>
#include <QScreen>
#include <QSizePolicy>
#include <QVBoxLayout>
#include <QWidget>
#include <iostream>
#include <qprocess.h>
#include <qsizepolicy.h>

Qt::WindowFlags devFlags() {
return Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint;
Expand All @@ -25,7 +24,6 @@ int main(int argc, char *argv[]) {
AppReader appReader;
QApplication app(argc, argv);
GlobalEventListener globalKbListener(app);
QProcess *process = new QProcess();

appReader.LoadApps();

Expand Down Expand Up @@ -104,9 +102,7 @@ int main(int argc, char *argv[]) {
}

std::cout << "Launching: " << cmd << std::endl;
// std::system(cmd.c_str());
process->startDetached(QString::fromStdString(cmd));
// QProcess::startDetached(QString::fromStdString(cmd));
QProcess::startDetached(QString::fromStdString(cmd));
app.quit();
}
}
Expand Down
Empty file removed src/search/search.cpp
Empty file.
8 changes: 0 additions & 8 deletions src/search/search.h

This file was deleted.

8 changes: 4 additions & 4 deletions src/utils/readApps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ void AppReader::LoadApps() {
std::filesystem::directory_iterator(expandedPath)) {
if (entry.path().extension() != ".desktop")
continue;
allAps.push_back(parseDesktopApp(entry.path()));
allApps.push_back(parseDesktopApp(entry.path()));
}
} catch (const std::filesystem::filesystem_error &e) {
std::cerr << "Filesystem error: " << e.what() << std::endl;
Expand All @@ -41,7 +41,7 @@ AppReader::ReadDesktopApps(int limit, const std::string &searchTerm) {
std::vector<DesktopApp> filtered;
std::string searchLower = toLower(searchTerm);

for (const auto &app : allAps) {
for (const auto &app : allApps) {
if (searchTerm.empty() ||
toLower(app.name).find(searchLower) != std::string::npos) {
filtered.push_back(app);
Expand All @@ -55,15 +55,15 @@ AppReader::ReadDesktopApps(int limit, const std::string &searchTerm) {
return filtered;
}

std::vector<DesktopApp> AppReader::GetAllApps() { return allAps; }
std::vector<DesktopApp> AppReader::GetAllApps() { return allApps; }

std::vector<DesktopApp> AppReader::SearchApps(std::string searchTerm, int limit,
bool isFuzzy) {
std::vector<DesktopApp> results;
std::string searchLower = toLower(searchTerm);

if (isFuzzy) {
for (const auto &app : allAps) {
for (const auto &app : allApps) {
std::string appNameLower = toLower(app.name);
std::string exec = toLower(app.exec);
if (similarity(appNameLower, searchLower) > 0.4) {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/readApps.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@ class AppReader {
"/var/lib/flatpak/applications",
"/var/lib/flatpak/exports/share/applications"};

std::vector<DesktopApp> allAps;
std::vector<DesktopApp> allApps;
};
3 changes: 1 addition & 2 deletions src/utils/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ std::vector<std::string> toStringArray(const std::string &content,
const std::string &delimiter = "\n");

size_t contains(const std::string &str, const std::string &search,
const bool caseSensetive = true);
const bool caseSensitive = true);

std::string toLower(const std::string &str);
std::string toLower(const std::string &s);
std::string ltrim(const std::string &s);
std::string rtrim(const std::string &s);
std::string trim(const std::string &s);
Expand Down