commit 7be0570f7f923859c9ddcfb11575a13d1af97375
Author: JRoshthen1 <37882816+JRoshthen1@users.noreply.github.com>
Date: Sat Mar 22 23:20:23 2025 +0100
upload to github
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..5e81951
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,7 @@
+Copyright 2025 JRosh
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..ae20292
--- /dev/null
+++ b/README.md
@@ -0,0 +1,9 @@
+# Applet launcher Gnome extension
+
+A small extension to add a quick access (top bar) to applications in Gnome aside from Dash or Overlay.
+
+
+
+work in progress
+
+MIT license
\ No newline at end of file
diff --git a/extension.js b/extension.js
new file mode 100644
index 0000000..ac891cd
--- /dev/null
+++ b/extension.js
@@ -0,0 +1,73 @@
+const { Gio, St } = imports.gi;
+const Main = imports.ui.main;
+const ExtensionUtils = imports.misc.extensionUtils;
+const Me = ExtensionUtils.getCurrentExtension();
+const Settings = ExtensionUtils.getSettings();
+
+let appLaunchers = [];
+
+class AppLauncher {
+ constructor(appExecutable, appIcon, iconSize) {
+ this.appExecutable = appExecutable;
+ this.appIcon = appIcon;
+
+ this.button = new St.Bin({
+ style_class: 'panel-button',
+ reactive: true,
+ can_focus: true,
+ track_hover: true
+ });
+
+ let icon = new St.Icon({
+ gicon: Gio.icon_new_for_string(appIcon),
+ icon_size: iconSize
+ });
+
+ this.button.set_child(icon);
+ this.button.set_width(iconSize * 2);
+
+ this.button.connect('button-press-event', () => {
+ let appInfo = Gio.AppInfo.create_from_commandline(appExecutable, null, Gio.AppInfoCreateFlags.NONE);
+ if (appInfo) {
+ appInfo.launch([], null);
+ }
+ });
+ }
+}
+
+function updateTopBar() {
+ // remove all existing launchers
+ appLaunchers.forEach(launcher => {
+ Main.panel._leftBox.remove_child(launcher.button);
+ });
+ appLaunchers = [];
+
+ // Add launchers based on current settings
+ for (let i = 0; i < 10; i++) {
+ let appExecutable = Settings.get_string(`app-executable-${i}`);
+ let appIcon = Settings.get_string(`app-icon-${i}`);
+ let iconSize = Settings.get_int(`icon-size-${i}`);
+
+ // create a launcher If executable and icon are set,
+ if (appExecutable && appIcon) {
+ let appLauncher = new AppLauncher(appExecutable, appIcon, iconSize);
+
+ // Insert the launcher at the end of the left box
+ Main.panel._leftBox.add_child(appLauncher.button);
+ appLaunchers.push(appLauncher);
+ }
+ }
+}
+
+function enable() {
+ updateTopBar();
+ Settings.connect('changed', updateTopBar);
+}
+
+function disable() {
+ appLaunchers.forEach(launcher => {
+ Main.panel._leftBox.remove_child(launcher.button);
+ });
+ appLaunchers = [];
+ Settings.disconnect('changed', updateTopBar);
+}
\ No newline at end of file
diff --git a/firefox.svg b/firefox.svg
new file mode 100644
index 0000000..ea8f925
--- /dev/null
+++ b/firefox.svg
@@ -0,0 +1 @@
+
diff --git a/metadata.json b/metadata.json
new file mode 100644
index 0000000..2e21b42
--- /dev/null
+++ b/metadata.json
@@ -0,0 +1,14 @@
+{
+ "uuid": "applet-launcher@jroshthen1.github.io",
+ "name": "Applet Launcher",
+ "description": "A simple extension to launch desired applications from the top bar",
+ "shell-version": [
+ "42",
+ "43",
+ "44"
+ ],
+ "version": 1,
+ "settings-schema": "org.gnome.shell.extensions.applet-launcher@jroshthen1.github.io",
+ "gettext-domain": "applet-launcher@jroshthen1.github.io",
+ "prefs.js": "prefs.js"
+}
diff --git a/prefs.js b/prefs.js
new file mode 100644
index 0000000..8911c31
--- /dev/null
+++ b/prefs.js
@@ -0,0 +1,140 @@
+const { Gtk, Gio } = imports.gi;
+const ExtensionUtils = imports.misc.extensionUtils;
+const Me = ExtensionUtils.getCurrentExtension();
+
+function init() {
+}
+
+function buildPrefsWidget() {
+ let settings = ExtensionUtils.getSettings();
+
+// Create a vertical box to hold the widgets
+ let box = new Gtk.Box({
+ orientation: Gtk.Orientation.VERTICAL,
+ spacing: 10,
+ margin_start: 10,
+ margin_end: 10,
+ margin_top: 10,
+ margin_bottom: 10
+ });
+ let grid = new Gtk.Grid({
+ column_spacing: 10,
+ row_spacing: 10
+ });
+ box.append(grid);
+
+
+
+ function addExecutableInput(row, executable = '', icon = '', iconSize = 24) {
+ // label and entry for app executable
+ let appExecutableLabel = new Gtk.Label({
+ label: `App Executable ${row + 1}:`,
+ halign: Gtk.Align.START
+ });
+ let appExecutableEntry = new Gtk.Entry({
+ hexpand: true,
+ text: executable
+ });
+ // connect the entry to settings
+ appExecutableEntry.connect('changed', (entry) => {
+ settings.set_string(`app-executable-${row}`, entry.get_text());
+ });
+
+ // label and entry for the app icon SVG
+ let appIconLabel = new Gtk.Label({
+ label: `App Icon SVG ${row + 1}:`,
+ halign: Gtk.Align.START
+ });
+ let appIconEntry = new Gtk.Entry({
+ hexpand: true,
+ text: icon
+ });
+ appIconEntry.connect('changed', (entry) => {
+ settings.set_string(`app-icon-${row}`, entry.get_text());
+ });
+
+ // label and spin button for the icon size
+ let iconSizeLabel = new Gtk.Label({
+ label: `Icon Size ${row + 1}:`,
+ halign: Gtk.Align.START
+ });
+ let iconSizeSpin = new Gtk.SpinButton({
+ adjustment: new Gtk.Adjustment({
+ value: iconSize,
+ lower: 16,
+ upper: 64,
+ step_increment: 1,
+ page_increment: 10
+ }),
+ hexpand: true
+ });
+ iconSizeSpin.connect('value-changed', (spin) => {
+ settings.set_int(`icon-size-${row}`, spin.get_value_as_int());
+ });
+
+
+ let deleteButton = new Gtk.Button({
+ label: "Delete",
+ halign: Gtk.Align.END
+ });
+ deleteButton.connect('clicked', () => {
+ // Clear settings for this row
+ settings.set_string(`app-executable-${row}`, '');
+ settings.set_string(`app-icon-${row}`, '');
+ settings.set_int(`icon-size-${row}`, 24);
+
+ grid.remove(appExecutableLabel);
+ grid.remove(appExecutableEntry);
+ grid.remove(appIconLabel);
+ grid.remove(appIconEntry);
+ grid.remove(iconSizeLabel);
+ grid.remove(iconSizeSpin);
+ grid.remove(deleteButton);
+
+ reorganizeRows(row);
+ });
+
+ grid.attach(appExecutableLabel, 0, row * 3, 1, 1);
+ grid.attach(appExecutableEntry, 1, row * 3, 1, 1);
+ grid.attach(appIconLabel, 0, row * 3 + 1, 1, 1);
+ grid.attach(appIconEntry, 1, row * 3 + 1, 1, 1);
+ grid.attach(iconSizeLabel, 0, row * 3 + 2, 1, 1);
+ grid.attach(iconSizeSpin, 1, row * 3 + 2, 1, 1);
+ grid.attach(deleteButton, 2, row * 3, 1, 3); // Span 3 rows for the button
+ }
+
+ // load existing launchers
+ let row = 0;
+ while (settings.get_string(`app-executable-${row}`) || settings.get_string(`app-icon-${row}`)) {
+ let executable = settings.get_string(`app-executable-${row}`);
+ let icon = settings.get_string(`app-icon-${row}`);
+ addExecutableInput(row, executable, icon);
+ row++;
+ }
+
+ // button to add new launchers
+ let addButton = new Gtk.Button({
+ label: "Add New Launcher",
+ halign: Gtk.Align.CENTER
+ });
+
+ addButton.connect('clicked', () => {
+ if (row < 10) { // Limit to 10 launchers
+ addExecutableInput(row);
+ row++;
+ } else {
+ let dialog = new Gtk.MessageDialog({
+ text: "Maximum of 10 launchers reached.",
+ buttons: Gtk.ButtonsType.OK
+ });
+ dialog.run();
+ dialog.destroy();
+ }
+ });
+
+ box.append(addButton);
+
+ box.show();
+
+ return box;
+}
\ No newline at end of file
diff --git a/schemas/gschemas.compiled b/schemas/gschemas.compiled
new file mode 100644
index 0000000..dac9ec5
Binary files /dev/null and b/schemas/gschemas.compiled differ
diff --git a/schemas/org.gnome.shell.extensions.applet-launcher.gschema.xml b/schemas/org.gnome.shell.extensions.applet-launcher.gschema.xml
new file mode 100644
index 0000000..90ad6c7
--- /dev/null
+++ b/schemas/org.gnome.shell.extensions.applet-launcher.gschema.xml
@@ -0,0 +1,154 @@
+
+
+
+ ''
+ App Executable 1
+ The path to the first app executable.
+
+
+ ''
+ App Icon SVG 1
+ The path to the first app icon SVG.
+
+
+ 18
+ Icon Size 1
+ The size of the first app icon.
+
+
+ ''
+ App Executable 2
+ The path to the second app executable.
+
+
+ ''
+ App Icon SVG 2
+ The path to the second app icon SVG.
+
+
+ 18
+ Icon Size 2
+ The size of the first app icon.
+
+
+ ''
+ App Executable 3
+ The path to the first app executable.
+
+
+ ''
+ App Icon SVG 3
+ The path to the first app icon SVG.
+
+
+ 18
+ Icon Size 3
+ The size of the first app icon.
+
+
+ ''
+ App Executable 4
+ The path to the second app executable.
+
+
+ ''
+ App Icon SVG 4
+ The path to the second app icon SVG.
+
+
+ 18
+ Icon Size 4
+ The size of the first app icon.
+
+
+ ''
+ App Executable 5
+ The path to the first app executable.
+
+
+ ''
+ App Icon SVG 5
+ The path to the first app icon SVG.
+
+
+ 18
+ Icon Size 5
+ The size of the first app icon.
+
+
+ ''
+ App Executable 6
+ The path to the second app executable.
+
+
+ ''
+ App Icon SVG 6
+ The path to the second app icon SVG.
+
+
+ 18
+ Icon Size 6
+ The size of the first app icon.
+
+
+ ''
+ App Executable 7
+ The path to the second app executable.
+
+
+ ''
+ App Icon SVG 7
+ The path to the second app icon SVG.
+
+
+ 18
+ Icon Size 7
+ The size of the first app icon.
+
+
+ ''
+ App Executable 8
+ The path to the second app executable.
+
+
+ ''
+ App Icon SVG 8
+ The path to the second app icon SVG.
+
+
+ 18
+ Icon Size 8
+ The size of the first app icon.
+
+
+ ''
+ App Executable 9
+ The path to the second app executable.
+
+
+ ''
+ App Icon SVG 9
+ The path to the second app icon SVG.
+
+
+ 18
+ Icon Size 9
+ The size of the first app icon.
+
+
+ ''
+ App Executable 10
+ The path to the second app executable.
+
+
+ ''
+ App Icon SVG 10
+ The path to the second app icon SVG.
+
+
+ 18
+ Icon Size 10
+ The size of the first app icon.
+
+
+
\ No newline at end of file
diff --git a/screenshot.png b/screenshot.png
new file mode 100644
index 0000000..567f558
Binary files /dev/null and b/screenshot.png differ
diff --git a/vscodium.svg b/vscodium.svg
new file mode 100644
index 0000000..1d3b073
--- /dev/null
+++ b/vscodium.svg
@@ -0,0 +1 @@
+