From 1c7bc4bc5cf98b1a99d8cfaf069e0a60597d319d Mon Sep 17 00:00:00 2001 From: ZanzyTHEbar Date: Tue, 18 Feb 2025 20:52:00 +0000 Subject: [PATCH] feat: add custom command arguments setting for editor launch --- ...l.extensions.vscode-workspaces.gschema.xml | 5 +++++ gnome-extension/src/extension.ts | 1 + gnome-extension/src/prefs.ts | 22 +++++++++++++++++-- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/gnome-extension/schemas/org.gnome.shell.extensions.vscode-workspaces.gschema.xml b/gnome-extension/schemas/org.gnome.shell.extensions.vscode-workspaces.gschema.xml index 69f652f..2bed58e 100644 --- a/gnome-extension/schemas/org.gnome.shell.extensions.vscode-workspaces.gschema.xml +++ b/gnome-extension/schemas/org.gnome.shell.extensions.vscode-workspaces.gschema.xml @@ -8,6 +8,11 @@ Path to your editor binary (code, codium, code-insiders) or 'auto' for automatic detection + + '' + Custom CMD Args + Arguments to pass to the editors' cli + false New Window diff --git a/gnome-extension/src/extension.ts b/gnome-extension/src/extension.ts index 3cd2647..3a6096f 100644 --- a/gnome-extension/src/extension.ts +++ b/gnome-extension/src/extension.ts @@ -14,6 +14,7 @@ import * as PopupMenu from 'resource:///org/gnome/shell/ui/popupMenu.js'; // TODO: Sort by Path, Recent, Saved // TODO: Ability to mark as favorite // TODO: Show favourites at the top separated by a separator + // TODO: Implement support for snap, and flatpak installations interface Workspace { diff --git a/gnome-extension/src/prefs.ts b/gnome-extension/src/prefs.ts index 84a5454..68d7359 100644 --- a/gnome-extension/src/prefs.ts +++ b/gnome-extension/src/prefs.ts @@ -37,7 +37,7 @@ export default class VSCodeWorkspacesPreferences extends ExtensionPreferences { const editorLocation = new Adw.EntryRow({ title: _('editor Location'), showApplyButton: true, - inputPurpose: Gtk.InputPurpose.TERMINAL, + inputPurpose: Gtk.InputPurpose.FREE_FORM, inputHints: Gtk.InputHints.WORD_COMPLETION, }); @@ -51,9 +51,20 @@ export default class VSCodeWorkspacesPreferences extends ExtensionPreferences { subtitle: _('Whether to prefer the workspace file over the workspace directory if a workspace file is present'), }); + const customCmdArgs = new Adw.EntryRow({ + title: _('Custom CMD Args'), + showApplyButton: true, + inputPurpose: Gtk.InputPurpose.FREE_FORM, + inputHints: Gtk.InputHints.NONE, + child: new Gtk.Entry({ + placeholder_text: _('Custom command line arguments for launching the editor'), + }) + }); + editorGroup.add(editorLocation); editorGroup.add(preferWorkspaceFile); editorGroup.add(debug); + editorGroup.add(customCmdArgs); page.add(editorGroup); // Group for Refresh Interval setting @@ -90,7 +101,7 @@ export default class VSCodeWorkspacesPreferences extends ExtensionPreferences { const nofailEntry = new Adw.EntryRow({ title: _('No-fail Workspaces'), showApplyButton: true, - inputPurpose: Gtk.InputPurpose.TERMINAL, + inputPurpose: Gtk.InputPurpose.FREE_FORM, inputHints: Gtk.InputHints.WORD_COMPLETION, child: new Gtk.Entry({ placeholder_text: _('Comma separated list of workspace directories to not fail'), @@ -135,6 +146,13 @@ export default class VSCodeWorkspacesPreferences extends ExtensionPreferences { Gio.SettingsBindFlags.DEFAULT ); + _settings.bind( + 'custom-cmd-args', + customCmdArgs, + 'text', + Gio.SettingsBindFlags.DEFAULT + ); + // Bind new settings _settings.bind( 'cleanup-orphaned-workspaces',