mirror of
https://github.com/gosticks/PaperWM.git
synced 2026-08-16 14:10:28 +00:00
app: Don't throw in spawnWindow, let trySpawnWindow throw
`spawnWindow` can be useful from `user.js`, so we make it always succeed, while we while we introduce a throwing `trySpawnWindow` for internal use.
This commit is contained in:
@@ -27,7 +27,7 @@ function init() {
|
||||
|
||||
function spawnWithFallback(fallback, ...args) {
|
||||
try {
|
||||
return spawnWindow(...args);
|
||||
return trySpawnWindow(...args);
|
||||
} catch(e) {
|
||||
return fallback();
|
||||
}
|
||||
@@ -133,7 +133,7 @@ function duplicateWindow(metaWindow) {
|
||||
return true;
|
||||
}
|
||||
|
||||
function spawnWindow(app, workspace) {
|
||||
function trySpawnWindow(app, workspace) {
|
||||
if (typeof(app) === 'string') {
|
||||
app = new Shell.App({ app_info: Gio.DesktopAppInfo.new(app) });
|
||||
}
|
||||
@@ -146,6 +146,17 @@ function spawnWindow(app, workspace) {
|
||||
}
|
||||
}
|
||||
|
||||
function spawnWindow(app, workspace) {
|
||||
if (typeof(app) === 'string') {
|
||||
app = new Shell.App({ app_info: Gio.DesktopAppInfo.new(app) });
|
||||
}
|
||||
try {
|
||||
return trySpawnWindow(app, workspace);
|
||||
} catch(e) {
|
||||
// Let the overide take care any fallback
|
||||
return app.open_new_window(-1);
|
||||
}
|
||||
}
|
||||
|
||||
function expandCommandline(commandline, space) {
|
||||
let dir = space.settings.get_string('directory');
|
||||
|
||||
Reference in New Issue
Block a user