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

View file

@ -27,9 +27,7 @@ defaultSession: {
sudo ${pkgs.systemd}/bin/systemctl start to-gaming-mode.service sudo ${pkgs.systemd}/bin/systemctl start to-gaming-mode.service
''; '';
in { in {
services = { services.displayManager.sddm = {
displayManager = {
sddm = {
enable = true; enable = true;
autoLogin.relogin = true; autoLogin.relogin = true;
@ -38,10 +36,6 @@ in {
compositorCommand = "kwin"; compositorCommand = "kwin";
}; };
}; };
};
xserver.enable = true;
};
# Sets the default session at launch # Sets the default session at launch
systemd.services."set-session" = { systemd.services."set-session" = {
@ -100,5 +94,17 @@ in {
config.home-manager.users.mariah.home.packages config.home-manager.users.mariah.home.packages
) )
+ "/share/applications/Gaming Mode.desktop"; + "/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: perSystem (pkgs:
import ./packages {inherit self pkgs mkVersion inputs;}); import ./packages {inherit self pkgs mkVersion inputs;});
overlays = import ./overlays {};
apps = apps =
perSystem (pkgs: perSystem (pkgs:
import ./apps {inherit inputs pkgs;}); import ./apps {inherit inputs pkgs;});

View file

@ -12,11 +12,15 @@
import input { import input {
inherit system; inherit system;
config.allowUnfree = true; config.allowUnfree = true;
overlays = map (i: inputs.${i}.overlays.default) [ overlays =
(map (i: inputs.${i}.overlays.default) [
"discord-overlay" "discord-overlay"
"grim-hyprland" "grim-hyprland"
"jovian" "jovian"
"nixpkgs-wayland" "nixpkgs-wayland"
])
++ [
inputs.self.overlays.xdg-desktop-portal-kde
]; ];
}; };

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;
+ }
}
}
'')
];
});
});
})