upload to github
This commit is contained in:
commit
7be0570f7f
10 changed files with 399 additions and 0 deletions
7
LICENSE
Normal file
7
LICENSE
Normal file
|
|
@ -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.
|
||||
9
README.md
Normal file
9
README.md
Normal file
|
|
@ -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
|
||||
73
extension.js
Normal file
73
extension.js
Normal file
|
|
@ -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);
|
||||
}
|
||||
1
firefox.svg
Normal file
1
firefox.svg
Normal file
|
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="#ebebeb" d="M6.85 6.74q.015 0 0 0M21.28 8.6c-.43-1.05-1.32-2.18-2.01-2.54c.56 1.11.89 2.22 1.02 3.04v.02c-1.13-2.82-3.05-3.96-4.62-6.44c-.08-.12-.17-.25-.24-.38c-.04-.07-.07-.14-.11-.21c-.06-.13-.12-.26-.15-.4c0-.01-.01-.02-.02-.02h-.03c-2.22 1.3-3.15 3.59-3.38 5.04c-.69.04-1.37.21-1.99.51c-.12.05-.17.19-.13.31c.05.14.21.21.34.15c.54-.26 1.14-.41 1.74-.45h.05c.08-.01.17-.01.25-.01c.5-.01.97.06 1.44.2l.06.02c.1.02.17.06.25.06c.05.04.11.06.16.08l.14.06c.07.03.14.06.2.09c.03.02.06.03.09.05c.07.04.16.07.2.11c.04.02.08.05.12.07c.73.45 1.34 1.07 1.75 1.81c-.53-.37-1.49-.74-2.41-.58c3.6 1.81 2.63 8-2.36 7.76c-.44-.01-.88-.1-1.3-.25c-.1-.03-.2-.07-.29-.12c-.05-.02-.12-.05-.17-.08c-1.23-.63-2.24-1.82-2.38-3.27c0 0 .5-1.73 3.33-1.73c.31 0 1.17-.86 1.2-1.1c0-.09-1.74-.78-2.42-1.45c-.37-.36-.54-.53-.69-.66c-.08-.07-.17-.13-.26-.19a4.63 4.63 0 0 1-.03-2.45C7.6 6.12 6.8 6.86 6.22 7.5c-.4-.5-.37-2.15-.35-2.5c-.01 0-.3.16-.33.18c-.35.25-.68.53-.98.82c-.35.37-.66.74-.94 1.14c-.62.91-1.12 1.95-1.34 3.04c0 .01-.1.41-.17.92l-.03.23c-.02.17-.04.32-.08.58v.41c0 5.53 4.5 10.01 10 10.01c4.97 0 9.08-3.59 9.88-8.33c.02-.11.03-.24.05-.37c.2-1.72-.02-3.52-.65-5.03"/></svg>
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
14
metadata.json
Normal file
14
metadata.json
Normal file
|
|
@ -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"
|
||||
}
|
||||
140
prefs.js
Normal file
140
prefs.js
Normal file
|
|
@ -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;
|
||||
}
|
||||
BIN
schemas/gschemas.compiled
Normal file
BIN
schemas/gschemas.compiled
Normal file
Binary file not shown.
154
schemas/org.gnome.shell.extensions.applet-launcher.gschema.xml
Normal file
154
schemas/org.gnome.shell.extensions.applet-launcher.gschema.xml
Normal file
|
|
@ -0,0 +1,154 @@
|
|||
<schemalist>
|
||||
<schema id="org.gnome.shell.extensions.applet-launcher@jroshthen1.github.io" path="/home/jrosh/.local/share/gnome-shell/extensions/applet-launcher@jroshthen1.github.io/">
|
||||
<key name="app-executable-0" type="s">
|
||||
<default>''</default>
|
||||
<summary>App Executable 1</summary>
|
||||
<description>The path to the first app executable.</description>
|
||||
</key>
|
||||
<key name="app-icon-0" type="s">
|
||||
<default>''</default>
|
||||
<summary>App Icon SVG 1</summary>
|
||||
<description>The path to the first app icon SVG.</description>
|
||||
</key>
|
||||
<key name="icon-size-0" type="i">
|
||||
<default>18</default>
|
||||
<summary>Icon Size 1</summary>
|
||||
<description>The size of the first app icon.</description>
|
||||
</key>
|
||||
<key name="app-executable-1" type="s">
|
||||
<default>''</default>
|
||||
<summary>App Executable 2</summary>
|
||||
<description>The path to the second app executable.</description>
|
||||
</key>
|
||||
<key name="app-icon-1" type="s">
|
||||
<default>''</default>
|
||||
<summary>App Icon SVG 2</summary>
|
||||
<description>The path to the second app icon SVG.</description>
|
||||
</key>
|
||||
<key name="icon-size-1" type="i">
|
||||
<default>18</default>
|
||||
<summary>Icon Size 2</summary>
|
||||
<description>The size of the first app icon.</description>
|
||||
</key>
|
||||
<key name="app-executable-2" type="s">
|
||||
<default>''</default>
|
||||
<summary>App Executable 3</summary>
|
||||
<description>The path to the first app executable.</description>
|
||||
</key>
|
||||
<key name="app-icon-2" type="s">
|
||||
<default>''</default>
|
||||
<summary>App Icon SVG 3</summary>
|
||||
<description>The path to the first app icon SVG.</description>
|
||||
</key>
|
||||
<key name="icon-size-2" type="i">
|
||||
<default>18</default>
|
||||
<summary>Icon Size 3</summary>
|
||||
<description>The size of the first app icon.</description>
|
||||
</key>
|
||||
<key name="app-executable-3" type="s">
|
||||
<default>''</default>
|
||||
<summary>App Executable 4</summary>
|
||||
<description>The path to the second app executable.</description>
|
||||
</key>
|
||||
<key name="app-icon-3" type="s">
|
||||
<default>''</default>
|
||||
<summary>App Icon SVG 4</summary>
|
||||
<description>The path to the second app icon SVG.</description>
|
||||
</key>
|
||||
<key name="icon-size-3" type="i">
|
||||
<default>18</default>
|
||||
<summary>Icon Size 4</summary>
|
||||
<description>The size of the first app icon.</description>
|
||||
</key>
|
||||
<key name="app-executable-4" type="s">
|
||||
<default>''</default>
|
||||
<summary>App Executable 5</summary>
|
||||
<description>The path to the first app executable.</description>
|
||||
</key>
|
||||
<key name="app-icon-4" type="s">
|
||||
<default>''</default>
|
||||
<summary>App Icon SVG 5</summary>
|
||||
<description>The path to the first app icon SVG.</description>
|
||||
</key>
|
||||
<key name="icon-size-4" type="i">
|
||||
<default>18</default>
|
||||
<summary>Icon Size 5</summary>
|
||||
<description>The size of the first app icon.</description>
|
||||
</key>
|
||||
<key name="app-executable-5" type="s">
|
||||
<default>''</default>
|
||||
<summary>App Executable 6</summary>
|
||||
<description>The path to the second app executable.</description>
|
||||
</key>
|
||||
<key name="app-icon-5" type="s">
|
||||
<default>''</default>
|
||||
<summary>App Icon SVG 6</summary>
|
||||
<description>The path to the second app icon SVG.</description>
|
||||
</key>
|
||||
<key name="icon-size-5" type="i">
|
||||
<default>18</default>
|
||||
<summary>Icon Size 6</summary>
|
||||
<description>The size of the first app icon.</description>
|
||||
</key>
|
||||
<key name="app-executable-6" type="s">
|
||||
<default>''</default>
|
||||
<summary>App Executable 7</summary>
|
||||
<description>The path to the second app executable.</description>
|
||||
</key>
|
||||
<key name="app-icon-6" type="s">
|
||||
<default>''</default>
|
||||
<summary>App Icon SVG 7</summary>
|
||||
<description>The path to the second app icon SVG.</description>
|
||||
</key>
|
||||
<key name="icon-size-6" type="i">
|
||||
<default>18</default>
|
||||
<summary>Icon Size 7</summary>
|
||||
<description>The size of the first app icon.</description>
|
||||
</key>
|
||||
<key name="app-executable-7" type="s">
|
||||
<default>''</default>
|
||||
<summary>App Executable 8</summary>
|
||||
<description>The path to the second app executable.</description>
|
||||
</key>
|
||||
<key name="app-icon-7" type="s">
|
||||
<default>''</default>
|
||||
<summary>App Icon SVG 8</summary>
|
||||
<description>The path to the second app icon SVG.</description>
|
||||
</key>
|
||||
<key name="icon-size-7" type="i">
|
||||
<default>18</default>
|
||||
<summary>Icon Size 8</summary>
|
||||
<description>The size of the first app icon.</description>
|
||||
</key>
|
||||
<key name="app-executable-8" type="s">
|
||||
<default>''</default>
|
||||
<summary>App Executable 9</summary>
|
||||
<description>The path to the second app executable.</description>
|
||||
</key>
|
||||
<key name="app-icon-8" type="s">
|
||||
<default>''</default>
|
||||
<summary>App Icon SVG 9</summary>
|
||||
<description>The path to the second app icon SVG.</description>
|
||||
</key>
|
||||
<key name="icon-size-8" type="i">
|
||||
<default>18</default>
|
||||
<summary>Icon Size 9</summary>
|
||||
<description>The size of the first app icon.</description>
|
||||
</key>
|
||||
<key name="app-executable-9" type="s">
|
||||
<default>''</default>
|
||||
<summary>App Executable 10</summary>
|
||||
<description>The path to the second app executable.</description>
|
||||
</key>
|
||||
<key name="app-icon-9" type="s">
|
||||
<default>''</default>
|
||||
<summary>App Icon SVG 10</summary>
|
||||
<description>The path to the second app icon SVG.</description>
|
||||
</key>
|
||||
<key name="icon-size-9" type="i">
|
||||
<default>18</default>
|
||||
<summary>Icon Size 10</summary>
|
||||
<description>The size of the first app icon.</description>
|
||||
</key>
|
||||
</schema>
|
||||
</schemalist>
|
||||
BIN
screenshot.png
Normal file
BIN
screenshot.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 223 KiB |
1
vscodium.svg
Normal file
1
vscodium.svg
Normal file
|
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128" viewBox="0 0 128 128"><path fill="#ebebeb" d="M61.773 2.91c-3.652 2.344-4.707 7.2-2.351 10.84C72.359 33.79 75.414 48.902 74.09 62.148c-5.356 25.364-16.996 30.508-27.172 30.508c-9.934 0-7.273-16.344.195-21.129c4.457-2.785 10.164-4.593 14.547-4.593c4.34 0 7.86-3.508 7.86-7.836c0-4.332-3.52-7.84-7.86-7.84c-5.117 0-10.14 1.078-14.824 2.906c.957-4.516 1.309-9.398.07-14.586c-1.879-7.883-7.285-15.406-16.68-22.703a7.86 7.86 0 0 0-5.8-1.598a7.86 7.86 0 0 0-5.235 2.961a7.826 7.826 0 0 0 1.38 11c7.652 5.946 10.179 10.344 11.042 13.965c.867 3.621.172 7.504-1.566 12.844c-2.219 7.191-4.793 13.613-5.922 19.773c-.555 3.032-.602 6.328-.746 8.965c-5.512-5.37-7.668-12.46-7.668-22.824c0-4.328-3.52-7.84-7.86-7.836s-7.855 3.508-7.855 7.836c0 14.152 4.137 27.617 15.23 36.602c10.04 9.562 35.57 6.027 35.57 21.386c0 4.332 6.345 6.442 10.684 6.442c4.454 0 10.055-2.977 10.055-6.442c0-17.426 18.363-28.015 48.59-27.969c4.344.008 7.863-3.5 7.871-7.828c.008-4.332-3.504-7.847-7.848-7.855c-2.066 0-4.082.07-6.066.187c3.379-7.949 4.879-16.699 4.566-26.148c-.14-4.328-3.773-7.723-8.113-7.582c-4.344.144-7.746 3.77-7.601 8.098c.41 12.375-.055 23.425-9.274 29.253c-2.62 1.653-5.672 3.09-8.562 3.09c2.246-6.101 3.941-12.547 4.632-19.488c.446-4.434.493-9.7-.015-13.785c-.781-6.336-1.73-13.524.676-18.938c2.16-4.66 7-6.613 14.109-6.613c4.336-.004 7.852-3.512 7.852-7.836c.003-4.332-3.512-7.844-7.852-7.848c-10.563 0-18.57 5.56-23.11 12.274c-2.37-5.066-5.261-10.29-8.753-15.7a7.87 7.87 0 0 0-4.942-3.413a7.9 7.9 0 0 0-3.066-.059a7.9 7.9 0 0 0-2.856 1.121m0 0"/></svg>
|
||||
|
After Width: | Height: | Size: 1.6 KiB |
Loading…
Add table
Add a link
Reference in a new issue