Compare commits

...

12 Commits

Author SHA1 Message Date
Malte Jürgens
f01c941c90 add timeout to getAudioDevice 2022-08-01 22:26:44 +02:00
Malte Jürgens
95d391e869 fix remote debugging 2022-08-01 19:59:01 +02:00
Malte Jürgens
af107168db update metainfo description 2022-07-31 21:12:53 +02:00
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
Malte Jürgens
bda1bc0df6 fixed invisible stream dialog 2022-07-29 01:03:25 +02:00
Malte Jürgens
cb0f084d42 fix metainfo 2022-07-29 01:02:20 +02:00
Malte Jürgens
674ac146f2 use icon for window 2022-07-28 18:36:09 +02:00
10 changed files with 103 additions and 14 deletions

View File

@@ -18,6 +18,12 @@ find_package(Qt5 CONFIG REQUIRED COMPONENTS
WebEngineWidgets
)
option(KF5NOTIFICATIONS "Use KF5Notifications for enhanced system notifications" ON)
if(KF5NOTIFICATIONS)
add_definitions( -DKF5NOTIFICATIONS )
find_package(KF5Notifications)
endif()
set(discord-screenaudio_SRC
src/main.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)
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(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)

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
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
- Only works with **PipeWire**
- Only works on **X11**
- Can only share primary screen (no other screens or specific applications) (see
[#1](https://github.com/maltejur/discord-screenaudio/issues/1))
- Can only share primary screen on X11 (no other screens or specific applications)
(see [#1](https://github.com/maltejur/discord-screenaudio/issues/1))
## Installation
If you are using Arch, you can build and install
[from the AUR](https://aur.archlinux.org/packages/discord-screenaudio). If you
aren't, you will have to [build it yourself](#building-from-source).
You have multiple options:
- 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
@@ -34,12 +46,12 @@ aren't, you will have to [build it yourself](#building-from-source).
- Basic building tools
- CMake
- Qt5 and QtWebEngine
- Qt5, QtWebEngine and Kf5Notifications
- **PipeWire** (it currently doesn't work with PulseAudio)
- Git
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

View File

@@ -13,10 +13,12 @@
<description>
<p>A very WIP custom discord client that supports streaming with audio on Linux, made possible by the great work of @edisionnano and the Rohrkabel library by @Curve.</p>
<p>The purpose of this project is not to provide an alternative to the original Discord client. Rather, it should be used in addition to the original client in 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 the original client.</p>
<p>Technically this could be against Discord's TOS, 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.</p>
<p>Known issues:<ul><li>Only works with PipeWire</li><li>Can only share primary screen on X11</li></ul></p>
</description>
<launchable type="desktop-id">
discord-screenaudio.desktop
de.shorsh.discord-screenaudio.desktop
</launchable>
<screenshots>
@@ -32,4 +34,12 @@
<provides>
<binary>discord-screenaudio</binary>
</provides>
<content_rating type="oars-1.0">
<content_attribute id="social-chat">intense</content_attribute>
<content_attribute id="social-info">intense</content_attribute>
<content_attribute id="social-audio">intense</content_attribute>
<content_attribute id="social-contacts">intense</content_attribute>
<content_attribute id="money-purchasing">mild</content_attribute>
</content_rating>
</component>

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

@@ -3,10 +3,15 @@
navigator.mediaDevices.chromiumGetDisplayMedia =
navigator.mediaDevices.getDisplayMedia;
function sleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
const getAudioDevice = async (nameOfAudioDevice) => {
await navigator.mediaDevices.getUserMedia({
audio: true,
});
await sleep(500);
let devices = await navigator.mediaDevices.enumerateDevices();
let audioDevice = devices.find(({ label }) => label === nameOfAudioDevice);
return audioDevice;

View File

@@ -2,5 +2,6 @@
<RCC>
<qresource>
<file>assets/userscript.js</file>
<file>assets/de.shorsh.discord-screenaudio.png</file>
</qresource>
</RCC>

View File

@@ -1,3 +1,5 @@
#include "main.h"
#include "mainwindow.h"
#include "virtmic.h"
@@ -7,7 +9,10 @@
int main(int argc, char *argv[]) {
QApplication app(argc, argv);
QApplication::setApplicationName("discord-screenaudio");
QApplication::setWindowIcon(
QIcon(":assets/de.shorsh.discord-screenaudio.png"));
QApplication::setApplicationVersion(DISCORD_SCEENAUDIO_VERSION_FULL);
QApplication::setDesktopFileName("de.shorsh.discord-screenaudio");
QCommandLineParser parser;
parser.setApplicationDescription(
@@ -17,16 +22,24 @@ int main(int argc, char *argv[]) {
QCommandLineOption virtmicOption("virtmic", "Start the Virtual Microphone",
"target");
parser.addOption(virtmicOption);
#ifdef DEBUG
parser.addOption(QCommandLineOption(
"remote-debugging-port", "Chromium Remote Debugging Port", "port"));
#endif
QCommandLineOption degubOption("remote-debugging",
"Open Chromium Remote Debugging on port 9222");
parser.addOption(degubOption);
parser.process(app);
if (parser.isSet(virtmicOption)) {
Virtmic::start(parser.value(virtmicOption));
}
qputenv("QTWEBENGINE_CHROMIUM_FLAGS",
"--enable-features=WebRTCPipeWireCapturer " +
qgetenv("QTWEBENGINE_CHROMIUM_FLAGS"));
if (parser.isSet(degubOption))
qputenv("QTWEBENGINE_CHROMIUM_FLAGS",
"--remote-debugging-port=9222 " +
qgetenv("QTWEBENGINE_CHROMIUM_FLAGS"));
MainWindow w;
w.show();

6
src/main.h Normal file
View File

@@ -0,0 +1,6 @@
#pragma once
#include <QString>
int main(int argc, char *argv[]);
void addToEnvVar(const char *var, const char *val);

View File

@@ -1,6 +1,10 @@
#include "mainwindow.h"
#include "virtmic.h"
#ifdef KF5NOTIFICATIONS
#include <KNotification>
#endif
#include <QApplication>
#include <QColor>
#include <QComboBox>
@@ -11,6 +15,8 @@
#include <QSpacerItem>
#include <QThread>
#include <QUrl>
#include <QWebEngineNotification>
#include <QWebEngineProfile>
#include <QWebEngineScript>
#include <QWebEngineScriptCollection>
#include <QWebEngineSettings>
@@ -30,6 +36,23 @@ void MainWindow::setupWebView() {
m_webView = new QWebEngineView(this);
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);
}

View File

@@ -13,6 +13,7 @@ StreamDialog::StreamDialog() : QWidget() {
setAttribute(Qt::WA_QuitOnClose, false);
auto layout = new QVBoxLayout(this);
layout->setSizeConstraint(QLayout::SetFixedSize);
auto targetLabel = new QLabel(this);
targetLabel->setText("Which app do you want to stream sound from?");
@@ -57,7 +58,6 @@ StreamDialog::StreamDialog() : QWidget() {
setLayout(layout);
setWindowTitle("discord-screenaudio Stream Dialog");
setFixedSize(0, 0);
}
void StreamDialog::startStream() {