Skip to content

Commit

Permalink
Init
Browse files Browse the repository at this point in the history
  • Loading branch information
jackpot51 committed Nov 15, 2019
1 parent 3becc19 commit c65e32e
Show file tree
Hide file tree
Showing 12 changed files with 160 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
@@ -0,0 +1,4 @@
*.zip
*.swp
_build
schemas/gschemas.compiled
1 change: 1 addition & 0 deletions CODE_OF_CONDUCT.md
@@ -0,0 +1 @@
Contributors to this repo agree to be bound by the [Pop! Code of Conduct](https://github.com/pop-os/code-of-conduct).
38 changes: 38 additions & 0 deletions Makefile
@@ -0,0 +1,38 @@
# Retrieve the UUID from ``metadata.json``
UUID = $(shell grep -E '^[ ]*"uuid":' ./metadata.json | sed 's@^[ ]*"uuid":[ ]*"\(.\+\)",[ ]*@\1@')

ifeq ($(strip $(DESTDIR)),)
INSTALLBASE = $(HOME)/.local/share/gnome-shell/extensions
else
INSTALLBASE = $(DESTDIR)/usr/share/gnome-shell/extensions
endif
INSTALLNAME = $(UUID)

$(info UUID is "$(UUID)")

.PHONY: all clean install zip-file

all: extension.js metadata.json schemas
rm -rf _build
mkdir -p _build
cp -r $^ _build

schemas: schemas/gschemas.compiled
touch $@

schemas/gschemas.compiled: schemas/*.gschema.xml
glib-compile-schemas schemas

clean:
rm -rf _build schemas/gschemas.compiled

install: all
rm -rf $(INSTALLBASE)/$(INSTALLNAME)
mkdir -p $(INSTALLBASE)/$(INSTALLNAME)
cp -r _build/* $(INSTALLBASE)/$(INSTALLNAME)/

uninstall:
rm -rf $(INSTALLBASE)/$(INSTALLNAME)

zip-file: all
cd _build && zip -qr "../$(UUID)$(VSTRING).zip" .
5 changes: 5 additions & 0 deletions debian/changelog
@@ -0,0 +1,5 @@
pop-shell (0.1.0) focal; urgency=medium

* Initial release.

-- Jeremy Soller <jeremy@system76.com> Thu, 14 Nov 2019 21:35:19 -0700
1 change: 1 addition & 0 deletions debian/compat
@@ -0,0 +1 @@
10
14 changes: 14 additions & 0 deletions debian/control
@@ -0,0 +1,14 @@
Source: pop-shell
Section: gnome
Priority: optional
Maintainer: Jeremy Soller <jeremy@system76.com>
Build-Depends: debhelper (>= 10)
Standards-Version: 3.9.8
Homepage: https://github.com/pop-os/shell
Vcs-Git: https://github.com/pop-os/shell

Package: pop-shell
Architecture: all
Depends:
${misc:Depends}
Description: Pop!_OS Shell
7 changes: 7 additions & 0 deletions debian/copyright
@@ -0,0 +1,7 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: pop-shell
Source: https://github.com/pop-os/shell

Files: *
Copyright: 2019 System76
License: GPL-3
8 changes: 8 additions & 0 deletions debian/rules
@@ -0,0 +1,8 @@
#!/usr/bin/make -f
# -*- makefile -*-

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

%:
dh $@
1 change: 1 addition & 0 deletions debian/source/format
@@ -0,0 +1 @@
3.0 (native)
65 changes: 65 additions & 0 deletions extension.js
@@ -0,0 +1,65 @@
const ExtensionUtils = imports.misc.extensionUtils;
const Gio = imports.gi.Gio;
const Main = imports.ui.main;
const Meta = imports.gi.Meta;
const Shell = imports.gi.Shell;

function log(text) {
global.log("pop-shell: " + text);
}

function settings() {
const extension = ExtensionUtils.getCurrentExtension();
const schema = extension.metadata["settings-schema"];
const GioSSS = Gio.SettingsSchemaSource;
const schemaDir = extension.dir.get_child("schemas");
let schemaSource = schemaDir.query_exists(null) ?
GioSSS.new_from_directory(schemaDir.get_path(), GioSSS.get_default(), false) :
GioSSS.get_default();

const schemaObj = schemaSource.lookup(schema, true);
if (!schemaObj)
throw new Error("Schema " + schema + " could not be found for extension "
+ extension.metadata.uuid + ". Please check your installation.");
let settings = new Gio.Settings({ settings_schema: schemaObj });
return settings;
}

function search() {
log("search");

let tabList = global.display.get_tab_list(Meta.TabList.NORMAL, null);
tabList.forEach(function(win) {
let app = Shell.WindowTracker.get_default().get_window_app(win);
let name = "";
try {
name = app.get_name().replace(/&/g, "&amp;");
} catch (e) {
log(e);
}

log(name + ": " + win.get_title());
});
}

function init() {
log("init");
}

function enable() {
log("enable");

Main.wm.addKeybinding(
"search",
settings(),
Meta.KeyBindingFlags.NONE,
Shell.ActionMode.NORMAL,
() => search()
);
}

function disable() {
log("disable");

Main.wm.removeKeybinding("search");
}
7 changes: 7 additions & 0 deletions metadata.json
@@ -0,0 +1,7 @@
{
"name": "Pop Shell",
"description": "Pop Shell",
"uuid": "pop-shell@system76.com",
"settings-schema": "org.gnome.shell.extensions.pop-shell",
"shell-version": ["3.36"]
}
9 changes: 9 additions & 0 deletions schemas/org.gnome.shell.extensions.pop-shell.gschema.xml
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<schemalist gettext-domain="pop-shell">
<schema id="org.gnome.shell.extensions.pop-shell" path="/org/gnome/shell/extensions/pop-shell/">
<key type="as" name="search">
<default><![CDATA[['<Super>slash']]]></default>
<summary>Search key combo</summary>
</key>
</schema>
</schemalist>

0 comments on commit c65e32e

Please sign in to comment.