Compare commits

...

3 Commits

Author SHA1 Message Date
Wizzard
58c3ac0b71 Scripts 2023-07-11 19:50:07 -04:00
Wizzard
2858eb3854 Scruots 2023-07-11 19:49:39 -04:00
Malte Jürgens
94b27f5b6a implement ctrl+q keybind 2023-06-23 17:48:54 +02:00
7 changed files with 111 additions and 9 deletions

23
.gitignore vendored
View File

@@ -1,3 +1,20 @@
/build # Ignore build and output directories
.vscode /build/
/submodules/arrpc /.flatpak-builder/
# Ignore flatpak-builder cache
/.flatpak-builder-cache/
# Ignore flatpak-builder log files
/*.log
# Ignore flatpak-builder generated files
/*.flatpak
/*.flatpak-builder
/*.flatpak-origin
# Ignore specific files or directories
/override.json
/metadata/
/manifest.json
/CMakeLists.txt.user

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

28
install.sh Executable file
View File

@@ -0,0 +1,28 @@
#!/bin/bash
# Build Flatpak package
flatpak-builder build-dir lol.deadzone.discord-awesomeaudio.json --install --user --force-clean
# Create wrapper script
echo '#!/bin/bash
RUNNING=$(pgrep -f "discord-screenaudio")
if [[ -n $RUNNING ]]; then
WM_CLASS="discord-screenaudio"
else
WM_CLASS=""
fi
flatpak run --env=WM_CLASS="$WM_CLASS" lol.deadzone.discord-awesomeaudio' > ~/.local/bin/discord-awesomeaudio.sh
# Make the wrapper script executable
chmod +x ~/.local/bin/discord-awesomeaudio.sh
# Create .desktop file
echo "[Desktop Entry]
Name=Discord Awesome Audio
Exec=flatpak run lol.deadzone.discord-awesomeaudio
Icon=/path/to/application/icon.png
Type=Application
Categories=AudioVideo;Network;" > ~/.local/share/applications/discord-awesomeaudio.desktop
# Make the .desktop file executable (if necessary)
chmod +x ~/.local/share/applications/discord-awesomeaudio.desktop

View File

@@ -0,0 +1,44 @@
{
"app-id": "lol.deadzone.discord-awesomeaudio",
"runtime": "org.kde.Platform",
"runtime-version": "5.15-22.08",
"sdk": "org.kde.Sdk",
"base": "io.qt.qtwebengine.BaseApp",
"base-version": "5.15-22.08",
"command": "discord-screenaudio",
"finish-args": [
"--share=ipc",
"--share=network",
"--socket=wayland",
"--socket=fallback-x11",
"--socket=pulseaudio",
"--filesystem=xdg-videos:ro",
"--filesystem=xdg-pictures:ro",
"--filesystem=xdg-download",
"--filesystem=xdg-run/pipewire-0",
"--device=all",
"--talk-name=org.kde.StatusNotifierWatcher",
"--env=QTWEBENGINEPROCESS_PATH=/app/bin/QtWebEngineProcess",
"--talk-name=org.freedesktop.Notifications",
"--talk-name=org.kde.kglobalaccel"
],
"modules": [
{
"name": "discord-screenaudio",
"buildsystem": "cmake-ninja",
"config-opts": [
"-DCMAKE_BUILD_TYPE=RelWithDebInfo",
"-DGIT_SUBMODULE=OFF"
],
"sources": [
{
"type": "dir",
"path": "."
}
]
}
],
"finish-install": {
"desktop-file": "[Desktop Entry]\nName=Discord Awesome Audio\nExec=flatpak run lol.deadzone.discord-awesomeaudio\nIcon=/path/to/application/icon.png\nType=Application\nCategories=AudioVideo;Network;"
}
}

View File

@@ -12,6 +12,7 @@
#include <QGridLayout> #include <QGridLayout>
#include <QLabel> #include <QLabel>
#include <QPushButton> #include <QPushButton>
#include <QShortcut>
#include <QSpacerItem> #include <QSpacerItem>
#include <QThread> #include <QThread>
#include <QTimer> #include <QTimer>
@@ -31,6 +32,8 @@ MainWindow::MainWindow(bool useNotifySend, QWidget *parent)
setCentralWidget(m_centralWidget); setCentralWidget(m_centralWidget);
setupTrayIcon(); setupTrayIcon();
setMinimumSize(800, 300); setMinimumSize(800, 300);
connect(new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this),
&QShortcut::activated, this, &MainWindow::toggleOrCloseWindow);
if (m_settings->contains("geometry")) { if (m_settings->contains("geometry")) {
restoreGeometry(m_settings->value("geometry").toByteArray()); restoreGeometry(m_settings->value("geometry").toByteArray());
} else { } else {
@@ -79,12 +82,7 @@ void MainWindow::setupTrayIcon() {
connect(m_trayIcon, &QSystemTrayIcon::activated, [this](auto reason) { connect(m_trayIcon, &QSystemTrayIcon::activated, [this](auto reason) {
if (reason == QSystemTrayIcon::Trigger) { if (reason == QSystemTrayIcon::Trigger) {
if (isVisible()) { toggleOrCloseWindow();
hide();
} else {
show();
activateWindow();
}
} }
}); });
} }
@@ -131,3 +129,15 @@ MainWindow *MainWindow::instance() { return m_instance; }
CentralWidget *MainWindow::centralWidget() { CentralWidget *MainWindow::centralWidget() {
return instance()->m_centralWidget; return instance()->m_centralWidget;
}; };
void MainWindow::toggleOrCloseWindow() {
if (isVisible()) {
if (m_trayIcon == nullptr)
QApplication::quit();
else
hide();
} else {
show();
activateWindow();
}
}

View File

@@ -36,4 +36,5 @@ private:
public Q_SLOTS: public Q_SLOTS:
void setTrayIcon(bool enabled); void setTrayIcon(bool enabled);
void fullScreenRequested(QWebEngineFullScreenRequest fullScreenRequest); void fullScreenRequested(QWebEngineFullScreenRequest fullScreenRequest);
void toggleOrCloseWindow();
}; };

2
uninstall.sh Executable file
View File

@@ -0,0 +1,2 @@
flatpak remove lol.deadzone.discord-awesomeaudio
rm ~/.local/share/applications/discord-awesomeaudio.desktop