Skip to content

Commit

Permalink
Use Polkit agent for X11 sessions. Don't crash if polkit doesn't star…
Browse files Browse the repository at this point in the history
…t properly.
  • Loading branch information
SparkyBluefang committed Nov 14, 2024
1 parent 3724d7a commit 02203ac
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
1 change: 0 additions & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ Depends:
metacity,
nemo,
network-manager-gnome [linux-any],
policykit-1-gnome,
python3,
python3-dbus,
python3-distro,
Expand Down
4 changes: 1 addition & 3 deletions js/ui/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -440,9 +440,7 @@ function start() {
_initUserSession();
screenRecorder = new ScreenRecorder.ScreenRecorder();

if (Meta.is_wayland_compositor()) {
PolkitAuthenticationAgent.init();
}
PolkitAuthenticationAgent.init();

KeyringPrompt.init();

Expand Down
20 changes: 19 additions & 1 deletion js/ui/polkitAuthenticationAgent.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const ModalDialog = imports.ui.modalDialog;
const CinnamonEntry = imports.ui.cinnamonEntry;
const UserWidget = imports.ui.userWidget;
const Util = imports.misc.util;
const Main = imports.ui.main;

const DIALOG_ICON_SIZE = 64;
const DELAYED_RESET_TIMEOUT = 200;
Expand Down Expand Up @@ -441,5 +442,22 @@ var AuthenticationAgent = class {
}

function init() {
let agent = new AuthenticationAgent();
try {
let agent = new AuthenticationAgent();
} catch(err) {
if(!(err instanceof Error)) {
err = new Error(err);
}

log('polkitAuthenticationAgent: init error ' + err);

let icon = new St.Icon({ icon_name: 'dialog-warning',
icon_type: St.IconType.FULLCOLOR,
icon_size: 36 });

Main.warningNotify(_('Unable to start Cinnamon PolicyKit Agent'), err.message +
"\n\n" +
_("If you have another PolicyKit Agent configured to autostart, it should be disabled."),
icon);
}
}

0 comments on commit 02203ac

Please sign in to comment.