Skip to content

Commit e965ea3

Browse files
authored
normcap: fix on GNOME wayland when used via keybind or alt-f2 (#351763)
2 parents 2855b82 + d11baac commit e965ea3

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

pkgs/by-name/no/normcap/package.nix

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ ps.buildPythonApplication rec {
6161
dependencies = [
6262
ps.pyside6
6363
ps.jeepney
64+
ps.toml
6465
];
6566

6667
preFixup = ''
@@ -69,6 +70,28 @@ ps.buildPythonApplication rec {
6970
--set QT_QPA_PLATFORM xcb
7071
--prefix PATH : ${lib.makeBinPath wrapperDeps}
7172
)
73+
''
74+
+ lib.optionalString stdenv.hostPlatform.isLinux ''
75+
# cursed fix on GNOME+wayland
76+
# this works because systemd-run runs the command as an ad-hoc service named run-1234567890.service
77+
# FIXME: make something like `--slice=app-com.github.dynobo.normcap.slice`
78+
# work such that the "screenshot screenshot" permission in
79+
# `flatpak permissions` is associated with the xdg app id
80+
# "com.github.dynobo.normcap" and not ""
81+
makeWrapperArgs+=(
82+
--run '
83+
if command -v systemd-run >/dev/null; then
84+
exec -a "$0" systemd-run --wait --user \
85+
--setenv=PATH="$PATH" \
86+
--setenv=PYTHONNOUSERSITE="$PYTHONNOUSERSITE" \
87+
--setenv=QT_QPA_PLATFORM="$QT_QPA_PLATFORM" \
88+
${placeholder "out"}/bin/.normcap-wrapped "$@"
89+
else
90+
exec -a "$0" ${placeholder "out"}/bin/.normcap-wrapped "$@"
91+
fi
92+
exit $?
93+
'
94+
)
7295
'';
7396

7497
postInstall = lib.optionalString stdenv.hostPlatform.isLinux ''
@@ -81,7 +104,6 @@ ps.buildPythonApplication rec {
81104
ps.pytest-cov-stub
82105
ps.pytest-instafail
83106
ps.pytest-qt
84-
ps.toml
85107
] ++ lib.optionals stdenv.hostPlatform.isLinux [
86108
ps.pytest-xvfb
87109
xorg.xvfb

0 commit comments

Comments
 (0)