Compare commits

..

6 Commits

Author SHA1 Message Date
Malte Jürgens
e7e6c5d82b update readme 2022-07-30 21:14:56 +02:00
Malte Jürgens
ee0c66762d add --enable-features=WebRTCPipeWireCapturer
Co-authored-by: edisionnano <samantas5855@gmail.com>
2022-07-30 21:09:30 +02:00
LukeVader
c3483a42db disclaimer (#23)
* disclaimer

add a disclaimer that no responsibility is on the developers in the case of any repercussions of breaking discord TOS

* Update disclaimer

Co-authored-by: Malte Jürgens <maltejur@dismail.de>

Co-authored-by: Malte Jürgens <maltejur@dismail.de>
2022-07-29 21:01:11 +00:00
Malte Jürgens
d68797cebb make KF5Notifications optional 2022-07-29 16:31:04 +02:00
Malte Jürgens
ef221d4574 implement better notifications 2022-07-29 16:08:19 +02:00
Malte Jürgens
3fa2e3fa3c update installation instructions 2022-07-29 14:41:00 +02:00
5 changed files with 67 additions and 8 deletions

View File

@@ -18,6 +18,12 @@ find_package(Qt5 CONFIG REQUIRED COMPONENTS
WebEngineWidgets WebEngineWidgets
) )
option(KF5NOTIFICATIONS "Use KF5Notifications for enhanced system notifications" ON)
if(KF5NOTIFICATIONS)
add_definitions( -DKF5NOTIFICATIONS )
find_package(KF5Notifications)
endif()
set(discord-screenaudio_SRC set(discord-screenaudio_SRC
src/main.cpp src/main.cpp
src/mainwindow.cpp src/mainwindow.cpp
@@ -52,6 +58,11 @@ add_executable(discord-screenaudio ${discord-screenaudio_SRC})
target_link_libraries(discord-screenaudio Qt5::Widgets Qt5::WebEngineWidgets rohrkabel) target_link_libraries(discord-screenaudio Qt5::Widgets Qt5::WebEngineWidgets rohrkabel)
if(KF5NOTIFICATIONS)
target_link_libraries(discord-screenaudio KF5::Notifications)
install(FILES assets/discord-screenaudio.notifyrc DESTINATION ${CMAKE_INSTALL_PREFIX}/share/knotifications5)
endif()
install(TARGETS discord-screenaudio DESTINATION bin) install(TARGETS discord-screenaudio DESTINATION bin)
install(FILES assets/de.shorsh.discord-screenaudio.png DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/256x256/apps) install(FILES assets/de.shorsh.discord-screenaudio.png DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/256x256/apps)
install(PROGRAMS assets/de.shorsh.discord-screenaudio.desktop DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications) install(PROGRAMS assets/de.shorsh.discord-screenaudio.desktop DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications)

View File

@@ -15,18 +15,30 @@ case you want to stream something, maybe used with a second account. For
anything else, this client has way too many things that work less well than in anything else, this client has way too many things that work less well than in
the original client. the original client.
Technically this could be against
[Discord's TOS](https://discord.com/terms#software-in-discord%E2%80%99s-services),
so be warned. Discord probably won't ban you for using this, but if they do I
told you and it's not my fault.
## Known Issues ## Known Issues
- Only works with **PipeWire** - Only works with **PipeWire**
- Only works on **X11** - Can only share primary screen on X11 (no other screens or specific applications)
- Can only share primary screen (no other screens or specific applications) (see (see [#1](https://github.com/maltejur/discord-screenaudio/issues/1))
[#1](https://github.com/maltejur/discord-screenaudio/issues/1))
## Installation ## Installation
If you are using Arch, you can build and install You have multiple options:
[from the AUR](https://aur.archlinux.org/packages/discord-screenaudio). If you
aren't, you will have to [build it yourself](#building-from-source). - Install the Flatpak (recommended):
`flatpak install de.shorsh.discord-screenaudio`
- If you are on Arch, you can build and install
[`discord-screenaudio`](https://aur.archlinux.org/packages/discord-screenaudio)
from the AUR
- If you are on openSUSE, you can use the
[Open Build Service package](https://software.opensuse.org/download.html?project=home%3AVortexAcherontic&package=discord-screenaudio)
by [@VortexAcherontic](https://github.com/VortexAcherontic)
- You can [build it yourself](#building-from-source)
## Building from Source ## Building from Source
@@ -34,12 +46,12 @@ aren't, you will have to [build it yourself](#building-from-source).
- Basic building tools - Basic building tools
- CMake - CMake
- Qt5 and QtWebEngine - Qt5, QtWebEngine and Kf5Notifications
- **PipeWire** (it currently doesn't work with PulseAudio) - **PipeWire** (it currently doesn't work with PulseAudio)
- Git - Git
On Debian: On Debian:
`apt install -y build-essential cmake qtbase5-dev qtwebengine5-dev pkg-config libpipewire-0.3-dev git` `apt install -y build-essential cmake qtbase5-dev qtwebengine5-dev libkf5notifications-dev pkg-config libpipewire-0.3-dev git`
### Building ### Building

View File

@@ -0,0 +1,8 @@
[Global]
IconName=de.shorsh.discord-screenaudio
Name=discord-screenaudio
DesktopEntry=de.shorsh.discord-screenaudio.desktop
[Event/discordNotification]
Name=Discord Notification
Action=Popup

View File

@@ -10,6 +10,7 @@ int main(int argc, char *argv[]) {
QApplication::setWindowIcon( QApplication::setWindowIcon(
QIcon(":assets/de.shorsh.discord-screenaudio.png")); QIcon(":assets/de.shorsh.discord-screenaudio.png"));
QApplication::setApplicationVersion(DISCORD_SCEENAUDIO_VERSION_FULL); QApplication::setApplicationVersion(DISCORD_SCEENAUDIO_VERSION_FULL);
QApplication::setDesktopFileName("de.shorsh.discord-screenaudio");
QCommandLineParser parser; QCommandLineParser parser;
parser.setApplicationDescription( parser.setApplicationDescription(
@@ -29,6 +30,10 @@ int main(int argc, char *argv[]) {
Virtmic::start(parser.value(virtmicOption)); Virtmic::start(parser.value(virtmicOption));
} }
qputenv("QTWEBENGINE_CHROMIUM_FLAGS",
"--enable-features=WebRTCPipeWireCapturer " +
qgetenv("QTWEBENGINE_CHROMIUM_FLAGS"));
MainWindow w; MainWindow w;
w.show(); w.show();

View File

@@ -1,6 +1,10 @@
#include "mainwindow.h" #include "mainwindow.h"
#include "virtmic.h" #include "virtmic.h"
#ifdef KF5NOTIFICATIONS
#include <KNotification>
#endif
#include <QApplication> #include <QApplication>
#include <QColor> #include <QColor>
#include <QComboBox> #include <QComboBox>
@@ -11,6 +15,8 @@
#include <QSpacerItem> #include <QSpacerItem>
#include <QThread> #include <QThread>
#include <QUrl> #include <QUrl>
#include <QWebEngineNotification>
#include <QWebEngineProfile>
#include <QWebEngineScript> #include <QWebEngineScript>
#include <QWebEngineScriptCollection> #include <QWebEngineScriptCollection>
#include <QWebEngineSettings> #include <QWebEngineSettings>
@@ -30,6 +36,23 @@ void MainWindow::setupWebView() {
m_webView = new QWebEngineView(this); m_webView = new QWebEngineView(this);
m_webView->setPage(page); m_webView->setPage(page);
#ifdef KF5NOTIFICATIONS
QWebEngineProfile::defaultProfile()->setNotificationPresenter(
[&](std::unique_ptr<QWebEngineNotification> notificationInfo) {
KNotification *notification = new KNotification("discordNotification");
notification->setTitle(notificationInfo->title());
notification->setText(notificationInfo->message());
notification->setPixmap(QPixmap::fromImage(notificationInfo->icon()));
notification->setDefaultAction("View");
connect(notification, &KNotification::defaultActivated,
[&, notificationInfo = std::move(notificationInfo)]() {
notificationInfo->click();
activateWindow();
});
notification->sendEvent();
});
#endif
setCentralWidget(m_webView); setCentralWidget(m_webView);
} }