fix(bbsteamie): use plasma wayland without annoying popups
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-08-04 18:44:53 -04:00
parent d8ef7d99ed
commit 8aa6f5b2b0
6 changed files with 92 additions and 19 deletions

View file

@ -1,6 +1,6 @@
{pkgs, ...}: let
# switch to wayland when possible
defaultSession = "plasmax11";
defaultSession = "plasma";
in {
imports = [
(import ./session-switching.nix defaultSession)
@ -22,6 +22,7 @@ in {
# Misc Apps
firefox
kdePackages.discover
kdePackages.krfb
# Libs
wl-clipboard

View file

@ -27,20 +27,14 @@ defaultSession: {
sudo ${pkgs.systemd}/bin/systemctl start to-gaming-mode.service
'';
in {
services = {
displayManager = {
sddm = {
enable = true;
autoLogin.relogin = true;
services.displayManager.sddm = {
enable = true;
autoLogin.relogin = true;
wayland = {
enable = true;
compositorCommand = "kwin";
};
};
wayland = {
enable = true;
compositorCommand = "kwin";
};
xserver.enable = true;
};
# Sets the default session at launch
@ -100,5 +94,17 @@ in {
config.home-manager.users.mariah.home.packages
)
+ "/share/applications/Gaming Mode.desktop";
# Fix remote control prompt showing up everytime
xdg.configFile = let
mkAutostart = name: flags: {
"autostart/${name}.desktop".text = "[Desktop Entry]\nType=Application\nExec=${name} ${flags}";
};
in (
# Needs xdg-desktop-portal-kde patch provided by `self.overlays.xdg-desktop-portal-kde`
{"plasmaremotedesktoprc".text = "[Sharing]\nUnattended=true";}
// (mkAutostart "krfb" "--nodialog %c")
// (mkAutostart "steam" "-silent %U")
);
};
}

View file

@ -114,6 +114,8 @@
perSystem (pkgs:
import ./packages {inherit self pkgs mkVersion inputs;});
overlays = import ./overlays {};
apps =
perSystem (pkgs:
import ./apps {inherit inputs pkgs;});

View file

@ -12,12 +12,16 @@
import input {
inherit system;
config.allowUnfree = true;
overlays = map (i: inputs.${i}.overlays.default) [
"discord-overlay"
"grim-hyprland"
"jovian"
"nixpkgs-wayland"
];
overlays =
(map (i: inputs.${i}.overlays.default) [
"discord-overlay"
"grim-hyprland"
"jovian"
"nixpkgs-wayland"
])
++ [
inputs.self.overlays.xdg-desktop-portal-kde
];
};
# Function that makes the attrs that make up the specialArgs

3
overlays/default.nix Normal file
View file

@ -0,0 +1,3 @@
{...}: {
xdg-desktop-portal-kde = import ./xdg-desktop-portal-kde;
}

View file

@ -0,0 +1,57 @@
(final: prev: {
kdePackages = prev.kdePackages.overrideScope (kfinal: kprev: {
xdg-desktop-portal-kde = kprev.xdg-desktop-portal-kde.overrideAttrs (o: {
patches =
(o.patches or [])
++ [
# https://invent.kde.org/plasma/xdg-desktop-portal-kde/-/issues/15#note_906047
(builtins.toFile
"rdp.patch"
# cpp
''
diff --git a/src/remotedesktop.cpp b/src/remotedesktop.cpp
index 99ce57f..af64eff 100644
--- a/src/remotedesktop.cpp
+++ b/src/remotedesktop.cpp
@@ -19,6 +19,8 @@
#include <KNotification>
#include <QGuiApplication>
#include <QRegion>
+#include <KSharedConfig>
+#include <KConfigGroup>
#include <QScreen>
RemoteDesktopPortal::RemoteDesktopPortal(QObject *parent)
@@ -152,14 +154,19 @@ uint RemoteDesktopPortal::Start(const QDBusObjectPath &handle,
notification->setIconName(QStringLiteral("krfb"));
notification->sendEvent();
} else {
- QScopedPointer<RemoteDesktopDialog, QScopedPointerDeleteLater> remoteDesktopDialog(
- new RemoteDesktopDialog(app_id, session->deviceTypes(), session->screenSharingEnabled()));
- Utils::setParentWindow(remoteDesktopDialog->windowHandle(), parent_window);
- Request::makeClosableDialogRequest(handle, remoteDesktopDialog.get());
- connect(session, &Session::closed, remoteDesktopDialog.data(), &RemoteDesktopDialog::reject);
-
- if (!remoteDesktopDialog->exec()) {
- return 1;
+ auto cfg = KSharedConfig::openConfig(QStringLiteral("plasmaremotedesktoprc"));
+ const auto unattendedAccess = cfg->group("Sharing").readEntry("Unattended", false);
+ if (!unattendedAccess)
+ {
+ QScopedPointer<RemoteDesktopDialog, QScopedPointerDeleteLater> remoteDesktopDialog(
+ new RemoteDesktopDialog(app_id, session->deviceTypes(), session->screenSharingEnabled()));
+ Utils::setParentWindow(remoteDesktopDialog->windowHandle(), parent_window);
+ Request::makeClosableDialogRequest(handle, remoteDesktopDialog.get());
+ connect(session, &Session::closed, remoteDesktopDialog.data(), &RemoteDesktopDialog::reject);
+
+ if (!remoteDesktopDialog->exec()) {
+ return 1;
+ }
}
}
'')
];
});
});
})