{"id":21392442,"url":"https://github.com/baymac/command-keeper","last_synced_at":"2025-06-29T00:37:29.729Z","repository":{"id":83255849,"uuid":"180332850","full_name":"baymac/command-keeper","owner":"baymac","description":"A gnome shell extension that store your shell commands and code snippets","archived":false,"fork":false,"pushed_at":"2019-06-15T20:10:12.000Z","size":43,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-07T15:52:47.364Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/baymac.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-04-09T09:31:06.000Z","updated_at":"2022-04-15T09:09:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"e7f68f6d-b649-4258-8a83-69cc44d5bfef","html_url":"https://github.com/baymac/command-keeper","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/baymac/command-keeper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baymac%2Fcommand-keeper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baymac%2Fcommand-keeper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baymac%2Fcommand-keeper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baymac%2Fcommand-keeper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/baymac","download_url":"https://codeload.github.com/baymac/command-keeper/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baymac%2Fcommand-keeper/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262518105,"owners_count":23323301,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-22T13:40:50.875Z","updated_at":"2025-06-29T00:37:29.700Z","avatar_url":"https://github.com/baymac.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# command-keeper\nA gnome shell extension that store your shell commands and lets you copy to your clipboard. We use various commands frequently and it is sometimes difficult to remember the exact syntax. You can easily store your commands, scripts, snippets etc on this extension and copy it whenever you like. 😃\n\n# Getting Started\n\nThere references to start with gnome extension development assuming zero\nprevious knowledge. Also has an example extension to get some inspiration. ☺\n\n#### Gnome Extension Basics:\n\nGenerate a skeleton gnome extension which adds an ‘Hello World’ item on your\npanel.\n\n    gnome-shell-extension-tool --create-extension\n\nFollow screen instructions to provide details of extension such as name,\ndescription, uuid etc. UUID should be a unique name, convention is to follow an\nemail address pattern e.g. *command-keeper@Baymax*\n\nBelow is the output of the above command, green underlines are the fields you\nhave to enter yourself.\n\n![](https://cdn-images-1.medium.com/max/800/1*9MYLpw64oIAdTurh3RNK-Q.png)\n\u003cspan class=\"figcaption_hack\"\u003eGenerating skeleton extension\u003c/span\u003e\n\nIf you plan on to publish this extension to Gnome’s library you need to adhere\nto their UUID schema. To verify UUID is correct, open a Python shell:\n\n    $ python\n    \u003e\u003e import re\n    \u003e\u003e re.match(‘[-a-zA-Z0–9@._]+$’, ‘extension-name@username.me’)\n\n#### Extension files:\n\nGnome shell extensions are typically stored in following locations:\n\nLocal:\n\n\nSystemwide:\n\n\nWhen you open your hello-world extension folder you will find the following\nfiles:\n\n    extension.js\n    metadata.json\n    stylesheet.css\n\nThe **extension.js** file is simply a JavaScript file; it must however have a\nfunction called **init**, which will be invoked at most once directly after your\nsource JS file is loaded. You should modify all user interfaces in a separate\n**enable** function, and remove all custom functionality in a **disable**\nfunction.\n\nYou may optionally include a stylesheet file, **stylesheet.css**.\n\nTo understand the code refer to this\n[gist](https://gist.github.com/baymac/9708f3af9e34cf5552aba433973c9cac) which\nconsists of well written comments for each function.\n\n#### Extension Preferences:\n\nTo enable the generated extension run the following command inside your\nextension directory\n\nExtensions may be configured in a consistent manner using the\n`gnome-shell-extension-prefs` tool. To hook into it, provide a simple javascript\nfile called **prefs.js**. It must contain a function labeled\n**buildPrefsWidget**, which should return some sort of GTK+ widget. Whatever is\nreturned from there will be inserted into the Preferences widget screen. Beyond\nthat, a function named **init** may also be provided, and will be invoked after\nthe file is loaded but before **buildPrefsWidget** is invoked.\n\n#### Development:\n\nFor more development setup and basics, see\n[this](https://wiki.gnome.org/Projects/GnomeShell/Development).\n\nStyle Guide —\n[https://wiki.gnome.org/Projects/GnomeShell/StyleGuide](https://wiki.gnome.org/Projects/GnomeShell/StyleGuide)\n\n#### Gnome API:\n\nFor all the API references of various Gnome components see\n[this](https://developer.gnome.org/references).\n\nIf need some inspiration from Gnome Source JavaScript Files, see\n[this](https://github.com/julio641742/gnome-shell-extension-reference/blob/master/REFERENCE.md).\n\nTo start development just familiarise with these components:\n\n* The [Clutter UI library](http://developer.gnome.org/clutter/)\n(`imports.gi.Clutter`)\n* The [GLib](http://developer.gnome.org/glib/)(`imports.gi.GLib`)\n* The [Shell Toolkit](http://developer.gnome.org/st/) (`imports.gi.St`)\n\n#### Debugging extensions:\n\nOn *systemd*-based systems (like Debian), you can see error and log output of\nextensions using `journalctl /usr/bin/gnome-shell -f`. On other systems, logs\nmight be written to `~/.xsession-errors`.\n\nYou can log messages from an extension into this log for informational or\ndebugging purposes using `log(msg)`.\n\n[Looking Glass](https://wiki.gnome.org/Projects/GnomeShell/LookingGlass) is\nGNOME Shell’s integrated inspector tool and JavaScript console useful for\ndebugging. It can be run by typing ‘lg’ in the `Alt+F2` prompt.\n\n### Command Keeper:\n\nI frequently used complex terminal commands and I can’t write a script for each\none of them. So I need to keep them in a place where I can search, add, copy\nfrom my commands list.\n\n![](https://cdn-images-1.medium.com/max/800/1*6ktyLmjTnVWYXyOO6YqLmw.png)\n\u003cspan class=\"figcaption_hack\"\u003eCommand Keeper\u003c/span\u003e\n\nThis extension is a panel menu button with the following functionality:\n\n1.  **Add:** Type your command on the text box and add it to the `commands` table\n1.  **Search: **Search for your command by typing it to the text box\n1.  **Delete: **Delete a command from menu and also remove the row containing the\ncommand from the `commands` table\n1.  **Copy: **Copy a command to your clipboard on selection\n\nInitially, I planned on using a plain text file to store my commands but file\nhandling in this case got complicated once I started to do crazy things with the\nitems I was storing. Switching to a database helped me track the menuitems with\ntheir ids with `autoincrement` so that I could query them with their ids. There\nare of course other advantages of a database over a file system.\n\nYou can start with looking at the codebase of this extension, it has well\nwritten comments. Find the code\n[here](https://github.com/baymac/command-keeper). There are some UI issues that\nI see.\n\nFor example,\u003cbr\u003e 1) The panel menu is not aligned properly and floats around\ncould be aligned with the right edge of the screen.\u003cbr\u003e 2) On entering a long\ntext (long enough to exceed the size of the text box) then the text pierces\nout.\u003cbr\u003e 3) Cannot added multiline commands in one menuitem since during parsing\nit is done using the newline spliting\n\nIf you want to improve the extension, your PRs will be most welcomed. If you\nhave any problems/confusion feel free to comment below.\n\nThis extension was heavily inspired from the\n[clipboard-indicator-extension](https://github.com/Tudmotu/gnome-shell-extension-clipboard-indicator).\n\n#### Using SQLite with Gda library:\n\nTo be able to use SQLite in gnome extension you need to install the GDA library.\nYou can find it [here](https://github.com/GNOME/libgda). On Ubuntu you can\ninstall using:\n\n    sudo apt-get install libgdal-dev\n\nCheckout the APIs here:\n[http://library.gnome.org/devel/libgda/stable/](http://library.gnome.org/devel/libgda/stable/)\n\n#### Known Issues:\n\nInstalling the library is a painstaking process in itself. Took me about half a\nday to figure out to get it working. There are multiple dependencies that you\nneed to install. Listing below some possible errors and their workarounds.\n\n#### Typelib file for namespace Gda not found:\n\nInstall this library:\n\n\nAnd add the following to your `.bashrc`\n\n    export GI_TYPELIB_PATH=/usr/lib/x86_64-linux-gnu/girepository-1.0\n\n#### Libpcre.pc not found:\n\nAdd the following contents in a file `libpcre.pc`:\n\n    # Package Information for pkg-config\n    prefix=/usr\n    exec_prefix=${prefix}\n    libdir=${prefix}/lib/x86_64-linux-gnu\n    includedir=${prefix}/include\n    Name: libpcre\n    Description: PCRE - Perl compatible regular expressions C library\n    Version: 8.12\n    Libs: -L${libdir} -lpcre\n    Cflags: -I${includedir}\n\nAnd save it in the following path:\n\n    /usr/lib/x86_64-linux-gnu/pkgconfig/\n\nAdd the path to your `.bashrc` :\n\n    export PKG_CONFIG_PATH=/usr/lib/pkgconfig\n\n#### References:\n\n[Gnome Shell Extension Reference and\nTutorial](https://github.com/julio641742/gnome-shell-extension-reference)\u003cbr\u003e\n[Example SQLite\nExtension](https://developer.gnome.org/gnome-devel-demos/stable/record-collection.js.html.en)\n\n**Aloha.**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbaymac%2Fcommand-keeper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbaymac%2Fcommand-keeper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbaymac%2Fcommand-keeper/lists"}