Skip to content

Commit

Permalink
Start ydotool.service outside the loop && logs
Browse files Browse the repository at this point in the history
  • Loading branch information
nlpsuge committed Feb 27, 2023
1 parent dc1efca commit 7653829
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
16 changes: 10 additions & 6 deletions closeSession.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,11 @@ var CloseSession = class {
if (workspacePersistent) this._updateWorkspacePersistent(true);

let [running_apps_closing_by_rules, new_running_apps] = this._getRunningAppsClosingByRules();
for(const app of running_apps_closing_by_rules) {
await this._tryCloseAppsByRules(app);
if (running_apps_closing_by_rules.length) {
await this._startYdotoold();
for(const app of running_apps_closing_by_rules) {
await this._tryCloseAppsByRules(app);
}
}

let promises = [];
Expand Down Expand Up @@ -321,7 +324,6 @@ var CloseSession = class {

this._log.info(`Closing ${app.get_name()} by sending: ${cmdStr} (${shortcutsOriginal.join(' ')})`);

await this._startYdotoold();
this._activateAndFocusWindow(app);
await SubprocessUtils.trySpawn(cmd,
(output) => {
Expand All @@ -340,6 +342,7 @@ var CloseSession = class {
async _startYdotoold() {
try {
return new Promise((resolve, reject) => {
Log.Log.getDefault().debug('Starting ydotool.service');
// Shell.util_start_systemd_unit only has been promisified since gnome 3.38
let startSystemdUnitMethod = Shell.util_start_systemd_unit;
if (Shell._original_util_start_systemd_unit) {
Expand All @@ -349,10 +352,11 @@ var CloseSession = class {
null,
(source, asyncResult) => {
try {
Shell.util_start_systemd_unit_finish(asyncResult);
resolve(true);
const started = Shell.util_start_systemd_unit_finish(asyncResult);
Log.Log.getDefault().debug(`Finished to start ydotool.service. Started: ${started}`);
resolve(started);
} catch (error) {
Log.Log.getDefault().error(error);
Log.Log.getDefault().error(error, 'Failed to start ydotool.service');
reject(false);
}
});
Expand Down
2 changes: 1 addition & 1 deletion ui/autoclose.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ var Autoclose = GObject.registerClass(
EndSessionDialog.EndSessionDialog.prototype.OpenAsync = function (parameters, invocation) {
try {
if (this._openingByAWSM) {
that._log.debug(`EndSessionDialog is already opening, ignore...`);
that._log.debug(`EndSessionDialog is already opening by AWSM, ignore...`);
return;
}

Expand Down

0 comments on commit 7653829

Please sign in to comment.