-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 7575914
Showing
13 changed files
with
824 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
{ | ||
"env": { | ||
"es2021": true | ||
}, | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/recommended" | ||
], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": 12, | ||
"sourceType": "module" | ||
}, | ||
"plugins": [ | ||
"@typescript-eslint" | ||
], | ||
"rules": { | ||
"indent": [ | ||
"error", | ||
"tab" | ||
], | ||
"linebreak-style": [ | ||
"error", | ||
"unix" | ||
], | ||
"quotes": [ | ||
"error", | ||
"single" | ||
], | ||
"semi": [ | ||
"warn", | ||
"always" | ||
], | ||
"no-unused-expressions":"error", | ||
"no-unused-labels":"error", | ||
"no-unused-vars": "off", | ||
"@typescript-eslint/no-unused-vars": [ | ||
"error", | ||
{ | ||
"vars": "all", | ||
"args": "all", | ||
"varsIgnorePattern": "^_", | ||
"argsIgnorePattern": "^_" | ||
} | ||
], | ||
"no-console":"error", | ||
"no-empty":"error", | ||
"no-empty-function":"error", | ||
"no-mixed-spaces-and-tabs":"error" | ||
}, | ||
"overrides": [ | ||
{ | ||
"files": ["build/**/*.js"], | ||
"globals": { | ||
"log":"readonly", | ||
"global":"readonly", | ||
"imports":"readonly", | ||
"console":"readonly", | ||
"process":"readonly" | ||
}, | ||
"rules": { | ||
"no-console":"off", | ||
"@typescript-eslint/no-unused-vars": "off", | ||
"@typescript-eslint/explicit-module-boundary-types": "off", | ||
"no-unused-expressions":"off" | ||
} | ||
}, | ||
{ | ||
"env": { | ||
"node": true | ||
}, | ||
"files": ["scripts/**/*.ts"], | ||
"rules":{ | ||
"no-console":"off" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
build/ | ||
node_modules/ | ||
package-lock.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
EXTENSIONDIR=build/src | ||
BUILDIR=build/ | ||
|
||
pack: | ||
cp metadata.json $(EXTENSIONDIR) | ||
gnome-extensions pack --force \ | ||
--out-dir $(BUILDIR) $(EXTENSIONDIR) \ | ||
--extra-source=lib | ||
|
||
update: pack | ||
gnome-extensions install -f build/*.shell-extension.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Generate GNOME extension from typescript. | ||
## Things to note. | ||
1. Top level directory of extension (containing extension.ts) should be src/ . | ||
2. javascript files will be generated into build/src/ folder. | ||
|
||
## How to use. | ||
* Run `npm install` to download dependencies. | ||
* Write your extension's javascript code into src/ folder. | ||
* Write global types you use into gnome-shell/global.d.ts | ||
* Modify gnome-shell/index.d.ts to suite your extension (each extension might use different method available from gnome-shell codebase). | ||
* Run `npm run pack` to generate extension zip file under build/ | ||
* You might want to modify Makefile to fit your needs. | ||
* If you don't use Makefiles | ||
* You might want to run `npm run build` and then your custom install script. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
|
||
declare function log(message: any): void; | ||
declare interface IExtension { | ||
enable(): void, | ||
disable(): void; | ||
} | ||
|
||
declare interface ISubExtension { | ||
apply(): void, | ||
destroy(): void; | ||
} | ||
|
||
// declare const imports: any; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
export const z = 9; | ||
|
||
// /* eslint-disable @typescript-eslint/no-explicit-any */ | ||
|
||
import Clutter from '@gi-types/clutter'; | ||
import St from '@gi-types/st'; | ||
import Gio from '@gi-types/gio'; | ||
|
||
declare interface ExtensionMeta { | ||
uuid: string, | ||
'settings-schema': string, | ||
'gettext-domain': string | ||
} | ||
|
||
declare interface ExtensionUtilsMeta { | ||
getSettings(schema?: string): Gio.Settings; | ||
getCurrentExtension(): { | ||
metadata: ExtensionMeta, | ||
dir: Gio.FilePrototype, | ||
imports: any, | ||
}; | ||
initTranslations(domain?: string): void; | ||
} | ||
|
||
declare namespace imports { | ||
namespace gettext { | ||
function domain(name: string): { gettext(message: string): string; }; | ||
} | ||
|
||
namespace misc { | ||
declare const extensionUtils: ExtensionUtilsMeta; | ||
} | ||
namespace ui { | ||
namespace main { | ||
function notify(message: string): void; | ||
|
||
const panel: { | ||
addToStatusArea(role: string, indicator: Clutter.Actor, position?: number, box?: string): void, | ||
} & Clutter.Actor; | ||
|
||
const overview: { | ||
dash: { | ||
showAppsButton: St.Button | ||
}; | ||
searchEntry: St.Entry, | ||
shouldToggleByCornerOrButton(): boolean, | ||
visible: boolean, | ||
show(): void, | ||
hide(): void, | ||
showApps(): void, | ||
connect(signal: 'showing' | 'hiding' | 'hidden' | 'shown', callback: () => void): number, | ||
disconnect(id: number): void, | ||
_overview: { | ||
_controls: overviewControls.OverviewControlsManager | ||
} & St.Widget | ||
}; | ||
} | ||
|
||
namespace overviewControls { | ||
declare enum ControlsState { | ||
HIDDEN, | ||
WINDOW_PICKER, | ||
APP_GRID | ||
} | ||
|
||
declare class OverviewAdjustment extends St.Adjustment { | ||
getStateTransitionParams(): { | ||
initialState: ControlsState, | ||
finalState: ControlsState | ||
currentState: number, | ||
progress: number | ||
} | ||
} | ||
|
||
declare class OverviewControlsManager extends St.Widget { | ||
_stateAdjustment: OverviewAdjustment; | ||
layoutManager: Clutter.BoxLayout & { | ||
_searchEntry: St.Bin | ||
} | ||
_toggleAppsPage(): void | ||
} | ||
} | ||
|
||
|
||
namespace panelMenu { | ||
declare class Button extends St.Widget { | ||
constructor(menuAlignment: number, nameText?: string, dontCreateMenu?: boolean); | ||
container: St.Bin; | ||
menu: popupMenu.PopupMenuItem; | ||
} | ||
} | ||
|
||
namespace popupMenu { | ||
declare class PopupMenuItem extends St.BoxLayout { | ||
constructor(text: string); | ||
addMenuItem(subMenu: PopupMenuItem); | ||
} | ||
} | ||
} | ||
} | ||
|
||
// needs to declare this global every file wherever it's used, since it clashes with default global | ||
declare const global: import('@gi-types/shell').Global; | ||
// declare function log(message: any): void; | ||
// declare function _(str: string): string; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"description" : "Indicator Extension", | ||
"name" : "Indicator Extension", | ||
"shell-version" : [ | ||
"40" | ||
], | ||
"url" : "", | ||
"uuid" : "indicator-extension@sample", | ||
"version" : 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"name": "gnome-extension-template", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"type": "module", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"lint:src": "eslint src scripts", | ||
"lint:package": "eslint build --fix", | ||
"build": "npm run clean && npm run lint:src && tsc && node build/scripts/transpile.js && npm run lint:package", | ||
"clean": "rm -rf build && mkdir build", | ||
"pack": "npm run build && make pack" | ||
}, | ||
"author": "", | ||
"license": "ISC", | ||
"devDependencies": { | ||
"@gi-types/clutter": "^7.0.6", | ||
"@gi-types/gobject": "^2.66.9", | ||
"@gi-types/meta": "^3.38.5", | ||
"@gi-types/shell": "^0.1.6", | ||
"@gi-types/st": "^1.0.6", | ||
"@types/glob": "^7.1.3", | ||
"@types/node": "^16.0.0", | ||
"@typescript-eslint/eslint-plugin": "^4.28.1", | ||
"@typescript-eslint/parser": "^4.28.1", | ||
"eslint": "^7.30.0", | ||
"fs": "0.0.1-security", | ||
"glob": "^7.1.7", | ||
"path": "^0.12.7", | ||
"typescript": "^4.3.5" | ||
} | ||
} |
Oops, something went wrong.