Merge branch 'refactor/eslint' into 'master'
Use ESLint and reformat code See merge request rmnvgr/nightthemeswitcher-gnome-shell-extension!38
This commit is contained in:
@@ -0,0 +1 @@
|
||||
src/convenience.js
|
||||
@@ -0,0 +1,4 @@
|
||||
extends:
|
||||
- ./lint/eslintrc-gjs.yml
|
||||
- ./lint/eslintrc-shell.yml
|
||||
- ./lint/eslintrc-extension.yml
|
||||
+24
-10
@@ -4,11 +4,31 @@ You're welcome to contribute to the [code](#contributing-to-the-code) or to the
|
||||
|
||||
## Contributing to the code
|
||||
|
||||
Create a new branch describing what your're working on, for example `feature/{name-of-the-feature}` or `theme/{name-of-the-theme}`. When you're done, commit all your changes and create a new merge request. Choose the appropriate merge request template.
|
||||
You'll need `make` and [NPM](https://www.npmjs.com/) to install the development dependencies:
|
||||
|
||||
```bash
|
||||
make deps-install
|
||||
```
|
||||
|
||||
Create a new branch describing what your're working on, for example `feature/{name-of-the-feature}` or `theme/{name-of-the-theme}`.
|
||||
|
||||
To make sure your code passes basic checks, run:
|
||||
|
||||
```bash
|
||||
make test
|
||||
```
|
||||
|
||||
When you're done, commit all your changes and create a new merge request. Choose the appropriate merge request template.
|
||||
|
||||
### Coding style
|
||||
|
||||
Please follow the coding style of each file.
|
||||
We follow the [GNOME Shell coding style](https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/master/HACKING.md) and we use [ESLint](https://eslint.org/) to enforce it.
|
||||
|
||||
To make sure your code follows it:
|
||||
|
||||
```bash
|
||||
make test-lint
|
||||
```
|
||||
|
||||
### Copyright notice
|
||||
|
||||
@@ -16,18 +36,12 @@ If you make changes to a file, please add your copyright notice at the top of th
|
||||
|
||||
### Themes and unit tests
|
||||
|
||||
If you add support for a theme, please write a unit test for each of its variants, in the `tests` directory, with the theme name as filename. Unit tests are written for [AVA](https://github.com/avajs/ava) and run with node and npm.
|
||||
|
||||
To install the tests dependencies:
|
||||
|
||||
```bash
|
||||
npm install
|
||||
```
|
||||
If you add support for a theme, please write a unit test for each of its variants, in the `tests` directory, with the theme name as filename. Unit tests are written for [AVA](https://github.com/avajs/ava).
|
||||
|
||||
To run the tests:
|
||||
|
||||
```bash
|
||||
make test
|
||||
make test-variants
|
||||
```
|
||||
|
||||
## Contributing to the translations
|
||||
|
||||
@@ -56,7 +56,14 @@ uninstall:
|
||||
clean: build-clean deps-clean
|
||||
|
||||
.PHONY: test
|
||||
test:
|
||||
test: test-lint test-variants
|
||||
|
||||
.PHONY: test-lint
|
||||
test-lint:
|
||||
npx eslint .
|
||||
|
||||
.PHONY: test-variants
|
||||
test-variants:
|
||||
cat ./src/modules/GtkVariants.js ./tests/gtk_themes/_variants.js.template > ./tests/gtk_themes/_variants.js
|
||||
cat ./src/modules/ShellVariants.js ./tests/shell_themes/_variants.js.template > ./tests/shell_themes/_variants.js
|
||||
npm run test
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
rules:
|
||||
no-unused-vars:
|
||||
- error
|
||||
- vars: 'local'
|
||||
varsIgnorePattern: (^unused|_$)
|
||||
argsIgnorePattern: ^(unused|_)
|
||||
@@ -0,0 +1,232 @@
|
||||
---
|
||||
# From https://gitlab.gnome.org/GNOME/gjs/
|
||||
env:
|
||||
es6: true
|
||||
extends: 'eslint:recommended'
|
||||
rules:
|
||||
array-bracket-newline:
|
||||
- error
|
||||
- consistent
|
||||
array-bracket-spacing:
|
||||
- error
|
||||
- never
|
||||
array-callback-return: error
|
||||
arrow-parens:
|
||||
- error
|
||||
- as-needed
|
||||
arrow-spacing: error
|
||||
block-scoped-var: error
|
||||
block-spacing: error
|
||||
brace-style: error
|
||||
# Waiting for this to have matured a bit in eslint
|
||||
# camelcase:
|
||||
# - error
|
||||
# - properties: never
|
||||
# allow: [^vfunc_, ^on_, _instance_init]
|
||||
comma-dangle:
|
||||
- error
|
||||
- arrays: always-multiline
|
||||
objects: always-multiline
|
||||
functions: never
|
||||
comma-spacing:
|
||||
- error
|
||||
- before: false
|
||||
after: true
|
||||
comma-style:
|
||||
- error
|
||||
- last
|
||||
computed-property-spacing: error
|
||||
curly:
|
||||
- error
|
||||
- multi-or-nest
|
||||
- consistent
|
||||
dot-location:
|
||||
- error
|
||||
- property
|
||||
eol-last: error
|
||||
eqeqeq: error
|
||||
func-call-spacing: error
|
||||
func-name-matching: error
|
||||
func-style:
|
||||
- error
|
||||
- declaration
|
||||
- allowArrowFunctions: true
|
||||
indent:
|
||||
- error
|
||||
- 4
|
||||
- ignoredNodes:
|
||||
# Allow not indenting the body of GObject.registerClass, since in the
|
||||
# future it's intended to be a decorator
|
||||
- 'CallExpression[callee.object.name=GObject][callee.property.name=registerClass] > ClassExpression:first-child'
|
||||
# Allow dedenting chained member expressions
|
||||
MemberExpression: 'off'
|
||||
key-spacing:
|
||||
- error
|
||||
- beforeColon: false
|
||||
afterColon: true
|
||||
keyword-spacing:
|
||||
- error
|
||||
- before: true
|
||||
after: true
|
||||
linebreak-style:
|
||||
- error
|
||||
- unix
|
||||
lines-between-class-members: error
|
||||
max-nested-callbacks: error
|
||||
max-statements-per-line: error
|
||||
new-parens: error
|
||||
no-array-constructor: error
|
||||
no-await-in-loop: error
|
||||
no-caller: error
|
||||
no-constant-condition:
|
||||
- error
|
||||
- checkLoops: false
|
||||
no-div-regex: error
|
||||
no-empty:
|
||||
- error
|
||||
- allowEmptyCatch: true
|
||||
no-extra-bind: error
|
||||
no-extra-parens:
|
||||
- error
|
||||
- all
|
||||
- conditionalAssign: false
|
||||
nestedBinaryExpressions: false
|
||||
returnAssign: false
|
||||
no-implicit-coercion:
|
||||
- error
|
||||
- allow:
|
||||
- '!!'
|
||||
no-invalid-this: error
|
||||
no-iterator: error
|
||||
no-label-var: error
|
||||
no-lonely-if: error
|
||||
no-loop-func: error
|
||||
no-nested-ternary: error
|
||||
no-new-object: error
|
||||
no-new-wrappers: error
|
||||
no-octal-escape: error
|
||||
no-proto: error
|
||||
no-prototype-builtins: 'off'
|
||||
no-restricted-properties:
|
||||
- error
|
||||
- object: Lang
|
||||
property: bind
|
||||
message: Use arrow notation or Function.prototype.bind()
|
||||
- object: Lang
|
||||
property: Class
|
||||
message: Use ES6 classes
|
||||
- object: imports
|
||||
property: mainloop
|
||||
message: Use GLib main loops and timeouts
|
||||
no-restricted-syntax:
|
||||
- error
|
||||
- selector: >-
|
||||
MethodDefinition[key.name="_init"] >
|
||||
FunctionExpression[params.length=1] >
|
||||
BlockStatement[body.length=1]
|
||||
CallExpression[arguments.length=1][callee.object.type="Super"][callee.property.name="_init"] >
|
||||
Identifier:first-child
|
||||
message: _init() that only calls super._init() is unnecessary
|
||||
- selector: >-
|
||||
MethodDefinition[key.name="_init"] >
|
||||
FunctionExpression[params.length=0] >
|
||||
BlockStatement[body.length=1]
|
||||
CallExpression[arguments.length=0][callee.object.type="Super"][callee.property.name="_init"]
|
||||
message: _init() that only calls super._init() is unnecessary
|
||||
no-return-assign: error
|
||||
no-return-await: error
|
||||
no-self-compare: error
|
||||
no-shadow: error
|
||||
no-shadow-restricted-names: error
|
||||
no-spaced-func: error
|
||||
no-tabs: error
|
||||
no-template-curly-in-string: error
|
||||
no-throw-literal: error
|
||||
no-trailing-spaces: error
|
||||
no-undef-init: error
|
||||
no-unneeded-ternary: error
|
||||
no-unused-expressions: error
|
||||
no-unused-vars:
|
||||
- error
|
||||
# Vars use a suffix _ instead of a prefix because of file-scope private vars
|
||||
- varsIgnorePattern: (^unused|_$)
|
||||
argsIgnorePattern: ^(unused|_)
|
||||
no-useless-call: error
|
||||
no-useless-computed-key: error
|
||||
no-useless-concat: error
|
||||
no-useless-constructor: error
|
||||
no-useless-rename: error
|
||||
no-useless-return: error
|
||||
no-whitespace-before-property: error
|
||||
no-with: error
|
||||
nonblock-statement-body-position:
|
||||
- error
|
||||
- below
|
||||
object-curly-newline:
|
||||
- error
|
||||
- consistent: true
|
||||
object-curly-spacing: error
|
||||
object-shorthand: error
|
||||
operator-assignment: error
|
||||
operator-linebreak: error
|
||||
# These may be a bit controversial, we can try them out and enable them later
|
||||
# prefer-const: error
|
||||
# prefer-destructuring: error
|
||||
prefer-numeric-literals: error
|
||||
prefer-promise-reject-errors: error
|
||||
prefer-rest-params: error
|
||||
prefer-spread: error
|
||||
prefer-template: error
|
||||
quotes:
|
||||
- error
|
||||
- single
|
||||
- avoidEscape: true
|
||||
require-await: error
|
||||
rest-spread-spacing: error
|
||||
semi:
|
||||
- error
|
||||
- always
|
||||
semi-spacing:
|
||||
- error
|
||||
- before: false
|
||||
after: true
|
||||
semi-style: error
|
||||
space-before-blocks: error
|
||||
space-before-function-paren:
|
||||
- error
|
||||
- named: never
|
||||
# for `function ()` and `async () =>`, preserve space around keywords
|
||||
anonymous: always
|
||||
asyncArrow: always
|
||||
space-in-parens: error
|
||||
space-infix-ops:
|
||||
- error
|
||||
- int32Hint: false
|
||||
space-unary-ops: error
|
||||
spaced-comment: error
|
||||
switch-colon-spacing: error
|
||||
symbol-description: error
|
||||
template-curly-spacing: error
|
||||
template-tag-spacing: error
|
||||
unicode-bom: error
|
||||
valid-jsdoc:
|
||||
- error
|
||||
- requireReturn: false
|
||||
wrap-iife:
|
||||
- error
|
||||
- inside
|
||||
yield-star-spacing: error
|
||||
yoda: error
|
||||
globals:
|
||||
ARGV: readonly
|
||||
Debugger: readonly
|
||||
GIRepositoryGType: readonly
|
||||
globalThis: readonly
|
||||
imports: readonly
|
||||
Intl: readonly
|
||||
log: readonly
|
||||
logError: readonly
|
||||
print: readonly
|
||||
printerr: readonly
|
||||
parserOptions:
|
||||
ecmaVersion: 2019
|
||||
@@ -0,0 +1,16 @@
|
||||
# From https://gitlab.gnome.org/GNOME/gnome-shell/
|
||||
rules:
|
||||
camelcase:
|
||||
- error
|
||||
- properties: never
|
||||
allow: [^vfunc_, ^on_]
|
||||
consistent-return: error
|
||||
key-spacing:
|
||||
- error
|
||||
- mode: minimum
|
||||
beforeColon: false
|
||||
afterColon: true
|
||||
object-curly-spacing:
|
||||
- error
|
||||
- always
|
||||
prefer-arrow-callback: error
|
||||
Generated
+559
@@ -185,6 +185,12 @@
|
||||
"integrity": "sha512-apwXVmYVpQ34m/i71vrApRrRKCWQnZZF1+npOD0WV5xZFfwWOmKGQ2RWlfdy9vWITsenisM8M0Qeq8agcFHNiQ==",
|
||||
"dev": true
|
||||
},
|
||||
"acorn-jsx": {
|
||||
"version": "5.2.0",
|
||||
"resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.2.0.tgz",
|
||||
"integrity": "sha512-HiUX/+K2YpkpJ+SzBffkM/AQ2YE03S0U1kjTLVpoJdhZMOWy8qvXVN9JdLqv2QsaQ6MPYQIuNmwD8zOiYUofLQ==",
|
||||
"dev": true
|
||||
},
|
||||
"acorn-walk": {
|
||||
"version": "7.1.1",
|
||||
"resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-7.1.1.tgz",
|
||||
@@ -201,6 +207,18 @@
|
||||
"indent-string": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"ajv": {
|
||||
"version": "6.12.3",
|
||||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.3.tgz",
|
||||
"integrity": "sha512-4K0cK3L1hsqk9xIb2z9vs/XU+PGJZ9PNpJRDS9YLzmNdX6jmVPfamLvTJr0aDAusnHyCHO6MjzlkAsgtqp9teA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"fast-deep-equal": "^3.1.1",
|
||||
"fast-json-stable-stringify": "^2.0.0",
|
||||
"json-schema-traverse": "^0.4.1",
|
||||
"uri-js": "^4.2.2"
|
||||
}
|
||||
},
|
||||
"ansi-align": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.0.tgz",
|
||||
@@ -250,6 +268,12 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"ansi-colors": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz",
|
||||
"integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==",
|
||||
"dev": true
|
||||
},
|
||||
"ansi-regex": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz",
|
||||
@@ -707,6 +731,17 @@
|
||||
"integrity": "sha1-fj5Iu+bZl7FBfdyihoIEtNPYVxU=",
|
||||
"dev": true
|
||||
},
|
||||
"cross-spawn": {
|
||||
"version": "7.0.3",
|
||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
|
||||
"integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"path-key": "^3.1.0",
|
||||
"shebang-command": "^2.0.0",
|
||||
"which": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"crypto-random-string": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz",
|
||||
@@ -761,6 +796,12 @@
|
||||
"integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==",
|
||||
"dev": true
|
||||
},
|
||||
"deep-is": {
|
||||
"version": "0.1.3",
|
||||
"resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz",
|
||||
"integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=",
|
||||
"dev": true
|
||||
},
|
||||
"defaults": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz",
|
||||
@@ -828,6 +869,15 @@
|
||||
"path-type": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"doctrine": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz",
|
||||
"integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"esutils": "^2.0.2"
|
||||
}
|
||||
},
|
||||
"dot-prop": {
|
||||
"version": "5.2.0",
|
||||
"resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.2.0.tgz",
|
||||
@@ -864,6 +914,15 @@
|
||||
"once": "^1.4.0"
|
||||
}
|
||||
},
|
||||
"enquirer": {
|
||||
"version": "2.3.6",
|
||||
"resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz",
|
||||
"integrity": "sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ansi-colors": "^4.1.1"
|
||||
}
|
||||
},
|
||||
"equal-length": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/equal-length/-/equal-length-1.0.1.tgz",
|
||||
@@ -891,18 +950,170 @@
|
||||
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
|
||||
"dev": true
|
||||
},
|
||||
"eslint": {
|
||||
"version": "7.5.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-7.5.0.tgz",
|
||||
"integrity": "sha512-vlUP10xse9sWt9SGRtcr1LAC67BENcQMFeV+w5EvLEoFe3xJ8cF1Skd0msziRx/VMC+72B4DxreCE+OR12OA6Q==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/code-frame": "^7.0.0",
|
||||
"ajv": "^6.10.0",
|
||||
"chalk": "^4.0.0",
|
||||
"cross-spawn": "^7.0.2",
|
||||
"debug": "^4.0.1",
|
||||
"doctrine": "^3.0.0",
|
||||
"enquirer": "^2.3.5",
|
||||
"eslint-scope": "^5.1.0",
|
||||
"eslint-utils": "^2.1.0",
|
||||
"eslint-visitor-keys": "^1.3.0",
|
||||
"espree": "^7.2.0",
|
||||
"esquery": "^1.2.0",
|
||||
"esutils": "^2.0.2",
|
||||
"file-entry-cache": "^5.0.1",
|
||||
"functional-red-black-tree": "^1.0.1",
|
||||
"glob-parent": "^5.0.0",
|
||||
"globals": "^12.1.0",
|
||||
"ignore": "^4.0.6",
|
||||
"import-fresh": "^3.0.0",
|
||||
"imurmurhash": "^0.1.4",
|
||||
"is-glob": "^4.0.0",
|
||||
"js-yaml": "^3.13.1",
|
||||
"json-stable-stringify-without-jsonify": "^1.0.1",
|
||||
"levn": "^0.4.1",
|
||||
"lodash": "^4.17.19",
|
||||
"minimatch": "^3.0.4",
|
||||
"natural-compare": "^1.4.0",
|
||||
"optionator": "^0.9.1",
|
||||
"progress": "^2.0.0",
|
||||
"regexpp": "^3.1.0",
|
||||
"semver": "^7.2.1",
|
||||
"strip-ansi": "^6.0.0",
|
||||
"strip-json-comments": "^3.1.0",
|
||||
"table": "^5.2.3",
|
||||
"text-table": "^0.2.0",
|
||||
"v8-compile-cache": "^2.0.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"ignore": {
|
||||
"version": "4.0.6",
|
||||
"resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz",
|
||||
"integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==",
|
||||
"dev": true
|
||||
},
|
||||
"lodash": {
|
||||
"version": "4.17.19",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz",
|
||||
"integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==",
|
||||
"dev": true
|
||||
},
|
||||
"semver": {
|
||||
"version": "7.3.2",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz",
|
||||
"integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==",
|
||||
"dev": true
|
||||
},
|
||||
"strip-json-comments": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz",
|
||||
"integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"eslint-scope": {
|
||||
"version": "5.1.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.0.tgz",
|
||||
"integrity": "sha512-iiGRvtxWqgtx5m8EyQUJihBloE4EnYeGE/bz1wSPwJE6tZuJUtHlhqDM4Xj2ukE8Dyy1+HCZ4hE0fzIVMzb58w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"esrecurse": "^4.1.0",
|
||||
"estraverse": "^4.1.1"
|
||||
}
|
||||
},
|
||||
"eslint-utils": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz",
|
||||
"integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"eslint-visitor-keys": "^1.1.0"
|
||||
}
|
||||
},
|
||||
"eslint-visitor-keys": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz",
|
||||
"integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==",
|
||||
"dev": true
|
||||
},
|
||||
"espree": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/espree/-/espree-7.2.0.tgz",
|
||||
"integrity": "sha512-H+cQ3+3JYRMEIOl87e7QdHX70ocly5iW4+dttuR8iYSPr/hXKFb+7dBsZ7+u1adC4VrnPlTkv0+OwuPnDop19g==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"acorn": "^7.3.1",
|
||||
"acorn-jsx": "^5.2.0",
|
||||
"eslint-visitor-keys": "^1.3.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"acorn": {
|
||||
"version": "7.3.1",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-7.3.1.tgz",
|
||||
"integrity": "sha512-tLc0wSnatxAQHVHUapaHdz72pi9KUyHjq5KyHjGg9Y8Ifdc79pTh2XvI6I1/chZbnM7QtNKzh66ooDogPZSleA==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"esprima": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
|
||||
"integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
|
||||
"dev": true
|
||||
},
|
||||
"esquery": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/esquery/-/esquery-1.3.1.tgz",
|
||||
"integrity": "sha512-olpvt9QG0vniUBZspVRN6lwB7hOZoTRtT+jzR+tS4ffYx2mzbw+z0XCOk44aaLYKApNX5nMm+E+P6o25ip/DHQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"estraverse": "^5.1.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"estraverse": {
|
||||
"version": "5.1.0",
|
||||
"resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.1.0.tgz",
|
||||
"integrity": "sha512-FyohXK+R0vE+y1nHLoBM7ZTyqRpqAlhdZHCWIWEviFLiGB8b04H6bQs8G+XTthacvT8VuwvteiP7RJSxMs8UEw==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"esrecurse": {
|
||||
"version": "4.2.1",
|
||||
"resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.1.tgz",
|
||||
"integrity": "sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"estraverse": "^4.1.0"
|
||||
}
|
||||
},
|
||||
"estraverse": {
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz",
|
||||
"integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==",
|
||||
"dev": true
|
||||
},
|
||||
"esutils": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",
|
||||
"integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==",
|
||||
"dev": true
|
||||
},
|
||||
"fast-deep-equal": {
|
||||
"version": "3.1.3",
|
||||
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
|
||||
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
|
||||
"dev": true
|
||||
},
|
||||
"fast-diff": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.2.0.tgz",
|
||||
@@ -923,6 +1134,18 @@
|
||||
"picomatch": "^2.2.1"
|
||||
}
|
||||
},
|
||||
"fast-json-stable-stringify": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
|
||||
"integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==",
|
||||
"dev": true
|
||||
},
|
||||
"fast-levenshtein": {
|
||||
"version": "2.0.6",
|
||||
"resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz",
|
||||
"integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=",
|
||||
"dev": true
|
||||
},
|
||||
"fastq": {
|
||||
"version": "1.8.0",
|
||||
"resolved": "https://registry.npmjs.org/fastq/-/fastq-1.8.0.tgz",
|
||||
@@ -941,6 +1164,15 @@
|
||||
"escape-string-regexp": "^1.0.5"
|
||||
}
|
||||
},
|
||||
"file-entry-cache": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-5.0.1.tgz",
|
||||
"integrity": "sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"flat-cache": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"fill-range": {
|
||||
"version": "7.0.1",
|
||||
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
|
||||
@@ -960,6 +1192,34 @@
|
||||
"path-exists": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"flat-cache": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz",
|
||||
"integrity": "sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"flatted": "^2.0.0",
|
||||
"rimraf": "2.6.3",
|
||||
"write": "1.0.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"rimraf": {
|
||||
"version": "2.6.3",
|
||||
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz",
|
||||
"integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"glob": "^7.1.3"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"flatted": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.2.tgz",
|
||||
"integrity": "sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA==",
|
||||
"dev": true
|
||||
},
|
||||
"fs.realpath": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
|
||||
@@ -973,6 +1233,12 @@
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"functional-red-black-tree": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz",
|
||||
"integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=",
|
||||
"dev": true
|
||||
},
|
||||
"get-caller-file": {
|
||||
"version": "2.0.5",
|
||||
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
|
||||
@@ -1020,6 +1286,23 @@
|
||||
"ini": "^1.3.5"
|
||||
}
|
||||
},
|
||||
"globals": {
|
||||
"version": "12.4.0",
|
||||
"resolved": "https://registry.npmjs.org/globals/-/globals-12.4.0.tgz",
|
||||
"integrity": "sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"type-fest": "^0.8.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"type-fest": {
|
||||
"version": "0.8.1",
|
||||
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz",
|
||||
"integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"globby": {
|
||||
"version": "11.0.0",
|
||||
"resolved": "https://registry.npmjs.org/globby/-/globby-11.0.0.tgz",
|
||||
@@ -1095,6 +1378,24 @@
|
||||
"integrity": "sha1-SMptcvbGo68Aqa1K5odr44ieKwk=",
|
||||
"dev": true
|
||||
},
|
||||
"import-fresh": {
|
||||
"version": "3.2.1",
|
||||
"resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.2.1.tgz",
|
||||
"integrity": "sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"parent-module": "^1.0.0",
|
||||
"resolve-from": "^4.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"resolve-from": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz",
|
||||
"integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"import-lazy": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-2.1.0.tgz",
|
||||
@@ -1275,6 +1576,12 @@
|
||||
"integrity": "sha512-VjSeb/lHmkoyd8ryPVIKvOCn4D1koMqY+vqyjjUfc3xyKtP4dYOxM44sZrnqQSzSds3xyOrUTLTC9LVCVgLngw==",
|
||||
"dev": true
|
||||
},
|
||||
"isexe": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
|
||||
"integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=",
|
||||
"dev": true
|
||||
},
|
||||
"isobject": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/isobject/-/isobject-4.0.0.tgz",
|
||||
@@ -1315,6 +1622,18 @@
|
||||
"integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==",
|
||||
"dev": true
|
||||
},
|
||||
"json-schema-traverse": {
|
||||
"version": "0.4.1",
|
||||
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
|
||||
"integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",
|
||||
"dev": true
|
||||
},
|
||||
"json-stable-stringify-without-jsonify": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz",
|
||||
"integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=",
|
||||
"dev": true
|
||||
},
|
||||
"keyv": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz",
|
||||
@@ -1333,6 +1652,16 @@
|
||||
"package-json": "^6.3.0"
|
||||
}
|
||||
},
|
||||
"levn": {
|
||||
"version": "0.4.1",
|
||||
"resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz",
|
||||
"integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"prelude-ls": "^1.2.1",
|
||||
"type-check": "~0.4.0"
|
||||
}
|
||||
},
|
||||
"lines-and-columns": {
|
||||
"version": "1.1.6",
|
||||
"resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz",
|
||||
@@ -1577,6 +1906,15 @@
|
||||
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
|
||||
"dev": true
|
||||
},
|
||||
"mkdirp": {
|
||||
"version": "0.5.5",
|
||||
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz",
|
||||
"integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"minimist": "^1.2.5"
|
||||
}
|
||||
},
|
||||
"ms": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
||||
@@ -1589,6 +1927,12 @@
|
||||
"integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==",
|
||||
"dev": true
|
||||
},
|
||||
"natural-compare": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz",
|
||||
"integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=",
|
||||
"dev": true
|
||||
},
|
||||
"normalize-package-data": {
|
||||
"version": "2.5.0",
|
||||
"resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz",
|
||||
@@ -1631,6 +1975,20 @@
|
||||
"mimic-fn": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"optionator": {
|
||||
"version": "0.9.1",
|
||||
"resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz",
|
||||
"integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"deep-is": "^0.1.3",
|
||||
"fast-levenshtein": "^2.0.6",
|
||||
"levn": "^0.4.1",
|
||||
"prelude-ls": "^1.2.1",
|
||||
"type-check": "^0.4.0",
|
||||
"word-wrap": "^1.2.3"
|
||||
}
|
||||
},
|
||||
"ora": {
|
||||
"version": "4.0.4",
|
||||
"resolved": "https://registry.npmjs.org/ora/-/ora-4.0.4.tgz",
|
||||
@@ -1724,6 +2082,15 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"parent-module": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz",
|
||||
"integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"callsites": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"parse-json": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz",
|
||||
@@ -1752,6 +2119,12 @@
|
||||
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
|
||||
"dev": true
|
||||
},
|
||||
"path-key": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",
|
||||
"integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",
|
||||
"dev": true
|
||||
},
|
||||
"path-parse": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz",
|
||||
@@ -1840,6 +2213,12 @@
|
||||
"irregular-plurals": "^3.2.0"
|
||||
}
|
||||
},
|
||||
"prelude-ls": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz",
|
||||
"integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==",
|
||||
"dev": true
|
||||
},
|
||||
"prepend-http": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz",
|
||||
@@ -1855,6 +2234,12 @@
|
||||
"parse-ms": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"progress": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz",
|
||||
"integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==",
|
||||
"dev": true
|
||||
},
|
||||
"pump": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz",
|
||||
@@ -1865,6 +2250,12 @@
|
||||
"once": "^1.3.1"
|
||||
}
|
||||
},
|
||||
"punycode": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
|
||||
"integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==",
|
||||
"dev": true
|
||||
},
|
||||
"pupa": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/pupa/-/pupa-2.0.1.tgz",
|
||||
@@ -1927,6 +2318,12 @@
|
||||
"picomatch": "^2.2.1"
|
||||
}
|
||||
},
|
||||
"regexpp": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.1.0.tgz",
|
||||
"integrity": "sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q==",
|
||||
"dev": true
|
||||
},
|
||||
"registry-auth-token": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.1.1.tgz",
|
||||
@@ -2062,6 +2459,21 @@
|
||||
"integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=",
|
||||
"dev": true
|
||||
},
|
||||
"shebang-command": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
|
||||
"integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"shebang-regex": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"shebang-regex": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",
|
||||
"integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",
|
||||
"dev": true
|
||||
},
|
||||
"signal-exit": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz",
|
||||
@@ -2239,6 +2651,99 @@
|
||||
"has-flag": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"table": {
|
||||
"version": "5.4.6",
|
||||
"resolved": "https://registry.npmjs.org/table/-/table-5.4.6.tgz",
|
||||
"integrity": "sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ajv": "^6.10.2",
|
||||
"lodash": "^4.17.14",
|
||||
"slice-ansi": "^2.1.0",
|
||||
"string-width": "^3.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"ansi-regex": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
|
||||
"integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
|
||||
"dev": true
|
||||
},
|
||||
"ansi-styles": {
|
||||
"version": "3.2.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
|
||||
"integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"color-convert": "^1.9.0"
|
||||
}
|
||||
},
|
||||
"astral-regex": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz",
|
||||
"integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==",
|
||||
"dev": true
|
||||
},
|
||||
"color-convert": {
|
||||
"version": "1.9.3",
|
||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
|
||||
"integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"color-name": "1.1.3"
|
||||
}
|
||||
},
|
||||
"color-name": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
|
||||
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=",
|
||||
"dev": true
|
||||
},
|
||||
"emoji-regex": {
|
||||
"version": "7.0.3",
|
||||
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz",
|
||||
"integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==",
|
||||
"dev": true
|
||||
},
|
||||
"is-fullwidth-code-point": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
|
||||
"integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=",
|
||||
"dev": true
|
||||
},
|
||||
"slice-ansi": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-2.1.0.tgz",
|
||||
"integrity": "sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ansi-styles": "^3.2.0",
|
||||
"astral-regex": "^1.0.0",
|
||||
"is-fullwidth-code-point": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"string-width": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz",
|
||||
"integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"emoji-regex": "^7.0.1",
|
||||
"is-fullwidth-code-point": "^2.0.0",
|
||||
"strip-ansi": "^5.1.0"
|
||||
}
|
||||
},
|
||||
"strip-ansi": {
|
||||
"version": "5.2.0",
|
||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
|
||||
"integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ansi-regex": "^4.1.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"temp-dir": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/temp-dir/-/temp-dir-2.0.0.tgz",
|
||||
@@ -2251,6 +2756,12 @@
|
||||
"integrity": "sha512-a6sumDlzyHVJWb8+YofY4TW112G6p2FCPEAFk+59gIYHv3XHRhm9ltVQ9kli4hNWeQBwSpe8cRN25x0ROunMOw==",
|
||||
"dev": true
|
||||
},
|
||||
"text-table": {
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz",
|
||||
"integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=",
|
||||
"dev": true
|
||||
},
|
||||
"time-zone": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/time-zone/-/time-zone-1.0.0.tgz",
|
||||
@@ -2278,6 +2789,15 @@
|
||||
"integrity": "sha1-n5up2e+odkw4dpi8v+sshI8RrbM=",
|
||||
"dev": true
|
||||
},
|
||||
"type-check": {
|
||||
"version": "0.4.0",
|
||||
"resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",
|
||||
"integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"prelude-ls": "^1.2.1"
|
||||
}
|
||||
},
|
||||
"type-fest": {
|
||||
"version": "0.3.1",
|
||||
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.3.1.tgz",
|
||||
@@ -2335,6 +2855,15 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"uri-js": {
|
||||
"version": "4.2.2",
|
||||
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz",
|
||||
"integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"punycode": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"url-parse-lax": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz",
|
||||
@@ -2344,6 +2873,12 @@
|
||||
"prepend-http": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"v8-compile-cache": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.1.1.tgz",
|
||||
"integrity": "sha512-8OQ9CL+VWyt3JStj7HX7/ciTL2V3Rl1Wf5OL+SNTm0yK1KvtReVulksyeRnCANHHuUxHlQig+JJDlUhBt1NQDQ==",
|
||||
"dev": true
|
||||
},
|
||||
"validate-npm-package-license": {
|
||||
"version": "3.0.4",
|
||||
"resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz",
|
||||
@@ -2369,6 +2904,15 @@
|
||||
"integrity": "sha512-ZMjC3ho+KXo0BfJb7JgtQ5IBuvnShdlACNkKkdsqBmYw3bPAaJfPeYUo6tLUaT5tG/Gkh7xkpBhKRQ9e7pyg9Q==",
|
||||
"dev": true
|
||||
},
|
||||
"which": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
|
||||
"integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"isexe": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"which-module": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz",
|
||||
@@ -2384,6 +2928,12 @@
|
||||
"string-width": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"word-wrap": {
|
||||
"version": "1.2.3",
|
||||
"resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz",
|
||||
"integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==",
|
||||
"dev": true
|
||||
},
|
||||
"wrap-ansi": {
|
||||
"version": "6.2.0",
|
||||
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz",
|
||||
@@ -2401,6 +2951,15 @@
|
||||
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
|
||||
"dev": true
|
||||
},
|
||||
"write": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/write/-/write-1.0.3.tgz",
|
||||
"integrity": "sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"mkdirp": "^0.5.1"
|
||||
}
|
||||
},
|
||||
"write-file-atomic": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz",
|
||||
|
||||
+2
-1
@@ -8,6 +8,7 @@
|
||||
"test": "ava"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^3.8.2"
|
||||
"ava": "^3.8.2",
|
||||
"eslint": "^7.5.0"
|
||||
}
|
||||
}
|
||||
|
||||
+34
-22
@@ -19,41 +19,53 @@ this program. If not, see <http s ://www.gnu.org/licenses/>.
|
||||
const { extensionUtils } = imports.misc;
|
||||
const Me = extensionUtils.getCurrentExtension();
|
||||
|
||||
const shell_minor_version = parseInt(imports.misc.config.PACKAGE_VERSION.split('.')[1]);
|
||||
const shellMinorVersion = parseInt(imports.misc.config.PACKAGE_VERSION.split('.')[1]);
|
||||
|
||||
|
||||
function init_translations(domain) {
|
||||
if ( shell_minor_version <= 30 ) return Me.imports.convenience.initTranslations(domain);
|
||||
else return extensionUtils.initTranslations(domain);
|
||||
function initTranslations(domain) {
|
||||
if (shellMinorVersion <= 30)
|
||||
return Me.imports.convenience.initTranslations(domain);
|
||||
else
|
||||
return extensionUtils.initTranslations(domain);
|
||||
}
|
||||
|
||||
|
||||
function extension_manager_initialized() {
|
||||
if ( shell_minor_version > 32 ) return imports.ui.main.extensionManager._initialized;
|
||||
else return imports.ui.extensionSystem.initted;
|
||||
function extensionManagerInitialized() {
|
||||
if (shellMinorVersion > 32)
|
||||
return imports.ui.main.extensionManager._initialized;
|
||||
else
|
||||
return imports.ui.extensionSystem.initted;
|
||||
}
|
||||
|
||||
|
||||
function extension_manager_lookup(uuid) {
|
||||
if ( shell_minor_version > 32 ) return imports.ui.main.extensionManager.lookup(uuid);
|
||||
else return extensionUtils.extensions[uuid] || null;
|
||||
function extensionManagerLookup(uuid) {
|
||||
if (shellMinorVersion > 32)
|
||||
return imports.ui.main.extensionManager.lookup(uuid);
|
||||
else
|
||||
return extensionUtils.extensions[uuid] || null;
|
||||
}
|
||||
|
||||
|
||||
function get_extension_settings() {
|
||||
if ( shell_minor_version <= 30 ) return Me.imports.convenience.getSettings();
|
||||
else return extensionUtils.getSettings();
|
||||
function getExtensionSettings() {
|
||||
if (shellMinorVersion <= 30)
|
||||
return Me.imports.convenience.getSettings();
|
||||
else
|
||||
return extensionUtils.getSettings();
|
||||
}
|
||||
|
||||
|
||||
function key_binding_auto_repeat() {
|
||||
// if version is less then 3.30 the keybinding flags are NONE
|
||||
if (shell_minor_version < 30) return imports.gi.Meta.KeyBindingFlags.NONE;
|
||||
else return imports.gi.Meta.KeyBindingFlags.IGNORE_AUTOREPEAT;
|
||||
};
|
||||
function keyBindingAutoRepeat() {
|
||||
// if version is less then 3.30 the keybinding flags are NONE
|
||||
if (shellMinorVersion < 30)
|
||||
return imports.gi.Meta.KeyBindingFlags.NONE;
|
||||
else
|
||||
return imports.gi.Meta.KeyBindingFlags.IGNORE_AUTOREPEAT;
|
||||
}
|
||||
|
||||
|
||||
function get_actor(subject) {
|
||||
if (shell_minor_version > 34) return subject;
|
||||
else return subject.actor;
|
||||
};
|
||||
function getActor(subject) {
|
||||
if (shellMinorVersion > 34)
|
||||
return subject;
|
||||
else
|
||||
return subject.actor;
|
||||
}
|
||||
|
||||
+48
-51
@@ -19,12 +19,11 @@ this program. If not, see <http s ://www.gnu.org/licenses/>.
|
||||
'use strict';
|
||||
|
||||
const { extensionUtils } = imports.misc;
|
||||
const { main } = imports.ui;
|
||||
|
||||
const Me = extensionUtils.getCurrentExtension();
|
||||
|
||||
const compat = Me.imports.compat;
|
||||
const { log_debug } = Me.imports.utils;
|
||||
const { logDebug } = Me.imports.utils;
|
||||
const { SettingsManager } = Me.imports.modules.SettingsManager;
|
||||
const { Timer } = Me.imports.modules.Timer;
|
||||
const { GtkThemer } = Me.imports.modules.GtkThemer;
|
||||
@@ -47,65 +46,63 @@ var commander = null;
|
||||
|
||||
|
||||
function init() {
|
||||
log_debug('Initializing extension...');
|
||||
compat.init_translations(Me.metadata.uuid);
|
||||
log_debug('Extension initialized.');
|
||||
logDebug('Initializing extension...');
|
||||
compat.initTranslations(Me.metadata.uuid);
|
||||
logDebug('Extension initialized.');
|
||||
}
|
||||
|
||||
function enable() {
|
||||
this._await_extensionManager_init().then(() => {
|
||||
log_debug('Enabling extension...');
|
||||
settingsManager = new SettingsManager();
|
||||
timer = new Timer();
|
||||
gtkThemer = new GtkThemer();
|
||||
shellThemer = new ShellThemer();
|
||||
iconThemer = new IconThemer();
|
||||
cursorThemer = new CursorThemer();
|
||||
backgrounder = new Backgrounder();
|
||||
commander = new Commander();
|
||||
_awaitExtensionManagerInit().then(() => {
|
||||
logDebug('Enabling extension...');
|
||||
settingsManager = new SettingsManager();
|
||||
timer = new Timer();
|
||||
gtkThemer = new GtkThemer();
|
||||
shellThemer = new ShellThemer();
|
||||
iconThemer = new IconThemer();
|
||||
cursorThemer = new CursorThemer();
|
||||
backgrounder = new Backgrounder();
|
||||
commander = new Commander();
|
||||
|
||||
settingsManager.enable();
|
||||
gtkThemer.enable();
|
||||
shellThemer.enable();
|
||||
iconThemer.enable();
|
||||
cursorThemer.enable();
|
||||
backgrounder.enable();
|
||||
commander.enable();
|
||||
timer.enable();
|
||||
settingsManager.enable();
|
||||
gtkThemer.enable();
|
||||
shellThemer.enable();
|
||||
iconThemer.enable();
|
||||
cursorThemer.enable();
|
||||
backgrounder.enable();
|
||||
commander.enable();
|
||||
timer.enable();
|
||||
|
||||
enabled = true;
|
||||
log_debug('Extension enabled.');
|
||||
});
|
||||
enabled = true;
|
||||
logDebug('Extension enabled.');
|
||||
});
|
||||
}
|
||||
|
||||
function disable() {
|
||||
log_debug('Disabling extension...');
|
||||
enabled = false;
|
||||
logDebug('Disabling extension...');
|
||||
enabled = false;
|
||||
|
||||
gtkThemer.disable();
|
||||
shellThemer.disable();
|
||||
iconThemer.disable();
|
||||
cursorThemer.disable();
|
||||
backgrounder.disable();
|
||||
commander.disable();
|
||||
timer.disable();
|
||||
settingsManager.disable();
|
||||
gtkThemer.disable();
|
||||
shellThemer.disable();
|
||||
iconThemer.disable();
|
||||
cursorThemer.disable();
|
||||
backgrounder.disable();
|
||||
commander.disable();
|
||||
timer.disable();
|
||||
settingsManager.disable();
|
||||
|
||||
settingsManager = null;
|
||||
timer = null;
|
||||
gtkThemer = null;
|
||||
shellThemer = null;
|
||||
iconThemer = null;
|
||||
cursorThemer = null;
|
||||
backgrounder = null;
|
||||
commander = null;
|
||||
log_debug('Extension disabled.');
|
||||
settingsManager = null;
|
||||
timer = null;
|
||||
gtkThemer = null;
|
||||
shellThemer = null;
|
||||
iconThemer = null;
|
||||
cursorThemer = null;
|
||||
backgrounder = null;
|
||||
commander = null;
|
||||
logDebug('Extension disabled.');
|
||||
}
|
||||
|
||||
async function _await_extensionManager_init() {
|
||||
log_debug('Waiting for the Extension Manager to be initialized...');
|
||||
while ( true ) {
|
||||
if ( compat.extension_manager_initialized() ) return;
|
||||
await null;
|
||||
}
|
||||
async function _awaitExtensionManagerInit() {
|
||||
logDebug('Waiting for the Extension Manager to be initialized...');
|
||||
while (!compat.extensionManagerInitialized())
|
||||
await undefined; // eslint-disable-line no-await-in-loop
|
||||
}
|
||||
|
||||
+86
-81
@@ -16,13 +16,12 @@ You should have received a copy of the GNU General Public License along with
|
||||
this program. If not, see <http s ://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
const { GLib } = imports.gi;
|
||||
const { extensionUtils } = imports.misc;
|
||||
|
||||
const Me = extensionUtils.getCurrentExtension();
|
||||
|
||||
const e = Me.imports.extension;
|
||||
const { log_debug } = Me.imports.utils;
|
||||
const { logDebug } = Me.imports.utils;
|
||||
|
||||
/**
|
||||
* The Backgrounder is responsible for changing the desktop background
|
||||
@@ -33,98 +32,104 @@ const { log_debug } = Me.imports.utils;
|
||||
*/
|
||||
var Backgrounder = class {
|
||||
|
||||
enable() {
|
||||
log_debug('Enabling Backgrounder...');
|
||||
this._watch_status();
|
||||
if ( e.settingsManager.backgrounds_enabled ) {
|
||||
this._connect_settings();
|
||||
this._connect_timer();
|
||||
}
|
||||
log_debug('Backgrounder enabled.');
|
||||
}
|
||||
constructor() {
|
||||
this._backgroundsStatusChangedConnect = null;
|
||||
this._backgroundTimeChangedConnect = null;
|
||||
this._backgroundChangedConnect = null;
|
||||
this._timeChangedConnect = null;
|
||||
}
|
||||
|
||||
disable() {
|
||||
log_debug('Disabling Backgrounder...');
|
||||
this._disconnect_timer();
|
||||
this._disconnect_settings();
|
||||
this._unwatch_status();
|
||||
log_debug('Backgrounder disabled.');
|
||||
}
|
||||
enable() {
|
||||
logDebug('Enabling Backgrounder...');
|
||||
this._watchStatus();
|
||||
if (e.settingsManager.backgroundsEnabled) {
|
||||
this._connectSettings();
|
||||
this._connectTimer();
|
||||
}
|
||||
logDebug('Backgrounder enabled.');
|
||||
}
|
||||
|
||||
disable() {
|
||||
logDebug('Disabling Backgrounder...');
|
||||
this._disconnectTimer();
|
||||
this._disconnectSettings();
|
||||
this._unwatchStatus();
|
||||
logDebug('Backgrounder disabled.');
|
||||
}
|
||||
|
||||
|
||||
_watch_status() {
|
||||
log_debug('Watching backgrounds status...');
|
||||
this._backgrounds_status_changed_connect = e.settingsManager.connect('backgrounds-status-changed', this._on_backgrounds_status_changed.bind(this));
|
||||
}
|
||||
_watchStatus() {
|
||||
logDebug('Watching backgrounds status...');
|
||||
this._backgroundsStatusChangedConnect = e.settingsManager.connect('backgrounds-status-changed', this._onBackgroundsStatusChanged.bind(this));
|
||||
}
|
||||
|
||||
_unwatch_status() {
|
||||
if ( this._backgrounds_status_changed_connect ) {
|
||||
e.settingsManager.disconnect(this._backgrounds_status_changed_connect);
|
||||
this._backgrounds_status_changed_connect = null;
|
||||
}
|
||||
log_debug('Stopped watching backgrounds status.');
|
||||
}
|
||||
_unwatchStatus() {
|
||||
if (this._backgroundsStatusChangedConnect) {
|
||||
e.settingsManager.disconnect(this._backgroundsStatusChangedConnect);
|
||||
this._backgroundsStatusChangedConnect = null;
|
||||
}
|
||||
logDebug('Stopped watching backgrounds status.');
|
||||
}
|
||||
|
||||
_connect_settings() {
|
||||
log_debug('Connecting Backgrounder to settings...');
|
||||
this._background_time_changed_connect = e.settingsManager.connect('background-time-changed', this._on_background_time_changed.bind(this));
|
||||
this._background_changed_connect = e.settingsManager.connect('background-changed', this._on_background_changed.bind(this));
|
||||
}
|
||||
_connectSettings() {
|
||||
logDebug('Connecting Backgrounder to settings...');
|
||||
this._backgroundTimeChangedConnect = e.settingsManager.connect('background-time-changed', this._onBackgroundTimeChanged.bind(this));
|
||||
this._backgroundChangedConnect = e.settingsManager.connect('background-changed', this._onBackgroundChanged.bind(this));
|
||||
}
|
||||
|
||||
_disconnect_settings() {
|
||||
if ( this._background_time_changed_connect ) {
|
||||
e.settingsManager.disconnect(this._background_time_changed_connect);
|
||||
this._background_time_changed_connect = null;
|
||||
}
|
||||
if ( this._background_changed_connect ) {
|
||||
e.settingsManager.disconnect(this._background_changed_connect);
|
||||
this._background_changed_connect = null;
|
||||
}
|
||||
log_debug('Disconnected Backgrounder from settings.');
|
||||
}
|
||||
_disconnectSettings() {
|
||||
if (this._backgroundTimeChangedConnect) {
|
||||
e.settingsManager.disconnect(this._backgroundTimeChangedConnect);
|
||||
this._backgroundTimeChangedConnect = null;
|
||||
}
|
||||
if (this._backgroundChangedConnect) {
|
||||
e.settingsManager.disconnect(this._backgroundChangedConnect);
|
||||
this._backgroundChangedConnect = null;
|
||||
}
|
||||
logDebug('Disconnected Backgrounder from settings.');
|
||||
}
|
||||
|
||||
_connect_timer() {
|
||||
log_debug('Connecting Backgrounder to Timer...');
|
||||
this._time_changed_connect = e.timer.connect('time-changed', this._on_time_changed.bind(this));
|
||||
}
|
||||
_connectTimer() {
|
||||
logDebug('Connecting Backgrounder to Timer...');
|
||||
this._timeChangedConnect = e.timer.connect('time-changed', this._onTimeChanged.bind(this));
|
||||
}
|
||||
|
||||
_disconnect_timer() {
|
||||
if ( this._time_changed_connect ) {
|
||||
e.timer.disconnect(this._time_changed_connect);
|
||||
this._time_changed_connect = null;
|
||||
}
|
||||
log_debug('Disconnected Backgrounder from Timer.');
|
||||
}
|
||||
_disconnectTimer() {
|
||||
if (this._timeChangedConnect) {
|
||||
e.timer.disconnect(this._timeChangedConnect);
|
||||
this._timeChangedConnect = null;
|
||||
}
|
||||
logDebug('Disconnected Backgrounder from Timer.');
|
||||
}
|
||||
|
||||
|
||||
_on_backgrounds_status_changed(settings, enabled) {
|
||||
this.disable();
|
||||
this.enable();
|
||||
}
|
||||
_onBackgroundsStatusChanged(_settings, _enabled) {
|
||||
this.disable();
|
||||
this.enable();
|
||||
}
|
||||
|
||||
_on_background_time_changed(settings, changed_background_time) {
|
||||
if ( changed_background_time === e.timer.time ) {
|
||||
this._change_background(changed_background_time);
|
||||
}
|
||||
}
|
||||
_onBackgroundTimeChanged(_settings, changedBackgroundTime) {
|
||||
if (changedBackgroundTime === e.timer.time)
|
||||
this._changeBackground(changedBackgroundTime);
|
||||
}
|
||||
|
||||
_on_background_changed(settings, new_background) {
|
||||
switch (e.timer.time) {
|
||||
case 'day':
|
||||
e.settingsManager.background_day = new_background;
|
||||
break;
|
||||
case 'night':
|
||||
e.settingsManager.background_night = new_background;
|
||||
}
|
||||
}
|
||||
_onBackgroundChanged(_settings, newBackground) {
|
||||
switch (e.timer.time) {
|
||||
case 'day':
|
||||
e.settingsManager.backgroundDay = newBackground;
|
||||
break;
|
||||
case 'night':
|
||||
e.settingsManager.backgroundNight = newBackground;
|
||||
}
|
||||
}
|
||||
|
||||
_on_time_changed(timer, new_time) {
|
||||
this._change_background(new_time);
|
||||
}
|
||||
_onTimeChanged(_timer, newTime) {
|
||||
this._changeBackground(newTime);
|
||||
}
|
||||
|
||||
|
||||
_change_background(time) {
|
||||
e.settingsManager.background = time === 'day' ? e.settingsManager.background_day : e.settingsManager.background_night;
|
||||
}
|
||||
_changeBackground(time) {
|
||||
e.settingsManager.background = time === 'day' ? e.settingsManager.backgroundDay : e.settingsManager.backgroundNight;
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
+54
-50
@@ -22,7 +22,7 @@ const { extensionUtils } = imports.misc;
|
||||
const Me = extensionUtils.getCurrentExtension();
|
||||
|
||||
const e = Me.imports.extension;
|
||||
const { log_debug } = Me.imports.utils;
|
||||
const { logDebug } = Me.imports.utils;
|
||||
|
||||
|
||||
/**
|
||||
@@ -30,64 +30,68 @@ const { log_debug } = Me.imports.utils;
|
||||
*/
|
||||
var Commander = class {
|
||||
|
||||
enable() {
|
||||
log_debug('Enabling Commander...');
|
||||
this._watch_status();
|
||||
if ( e.settingsManager.commands_enabled ) {
|
||||
this._connect_timer();
|
||||
}
|
||||
log_debug('Commander enabled.');
|
||||
}
|
||||
constructor() {
|
||||
this._commandsStatusChangedConnect = null;
|
||||
this._timeChangedConnect = null;
|
||||
}
|
||||
|
||||
disable() {
|
||||
log_debug('Disabling Commander...');
|
||||
this._disconnect_timer();
|
||||
this._unwatch_status();
|
||||
log_debug('Commander disabled.');
|
||||
}
|
||||
enable() {
|
||||
logDebug('Enabling Commander...');
|
||||
this._watchStatus();
|
||||
if (e.settingsManager.commandsEnabled)
|
||||
this._connectTimer();
|
||||
logDebug('Commander enabled.');
|
||||
}
|
||||
|
||||
disable() {
|
||||
logDebug('Disabling Commander...');
|
||||
this._disconnectTimer();
|
||||
this._unwatchStatus();
|
||||
logDebug('Commander disabled.');
|
||||
}
|
||||
|
||||
|
||||
_watch_status() {
|
||||
log_debug('Watching commands status...');
|
||||
this._commands_status_changed_connect = e.settingsManager.connect('commands-status-changed', this._on_commands_status_changed.bind(this));
|
||||
}
|
||||
_watchStatus() {
|
||||
logDebug('Watching commands status...');
|
||||
this._commandsStatusChangedConnect = e.settingsManager.connect('commands-status-changed', this._onCommandsStatusChanged.bind(this));
|
||||
}
|
||||
|
||||
_unwatch_status() {
|
||||
if ( this._commands_status_changed_connect ) {
|
||||
e.settingsManager.disconnect(this._commands_status_changed_connect);
|
||||
this._commands_status_changed_connect = null;
|
||||
}
|
||||
log_debug('Stopped watching commands status.');
|
||||
}
|
||||
_unwatchStatus() {
|
||||
if (this._commandsStatusChangedConnect) {
|
||||
e.settingsManager.disconnect(this._commandsStatusChangedConnect);
|
||||
this._commandsStatusChangedConnect = null;
|
||||
}
|
||||
logDebug('Stopped watching commands status.');
|
||||
}
|
||||
|
||||
_connect_timer() {
|
||||
log_debug('Connecting Commander to Timer...');
|
||||
this._time_changed_connect = e.timer.connect('time-changed', this._on_time_changed.bind(this));
|
||||
}
|
||||
_connectTimer() {
|
||||
logDebug('Connecting Commander to Timer...');
|
||||
this._timeChangedConnect = e.timer.connect('time-changed', this._onTimeChanged.bind(this));
|
||||
}
|
||||
|
||||
_disconnect_timer() {
|
||||
if ( this._time_changed_connect ) {
|
||||
e.timer.disconnect(this._time_changed_connect);
|
||||
this._time_changed_connect = null;
|
||||
}
|
||||
log_debug('Disconnecting Commander from Timer.');
|
||||
}
|
||||
_disconnectTimer() {
|
||||
if (this._timeChangedConnect) {
|
||||
e.timer.disconnect(this._timeChangedConnect);
|
||||
this._timeChangedConnect = null;
|
||||
}
|
||||
logDebug('Disconnecting Commander from Timer.');
|
||||
}
|
||||
|
||||
|
||||
_on_commands_status_changed(settings, enabled) {
|
||||
this.disable();
|
||||
this.enable();
|
||||
}
|
||||
_onCommandsStatusChanged(_settings, _enabled) {
|
||||
this.disable();
|
||||
this.enable();
|
||||
}
|
||||
|
||||
_on_time_changed(timer, new_time) {
|
||||
this._spawn_command(new_time);
|
||||
}
|
||||
_onTimeChanged(_timer, newTime) {
|
||||
this._spawnCommand(newTime);
|
||||
}
|
||||
|
||||
|
||||
_spawn_command(time) {
|
||||
const command = time === 'day' ? e.settingsManager.command_sunrise : e.settingsManager.command_sunset;
|
||||
GLib.spawn_async(null, ['sh', '-c', command], null, GLib.SpawnFlags.SEARCH_PATH, null);
|
||||
log_debug(`Spawned ${time} command.`);
|
||||
}
|
||||
_spawnCommand(time) {
|
||||
const command = time === 'day' ? e.settingsManager.commandSunrise : e.settingsManager.commandSunset;
|
||||
GLib.spawn_async(null, ['sh', '-c', command], null, GLib.SpawnFlags.SEARCH_PATH, null);
|
||||
logDebug(`Spawned ${time} command.`);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
+111
-105
@@ -22,7 +22,7 @@ const { main } = imports.ui;
|
||||
const Me = extensionUtils.getCurrentExtension();
|
||||
|
||||
const e = Me.imports.extension;
|
||||
const { log_debug } = Me.imports.utils;
|
||||
const { logDebug } = Me.imports.utils;
|
||||
|
||||
|
||||
/**
|
||||
@@ -31,125 +31,131 @@ const { log_debug } = Me.imports.utils;
|
||||
*/
|
||||
var CursorThemer = class {
|
||||
|
||||
enable() {
|
||||
log_debug('Enabling Cursor Themer...');
|
||||
this._watch_status();
|
||||
this._save_original_theme();
|
||||
if ( e.settingsManager.cursor_variants_enabled ) {
|
||||
this._connect_settings();
|
||||
this._connect_timer();
|
||||
}
|
||||
log_debug('Cursor Themer enabled.');
|
||||
}
|
||||
constructor() {
|
||||
this._cursorVariantsStatusChangedConnect = null;
|
||||
this._cursorVariantChangedConnect = null;
|
||||
this._cursorThemeChangedConnect = null;
|
||||
this._timeChangedConnect = null;
|
||||
}
|
||||
|
||||
disable() {
|
||||
log_debug('Disabling Cursor Themer...');
|
||||
this._disconnect_timer();
|
||||
this._disconnect_settings();
|
||||
this._reset_original_theme();
|
||||
this._unwatch_status();
|
||||
log_debug('Cursor Themer disabled.');
|
||||
}
|
||||
enable() {
|
||||
logDebug('Enabling Cursor Themer...');
|
||||
this._watchStatus();
|
||||
this._saveOriginalTheme();
|
||||
if (e.settingsManager.cursorVariantsEnabled) {
|
||||
this._connectSettings();
|
||||
this._connectTimer();
|
||||
}
|
||||
logDebug('Cursor Themer enabled.');
|
||||
}
|
||||
|
||||
disable() {
|
||||
logDebug('Disabling Cursor Themer...');
|
||||
this._disconnectTimer();
|
||||
this._disconnectSettings();
|
||||
this._resetOriginalTheme();
|
||||
this._unwatchStatus();
|
||||
logDebug('Cursor Themer disabled.');
|
||||
}
|
||||
|
||||
|
||||
_watch_status() {
|
||||
log_debug('Watching cursor variants status...');
|
||||
this._cursor_variants_status_changed_connect = e.settingsManager.connect('cursor-variants-status-changed', this._on_cursor_variants_status_changed.bind(this));
|
||||
}
|
||||
_watchStatus() {
|
||||
logDebug('Watching cursor variants status...');
|
||||
this._cursorVariantsStatusChangedConnect = e.settingsManager.connect('cursor-variants-status-changed', this._onCursorVariantsStatusChanged.bind(this));
|
||||
}
|
||||
|
||||
_unwatch_status() {
|
||||
if ( this._cursor_variants_status_changed_connect ) {
|
||||
e.settingsManager.disconnect(this._cursor_variants_status_changed_connect);
|
||||
this._cursor_variants_status_changed_connect = null;
|
||||
}
|
||||
log_debug('Stopped watching cursor variants status.');
|
||||
}
|
||||
_unwatchStatus() {
|
||||
if (this._cursorVariantsStatusChangedConnect) {
|
||||
e.settingsManager.disconnect(this._cursorVariantsStatusChangedConnect);
|
||||
this._cursorVariantsStatusChangedConnect = null;
|
||||
}
|
||||
logDebug('Stopped watching cursor variants status.');
|
||||
}
|
||||
|
||||
_connect_settings() {
|
||||
log_debug('Connecting Cursor Themer to settings...');
|
||||
this._cursor_variant_changed_connect = e.settingsManager.connect('cursor-variant-changed', this._on_cursor_variant_changed.bind(this));
|
||||
this._cursor_theme_changed_connect = e.settingsManager.connect('cursor-theme-changed', this._on_cursor_theme_changed.bind(this));
|
||||
}
|
||||
_connectSettings() {
|
||||
logDebug('Connecting Cursor Themer to settings...');
|
||||
this._cursorVariantChangedConnect = e.settingsManager.connect('cursor-variant-changed', this._onCursorVariantChanged.bind(this));
|
||||
this._cursorThemeChangedConnect = e.settingsManager.connect('cursor-theme-changed', this._onCursorThemeChanged.bind(this));
|
||||
}
|
||||
|
||||
_disconnect_settings() {
|
||||
if ( this._cursor_variant_changed_connect ) {
|
||||
e.settingsManager.disconnect(this._cursor_variant_changed_connect);
|
||||
this._cursor_variant_changed_connect = null;
|
||||
}
|
||||
if ( this._cursor_theme_changed_connect ) {
|
||||
e.settingsManager.disconnect(this._cursor_theme_changed_connect);
|
||||
this._cursor_theme_changed_connect = null;
|
||||
}
|
||||
log_debug('Disconnected Cursor Themer from settings.');
|
||||
}
|
||||
_disconnectSettings() {
|
||||
if (this._cursorVariantChangedConnect) {
|
||||
e.settingsManager.disconnect(this._cursorVariantChangedConnect);
|
||||
this._cursorVariantChangedConnect = null;
|
||||
}
|
||||
if (this._cursorThemeChangedConnect) {
|
||||
e.settingsManager.disconnect(this._cursorThemeChangedConnect);
|
||||
this._cursorThemeChangedConnect = null;
|
||||
}
|
||||
logDebug('Disconnected Cursor Themer from settings.');
|
||||
}
|
||||
|
||||
_connect_timer() {
|
||||
log_debug('Connecting Cursor Themer to Timer...');
|
||||
this._time_changed_connect = e.timer.connect('time-changed', this._on_time_changed.bind(this));
|
||||
}
|
||||
_connectTimer() {
|
||||
logDebug('Connecting Cursor Themer to Timer...');
|
||||
this._timeChangedConnect = e.timer.connect('time-changed', this._onTimeChanged.bind(this));
|
||||
}
|
||||
|
||||
_disconnect_timer() {
|
||||
if ( this._time_changed_connect ) {
|
||||
e.timer.disconnect(this._time_changed_connect);
|
||||
this._time_changed_connect = null;
|
||||
}
|
||||
log_debug('Disconnected Cursor Themer from Timer.');
|
||||
}
|
||||
_disconnectTimer() {
|
||||
if (this._timeChangedConnect) {
|
||||
e.timer.disconnect(this._timeChangedConnect);
|
||||
this._timeChangedConnect = null;
|
||||
}
|
||||
logDebug('Disconnected Cursor Themer from Timer.');
|
||||
}
|
||||
|
||||
|
||||
_on_cursor_variants_status_changed(settings, enabled) {
|
||||
this.disable();
|
||||
this.enable();
|
||||
}
|
||||
_onCursorVariantsStatusChanged(_settings, _enabled) {
|
||||
this.disable();
|
||||
this.enable();
|
||||
}
|
||||
|
||||
_on_cursor_variant_changed(settings, changed_variant_time) {
|
||||
if ( changed_variant_time === e.timer.time ) {
|
||||
this._set_variant(changed_variant_time);
|
||||
}
|
||||
}
|
||||
_onCursorVariantChanged(_settings, changedVariantTime) {
|
||||
if (changedVariantTime === e.timer.time)
|
||||
this._setVariant(changedVariantTime);
|
||||
}
|
||||
|
||||
_on_cursor_theme_changed(settings, new_theme) {
|
||||
switch (e.timer.time) {
|
||||
case 'day':
|
||||
e.settingsManager.cursor_variant_day = new_theme;
|
||||
break;
|
||||
case 'night':
|
||||
e.settingsManager.cursor_variant_night = new_theme;
|
||||
}
|
||||
this._set_variant(e.timer.time);
|
||||
}
|
||||
_onCursorThemeChanged(_settings, newTheme) {
|
||||
switch (e.timer.time) {
|
||||
case 'day':
|
||||
e.settingsManager.cursorVariantDay = newTheme;
|
||||
break;
|
||||
case 'night':
|
||||
e.settingsManager.cursorVariantNight = newTheme;
|
||||
}
|
||||
this._setVariant(e.timer.time);
|
||||
}
|
||||
|
||||
_on_time_changed(timer, new_time) {
|
||||
this._set_variant(new_time);
|
||||
}
|
||||
_onTimeChanged(_timer, newTime) {
|
||||
this._setVariant(newTime);
|
||||
}
|
||||
|
||||
|
||||
_set_variant(time) {
|
||||
log_debug(`Setting the cursor ${time} variant...`);
|
||||
switch (time) {
|
||||
case 'day':
|
||||
e.settingsManager.cursor_theme = e.settingsManager.cursor_variant_day;
|
||||
break;
|
||||
case 'night':
|
||||
e.settingsManager.cursor_theme = e.settingsManager.cursor_variant_night;
|
||||
break;
|
||||
case 'original':
|
||||
e.settingsManager.cursor_theme = e.settingsManager.cursor_variant_original;
|
||||
break;
|
||||
}
|
||||
}
|
||||
_setVariant(time) {
|
||||
logDebug(`Setting the cursor ${time} variant...`);
|
||||
switch (time) {
|
||||
case 'day':
|
||||
e.settingsManager.cursorTheme = e.settingsManager.cursorVariantDay;
|
||||
break;
|
||||
case 'night':
|
||||
e.settingsManager.cursorTheme = e.settingsManager.cursorVariantNight;
|
||||
break;
|
||||
case 'original':
|
||||
e.settingsManager.cursorTheme = e.settingsManager.cursorVariantOriginal;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
_save_original_theme() {
|
||||
e.settingsManager.cursor_variant_original = e.settingsManager.cursor_theme;
|
||||
}
|
||||
_saveOriginalTheme() {
|
||||
e.settingsManager.cursorVariantOriginal = e.settingsManager.cursorTheme;
|
||||
}
|
||||
|
||||
_reset_original_theme() {
|
||||
// We don't reset the theme when locking the session to prevent
|
||||
// flicker on unlocking
|
||||
if ( !main.screenShield.locked ) {
|
||||
log_debug('Resetting to the user\'s original cursor theme...');
|
||||
this._set_variant('original');
|
||||
}
|
||||
}
|
||||
_resetOriginalTheme() {
|
||||
// We don't reset the theme when locking the session to prevent
|
||||
// flicker on unlocking
|
||||
if (!main.screenShield.locked) {
|
||||
logDebug('Resetting to the user\'s original cursor theme...');
|
||||
this._setVariant('original');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
+133
-131
@@ -16,14 +16,13 @@ You should have received a copy of the GNU General Public License along with
|
||||
this program. If not, see <http s ://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
const { Gio, GLib, Gtk } = imports.gi;
|
||||
const { extensionUtils } = imports.misc;
|
||||
const { main } = imports.ui;
|
||||
|
||||
const Me = extensionUtils.getCurrentExtension();
|
||||
|
||||
const e = Me.imports.extension;
|
||||
const { log_debug, log_error, get_installed_gtk_themes } = Me.imports.utils;
|
||||
const { logDebug, notifyError, getInstalledGtkThemes } = Me.imports.utils;
|
||||
const { GtkVariants } = Me.imports.modules.GtkVariants;
|
||||
|
||||
const Gettext = imports.gettext.domain(Me.metadata.uuid);
|
||||
@@ -43,155 +42,158 @@ const _ = Gettext.gettext;
|
||||
*/
|
||||
var GtkThemer = class {
|
||||
|
||||
enable() {
|
||||
log_debug('Enabling GTK Themer...');
|
||||
try {
|
||||
this._watch_status();
|
||||
this._save_original_theme();
|
||||
if ( e.settingsManager.gtk_variants_enabled ) {
|
||||
this._update_variants();
|
||||
this._connect_settings();
|
||||
this._connect_timer();
|
||||
}
|
||||
}
|
||||
catch(e) {
|
||||
log_error(e);
|
||||
}
|
||||
log_debug('GTK Themer enabled.');
|
||||
}
|
||||
constructor() {
|
||||
this._gtkVariantsStatusChangedConnect = null;
|
||||
this._gtkVariantChangedConnect = null;
|
||||
this._gtkThemeChangedConnect = null;
|
||||
this._timeChangedConnect = null;
|
||||
}
|
||||
|
||||
disable() {
|
||||
log_debug('Disabling GTK Themer...');
|
||||
this._disconnect_timer();
|
||||
this._disconnect_settings();
|
||||
this._reset_original_theme();
|
||||
this._unwatch_status();
|
||||
log_debug('GTK Themer disabled.');
|
||||
}
|
||||
enable() {
|
||||
logDebug('Enabling GTK Themer...');
|
||||
try {
|
||||
this._watchStatus();
|
||||
this._saveOriginalTheme();
|
||||
if (e.settingsManager.gtkVariantsEnabled) {
|
||||
this._updateVariants();
|
||||
this._connectSettings();
|
||||
this._connectTimer();
|
||||
}
|
||||
} catch (error) {
|
||||
notifyError(error);
|
||||
}
|
||||
logDebug('GTK Themer enabled.');
|
||||
}
|
||||
|
||||
disable() {
|
||||
logDebug('Disabling GTK Themer...');
|
||||
this._disconnectTimer();
|
||||
this._disconnectSettings();
|
||||
this._resetOriginalTheme();
|
||||
this._unwatchStatus();
|
||||
logDebug('GTK Themer disabled.');
|
||||
}
|
||||
|
||||
|
||||
_watch_status() {
|
||||
log_debug('Watching GTK variants status...');
|
||||
this._gtk_variants_status_changed_connect = e.settingsManager.connect('gtk-variants-status-changed', this._on_gtk_variants_status_changed.bind(this));
|
||||
}
|
||||
_watchStatus() {
|
||||
logDebug('Watching GTK variants status...');
|
||||
this._gtkVariantsStatusChangedConnect = e.settingsManager.connect('gtk-variants-status-changed', this._onGtkVariantsStatusChanged.bind(this));
|
||||
}
|
||||
|
||||
_unwatch_status() {
|
||||
if ( this._gtk_variants_status_changed_connect ) {
|
||||
e.settingsManager.disconnect(this._gtk_variants_status_changed_connect);
|
||||
this._gtk_variants_status_changed_connect = null;
|
||||
}
|
||||
log_debug('Stopped watching GTK variants status.');
|
||||
}
|
||||
_unwatchStatus() {
|
||||
if (this._gtkVariantsStatusChangedConnect) {
|
||||
e.settingsManager.disconnect(this._gtkVariantsStatusChangedConnect);
|
||||
this._gtkVariantsStatusChangedConnect = null;
|
||||
}
|
||||
logDebug('Stopped watching GTK variants status.');
|
||||
}
|
||||
|
||||
_connect_settings() {
|
||||
log_debug('Connecting GTK Themer to settings...');
|
||||
this._gtk_variant_changed_connect = e.settingsManager.connect('gtk-variant-changed', this._on_gtk_variant_changed.bind(this));
|
||||
this._gtk_theme_changed_connect = e.settingsManager.connect('gtk-theme-changed', this._on_gtk_theme_changed.bind(this));
|
||||
}
|
||||
_connectSettings() {
|
||||
logDebug('Connecting GTK Themer to settings...');
|
||||
this._gtkVariantChangedConnect = e.settingsManager.connect('gtk-variant-changed', this._onGtkVariantChanged.bind(this));
|
||||
this._gtkThemeChangedConnect = e.settingsManager.connect('gtk-theme-changed', this._onGtkThemeChanged.bind(this));
|
||||
}
|
||||
|
||||
_disconnect_settings() {
|
||||
if ( this._gtk_variant_changed_connect ) {
|
||||
e.settingsManager.disconnect(this._gtk_variant_changed_connect);
|
||||
this._gtk_variant_changed_connect = null;
|
||||
}
|
||||
if ( this._gtk_theme_changed_connect ) {
|
||||
e.settingsManager.disconnect(this._gtk_theme_changed_connect);
|
||||
this._gtk_theme_changed_connect = null;
|
||||
}
|
||||
log_debug('Disconnected GTK Themer from settings.');
|
||||
}
|
||||
_disconnectSettings() {
|
||||
if (this._gtkVariantChangedConnect) {
|
||||
e.settingsManager.disconnect(this._gtkVariantChangedConnect);
|
||||
this._gtkVariantChangedConnect = null;
|
||||
}
|
||||
if (this._gtkThemeChangedConnect) {
|
||||
e.settingsManager.disconnect(this._gtkThemeChangedConnect);
|
||||
this._gtkThemeChangedConnect = null;
|
||||
}
|
||||
logDebug('Disconnected GTK Themer from settings.');
|
||||
}
|
||||
|
||||
_connect_timer() {
|
||||
log_debug('Connecting GTK Themer to Timer...');
|
||||
this._time_changed_connect = e.timer.connect('time-changed', this._on_time_changed.bind(this));
|
||||
}
|
||||
_connectTimer() {
|
||||
logDebug('Connecting GTK Themer to Timer...');
|
||||
this._timeChangedConnect = e.timer.connect('time-changed', this._onTimeChanged.bind(this));
|
||||
}
|
||||
|
||||
_disconnect_timer() {
|
||||
if ( this._time_changed_connect ) {
|
||||
e.timer.disconnect(this._time_changed_connect);
|
||||
this._time_changed_connect = null;
|
||||
}
|
||||
log_debug('Disconnected GTK Themer from Timer.');
|
||||
}
|
||||
_disconnectTimer() {
|
||||
if (this._timeChangedConnect) {
|
||||
e.timer.disconnect(this._timeChangedConnect);
|
||||
this._timeChangedConnect = null;
|
||||
}
|
||||
logDebug('Disconnected GTK Themer from Timer.');
|
||||
}
|
||||
|
||||
|
||||
_on_gtk_variants_status_changed(settings, enabled) {
|
||||
this.disable();
|
||||
this.enable();
|
||||
}
|
||||
_onGtkVariantsStatusChanged(_settings, _enabled) {
|
||||
this.disable();
|
||||
this.enable();
|
||||
}
|
||||
|
||||
_on_gtk_variant_changed(settings, changed_variant_time) {
|
||||
if ( changed_variant_time === e.timer.time ) {
|
||||
this._set_variant(changed_variant_time);
|
||||
}
|
||||
}
|
||||
_onGtkVariantChanged(_settings, changedVariantTime) {
|
||||
if (changedVariantTime === e.timer.time)
|
||||
this._setVariant(changedVariantTime);
|
||||
}
|
||||
|
||||
_on_gtk_theme_changed(settings, new_theme) {
|
||||
try {
|
||||
this._update_variants();
|
||||
this._set_variant(e.timer.time);
|
||||
}
|
||||
catch(e) {
|
||||
log_error(e);
|
||||
}
|
||||
}
|
||||
_onGtkThemeChanged(_settings, _newTheme) {
|
||||
try {
|
||||
this._updateVariants();
|
||||
this._setVariant(e.timer.time);
|
||||
} catch (error) {
|
||||
notifyError(error);
|
||||
}
|
||||
}
|
||||
|
||||
_on_time_changed(timer, new_time) {
|
||||
this._set_variant(new_time);
|
||||
}
|
||||
_onTimeChanged(_timer, newTime) {
|
||||
this._setVariant(newTime);
|
||||
}
|
||||
|
||||
|
||||
_are_variants_up_to_date() {
|
||||
return ( e.settingsManager.gtk_theme === e.settingsManager.gtk_variant_day || e.settingsManager.gtk_theme === e.settingsManager.gtk_variant_night );
|
||||
}
|
||||
_areVariantsUpToDate() {
|
||||
return e.settingsManager.gtkTheme === e.settingsManager.gtkVariantDay || e.settingsManager.gtkTheme === e.settingsManager.gtkVariantNight;
|
||||
}
|
||||
|
||||
_set_variant(time) {
|
||||
log_debug(`Setting the GTK ${time} variant...`);
|
||||
switch (time) {
|
||||
case 'day':
|
||||
e.settingsManager.gtk_theme = e.settingsManager.gtk_variant_day;
|
||||
break;
|
||||
case 'night':
|
||||
e.settingsManager.gtk_theme = e.settingsManager.gtk_variant_night;
|
||||
break;
|
||||
case 'original':
|
||||
e.settingsManager.gtk_theme = e.settingsManager.gtk_variant_original;
|
||||
break;
|
||||
}
|
||||
}
|
||||
_setVariant(time) {
|
||||
logDebug(`Setting the GTK ${time} variant...`);
|
||||
switch (time) {
|
||||
case 'day':
|
||||
e.settingsManager.gtkTheme = e.settingsManager.gtkVariantDay;
|
||||
break;
|
||||
case 'night':
|
||||
e.settingsManager.gtkTheme = e.settingsManager.gtkVariantNight;
|
||||
break;
|
||||
case 'original':
|
||||
e.settingsManager.gtkTheme = e.settingsManager.gtkVariantOriginal;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
_update_variants() {
|
||||
if ( e.settingsManager.manual_gtk_variants || this._are_variants_up_to_date() ) {
|
||||
return;
|
||||
}
|
||||
_updateVariants() {
|
||||
if (e.settingsManager.manualGtkVariants || this._areVariantsUpToDate())
|
||||
return;
|
||||
|
||||
log_debug('Updating GTK variants...');
|
||||
const variants = GtkVariants.guess_from(e.settingsManager.gtk_theme);
|
||||
const installed_themes = get_installed_gtk_themes();
|
||||
logDebug('Updating GTK variants...');
|
||||
const variants = GtkVariants.guessFrom(e.settingsManager.gtkTheme);
|
||||
const installedThemes = getInstalledGtkThemes();
|
||||
|
||||
if ( !installed_themes.has(variants.get('day')) || !installed_themes.has(variants.get('night')) ) {
|
||||
e.settingsManager.gtk_variant_original = variants.get('original');
|
||||
const message = _('Unable to automatically detect the day and night variants for the "%s" GTK theme. Please manually choose them in the extension\'s preferences.').format(variants.get('original'));
|
||||
throw new Error(message);
|
||||
}
|
||||
if (!installedThemes.has(variants.get('day')) || !installedThemes.has(variants.get('night'))) {
|
||||
e.settingsManager.gtkVariantOriginal = variants.get('original');
|
||||
const message = _('Unable to automatically detect the day and night variants for the "%s" GTK theme. Please manually choose them in the extension\'s preferences.').format(variants.get('original'));
|
||||
throw new Error(message);
|
||||
}
|
||||
|
||||
e.settingsManager.gtk_variant_day = variants.get('day');
|
||||
e.settingsManager.gtk_variant_night = variants.get('night');
|
||||
e.settingsManager.gtk_variant_original = variants.get('original');
|
||||
log_debug(`New GTK variants. { day: '${variants.get('day')}'; night: '${variants.get('night')}' }`);
|
||||
}
|
||||
e.settingsManager.gtkVariantDay = variants.get('day');
|
||||
e.settingsManager.gtkVariantNight = variants.get('night');
|
||||
e.settingsManager.gtkVariantOriginal = variants.get('original');
|
||||
logDebug(`New GTK variants. { day: '${variants.get('day')}'; night: '${variants.get('night')}' }`);
|
||||
}
|
||||
|
||||
_save_original_theme() {
|
||||
e.settingsManager.gtk_variant_original = e.settingsManager.gtk_theme;
|
||||
}
|
||||
_saveOriginalTheme() {
|
||||
e.settingsManager.gtkVariantOriginal = e.settingsManager.gtkTheme;
|
||||
}
|
||||
|
||||
_reset_original_theme() {
|
||||
// We don't reset the theme when locking the session to prevent
|
||||
// flicker on unlocking
|
||||
if ( !main.screenShield.locked ) {
|
||||
log_debug('Resetting to the user\'s original GTK theme...');
|
||||
this._set_variant('original');
|
||||
}
|
||||
}
|
||||
_resetOriginalTheme() {
|
||||
// We don't reset the theme when locking the session to prevent
|
||||
// flicker on unlocking
|
||||
if (!main.screenShield.locked) {
|
||||
logDebug('Resetting to the user\'s original GTK theme...');
|
||||
this._setVariant('original');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
+63
-77
@@ -21,10 +21,10 @@ this program. If not, see <http s ://www.gnu.org/licenses/>.
|
||||
* The magic of guessing theme variants happens here.
|
||||
*
|
||||
* If the theme doesn't fit a particular case, we'll do the following:
|
||||
* - Remove any signs of a dark variant to the theme name to get the day
|
||||
* variant
|
||||
* - Remove any signs of a light variant to the day variant and add '-dark' to
|
||||
* get the night variant
|
||||
* - Remove any signs of a dark variant to the theme name to get the day
|
||||
* variant
|
||||
* - Remove any signs of a light variant to the day variant and add '-dark' to
|
||||
* get the night variant
|
||||
*
|
||||
* For themes that don't work with the general rule, a particular case must be
|
||||
* written. Day and night variants should be guessed with the most generic light
|
||||
@@ -32,84 +32,70 @@ this program. If not, see <http s ://www.gnu.org/licenses/>.
|
||||
* specific variant.
|
||||
*
|
||||
* Light variants, from the most to the least generic:
|
||||
* - ''
|
||||
* - '-light'
|
||||
* - '-darker'
|
||||
* - ''
|
||||
* - '-light'
|
||||
* - '-darker'
|
||||
*
|
||||
* Dark variants, from the most the least generic:
|
||||
* - '-dark'
|
||||
* - '-darkest'
|
||||
* - '-dark'
|
||||
* - '-darkest'
|
||||
*/
|
||||
var GtkVariants = class {
|
||||
|
||||
static guess_from(name) {
|
||||
const variants = new Map();
|
||||
variants.set('original', name);
|
||||
static guessFrom(name) {
|
||||
const variants = new Map();
|
||||
variants.set('original', name);
|
||||
|
||||
if ( name.includes('Adapta') ) {
|
||||
variants.set('day', name.replace('-Nokto', ''));
|
||||
variants.set('night', variants.get('day').replace('Adapta', 'Adapta-Nokto'));
|
||||
}
|
||||
else if ( name.includes('Arc') ) {
|
||||
const basename = name.split('-')[0];
|
||||
variants.set('day', name.replace(/-Dark(?!er)/, ''));
|
||||
variants.set('night', variants.get('day').replace(/Arc(-Darker)?/, 'Arc-Dark'));
|
||||
}
|
||||
else if ( name.match('Cabinet') ) {
|
||||
variants.set('day', name.replace(/-Dark(?!er)/, '-Light'));
|
||||
variants.set('night', variants.get('day').replace(/(-Light|-Darker)/, '-Dark'))
|
||||
}
|
||||
else if ( name.match(/^(Canta|ChromeOS|Materia|Orchis).*-compact/) ) {
|
||||
variants.set('day', name.replace('-dark', ''));
|
||||
variants.set('night', variants.get('day').replace(/(-light)?-compact/, '-dark-compact'));
|
||||
}
|
||||
else if ( name.includes('Flat-Remix-GTK') ) {
|
||||
const isSolid = name.includes('-Solid');
|
||||
const withoutBorder = name.includes('-NoBorder');
|
||||
const basename = name.split('-').slice(0, 4).join('-');
|
||||
variants.set('day', basename + (name.includes('-Darker') ? '-Darker' : '') + (isSolid ? '-Solid' : ''));
|
||||
variants.set('night', basename + (name.includes('-Darkest') ? '-Darkest' : '-Dark') + (isSolid ? '-Solid' : '') + (withoutBorder ? '-NoBorder' : ''));
|
||||
}
|
||||
else if ( name.includes('HighContrast') ) {
|
||||
variants.set('day', 'HighContrast');
|
||||
variants.set('night', 'HighContrastInverse');
|
||||
}
|
||||
else if ( name.match(/^(Layan|Macwaita|Matcha|Nextwaita)/) ) {
|
||||
const basename = name.split('-')[0];
|
||||
variants.set('day', name.replace('-dark', ''));
|
||||
variants.set('night', variants.get('day').replace(new RegExp(`${basename}(-light)?`), `${basename}-dark`));
|
||||
}
|
||||
else if ( name.includes('Mojave') ) {
|
||||
variants.set('day', name.replace('-dark', '-light'));
|
||||
variants.set('night', variants.get('day').replace('-light', '-dark'));
|
||||
}
|
||||
else if ( name.includes('Plata') ) {
|
||||
variants.set('day', name.replace('-Noir', ''));
|
||||
variants.set('night', variants.get('day').replace(/Plata(-Lumine)?/, 'Plata-Noir'));
|
||||
}
|
||||
else if ( name.match(/^Prof-Gnome-(.+)-3(.*)/) ) {
|
||||
variants.set('day', name.replace(/-Dark(?!er)/, '-Light'));
|
||||
variants.set('night', variants.get('day').replace(/(-Light(-DS)?|-Darker)/, '-Dark'))
|
||||
}
|
||||
else if ( name.includes('Simply_Circles') ) {
|
||||
variants.set('day', name.replace('_Dark', '_Light'));
|
||||
variants.set('night', name.replace('_Light', '_Dark'));
|
||||
}
|
||||
else if ( name.includes('Teja') ) {
|
||||
const dark_variant = '_' + (name.replace('_Light').split('_')[1] || 'Dark');
|
||||
variants.set('day', name.replace(/(_Dark(est)?|_Black)/, ''));
|
||||
variants.set('night', variants.get('day').replace('_Light', '') + dark_variant);
|
||||
}
|
||||
else if ( name.includes('vimix') ) {
|
||||
variants.set('day', name.replace('-dark', ''));
|
||||
variants.set('night', variants.get('day').replace(/vimix(-light)?/, 'vimix-dark'));
|
||||
}
|
||||
else {
|
||||
variants.set('day', name.replace(/-dark(?!er)(est)?/, ''));
|
||||
variants.set('night', variants.get('day').replace(/(-light|-darker)/, '') + (name.includes('-darkest') ? '-darkest' : '-dark'));
|
||||
}
|
||||
if (name.includes('Adapta')) {
|
||||
variants.set('day', name.replace('-Nokto', ''));
|
||||
variants.set('night', variants.get('day').replace('Adapta', 'Adapta-Nokto'));
|
||||
} else if (name.includes('Arc')) {
|
||||
variants.set('day', name.replace(/-Dark(?!er)/, ''));
|
||||
variants.set('night', variants.get('day').replace(/Arc(-Darker)?/, 'Arc-Dark'));
|
||||
} else if (name.match('Cabinet')) {
|
||||
variants.set('day', name.replace(/-Dark(?!er)/, '-Light'));
|
||||
variants.set('night', variants.get('day').replace(/(-Light|-Darker)/, '-Dark'));
|
||||
} else if (name.match(/^(Canta|ChromeOS|Materia|Orchis).*-compact/)) {
|
||||
variants.set('day', name.replace('-dark', ''));
|
||||
variants.set('night', variants.get('day').replace(/(-light)?-compact/, '-dark-compact'));
|
||||
} else if (name.includes('Flat-Remix-GTK')) {
|
||||
const isSolid = name.includes('-Solid');
|
||||
const withoutBorder = name.includes('-NoBorder');
|
||||
const basename = name.split('-').slice(0, 4).join('-');
|
||||
variants.set('day', basename + (name.includes('-Darker') ? '-Darker' : '') + (isSolid ? '-Solid' : ''));
|
||||
variants.set('night', basename + (name.includes('-Darkest') ? '-Darkest' : '-Dark') + (isSolid ? '-Solid' : '') + (withoutBorder ? '-NoBorder' : ''));
|
||||
} else if (name.includes('HighContrast')) {
|
||||
variants.set('day', 'HighContrast');
|
||||
variants.set('night', 'HighContrastInverse');
|
||||
} else if (name.match(/^(Layan|Macwaita|Matcha|Nextwaita)/)) {
|
||||
const basename = name.split('-')[0];
|
||||
variants.set('day', name.replace('-dark', ''));
|
||||
variants.set('night', variants.get('day').replace(new RegExp(`${basename}(-light)?`), `${basename}-dark`));
|
||||
} else if (name.includes('Mojave')) {
|
||||
variants.set('day', name.replace('-dark', '-light'));
|
||||
variants.set('night', variants.get('day').replace('-light', '-dark'));
|
||||
} else if (name.includes('Plata')) {
|
||||
variants.set('day', name.replace('-Noir', ''));
|
||||
variants.set('night', variants.get('day').replace(/Plata(-Lumine)?/, 'Plata-Noir'));
|
||||
} else if (name.match(/^Prof-Gnome-(.+)-3(.*)/)) {
|
||||
variants.set('day', name.replace(/-Dark(?!er)/, '-Light'));
|
||||
variants.set('night', variants.get('day').replace(/(-Light(-DS)?|-Darker)/, '-Dark'));
|
||||
} else if (name.includes('Simply_Circles')) {
|
||||
variants.set('day', name.replace('_Dark', '_Light'));
|
||||
variants.set('night', name.replace('_Light', '_Dark'));
|
||||
} else if (name.includes('Teja')) {
|
||||
const darkVariant = `_${name.replace('_Light').split('_')[1] || 'Dark'}`;
|
||||
variants.set('day', name.replace(/(_Dark(est)?|_Black)/, ''));
|
||||
variants.set('night', variants.get('day').replace('_Light', '') + darkVariant);
|
||||
} else if (name.includes('vimix')) {
|
||||
variants.set('day', name.replace('-dark', ''));
|
||||
variants.set('night', variants.get('day').replace(/vimix(-light)?/, 'vimix-dark'));
|
||||
} else {
|
||||
variants.set('day', name.replace(/-dark(?!er)(est)?/, ''));
|
||||
variants.set('night', variants.get('day').replace(/(-light|-darker)/, '') + (name.includes('-darkest') ? '-darkest' : '-dark'));
|
||||
}
|
||||
|
||||
return variants;
|
||||
}
|
||||
return variants;
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
+111
-105
@@ -22,7 +22,7 @@ const { main } = imports.ui;
|
||||
const Me = extensionUtils.getCurrentExtension();
|
||||
|
||||
const e = Me.imports.extension;
|
||||
const { log_debug } = Me.imports.utils;
|
||||
const { logDebug } = Me.imports.utils;
|
||||
|
||||
|
||||
/**
|
||||
@@ -31,125 +31,131 @@ const { log_debug } = Me.imports.utils;
|
||||
*/
|
||||
var IconThemer = class {
|
||||
|
||||
enable() {
|
||||
log_debug('Enabling Icon Themer...');
|
||||
this._watch_status();
|
||||
this._save_original_theme();
|
||||
if ( e.settingsManager.icon_variants_enabled ) {
|
||||
this._connect_settings();
|
||||
this._connect_timer();
|
||||
}
|
||||
log_debug('Icon Themer enabled.');
|
||||
}
|
||||
constructor() {
|
||||
this._iconVariantsStatusChangedConnect = null;
|
||||
this._iconVariantChangedConnect = null;
|
||||
this._iconThemeChangedConnect = null;
|
||||
this._timeChangedConnect = null;
|
||||
}
|
||||
|
||||
disable() {
|
||||
log_debug('Disabling Icon Themer...');
|
||||
this._disconnect_timer();
|
||||
this._disconnect_settings();
|
||||
this._reset_original_theme();
|
||||
this._unwatch_status();
|
||||
log_debug('Icon Themer disabled.');
|
||||
}
|
||||
enable() {
|
||||
logDebug('Enabling Icon Themer...');
|
||||
this._watchStatus();
|
||||
this._saveOriginalTheme();
|
||||
if (e.settingsManager.iconVariantsEnabled) {
|
||||
this._connectSettings();
|
||||
this._connectTimer();
|
||||
}
|
||||
logDebug('Icon Themer enabled.');
|
||||
}
|
||||
|
||||
disable() {
|
||||
logDebug('Disabling Icon Themer...');
|
||||
this._disconnectTimer();
|
||||
this._disconnectSettings();
|
||||
this._resetOriginalTheme();
|
||||
this._unwatchStatus();
|
||||
logDebug('Icon Themer disabled.');
|
||||
}
|
||||
|
||||
|
||||
_watch_status() {
|
||||
log_debug('Watching icon variants status...');
|
||||
this._icon_variants_status_changed_connect = e.settingsManager.connect('icon-variants-status-changed', this._on_icon_variants_status_changed.bind(this));
|
||||
}
|
||||
_watchStatus() {
|
||||
logDebug('Watching icon variants status...');
|
||||
this._iconVariantsStatusChangedConnect = e.settingsManager.connect('icon-variants-status-changed', this._onIconVariantsStatusChanged.bind(this));
|
||||
}
|
||||
|
||||
_unwatch_status() {
|
||||
if ( this._icon_variants_status_changed_connect ) {
|
||||
e.settingsManager.disconnect(this._icon_variants_status_changed_connect);
|
||||
this._icon_variants_status_changed_connect = null;
|
||||
}
|
||||
log_debug('Stopped watching icon variants status.');
|
||||
}
|
||||
_unwatchStatus() {
|
||||
if (this._iconVariantsStatusChangedConnect) {
|
||||
e.settingsManager.disconnect(this._iconVariantsStatusChangedConnect);
|
||||
this._iconVariantsStatusChangedConnect = null;
|
||||
}
|
||||
logDebug('Stopped watching icon variants status.');
|
||||
}
|
||||
|
||||
_connect_settings() {
|
||||
log_debug('Connecting Icon Themer to settings...');
|
||||
this._icon_variant_changed_connect = e.settingsManager.connect('icon-variant-changed', this._on_icon_variant_changed.bind(this));
|
||||
this._icon_theme_changed_connect = e.settingsManager.connect('icon-theme-changed', this._on_icon_theme_changed.bind(this));
|
||||
}
|
||||
_connectSettings() {
|
||||
logDebug('Connecting Icon Themer to settings...');
|
||||
this._iconVariantChangedConnect = e.settingsManager.connect('icon-variant-changed', this._onIconVariantChanged.bind(this));
|
||||
this._iconThemeChangedConnect = e.settingsManager.connect('icon-theme-changed', this._onIconThemeChanged.bind(this));
|
||||
}
|
||||
|
||||
_disconnect_settings() {
|
||||
if ( this._icon_variant_changed_connect ) {
|
||||
e.settingsManager.disconnect(this._icon_variant_changed_connect);
|
||||
this._icon_variant_changed_connect = null;
|
||||
}
|
||||
if ( this._icon_theme_changed_connect ) {
|
||||
e.settingsManager.disconnect(this._icon_theme_changed_connect);
|
||||
this._icon_theme_changed_connect = null;
|
||||
}
|
||||
log_debug('Disconnected Icon Themer from settings.');
|
||||
}
|
||||
_disconnectSettings() {
|
||||
if (this._iconVariantChangedConnect) {
|
||||
e.settingsManager.disconnect(this._iconVariantChangedConnect);
|
||||
this._iconVariantChangedConnect = null;
|
||||
}
|
||||
if (this._iconThemeChangedConnect) {
|
||||
e.settingsManager.disconnect(this._iconThemeChangedConnect);
|
||||
this._iconThemeChangedConnect = null;
|
||||
}
|
||||
logDebug('Disconnected Icon Themer from settings.');
|
||||
}
|
||||
|
||||
_connect_timer() {
|
||||
log_debug('Connecting Icon Themer to Timer...');
|
||||
this._time_changed_connect = e.timer.connect('time-changed', this._on_time_changed.bind(this));
|
||||
}
|
||||
_connectTimer() {
|
||||
logDebug('Connecting Icon Themer to Timer...');
|
||||
this._timeChangedConnect = e.timer.connect('time-changed', this._onTimeChanged.bind(this));
|
||||
}
|
||||
|
||||
_disconnect_timer() {
|
||||
if ( this._time_changed_connect ) {
|
||||
e.timer.disconnect(this._time_changed_connect);
|
||||
this._time_changed_connect = null;
|
||||
}
|
||||
log_debug('Disconnected Icon Themer from Timer.');
|
||||
}
|
||||
_disconnectTimer() {
|
||||
if (this._timeChangedConnect) {
|
||||
e.timer.disconnect(this._timeChangedConnect);
|
||||
this._timeChangedConnect = null;
|
||||
}
|
||||
logDebug('Disconnected Icon Themer from Timer.');
|
||||
}
|
||||
|
||||
|
||||
_on_icon_variants_status_changed(settings, enabled) {
|
||||
this.disable();
|
||||
this.enable();
|
||||
}
|
||||
_onIconVariantsStatusChanged(_settings, _enabled) {
|
||||
this.disable();
|
||||
this.enable();
|
||||
}
|
||||
|
||||
_on_icon_variant_changed(settings, changed_variant_time) {
|
||||
if ( changed_variant_time === e.timer.time ) {
|
||||
this._set_variant(changed_variant_time);
|
||||
}
|
||||
}
|
||||
_onIconVariantChanged(_settings, changedVariantTime) {
|
||||
if (changedVariantTime === e.timer.time)
|
||||
this._setVariant(changedVariantTime);
|
||||
}
|
||||
|
||||
_on_icon_theme_changed(settings, new_theme) {
|
||||
switch (e.timer.time) {
|
||||
case 'day':
|
||||
e.settingsManager.icon_variant_day = new_theme;
|
||||
break;
|
||||
case 'night':
|
||||
e.settingsManager.icon_variant_night = new_theme;
|
||||
}
|
||||
this._set_variant(e.timer.time);
|
||||
}
|
||||
_onIconThemeChanged(_settings, newTheme) {
|
||||
switch (e.timer.time) {
|
||||
case 'day':
|
||||
e.settingsManager.iconVariantDay = newTheme;
|
||||
break;
|
||||
case 'night':
|
||||
e.settingsManager.iconVariantNight = newTheme;
|
||||
}
|
||||
this._setVariant(e.timer.time);
|
||||
}
|
||||
|
||||
_on_time_changed(timer, new_time) {
|
||||
this._set_variant(new_time);
|
||||
}
|
||||
_onTimeChanged(_timer, newTime) {
|
||||
this._setVariant(newTime);
|
||||
}
|
||||
|
||||
|
||||
_set_variant(time) {
|
||||
log_debug(`Setting the icon ${time} variant...`);
|
||||
switch (time) {
|
||||
case 'day':
|
||||
e.settingsManager.icon_theme = e.settingsManager.icon_variant_day;
|
||||
break;
|
||||
case 'night':
|
||||
e.settingsManager.icon_theme = e.settingsManager.icon_variant_night;
|
||||
break;
|
||||
case 'original':
|
||||
e.settingsManager.icon_theme = e.settingsManager.icon_variant_original;
|
||||
break;
|
||||
}
|
||||
}
|
||||
_setVariant(time) {
|
||||
logDebug(`Setting the icon ${time} variant...`);
|
||||
switch (time) {
|
||||
case 'day':
|
||||
e.settingsManager.iconTheme = e.settingsManager.iconVariantDay;
|
||||
break;
|
||||
case 'night':
|
||||
e.settingsManager.iconTheme = e.settingsManager.iconVariantNight;
|
||||
break;
|
||||
case 'original':
|
||||
e.settingsManager.iconTheme = e.settingsManager.iconVariantOriginal;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
_save_original_theme() {
|
||||
e.settingsManager.icon_variant_original = e.settingsManager.icon_theme;
|
||||
}
|
||||
_saveOriginalTheme() {
|
||||
e.settingsManager.iconVariantOriginal = e.settingsManager.iconTheme;
|
||||
}
|
||||
|
||||
_reset_original_theme() {
|
||||
// We don't reset the theme when locking the session to prevent
|
||||
// flicker on unlocking
|
||||
if ( !main.screenShield.locked ) {
|
||||
log_debug('Resetting to the user\'s original icon theme...');
|
||||
this._set_variant('original');
|
||||
}
|
||||
}
|
||||
_resetOriginalTheme() {
|
||||
// We don't reset the theme when locking the session to prevent
|
||||
// flicker on unlocking
|
||||
if (!main.screenShield.locked) {
|
||||
logDebug('Resetting to the user\'s original icon theme...');
|
||||
this._setVariant('original');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
+497
-508
File diff suppressed because it is too large
Load Diff
+140
-138
@@ -23,7 +23,7 @@ const { main } = imports.ui;
|
||||
const Me = extensionUtils.getCurrentExtension();
|
||||
|
||||
const e = Me.imports.extension;
|
||||
const { log_debug, log_error, get_installed_shell_themes, get_shell_theme_stylesheet, apply_shell_stylesheet } = Me.imports.utils;
|
||||
const { logDebug, notifyError, getInstalledShellThemes, getShellThemeStylesheet, applyShellStylesheet } = Me.imports.utils;
|
||||
const { ShellVariants } = Me.imports.modules.ShellVariants;
|
||||
|
||||
const Gettext = imports.gettext.domain(Me.metadata.uuid);
|
||||
@@ -42,164 +42,166 @@ const _ = Gettext.gettext;
|
||||
*/
|
||||
var ShellThemer = class {
|
||||
|
||||
enable() {
|
||||
log_debug('Enabling Shell Themer...');
|
||||
try {
|
||||
this._watch_status();
|
||||
this._save_original_theme();
|
||||
if ( e.settingsManager.shell_variants_enabled ) {
|
||||
this._update_variants();
|
||||
this._connect_settings();
|
||||
this._connect_timer();
|
||||
}
|
||||
}
|
||||
catch(e) {
|
||||
log_error(e);
|
||||
}
|
||||
log_debug('Shell Themer enabled.');
|
||||
}
|
||||
constructor() {
|
||||
this._shellVariantsStatusChangedConnect = null;
|
||||
this._shellVariantChangedConnect = null;
|
||||
this._shellThemeChangedConnect = null;
|
||||
this._timeChangedConnect = null;
|
||||
}
|
||||
|
||||
disable() {
|
||||
log_debug('Disabling Shell Themer...');
|
||||
this._disconnect_timer();
|
||||
this._disconnect_settings();
|
||||
this._reset_original_theme();
|
||||
this._unwatch_status();
|
||||
log_debug('Shell Themer disabled.');
|
||||
}
|
||||
enable() {
|
||||
logDebug('Enabling Shell Themer...');
|
||||
try {
|
||||
this._watchStatus();
|
||||
this._saveOriginalTheme();
|
||||
if (e.settingsManager.shellVariantsEnabled) {
|
||||
this._updateVariants();
|
||||
this._connectSettings();
|
||||
this._connectTimer();
|
||||
}
|
||||
} catch (error) {
|
||||
notifyError(error);
|
||||
}
|
||||
logDebug('Shell Themer enabled.');
|
||||
}
|
||||
|
||||
disable() {
|
||||
logDebug('Disabling Shell Themer...');
|
||||
this._disconnectTimer();
|
||||
this._disconnectSettings();
|
||||
this._resetOriginalTheme();
|
||||
this._unwatchStatus();
|
||||
logDebug('Shell Themer disabled.');
|
||||
}
|
||||
|
||||
|
||||
_watch_status() {
|
||||
log_debug('Watching shell variants status...');
|
||||
this._shell_variants_status_changed_connect = e.settingsManager.connect('shell-variants-status-changed', this._on_shell_variants_status_changed.bind(this));
|
||||
}
|
||||
_watchStatus() {
|
||||
logDebug('Watching shell variants status...');
|
||||
this._shellVariantsStatusChangedConnect = e.settingsManager.connect('shell-variants-status-changed', this._onShellVariantsStatusChanged.bind(this));
|
||||
}
|
||||
|
||||
_unwatch_status() {
|
||||
if ( this._shell_variants_status_changed_connect ) {
|
||||
e.settingsManager.disconnect(this._shell_variants_status_changed_connect);
|
||||
this._shell_variants_status_changed_connect = null;
|
||||
}
|
||||
log_debug('Stopped watching shell variants status.');
|
||||
}
|
||||
_unwatchStatus() {
|
||||
if (this._shellVariantsStatusChangedConnect) {
|
||||
e.settingsManager.disconnect(this._shellVariantsStatusChangedConnect);
|
||||
this._shellVariantsStatusChangedConnect = null;
|
||||
}
|
||||
logDebug('Stopped watching shell variants status.');
|
||||
}
|
||||
|
||||
_connect_settings() {
|
||||
log_debug('Connecting Shell Themer to settings...');
|
||||
this._shell_variant_changed_connect = e.settingsManager.connect('shell-variant-changed', this._on_shell_variant_changed.bind(this));
|
||||
this._shell_theme_changed_connect = e.settingsManager.connect('shell-theme-changed', this._on_shell_theme_changed.bind(this));
|
||||
}
|
||||
_connectSettings() {
|
||||
logDebug('Connecting Shell Themer to settings...');
|
||||
this._shellVariantChangedConnect = e.settingsManager.connect('shell-variant-changed', this._onShellVariantChanged.bind(this));
|
||||
this._shellThemeChangedConnect = e.settingsManager.connect('shell-theme-changed', this._onShellThemeChanged.bind(this));
|
||||
}
|
||||
|
||||
_disconnect_settings() {
|
||||
if ( this._shell_variant_changed_connect ) {
|
||||
e.settingsManager.disconnect(this._shell_variant_changed_connect);
|
||||
this._shell_variant_changed_connect = null;
|
||||
}
|
||||
if ( this._shell_theme_changed_connect ) {
|
||||
e.settingsManager.disconnect(this._shell_theme_changed_connect);
|
||||
this._shell_theme_changed_connect = null;
|
||||
}
|
||||
log_debug('Disconnected Shell Themer from settings.');
|
||||
}
|
||||
_disconnectSettings() {
|
||||
if (this._shellVariantChangedConnect) {
|
||||
e.settingsManager.disconnect(this._shellVariantChangedConnect);
|
||||
this._shellVariantChangedConnect = null;
|
||||
}
|
||||
if (this._shellThemeChangedConnect) {
|
||||
e.settingsManager.disconnect(this._shellThemeChangedConnect);
|
||||
this._shellThemeChangedConnect = null;
|
||||
}
|
||||
logDebug('Disconnected Shell Themer from settings.');
|
||||
}
|
||||
|
||||
_connect_timer() {
|
||||
log_debug('Connecting Shell Themer to Timer...');
|
||||
this._time_changed_connect = e.timer.connect('time-changed', this._on_time_changed.bind(this));
|
||||
}
|
||||
_connectTimer() {
|
||||
logDebug('Connecting Shell Themer to Timer...');
|
||||
this._timeChangedConnect = e.timer.connect('time-changed', this._onTimeChanged.bind(this));
|
||||
}
|
||||
|
||||
_disconnect_timer() {
|
||||
if ( this._time_changed_connect ) {
|
||||
e.timer.disconnect(this._time_changed_connect);
|
||||
this._time_changed_connect = null;
|
||||
}
|
||||
log_debug('Disconnected Shell Themer from Timer.');
|
||||
}
|
||||
_disconnectTimer() {
|
||||
if (this._timeChangedConnect) {
|
||||
e.timer.disconnect(this._timeChangedConnect);
|
||||
this._timeChangedConnect = null;
|
||||
}
|
||||
logDebug('Disconnected Shell Themer from Timer.');
|
||||
}
|
||||
|
||||
|
||||
_on_shell_variants_status_changed(settings, enabled) {
|
||||
this.disable();
|
||||
this.enable();
|
||||
}
|
||||
_onShellVariantsStatusChanged(_settings, _enabled) {
|
||||
this.disable();
|
||||
this.enable();
|
||||
}
|
||||
|
||||
_on_shell_variant_changed(settings, changed_variant_time) {
|
||||
if ( changed_variant_time === e.timer.time ) {
|
||||
this._set_variant(e.timer.time);
|
||||
}
|
||||
}
|
||||
_onShellVariantChanged(_settings, changedVariantTime) {
|
||||
if (changedVariantTime === e.timer.time)
|
||||
this._setVariant(e.timer.time);
|
||||
}
|
||||
|
||||
_on_shell_theme_changed(settings, new_theme) {
|
||||
try {
|
||||
this._update_variants();
|
||||
this._set_variant(e.timer.time);
|
||||
}
|
||||
catch(e) {
|
||||
log_error(e);
|
||||
}
|
||||
}
|
||||
_onShellThemeChanged(_settings, _newTheme) {
|
||||
try {
|
||||
this._updateVariants();
|
||||
this._setVariant(e.timer.time);
|
||||
} catch (error) {
|
||||
notifyError(error);
|
||||
}
|
||||
}
|
||||
|
||||
_on_time_changed(timer, new_time) {
|
||||
this._set_variant(new_time);
|
||||
}
|
||||
_onTimeChanged(_timer, newTime) {
|
||||
this._setVariant(newTime);
|
||||
}
|
||||
|
||||
|
||||
_are_variants_up_to_date() {
|
||||
return ( e.settingsManager.shell_theme === e.settingsManager.shell_variant_day || e.settingsManager.shell_theme === e.settingsManager.shell_variant_night );
|
||||
}
|
||||
_areVariantsUpToDate() {
|
||||
return e.settingsManager.shellTheme === e.settingsManager.shellVariantDay || e.settingsManager.shellTheme === e.settingsManager.shellVariantNight;
|
||||
}
|
||||
|
||||
_set_variant(time) {
|
||||
log_debug(`Setting the shell ${time} variant...`);
|
||||
let shell_theme;
|
||||
switch (time) {
|
||||
case 'day':
|
||||
shell_theme = e.settingsManager.shell_variant_day;
|
||||
break;
|
||||
case 'night':
|
||||
shell_theme = e.settingsManager.shell_variant_night;
|
||||
break;
|
||||
case 'original':
|
||||
shell_theme = e.settingsManager.shell_variant_original;
|
||||
break;
|
||||
}
|
||||
if ( e.settingsManager.use_userthemes ) {
|
||||
e.settingsManager.shell_theme = shell_theme;
|
||||
}
|
||||
else {
|
||||
const stylesheet = get_shell_theme_stylesheet(shell_theme);
|
||||
apply_shell_stylesheet(stylesheet);
|
||||
}
|
||||
}
|
||||
_setVariant(time) {
|
||||
logDebug(`Setting the shell ${time} variant...`);
|
||||
let shellTheme;
|
||||
switch (time) {
|
||||
case 'day':
|
||||
shellTheme = e.settingsManager.shellVariantDay;
|
||||
break;
|
||||
case 'night':
|
||||
shellTheme = e.settingsManager.shellVariantNight;
|
||||
break;
|
||||
case 'original':
|
||||
shellTheme = e.settingsManager.shellVariantOriginal;
|
||||
break;
|
||||
}
|
||||
if (e.settingsManager.useUserthemes) {
|
||||
e.settingsManager.shellTheme = shellTheme;
|
||||
} else {
|
||||
const stylesheet = getShellThemeStylesheet(shellTheme);
|
||||
applyShellStylesheet(stylesheet);
|
||||
}
|
||||
}
|
||||
|
||||
_update_variants() {
|
||||
if ( !e.settingsManager.use_userthemes || e.settingsManager.manual_shell_variants || this._are_variants_up_to_date() ) {
|
||||
return;
|
||||
}
|
||||
_updateVariants() {
|
||||
if (!e.settingsManager.useUserthemes || e.settingsManager.manualShellVariants || this._areVariantsUpToDate())
|
||||
return;
|
||||
|
||||
log_debug('Updating Shell variants...');
|
||||
const variants = ShellVariants.guess_from(e.settingsManager.shell_theme);
|
||||
const installed_themes = get_installed_shell_themes();
|
||||
logDebug('Updating Shell variants...');
|
||||
const variants = ShellVariants.guessFrom(e.settingsManager.shellTheme);
|
||||
const installedThemes = getInstalledShellThemes();
|
||||
|
||||
if ( !installed_themes.has(variants.get('day')) || !installed_themes.has(variants.get('night')) ) {
|
||||
e.settingsManager.shell_variant_original = variants.get('original');
|
||||
const message = _('Unable to automatically detect the day and night variants for the "%s" GNOME Shell theme. Please manually choose them in the extension\'s preferences.').format(variants.get('original'));
|
||||
throw new Error(message);
|
||||
}
|
||||
if (!installedThemes.has(variants.get('day')) || !installedThemes.has(variants.get('night'))) {
|
||||
e.settingsManager.shellVariantOriginal = variants.get('original');
|
||||
const message = _('Unable to automatically detect the day and night variants for the "%s" GNOME Shell theme. Please manually choose them in the extension\'s preferences.').format(variants.get('original'));
|
||||
throw new Error(message);
|
||||
}
|
||||
|
||||
e.settingsManager.shell_variant_day = variants.get('day');
|
||||
e.settingsManager.shell_variant_night = variants.get('night');
|
||||
e.settingsManager.shell_variant_original = variants.get('original');
|
||||
log_debug(`New Shell variants. { day: '${variants.get('day')}'; night: '${variants.get('night')}' }`);
|
||||
}
|
||||
e.settingsManager.shellVariantDay = variants.get('day');
|
||||
e.settingsManager.shellVariantNight = variants.get('night');
|
||||
e.settingsManager.shellVariantOriginal = variants.get('original');
|
||||
logDebug(`New Shell variants. { day: '${variants.get('day')}'; night: '${variants.get('night')}' }`);
|
||||
}
|
||||
|
||||
_save_original_theme() {
|
||||
e.settingsManager.shell_variant_original = e.settingsManager.shell_theme;
|
||||
}
|
||||
_saveOriginalTheme() {
|
||||
e.settingsManager.shellVariantOriginal = e.settingsManager.shellTheme;
|
||||
}
|
||||
|
||||
_reset_original_theme() {
|
||||
// We don't reset the theme when locking the session to prevent
|
||||
// flicker on unlocking
|
||||
if ( !main.screenShield.locked ) {
|
||||
log_debug('Resetting to the user\'s original Shell theme...');
|
||||
this._set_variant('original');
|
||||
}
|
||||
}
|
||||
_resetOriginalTheme() {
|
||||
// We don't reset the theme when locking the session to prevent
|
||||
// flicker on unlocking
|
||||
if (!main.screenShield.locked) {
|
||||
logDebug('Resetting to the user\'s original Shell theme...');
|
||||
this._setVariant('original');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
Signals.addSignalMethods(ShellThemer.prototype);
|
||||
|
||||
@@ -17,15 +17,14 @@ You should have received a copy of the GNU General Public License along with
|
||||
this program. If not, see <http s ://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* The magic of guessing theme variants happens here.
|
||||
*
|
||||
* If the theme doesn't fit a particular case, we'll do the following:
|
||||
* - Remove any signs of a dark variant to the theme name to get the day
|
||||
* variant
|
||||
* - Remove any signs of a light variant to the day variant and add '-dark' to
|
||||
* get the night variant
|
||||
* - Remove any signs of a dark variant to the theme name to get the day
|
||||
* variant
|
||||
* - Remove any signs of a light variant to the day variant and add '-dark' to
|
||||
* get the night variant
|
||||
*
|
||||
* For themes that don't work with the general rule, a particular case must be
|
||||
* written. Day and night variants should be guessed with the most generic light
|
||||
@@ -33,75 +32,64 @@ this program. If not, see <http s ://www.gnu.org/licenses/>.
|
||||
* specific variant.
|
||||
*
|
||||
* Light variants, from the most to the least generic:
|
||||
* - ''
|
||||
* - '-light'
|
||||
* - '-darker'
|
||||
* - ''
|
||||
* - '-light'
|
||||
* - '-darker'
|
||||
*
|
||||
* Dark variants, from the most the least generic:
|
||||
* - '-dark'
|
||||
* - '-darkest'
|
||||
* - '-dark'
|
||||
* - '-darkest'
|
||||
*/
|
||||
var ShellVariants = class {
|
||||
|
||||
static guess_from(name) {
|
||||
const variants = new Map();
|
||||
variants.set('original', name);
|
||||
static guessFrom(name) {
|
||||
const variants = new Map();
|
||||
variants.set('original', name);
|
||||
|
||||
if ( name === '' ) {
|
||||
variants.set('day', '');
|
||||
variants.set('night', '');
|
||||
}
|
||||
else if ( name.includes('Adapta') ) {
|
||||
variants.set('day', name.replace('-Nokto', ''));
|
||||
variants.set('night', variants.get('day').replace('Adapta', 'Adapta-Nokto'));
|
||||
}
|
||||
else if ( name.includes('Arc') ) {
|
||||
variants.set('day', name.replace('-Dark', ''));
|
||||
variants.set('night', variants.get('day').replace('Arc', 'Arc-Dark'));
|
||||
}
|
||||
else if ( name.match(/^(Canta|ChromeOS|Materia|Orchis).*-compact/) ) {
|
||||
variants.set('day', name.replace('-dark', ''));
|
||||
variants.set('night', variants.get('day').replace(/(-light)?-compact/, '-dark-compact'));
|
||||
}
|
||||
else if ( name.includes('Flat-Remix') ) {
|
||||
const color = ( name.split('-')[2] && !['Dark', 'Darkest', 'fullPanel'].includes(name.split('-')[2]) ) ? '-' + name.split('-')[2] : '';
|
||||
const dark_variant = name.includes('Darkest') ? '-Darkest' : '-Dark';
|
||||
const size = name.includes('fullPanel')? '-fullPanel' : '';
|
||||
variants.set('day', name.replace(/-Dark(est)?/, ''));
|
||||
variants.set('night', `Flat-Remix${color}${dark_variant}${size}`);
|
||||
}
|
||||
else if ( name.match(/^(Layan|Matcha)/) ) {
|
||||
const basename = name.split('-')[0];
|
||||
variants.set('day', name.replace('-dark', ''));
|
||||
variants.set('night', variants.get('day').replace(new RegExp(`${basename}(-light)?`), `${basename}-dark`));
|
||||
}
|
||||
else if ( name.includes('Mojave') ) {
|
||||
variants.set('day', name.replace('-dark', '-light'));
|
||||
variants.set('night', variants.get('day').replace('-light', '-dark'));
|
||||
}
|
||||
else if ( name.includes('Plata') ) {
|
||||
variants.set('day', name.replace('-Noir', ''));
|
||||
variants.set('night', variants.get('day').replace(/Plata(-Lumine)?/, 'Plata-Noir'));
|
||||
}
|
||||
else if ( name.includes('Simply_Circles') ) {
|
||||
variants.set('day', name.replace('_Dark', '_Light'));
|
||||
variants.set('night', name.replace('_Light', '_Dark'));
|
||||
}
|
||||
else if ( name.includes('Teja') ) {
|
||||
const dark_variant = '_' + (name.replace('_Light').split('_')[1] || 'Dark');
|
||||
variants.set('day', name.replace(/(_Dark(est)?|_Black)/, ''));
|
||||
variants.set('night', variants.get('day').replace('_Light', '') + dark_variant);
|
||||
}
|
||||
else if ( name.includes('vimix') ) {
|
||||
variants.set('day', name.replace('-dark', ''));
|
||||
variants.set('night', variants.get('day').replace(/vimix(-light)?/, 'vimix-dark'));
|
||||
}
|
||||
else {
|
||||
variants.set('day', name.replace(/-dark(?!er)(est)?/, ''));
|
||||
variants.set('night', variants.get('day').replace(/(-light|-darker)/, '') + (name.includes('-darkest') ? '-darkest' : '-dark'));
|
||||
}
|
||||
if (name === '') {
|
||||
variants.set('day', '');
|
||||
variants.set('night', '');
|
||||
} else if (name.includes('Adapta')) {
|
||||
variants.set('day', name.replace('-Nokto', ''));
|
||||
variants.set('night', variants.get('day').replace('Adapta', 'Adapta-Nokto'));
|
||||
} else if (name.includes('Arc')) {
|
||||
variants.set('day', name.replace('-Dark', ''));
|
||||
variants.set('night', variants.get('day').replace('Arc', 'Arc-Dark'));
|
||||
} else if (name.match(/^(Canta|ChromeOS|Materia|Orchis).*-compact/)) {
|
||||
variants.set('day', name.replace('-dark', ''));
|
||||
variants.set('night', variants.get('day').replace(/(-light)?-compact/, '-dark-compact'));
|
||||
} else if (name.includes('Flat-Remix')) {
|
||||
const color = name.split('-')[2] && !['Dark', 'Darkest', 'fullPanel'].includes(name.split('-')[2]) ? `-${name.split('-')[2]}` : '';
|
||||
const darkVariant = name.includes('Darkest') ? '-Darkest' : '-Dark';
|
||||
const size = name.includes('fullPanel') ? '-fullPanel' : '';
|
||||
variants.set('day', name.replace(/-Dark(est)?/, ''));
|
||||
variants.set('night', `Flat-Remix${color}${darkVariant}${size}`);
|
||||
} else if (name.match(/^(Layan|Matcha)/)) {
|
||||
const basename = name.split('-')[0];
|
||||
variants.set('day', name.replace('-dark', ''));
|
||||
variants.set('night', variants.get('day').replace(new RegExp(`${basename}(-light)?`), `${basename}-dark`));
|
||||
} else if (name.includes('Mojave')) {
|
||||
variants.set('day', name.replace('-dark', '-light'));
|
||||
variants.set('night', variants.get('day').replace('-light', '-dark'));
|
||||
} else if (name.includes('Plata')) {
|
||||
variants.set('day', name.replace('-Noir', ''));
|
||||
variants.set('night', variants.get('day').replace(/Plata(-Lumine)?/, 'Plata-Noir'));
|
||||
} else if (name.includes('Simply_Circles')) {
|
||||
variants.set('day', name.replace('_Dark', '_Light'));
|
||||
variants.set('night', name.replace('_Light', '_Dark'));
|
||||
} else if (name.includes('Teja')) {
|
||||
const darkVariant = `_${name.replace('_Light').split('_')[1] || 'Dark'}`;
|
||||
variants.set('day', name.replace(/(_Dark(est)?|_Black)/, ''));
|
||||
variants.set('night', variants.get('day').replace('_Light', '') + darkVariant);
|
||||
} else if (name.includes('vimix')) {
|
||||
variants.set('day', name.replace('-dark', ''));
|
||||
variants.set('night', variants.get('day').replace(/vimix(-light)?/, 'vimix-dark'));
|
||||
} else {
|
||||
variants.set('day', name.replace(/-dark(?!er)(est)?/, ''));
|
||||
variants.set('night', variants.get('day').replace(/(-light|-darker)/, '') + (name.includes('-darkest') ? '-darkest' : '-dark'));
|
||||
}
|
||||
|
||||
return variants;
|
||||
}
|
||||
return variants;
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
+126
-125
@@ -22,7 +22,7 @@ const Signals = imports.signals;
|
||||
const Me = extensionUtils.getCurrentExtension();
|
||||
|
||||
const e = Me.imports.extension;
|
||||
const { log_debug } = Me.imports.utils;
|
||||
const { logDebug } = Me.imports.utils;
|
||||
const { TimerNightlight } = Me.imports.modules.TimerNightlight;
|
||||
const { TimerLocation } = Me.imports.modules.TimerLocation;
|
||||
const { TimerSchedule } = Me.imports.modules.TimerSchedule;
|
||||
@@ -37,156 +37,157 @@ const { TimerOndemand } = Me.imports.modules.TimerOndemand;
|
||||
*
|
||||
* It will try to use one of this three different time sources, in this order of
|
||||
* preference:
|
||||
* - Night Light
|
||||
* - Location Services
|
||||
* - Manual schedule
|
||||
* - Night Light
|
||||
* - Location Services
|
||||
* - Manual schedule
|
||||
*
|
||||
* The user can manually force a specific time source and set the manual
|
||||
* schedule in the extensions's preferences.
|
||||
*/
|
||||
var Timer = class {
|
||||
|
||||
constructor() {
|
||||
this._source = null;
|
||||
this._previous_time = null;
|
||||
}
|
||||
constructor() {
|
||||
this._source = null;
|
||||
this._previousTime = null;
|
||||
this._nightlightStatusChangedConnect = null;
|
||||
this._locationStatusChangedConnect = null;
|
||||
this._manualTimeSourceChangedConnect = null;
|
||||
this._timeSourceChangedConnect = null;
|
||||
this._timeChangedConnect = null;
|
||||
}
|
||||
|
||||
enable() {
|
||||
log_debug('Enabling Timer...');
|
||||
this._connect_settings();
|
||||
this._create_source();
|
||||
this._connect_source();
|
||||
this._enable_source();
|
||||
log_debug('Timer enabled.');
|
||||
}
|
||||
enable() {
|
||||
logDebug('Enabling Timer...');
|
||||
this._connectSettings();
|
||||
this._createSource();
|
||||
this._connectSource();
|
||||
this._enableSource();
|
||||
logDebug('Timer enabled.');
|
||||
}
|
||||
|
||||
disable() {
|
||||
log_debug('Disabling Timer...');
|
||||
this._disconnect_source();
|
||||
this._disable_source();
|
||||
this._disconnect_settings();
|
||||
log_debug('Timer disabled.');
|
||||
}
|
||||
disable() {
|
||||
logDebug('Disabling Timer...');
|
||||
this._disconnectSource();
|
||||
this._disableSource();
|
||||
this._disconnectSettings();
|
||||
logDebug('Timer disabled.');
|
||||
}
|
||||
|
||||
|
||||
get time() {
|
||||
return this._source.time;
|
||||
}
|
||||
get time() {
|
||||
return this._source.time;
|
||||
}
|
||||
|
||||
|
||||
_connect_settings() {
|
||||
log_debug('Connecting Timer to settings...');
|
||||
this._nightlight_status_changed_connect = e.settingsManager.connect('nightlight-status-changed', this._on_source_changed.bind(this));
|
||||
this._location_status_changed_connect = e.settingsManager.connect('location-status-changed', this._on_source_changed.bind(this));
|
||||
this._manual_time_source_changed_connect = e.settingsManager.connect('manual-time-source-changed', this._on_source_changed.bind(this));
|
||||
this._time_source_changed_connect = e.settingsManager.connect('time-source-changed', this._on_time_source_changed.bind(this));
|
||||
}
|
||||
_connectSettings() {
|
||||
logDebug('Connecting Timer to settings...');
|
||||
this._nightlightStatusChangedConnect = e.settingsManager.connect('nightlight-status-changed', this._onSourceChanged.bind(this));
|
||||
this._locationStatusChangedConnect = e.settingsManager.connect('location-status-changed', this._onSourceChanged.bind(this));
|
||||
this._manualTimeSourceChangedConnect = e.settingsManager.connect('manual-time-source-changed', this._onSourceChanged.bind(this));
|
||||
this._timeSourceChangedConnect = e.settingsManager.connect('time-source-changed', this._onTimeSourceChanged.bind(this));
|
||||
}
|
||||
|
||||
_disconnect_settings() {
|
||||
if ( this._nightlight_status_changed_connect ) {
|
||||
e.settingsManager.disconnect(this._nightlight_status_changed_connect);
|
||||
this._nightlight_status_changed_connect = null;
|
||||
}
|
||||
if ( this._location_status_changed_connect ) {
|
||||
e.settingsManager.disconnect(this._location_status_changed_connect);
|
||||
this._location_status_changed_connect = null;
|
||||
}
|
||||
if ( this._manual_time_source_changed_connect ) {
|
||||
e.settingsManager.disconnect(this._manual_time_source_changed_connect);
|
||||
this._manual_time_source_changed_connect = null;
|
||||
}
|
||||
if ( this._time_source_changed_connect ) {
|
||||
e.settingsManager.disconnect(this._time_source_changed_connect);
|
||||
this._time_source_changed_connect = null;
|
||||
}
|
||||
log_debug('Disconnected Timer from settings.');
|
||||
}
|
||||
_disconnectSettings() {
|
||||
if (this._nightlightStatusChangedConnect) {
|
||||
e.settingsManager.disconnect(this._nightlightStatusChangedConnect);
|
||||
this._nightlightStatusChangedConnect = null;
|
||||
}
|
||||
if (this._locationStatusChangedConnect) {
|
||||
e.settingsManager.disconnect(this._locationStatusChangedConnect);
|
||||
this._locationStatusChangedConnect = null;
|
||||
}
|
||||
if (this._manualTimeSourceChangedConnect) {
|
||||
e.settingsManager.disconnect(this._manualTimeSourceChangedConnect);
|
||||
this._manualTimeSourceChangedConnect = null;
|
||||
}
|
||||
if (this._timeSourceChangedConnect) {
|
||||
e.settingsManager.disconnect(this._timeSourceChangedConnect);
|
||||
this._timeSourceChangedConnect = null;
|
||||
}
|
||||
logDebug('Disconnected Timer from settings.');
|
||||
}
|
||||
|
||||
_create_source() {
|
||||
switch ( this._get_source() ) {
|
||||
case 'nightlight':
|
||||
this._source = new TimerNightlight();
|
||||
break;
|
||||
case 'location':
|
||||
this._source = new TimerLocation();
|
||||
break;
|
||||
case 'schedule':
|
||||
this._source = new TimerSchedule();
|
||||
break;
|
||||
case 'ondemand':
|
||||
this._source = new TimerOndemand();
|
||||
break;
|
||||
}
|
||||
}
|
||||
_createSource() {
|
||||
switch (this._getSource()) {
|
||||
case 'nightlight':
|
||||
this._source = new TimerNightlight();
|
||||
break;
|
||||
case 'location':
|
||||
this._source = new TimerLocation();
|
||||
break;
|
||||
case 'schedule':
|
||||
this._source = new TimerSchedule();
|
||||
break;
|
||||
case 'ondemand':
|
||||
this._source = new TimerOndemand();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
_enable_source() {
|
||||
this._source.enable();
|
||||
}
|
||||
_enableSource() {
|
||||
this._source.enable();
|
||||
}
|
||||
|
||||
_disable_source() {
|
||||
if ( this._source ) {
|
||||
this._source.disable();
|
||||
this._source = null;
|
||||
}
|
||||
}
|
||||
_disableSource() {
|
||||
if (this._source) {
|
||||
this._source.disable();
|
||||
this._source = null;
|
||||
}
|
||||
}
|
||||
|
||||
_connect_source() {
|
||||
log_debug('Connecting to time source...');
|
||||
this._time_changed_connect = this._source.connect('time-changed', this._on_time_changed.bind(this));
|
||||
}
|
||||
_connectSource() {
|
||||
logDebug('Connecting to time source...');
|
||||
this._timeChangedConnect = this._source.connect('time-changed', this._onTimeChanged.bind(this));
|
||||
}
|
||||
|
||||
_disconnect_source() {
|
||||
if ( this._time_changed_connect ) {
|
||||
this._source.disconnect(this._time_changed_connect);
|
||||
this._time_changed_connect = null;
|
||||
}
|
||||
log_debug('Disconnected from time source.');
|
||||
}
|
||||
_disconnectSource() {
|
||||
if (this._timeChangedConnect) {
|
||||
this._source.disconnect(this._timeChangedConnect);
|
||||
this._timeChangedConnect = null;
|
||||
}
|
||||
logDebug('Disconnected from time source.');
|
||||
}
|
||||
|
||||
|
||||
_on_source_changed() {
|
||||
this.disable();
|
||||
this.enable();
|
||||
}
|
||||
_onSourceChanged() {
|
||||
this.disable();
|
||||
this.enable();
|
||||
}
|
||||
|
||||
_on_time_source_changed(settings, new_source) {
|
||||
if ( e.settingsManager.manual_time_source ) {
|
||||
this._on_source_changed();
|
||||
}
|
||||
}
|
||||
_onTimeSourceChanged(_settings, _newSource) {
|
||||
if (e.settingsManager.manualTimeSource)
|
||||
this._onSourceChanged();
|
||||
}
|
||||
|
||||
_on_time_changed(source, new_time) {
|
||||
if ( new_time !== this._previous_time) {
|
||||
log_debug(`Time has changed to ${new_time}.`);
|
||||
this.emit('time-changed', new_time);
|
||||
this._previous_time = new_time;
|
||||
}
|
||||
}
|
||||
_onTimeChanged(_source, newTime) {
|
||||
if (newTime !== this._previousTime) {
|
||||
logDebug(`Time has changed to ${newTime}.`);
|
||||
this.emit('time-changed', newTime);
|
||||
this._previousTime = newTime;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
_get_source() {
|
||||
log_debug('Getting time source...');
|
||||
_getSource() {
|
||||
logDebug('Getting time source...');
|
||||
|
||||
if ( e.settingsManager.manual_time_source ) {
|
||||
log_debug(`Time source is forced to ${e.settingsManager.time_source}.`);
|
||||
return e.settingsManager.time_source;
|
||||
}
|
||||
if (e.settingsManager.manualTimeSource) {
|
||||
logDebug(`Time source is forced to ${e.settingsManager.timeSource}.`);
|
||||
return e.settingsManager.timeSource;
|
||||
}
|
||||
|
||||
let source;
|
||||
if ( e.settingsManager.nightlight_enabled ) {
|
||||
source = 'nightlight';
|
||||
}
|
||||
else if ( e.settingsManager.location_enabled ) {
|
||||
source = 'location';
|
||||
}
|
||||
else {
|
||||
source = 'schedule';
|
||||
}
|
||||
let source;
|
||||
if (e.settingsManager.nightlightEnabled)
|
||||
source = 'nightlight';
|
||||
else if (e.settingsManager.locationEnabled)
|
||||
source = 'location';
|
||||
else
|
||||
source = 'schedule';
|
||||
|
||||
log_debug(`Time source is ${source}.`);
|
||||
e.settingsManager.time_source = source;
|
||||
return source;
|
||||
}
|
||||
logDebug(`Time source is ${source}.`);
|
||||
e.settingsManager.timeSource = source;
|
||||
return source;
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
Signals.addSignalMethods(Timer.prototype);
|
||||
|
||||
+238
-233
@@ -23,64 +23,64 @@ const Signals = imports.signals;
|
||||
const Me = extensionUtils.getCurrentExtension();
|
||||
|
||||
const e = Me.imports.extension;
|
||||
const { log_debug } = Me.imports.utils;
|
||||
const { logDebug } = Me.imports.utils;
|
||||
|
||||
|
||||
// GeoClue2 interfaces from https://gitlab.freedesktop.org/geoclue/geoclue/
|
||||
const GEOCLUE_MANAGER_INTERFACE = `
|
||||
<node>
|
||||
<interface name="org.freedesktop.GeoClue2.Manager">
|
||||
<property name="InUse" type="b" access="read"/>
|
||||
<property name="AvailableAccuracyLevel" type="u" access="read"/>
|
||||
<method name="GetClient">
|
||||
<arg name="client" type="o" direction="out"/>
|
||||
</method>
|
||||
<method name="CreateClient">
|
||||
<arg name="client" type="o" direction="out"/>
|
||||
</method>
|
||||
<method name="DeleteClient">
|
||||
<arg name="client" type="o" direction="in"/>
|
||||
</method>
|
||||
<method name="AddAgent">
|
||||
<arg name="id" type="s" direction="in"/>
|
||||
</method>
|
||||
</interface>
|
||||
<interface name="org.freedesktop.GeoClue2.Manager">
|
||||
<property name="InUse" type="b" access="read"/>
|
||||
<property name="AvailableAccuracyLevel" type="u" access="read"/>
|
||||
<method name="GetClient">
|
||||
<arg name="client" type="o" direction="out"/>
|
||||
</method>
|
||||
<method name="CreateClient">
|
||||
<arg name="client" type="o" direction="out"/>
|
||||
</method>
|
||||
<method name="DeleteClient">
|
||||
<arg name="client" type="o" direction="in"/>
|
||||
</method>
|
||||
<method name="AddAgent">
|
||||
<arg name="id" type="s" direction="in"/>
|
||||
</method>
|
||||
</interface>
|
||||
</node>`;
|
||||
|
||||
const GEOCLUE_CLIENT_INTERFACE = `
|
||||
<node>
|
||||
<interface name="org.freedesktop.GeoClue2.Client">
|
||||
<property name="Location" type="o" access="read"/>
|
||||
<property name="DistanceThreshold" type="u" access="readwrite">
|
||||
<annotation name="org.freedesktop.Accounts.DefaultValue" value="0"/>
|
||||
</property>
|
||||
<property name="TimeThreshold" type="u" access="readwrite">
|
||||
<annotation name="org.freedesktop.Accounts.DefaultValue" value="0"/>
|
||||
</property>
|
||||
<property name="DesktopId" type="s" access="readwrite"/>
|
||||
<property name="RequestedAccuracyLevel" type="u" access="readwrite"/>
|
||||
<property name="Active" type="b" access="read"/>
|
||||
<method name="Start"/>
|
||||
<method name="Stop"/>
|
||||
<signal name="LocationUpdated">
|
||||
<arg name="old" type="o"/>
|
||||
<arg name="new" type="o"/>
|
||||
</signal>
|
||||
</interface>
|
||||
<interface name="org.freedesktop.GeoClue2.Client">
|
||||
<property name="Location" type="o" access="read"/>
|
||||
<property name="DistanceThreshold" type="u" access="readwrite">
|
||||
<annotation name="org.freedesktop.Accounts.DefaultValue" value="0"/>
|
||||
</property>
|
||||
<property name="TimeThreshold" type="u" access="readwrite">
|
||||
<annotation name="org.freedesktop.Accounts.DefaultValue" value="0"/>
|
||||
</property>
|
||||
<property name="DesktopId" type="s" access="readwrite"/>
|
||||
<property name="RequestedAccuracyLevel" type="u" access="readwrite"/>
|
||||
<property name="Active" type="b" access="read"/>
|
||||
<method name="Start"/>
|
||||
<method name="Stop"/>
|
||||
<signal name="LocationUpdated">
|
||||
<arg name="old" type="o"/>
|
||||
<arg name="new" type="o"/>
|
||||
</signal>
|
||||
</interface>
|
||||
</node>`;
|
||||
|
||||
const GEOCLUE_LOCATION_INTERFACE = `
|
||||
<node>
|
||||
<interface name="org.freedesktop.GeoClue2.Location">
|
||||
<property name="Latitude" type="d" access="read"/>
|
||||
<property name="Longitude" type="d" access="read"/>
|
||||
<property name="Accuracy" type="d" access="read"/>
|
||||
<property name="Altitude" type="d" access="read"/>
|
||||
<property name="Speed" type="d" access="read"/>
|
||||
<property name="Heading" type="d" access="read"/>
|
||||
<property name="Description" type="s" access="read"/>
|
||||
<property name="Timestamp" type="(tt)" access="read"/>
|
||||
</interface>
|
||||
<interface name="org.freedesktop.GeoClue2.Location">
|
||||
<property name="Latitude" type="d" access="read"/>
|
||||
<property name="Longitude" type="d" access="read"/>
|
||||
<property name="Accuracy" type="d" access="read"/>
|
||||
<property name="Altitude" type="d" access="read"/>
|
||||
<property name="Speed" type="d" access="read"/>
|
||||
<property name="Heading" type="d" access="read"/>
|
||||
<property name="Description" type="s" access="read"/>
|
||||
<property name="Timestamp" type="(tt)" access="read"/>
|
||||
</interface>
|
||||
</node>`;
|
||||
|
||||
|
||||
@@ -99,224 +99,229 @@ const GEOCLUE_LOCATION_INTERFACE = `
|
||||
*/
|
||||
var TimerLocation = class {
|
||||
|
||||
constructor() {
|
||||
this._previously_daytime = null;
|
||||
// Before we have the location suntimes, we'll use the manual schedule
|
||||
// times
|
||||
this._suntimes = new Map([
|
||||
['sunrise', e.settingsManager.schedule_sunrise],
|
||||
['sunset', e.settingsManager.schedule_sunrise]
|
||||
]);
|
||||
}
|
||||
constructor() {
|
||||
this._previouslyDaytime = null;
|
||||
// Before we have the location suntimes, we'll use the manual schedule
|
||||
// times
|
||||
this._suntimes = new Map([
|
||||
['sunrise', e.settingsManager.scheduleSunrise],
|
||||
['sunset', e.settingsManager.scheduleSunrise],
|
||||
]);
|
||||
this._geoclueClient = null;
|
||||
this._geoclueClientDbusProxy = null;
|
||||
this._geoclueManagerDbusProxy = null;
|
||||
this._geoclueLocationDbusProxy = null;
|
||||
this._locationUpdatesConnect = null;
|
||||
this._timeChangeTimer = null;
|
||||
this._regularlyUpdateSuntimesTimer = null;
|
||||
}
|
||||
|
||||
enable() {
|
||||
log_debug('Enabling Location Timer...');
|
||||
this._connect_to_geoclue_dbus_proxy();
|
||||
this._listen_to_location_updates();
|
||||
this._connect_to_geoclue_location_dbus_proxy();
|
||||
this._update_location();
|
||||
this._update_suntimes();
|
||||
this._watch_for_time_change();
|
||||
this._regularly_update_suntimes();
|
||||
log_debug('Location Timer enabled.');
|
||||
}
|
||||
enable() {
|
||||
logDebug('Enabling Location Timer...');
|
||||
this._connectToGeoclueDbusProxy();
|
||||
this._listenToLocationUpdates();
|
||||
this._connectToGeoclueLocationDbusProxy();
|
||||
this._updateLocation();
|
||||
this._updateSuntimes();
|
||||
this._watchForTimeChange();
|
||||
this._regularlyUpdateSuntimes();
|
||||
logDebug('Location Timer enabled.');
|
||||
}
|
||||
|
||||
disable() {
|
||||
log_debug('Disabling Location Timer...');
|
||||
this._stop_regularly_updating_suntimes();
|
||||
this._stop_watching_for_time_change();
|
||||
this._stop_listening_to_location_updates();
|
||||
this._disconnect_from_geoclue_location_dbus_proxy();
|
||||
this._disconnect_from_geoclue_dbus_proxy();
|
||||
log_debug('Location Timer disabled.');
|
||||
}
|
||||
disable() {
|
||||
logDebug('Disabling Location Timer...');
|
||||
this._stopRegularlyUpdatingSuntimes();
|
||||
this._stopWatchingForTimeChange();
|
||||
this._stopListeningToLocationUpdates();
|
||||
this._disconnectFromGeoclueLocationDbusProxy();
|
||||
this._disconnectFromGeoclueDbusProxy();
|
||||
logDebug('Location Timer disabled.');
|
||||
}
|
||||
|
||||
|
||||
get time() {
|
||||
return this._is_daytime() ? 'day' : 'night';
|
||||
}
|
||||
get time() {
|
||||
return this._isDaytime() ? 'day' : 'night';
|
||||
}
|
||||
|
||||
_connect_to_geoclue_dbus_proxy() {
|
||||
log_debug('Connecting to GeoClue manager DBus proxy...');
|
||||
const GeoClueManagerProxy = Gio.DBusProxy.makeProxyWrapper(GEOCLUE_MANAGER_INTERFACE);
|
||||
this._geoclue_manager_dbus_proxy = new GeoClueManagerProxy(
|
||||
Gio.DBus.system,
|
||||
'org.freedesktop.GeoClue2',
|
||||
'/org/freedesktop/GeoClue2/Manager'
|
||||
);
|
||||
log_debug('Connected to GeoClue manager DBus proxy.');
|
||||
_connectToGeoclueDbusProxy() {
|
||||
logDebug('Connecting to GeoClue manager DBus proxy...');
|
||||
const GeoClueManagerProxy = Gio.DBusProxy.makeProxyWrapper(GEOCLUE_MANAGER_INTERFACE);
|
||||
this._geoclueManagerDbusProxy = new GeoClueManagerProxy(
|
||||
Gio.DBus.system,
|
||||
'org.freedesktop.GeoClue2',
|
||||
'/org/freedesktop/GeoClue2/Manager'
|
||||
);
|
||||
logDebug('Connected to GeoClue manager DBus proxy.');
|
||||
|
||||
log_debug('Getting a GeoClue client...');
|
||||
this._geoclue_client = this._geoclue_manager_dbus_proxy.GetClientSync()[0];
|
||||
log_debug(`Got a GeoClue client at ${this._geoclue_client}`);
|
||||
logDebug('Getting a GeoClue client...');
|
||||
this._geoclueClient = this._geoclueManagerDbusProxy.GetClientSync()[0];
|
||||
logDebug(`Got a GeoClue client at ${this._geoclueClient}`);
|
||||
|
||||
log_debug('Connecting to GeoClue client DBus proxy...');
|
||||
const GeoClueClientProxy = Gio.DBusProxy.makeProxyWrapper(GEOCLUE_CLIENT_INTERFACE);
|
||||
this._geoclue_client_dbus_proxy = new GeoClueClientProxy(
|
||||
Gio.DBus.system,
|
||||
'org.freedesktop.GeoClue2',
|
||||
this._geoclue_client
|
||||
);
|
||||
this._geoclue_client_dbus_proxy.DesktopId = Me.metadata.uuid;
|
||||
this._geoclue_client_dbus_proxy.DistanceThreshold = 10000;
|
||||
this._geoclue_client_dbus_proxy.RequestedAccuracyLevel = 4;
|
||||
log_debug('Connected to GeoClue client DBus proxy.');
|
||||
}
|
||||
logDebug('Connecting to GeoClue client DBus proxy...');
|
||||
const GeoClueClientProxy = Gio.DBusProxy.makeProxyWrapper(GEOCLUE_CLIENT_INTERFACE);
|
||||
this._geoclueClientDbusProxy = new GeoClueClientProxy(
|
||||
Gio.DBus.system,
|
||||
'org.freedesktop.GeoClue2',
|
||||
this._geoclueClient
|
||||
);
|
||||
this._geoclueClientDbusProxy.DesktopId = Me.metadata.uuid;
|
||||
this._geoclueClientDbusProxy.DistanceThreshold = 10000;
|
||||
this._geoclueClientDbusProxy.RequestedAccuracyLevel = 4;
|
||||
logDebug('Connected to GeoClue client DBus proxy.');
|
||||
}
|
||||
|
||||
_disconnect_from_geoclue_dbus_proxy() {
|
||||
log_debug('Disconnecting from GeoClue DBus proxy...')
|
||||
this._geoclue_manager_dbus_proxy.DeleteClientSync(this._geoclue_client);
|
||||
this._geoclue_client = null;
|
||||
this._geoclue_client_dbus_proxy = null;
|
||||
this._geoclue_manager_dbus_proxy = null;
|
||||
log_debug('Disconnected from GeoClue DBus proxy.')
|
||||
}
|
||||
_disconnectFromGeoclueDbusProxy() {
|
||||
logDebug('Disconnecting from GeoClue DBus proxy...');
|
||||
this._geoclueManagerDbusProxy.DeleteClientSync(this._geoclueClient);
|
||||
this._geoclueClient = null;
|
||||
this._geoclueClientDbusProxy = null;
|
||||
this._geoclueManagerDbusProxy = null;
|
||||
logDebug('Disconnected from GeoClue DBus proxy.');
|
||||
}
|
||||
|
||||
_listen_to_location_updates() {
|
||||
log_debug('Listening to location updates...');
|
||||
this._location_updates_connect = this._geoclue_client_dbus_proxy.connectSignal('LocationUpdated', this._on_location_updated.bind(this));
|
||||
this._geoclue_client_dbus_proxy.StartSync();
|
||||
}
|
||||
_listenToLocationUpdates() {
|
||||
logDebug('Listening to location updates...');
|
||||
this._locationUpdatesConnect = this._geoclueClientDbusProxy.connectSignal('LocationUpdated', this._onLocationUpdated.bind(this));
|
||||
this._geoclueClientDbusProxy.StartSync();
|
||||
}
|
||||
|
||||
_stop_listening_to_location_updates() {
|
||||
this._geoclue_client_dbus_proxy.disconnectSignal(this._location_updates_connect);
|
||||
this._location_updates_connect = null;
|
||||
this._geoclue_client_dbus_proxy.StopSync();
|
||||
log_debug('Stopped listening to location updates.');
|
||||
}
|
||||
_stopListeningToLocationUpdates() {
|
||||
this._geoclueClientDbusProxy.disconnectSignal(this._locationUpdatesConnect);
|
||||
this._locationUpdatesConnect = null;
|
||||
this._geoclueClientDbusProxy.StopSync();
|
||||
logDebug('Stopped listening to location updates.');
|
||||
}
|
||||
|
||||
_on_location_updated(proxy, sender, [old_location_path, new_location_path]) {
|
||||
log_debug('Location has changed.');
|
||||
this._connect_to_geoclue_location_dbus_proxy(new_location_path);
|
||||
this._update_location();
|
||||
this._update_suntimes();
|
||||
}
|
||||
_onLocationUpdated(_proxy, _sender, [_oldLocationPath, newLocationPath]) {
|
||||
logDebug('Location has changed.');
|
||||
this._connectToGeoclueLocationDbusProxy(newLocationPath);
|
||||
this._updateLocation();
|
||||
this._updateSuntimes();
|
||||
}
|
||||
|
||||
_connect_to_geoclue_location_dbus_proxy(path) {
|
||||
if ( !path ) {
|
||||
path = this._geoclue_client_dbus_proxy.Location;
|
||||
}
|
||||
if ( path !== '/' ) {
|
||||
log_debug('Connecting to GeoClue location DBus proxy...');
|
||||
const GeoClueLocationProxy = Gio.DBusProxy.makeProxyWrapper(GEOCLUE_LOCATION_INTERFACE);
|
||||
this._geoclue_location_dbus_proxy = new GeoClueLocationProxy(
|
||||
Gio.DBus.system,
|
||||
'org.freedesktop.GeoClue2',
|
||||
path
|
||||
);
|
||||
log_debug('Connected to GeoClue location DBus proxy.');
|
||||
}
|
||||
}
|
||||
_connectToGeoclueLocationDbusProxy(path) {
|
||||
if (!path)
|
||||
path = this._geoclueClientDbusProxy.Location;
|
||||
if (path !== '/') {
|
||||
logDebug('Connecting to GeoClue location DBus proxy...');
|
||||
const GeoClueLocationProxy = Gio.DBusProxy.makeProxyWrapper(GEOCLUE_LOCATION_INTERFACE);
|
||||
this._geoclueLocationDbusProxy = new GeoClueLocationProxy(
|
||||
Gio.DBus.system,
|
||||
'org.freedesktop.GeoClue2',
|
||||
path
|
||||
);
|
||||
logDebug('Connected to GeoClue location DBus proxy.');
|
||||
}
|
||||
}
|
||||
|
||||
_disconnect_from_geoclue_location_dbus_proxy() {
|
||||
log_debug('Disconnecting from GeoClue location DBus proxy...');
|
||||
this._geoclue_location_dbus_proxy = null;
|
||||
log_debug('Disconnected from GeoClue location DBus proxy.');
|
||||
}
|
||||
_disconnectFromGeoclueLocationDbusProxy() {
|
||||
logDebug('Disconnecting from GeoClue location DBus proxy...');
|
||||
this._geoclueLocationDbusProxy = null;
|
||||
logDebug('Disconnected from GeoClue location DBus proxy.');
|
||||
}
|
||||
|
||||
_update_location() {
|
||||
if ( this._geoclue_location_dbus_proxy ) {
|
||||
log_debug('Updating location...');
|
||||
const latitude = this._geoclue_location_dbus_proxy.Latitude;
|
||||
const longitude = this._geoclue_location_dbus_proxy.Longitude;
|
||||
_updateLocation() {
|
||||
if (this._geoclueLocationDbusProxy) {
|
||||
logDebug('Updating location...');
|
||||
const latitude = this._geoclueLocationDbusProxy.Latitude;
|
||||
const longitude = this._geoclueLocationDbusProxy.Longitude;
|
||||
|
||||
this.location = new Map([
|
||||
['latitude', latitude],
|
||||
['longitude', longitude]
|
||||
]);
|
||||
log_debug(`Current location: (${latitude};${longitude})`);
|
||||
}
|
||||
}
|
||||
this.location = new Map([
|
||||
['latitude', latitude],
|
||||
['longitude', longitude],
|
||||
]);
|
||||
logDebug(`Current location: (${latitude};${longitude})`);
|
||||
}
|
||||
}
|
||||
|
||||
_update_suntimes() {
|
||||
if ( !this.location ) {
|
||||
return;
|
||||
}
|
||||
_updateSuntimes() {
|
||||
if (!this.location)
|
||||
return;
|
||||
|
||||
log_debug('Updating sun times...');
|
||||
logDebug('Updating sun times...');
|
||||
|
||||
Math.rad = degrees => degrees * Math.PI / 180;
|
||||
Math.deg = radians => radians * 180 / Math.PI;
|
||||
Math.rad = degrees => degrees * Math.PI / 180;
|
||||
Math.deg = radians => radians * 180 / Math.PI;
|
||||
|
||||
// Calculations from https://www.esrl.noaa.gov/gmd/grad/solcalc/calcdetails.html
|
||||
const latitude = this.location.get('latitude');
|
||||
const longitude = this.location.get('longitude');
|
||||
// Calculations from https://www.esrl.noaa.gov/gmd/grad/solcalc/calcdetails.html
|
||||
const latitude = this.location.get('latitude');
|
||||
const longitude = this.location.get('longitude');
|
||||
|
||||
const dt_now = GLib.DateTime.new_now_local();
|
||||
const dt_zero = GLib.DateTime.new_utc(1900, 1, 1, 0, 0, 0);
|
||||
const dtNow = GLib.DateTime.new_now_local();
|
||||
const dtZero = GLib.DateTime.new_utc(1900, 1, 1, 0, 0, 0);
|
||||
|
||||
const time_span = dt_now.difference(dt_zero);
|
||||
const timeSpan = dtNow.difference(dtZero);
|
||||
|
||||
const date = time_span / 1000 / 1000 / 60 / 60 / 24 + 2;
|
||||
const tz_offset = dt_now.get_utc_offset() / 1000 / 1000 / 60 / 60;
|
||||
const time_past_local_midnight = 0;
|
||||
const date = timeSpan / 1000 / 1000 / 60 / 60 / 24 + 2;
|
||||
const tzOffset = dtNow.get_utc_offset() / 1000 / 1000 / 60 / 60;
|
||||
const timePastLocalMidnight = 0;
|
||||
|
||||
const julian_day = date + 2415018.5 + time_past_local_midnight - tz_offset / 24;
|
||||
const julian_century = (julian_day - 2451545) / 36525;
|
||||
const geom_mean_long_sun = (280.46646 + julian_century * (36000.76983 + julian_century * 0.0003032)) % 360;
|
||||
const geom_mean_anom_sun = 357.52911 + julian_century * (35999.05029 - 0.0001537 * julian_century);
|
||||
const eccent_earth_orbit = 0.016708634 - julian_century * (0.000042037 + 0.0000001267 * julian_century);
|
||||
const sun_eq_of_ctr = Math.sin(Math.rad(geom_mean_anom_sun)) * (1.914602 - julian_century * (0.004817 + 0.000014 * julian_century)) + Math.sin(Math.rad(2 * geom_mean_anom_sun)) * (0.019993 - 0.000101 * julian_century) + Math.sin(Math.rad(3 * geom_mean_anom_sun)) * 0.000289;
|
||||
const sun_true_long = geom_mean_long_sun + sun_eq_of_ctr;
|
||||
const sun_app_long = sun_true_long - 0.00569 - 0.00478 * Math.sin(Math.rad(125.04 - 1934.136 * julian_century));
|
||||
const mean_obliq_ecliptic = 23 + (26 + ((21.448 - julian_century * (46.815 + julian_century * (0.00059 - julian_century * 0.001813)))) / 60) / 60;
|
||||
const obliq_corr = mean_obliq_ecliptic + 0.00256 * Math.cos(Math.rad(125.04 - 1934.136 * julian_century));
|
||||
const sun_declin = Math.deg(Math.asin(Math.sin(Math.rad(obliq_corr)) * Math.sin(Math.rad(sun_app_long))));
|
||||
const var_y = Math.tan(Math.rad(obliq_corr / 2)) * Math.tan(Math.rad(obliq_corr / 2));
|
||||
const eq_of_time = 4 * Math.deg(var_y * Math.sin(2 * Math.rad(geom_mean_long_sun)) - 2 * eccent_earth_orbit * Math.sin(Math.rad(geom_mean_anom_sun)) + 4 * eccent_earth_orbit * var_y * Math.sin(Math.rad(geom_mean_anom_sun)) * Math.cos(2 * Math.rad(geom_mean_long_sun)) - 0.5 * var_y * var_y * Math.sin(4 * Math.rad(geom_mean_long_sun)) - 1.25 * eccent_earth_orbit * eccent_earth_orbit * Math.sin(2 * Math.rad(geom_mean_anom_sun)));
|
||||
const ha_sunrise = Math.deg(Math.acos(Math.cos(Math.rad(90.833)) / (Math.cos(Math.rad(latitude)) * Math.cos(Math.rad(sun_declin))) - Math.tan(Math.rad(latitude)) * Math.tan(Math.rad(sun_declin))));
|
||||
const solar_noon = (720 - 4 * longitude - eq_of_time + tz_offset * 60) / 1440;
|
||||
const julianDay = date + 2415018.5 + timePastLocalMidnight - tzOffset / 24;
|
||||
const julianCentury = (julianDay - 2451545) / 36525;
|
||||
const geomMeanLongSun = (280.46646 + julianCentury * (36000.76983 + julianCentury * 0.0003032)) % 360;
|
||||
const geomMeanAnomSun = 357.52911 + julianCentury * (35999.05029 - 0.0001537 * julianCentury);
|
||||
const eccentEarthOrbit = 0.016708634 - julianCentury * (0.000042037 + 0.0000001267 * julianCentury);
|
||||
const sunEqOfCtr = Math.sin(Math.rad(geomMeanAnomSun)) * (1.914602 - julianCentury * (0.004817 + 0.000014 * julianCentury)) + Math.sin(Math.rad(2 * geomMeanAnomSun)) * (0.019993 - 0.000101 * julianCentury) + Math.sin(Math.rad(3 * geomMeanAnomSun)) * 0.000289;
|
||||
const sunTrueLong = geomMeanLongSun + sunEqOfCtr;
|
||||
const sunAppLong = sunTrueLong - 0.00569 - 0.00478 * Math.sin(Math.rad(125.04 - 1934.136 * julianCentury));
|
||||
const meanObliqEcliptic = 23 + (26 + ((21.448 - julianCentury * (46.815 + julianCentury * (0.00059 - julianCentury * 0.001813)))) / 60) / 60;
|
||||
const obliqCorr = meanObliqEcliptic + 0.00256 * Math.cos(Math.rad(125.04 - 1934.136 * julianCentury));
|
||||
const sunDeclin = Math.deg(Math.asin(Math.sin(Math.rad(obliqCorr)) * Math.sin(Math.rad(sunAppLong))));
|
||||
const varY = Math.tan(Math.rad(obliqCorr / 2)) * Math.tan(Math.rad(obliqCorr / 2));
|
||||
const eqOfTime = 4 * Math.deg(varY * Math.sin(2 * Math.rad(geomMeanLongSun)) - 2 * eccentEarthOrbit * Math.sin(Math.rad(geomMeanAnomSun)) + 4 * eccentEarthOrbit * varY * Math.sin(Math.rad(geomMeanAnomSun)) * Math.cos(2 * Math.rad(geomMeanLongSun)) - 0.5 * varY * varY * Math.sin(4 * Math.rad(geomMeanLongSun)) - 1.25 * eccentEarthOrbit * eccentEarthOrbit * Math.sin(2 * Math.rad(geomMeanAnomSun)));
|
||||
const haSunrise = Math.deg(Math.acos(Math.cos(Math.rad(90.833)) / (Math.cos(Math.rad(latitude)) * Math.cos(Math.rad(sunDeclin))) - Math.tan(Math.rad(latitude)) * Math.tan(Math.rad(sunDeclin))));
|
||||
const solarNoon = (720 - 4 * longitude - eqOfTime + tzOffset * 60) / 1440;
|
||||
|
||||
const sunrise_time = solar_noon - ha_sunrise * 4 / 1440;
|
||||
const sunset_time = solar_noon + ha_sunrise * 4 / 1440;
|
||||
const timeSunrise = solarNoon - haSunrise * 4 / 1440;
|
||||
const timeSunset = solarNoon + haSunrise * 4 / 1440;
|
||||
|
||||
const sunrise = sunrise_time * 24;
|
||||
const sunset = sunset_time * 24;
|
||||
const sunrise = timeSunrise * 24;
|
||||
const sunset = timeSunset * 24;
|
||||
|
||||
this._suntimes.set('sunrise', sunrise);
|
||||
this._suntimes.set('sunset', sunset);
|
||||
log_debug(`New sun times: (sunrise: ${sunrise}; sunset: ${sunset})`);
|
||||
}
|
||||
this._suntimes.set('sunrise', sunrise);
|
||||
this._suntimes.set('sunset', sunset);
|
||||
logDebug(`New sun times: (sunrise: ${sunrise}; sunset: ${sunset})`);
|
||||
}
|
||||
|
||||
_regularly_update_suntimes() {
|
||||
log_debug('Regularly updating sun times...');
|
||||
this._regularly_update_suntimes_timer = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, 3600, () => {
|
||||
this._update_suntimes();
|
||||
return true; // Repeat the loop
|
||||
});
|
||||
}
|
||||
_regularlyUpdateSuntimes() {
|
||||
logDebug('Regularly updating sun times...');
|
||||
this._regularlyUpdateSuntimesTimer = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, 3600, () => {
|
||||
this._updateSuntimes();
|
||||
return true; // Repeat the loop
|
||||
});
|
||||
}
|
||||
|
||||
_stop_regularly_updating_suntimes() {
|
||||
GLib.Source.remove(this._regularly_update_suntimes_timer);
|
||||
this._regularly_update_suntimes_timer = null;
|
||||
log_debug('Stopped regularly updating sun times.');
|
||||
}
|
||||
_stopRegularlyUpdatingSuntimes() {
|
||||
GLib.Source.remove(this._regularlyUpdateSuntimesTimer);
|
||||
this._regularlyUpdateSuntimesTimer = null;
|
||||
logDebug('Stopped regularly updating sun times.');
|
||||
}
|
||||
|
||||
_is_daytime() {
|
||||
const time = GLib.DateTime.new_now_local();
|
||||
const hour = time.get_hour() + time.get_minute() / 60 + time.get_second() / 3600;
|
||||
return ( hour >= this._suntimes.get('sunrise') && hour <= this._suntimes.get('sunset') );
|
||||
}
|
||||
_isDaytime() {
|
||||
const time = GLib.DateTime.new_now_local();
|
||||
const hour = time.get_hour() + time.get_minute() / 60 + time.get_second() / 3600;
|
||||
return hour >= this._suntimes.get('sunrise') && hour <= this._suntimes.get('sunset');
|
||||
}
|
||||
|
||||
_watch_for_time_change() {
|
||||
log_debug('Watching for time change...');
|
||||
this._time_change_timer = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, 1, () => {
|
||||
if ( !Me.imports.extension.enabled ) {
|
||||
// The extension doesn't exist anymore, quit the loop
|
||||
return false;
|
||||
}
|
||||
if ( this._previously_daytime !== this._is_daytime() ) {
|
||||
this._previously_daytime = this._is_daytime();
|
||||
this.emit('time-changed', this.time);
|
||||
}
|
||||
return true; // Repeat the loop
|
||||
});
|
||||
}
|
||||
_watchForTimeChange() {
|
||||
logDebug('Watching for time change...');
|
||||
this._timeChangeTimer = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, 1, () => {
|
||||
if (!Me.imports.extension.enabled) {
|
||||
// The extension doesn't exist anymore, quit the loop
|
||||
return false;
|
||||
}
|
||||
if (this._previouslyDaytime !== this._isDaytime()) {
|
||||
this._previouslyDaytime = this._isDaytime();
|
||||
this.emit('time-changed', this.time);
|
||||
}
|
||||
return true; // Repeat the loop
|
||||
});
|
||||
}
|
||||
|
||||
_stop_watching_for_time_change() {
|
||||
GLib.Source.remove(this._time_change_timer);
|
||||
log_debug('Stopped watching for time change.');
|
||||
}
|
||||
_stopWatchingForTimeChange() {
|
||||
GLib.Source.remove(this._timeChangeTimer);
|
||||
logDebug('Stopped watching for time change.');
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
Signals.addSignalMethods(TimerLocation.prototype);
|
||||
|
||||
@@ -16,20 +16,20 @@ You should have received a copy of the GNU General Public License along with
|
||||
this program. If not, see <http s ://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
const { Gio, GLib } = imports.gi;
|
||||
const { Gio } = imports.gi;
|
||||
const { extensionUtils } = imports.misc;
|
||||
const Signals = imports.signals;
|
||||
|
||||
const Me = extensionUtils.getCurrentExtension();
|
||||
|
||||
const { log_debug } = Me.imports.utils;
|
||||
const { logDebug } = Me.imports.utils;
|
||||
|
||||
|
||||
const COLOR_INTERFACE = `
|
||||
<node>
|
||||
<interface name="org.gnome.SettingsDaemon.Color">
|
||||
<property name="NightLightActive" type="b" access="read"/>
|
||||
</interface>
|
||||
<interface name="org.gnome.SettingsDaemon.Color">
|
||||
<property name="NightLightActive" type="b" access="read"/>
|
||||
</interface>
|
||||
</node>`;
|
||||
|
||||
|
||||
@@ -41,68 +41,73 @@ const COLOR_INTERFACE = `
|
||||
*/
|
||||
var TimerNightlight = class {
|
||||
|
||||
enable() {
|
||||
log_debug('Enabling Night Light Timer...');
|
||||
this._connect_to_color_dbus_proxy();
|
||||
this._listen_to_nightlight_state();
|
||||
this.emit('time-changed', this.time);
|
||||
log_debug('Night Light Timer enabled.');
|
||||
}
|
||||
constructor() {
|
||||
this._colorDbusProxy = null;
|
||||
this._nightlightStateConnect = null;
|
||||
}
|
||||
|
||||
disable() {
|
||||
log_debug('Disabling Night Light Timer...');
|
||||
this._stop_listening_to_nightlight_state();
|
||||
this._disconnect_from_color_dbus_proxy();
|
||||
log_debug('Night Light Timer disabled.');
|
||||
}
|
||||
enable() {
|
||||
logDebug('Enabling Night Light Timer...');
|
||||
this._connectToColorDbusProxy();
|
||||
this._listenToNightlightState();
|
||||
this.emit('time-changed', this.time);
|
||||
logDebug('Night Light Timer enabled.');
|
||||
}
|
||||
|
||||
disable() {
|
||||
logDebug('Disabling Night Light Timer...');
|
||||
this._stopListeningToNightlightState();
|
||||
this._disconnectFromColorDbusProxy();
|
||||
logDebug('Night Light Timer disabled.');
|
||||
}
|
||||
|
||||
|
||||
get time() {
|
||||
return this._is_nightlight_active() ? 'night' : 'day';
|
||||
}
|
||||
get time() {
|
||||
return this._isNightlightActive() ? 'night' : 'day';
|
||||
}
|
||||
|
||||
|
||||
_connect_to_color_dbus_proxy() {
|
||||
log_debug('Connecting to Color DBus proxy...');
|
||||
const ColorProxy = Gio.DBusProxy.makeProxyWrapper(COLOR_INTERFACE);
|
||||
this._color_dbus_proxy = new ColorProxy(
|
||||
Gio.DBus.session,
|
||||
'org.gnome.SettingsDaemon.Color',
|
||||
'/org/gnome/SettingsDaemon/Color'
|
||||
);
|
||||
log_debug('Connected to Color DBus proxy.');
|
||||
}
|
||||
_connectToColorDbusProxy() {
|
||||
logDebug('Connecting to Color DBus proxy...');
|
||||
const ColorProxy = Gio.DBusProxy.makeProxyWrapper(COLOR_INTERFACE);
|
||||
this._colorDbusProxy = new ColorProxy(
|
||||
Gio.DBus.session,
|
||||
'org.gnome.SettingsDaemon.Color',
|
||||
'/org/gnome/SettingsDaemon/Color'
|
||||
);
|
||||
logDebug('Connected to Color DBus proxy.');
|
||||
}
|
||||
|
||||
_disconnect_from_color_dbus_proxy() {
|
||||
log_debug('Disconnecting from Color DBus proxy...');
|
||||
this._color_dbus_proxy = null;
|
||||
log_debug('Disconnected from Color DBus proxy.');
|
||||
}
|
||||
_disconnectFromColorDbusProxy() {
|
||||
logDebug('Disconnecting from Color DBus proxy...');
|
||||
this._colorDbusProxy = null;
|
||||
logDebug('Disconnected from Color DBus proxy.');
|
||||
}
|
||||
|
||||
_listen_to_nightlight_state() {
|
||||
log_debug('Listening to Night Light state...');
|
||||
this._nightlight_state_connect = this._color_dbus_proxy.connect(
|
||||
'g-properties-changed',
|
||||
this._on_nightlight_state_changed.bind(this)
|
||||
);
|
||||
}
|
||||
_listenToNightlightState() {
|
||||
logDebug('Listening to Night Light state...');
|
||||
this._nightlightStateConnect = this._colorDbusProxy.connect(
|
||||
'g-properties-changed',
|
||||
this._onNightlightStateChanged.bind(this)
|
||||
);
|
||||
}
|
||||
|
||||
_stop_listening_to_nightlight_state() {
|
||||
this._color_dbus_proxy.disconnect(this._nightlight_state_connect);
|
||||
log_debug('Stopped listening to Night Light state.');
|
||||
}
|
||||
_stopListeningToNightlightState() {
|
||||
this._colorDbusProxy.disconnect(this._nightlightStateConnect);
|
||||
logDebug('Stopped listening to Night Light state.');
|
||||
}
|
||||
|
||||
_on_nightlight_state_changed(sender, dbus_properties) {
|
||||
const properties = dbus_properties.deep_unpack();
|
||||
if ( properties.NightLightActive ) {
|
||||
log_debug('Night Light has become ' + (properties.NightLightActive.unpack() ? '' : 'in') + 'active.');
|
||||
this.emit('time-changed', this.time);
|
||||
}
|
||||
}
|
||||
_onNightlightStateChanged(_sender, dbusProperties) {
|
||||
const properties = dbusProperties.deep_unpack();
|
||||
if (properties.NightLightActive) {
|
||||
logDebug(`Night Light has become ${properties.NightLightActive.unpack() ? '' : 'in'}active.`);
|
||||
this.emit('time-changed', this.time);
|
||||
}
|
||||
}
|
||||
|
||||
_is_nightlight_active() {
|
||||
return this._color_dbus_proxy.NightLightActive;
|
||||
}
|
||||
_isNightlightActive() {
|
||||
return this._colorDbusProxy.NightLightActive;
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
Signals.addSignalMethods(TimerNightlight.prototype);
|
||||
|
||||
@@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with
|
||||
this program. If not, see <http s ://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
const { GLib, Shell, St } = imports.gi;
|
||||
const { Shell, St } = imports.gi;
|
||||
const { extensionUtils } = imports.misc;
|
||||
const Signals = imports.signals;
|
||||
|
||||
@@ -25,8 +25,8 @@ const { main, panelMenu } = imports.ui;
|
||||
const Me = extensionUtils.getCurrentExtension();
|
||||
|
||||
const e = Me.imports.extension;
|
||||
const { log_debug } = Me.imports.utils;
|
||||
const { key_binding_auto_repeat, get_actor } = Me.imports.compat;
|
||||
const { logDebug } = Me.imports.utils;
|
||||
const { keyBindingAutoRepeat, getActor } = Me.imports.compat;
|
||||
|
||||
/**
|
||||
* The On-demand Timer allows the user to manually switch between the day and
|
||||
@@ -36,85 +36,85 @@ const { key_binding_auto_repeat, get_actor } = Me.imports.compat;
|
||||
*/
|
||||
var TimerOndemand = class {
|
||||
|
||||
constructor() {
|
||||
this._button = null;
|
||||
this._icon = null;
|
||||
}
|
||||
constructor() {
|
||||
this._button = null;
|
||||
this._icon = null;
|
||||
}
|
||||
|
||||
enable() {
|
||||
log_debug('Enabling On-demand Timer ...');
|
||||
this._add_keybinding();
|
||||
this._add_button();
|
||||
log_debug('On-demand Timer enabled.');
|
||||
}
|
||||
enable() {
|
||||
logDebug('Enabling On-demand Timer ...');
|
||||
this._addKeybinding();
|
||||
this._addButton();
|
||||
logDebug('On-demand Timer enabled.');
|
||||
}
|
||||
|
||||
disable() {
|
||||
log_debug('Disabling On-demand Timer ...');
|
||||
this._remove_keybinding();
|
||||
this._remove_button();
|
||||
log_debug('On-demand Timer disabled.');
|
||||
}
|
||||
disable() {
|
||||
logDebug('Disabling On-demand Timer ...');
|
||||
this._removeKeybinding();
|
||||
this._removeButton();
|
||||
logDebug('On-demand Timer disabled.');
|
||||
}
|
||||
|
||||
|
||||
get time() {
|
||||
return e.settingsManager.ondemand_time;
|
||||
}
|
||||
get time() {
|
||||
return e.settingsManager.ondemandTime;
|
||||
}
|
||||
|
||||
_add_keybinding() {
|
||||
log_debug('Adding On-demand Timer keybinding...');
|
||||
// add our own keydinging handler
|
||||
main.wm.addKeybinding(
|
||||
'nightthemeswitcher-ondemand-keybinding',
|
||||
e.settingsManager._extensionsSettings,
|
||||
key_binding_auto_repeat(),
|
||||
Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW,
|
||||
this._toggle_time.bind(this)
|
||||
);
|
||||
log_debug('Added On-demand Timer keybinding.');
|
||||
}
|
||||
_addKeybinding() {
|
||||
logDebug('Adding On-demand Timer keybinding...');
|
||||
// add our own keydinging handler
|
||||
main.wm.addKeybinding(
|
||||
'nightthemeswitcher-ondemand-keybinding',
|
||||
e.settingsManager._extensionsSettings,
|
||||
keyBindingAutoRepeat(),
|
||||
Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW,
|
||||
this._toggleTime.bind(this)
|
||||
);
|
||||
logDebug('Added On-demand Timer keybinding.');
|
||||
}
|
||||
|
||||
_remove_keybinding() {
|
||||
log_debug('Removing On-demand Timer keybinding...');
|
||||
main.wm.removeKeybinding('nightthemeswitcher-ondemand-keybinding');
|
||||
log_debug('Removed On-demand Timer keybinding.');
|
||||
}
|
||||
_removeKeybinding() {
|
||||
logDebug('Removing On-demand Timer keybinding...');
|
||||
main.wm.removeKeybinding('nightthemeswitcher-ondemand-keybinding');
|
||||
logDebug('Removed On-demand Timer keybinding.');
|
||||
}
|
||||
|
||||
_add_button() {
|
||||
log_debug('Adding On-demand Timer button...');
|
||||
_addButton() {
|
||||
logDebug('Adding On-demand Timer button...');
|
||||
|
||||
this._icon = new St.Icon({
|
||||
icon_name: this._get_icon_name_for_current_time(),
|
||||
style_class: 'system-status-icon'
|
||||
});
|
||||
this._icon = new St.Icon({
|
||||
icon_name: this._getIconNameForCurrentTime(),
|
||||
style_class: 'system-status-icon',
|
||||
});
|
||||
|
||||
this._button = new panelMenu.Button(0.0);
|
||||
const button_actor = get_actor(this._button);
|
||||
button_actor.add_actor(this._icon);
|
||||
button_actor.connect(
|
||||
'button-press-event',
|
||||
this._toggle_time.bind(this)
|
||||
);
|
||||
main.panel.addToStatusArea('NightThemeSwitcherButton', this._button);
|
||||
this._button = new panelMenu.Button(0.0);
|
||||
const buttonActor = getActor(this._button);
|
||||
buttonActor.add_actor(this._icon);
|
||||
buttonActor.connect(
|
||||
'button-press-event',
|
||||
this._toggleTime.bind(this)
|
||||
);
|
||||
main.panel.addToStatusArea('NightThemeSwitcherButton', this._button);
|
||||
|
||||
log_debug('Added On-demand Timer button.');
|
||||
}
|
||||
logDebug('Added On-demand Timer button.');
|
||||
}
|
||||
|
||||
_remove_button() {
|
||||
log_debug('Removing On-demand Timer button...');
|
||||
this._button.destroy();
|
||||
log_debug('Removed On-demand Timer button.');
|
||||
}
|
||||
_removeButton() {
|
||||
logDebug('Removing On-demand Timer button...');
|
||||
this._button.destroy();
|
||||
logDebug('Removed On-demand Timer button.');
|
||||
}
|
||||
|
||||
_toggle_time() {
|
||||
e.settingsManager.ondemand_time = e.timer.time === 'day' ? 'night' : 'day';
|
||||
this.emit('time-changed', this.time);
|
||||
this._icon.icon_name = this._get_icon_name_for_current_time();
|
||||
_toggleTime() {
|
||||
e.settingsManager.ondemandTime = e.timer.time === 'day' ? 'night' : 'day';
|
||||
this.emit('time-changed', this.time);
|
||||
this._icon.icon_name = this._getIconNameForCurrentTime();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
_get_icon_name_for_current_time() {
|
||||
return e.timer.time === 'day' ? 'weather-clear-symbolic' : 'weather-clear-night-symbolic';
|
||||
}
|
||||
_getIconNameForCurrentTime() {
|
||||
return e.timer.time === 'day' ? 'weather-clear-symbolic' : 'weather-clear-night-symbolic';
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
Signals.addSignalMethods(TimerOndemand.prototype);
|
||||
|
||||
@@ -23,7 +23,7 @@ const Signals = imports.signals;
|
||||
const Me = extensionUtils.getCurrentExtension();
|
||||
|
||||
const e = Me.imports.extension;
|
||||
const { log_debug } = Me.imports.utils;
|
||||
const { logDebug } = Me.imports.utils;
|
||||
|
||||
|
||||
/**
|
||||
@@ -36,53 +36,54 @@ const { log_debug } = Me.imports.utils;
|
||||
*/
|
||||
var TimerSchedule = class {
|
||||
|
||||
constructor() {
|
||||
this._previously_daytime = null;
|
||||
}
|
||||
constructor() {
|
||||
this._previouslyDaytime = null;
|
||||
this._timeChangeTimer = null;
|
||||
}
|
||||
|
||||
enable() {
|
||||
log_debug('Enabling Schedule Timer...');
|
||||
this._watch_for_time_change();
|
||||
log_debug('Schedule Timer enabled.');
|
||||
}
|
||||
enable() {
|
||||
logDebug('Enabling Schedule Timer...');
|
||||
this._watchForTimeChange();
|
||||
logDebug('Schedule Timer enabled.');
|
||||
}
|
||||
|
||||
disable() {
|
||||
log_debug('Disabling Schedule Timer...');
|
||||
this._stop_watching_for_time_change();
|
||||
log_debug('Schedule Timer disabled.');
|
||||
}
|
||||
disable() {
|
||||
logDebug('Disabling Schedule Timer...');
|
||||
this._stopWatchingForTimeChange();
|
||||
logDebug('Schedule Timer disabled.');
|
||||
}
|
||||
|
||||
|
||||
get time() {
|
||||
return this._is_daytime() ? 'day' : 'night';
|
||||
}
|
||||
get time() {
|
||||
return this._isDaytime() ? 'day' : 'night';
|
||||
}
|
||||
|
||||
|
||||
_is_daytime() {
|
||||
const time = GLib.DateTime.new_now_local();
|
||||
const hour = time.get_hour() + time.get_minute() / 60 + time.get_second() / 3600;
|
||||
return ( hour >= e.settingsManager.schedule_sunrise && hour <= e.settingsManager.schedule_sunset );
|
||||
}
|
||||
_isDaytime() {
|
||||
const time = GLib.DateTime.new_now_local();
|
||||
const hour = time.get_hour() + time.get_minute() / 60 + time.get_second() / 3600;
|
||||
return hour >= e.settingsManager.scheduleSunrise && hour <= e.settingsManager.scheduleSunset;
|
||||
}
|
||||
|
||||
_watch_for_time_change() {
|
||||
log_debug('Watching for time change...');
|
||||
this._time_change_timer = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, 1, () => {
|
||||
if ( !Me.imports.extension.enabled ) {
|
||||
// The extension doesn't exist anymore, quit the loop
|
||||
return false;
|
||||
}
|
||||
if ( this._previously_daytime !== this._is_daytime() ) {
|
||||
this._previously_daytime = this._is_daytime();
|
||||
this.emit('time-changed', this.time);
|
||||
}
|
||||
return true; // Repeat the loop
|
||||
});
|
||||
}
|
||||
_watchForTimeChange() {
|
||||
logDebug('Watching for time change...');
|
||||
this._timeChangeTimer = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, 1, () => {
|
||||
if (!Me.imports.extension.enabled) {
|
||||
// The extension doesn't exist anymore, quit the loop
|
||||
return false;
|
||||
}
|
||||
if (this._previouslyDaytime !== this._isDaytime()) {
|
||||
this._previouslyDaytime = this._isDaytime();
|
||||
this.emit('time-changed', this.time);
|
||||
}
|
||||
return true; // Repeat the loop
|
||||
});
|
||||
}
|
||||
|
||||
_stop_watching_for_time_change() {
|
||||
GLib.Source.remove(this._time_change_timer);
|
||||
log_debug('Stopped watching for time change.');
|
||||
}
|
||||
_stopWatchingForTimeChange() {
|
||||
GLib.Source.remove(this._timeChangeTimer);
|
||||
logDebug('Stopped watching for time change.');
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
Signals.addSignalMethods(TimerSchedule.prototype);
|
||||
|
||||
@@ -30,89 +30,89 @@ const _ = Gettext.gettext;
|
||||
|
||||
var BackgroundsPreferences = class {
|
||||
|
||||
constructor() {
|
||||
const settings = compat.get_extension_settings();
|
||||
constructor() {
|
||||
const settings = compat.getExtensionSettings();
|
||||
|
||||
const label = _('Backgrounds');
|
||||
const description = _('You can set different backgrounds for day and night.');
|
||||
const content = new SettingsList();
|
||||
const label = _('Backgrounds');
|
||||
const description = _('You can set different backgrounds for day and night.');
|
||||
const content = new SettingsList();
|
||||
|
||||
content.add_row(new SettingsListRow(_('Switch backgrounds'), new BackgroundsEnabledControl()));
|
||||
content.add_row(new SettingsListRow(_('Switch backgrounds'), new BackgroundsEnabledControl()));
|
||||
|
||||
const day_background_row = new SettingsListRow(_('Day background'), new TimeBackgroundControl('day'));
|
||||
settings.bind(
|
||||
'backgrounds-enabled',
|
||||
day_background_row,
|
||||
'sensitive',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
content.add_row(day_background_row);
|
||||
const dayBackgroundRow = new SettingsListRow(_('Day background'), new TimeBackgroundControl('day'));
|
||||
settings.bind(
|
||||
'backgrounds-enabled',
|
||||
dayBackgroundRow,
|
||||
'sensitive',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
content.add_row(dayBackgroundRow);
|
||||
|
||||
const night_background_row = new SettingsListRow(_('Night background'), new TimeBackgroundControl('night'));
|
||||
settings.bind(
|
||||
'backgrounds-enabled',
|
||||
night_background_row,
|
||||
'sensitive',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
content.add_row(night_background_row);
|
||||
const nightBackgroundRow = new SettingsListRow(_('Night background'), new TimeBackgroundControl('night'));
|
||||
settings.bind(
|
||||
'backgrounds-enabled',
|
||||
nightBackgroundRow,
|
||||
'sensitive',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
content.add_row(nightBackgroundRow);
|
||||
|
||||
return new SettingsPage(label, description, content);
|
||||
}
|
||||
return new SettingsPage(label, description, content);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class BackgroundsEnabledControl {
|
||||
|
||||
constructor() {
|
||||
const settings = compat.get_extension_settings();
|
||||
const toggle = new Gtk.Switch({
|
||||
active: settings.get_boolean('backgrounds-enabled')
|
||||
});
|
||||
settings.bind(
|
||||
'backgrounds-enabled',
|
||||
toggle,
|
||||
'active',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
return toggle;
|
||||
}
|
||||
constructor() {
|
||||
const settings = compat.getExtensionSettings();
|
||||
const toggle = new Gtk.Switch({
|
||||
active: settings.get_boolean('backgrounds-enabled'),
|
||||
});
|
||||
settings.bind(
|
||||
'backgrounds-enabled',
|
||||
toggle,
|
||||
'active',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
return toggle;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
class TimeBackgroundControl {
|
||||
|
||||
constructor(time) {
|
||||
const settings = compat.get_extension_settings();
|
||||
constructor(time) {
|
||||
const settings = compat.getExtensionSettings();
|
||||
|
||||
const filter = new Gtk.FileFilter();
|
||||
filter.add_mime_type('image/jpeg');
|
||||
filter.add_mime_type('image/png');
|
||||
filter.add_mime_type('image/tiff');
|
||||
const filter = new Gtk.FileFilter();
|
||||
filter.add_mime_type('image/jpeg');
|
||||
filter.add_mime_type('image/png');
|
||||
filter.add_mime_type('image/tiff');
|
||||
|
||||
const preview = new Gtk.Image({
|
||||
pixel_size: 256
|
||||
});
|
||||
const preview = new Gtk.Image({
|
||||
pixel_size: 256,
|
||||
});
|
||||
|
||||
const button = new Gtk.FileChooserButton({
|
||||
title: _('Select your background image'),
|
||||
action: Gtk.FileChooserAction.OPEN,
|
||||
filter: filter,
|
||||
preview_widget: preview,
|
||||
use_preview_label: false
|
||||
});
|
||||
button.set_uri(settings.get_string(`background-${time}`));
|
||||
button.connect('update-preview', () => {
|
||||
const file = button.get_preview_filename();
|
||||
const pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(file, 256, 256);
|
||||
preview.set_from_pixbuf(pixbuf);
|
||||
});
|
||||
button.connect('file-set', () => settings.set_string(`background-${time}`, button.get_uri()));
|
||||
settings.connect(`changed::background-${time}`, () => button.set_uri(settings.get_string(`background-${time}`)));
|
||||
const button = new Gtk.FileChooserButton({
|
||||
title: _('Select your background image'),
|
||||
action: Gtk.FileChooserAction.OPEN,
|
||||
filter,
|
||||
preview_widget: preview,
|
||||
use_preview_label: false,
|
||||
});
|
||||
button.set_uri(settings.get_string(`background-${time}`));
|
||||
button.connect('update-preview', () => {
|
||||
const file = button.get_preview_filename();
|
||||
const pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(file, 256, 256);
|
||||
preview.set_from_pixbuf(pixbuf);
|
||||
});
|
||||
button.connect('file-set', () => settings.set_string(`background-${time}`, button.get_uri()));
|
||||
settings.connect(`changed::background-${time}`, () => button.set_uri(settings.get_string(`background-${time}`)));
|
||||
|
||||
return button;
|
||||
}
|
||||
return button;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+56
-56
@@ -30,77 +30,77 @@ const _ = Gettext.gettext;
|
||||
|
||||
var CommandsPreferences = class {
|
||||
|
||||
constructor() {
|
||||
const settings = compat.get_extension_settings();
|
||||
constructor() {
|
||||
const settings = compat.getExtensionSettings();
|
||||
|
||||
const label = _('Commands');
|
||||
const description = _('You can set custom commands that will be run when the time of the day changes.');
|
||||
const content = new SettingsList();
|
||||
const label = _('Commands');
|
||||
const description = _('You can set custom commands that will be run when the time of the day changes.');
|
||||
const content = new SettingsList();
|
||||
|
||||
content.add_row(new SettingsListRow(_('Use custom commands'), new CommandsEnabledControl()));
|
||||
content.add_row(new SettingsListRow(_('Use custom commands'), new CommandsEnabledControl()));
|
||||
|
||||
const day_command_row = new SettingsListRow(_('Sunrise'), new SuntimeCommandControl('sunrise'));
|
||||
settings.bind(
|
||||
'commands-enabled',
|
||||
day_command_row,
|
||||
'sensitive',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
content.add_row(day_command_row);
|
||||
const dayCommandRow = new SettingsListRow(_('Sunrise'), new SuntimeCommandControl('sunrise'));
|
||||
settings.bind(
|
||||
'commands-enabled',
|
||||
dayCommandRow,
|
||||
'sensitive',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
content.add_row(dayCommandRow);
|
||||
|
||||
const night_command_row = new SettingsListRow(_('Sunset'), new SuntimeCommandControl('sunset'));
|
||||
settings.bind(
|
||||
'commands-enabled',
|
||||
night_command_row,
|
||||
'sensitive',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
content.add_row(night_command_row);
|
||||
const nightCommandRow = new SettingsListRow(_('Sunset'), new SuntimeCommandControl('sunset'));
|
||||
settings.bind(
|
||||
'commands-enabled',
|
||||
nightCommandRow,
|
||||
'sensitive',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
content.add_row(nightCommandRow);
|
||||
|
||||
return new SettingsPage(label, description, content);
|
||||
}
|
||||
return new SettingsPage(label, description, content);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class CommandsEnabledControl {
|
||||
|
||||
constructor() {
|
||||
const settings = compat.get_extension_settings();
|
||||
const toggle = new Gtk.Switch({
|
||||
active: settings.get_boolean('commands-enabled')
|
||||
});
|
||||
settings.bind(
|
||||
'commands-enabled',
|
||||
toggle,
|
||||
'active',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
return toggle;
|
||||
}
|
||||
constructor() {
|
||||
const settings = compat.getExtensionSettings();
|
||||
const toggle = new Gtk.Switch({
|
||||
active: settings.get_boolean('commands-enabled'),
|
||||
});
|
||||
settings.bind(
|
||||
'commands-enabled',
|
||||
toggle,
|
||||
'active',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
return toggle;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
class SuntimeCommandControl {
|
||||
|
||||
constructor(suntime) {
|
||||
const message = new Map([
|
||||
['sunrise', _('Hello sunshine!')],
|
||||
['sunset', _('Hello moonshine!')]
|
||||
]);
|
||||
const settings = compat.get_extension_settings();
|
||||
const entry = new Gtk.Entry({
|
||||
width_request: 300,
|
||||
placeholder_text: _(`notify-send "${message.get(suntime)}"`)
|
||||
});
|
||||
settings.bind(
|
||||
`command-${suntime}`,
|
||||
entry,
|
||||
'text',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
return entry;
|
||||
}
|
||||
constructor(suntime) {
|
||||
const message = new Map([
|
||||
['sunrise', _('Hello sunshine!')],
|
||||
['sunset', _('Hello moonshine!')],
|
||||
]);
|
||||
const settings = compat.getExtensionSettings();
|
||||
const entry = new Gtk.Entry({
|
||||
width_request: 300,
|
||||
placeholder_text: _(`notify-send "${message.get(suntime)}"`),
|
||||
});
|
||||
settings.bind(
|
||||
`command-${suntime}`,
|
||||
entry,
|
||||
'text',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
return entry;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ const Me = extensionUtils.getCurrentExtension();
|
||||
|
||||
const compat = Me.imports.compat;
|
||||
const { SettingsPage, SettingsList, SettingsListRow } = Me.imports.preferences.bases;
|
||||
const { get_installed_cursor_themes } = Me.imports.utils;
|
||||
const { getInstalledCursorThemes } = Me.imports.utils;
|
||||
|
||||
const Gettext = imports.gettext.domain(Me.metadata.uuid);
|
||||
const _ = Gettext.gettext;
|
||||
@@ -31,72 +31,72 @@ const _ = Gettext.gettext;
|
||||
|
||||
var CursorThemePreferences = class {
|
||||
|
||||
constructor() {
|
||||
const settings = compat.get_extension_settings();
|
||||
constructor() {
|
||||
const settings = compat.getExtensionSettings();
|
||||
|
||||
const label = _('Cursor theme');
|
||||
const description = _('You can set different cursor themes for day and night.');
|
||||
const content = new SettingsList();
|
||||
const label = _('Cursor theme');
|
||||
const description = _('You can set different cursor themes for day and night.');
|
||||
const content = new SettingsList();
|
||||
|
||||
content.add_row(new SettingsListRow(_('Switch cursor variants'), new CursorVariantsEnabledControl()));
|
||||
content.add_row(new SettingsListRow(_('Switch cursor variants'), new CursorVariantsEnabledControl()));
|
||||
|
||||
const day_variant_row = new SettingsListRow(_('Day variant'), new TimeCursorVariantControl('day'));
|
||||
settings.bind(
|
||||
'cursor-variants-enabled',
|
||||
day_variant_row,
|
||||
'sensitive',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
content.add_row(day_variant_row);
|
||||
const dayVariantRow = new SettingsListRow(_('Day variant'), new TimeCursorVariantControl('day'));
|
||||
settings.bind(
|
||||
'cursor-variants-enabled',
|
||||
dayVariantRow,
|
||||
'sensitive',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
content.add_row(dayVariantRow);
|
||||
|
||||
const night_variant_row = new SettingsListRow(_('Night variant'), new TimeCursorVariantControl('night'));
|
||||
settings.bind(
|
||||
'cursor-variants-enabled',
|
||||
night_variant_row,
|
||||
'sensitive',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
content.add_row(night_variant_row);
|
||||
const nightVariantRow = new SettingsListRow(_('Night variant'), new TimeCursorVariantControl('night'));
|
||||
settings.bind(
|
||||
'cursor-variants-enabled',
|
||||
nightVariantRow,
|
||||
'sensitive',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
content.add_row(nightVariantRow);
|
||||
|
||||
return new SettingsPage(label, description, content);
|
||||
}
|
||||
return new SettingsPage(label, description, content);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class CursorVariantsEnabledControl {
|
||||
|
||||
constructor() {
|
||||
const settings = compat.get_extension_settings();
|
||||
const toggle = new Gtk.Switch({
|
||||
active: settings.get_boolean('cursor-variants-enabled')
|
||||
});
|
||||
settings.bind(
|
||||
'cursor-variants-enabled',
|
||||
toggle,
|
||||
'active',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
return toggle;
|
||||
}
|
||||
constructor() {
|
||||
const settings = compat.getExtensionSettings();
|
||||
const toggle = new Gtk.Switch({
|
||||
active: settings.get_boolean('cursor-variants-enabled'),
|
||||
});
|
||||
settings.bind(
|
||||
'cursor-variants-enabled',
|
||||
toggle,
|
||||
'active',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
return toggle;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
class TimeCursorVariantControl {
|
||||
|
||||
constructor(time) {
|
||||
const settings = compat.get_extension_settings();
|
||||
const combo = new Gtk.ComboBoxText();
|
||||
const themes = Array.from(get_installed_cursor_themes()).sort();
|
||||
themes.forEach(theme => combo.append(theme, theme));
|
||||
settings.bind(
|
||||
`cursor-variant-${time}`,
|
||||
combo,
|
||||
'active-id',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
return combo;
|
||||
}
|
||||
constructor(time) {
|
||||
const settings = compat.getExtensionSettings();
|
||||
const combo = new Gtk.ComboBoxText();
|
||||
const themes = Array.from(getInstalledCursorThemes()).sort();
|
||||
themes.forEach(theme => combo.append(theme, theme));
|
||||
settings.bind(
|
||||
`cursor-variant-${time}`,
|
||||
combo,
|
||||
'active-id',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
return combo;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+69
-69
@@ -23,7 +23,7 @@ const Me = extensionUtils.getCurrentExtension();
|
||||
|
||||
const compat = Me.imports.compat;
|
||||
const { SettingsPage, SettingsList, SettingsListRow } = Me.imports.preferences.bases;
|
||||
const { get_installed_gtk_themes } = Me.imports.utils;
|
||||
const { getInstalledGtkThemes } = Me.imports.utils;
|
||||
|
||||
const Gettext = imports.gettext.domain(Me.metadata.uuid);
|
||||
const _ = Gettext.gettext;
|
||||
@@ -31,96 +31,96 @@ const _ = Gettext.gettext;
|
||||
|
||||
var GtkThemePreferences = class {
|
||||
|
||||
constructor() {
|
||||
const settings = compat.get_extension_settings();
|
||||
constructor() {
|
||||
const settings = compat.getExtensionSettings();
|
||||
|
||||
const label = _('GTK theme');
|
||||
const description = _('The extension will try to automatically detect the day and night variants of your GTK theme.\n\nIf the theme you use isn\'t supported, please <a href="https://gitlab.com/rmnvgr/nightthemeswitcher-gnome-shell-extension/-/issues">submit a request</a>. You can also manually set variants.');
|
||||
const content = new SettingsList();
|
||||
const label = _('GTK theme');
|
||||
const description = _('The extension will try to automatically detect the day and night variants of your GTK theme.\n\nIf the theme you use isn\'t supported, please <a href="https://gitlab.com/rmnvgr/nightthemeswitcher-gnome-shell-extension/-/issues">submit a request</a>. You can also manually set variants.');
|
||||
const content = new SettingsList();
|
||||
|
||||
content.add_row(new SettingsListRow(_('Switch GTK variants'), new GtkVariantsEnabledControl()));
|
||||
content.add_row(new SettingsListRow(_('Switch GTK variants'), new GtkVariantsEnabledControl()));
|
||||
|
||||
const manual_variants_row = new SettingsListRow(_('Manual variants'), new ManualGtkVariantsControl());
|
||||
settings.bind(
|
||||
'gtk-variants-enabled',
|
||||
manual_variants_row,
|
||||
'sensitive',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
content.add_row(manual_variants_row);
|
||||
const manualVariantsRow = new SettingsListRow(_('Manual variants'), new ManualGtkVariantsControl());
|
||||
settings.bind(
|
||||
'gtk-variants-enabled',
|
||||
manualVariantsRow,
|
||||
'sensitive',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
content.add_row(manualVariantsRow);
|
||||
|
||||
const day_variant_row = new SettingsListRow(_('Day variant'), new TimeGtkVariantControl('day'));
|
||||
const update_day_variant_row_sensitivity = () => day_variant_row.set_sensitive(!!(settings.get_boolean('gtk-variants-enabled') && settings.get_boolean('manual-gtk-variants')));
|
||||
settings.connect('changed::gtk-variants-enabled', update_day_variant_row_sensitivity);
|
||||
settings.connect('changed::manual-gtk-variants', update_day_variant_row_sensitivity)
|
||||
update_day_variant_row_sensitivity();
|
||||
content.add_row(day_variant_row);
|
||||
const dayVariantRow = new SettingsListRow(_('Day variant'), new TimeGtkVariantControl('day'));
|
||||
const updateDayVariantRowSensitivity = () => dayVariantRow.set_sensitive(!!(settings.get_boolean('gtk-variants-enabled') && settings.get_boolean('manual-gtk-variants')));
|
||||
settings.connect('changed::gtk-variants-enabled', updateDayVariantRowSensitivity);
|
||||
settings.connect('changed::manual-gtk-variants', updateDayVariantRowSensitivity);
|
||||
updateDayVariantRowSensitivity();
|
||||
content.add_row(dayVariantRow);
|
||||
|
||||
const night_variant_row = new SettingsListRow(_('Night variant'), new TimeGtkVariantControl('night'));
|
||||
const update_night_variant_row_sensitivity = () => night_variant_row.set_sensitive(!!(settings.get_boolean('gtk-variants-enabled') && settings.get_boolean('manual-gtk-variants')));
|
||||
settings.connect('changed::gtk-variants-enabled', update_night_variant_row_sensitivity);
|
||||
settings.connect('changed::manual-gtk-variants', update_night_variant_row_sensitivity)
|
||||
update_night_variant_row_sensitivity();
|
||||
content.add_row(night_variant_row);
|
||||
const nightVariantRow = new SettingsListRow(_('Night variant'), new TimeGtkVariantControl('night'));
|
||||
const updateNightVariantRowSensitivity = () => nightVariantRow.set_sensitive(!!(settings.get_boolean('gtk-variants-enabled') && settings.get_boolean('manual-gtk-variants')));
|
||||
settings.connect('changed::gtk-variants-enabled', updateNightVariantRowSensitivity);
|
||||
settings.connect('changed::manual-gtk-variants', updateNightVariantRowSensitivity);
|
||||
updateNightVariantRowSensitivity();
|
||||
content.add_row(nightVariantRow);
|
||||
|
||||
return new SettingsPage(label, description, content);
|
||||
}
|
||||
return new SettingsPage(label, description, content);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class GtkVariantsEnabledControl {
|
||||
|
||||
constructor() {
|
||||
const settings = compat.get_extension_settings();
|
||||
const toggle = new Gtk.Switch({
|
||||
active: settings.get_boolean('gtk-variants-enabled')
|
||||
});
|
||||
settings.bind(
|
||||
'gtk-variants-enabled',
|
||||
toggle,
|
||||
'active',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
return toggle;
|
||||
}
|
||||
constructor() {
|
||||
const settings = compat.getExtensionSettings();
|
||||
const toggle = new Gtk.Switch({
|
||||
active: settings.get_boolean('gtk-variants-enabled'),
|
||||
});
|
||||
settings.bind(
|
||||
'gtk-variants-enabled',
|
||||
toggle,
|
||||
'active',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
return toggle;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
class ManualGtkVariantsControl {
|
||||
|
||||
constructor() {
|
||||
const settings = compat.get_extension_settings();
|
||||
const toggle = new Gtk.Switch({
|
||||
active: false
|
||||
});
|
||||
settings.bind(
|
||||
'manual-gtk-variants',
|
||||
toggle,
|
||||
'active',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
return toggle;
|
||||
}
|
||||
constructor() {
|
||||
const settings = compat.getExtensionSettings();
|
||||
const toggle = new Gtk.Switch({
|
||||
active: false,
|
||||
});
|
||||
settings.bind(
|
||||
'manual-gtk-variants',
|
||||
toggle,
|
||||
'active',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
return toggle;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
class TimeGtkVariantControl {
|
||||
|
||||
constructor(time) {
|
||||
const settings = compat.get_extension_settings();
|
||||
const combo = new Gtk.ComboBoxText();
|
||||
const themes = Array.from(get_installed_gtk_themes()).sort();
|
||||
themes.forEach(theme => combo.append(theme, theme));
|
||||
settings.bind(
|
||||
`gtk-variant-${time}`,
|
||||
combo,
|
||||
'active-id',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
return combo;
|
||||
}
|
||||
constructor(time) {
|
||||
const settings = compat.getExtensionSettings();
|
||||
const combo = new Gtk.ComboBoxText();
|
||||
const themes = Array.from(getInstalledGtkThemes()).sort();
|
||||
themes.forEach(theme => combo.append(theme, theme));
|
||||
settings.bind(
|
||||
`gtk-variant-${time}`,
|
||||
combo,
|
||||
'active-id',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
return combo;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ const Me = extensionUtils.getCurrentExtension();
|
||||
|
||||
const compat = Me.imports.compat;
|
||||
const { SettingsPage, SettingsList, SettingsListRow } = Me.imports.preferences.bases;
|
||||
const { get_installed_icon_themes } = Me.imports.utils;
|
||||
const { getInstalledIconThemes } = Me.imports.utils;
|
||||
|
||||
const Gettext = imports.gettext.domain(Me.metadata.uuid);
|
||||
const _ = Gettext.gettext;
|
||||
@@ -31,72 +31,72 @@ const _ = Gettext.gettext;
|
||||
|
||||
var IconThemePreferences = class {
|
||||
|
||||
constructor() {
|
||||
const settings = compat.get_extension_settings();
|
||||
constructor() {
|
||||
const settings = compat.getExtensionSettings();
|
||||
|
||||
const label = _('Icon theme');
|
||||
const description = _('You can set different icon themes for day and night.');
|
||||
const content = new SettingsList();
|
||||
const label = _('Icon theme');
|
||||
const description = _('You can set different icon themes for day and night.');
|
||||
const content = new SettingsList();
|
||||
|
||||
content.add_row(new SettingsListRow(_('Switch icon variants'), new IconVariantsEnabledControl()));
|
||||
content.add_row(new SettingsListRow(_('Switch icon variants'), new IconVariantsEnabledControl()));
|
||||
|
||||
const day_variant_row = new SettingsListRow(_('Day variant'), new TimeIconVariantControl('day'));
|
||||
settings.bind(
|
||||
'icon-variants-enabled',
|
||||
day_variant_row,
|
||||
'sensitive',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
content.add_row(day_variant_row);
|
||||
const dayVariantRow = new SettingsListRow(_('Day variant'), new TimeIconVariantControl('day'));
|
||||
settings.bind(
|
||||
'icon-variants-enabled',
|
||||
dayVariantRow,
|
||||
'sensitive',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
content.add_row(dayVariantRow);
|
||||
|
||||
const night_variant_row = new SettingsListRow(_('Night variant'), new TimeIconVariantControl('night'));
|
||||
settings.bind(
|
||||
'icon-variants-enabled',
|
||||
night_variant_row,
|
||||
'sensitive',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
content.add_row(night_variant_row);
|
||||
const nightVariantRow = new SettingsListRow(_('Night variant'), new TimeIconVariantControl('night'));
|
||||
settings.bind(
|
||||
'icon-variants-enabled',
|
||||
nightVariantRow,
|
||||
'sensitive',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
content.add_row(nightVariantRow);
|
||||
|
||||
return new SettingsPage(label, description, content);
|
||||
}
|
||||
return new SettingsPage(label, description, content);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class IconVariantsEnabledControl {
|
||||
|
||||
constructor() {
|
||||
const settings = compat.get_extension_settings();
|
||||
const toggle = new Gtk.Switch({
|
||||
active: settings.get_boolean('icon-variants-enabled')
|
||||
});
|
||||
settings.bind(
|
||||
'icon-variants-enabled',
|
||||
toggle,
|
||||
'active',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
return toggle;
|
||||
}
|
||||
constructor() {
|
||||
const settings = compat.getExtensionSettings();
|
||||
const toggle = new Gtk.Switch({
|
||||
active: settings.get_boolean('icon-variants-enabled'),
|
||||
});
|
||||
settings.bind(
|
||||
'icon-variants-enabled',
|
||||
toggle,
|
||||
'active',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
return toggle;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
class TimeIconVariantControl {
|
||||
|
||||
constructor(time) {
|
||||
const settings = compat.get_extension_settings();
|
||||
const combo = new Gtk.ComboBoxText();
|
||||
const themes = Array.from(get_installed_icon_themes()).sort();
|
||||
themes.forEach(theme => combo.append(theme, theme));
|
||||
settings.bind(
|
||||
`icon-variant-${time}`,
|
||||
combo,
|
||||
'active-id',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
return combo;
|
||||
}
|
||||
constructor(time) {
|
||||
const settings = compat.getExtensionSettings();
|
||||
const combo = new Gtk.ComboBoxText();
|
||||
const themes = Array.from(getInstalledIconThemes()).sort();
|
||||
themes.forEach(theme => combo.append(theme, theme));
|
||||
settings.bind(
|
||||
`icon-variant-${time}`,
|
||||
combo,
|
||||
'active-id',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
return combo;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+223
-226
@@ -30,280 +30,277 @@ const _ = Gettext.gettext;
|
||||
|
||||
var SchedulePreferences = class {
|
||||
|
||||
constructor() {
|
||||
const settings = compat.get_extension_settings();
|
||||
constructor() {
|
||||
const settings = compat.getExtensionSettings();
|
||||
|
||||
const label = _('Schedule');
|
||||
const description = _('The extension will try to use Night Light or Location Services to automatically set your current sunrise and sunset times if they are enabled.\n\nIf you prefer, you can manually choose a time source.');
|
||||
const content = new SettingsList();
|
||||
const label = _('Schedule');
|
||||
const description = _('The extension will try to use Night Light or Location Services to automatically set your current sunrise and sunset times if they are enabled.\n\nIf you prefer, you can manually choose a time source.');
|
||||
const content = new SettingsList();
|
||||
|
||||
content.add_row(new SettingsListRow(_('Automatic time source'), new ManualTimeSourceControl()));
|
||||
content.add_row(new SettingsListRow(_('Automatic time source'), new ManualTimeSourceControl()));
|
||||
|
||||
const time_source_row = new SettingsListRow(_('Time source'), new TimeSourceControl());
|
||||
settings.bind(
|
||||
'manual-time-source',
|
||||
time_source_row,
|
||||
'sensitive',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
content.add_row(time_source_row);
|
||||
const timeSourceRow = new SettingsListRow(_('Time source'), new TimeSourceControl());
|
||||
settings.bind(
|
||||
'manual-time-source',
|
||||
timeSourceRow,
|
||||
'sensitive',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
content.add_row(timeSourceRow);
|
||||
|
||||
const ondemand_shortcut_row = new SettingsListRow(_('On-demand shortcut'), new KeyBindingControl());
|
||||
const update_ondemand_shortcut_row_sensitivity = () => ondemand_shortcut_row.set_sensitive(!!(settings.get_boolean('manual-time-source') && settings.get_string('time-source') === 'ondemand'));
|
||||
settings.connect('changed::manual-time-source', () => update_ondemand_shortcut_row_sensitivity());
|
||||
settings.connect('changed::time-source', () => update_ondemand_shortcut_row_sensitivity());
|
||||
update_ondemand_shortcut_row_sensitivity();
|
||||
content.add_row(ondemand_shortcut_row);
|
||||
const ondemandShortcutRow = new SettingsListRow(_('On-demand shortcut'), new KeyBindingControl());
|
||||
const updateOndemandShortcutRowSensitivity = () => ondemandShortcutRow.set_sensitive(!!(settings.get_boolean('manual-time-source') && settings.get_string('time-source') === 'ondemand'));
|
||||
settings.connect('changed::manual-time-source', () => updateOndemandShortcutRowSensitivity());
|
||||
settings.connect('changed::time-source', () => updateOndemandShortcutRowSensitivity());
|
||||
updateOndemandShortcutRowSensitivity();
|
||||
content.add_row(ondemandShortcutRow);
|
||||
|
||||
const sunrise_row = new SettingsListRow(_('Sunrise'), new SuntimeControl('sunrise'));
|
||||
const update_sunrise_row_sensitivity = () => sunrise_row.set_sensitive(!!(settings.get_boolean('manual-time-source') && settings.get_string('time-source') === 'schedule'));
|
||||
settings.connect('changed::manual-time-source', () => update_sunrise_row_sensitivity());
|
||||
settings.connect('changed::time-source', () => update_sunrise_row_sensitivity());
|
||||
update_sunrise_row_sensitivity();
|
||||
content.add_row(sunrise_row);
|
||||
const sunriseRow = new SettingsListRow(_('Sunrise'), new SuntimeControl('sunrise'));
|
||||
const updateSunriseRowSensitivity = () => sunriseRow.set_sensitive(!!(settings.get_boolean('manual-time-source') && settings.get_string('time-source') === 'schedule'));
|
||||
settings.connect('changed::manual-time-source', () => updateSunriseRowSensitivity());
|
||||
settings.connect('changed::time-source', () => updateSunriseRowSensitivity());
|
||||
updateSunriseRowSensitivity();
|
||||
content.add_row(sunriseRow);
|
||||
|
||||
const sunset_row = new SettingsListRow(_('Sunset'), new SuntimeControl('sunset'));
|
||||
const update_sunset_row_sensitivity = () => sunset_row.set_sensitive(!!(settings.get_boolean('manual-time-source') && settings.get_string('time-source') === 'schedule'));
|
||||
settings.connect('changed::manual-time-source', () => update_sunset_row_sensitivity());
|
||||
settings.connect('changed::time-source', () => update_sunset_row_sensitivity());
|
||||
update_sunset_row_sensitivity();
|
||||
content.add_row(sunset_row);
|
||||
const sunsetRow = new SettingsListRow(_('Sunset'), new SuntimeControl('sunset'));
|
||||
const updateSunsetRowSensitivity = () => sunsetRow.set_sensitive(!!(settings.get_boolean('manual-time-source') && settings.get_string('time-source') === 'schedule'));
|
||||
settings.connect('changed::manual-time-source', () => updateSunsetRowSensitivity());
|
||||
settings.connect('changed::time-source', () => updateSunsetRowSensitivity());
|
||||
updateSunsetRowSensitivity();
|
||||
content.add_row(sunsetRow);
|
||||
|
||||
return new SettingsPage(label, description, content);
|
||||
}
|
||||
return new SettingsPage(label, description, content);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
class ManualTimeSourceControl {
|
||||
|
||||
constructor() {
|
||||
const settings = compat.get_extension_settings();
|
||||
const toggle = new Gtk.Switch({
|
||||
active: false
|
||||
});
|
||||
settings.bind(
|
||||
'manual-time-source',
|
||||
toggle,
|
||||
'active',
|
||||
Gio.SettingsBindFlags.INVERT_BOOLEAN
|
||||
);
|
||||
return toggle;
|
||||
}
|
||||
constructor() {
|
||||
const settings = compat.getExtensionSettings();
|
||||
const toggle = new Gtk.Switch({
|
||||
active: false,
|
||||
});
|
||||
settings.bind(
|
||||
'manual-time-source',
|
||||
toggle,
|
||||
'active',
|
||||
Gio.SettingsBindFlags.INVERT_BOOLEAN
|
||||
);
|
||||
return toggle;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
class TimeSourceControl {
|
||||
|
||||
constructor() {
|
||||
const settings = compat.get_extension_settings();
|
||||
const colorSettings = new Gio.Settings({ schema: 'org.gnome.settings-daemon.plugins.color' });
|
||||
const locationSettings = new Gio.Settings({ schema: 'org.gnome.system.location' });
|
||||
constructor() {
|
||||
const settings = compat.getExtensionSettings();
|
||||
const colorSettings = new Gio.Settings({ schema: 'org.gnome.settings-daemon.plugins.color' });
|
||||
const locationSettings = new Gio.Settings({ schema: 'org.gnome.system.location' });
|
||||
|
||||
const box = new Gtk.Box({
|
||||
spacing: 8,
|
||||
orientation: Gtk.Orientation.HORIZONTAL,
|
||||
can_focus: false
|
||||
});
|
||||
const box = new Gtk.Box({
|
||||
spacing: 8,
|
||||
orientation: Gtk.Orientation.HORIZONTAL,
|
||||
can_focus: false,
|
||||
});
|
||||
|
||||
const nightlight_radio = new Gtk.RadioButton({
|
||||
label: _('Night Light'),
|
||||
active: (settings.get_string('time-source') === 'nightlight')
|
||||
});
|
||||
nightlight_radio.connect('toggled', () => {
|
||||
if ( nightlight_radio.get_active() ) {
|
||||
settings.set_string('time-source', 'nightlight')
|
||||
}
|
||||
});
|
||||
colorSettings.bind(
|
||||
'night-light-enabled',
|
||||
nightlight_radio,
|
||||
'sensitive',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
box.pack_start(nightlight_radio, false, false, 0);
|
||||
const nightlightRadio = new Gtk.RadioButton({
|
||||
label: _('Night Light'),
|
||||
active: settings.get_string('time-source') === 'nightlight',
|
||||
});
|
||||
nightlightRadio.connect('toggled', () => {
|
||||
if (nightlightRadio.get_active())
|
||||
settings.set_string('time-source', 'nightlight');
|
||||
});
|
||||
colorSettings.bind(
|
||||
'night-light-enabled',
|
||||
nightlightRadio,
|
||||
'sensitive',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
box.pack_start(nightlightRadio, false, false, 0);
|
||||
|
||||
const location_radio = new Gtk.RadioButton({
|
||||
label: _('Location Services'),
|
||||
group: nightlight_radio,
|
||||
active: (settings.get_string('time-source') === 'location')
|
||||
});
|
||||
location_radio.connect('toggled', () => {
|
||||
if ( location_radio.get_active() ) {
|
||||
settings.set_string('time-source', 'location')
|
||||
}
|
||||
});
|
||||
locationSettings.bind(
|
||||
'enabled',
|
||||
location_radio,
|
||||
'sensitive',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
box.pack_start(location_radio, false, false, 0);
|
||||
const locationRadio = new Gtk.RadioButton({
|
||||
label: _('Location Services'),
|
||||
group: nightlightRadio,
|
||||
active: settings.get_string('time-source') === 'location',
|
||||
});
|
||||
locationRadio.connect('toggled', () => {
|
||||
if (locationRadio.get_active())
|
||||
settings.set_string('time-source', 'location');
|
||||
});
|
||||
locationSettings.bind(
|
||||
'enabled',
|
||||
locationRadio,
|
||||
'sensitive',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
box.pack_start(locationRadio, false, false, 0);
|
||||
|
||||
const schedule_radio = new Gtk.RadioButton({
|
||||
label: _('Manual schedule'),
|
||||
group: nightlight_radio,
|
||||
active: (settings.get_string('time-source') === 'schedule')
|
||||
});
|
||||
schedule_radio.connect('toggled', () => {
|
||||
if ( schedule_radio.get_active() ) {
|
||||
settings.set_string('time-source', 'schedule')
|
||||
}
|
||||
});
|
||||
settings.bind(
|
||||
'manual-time-source',
|
||||
schedule_radio,
|
||||
'sensitive',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
box.pack_start(schedule_radio, false, false, 0);
|
||||
const scheduleRadio = new Gtk.RadioButton({
|
||||
label: _('Manual schedule'),
|
||||
group: nightlightRadio,
|
||||
active: settings.get_string('time-source') === 'schedule',
|
||||
});
|
||||
scheduleRadio.connect('toggled', () => {
|
||||
if (scheduleRadio.get_active())
|
||||
settings.set_string('time-source', 'schedule');
|
||||
});
|
||||
settings.bind(
|
||||
'manual-time-source',
|
||||
scheduleRadio,
|
||||
'sensitive',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
box.pack_start(scheduleRadio, false, false, 0);
|
||||
|
||||
const ondemand_radio = new Gtk.RadioButton({
|
||||
label: _('On-demand'),
|
||||
group: nightlight_radio,
|
||||
active: (settings.get_string('time-source') === 'ondemand')
|
||||
});
|
||||
ondemand_radio.connect('toggled', () => {
|
||||
settings.set_string('time-source', 'ondemand')
|
||||
});
|
||||
settings.bind(
|
||||
'manual-time-source',
|
||||
ondemand_radio,
|
||||
'sensitive',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
box.pack_start(ondemand_radio, false, false, 0);
|
||||
const ondemandRadio = new Gtk.RadioButton({
|
||||
label: _('On-demand'),
|
||||
group: nightlightRadio,
|
||||
active: settings.get_string('time-source') === 'ondemand',
|
||||
});
|
||||
ondemandRadio.connect('toggled', () => {
|
||||
settings.set_string('time-source', 'ondemand');
|
||||
});
|
||||
settings.bind(
|
||||
'manual-time-source',
|
||||
ondemandRadio,
|
||||
'sensitive',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
box.pack_start(ondemandRadio, false, false, 0);
|
||||
|
||||
return box;
|
||||
}
|
||||
return box;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
class KeyBindingControl {
|
||||
|
||||
constructor() {
|
||||
const settings = compat.get_extension_settings();
|
||||
const KEYBINDING_KEY = 'nightthemeswitcher-ondemand-keybinding';
|
||||
const COLUMN_KEY = 0;
|
||||
const COLUMN_MODS = 1;
|
||||
constructor() {
|
||||
const settings = compat.getExtensionSettings();
|
||||
const KEYBINDING_KEY = 'nightthemeswitcher-ondemand-keybinding';
|
||||
const COLUMN_KEY = 0;
|
||||
const COLUMN_MODS = 1;
|
||||
|
||||
const list_store = new Gtk.ListStore();
|
||||
list_store.set_column_types([GObject.TYPE_INT, GObject.TYPE_INT]);
|
||||
const tree_view = new Gtk.TreeView({model: list_store});
|
||||
tree_view.set_headers_visible(false);
|
||||
const listStore = new Gtk.ListStore();
|
||||
listStore.set_column_types([GObject.TYPE_INT, GObject.TYPE_INT]);
|
||||
const treeView = new Gtk.TreeView({ model: listStore });
|
||||
treeView.set_headers_visible(false);
|
||||
|
||||
const renderer = new Gtk.CellRendererAccel({ editable: true});
|
||||
const column = new Gtk.TreeViewColumn();
|
||||
const iter = list_store.append();
|
||||
const renderer = new Gtk.CellRendererAccel({ editable: true });
|
||||
const column = new Gtk.TreeViewColumn();
|
||||
const iter = listStore.append();
|
||||
|
||||
const update_shortcut_row = (accel) => {
|
||||
const [key, mods] = accel ? Gtk.accelerator_parse(accel) : [0, 0];
|
||||
list_store.set(iter, [COLUMN_KEY, COLUMN_MODS], [key, mods]);
|
||||
};
|
||||
const updateShortcutRow = accel => {
|
||||
const [key, mods] = accel ? Gtk.accelerator_parse(accel) : [0, 0];
|
||||
listStore.set(iter, [COLUMN_KEY, COLUMN_MODS], [key, mods]);
|
||||
};
|
||||
|
||||
renderer.connect('accel-edited', (renderer, path, key, mods) => {
|
||||
const accel = Gtk.accelerator_name(key, mods);
|
||||
update_shortcut_row(accel);
|
||||
settings.set_strv(KEYBINDING_KEY, [accel]);
|
||||
});
|
||||
renderer.connect('accel-edited', (_renderer, _path, key, mods) => {
|
||||
const accel = Gtk.accelerator_name(key, mods);
|
||||
updateShortcutRow(accel);
|
||||
settings.set_strv(KEYBINDING_KEY, [accel]);
|
||||
});
|
||||
|
||||
renderer.connect('accel-cleared', () => {
|
||||
update_shortcut_row(null);
|
||||
settings.set_strv(KEYBINDING_KEY, []);
|
||||
});
|
||||
renderer.connect('accel-cleared', () => {
|
||||
updateShortcutRow(null);
|
||||
settings.set_strv(KEYBINDING_KEY, []);
|
||||
});
|
||||
|
||||
settings.connect(`changed::${KEYBINDING_KEY}`, () => {
|
||||
update_shortcut_row(settings.get_strv(KEYBINDING_KEY)[0]);
|
||||
});
|
||||
settings.connect(`changed::${KEYBINDING_KEY}`, () => {
|
||||
updateShortcutRow(settings.get_strv(KEYBINDING_KEY)[0]);
|
||||
});
|
||||
|
||||
column.pack_start(renderer, true);
|
||||
column.add_attribute(renderer, 'accel-key', COLUMN_KEY);
|
||||
column.add_attribute(renderer, 'accel-mods', COLUMN_MODS);
|
||||
column.pack_start(renderer, true);
|
||||
column.add_attribute(renderer, 'accel-key', COLUMN_KEY);
|
||||
column.add_attribute(renderer, 'accel-mods', COLUMN_MODS);
|
||||
|
||||
tree_view.append_column(column);
|
||||
update_shortcut_row(settings.get_strv(KEYBINDING_KEY)[0]);
|
||||
treeView.append_column(column);
|
||||
updateShortcutRow(settings.get_strv(KEYBINDING_KEY)[0]);
|
||||
|
||||
return tree_view;
|
||||
}
|
||||
return treeView;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
class SuntimeControl {
|
||||
|
||||
constructor(suntime) {
|
||||
const settings = compat.get_extension_settings();
|
||||
const box = new Gtk.Box({
|
||||
spacing: 8,
|
||||
orientation: Gtk.Orientation.HORIZONTAL,
|
||||
can_focus: false
|
||||
});
|
||||
constructor(suntime) {
|
||||
const settings = compat.getExtensionSettings();
|
||||
const box = new Gtk.Box({
|
||||
spacing: 8,
|
||||
orientation: Gtk.Orientation.HORIZONTAL,
|
||||
can_focus: false,
|
||||
});
|
||||
|
||||
const time = settings.get_double(`schedule-${suntime}`);
|
||||
const hours = Math.trunc(time);
|
||||
const minutes = Math.round((time - hours) * 60);
|
||||
const time = settings.get_double(`schedule-${suntime}`);
|
||||
const hours = Math.trunc(time);
|
||||
const minutes = Math.round((time - hours) * 60);
|
||||
|
||||
const hours_spin = new Gtk.SpinButton({
|
||||
adjustment: new Gtk.Adjustment({
|
||||
value: hours,
|
||||
lower: 0,
|
||||
upper: 23,
|
||||
step_increment: 1,
|
||||
page_increment: 0,
|
||||
page_size: 0
|
||||
}),
|
||||
value: hours,
|
||||
numeric: true,
|
||||
wrap: true,
|
||||
orientation: Gtk.Orientation.VERTICAL
|
||||
});
|
||||
hours_spin.connect('output', () => {
|
||||
const text = hours_spin.adjustment.value.toString().padStart(2, '0');
|
||||
hours_spin.set_text(text);
|
||||
return true;
|
||||
});
|
||||
hours_spin.connect('value-changed', () => {
|
||||
const old_time = settings.get_double(`schedule-${suntime}`);
|
||||
const old_hour = Math.trunc(old_time);
|
||||
const minutes = old_time - old_hour;
|
||||
const new_time = hours_spin.value + minutes;
|
||||
settings.set_double(`schedule-${suntime}`, new_time);
|
||||
});
|
||||
const hoursSpin = new Gtk.SpinButton({
|
||||
adjustment: new Gtk.Adjustment({
|
||||
value: hours,
|
||||
lower: 0,
|
||||
upper: 23,
|
||||
step_increment: 1,
|
||||
page_increment: 0,
|
||||
page_size: 0,
|
||||
}),
|
||||
value: hours,
|
||||
numeric: true,
|
||||
wrap: true,
|
||||
orientation: Gtk.Orientation.VERTICAL,
|
||||
});
|
||||
hoursSpin.connect('output', () => {
|
||||
const text = hoursSpin.adjustment.value.toString().padStart(2, '0');
|
||||
hoursSpin.set_text(text);
|
||||
return true;
|
||||
});
|
||||
hoursSpin.connect('value-changed', () => {
|
||||
const oldTime = settings.get_double(`schedule-${suntime}`);
|
||||
const oldHour = Math.trunc(oldTime);
|
||||
const newMinutes = oldTime - oldHour;
|
||||
const newTime = hoursSpin.value + newMinutes;
|
||||
settings.set_double(`schedule-${suntime}`, newTime);
|
||||
});
|
||||
|
||||
const separator = new Gtk.Label({ label: ':' });
|
||||
const separator = new Gtk.Label({ label: ':' });
|
||||
|
||||
const minutes_spin = new Gtk.SpinButton({
|
||||
adjustment: new Gtk.Adjustment({
|
||||
value: minutes,
|
||||
lower: 0,
|
||||
upper: 59,
|
||||
step_increment: 1,
|
||||
page_increment: 0,
|
||||
page_size: 0
|
||||
}),
|
||||
value: minutes,
|
||||
numeric: true,
|
||||
wrap: true,
|
||||
orientation: Gtk.Orientation.VERTICAL
|
||||
});
|
||||
minutes_spin.connect('output', () => {
|
||||
const text = minutes_spin.adjustment.value.toString().padStart(2, '0');
|
||||
minutes_spin.set_text(text);
|
||||
return true;
|
||||
});
|
||||
minutes_spin.connect('value-changed', () => {
|
||||
const hour = Math.trunc(settings.get_double(`schedule-${suntime}`));
|
||||
const minutes = minutes_spin.value / 60;
|
||||
const new_time = hour + minutes;
|
||||
settings.set_double(`schedule-${suntime}`, new_time);
|
||||
});
|
||||
const minutesSpin = new Gtk.SpinButton({
|
||||
adjustment: new Gtk.Adjustment({
|
||||
value: minutes,
|
||||
lower: 0,
|
||||
upper: 59,
|
||||
step_increment: 1,
|
||||
page_increment: 0,
|
||||
page_size: 0,
|
||||
}),
|
||||
value: minutes,
|
||||
numeric: true,
|
||||
wrap: true,
|
||||
orientation: Gtk.Orientation.VERTICAL,
|
||||
});
|
||||
minutesSpin.connect('output', () => {
|
||||
const text = minutesSpin.adjustment.value.toString().padStart(2, '0');
|
||||
minutesSpin.set_text(text);
|
||||
return true;
|
||||
});
|
||||
minutesSpin.connect('value-changed', () => {
|
||||
const hour = Math.trunc(settings.get_double(`schedule-${suntime}`));
|
||||
const newMinutes = minutesSpin.value / 60;
|
||||
const newTime = hour + newMinutes;
|
||||
settings.set_double(`schedule-${suntime}`, newTime);
|
||||
});
|
||||
|
||||
box.pack_start(hours_spin, false, false, 0);
|
||||
box.pack_start(separator, false, false, 0);
|
||||
box.pack_start(minutes_spin, false, false, 0);
|
||||
return box;
|
||||
}
|
||||
box.pack_start(hoursSpin, false, false, 0);
|
||||
box.pack_start(separator, false, false, 0);
|
||||
box.pack_start(minutesSpin, false, false, 0);
|
||||
return box;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ const Me = extensionUtils.getCurrentExtension();
|
||||
|
||||
const compat = Me.imports.compat;
|
||||
const { SettingsPage, SettingsList, SettingsListRow } = Me.imports.preferences.bases;
|
||||
const { get_installed_shell_themes } = Me.imports.utils;
|
||||
const { getInstalledShellThemes } = Me.imports.utils;
|
||||
|
||||
const Gettext = imports.gettext.domain(Me.metadata.uuid);
|
||||
const _ = Gettext.gettext;
|
||||
@@ -31,96 +31,96 @@ const _ = Gettext.gettext;
|
||||
|
||||
var ShellThemePreferences = class {
|
||||
|
||||
constructor() {
|
||||
const settings = compat.get_extension_settings();
|
||||
constructor() {
|
||||
const settings = compat.getExtensionSettings();
|
||||
|
||||
const label = _('Shell theme');
|
||||
const description = _('The extension will try to automatically detect the day and night variants of your GNOME Shell theme.\n\nIf the theme you use isn\'t supported, please <a href="https://gitlab.com/rmnvgr/nightthemeswitcher-gnome-shell-extension/-/issues">submit a request</a>. You can also manually set variants.');
|
||||
const content = new SettingsList();
|
||||
const label = _('Shell theme');
|
||||
const description = _('The extension will try to automatically detect the day and night variants of your GNOME Shell theme.\n\nIf the theme you use isn\'t supported, please <a href="https://gitlab.com/rmnvgr/nightthemeswitcher-gnome-shell-extension/-/issues">submit a request</a>. You can also manually set variants.');
|
||||
const content = new SettingsList();
|
||||
|
||||
content.add_row(new SettingsListRow(_('Switch Shell variants'), new ShellVariantsEnabledControl()));
|
||||
content.add_row(new SettingsListRow(_('Switch Shell variants'), new ShellVariantsEnabledControl()));
|
||||
|
||||
const manual_variants_row = new SettingsListRow(_('Manual variants'), new ManualShellVariantsControl());
|
||||
settings.bind(
|
||||
'shell-variants-enabled',
|
||||
manual_variants_row,
|
||||
'sensitive',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
content.add_row(manual_variants_row);
|
||||
const manualVariantsRow = new SettingsListRow(_('Manual variants'), new ManualShellVariantsControl());
|
||||
settings.bind(
|
||||
'shell-variants-enabled',
|
||||
manualVariantsRow,
|
||||
'sensitive',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
content.add_row(manualVariantsRow);
|
||||
|
||||
const day_variant_row = new SettingsListRow(_('Day variant'), new TimeShellVariantControl('day'));
|
||||
const update_day_variant_row_sensitivity = () => day_variant_row.set_sensitive(!!(settings.get_boolean('shell-variants-enabled') && settings.get_boolean('manual-shell-variants')));
|
||||
settings.connect('changed::shell-variants-enabled', update_day_variant_row_sensitivity);
|
||||
settings.connect('changed::manual-shell-variants', update_day_variant_row_sensitivity)
|
||||
update_day_variant_row_sensitivity();
|
||||
content.add_row(day_variant_row);
|
||||
const dayVariantRow = new SettingsListRow(_('Day variant'), new TimeShellVariantControl('day'));
|
||||
const updateDayVariantRowSensitivity = () => dayVariantRow.set_sensitive(!!(settings.get_boolean('shell-variants-enabled') && settings.get_boolean('manual-shell-variants')));
|
||||
settings.connect('changed::shell-variants-enabled', updateDayVariantRowSensitivity);
|
||||
settings.connect('changed::manual-shell-variants', updateDayVariantRowSensitivity);
|
||||
updateDayVariantRowSensitivity();
|
||||
content.add_row(dayVariantRow);
|
||||
|
||||
const night_variant_row = new SettingsListRow(_('Night variant'), new TimeShellVariantControl('night'));
|
||||
const update_night_variant_row_sensitivity = () => night_variant_row.set_sensitive(!!(settings.get_boolean('shell-variants-enabled') && settings.get_boolean('manual-shell-variants')));
|
||||
settings.connect('changed::shell-variants-enabled', update_night_variant_row_sensitivity);
|
||||
settings.connect('changed::manual-shell-variants', update_night_variant_row_sensitivity)
|
||||
update_night_variant_row_sensitivity();
|
||||
content.add_row(night_variant_row);
|
||||
const nightVariantRow = new SettingsListRow(_('Night variant'), new TimeShellVariantControl('night'));
|
||||
const updateNightVariantRowSensitivity = () => nightVariantRow.set_sensitive(!!(settings.get_boolean('shell-variants-enabled') && settings.get_boolean('manual-shell-variants')));
|
||||
settings.connect('changed::shell-variants-enabled', updateNightVariantRowSensitivity);
|
||||
settings.connect('changed::manual-shell-variants', updateNightVariantRowSensitivity);
|
||||
updateNightVariantRowSensitivity();
|
||||
content.add_row(nightVariantRow);
|
||||
|
||||
return new SettingsPage(label, description, content);
|
||||
}
|
||||
return new SettingsPage(label, description, content);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class ShellVariantsEnabledControl {
|
||||
|
||||
constructor() {
|
||||
const settings = compat.get_extension_settings();
|
||||
const toggle = new Gtk.Switch({
|
||||
active: settings.get_boolean('shell-variants-enabled')
|
||||
});
|
||||
settings.bind(
|
||||
'shell-variants-enabled',
|
||||
toggle,
|
||||
'active',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
return toggle;
|
||||
}
|
||||
constructor() {
|
||||
const settings = compat.getExtensionSettings();
|
||||
const toggle = new Gtk.Switch({
|
||||
active: settings.get_boolean('shell-variants-enabled'),
|
||||
});
|
||||
settings.bind(
|
||||
'shell-variants-enabled',
|
||||
toggle,
|
||||
'active',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
return toggle;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
class ManualShellVariantsControl {
|
||||
|
||||
constructor() {
|
||||
const settings = compat.get_extension_settings();
|
||||
const toggle = new Gtk.Switch({
|
||||
active: false
|
||||
});
|
||||
settings.bind(
|
||||
'manual-shell-variants',
|
||||
toggle,
|
||||
'active',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
return toggle;
|
||||
}
|
||||
constructor() {
|
||||
const settings = compat.getExtensionSettings();
|
||||
const toggle = new Gtk.Switch({
|
||||
active: false,
|
||||
});
|
||||
settings.bind(
|
||||
'manual-shell-variants',
|
||||
toggle,
|
||||
'active',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
return toggle;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
class TimeShellVariantControl {
|
||||
|
||||
constructor(time) {
|
||||
const settings = compat.get_extension_settings();
|
||||
const combo = new Gtk.ComboBoxText();
|
||||
const themes = Array.from(get_installed_shell_themes()).sort();
|
||||
themes.forEach(theme => combo.append(theme, (theme === '' ? _('Default') : theme)));
|
||||
settings.bind(
|
||||
`shell-variant-${time}`,
|
||||
combo,
|
||||
'active-id',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
return combo;
|
||||
}
|
||||
constructor(time) {
|
||||
const settings = compat.getExtensionSettings();
|
||||
const combo = new Gtk.ComboBoxText();
|
||||
const themes = Array.from(getInstalledShellThemes()).sort();
|
||||
themes.forEach(theme => combo.append(theme, theme === '' ? _('Default') : theme));
|
||||
settings.bind(
|
||||
`shell-variant-${time}`,
|
||||
combo,
|
||||
'active-id',
|
||||
Gio.SettingsBindFlags.DEFAULT
|
||||
);
|
||||
return combo;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+68
-68
@@ -21,89 +21,89 @@ const { Gtk } = imports.gi;
|
||||
|
||||
var SettingsPage = class {
|
||||
|
||||
constructor(label, description, content_widget) {
|
||||
this.label = new Gtk.Label({
|
||||
label: label
|
||||
});
|
||||
constructor(label, description, contentWidget) {
|
||||
this.label = new Gtk.Label({
|
||||
label,
|
||||
});
|
||||
|
||||
this.page = new Gtk.Box({
|
||||
orientation: Gtk.Orientation.VERTICAL,
|
||||
spacing: 30,
|
||||
margin_top: 30,
|
||||
margin_end: 36,
|
||||
margin_start: 36,
|
||||
margin_bottom: 36,
|
||||
valign: Gtk.Align.START,
|
||||
halign: Gtk.Align.CENTER
|
||||
});
|
||||
this.page = new Gtk.Box({
|
||||
orientation: Gtk.Orientation.VERTICAL,
|
||||
spacing: 30,
|
||||
margin_top: 30,
|
||||
margin_end: 36,
|
||||
margin_start: 36,
|
||||
margin_bottom: 36,
|
||||
valign: Gtk.Align.START,
|
||||
halign: Gtk.Align.CENTER,
|
||||
});
|
||||
|
||||
const description_widget = new Gtk.Label({
|
||||
label: description,
|
||||
use_markup: true,
|
||||
width_request: 600,
|
||||
max_width_chars: 60,
|
||||
wrap: true,
|
||||
justify: Gtk.Justification.LEFT,
|
||||
halign: Gtk.Align.START
|
||||
});
|
||||
this.page.pack_start(description_widget, false, false, 0);
|
||||
const descriptionWidget = new Gtk.Label({
|
||||
label: description,
|
||||
use_markup: true,
|
||||
width_request: 600,
|
||||
max_width_chars: 60,
|
||||
wrap: true,
|
||||
justify: Gtk.Justification.LEFT,
|
||||
halign: Gtk.Align.START,
|
||||
});
|
||||
this.page.pack_start(descriptionWidget, false, false, 0);
|
||||
|
||||
this.page.pack_start(content_widget, false, false, 0);
|
||||
}
|
||||
this.page.pack_start(contentWidget, false, false, 0);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
var SettingsList = class {
|
||||
|
||||
constructor() {
|
||||
const frame = new Gtk.Frame({
|
||||
can_focus: false
|
||||
});
|
||||
constructor() {
|
||||
const frame = new Gtk.Frame({
|
||||
can_focus: false,
|
||||
});
|
||||
|
||||
const list = new Gtk.ListBox({
|
||||
border_width: 0,
|
||||
margin: 0,
|
||||
can_focus: false,
|
||||
selection_mode: Gtk.SelectionMode.NONE
|
||||
});
|
||||
frame.add(list);
|
||||
const list = new Gtk.ListBox({
|
||||
border_width: 0,
|
||||
margin: 0,
|
||||
can_focus: false,
|
||||
selection_mode: Gtk.SelectionMode.NONE,
|
||||
});
|
||||
frame.add(list);
|
||||
|
||||
frame.add_row = (widget) => {
|
||||
if ( list.get_children().length > 0 ) {
|
||||
const separator = new Gtk.Separator({
|
||||
orientation: Gtk.Orientation.VERTICAL,
|
||||
can_focus: false
|
||||
});
|
||||
list.add(separator);
|
||||
}
|
||||
list.add(widget);
|
||||
}
|
||||
frame.add_row = widget => {
|
||||
if (list.get_children().length > 0) {
|
||||
const separator = new Gtk.Separator({
|
||||
orientation: Gtk.Orientation.VERTICAL,
|
||||
can_focus: false,
|
||||
});
|
||||
list.add(separator);
|
||||
}
|
||||
list.add(widget);
|
||||
};
|
||||
|
||||
return frame;
|
||||
}
|
||||
return frame;
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
var SettingsListRow = class {
|
||||
|
||||
constructor(label, widget) {
|
||||
const row = new Gtk.Box({
|
||||
margin: 16,
|
||||
spacing: 30,
|
||||
orientation: Gtk.Orientation.HORIZONTAL,
|
||||
can_focus: false
|
||||
});
|
||||
constructor(label, widget) {
|
||||
const row = new Gtk.Box({
|
||||
margin: 16,
|
||||
spacing: 30,
|
||||
orientation: Gtk.Orientation.HORIZONTAL,
|
||||
can_focus: false,
|
||||
});
|
||||
|
||||
const label_widget = new Gtk.Label({
|
||||
label: label,
|
||||
halign: Gtk.Align.START
|
||||
});
|
||||
row.pack_start(label_widget, true, true, 0);
|
||||
const labelWidget = new Gtk.Label({
|
||||
label,
|
||||
halign: Gtk.Align.START,
|
||||
});
|
||||
row.pack_start(labelWidget, true, true, 0);
|
||||
|
||||
widget.set_halign(Gtk.Align.END);
|
||||
row.pack_start(widget, false, false, 0);
|
||||
widget.set_halign(Gtk.Align.END);
|
||||
row.pack_start(widget, false, false, 0);
|
||||
|
||||
return row;
|
||||
}
|
||||
return row;
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
+20
-20
@@ -34,36 +34,36 @@ const { ShellThemePreferences } = Me.imports.preferences.ShellTheme;
|
||||
|
||||
|
||||
function init() {
|
||||
compat.init_translations(Me.metadata.uuid);
|
||||
compat.initTranslations(Me.metadata.uuid);
|
||||
}
|
||||
|
||||
function buildPrefsWidget() {
|
||||
const prefs_widget = new Gtk.Notebook({
|
||||
visible: true
|
||||
});
|
||||
const prefsWidget = new Gtk.Notebook({
|
||||
visible: true,
|
||||
});
|
||||
|
||||
const schedulePreferences = new SchedulePreferences();
|
||||
prefs_widget.append_page(schedulePreferences.page, schedulePreferences.label);
|
||||
const schedulePreferences = new SchedulePreferences();
|
||||
prefsWidget.append_page(schedulePreferences.page, schedulePreferences.label);
|
||||
|
||||
const gtkThemePreferences = new GtkThemePreferences();
|
||||
prefs_widget.append_page(gtkThemePreferences.page, gtkThemePreferences.label);
|
||||
const gtkThemePreferences = new GtkThemePreferences();
|
||||
prefsWidget.append_page(gtkThemePreferences.page, gtkThemePreferences.label);
|
||||
|
||||
const shellThemePreferences = new ShellThemePreferences();
|
||||
prefs_widget.append_page(shellThemePreferences.page, shellThemePreferences.label);
|
||||
const shellThemePreferences = new ShellThemePreferences();
|
||||
prefsWidget.append_page(shellThemePreferences.page, shellThemePreferences.label);
|
||||
|
||||
const iconThemePreferences = new IconThemePreferences();
|
||||
prefs_widget.append_page(iconThemePreferences.page, iconThemePreferences.label);
|
||||
const iconThemePreferences = new IconThemePreferences();
|
||||
prefsWidget.append_page(iconThemePreferences.page, iconThemePreferences.label);
|
||||
|
||||
const cursorThemePreferences = new CursorThemePreferences();
|
||||
prefs_widget.append_page(cursorThemePreferences.page, cursorThemePreferences.label);
|
||||
const cursorThemePreferences = new CursorThemePreferences();
|
||||
prefsWidget.append_page(cursorThemePreferences.page, cursorThemePreferences.label);
|
||||
|
||||
const backgroundsPreferences = new BackgroundsPreferences();
|
||||
prefs_widget.append_page(backgroundsPreferences.page, backgroundsPreferences.label);
|
||||
const backgroundsPreferences = new BackgroundsPreferences();
|
||||
prefsWidget.append_page(backgroundsPreferences.page, backgroundsPreferences.label);
|
||||
|
||||
const commandsPreferences = new CommandsPreferences();
|
||||
prefs_widget.append_page(commandsPreferences.page, commandsPreferences.label);
|
||||
const commandsPreferences = new CommandsPreferences();
|
||||
prefsWidget.append_page(commandsPreferences.page, commandsPreferences.label);
|
||||
|
||||
prefs_widget.show_all();
|
||||
prefsWidget.show_all();
|
||||
|
||||
return prefs_widget;
|
||||
return prefsWidget;
|
||||
}
|
||||
|
||||
+107
-129
@@ -31,23 +31,20 @@ const _ = Gettext.gettext;
|
||||
* Output a debug message to the console if the debug config is active.
|
||||
* @param {string} message The message to log.
|
||||
*/
|
||||
function log_debug(message) {
|
||||
if (config.debug) {
|
||||
log(`[DEBUG] ${Me.metadata.name}: ${message}`);
|
||||
}
|
||||
function logDebug(message) {
|
||||
if (config.debug)
|
||||
log(`[DEBUG] ${Me.metadata.name}: ${message}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log an error and show a notification if it has a message.
|
||||
* @param {Error} error The error to log.
|
||||
*/
|
||||
function log_error(error) {
|
||||
if (config.debug) {
|
||||
logError(error, Me.metadata.name);
|
||||
}
|
||||
if ( error.message && imports.ui ) {
|
||||
imports.ui.main.notifyError(Me.metadata.name, error.message);
|
||||
}
|
||||
function notifyError(error) {
|
||||
if (config.debug)
|
||||
logError(error, Me.metadata.name);
|
||||
if (error.message && imports.ui)
|
||||
imports.ui.main.notifyError(Me.metadata.name, error.message);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -55,12 +52,12 @@ function log_error(error) {
|
||||
* @param {string} resource The resource to get the directories.
|
||||
* @returns {string[]} An array of paths.
|
||||
*/
|
||||
function get_resources_dirs_paths(resource) {
|
||||
return [
|
||||
GLib.build_filenamev([GLib.get_home_dir(), `.${resource}`]),
|
||||
GLib.build_filenamev([GLib.get_user_data_dir(), resource]),
|
||||
...GLib.get_system_data_dirs().map(path => GLib.build_filenamev([path, resource]))
|
||||
];
|
||||
function getResourcesDirsPaths(resource) {
|
||||
return [
|
||||
GLib.build_filenamev([GLib.get_home_dir(), `.${resource}`]),
|
||||
GLib.build_filenamev([GLib.get_user_data_dir(), resource]),
|
||||
...GLib.get_system_data_dirs().map(path => GLib.build_filenamev([path, resource])),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -68,106 +65,91 @@ function get_resources_dirs_paths(resource) {
|
||||
* @param {string} type The resources to get.
|
||||
* @returns {Set} A set of installed resources.
|
||||
*/
|
||||
function get_installed_resources(type) {
|
||||
const installed_resources = new Set();
|
||||
|
||||
get_resources_dirs_paths(type).forEach(resources_dir_path => {
|
||||
const resources_dir = Gio.File.new_for_path(resources_dir_path);
|
||||
|
||||
if (resources_dir.query_file_type(Gio.FileQueryInfoFlags.NONE, null) !== Gio.FileType.DIRECTORY) {
|
||||
return;
|
||||
}
|
||||
|
||||
const resources_dirs_enumerator = resources_dir.enumerate_children('', Gio.FileQueryInfoFlags.NONE, null);
|
||||
|
||||
while (true) {
|
||||
let resource_dir_info = resources_dirs_enumerator.next_file(null);
|
||||
|
||||
if (resource_dir_info === null) {
|
||||
break;
|
||||
}
|
||||
|
||||
const resource_dir = resources_dirs_enumerator.get_child(resource_dir_info);
|
||||
if ( resource_dir === null ) {
|
||||
break;
|
||||
}
|
||||
const resource = new Map([
|
||||
['name', resource_dir.get_basename()],
|
||||
['path', resource_dir.get_path()]
|
||||
]);
|
||||
installed_resources.add(resource);
|
||||
}
|
||||
resources_dirs_enumerator.close(null);
|
||||
});
|
||||
|
||||
return installed_resources;
|
||||
function getInstalledResources(type) {
|
||||
const installedResources = new Set();
|
||||
getResourcesDirsPaths(type).forEach(resourcesDirPath => {
|
||||
const resourcesDir = Gio.File.new_for_path(resourcesDirPath);
|
||||
if (resourcesDir.query_file_type(Gio.FileQueryInfoFlags.NONE, null) !== Gio.FileType.DIRECTORY)
|
||||
return;
|
||||
const resourcesDirsEnumerator = resourcesDir.enumerate_children('', Gio.FileQueryInfoFlags.NONE, null);
|
||||
while (true) {
|
||||
let resourceDirInfo = resourcesDirsEnumerator.next_file(null);
|
||||
if (resourceDirInfo === null)
|
||||
break;
|
||||
const resourceDir = resourcesDirsEnumerator.get_child(resourceDirInfo);
|
||||
if (resourceDir === null)
|
||||
break;
|
||||
const resource = new Map([
|
||||
['name', resourceDir.get_basename()],
|
||||
['path', resourceDir.get_path()],
|
||||
]);
|
||||
installedResources.add(resource);
|
||||
}
|
||||
resourcesDirsEnumerator.close(null);
|
||||
});
|
||||
return installedResources;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the installed GTK themes on the system.
|
||||
* @returns {Set<string>} A set containing all the installed GTK themes names.
|
||||
*/
|
||||
function get_installed_gtk_themes() {
|
||||
const themes = new Set(['Adwaita', 'HighContrast', 'HighContrastInverse']);
|
||||
get_installed_resources('themes').forEach(theme => {
|
||||
const version = [0, Gtk.MINOR_VERSION].find(gtk_version => {
|
||||
if (gtk_version % 2) {
|
||||
gtk_version += 1;
|
||||
}
|
||||
const css_file = Gio.File.new_for_path(GLib.build_filenamev([theme.get('path'), `gtk-3.${gtk_version}`, 'gtk.css']));
|
||||
return css_file.query_exists(null);
|
||||
});
|
||||
if ( version !== undefined ) {
|
||||
themes.add(theme.get('name'));
|
||||
}
|
||||
});
|
||||
return themes;
|
||||
function getInstalledGtkThemes() {
|
||||
const themes = new Set(['Adwaita', 'HighContrast', 'HighContrastInverse']);
|
||||
getInstalledResources('themes').forEach(theme => {
|
||||
const version = [0, Gtk.MINOR_VERSION].find(gtkVersion => {
|
||||
if (gtkVersion % 2)
|
||||
gtkVersion += 1;
|
||||
const cssFile = Gio.File.new_for_path(GLib.build_filenamev([theme.get('path'), `gtk-3.${gtkVersion}`, 'gtk.css']));
|
||||
return cssFile.query_exists(null);
|
||||
});
|
||||
if (version !== undefined)
|
||||
themes.add(theme.get('name'));
|
||||
});
|
||||
return themes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the installed shell themes on the system.
|
||||
* @returns {Set<string>} A set containing all the installed shell themes names.
|
||||
*/
|
||||
function get_installed_shell_themes() {
|
||||
const themes = new Set(['']);
|
||||
get_installed_resources('themes').forEach(theme => {
|
||||
const theme_file = Gio.File.new_for_path(GLib.build_filenamev([theme.get('path'), 'gnome-shell', 'gnome-shell.css']));
|
||||
if ( theme_file.query_exists(null) ) {
|
||||
themes.add(theme.get('name'));
|
||||
}
|
||||
});
|
||||
return themes;
|
||||
function getInstalledShellThemes() {
|
||||
const themes = new Set(['']);
|
||||
getInstalledResources('themes').forEach(theme => {
|
||||
const themeFile = Gio.File.new_for_path(GLib.build_filenamev([theme.get('path'), 'gnome-shell', 'gnome-shell.css']));
|
||||
if (themeFile.query_exists(null))
|
||||
themes.add(theme.get('name'));
|
||||
});
|
||||
return themes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the installed icon themes on the system.
|
||||
* @returns {Set<string>} A set containing all the installed icon themes names.
|
||||
*/
|
||||
function get_installed_icon_themes() {
|
||||
const themes = new Set();
|
||||
get_installed_resources('icons').forEach(theme => {
|
||||
const theme_file = Gio.File.new_for_path(GLib.build_filenamev([theme.get('path'), 'index.theme']));
|
||||
if ( theme_file.query_exists(null) ) {
|
||||
themes.add(theme.get('name'));
|
||||
}
|
||||
});
|
||||
themes.delete('default');
|
||||
return themes;
|
||||
function getInstalledIconThemes() {
|
||||
const themes = new Set();
|
||||
getInstalledResources('icons').forEach(theme => {
|
||||
const themeFile = Gio.File.new_for_path(GLib.build_filenamev([theme.get('path'), 'index.theme']));
|
||||
if (themeFile.query_exists(null))
|
||||
themes.add(theme.get('name'));
|
||||
});
|
||||
themes.delete('default');
|
||||
return themes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the installed cursor themes on the system.
|
||||
* @returns {Set<string>} A set containing all the installed cursor themes names.
|
||||
*/
|
||||
function get_installed_cursor_themes() {
|
||||
const themes = new Set();
|
||||
get_installed_resources('icons').forEach(theme => {
|
||||
const theme_file = Gio.File.new_for_path(GLib.build_filenamev([theme.get('path'), 'cursors']));
|
||||
if ( theme_file.query_exists(null) ) {
|
||||
themes.add(theme.get('name'));
|
||||
}
|
||||
});
|
||||
return themes;
|
||||
function getInstalledCursorThemes() {
|
||||
const themes = new Set();
|
||||
getInstalledResources('icons').forEach(theme => {
|
||||
const themeFile = Gio.File.new_for_path(GLib.build_filenamev([theme.get('path'), 'cursors']));
|
||||
if (themeFile.query_exists(null))
|
||||
themes.add(theme.get('name'));
|
||||
});
|
||||
return themes;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -175,8 +157,8 @@ function get_installed_cursor_themes() {
|
||||
* @returns {Object|undefined} The User Themes extension object or undefined if
|
||||
* it isn't installed.
|
||||
*/
|
||||
function get_userthemes_extension() {
|
||||
return compat.extension_manager_lookup('user-theme@gnome-shell-extensions.gcampax.github.com');
|
||||
function getUserthemesExtension() {
|
||||
return compat.extensionManagerLookup('user-theme@gnome-shell-extensions.gcampax.github.com');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -184,24 +166,19 @@ function get_userthemes_extension() {
|
||||
* @returns {Gio.Settings|null} The User Themes extension settings or null if
|
||||
* the extension isn't installed.
|
||||
*/
|
||||
function get_userthemes_settings() {
|
||||
let extension = get_userthemes_extension();
|
||||
|
||||
if ( !extension ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const schema_dir = extension.dir.get_child('schemas');
|
||||
const GioSSS = Gio.SettingsSchemaSource;
|
||||
let schemaSource;
|
||||
if ( schema_dir.query_exists(null) ) {
|
||||
schemaSource = GioSSS.new_from_directory(schema_dir.get_path(), GioSSS.get_default(), false);
|
||||
}
|
||||
else {
|
||||
schemaSource = GioSSS.get_default();
|
||||
}
|
||||
const schemaObj = schemaSource.lookup('org.gnome.shell.extensions.user-theme', true);
|
||||
return new Gio.Settings({ settings_schema: schemaObj });
|
||||
function getUserthemesSettings() {
|
||||
let extension = getUserthemesExtension();
|
||||
if (!extension)
|
||||
return null;
|
||||
const schemaDir = extension.dir.get_child('schemas');
|
||||
const GioSSS = Gio.SettingsSchemaSource;
|
||||
let schemaSource;
|
||||
if (schemaDir.query_exists(null))
|
||||
schemaSource = GioSSS.new_from_directory(schemaDir.get_path(), GioSSS.get_default(), false);
|
||||
else
|
||||
schemaSource = GioSSS.get_default();
|
||||
const schemaObj = schemaSource.lookup('org.gnome.shell.extensions.user-theme', true);
|
||||
return new Gio.Settings({ settings_schema: schemaObj });
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -209,26 +186,27 @@ function get_userthemes_settings() {
|
||||
* @param {string} theme The shell theme name.
|
||||
* @returns {string|null} Path to the shell theme stylesheet.
|
||||
*/
|
||||
function get_shell_theme_stylesheet(theme) {
|
||||
log_debug('Getting the ' + (theme ? `'${theme}'` : 'default') + ' theme shell stylesheet...');
|
||||
let stylesheet = null;
|
||||
if ( theme ) {
|
||||
const stylesheet_paths = get_resources_dirs_paths('themes').map(path => GLib.build_filenamev([path, theme, 'gnome-shell', 'gnome-shell.css']));
|
||||
stylesheet = stylesheet_paths.find(path => {
|
||||
const file = Gio.file_new_for_path(path);
|
||||
return file.query_exists(null);
|
||||
});
|
||||
}
|
||||
return stylesheet;
|
||||
function getShellThemeStylesheet(theme) {
|
||||
const themeName = theme ? `'${theme}'` : 'default';
|
||||
logDebug(`Getting the ${themeName} theme shell stylesheet...`);
|
||||
let stylesheet = null;
|
||||
if (theme) {
|
||||
const stylesheetPaths = getResourcesDirsPaths('themes').map(path => GLib.build_filenamev([path, theme, 'gnome-shell', 'gnome-shell.css']));
|
||||
stylesheet = stylesheetPaths.find(path => {
|
||||
const file = Gio.file_new_for_path(path);
|
||||
return file.query_exists(null);
|
||||
});
|
||||
}
|
||||
return stylesheet;
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply a stylesheet to the shell.
|
||||
* @param {string} stylesheet The shell stylesheet to apply.
|
||||
*/
|
||||
function apply_shell_stylesheet(stylesheet) {
|
||||
log_debug('Applying shell stylesheet...');
|
||||
imports.ui.main.setThemeStylesheet(stylesheet);
|
||||
imports.ui.main.loadTheme();
|
||||
log_debug('Shell stylesheet applied.');
|
||||
function applyShellStylesheet(stylesheet) {
|
||||
logDebug('Applying shell stylesheet...');
|
||||
imports.ui.main.setThemeStylesheet(stylesheet);
|
||||
imports.ui.main.loadTheme();
|
||||
logDebug('Shell stylesheet applied.');
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
env:
|
||||
commonjs: true
|
||||
node: true
|
||||
+12
-12
@@ -21,25 +21,25 @@ const { Variants } = require('./_variants');
|
||||
|
||||
|
||||
test('Adapta', t => {
|
||||
const variants = Variants.guess_from('Adapta');
|
||||
t.is(variants.get('day'), 'Adapta');
|
||||
t.is(variants.get('night'), 'Adapta-Nokto')
|
||||
const variants = Variants.guessFrom('Adapta');
|
||||
t.is(variants.get('day'), 'Adapta');
|
||||
t.is(variants.get('night'), 'Adapta-Nokto');
|
||||
});
|
||||
|
||||
test('Adapta-Nokto', t => {
|
||||
const variants = Variants.guess_from('Adapta-Nokto');
|
||||
t.is(variants.get('day'), 'Adapta');
|
||||
t.is(variants.get('night'), 'Adapta-Nokto');
|
||||
const variants = Variants.guessFrom('Adapta-Nokto');
|
||||
t.is(variants.get('day'), 'Adapta');
|
||||
t.is(variants.get('night'), 'Adapta-Nokto');
|
||||
});
|
||||
|
||||
test('Adapta-Eta', t => {
|
||||
const variants = Variants.guess_from('Adapta-Eta');
|
||||
t.is(variants.get('day'), 'Adapta-Eta');
|
||||
t.is(variants.get('night'), 'Adapta-Nokto-Eta');
|
||||
const variants = Variants.guessFrom('Adapta-Eta');
|
||||
t.is(variants.get('day'), 'Adapta-Eta');
|
||||
t.is(variants.get('night'), 'Adapta-Nokto-Eta');
|
||||
});
|
||||
|
||||
test('Adapta-Nokto-Eta', t => {
|
||||
const variants = Variants.guess_from('Adapta-Nokto-Eta');
|
||||
t.is(variants.get('day'), 'Adapta-Eta');
|
||||
t.is(variants.get('night'), 'Adapta-Nokto-Eta');
|
||||
const variants = Variants.guessFrom('Adapta-Nokto-Eta');
|
||||
t.is(variants.get('day'), 'Adapta-Eta');
|
||||
t.is(variants.get('night'), 'Adapta-Nokto-Eta');
|
||||
});
|
||||
|
||||
@@ -21,13 +21,13 @@ const { Variants } = require('./_variants');
|
||||
|
||||
|
||||
test('Adwaita', t => {
|
||||
const variants = Variants.guess_from('Adwaita');
|
||||
t.is(variants.get('day'), 'Adwaita');
|
||||
t.is(variants.get('night'), 'Adwaita-dark');
|
||||
const variants = Variants.guessFrom('Adwaita');
|
||||
t.is(variants.get('day'), 'Adwaita');
|
||||
t.is(variants.get('night'), 'Adwaita-dark');
|
||||
});
|
||||
|
||||
test('Adwaita-dark', t => {
|
||||
const variants = Variants.guess_from('Adwaita-dark');
|
||||
t.is(variants.get('day'), 'Adwaita');
|
||||
t.is(variants.get('night'), 'Adwaita-dark');
|
||||
const variants = Variants.guessFrom('Adwaita-dark');
|
||||
t.is(variants.get('day'), 'Adwaita');
|
||||
t.is(variants.get('night'), 'Adwaita-dark');
|
||||
});
|
||||
|
||||
+18
-18
@@ -21,37 +21,37 @@ const { Variants } = require('./_variants');
|
||||
|
||||
|
||||
test('Arc', t => {
|
||||
const variants = Variants.guess_from('Arc');
|
||||
t.is(variants.get('day'), 'Arc');
|
||||
t.is(variants.get('night'), 'Arc-Dark');
|
||||
const variants = Variants.guessFrom('Arc');
|
||||
t.is(variants.get('day'), 'Arc');
|
||||
t.is(variants.get('night'), 'Arc-Dark');
|
||||
});
|
||||
|
||||
test('Arc-Dark', t => {
|
||||
const variants = Variants.guess_from('Arc-Dark');
|
||||
t.is(variants.get('day'), 'Arc');
|
||||
t.is(variants.get('night'), 'Arc-Dark');
|
||||
const variants = Variants.guessFrom('Arc-Dark');
|
||||
t.is(variants.get('day'), 'Arc');
|
||||
t.is(variants.get('night'), 'Arc-Dark');
|
||||
});
|
||||
|
||||
test('Arc-Darker', t => {
|
||||
const variants = Variants.guess_from('Arc-Darker');
|
||||
t.is(variants.get('day'), 'Arc-Darker');
|
||||
t.is(variants.get('night'), 'Arc-Dark');
|
||||
const variants = Variants.guessFrom('Arc-Darker');
|
||||
t.is(variants.get('day'), 'Arc-Darker');
|
||||
t.is(variants.get('night'), 'Arc-Dark');
|
||||
});
|
||||
|
||||
test('Arc-Darker-solid', t => {
|
||||
const variants = Variants.guess_from('Arc-Darker-solid');
|
||||
t.is(variants.get('day'), 'Arc-Darker-solid');
|
||||
t.is(variants.get('night'), 'Arc-Dark-solid');
|
||||
const variants = Variants.guessFrom('Arc-Darker-solid');
|
||||
t.is(variants.get('day'), 'Arc-Darker-solid');
|
||||
t.is(variants.get('night'), 'Arc-Dark-solid');
|
||||
});
|
||||
|
||||
test('Arc-Dark-solid', t => {
|
||||
const variants = Variants.guess_from('Arc-Dark-solid');
|
||||
t.is(variants.get('day'), 'Arc-solid');
|
||||
t.is(variants.get('night'), 'Arc-Dark-solid');
|
||||
const variants = Variants.guessFrom('Arc-Dark-solid');
|
||||
t.is(variants.get('day'), 'Arc-solid');
|
||||
t.is(variants.get('night'), 'Arc-Dark-solid');
|
||||
});
|
||||
|
||||
test('Arc-solid', t => {
|
||||
const variants = Variants.guess_from('Arc-solid');
|
||||
t.is(variants.get('day'), 'Arc-solid');
|
||||
t.is(variants.get('night'), 'Arc-Dark-solid');
|
||||
const variants = Variants.guessFrom('Arc-solid');
|
||||
t.is(variants.get('day'), 'Arc-solid');
|
||||
t.is(variants.get('night'), 'Arc-Dark-solid');
|
||||
});
|
||||
|
||||
+15
-15
@@ -21,21 +21,21 @@ const { Variants } = require('./_variants');
|
||||
|
||||
|
||||
['Blue', 'Green', 'Orange'].forEach(color => {
|
||||
test(`Cabinet-${color}`, t => {
|
||||
const variants = Variants.guess_from(`Cabinet-Light-${color}`);
|
||||
t.is(variants.get('day'), `Cabinet-Light-${color}`);
|
||||
t.is(variants.get('night'), `Cabinet-Dark-${color}`);
|
||||
});
|
||||
test(`Cabinet-${color}`, t => {
|
||||
const variants = Variants.guessFrom(`Cabinet-Light-${color}`);
|
||||
t.is(variants.get('day'), `Cabinet-Light-${color}`);
|
||||
t.is(variants.get('night'), `Cabinet-Dark-${color}`);
|
||||
});
|
||||
|
||||
test(`Cabinet-Dark-${color}`, t => {
|
||||
const variants = Variants.guess_from(`Cabinet-Dark-${color}`);
|
||||
t.is(variants.get('day'), `Cabinet-Light-${color}`);
|
||||
t.is(variants.get('night'), `Cabinet-Dark-${color}`);
|
||||
});
|
||||
test(`Cabinet-Dark-${color}`, t => {
|
||||
const variants = Variants.guessFrom(`Cabinet-Dark-${color}`);
|
||||
t.is(variants.get('day'), `Cabinet-Light-${color}`);
|
||||
t.is(variants.get('night'), `Cabinet-Dark-${color}`);
|
||||
});
|
||||
|
||||
test(`Cabinet-Darker-${color}`, t => {
|
||||
const variants = Variants.guess_from(`Cabinet-Darker-${color}`);
|
||||
t.is(variants.get('day'), `Cabinet-Darker-${color}`);
|
||||
t.is(variants.get('night'), `Cabinet-Dark-${color}`);
|
||||
});
|
||||
test(`Cabinet-Darker-${color}`, t => {
|
||||
const variants = Variants.guessFrom(`Cabinet-Darker-${color}`);
|
||||
t.is(variants.get('day'), `Cabinet-Darker-${color}`);
|
||||
t.is(variants.get('night'), `Cabinet-Dark-${color}`);
|
||||
});
|
||||
});
|
||||
|
||||
+30
-30
@@ -21,39 +21,39 @@ const { Variants } = require('./_variants');
|
||||
|
||||
|
||||
['', '-blue', '-indigo'].forEach(color => {
|
||||
test(`Canta${color}`, t => {
|
||||
const variants = Variants.guess_from(`Canta${color}`);
|
||||
t.is(variants.get('day'), `Canta${color}`);
|
||||
t.is(variants.get('night'), `Canta${color}-dark`);
|
||||
});
|
||||
test(`Canta${color}`, t => {
|
||||
const variants = Variants.guessFrom(`Canta${color}`);
|
||||
t.is(variants.get('day'), `Canta${color}`);
|
||||
t.is(variants.get('night'), `Canta${color}-dark`);
|
||||
});
|
||||
|
||||
test(`Canta${color}-dark`, t => {
|
||||
const variants = Variants.guess_from(`Canta${color}-dark`);
|
||||
t.is(variants.get('day'), `Canta${color}`);
|
||||
t.is(variants.get('night'), `Canta${color}-dark`);
|
||||
});
|
||||
test(`Canta${color}-dark`, t => {
|
||||
const variants = Variants.guessFrom(`Canta${color}-dark`);
|
||||
t.is(variants.get('day'), `Canta${color}`);
|
||||
t.is(variants.get('night'), `Canta${color}-dark`);
|
||||
});
|
||||
|
||||
test(`Canta${color}-light`, t => {
|
||||
const variants = Variants.guess_from(`Canta${color}-light`);
|
||||
t.is(variants.get('day'), `Canta${color}-light`);
|
||||
t.is(variants.get('night'), `Canta${color}-dark`);
|
||||
});
|
||||
test(`Canta${color}-light`, t => {
|
||||
const variants = Variants.guessFrom(`Canta${color}-light`);
|
||||
t.is(variants.get('day'), `Canta${color}-light`);
|
||||
t.is(variants.get('night'), `Canta${color}-dark`);
|
||||
});
|
||||
|
||||
test(`Canta${color}-compact`, t => {
|
||||
const variants = Variants.guess_from(`Canta${color}-compact`);
|
||||
t.is(variants.get('day'), `Canta${color}-compact`);
|
||||
t.is(variants.get('night'), `Canta${color}-dark-compact`);
|
||||
});
|
||||
test(`Canta${color}-compact`, t => {
|
||||
const variants = Variants.guessFrom(`Canta${color}-compact`);
|
||||
t.is(variants.get('day'), `Canta${color}-compact`);
|
||||
t.is(variants.get('night'), `Canta${color}-dark-compact`);
|
||||
});
|
||||
|
||||
test(`Canta${color}-dark-compact`, t => {
|
||||
const variants = Variants.guess_from(`Canta${color}-dark-compact`);
|
||||
t.is(variants.get('day'), `Canta${color}-compact`);
|
||||
t.is(variants.get('night'), `Canta${color}-dark-compact`);
|
||||
});
|
||||
test(`Canta${color}-dark-compact`, t => {
|
||||
const variants = Variants.guessFrom(`Canta${color}-dark-compact`);
|
||||
t.is(variants.get('day'), `Canta${color}-compact`);
|
||||
t.is(variants.get('night'), `Canta${color}-dark-compact`);
|
||||
});
|
||||
|
||||
test(`Canta${color}-light-compact`, t => {
|
||||
const variants = Variants.guess_from(`Canta${color}-light-compact`);
|
||||
t.is(variants.get('day'), `Canta${color}-light-compact`);
|
||||
t.is(variants.get('night'), `Canta${color}-dark-compact`);
|
||||
});
|
||||
test(`Canta${color}-light-compact`, t => {
|
||||
const variants = Variants.guessFrom(`Canta${color}-light-compact`);
|
||||
t.is(variants.get('day'), `Canta${color}-light-compact`);
|
||||
t.is(variants.get('night'), `Canta${color}-dark-compact`);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -20,21 +20,21 @@ const test = require('ava');
|
||||
const { Variants } = require('./_variants');
|
||||
|
||||
['', '-compact'].forEach(size => {
|
||||
test(`ChromeOS${size}`, t => {
|
||||
const variants = Variants.guess_from(`ChromeOS${size}`);
|
||||
t.is(variants.get('day'), `ChromeOS${size}`);
|
||||
t.is(variants.get('night'), `ChromeOS-dark${size}`);
|
||||
});
|
||||
test(`ChromeOS${size}`, t => {
|
||||
const variants = Variants.guessFrom(`ChromeOS${size}`);
|
||||
t.is(variants.get('day'), `ChromeOS${size}`);
|
||||
t.is(variants.get('night'), `ChromeOS-dark${size}`);
|
||||
});
|
||||
|
||||
test(`ChromeOS-dark${size}`, t => {
|
||||
const variants = Variants.guess_from(`ChromeOS-dark${size}`);
|
||||
t.is(variants.get('day'), `ChromeOS${size}`);
|
||||
t.is(variants.get('night'), `ChromeOS-dark${size}`);
|
||||
});
|
||||
test(`ChromeOS-dark${size}`, t => {
|
||||
const variants = Variants.guessFrom(`ChromeOS-dark${size}`);
|
||||
t.is(variants.get('day'), `ChromeOS${size}`);
|
||||
t.is(variants.get('night'), `ChromeOS-dark${size}`);
|
||||
});
|
||||
|
||||
test(`ChromeOS-light${size}`, t => {
|
||||
const variants = Variants.guess_from(`ChromeOS-light${size}`);
|
||||
t.is(variants.get('day'), `ChromeOS-light${size}`);
|
||||
t.is(variants.get('night'), `ChromeOS-dark${size}`);
|
||||
});
|
||||
})
|
||||
test(`ChromeOS-light${size}`, t => {
|
||||
const variants = Variants.guessFrom(`ChromeOS-light${size}`);
|
||||
t.is(variants.get('day'), `ChromeOS-light${size}`);
|
||||
t.is(variants.get('night'), `ChromeOS-dark${size}`);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -21,63 +21,63 @@ const { Variants } = require('./_variants');
|
||||
|
||||
|
||||
['Blue', 'Green', 'Red', 'Yellow'].forEach(color => {
|
||||
test(`Flat-Remix-GTK-${color}`, t => {
|
||||
const variants = Variants.guess_from(`Flat-Remix-GTK-${color}`);
|
||||
t.is(variants.get('day'), `Flat-Remix-GTK-${color}`);
|
||||
t.is(variants.get('night'), `Flat-Remix-GTK-${color}-Dark`);
|
||||
});
|
||||
test(`Flat-Remix-GTK-${color}`, t => {
|
||||
const variants = Variants.guessFrom(`Flat-Remix-GTK-${color}`);
|
||||
t.is(variants.get('day'), `Flat-Remix-GTK-${color}`);
|
||||
t.is(variants.get('night'), `Flat-Remix-GTK-${color}-Dark`);
|
||||
});
|
||||
|
||||
test(`Flat-Remix-GTK-${color}-Dark`, t => {
|
||||
const variants = Variants.guess_from(`Flat-Remix-GTK-${color}-Dark`);
|
||||
t.is(variants.get('day'), `Flat-Remix-GTK-${color}`);
|
||||
t.is(variants.get('night'), `Flat-Remix-GTK-${color}-Dark`);
|
||||
});
|
||||
test(`Flat-Remix-GTK-${color}-Dark`, t => {
|
||||
const variants = Variants.guessFrom(`Flat-Remix-GTK-${color}-Dark`);
|
||||
t.is(variants.get('day'), `Flat-Remix-GTK-${color}`);
|
||||
t.is(variants.get('night'), `Flat-Remix-GTK-${color}-Dark`);
|
||||
});
|
||||
|
||||
test(`Flat-Remix-GTK-${color}-Darker`, t => {
|
||||
const variants = Variants.guess_from(`Flat-Remix-GTK-${color}-Darker`);
|
||||
t.is(variants.get('day'), `Flat-Remix-GTK-${color}-Darker`);
|
||||
t.is(variants.get('night'), `Flat-Remix-GTK-${color}-Dark`);
|
||||
});
|
||||
test(`Flat-Remix-GTK-${color}-Darker`, t => {
|
||||
const variants = Variants.guessFrom(`Flat-Remix-GTK-${color}-Darker`);
|
||||
t.is(variants.get('day'), `Flat-Remix-GTK-${color}-Darker`);
|
||||
t.is(variants.get('night'), `Flat-Remix-GTK-${color}-Dark`);
|
||||
});
|
||||
|
||||
test(`Flat-Remix-GTK-${color}-Darker-Solid`, t => {
|
||||
const variants = Variants.guess_from(`Flat-Remix-GTK-${color}-Darker-Solid`);
|
||||
t.is(variants.get('day'), `Flat-Remix-GTK-${color}-Darker-Solid`);
|
||||
t.is(variants.get('night'), `Flat-Remix-GTK-${color}-Dark-Solid`);
|
||||
});
|
||||
test(`Flat-Remix-GTK-${color}-Darker-Solid`, t => {
|
||||
const variants = Variants.guessFrom(`Flat-Remix-GTK-${color}-Darker-Solid`);
|
||||
t.is(variants.get('day'), `Flat-Remix-GTK-${color}-Darker-Solid`);
|
||||
t.is(variants.get('night'), `Flat-Remix-GTK-${color}-Dark-Solid`);
|
||||
});
|
||||
|
||||
test(`Flat-Remix-GTK-${color}-Darkest`, t => {
|
||||
const variants = Variants.guess_from(`Flat-Remix-GTK-${color}-Darkest`);
|
||||
t.is(variants.get('day'), `Flat-Remix-GTK-${color}`);
|
||||
t.is(variants.get('night'), `Flat-Remix-GTK-${color}-Darkest`);
|
||||
});
|
||||
test(`Flat-Remix-GTK-${color}-Darkest`, t => {
|
||||
const variants = Variants.guessFrom(`Flat-Remix-GTK-${color}-Darkest`);
|
||||
t.is(variants.get('day'), `Flat-Remix-GTK-${color}`);
|
||||
t.is(variants.get('night'), `Flat-Remix-GTK-${color}-Darkest`);
|
||||
});
|
||||
|
||||
test(`Flat-Remix-GTK-${color}-Darkest-NoBorder`, t => {
|
||||
const variants = Variants.guess_from(`Flat-Remix-GTK-${color}-Darkest-NoBorder`);
|
||||
t.is(variants.get('day'), `Flat-Remix-GTK-${color}`);
|
||||
t.is(variants.get('night'), `Flat-Remix-GTK-${color}-Darkest-NoBorder`);
|
||||
});
|
||||
test(`Flat-Remix-GTK-${color}-Darkest-NoBorder`, t => {
|
||||
const variants = Variants.guessFrom(`Flat-Remix-GTK-${color}-Darkest-NoBorder`);
|
||||
t.is(variants.get('day'), `Flat-Remix-GTK-${color}`);
|
||||
t.is(variants.get('night'), `Flat-Remix-GTK-${color}-Darkest-NoBorder`);
|
||||
});
|
||||
|
||||
test(`Flat-Remix-GTK-${color}-Darkest-Solid`, t => {
|
||||
const variants = Variants.guess_from(`Flat-Remix-GTK-${color}-Darkest-Solid`);
|
||||
t.is(variants.get('day'), `Flat-Remix-GTK-${color}-Solid`);
|
||||
t.is(variants.get('night'), `Flat-Remix-GTK-${color}-Darkest-Solid`);
|
||||
});
|
||||
test(`Flat-Remix-GTK-${color}-Darkest-Solid`, t => {
|
||||
const variants = Variants.guessFrom(`Flat-Remix-GTK-${color}-Darkest-Solid`);
|
||||
t.is(variants.get('day'), `Flat-Remix-GTK-${color}-Solid`);
|
||||
t.is(variants.get('night'), `Flat-Remix-GTK-${color}-Darkest-Solid`);
|
||||
});
|
||||
|
||||
test(`Flat-Remix-GTK-${color}-Darkest-Solid-NoBorder`, t => {
|
||||
const variants = Variants.guess_from(`Flat-Remix-GTK-${color}-Darkest-Solid-NoBorder`);
|
||||
t.is(variants.get('day'), `Flat-Remix-GTK-${color}-Solid`);
|
||||
t.is(variants.get('night'), `Flat-Remix-GTK-${color}-Darkest-Solid-NoBorder`);
|
||||
});
|
||||
test(`Flat-Remix-GTK-${color}-Darkest-Solid-NoBorder`, t => {
|
||||
const variants = Variants.guessFrom(`Flat-Remix-GTK-${color}-Darkest-Solid-NoBorder`);
|
||||
t.is(variants.get('day'), `Flat-Remix-GTK-${color}-Solid`);
|
||||
t.is(variants.get('night'), `Flat-Remix-GTK-${color}-Darkest-Solid-NoBorder`);
|
||||
});
|
||||
|
||||
test(`Flat-Remix-GTK-${color}-Dark-Solid`, t => {
|
||||
const variants = Variants.guess_from(`Flat-Remix-GTK-${color}-Dark-Solid`);
|
||||
t.is(variants.get('day'), `Flat-Remix-GTK-${color}-Solid`);
|
||||
t.is(variants.get('night'), `Flat-Remix-GTK-${color}-Dark-Solid`);
|
||||
});
|
||||
test(`Flat-Remix-GTK-${color}-Dark-Solid`, t => {
|
||||
const variants = Variants.guessFrom(`Flat-Remix-GTK-${color}-Dark-Solid`);
|
||||
t.is(variants.get('day'), `Flat-Remix-GTK-${color}-Solid`);
|
||||
t.is(variants.get('night'), `Flat-Remix-GTK-${color}-Dark-Solid`);
|
||||
});
|
||||
|
||||
test(`Flat-Remix-GTK-${color}-Solid`, t => {
|
||||
const variants = Variants.guess_from(`Flat-Remix-GTK-${color}-Solid`);
|
||||
t.is(variants.get('day'), `Flat-Remix-GTK-${color}-Solid`);
|
||||
t.is(variants.get('night'), `Flat-Remix-GTK-${color}-Dark-Solid`);
|
||||
});
|
||||
test(`Flat-Remix-GTK-${color}-Solid`, t => {
|
||||
const variants = Variants.guessFrom(`Flat-Remix-GTK-${color}-Solid`);
|
||||
t.is(variants.get('day'), `Flat-Remix-GTK-${color}-Solid`);
|
||||
t.is(variants.get('night'), `Flat-Remix-GTK-${color}-Dark-Solid`);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -21,13 +21,13 @@ const { Variants } = require('./_variants');
|
||||
|
||||
|
||||
test('HighContrast', t => {
|
||||
const variants = Variants.guess_from('HighContrast');
|
||||
t.is(variants.get('day'), 'HighContrast');
|
||||
t.is(variants.get('night'), 'HighContrastInverse');
|
||||
const variants = Variants.guessFrom('HighContrast');
|
||||
t.is(variants.get('day'), 'HighContrast');
|
||||
t.is(variants.get('night'), 'HighContrastInverse');
|
||||
});
|
||||
|
||||
test('HighContrastInverse', t => {
|
||||
const variants = Variants.guess_from('HighContrastInverse');
|
||||
t.is(variants.get('day'), 'HighContrast');
|
||||
t.is(variants.get('night'), 'HighContrastInverse');
|
||||
const variants = Variants.guessFrom('HighContrastInverse');
|
||||
t.is(variants.get('day'), 'HighContrast');
|
||||
t.is(variants.get('night'), 'HighContrastInverse');
|
||||
});
|
||||
|
||||
+18
-18
@@ -21,37 +21,37 @@ const { Variants } = require('./_variants');
|
||||
|
||||
|
||||
test('Layan', t => {
|
||||
const variants = Variants.guess_from('Layan');
|
||||
t.is(variants.get('day'), 'Layan');
|
||||
t.is(variants.get('night'), 'Layan-dark');
|
||||
const variants = Variants.guessFrom('Layan');
|
||||
t.is(variants.get('day'), 'Layan');
|
||||
t.is(variants.get('night'), 'Layan-dark');
|
||||
});
|
||||
|
||||
test('Layan-dark', t => {
|
||||
const variants = Variants.guess_from('Layan-dark');
|
||||
t.is(variants.get('day'), 'Layan');
|
||||
t.is(variants.get('night'), 'Layan-dark');
|
||||
const variants = Variants.guessFrom('Layan-dark');
|
||||
t.is(variants.get('day'), 'Layan');
|
||||
t.is(variants.get('night'), 'Layan-dark');
|
||||
});
|
||||
|
||||
test('Layan-light', t => {
|
||||
const variants = Variants.guess_from('Layan-light');
|
||||
t.is(variants.get('day'), 'Layan-light');
|
||||
t.is(variants.get('night'), 'Layan-dark');
|
||||
const variants = Variants.guessFrom('Layan-light');
|
||||
t.is(variants.get('day'), 'Layan-light');
|
||||
t.is(variants.get('night'), 'Layan-dark');
|
||||
});
|
||||
|
||||
test('Layan-solid', t => {
|
||||
const variants = Variants.guess_from('Layan-solid');
|
||||
t.is(variants.get('day'), 'Layan-solid');
|
||||
t.is(variants.get('night'), 'Layan-dark-solid');
|
||||
const variants = Variants.guessFrom('Layan-solid');
|
||||
t.is(variants.get('day'), 'Layan-solid');
|
||||
t.is(variants.get('night'), 'Layan-dark-solid');
|
||||
});
|
||||
|
||||
test('Layan-dark-solid', t => {
|
||||
const variants = Variants.guess_from('Layan-dark-solid');
|
||||
t.is(variants.get('day'), 'Layan-solid');
|
||||
t.is(variants.get('night'), 'Layan-dark-solid');
|
||||
const variants = Variants.guessFrom('Layan-dark-solid');
|
||||
t.is(variants.get('day'), 'Layan-solid');
|
||||
t.is(variants.get('night'), 'Layan-dark-solid');
|
||||
});
|
||||
|
||||
test('Layan-light-solid', t => {
|
||||
const variants = Variants.guess_from('Layan-light-solid');
|
||||
t.is(variants.get('day'), 'Layan-light-solid');
|
||||
t.is(variants.get('night'), 'Layan-dark-solid');
|
||||
const variants = Variants.guessFrom('Layan-light-solid');
|
||||
t.is(variants.get('day'), 'Layan-light-solid');
|
||||
t.is(variants.get('night'), 'Layan-dark-solid');
|
||||
});
|
||||
|
||||
@@ -21,17 +21,17 @@ const { Variants } = require('./_variants');
|
||||
|
||||
|
||||
['', '-Slim'].forEach(size => {
|
||||
['-blue', '-green', '-orange', '-purple', '-red', '-yellow'].forEach(color => {
|
||||
test(`Macwaita${color}${size}`, t => {
|
||||
const variants = Variants.guess_from(`Macwaita${color}${size}`);
|
||||
t.is(variants.get('day'), `Macwaita${color}${size}`);
|
||||
t.is(variants.get('night'), `Macwaita-dark${color}${size}`);
|
||||
});
|
||||
['-blue', '-green', '-orange', '-purple', '-red', '-yellow'].forEach(color => {
|
||||
test(`Macwaita${color}${size}`, t => {
|
||||
const variants = Variants.guessFrom(`Macwaita${color}${size}`);
|
||||
t.is(variants.get('day'), `Macwaita${color}${size}`);
|
||||
t.is(variants.get('night'), `Macwaita-dark${color}${size}`);
|
||||
});
|
||||
|
||||
test(`Macwaita-dark${color}${size}`, t => {
|
||||
const variants = Variants.guess_from(`Macwaita-dark${color}${size}`);
|
||||
t.is(variants.get('day'), `Macwaita${color}${size}`);
|
||||
t.is(variants.get('night'), `Macwaita-dark${color}${size}`);
|
||||
});
|
||||
});
|
||||
test(`Macwaita-dark${color}${size}`, t => {
|
||||
const variants = Variants.guessFrom(`Macwaita-dark${color}${size}`);
|
||||
t.is(variants.get('day'), `Macwaita${color}${size}`);
|
||||
t.is(variants.get('night'), `Macwaita-dark${color}${size}`);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
+16
-16
@@ -21,21 +21,21 @@ const { Variants } = require('./_variants');
|
||||
|
||||
|
||||
['aliz', 'azul', 'sea'].forEach(color => {
|
||||
test(`Matcha-${color}`, t => {
|
||||
const variants = Variants.guess_from(`Matcha-${color}`);
|
||||
t.is(variants.get('day'), `Matcha-${color}`);
|
||||
t.is(variants.get('night'), `Matcha-dark-${color}`);
|
||||
});
|
||||
test(`Matcha-${color}`, t => {
|
||||
const variants = Variants.guessFrom(`Matcha-${color}`);
|
||||
t.is(variants.get('day'), `Matcha-${color}`);
|
||||
t.is(variants.get('night'), `Matcha-dark-${color}`);
|
||||
});
|
||||
|
||||
test(`Matcha-dark-${color}`, t => {
|
||||
const variants = Variants.guess_from(`Matcha-dark-${color}`);
|
||||
t.is(variants.get('day'), `Matcha-${color}`);
|
||||
t.is(variants.get('night'), `Matcha-dark-${color}`);
|
||||
});
|
||||
test(`Matcha-dark-${color}`, t => {
|
||||
const variants = Variants.guessFrom(`Matcha-dark-${color}`);
|
||||
t.is(variants.get('day'), `Matcha-${color}`);
|
||||
t.is(variants.get('night'), `Matcha-dark-${color}`);
|
||||
});
|
||||
|
||||
test(`Matcha-light-${color}`, t => {
|
||||
const variants = Variants.guess_from(`Matcha-light-${color}`);
|
||||
t.is(variants.get('day'), `Matcha-light-${color}`);
|
||||
t.is(variants.get('night'), `Matcha-dark-${color}`);
|
||||
});
|
||||
})
|
||||
test(`Matcha-light-${color}`, t => {
|
||||
const variants = Variants.guessFrom(`Matcha-light-${color}`);
|
||||
t.is(variants.get('day'), `Matcha-light-${color}`);
|
||||
t.is(variants.get('night'), `Matcha-dark-${color}`);
|
||||
});
|
||||
});
|
||||
|
||||
+16
-16
@@ -21,21 +21,21 @@ const { Variants } = require('./_variants');
|
||||
|
||||
|
||||
['', '-compact'].forEach(size => {
|
||||
test(`Materia${size}`, t => {
|
||||
const variants = Variants.guess_from(`Materia${size}`);
|
||||
t.is(variants.get('day'), `Materia${size}`);
|
||||
t.is(variants.get('night'), `Materia-dark${size}`);
|
||||
});
|
||||
test(`Materia${size}`, t => {
|
||||
const variants = Variants.guessFrom(`Materia${size}`);
|
||||
t.is(variants.get('day'), `Materia${size}`);
|
||||
t.is(variants.get('night'), `Materia-dark${size}`);
|
||||
});
|
||||
|
||||
test(`Materia-dark${size}`, t => {
|
||||
const variants = Variants.guess_from(`Materia-dark${size}`);
|
||||
t.is(variants.get('day'), `Materia${size}`);
|
||||
t.is(variants.get('night'), `Materia-dark${size}`);
|
||||
});
|
||||
test(`Materia-dark${size}`, t => {
|
||||
const variants = Variants.guessFrom(`Materia-dark${size}`);
|
||||
t.is(variants.get('day'), `Materia${size}`);
|
||||
t.is(variants.get('night'), `Materia-dark${size}`);
|
||||
});
|
||||
|
||||
test(`Materia-light${size}`, t => {
|
||||
const variants = Variants.guess_from(`Materia-light${size}`);
|
||||
t.is(variants.get('day'), `Materia-light${size}`);
|
||||
t.is(variants.get('night'), `Materia-dark${size}`);
|
||||
});
|
||||
})
|
||||
test(`Materia-light${size}`, t => {
|
||||
const variants = Variants.guessFrom(`Materia-light${size}`);
|
||||
t.is(variants.get('day'), `Materia-light${size}`);
|
||||
t.is(variants.get('night'), `Materia-dark${size}`);
|
||||
});
|
||||
});
|
||||
|
||||
+12
-12
@@ -21,17 +21,17 @@ const { Variants } = require('./_variants');
|
||||
|
||||
|
||||
['', '-solid'].forEach(transparency => {
|
||||
['', '-alt'].forEach(alt => {
|
||||
test(`Mojave-light${transparency}${alt}`, t => {
|
||||
const variants = Variants.guess_from(`Mojave-light${transparency}${alt}`);
|
||||
t.is(variants.get('day'), `Mojave-light${transparency}${alt}`);
|
||||
t.is(variants.get('night'), `Mojave-dark${transparency}${alt}`);
|
||||
});
|
||||
['', '-alt'].forEach(alt => {
|
||||
test(`Mojave-light${transparency}${alt}`, t => {
|
||||
const variants = Variants.guessFrom(`Mojave-light${transparency}${alt}`);
|
||||
t.is(variants.get('day'), `Mojave-light${transparency}${alt}`);
|
||||
t.is(variants.get('night'), `Mojave-dark${transparency}${alt}`);
|
||||
});
|
||||
|
||||
test(`Mojave-dark${transparency}${alt}`, t => {
|
||||
const variants = Variants.guess_from(`Mojave-dark${transparency}${alt}`);
|
||||
t.is(variants.get('day'), `Mojave-light${transparency}${alt}`);
|
||||
t.is(variants.get('night'), `Mojave-dark${transparency}${alt}`);
|
||||
});
|
||||
});
|
||||
test(`Mojave-dark${transparency}${alt}`, t => {
|
||||
const variants = Variants.guessFrom(`Mojave-dark${transparency}${alt}`);
|
||||
t.is(variants.get('day'), `Mojave-light${transparency}${alt}`);
|
||||
t.is(variants.get('night'), `Mojave-dark${transparency}${alt}`);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -20,13 +20,13 @@ const test = require('ava');
|
||||
const { Variants } = require('./_variants');
|
||||
|
||||
test('Nextwaita', t => {
|
||||
const variants = Variants.guess_from('Nextwaita-2.2');
|
||||
t.is(variants.get('day'), 'Nextwaita-2.2');
|
||||
t.is(variants.get('night'), 'Nextwaita-dark-2.2');
|
||||
const variants = Variants.guessFrom('Nextwaita-2.2');
|
||||
t.is(variants.get('day'), 'Nextwaita-2.2');
|
||||
t.is(variants.get('night'), 'Nextwaita-dark-2.2');
|
||||
});
|
||||
|
||||
test('Nextwaita-dark', t => {
|
||||
const variants = Variants.guess_from('Nextwaita-dark-2.2');
|
||||
t.is(variants.get('day'), 'Nextwaita-2.2');
|
||||
t.is(variants.get('night'), 'Nextwaita-dark-2.2');
|
||||
const variants = Variants.guessFrom('Nextwaita-dark-2.2');
|
||||
t.is(variants.get('day'), 'Nextwaita-2.2');
|
||||
t.is(variants.get('night'), 'Nextwaita-dark-2.2');
|
||||
});
|
||||
|
||||
+11
-11
@@ -21,15 +21,15 @@ const { Variants } = require('./_variants');
|
||||
|
||||
|
||||
['', '-compact'].forEach(size => {
|
||||
test(`Orchis${size}`, t => {
|
||||
const variants = Variants.guess_from(`Orchis${size}`);
|
||||
t.is(variants.get('day'), `Orchis${size}`);
|
||||
t.is(variants.get('night'), `Orchis-dark${size}`);
|
||||
});
|
||||
test(`Orchis${size}`, t => {
|
||||
const variants = Variants.guessFrom(`Orchis${size}`);
|
||||
t.is(variants.get('day'), `Orchis${size}`);
|
||||
t.is(variants.get('night'), `Orchis-dark${size}`);
|
||||
});
|
||||
|
||||
test(`Orchis-dark${size}`, t => {
|
||||
const variants = Variants.guess_from(`Orchis-dark${size}`);
|
||||
t.is(variants.get('day'), `Orchis${size}`);
|
||||
t.is(variants.get('night'), `Orchis-dark${size}`);
|
||||
});
|
||||
})
|
||||
test(`Orchis-dark${size}`, t => {
|
||||
const variants = Variants.guessFrom(`Orchis-dark${size}`);
|
||||
t.is(variants.get('day'), `Orchis${size}`);
|
||||
t.is(variants.get('night'), `Orchis-dark${size}`);
|
||||
});
|
||||
});
|
||||
|
||||
+16
-16
@@ -21,21 +21,21 @@ const { Variants } = require('./_variants');
|
||||
|
||||
|
||||
['', '-Compact'].forEach(size => {
|
||||
test(`Plata${size}`, t => {
|
||||
const variants = Variants.guess_from(`Plata${size}`);
|
||||
t.is(variants.get('day'), `Plata${size}`);
|
||||
t.is(variants.get('night'), `Plata-Noir${size}`);
|
||||
});
|
||||
test(`Plata${size}`, t => {
|
||||
const variants = Variants.guessFrom(`Plata${size}`);
|
||||
t.is(variants.get('day'), `Plata${size}`);
|
||||
t.is(variants.get('night'), `Plata-Noir${size}`);
|
||||
});
|
||||
|
||||
test(`Plata-Noir${size}`, t => {
|
||||
const variants = Variants.guess_from(`Plata-Noir${size}`);
|
||||
t.is(variants.get('day'), `Plata${size}`);
|
||||
t.is(variants.get('night'), `Plata-Noir${size}`);
|
||||
});
|
||||
test(`Plata-Noir${size}`, t => {
|
||||
const variants = Variants.guessFrom(`Plata-Noir${size}`);
|
||||
t.is(variants.get('day'), `Plata${size}`);
|
||||
t.is(variants.get('night'), `Plata-Noir${size}`);
|
||||
});
|
||||
|
||||
test(`Plata-Lumine${size}`, t => {
|
||||
const variants = Variants.guess_from(`Plata-Lumine${size}`);
|
||||
t.is(variants.get('day'), `Plata-Lumine${size}`);
|
||||
t.is(variants.get('night'), `Plata-Noir${size}`);
|
||||
});
|
||||
})
|
||||
test(`Plata-Lumine${size}`, t => {
|
||||
const variants = Variants.guessFrom(`Plata-Lumine${size}`);
|
||||
t.is(variants.get('day'), `Plata-Lumine${size}`);
|
||||
t.is(variants.get('night'), `Plata-Noir${size}`);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -21,25 +21,25 @@ const { Variants } = require('./_variants');
|
||||
|
||||
|
||||
test('Prof-Gnome-Light-3', t => {
|
||||
const variants = Variants.guess_from('Prof-Gnome-Light-3');
|
||||
t.is(variants.get('day'), 'Prof-Gnome-Light-3');
|
||||
t.is(variants.get('night'), 'Prof-Gnome-Dark-3');
|
||||
const variants = Variants.guessFrom('Prof-Gnome-Light-3');
|
||||
t.is(variants.get('day'), 'Prof-Gnome-Light-3');
|
||||
t.is(variants.get('night'), 'Prof-Gnome-Dark-3');
|
||||
});
|
||||
|
||||
test('Prof-Gnome-Dark-3', t => {
|
||||
const variants = Variants.guess_from('Prof-Gnome-Dark-3');
|
||||
t.is(variants.get('day'), 'Prof-Gnome-Light-3');
|
||||
t.is(variants.get('night'), 'Prof-Gnome-Dark-3');
|
||||
const variants = Variants.guessFrom('Prof-Gnome-Dark-3');
|
||||
t.is(variants.get('day'), 'Prof-Gnome-Light-3');
|
||||
t.is(variants.get('night'), 'Prof-Gnome-Dark-3');
|
||||
});
|
||||
|
||||
test('Prof-Gnome-Darker-3', t => {
|
||||
const variants = Variants.guess_from('Prof-Gnome-Darker-3');
|
||||
t.is(variants.get('day'), 'Prof-Gnome-Darker-3');
|
||||
t.is(variants.get('night'), 'Prof-Gnome-Dark-3');
|
||||
const variants = Variants.guessFrom('Prof-Gnome-Darker-3');
|
||||
t.is(variants.get('day'), 'Prof-Gnome-Darker-3');
|
||||
t.is(variants.get('night'), 'Prof-Gnome-Dark-3');
|
||||
});
|
||||
|
||||
test('Prof-Gnome-Light-DS-3', t => {
|
||||
const variants = Variants.guess_from('Prof-Gnome-Light-DS-3');
|
||||
t.is(variants.get('day'), 'Prof-Gnome-Light-DS-3');
|
||||
t.is(variants.get('night'), 'Prof-Gnome-Dark-3');
|
||||
const variants = Variants.guessFrom('Prof-Gnome-Light-DS-3');
|
||||
t.is(variants.get('day'), 'Prof-Gnome-Light-DS-3');
|
||||
t.is(variants.get('night'), 'Prof-Gnome-Dark-3');
|
||||
});
|
||||
|
||||
+17
-17
@@ -21,23 +21,23 @@ const { Variants } = require('./_variants');
|
||||
|
||||
|
||||
['', '-manjaro', '-ubuntu'].forEach(color => {
|
||||
['', '-win'].forEach(alt => {
|
||||
test(`Qogir${color}${alt}`, t => {
|
||||
const variants = Variants.guess_from(`Qogir${color}${alt}`);
|
||||
t.is(variants.get('day'), `Qogir${color}${alt}`);
|
||||
t.is(variants.get('night'), `Qogir${color}${alt}-dark`);
|
||||
});
|
||||
['', '-win'].forEach(alt => {
|
||||
test(`Qogir${color}${alt}`, t => {
|
||||
const variants = Variants.guessFrom(`Qogir${color}${alt}`);
|
||||
t.is(variants.get('day'), `Qogir${color}${alt}`);
|
||||
t.is(variants.get('night'), `Qogir${color}${alt}-dark`);
|
||||
});
|
||||
|
||||
test(`Qogir${color}${alt}-dark`, t => {
|
||||
const variants = Variants.guess_from(`Qogir${color}${alt}-dark`);
|
||||
t.is(variants.get('day'), `Qogir${color}${alt}`);
|
||||
t.is(variants.get('night'), `Qogir${color}${alt}-dark`);
|
||||
});
|
||||
test(`Qogir${color}${alt}-dark`, t => {
|
||||
const variants = Variants.guessFrom(`Qogir${color}${alt}-dark`);
|
||||
t.is(variants.get('day'), `Qogir${color}${alt}`);
|
||||
t.is(variants.get('night'), `Qogir${color}${alt}-dark`);
|
||||
});
|
||||
|
||||
test(`Qogir${color}${alt}light`, t => {
|
||||
const variants = Variants.guess_from(`Qogir${color}${alt}-light`);
|
||||
t.is(variants.get('day'), `Qogir${color}${alt}-light`);
|
||||
t.is(variants.get('night'), `Qogir${color}${alt}-dark`);
|
||||
});
|
||||
});
|
||||
test(`Qogir${color}${alt}light`, t => {
|
||||
const variants = Variants.guessFrom(`Qogir${color}${alt}-light`);
|
||||
t.is(variants.get('day'), `Qogir${color}${alt}-light`);
|
||||
t.is(variants.get('night'), `Qogir${color}${alt}-dark`);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -21,17 +21,17 @@ const { Variants } = require('./_variants');
|
||||
|
||||
|
||||
['', '_Blue', '_Cyan', '_Green', '_Orange', '_Purple'].forEach(color => {
|
||||
['', '_Envolved'].forEach(variant => {
|
||||
test(`Simply_Circles${color}_Light${variant}`, t => {
|
||||
const variants = Variants.guess_from(`Simply_Circles${color}_Light${variant}`);
|
||||
t.is(variants.get('day'), `Simply_Circles${color}_Light${variant}`);
|
||||
t.is(variants.get('night'), `Simply_Circles${color}_Dark${variant}`);
|
||||
});
|
||||
['', '_Envolved'].forEach(variant => {
|
||||
test(`Simply_Circles${color}_Light${variant}`, t => {
|
||||
const variants = Variants.guessFrom(`Simply_Circles${color}_Light${variant}`);
|
||||
t.is(variants.get('day'), `Simply_Circles${color}_Light${variant}`);
|
||||
t.is(variants.get('night'), `Simply_Circles${color}_Dark${variant}`);
|
||||
});
|
||||
|
||||
test(`Simply_Circles${color}${variant}`, t => {
|
||||
const variants = Variants.guess_from(`Simply_Circles${color}_Dark${variant}`);
|
||||
t.is(variants.get('day'), `Simply_Circles${color}_Light${variant}`);
|
||||
t.is(variants.get('night'), `Simply_Circles${color}_Dark${variant}`);
|
||||
});
|
||||
})
|
||||
test(`Simply_Circles${color}${variant}`, t => {
|
||||
const variants = Variants.guessFrom(`Simply_Circles${color}_Dark${variant}`);
|
||||
t.is(variants.get('day'), `Simply_Circles${color}_Light${variant}`);
|
||||
t.is(variants.get('night'), `Simply_Circles${color}_Dark${variant}`);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
+15
-15
@@ -20,31 +20,31 @@ const test = require('ava');
|
||||
const { Variants } = require('./_variants');
|
||||
|
||||
test('Teja', t => {
|
||||
const variants = Variants.guess_from('Teja');
|
||||
t.is(variants.get('day'), 'Teja');
|
||||
t.is(variants.get('night'), 'Teja_Dark');
|
||||
const variants = Variants.guessFrom('Teja');
|
||||
t.is(variants.get('day'), 'Teja');
|
||||
t.is(variants.get('night'), 'Teja_Dark');
|
||||
});
|
||||
|
||||
test('Teja_Dark', t => {
|
||||
const variants = Variants.guess_from('Teja_Dark');
|
||||
t.is(variants.get('day'), 'Teja');
|
||||
t.is(variants.get('night'), 'Teja_Dark');
|
||||
const variants = Variants.guessFrom('Teja_Dark');
|
||||
t.is(variants.get('day'), 'Teja');
|
||||
t.is(variants.get('night'), 'Teja_Dark');
|
||||
});
|
||||
|
||||
test('Teja_Darkest', t => {
|
||||
const variants = Variants.guess_from('Teja_Darkest');
|
||||
t.is(variants.get('day'), 'Teja');
|
||||
t.is(variants.get('night'), 'Teja_Darkest');
|
||||
const variants = Variants.guessFrom('Teja_Darkest');
|
||||
t.is(variants.get('day'), 'Teja');
|
||||
t.is(variants.get('night'), 'Teja_Darkest');
|
||||
});
|
||||
|
||||
test('Teja_Black', t => {
|
||||
const variants = Variants.guess_from('Teja_Black');
|
||||
t.is(variants.get('day'), 'Teja');
|
||||
t.is(variants.get('night'), 'Teja_Black');
|
||||
const variants = Variants.guessFrom('Teja_Black');
|
||||
t.is(variants.get('day'), 'Teja');
|
||||
t.is(variants.get('night'), 'Teja_Black');
|
||||
});
|
||||
|
||||
test('Teja_Light', t => {
|
||||
const variants = Variants.guess_from('Teja_Light');
|
||||
t.is(variants.get('day'), 'Teja_Light');
|
||||
t.is(variants.get('night'), 'Teja_Dark');
|
||||
const variants = Variants.guessFrom('Teja_Light');
|
||||
t.is(variants.get('day'), 'Teja_Light');
|
||||
t.is(variants.get('night'), 'Teja_Dark');
|
||||
});
|
||||
|
||||
+17
-17
@@ -21,22 +21,22 @@ const { Variants } = require('./_variants');
|
||||
|
||||
|
||||
['', '-laptop'].forEach(size => {
|
||||
['', '-beryl', '-doder', '-ruby'].forEach(color => {
|
||||
test(`vimix${size}${color}`, t => {
|
||||
const variants = Variants.guess_from(`vimix${size}${color}`);
|
||||
t.is(variants.get('day'), `vimix${size}${color}`);
|
||||
t.is(variants.get('night'), `vimix-dark${size}${color}`);
|
||||
});
|
||||
['', '-beryl', '-doder', '-ruby'].forEach(color => {
|
||||
test(`vimix${size}${color}`, t => {
|
||||
const variants = Variants.guessFrom(`vimix${size}${color}`);
|
||||
t.is(variants.get('day'), `vimix${size}${color}`);
|
||||
t.is(variants.get('night'), `vimix-dark${size}${color}`);
|
||||
});
|
||||
|
||||
test(`vimix-dark${size}${color}`, t => {
|
||||
const variants = Variants.guess_from(`vimix-dark${size}${color}`);
|
||||
t.is(variants.get('day'), `vimix${size}${color}`);
|
||||
t.is(variants.get('night'), `vimix-dark${size}${color}`);
|
||||
});
|
||||
test(`vimix-light${size}${color}`, t => {
|
||||
const variants = Variants.guess_from(`vimix-light${size}${color}`);
|
||||
t.is(variants.get('day'), `vimix-light${size}${color}`);
|
||||
t.is(variants.get('night'), `vimix-dark${size}${color}`);
|
||||
});
|
||||
});
|
||||
test(`vimix-dark${size}${color}`, t => {
|
||||
const variants = Variants.guessFrom(`vimix-dark${size}${color}`);
|
||||
t.is(variants.get('day'), `vimix${size}${color}`);
|
||||
t.is(variants.get('night'), `vimix-dark${size}${color}`);
|
||||
});
|
||||
test(`vimix-light${size}${color}`, t => {
|
||||
const variants = Variants.guessFrom(`vimix-light${size}${color}`);
|
||||
t.is(variants.get('day'), `vimix-light${size}${color}`);
|
||||
t.is(variants.get('night'), `vimix-dark${size}${color}`);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -21,19 +21,19 @@ const { Variants } = require('./_variants');
|
||||
|
||||
|
||||
test('Yaru', t => {
|
||||
const variants = Variants.guess_from('Yaru');
|
||||
t.is(variants.get('day'), 'Yaru');
|
||||
t.is(variants.get('night'), 'Yaru-dark');
|
||||
const variants = Variants.guessFrom('Yaru');
|
||||
t.is(variants.get('day'), 'Yaru');
|
||||
t.is(variants.get('night'), 'Yaru-dark');
|
||||
});
|
||||
|
||||
test('Yaru-dark', t => {
|
||||
const variants = Variants.guess_from('Yaru-dark');
|
||||
t.is(variants.get('day'), 'Yaru');
|
||||
t.is(variants.get('night'), 'Yaru-dark');
|
||||
const variants = Variants.guessFrom('Yaru-dark');
|
||||
t.is(variants.get('day'), 'Yaru');
|
||||
t.is(variants.get('night'), 'Yaru-dark');
|
||||
});
|
||||
|
||||
test('Yaru-light', t => {
|
||||
const variants = Variants.guess_from('Yaru-light');
|
||||
t.is(variants.get('day'), 'Yaru-light');
|
||||
t.is(variants.get('night'), 'Yaru-dark');
|
||||
const variants = Variants.guessFrom('Yaru-light');
|
||||
t.is(variants.get('day'), 'Yaru-light');
|
||||
t.is(variants.get('night'), 'Yaru-dark');
|
||||
});
|
||||
|
||||
+15
-15
@@ -20,31 +20,31 @@ const test = require('ava');
|
||||
const { Variants } = require('./_variants');
|
||||
|
||||
test('base', t => {
|
||||
const variants = Variants.guess_from('base');
|
||||
t.is(variants.get('day'), 'base');
|
||||
t.is(variants.get('night'), 'base-dark');
|
||||
const variants = Variants.guessFrom('base');
|
||||
t.is(variants.get('day'), 'base');
|
||||
t.is(variants.get('night'), 'base-dark');
|
||||
});
|
||||
|
||||
test('base-dark', t => {
|
||||
const variants = Variants.guess_from('base-dark');
|
||||
t.is(variants.get('day'), 'base');
|
||||
t.is(variants.get('night'), 'base-dark');
|
||||
const variants = Variants.guessFrom('base-dark');
|
||||
t.is(variants.get('day'), 'base');
|
||||
t.is(variants.get('night'), 'base-dark');
|
||||
});
|
||||
|
||||
test('base-light', t => {
|
||||
const variants = Variants.guess_from('base-light');
|
||||
t.is(variants.get('day'), 'base-light');
|
||||
t.is(variants.get('night'), 'base-dark');
|
||||
const variants = Variants.guessFrom('base-light');
|
||||
t.is(variants.get('day'), 'base-light');
|
||||
t.is(variants.get('night'), 'base-dark');
|
||||
});
|
||||
|
||||
test('base-darker', t => {
|
||||
const variants = Variants.guess_from('base-darker');
|
||||
t.is(variants.get('day'), 'base-darker');
|
||||
t.is(variants.get('night'), 'base-dark');
|
||||
const variants = Variants.guessFrom('base-darker');
|
||||
t.is(variants.get('day'), 'base-darker');
|
||||
t.is(variants.get('night'), 'base-dark');
|
||||
});
|
||||
|
||||
test('base-darkest', t => {
|
||||
const variants = Variants.guess_from('base-darkest');
|
||||
t.is(variants.get('day'), 'base');
|
||||
t.is(variants.get('night'), 'base-darkest');
|
||||
const variants = Variants.guessFrom('base-darkest');
|
||||
t.is(variants.get('day'), 'base');
|
||||
t.is(variants.get('night'), 'base-darkest');
|
||||
});
|
||||
|
||||
@@ -21,25 +21,25 @@ const { Variants } = require('./_variants');
|
||||
|
||||
|
||||
test('Adapta', t => {
|
||||
const variants = Variants.guess_from('Adapta');
|
||||
t.is(variants.get('day'), 'Adapta');
|
||||
t.is(variants.get('night'), 'Adapta-Nokto');
|
||||
const variants = Variants.guessFrom('Adapta');
|
||||
t.is(variants.get('day'), 'Adapta');
|
||||
t.is(variants.get('night'), 'Adapta-Nokto');
|
||||
});
|
||||
|
||||
test('Adapta-Nokto', t => {
|
||||
const variants = Variants.guess_from('Adapta-Nokto');
|
||||
t.is(variants.get('day'), 'Adapta');
|
||||
t.is(variants.get('night'), 'Adapta-Nokto');
|
||||
const variants = Variants.guessFrom('Adapta-Nokto');
|
||||
t.is(variants.get('day'), 'Adapta');
|
||||
t.is(variants.get('night'), 'Adapta-Nokto');
|
||||
});
|
||||
|
||||
test('Adapta-Eta', t => {
|
||||
const variants = Variants.guess_from('Adapta-Eta');
|
||||
t.is(variants.get('day'), 'Adapta-Eta');
|
||||
t.is(variants.get('night'), 'Adapta-Nokto-Eta');
|
||||
const variants = Variants.guessFrom('Adapta-Eta');
|
||||
t.is(variants.get('day'), 'Adapta-Eta');
|
||||
t.is(variants.get('night'), 'Adapta-Nokto-Eta');
|
||||
});
|
||||
|
||||
test('Adapta-Nokto-Eta', t => {
|
||||
const variants = Variants.guess_from('Adapta-Nokto-Eta');
|
||||
t.is(variants.get('day'), 'Adapta-Eta');
|
||||
t.is(variants.get('night'), 'Adapta-Nokto-Eta');
|
||||
const variants = Variants.guessFrom('Adapta-Nokto-Eta');
|
||||
t.is(variants.get('day'), 'Adapta-Eta');
|
||||
t.is(variants.get('night'), 'Adapta-Nokto-Eta');
|
||||
});
|
||||
|
||||
+12
-12
@@ -21,25 +21,25 @@ const { Variants } = require('./_variants');
|
||||
|
||||
|
||||
test('Arc', t => {
|
||||
const variants = Variants.guess_from('Arc');
|
||||
t.is(variants.get('day'), 'Arc');
|
||||
t.is(variants.get('night'), 'Arc-Dark');
|
||||
const variants = Variants.guessFrom('Arc');
|
||||
t.is(variants.get('day'), 'Arc');
|
||||
t.is(variants.get('night'), 'Arc-Dark');
|
||||
});
|
||||
|
||||
test('Arc-Dark', t => {
|
||||
const variants = Variants.guess_from('Arc-Dark');
|
||||
t.is(variants.get('day'), 'Arc');
|
||||
t.is(variants.get('night'), 'Arc-Dark');
|
||||
const variants = Variants.guessFrom('Arc-Dark');
|
||||
t.is(variants.get('day'), 'Arc');
|
||||
t.is(variants.get('night'), 'Arc-Dark');
|
||||
});
|
||||
|
||||
test('Arc-Dark-solid', t => {
|
||||
const variants = Variants.guess_from('Arc-Dark-solid');
|
||||
t.is(variants.get('day'), 'Arc-solid');
|
||||
t.is(variants.get('night'), 'Arc-Dark-solid');
|
||||
const variants = Variants.guessFrom('Arc-Dark-solid');
|
||||
t.is(variants.get('day'), 'Arc-solid');
|
||||
t.is(variants.get('night'), 'Arc-Dark-solid');
|
||||
});
|
||||
|
||||
test('Arc-solid', t => {
|
||||
const variants = Variants.guess_from('Arc-solid');
|
||||
t.is(variants.get('day'), 'Arc-solid');
|
||||
t.is(variants.get('night'), 'Arc-Dark-solid');
|
||||
const variants = Variants.guessFrom('Arc-solid');
|
||||
t.is(variants.get('day'), 'Arc-solid');
|
||||
t.is(variants.get('night'), 'Arc-Dark-solid');
|
||||
});
|
||||
|
||||
+30
-30
@@ -21,39 +21,39 @@ const { Variants } = require('./_variants');
|
||||
|
||||
|
||||
['', '-blue', '-indigo'].forEach(color => {
|
||||
test(`Canta${color}`, t => {
|
||||
const variants = Variants.guess_from(`Canta${color}`);
|
||||
t.is(variants.get('day'), `Canta${color}`);
|
||||
t.is(variants.get('night'), `Canta${color}-dark`);
|
||||
});
|
||||
test(`Canta${color}`, t => {
|
||||
const variants = Variants.guessFrom(`Canta${color}`);
|
||||
t.is(variants.get('day'), `Canta${color}`);
|
||||
t.is(variants.get('night'), `Canta${color}-dark`);
|
||||
});
|
||||
|
||||
test(`Canta${color}-dark`, t => {
|
||||
const variants = Variants.guess_from(`Canta${color}-dark`);
|
||||
t.is(variants.get('day'), `Canta${color}`);
|
||||
t.is(variants.get('night'), `Canta${color}-dark`);
|
||||
});
|
||||
test(`Canta${color}-dark`, t => {
|
||||
const variants = Variants.guessFrom(`Canta${color}-dark`);
|
||||
t.is(variants.get('day'), `Canta${color}`);
|
||||
t.is(variants.get('night'), `Canta${color}-dark`);
|
||||
});
|
||||
|
||||
test(`Canta${color}-light`, t => {
|
||||
const variants = Variants.guess_from(`Canta${color}-light`);
|
||||
t.is(variants.get('day'), `Canta${color}-light`);
|
||||
t.is(variants.get('night'), `Canta${color}-dark`);
|
||||
});
|
||||
test(`Canta${color}-light`, t => {
|
||||
const variants = Variants.guessFrom(`Canta${color}-light`);
|
||||
t.is(variants.get('day'), `Canta${color}-light`);
|
||||
t.is(variants.get('night'), `Canta${color}-dark`);
|
||||
});
|
||||
|
||||
test(`Canta${color}-compact`, t => {
|
||||
const variants = Variants.guess_from(`Canta${color}-compact`);
|
||||
t.is(variants.get('day'), `Canta${color}-compact`);
|
||||
t.is(variants.get('night'), `Canta${color}-dark-compact`);
|
||||
});
|
||||
test(`Canta${color}-compact`, t => {
|
||||
const variants = Variants.guessFrom(`Canta${color}-compact`);
|
||||
t.is(variants.get('day'), `Canta${color}-compact`);
|
||||
t.is(variants.get('night'), `Canta${color}-dark-compact`);
|
||||
});
|
||||
|
||||
test(`Canta${color}-dark-compact`, t => {
|
||||
const variants = Variants.guess_from(`Canta${color}-dark-compact`);
|
||||
t.is(variants.get('day'), `Canta${color}-compact`);
|
||||
t.is(variants.get('night'), `Canta${color}-dark-compact`);
|
||||
});
|
||||
test(`Canta${color}-dark-compact`, t => {
|
||||
const variants = Variants.guessFrom(`Canta${color}-dark-compact`);
|
||||
t.is(variants.get('day'), `Canta${color}-compact`);
|
||||
t.is(variants.get('night'), `Canta${color}-dark-compact`);
|
||||
});
|
||||
|
||||
test(`Canta${color}-light-compact`, t => {
|
||||
const variants = Variants.guess_from(`Canta${color}-light-compact`);
|
||||
t.is(variants.get('day'), `Canta${color}-light-compact`);
|
||||
t.is(variants.get('night'), `Canta${color}-dark-compact`);
|
||||
});
|
||||
test(`Canta${color}-light-compact`, t => {
|
||||
const variants = Variants.guessFrom(`Canta${color}-light-compact`);
|
||||
t.is(variants.get('day'), `Canta${color}-light-compact`);
|
||||
t.is(variants.get('night'), `Canta${color}-dark-compact`);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -20,21 +20,21 @@ const test = require('ava');
|
||||
const { Variants } = require('./_variants');
|
||||
|
||||
['', '-compact'].forEach(size => {
|
||||
test(`ChromeOS${size}`, t => {
|
||||
const variants = Variants.guess_from(`ChromeOS${size}`);
|
||||
t.is(variants.get('day'), `ChromeOS${size}`);
|
||||
t.is(variants.get('night'), `ChromeOS-dark${size}`);
|
||||
});
|
||||
test(`ChromeOS${size}`, t => {
|
||||
const variants = Variants.guessFrom(`ChromeOS${size}`);
|
||||
t.is(variants.get('day'), `ChromeOS${size}`);
|
||||
t.is(variants.get('night'), `ChromeOS-dark${size}`);
|
||||
});
|
||||
|
||||
test(`ChromeOS-dark${size}`, t => {
|
||||
const variants = Variants.guess_from(`ChromeOS-dark${size}`);
|
||||
t.is(variants.get('day'), `ChromeOS${size}`);
|
||||
t.is(variants.get('night'), `ChromeOS-dark${size}`);
|
||||
});
|
||||
test(`ChromeOS-dark${size}`, t => {
|
||||
const variants = Variants.guessFrom(`ChromeOS-dark${size}`);
|
||||
t.is(variants.get('day'), `ChromeOS${size}`);
|
||||
t.is(variants.get('night'), `ChromeOS-dark${size}`);
|
||||
});
|
||||
|
||||
test(`ChromeOS-light${size}`, t => {
|
||||
const variants = Variants.guess_from(`ChromeOS-light${size}`);
|
||||
t.is(variants.get('day'), `ChromeOS-light${size}`);
|
||||
t.is(variants.get('night'), `ChromeOS-dark${size}`);
|
||||
});
|
||||
})
|
||||
test(`ChromeOS-light${size}`, t => {
|
||||
const variants = Variants.guessFrom(`ChromeOS-light${size}`);
|
||||
t.is(variants.get('day'), `ChromeOS-light${size}`);
|
||||
t.is(variants.get('night'), `ChromeOS-dark${size}`);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -20,23 +20,23 @@ const test = require('ava');
|
||||
const { Variants } = require('./_variants');
|
||||
|
||||
['', '-Miami'].forEach(color => {
|
||||
['', '-fullPanel'].forEach(size => {
|
||||
test(`Flat-Remix${color}${size}`, t => {
|
||||
const variants = Variants.guess_from(`Flat-Remix${color}${size}`);
|
||||
t.is(variants.get('day'), `Flat-Remix${color}${size}`);
|
||||
t.is(variants.get('night'), `Flat-Remix${color}-Dark${size}`);
|
||||
});
|
||||
['', '-fullPanel'].forEach(size => {
|
||||
test(`Flat-Remix${color}${size}`, t => {
|
||||
const variants = Variants.guessFrom(`Flat-Remix${color}${size}`);
|
||||
t.is(variants.get('day'), `Flat-Remix${color}${size}`);
|
||||
t.is(variants.get('night'), `Flat-Remix${color}-Dark${size}`);
|
||||
});
|
||||
|
||||
test(`Flat-Remix${color}-Dark${size}`, t => {
|
||||
const variants = Variants.guess_from(`Flat-Remix${color}-Dark${size}`);
|
||||
t.is(variants.get('day'), `Flat-Remix${color}${size}`);
|
||||
t.is(variants.get('night'), `Flat-Remix${color}-Dark${size}`);
|
||||
});
|
||||
test(`Flat-Remix${color}-Dark${size}`, t => {
|
||||
const variants = Variants.guessFrom(`Flat-Remix${color}-Dark${size}`);
|
||||
t.is(variants.get('day'), `Flat-Remix${color}${size}`);
|
||||
t.is(variants.get('night'), `Flat-Remix${color}-Dark${size}`);
|
||||
});
|
||||
|
||||
test(`Flat-Remix${color}-Darkest${size}`, t => {
|
||||
const variants = Variants.guess_from(`Flat-Remix${color}-Darkest${size}`);
|
||||
t.is(variants.get('day'), `Flat-Remix${color}${size}`);
|
||||
t.is(variants.get('night'), `Flat-Remix${color}-Darkest${size}`);
|
||||
});
|
||||
})
|
||||
})
|
||||
test(`Flat-Remix${color}-Darkest${size}`, t => {
|
||||
const variants = Variants.guessFrom(`Flat-Remix${color}-Darkest${size}`);
|
||||
t.is(variants.get('day'), `Flat-Remix${color}${size}`);
|
||||
t.is(variants.get('night'), `Flat-Remix${color}-Darkest${size}`);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
+18
-18
@@ -21,37 +21,37 @@ const { Variants } = require('./_variants');
|
||||
|
||||
|
||||
test('Layan', t => {
|
||||
const variants = Variants.guess_from('Layan');
|
||||
t.is(variants.get('day'), 'Layan');
|
||||
t.is(variants.get('night'), 'Layan-dark');
|
||||
const variants = Variants.guessFrom('Layan');
|
||||
t.is(variants.get('day'), 'Layan');
|
||||
t.is(variants.get('night'), 'Layan-dark');
|
||||
});
|
||||
|
||||
test('Layan-dark', t => {
|
||||
const variants = Variants.guess_from('Layan-dark');
|
||||
t.is(variants.get('day'), 'Layan');
|
||||
t.is(variants.get('night'), 'Layan-dark');
|
||||
const variants = Variants.guessFrom('Layan-dark');
|
||||
t.is(variants.get('day'), 'Layan');
|
||||
t.is(variants.get('night'), 'Layan-dark');
|
||||
});
|
||||
|
||||
test('Layan-light', t => {
|
||||
const variants = Variants.guess_from('Layan-light');
|
||||
t.is(variants.get('day'), 'Layan-light');
|
||||
t.is(variants.get('night'), 'Layan-dark');
|
||||
const variants = Variants.guessFrom('Layan-light');
|
||||
t.is(variants.get('day'), 'Layan-light');
|
||||
t.is(variants.get('night'), 'Layan-dark');
|
||||
});
|
||||
|
||||
test('Layan-solid', t => {
|
||||
const variants = Variants.guess_from('Layan-solid');
|
||||
t.is(variants.get('day'), 'Layan-solid');
|
||||
t.is(variants.get('night'), 'Layan-dark-solid');
|
||||
const variants = Variants.guessFrom('Layan-solid');
|
||||
t.is(variants.get('day'), 'Layan-solid');
|
||||
t.is(variants.get('night'), 'Layan-dark-solid');
|
||||
});
|
||||
|
||||
test('Layan-dark-solid', t => {
|
||||
const variants = Variants.guess_from('Layan-dark-solid');
|
||||
t.is(variants.get('day'), 'Layan-solid');
|
||||
t.is(variants.get('night'), 'Layan-dark-solid');
|
||||
const variants = Variants.guessFrom('Layan-dark-solid');
|
||||
t.is(variants.get('day'), 'Layan-solid');
|
||||
t.is(variants.get('night'), 'Layan-dark-solid');
|
||||
});
|
||||
|
||||
test('Layan-light-solid', t => {
|
||||
const variants = Variants.guess_from('Layan-light-solid');
|
||||
t.is(variants.get('day'), 'Layan-light-solid');
|
||||
t.is(variants.get('night'), 'Layan-dark-solid');
|
||||
const variants = Variants.guessFrom('Layan-light-solid');
|
||||
t.is(variants.get('day'), 'Layan-light-solid');
|
||||
t.is(variants.get('night'), 'Layan-dark-solid');
|
||||
});
|
||||
|
||||
@@ -21,21 +21,21 @@ const { Variants } = require('./_variants');
|
||||
|
||||
|
||||
['aliz', 'azul', 'sea'].forEach(color => {
|
||||
test(`Matcha-${color}`, t => {
|
||||
const variants = Variants.guess_from(`Matcha-${color}`);
|
||||
t.is(variants.get('day'), `Matcha-${color}`);
|
||||
t.is(variants.get('night'), `Matcha-dark-${color}`);
|
||||
});
|
||||
test(`Matcha-${color}`, t => {
|
||||
const variants = Variants.guessFrom(`Matcha-${color}`);
|
||||
t.is(variants.get('day'), `Matcha-${color}`);
|
||||
t.is(variants.get('night'), `Matcha-dark-${color}`);
|
||||
});
|
||||
|
||||
test(`Matcha-dark-${color}`, t => {
|
||||
const variants = Variants.guess_from(`Matcha-dark-${color}`);
|
||||
t.is(variants.get('day'), `Matcha-${color}`);
|
||||
t.is(variants.get('night'), `Matcha-dark-${color}`);
|
||||
});
|
||||
test(`Matcha-dark-${color}`, t => {
|
||||
const variants = Variants.guessFrom(`Matcha-dark-${color}`);
|
||||
t.is(variants.get('day'), `Matcha-${color}`);
|
||||
t.is(variants.get('night'), `Matcha-dark-${color}`);
|
||||
});
|
||||
|
||||
test(`Matcha-light-${color}`, t => {
|
||||
const variants = Variants.guess_from(`Matcha-light-${color}`);
|
||||
t.is(variants.get('day'), `Matcha-light-${color}`);
|
||||
t.is(variants.get('night'), `Matcha-dark-${color}`);
|
||||
});
|
||||
})
|
||||
test(`Matcha-light-${color}`, t => {
|
||||
const variants = Variants.guessFrom(`Matcha-light-${color}`);
|
||||
t.is(variants.get('day'), `Matcha-light-${color}`);
|
||||
t.is(variants.get('night'), `Matcha-dark-${color}`);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -21,21 +21,21 @@ const { Variants } = require('./_variants');
|
||||
|
||||
|
||||
['', '-compact'].forEach(size => {
|
||||
test(`Materia${size}`, t => {
|
||||
const variants = Variants.guess_from(`Materia${size}`);
|
||||
t.is(variants.get('day'), `Materia${size}`);
|
||||
t.is(variants.get('night'), `Materia-dark${size}`);
|
||||
});
|
||||
test(`Materia${size}`, t => {
|
||||
const variants = Variants.guessFrom(`Materia${size}`);
|
||||
t.is(variants.get('day'), `Materia${size}`);
|
||||
t.is(variants.get('night'), `Materia-dark${size}`);
|
||||
});
|
||||
|
||||
test(`Materia-dark${size}`, t => {
|
||||
const variants = Variants.guess_from(`Materia-dark${size}`);
|
||||
t.is(variants.get('day'), `Materia${size}`);
|
||||
t.is(variants.get('night'), `Materia-dark${size}`);
|
||||
});
|
||||
test(`Materia-dark${size}`, t => {
|
||||
const variants = Variants.guessFrom(`Materia-dark${size}`);
|
||||
t.is(variants.get('day'), `Materia${size}`);
|
||||
t.is(variants.get('night'), `Materia-dark${size}`);
|
||||
});
|
||||
|
||||
test(`Materia-light${size}`, t => {
|
||||
const variants = Variants.guess_from(`Materia-light${size}`);
|
||||
t.is(variants.get('day'), `Materia-light${size}`);
|
||||
t.is(variants.get('night'), `Materia-dark${size}`);
|
||||
});
|
||||
})
|
||||
test(`Materia-light${size}`, t => {
|
||||
const variants = Variants.guessFrom(`Materia-light${size}`);
|
||||
t.is(variants.get('day'), `Materia-light${size}`);
|
||||
t.is(variants.get('night'), `Materia-dark${size}`);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -21,17 +21,17 @@ const { Variants } = require('./_variants');
|
||||
|
||||
|
||||
['', '-solid'].forEach(transparency => {
|
||||
['', '-alt'].forEach(alt => {
|
||||
test(`Mojave-light${transparency}${alt}`, t => {
|
||||
const variants = Variants.guess_from(`Mojave-light${transparency}${alt}`);
|
||||
t.is(variants.get('day'), `Mojave-light${transparency}${alt}`);
|
||||
t.is(variants.get('night'), `Mojave-dark${transparency}${alt}`);
|
||||
});
|
||||
['', '-alt'].forEach(alt => {
|
||||
test(`Mojave-light${transparency}${alt}`, t => {
|
||||
const variants = Variants.guessFrom(`Mojave-light${transparency}${alt}`);
|
||||
t.is(variants.get('day'), `Mojave-light${transparency}${alt}`);
|
||||
t.is(variants.get('night'), `Mojave-dark${transparency}${alt}`);
|
||||
});
|
||||
|
||||
test(`Mojave-dark${transparency}${alt}`, t => {
|
||||
const variants = Variants.guess_from(`Mojave-dark${transparency}${alt}`);
|
||||
t.is(variants.get('day'), `Mojave-light${transparency}${alt}`);
|
||||
t.is(variants.get('night'), `Mojave-dark${transparency}${alt}`);
|
||||
});
|
||||
});
|
||||
test(`Mojave-dark${transparency}${alt}`, t => {
|
||||
const variants = Variants.guessFrom(`Mojave-dark${transparency}${alt}`);
|
||||
t.is(variants.get('day'), `Mojave-light${transparency}${alt}`);
|
||||
t.is(variants.get('night'), `Mojave-dark${transparency}${alt}`);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -21,15 +21,15 @@ const { Variants } = require('./_variants');
|
||||
|
||||
|
||||
['', '-compact'].forEach(size => {
|
||||
test(`Orchis${size}`, t => {
|
||||
const variants = Variants.guess_from(`Orchis${size}`);
|
||||
t.is(variants.get('day'), `Orchis${size}`);
|
||||
t.is(variants.get('night'), `Orchis-dark${size}`);
|
||||
});
|
||||
test(`Orchis${size}`, t => {
|
||||
const variants = Variants.guessFrom(`Orchis${size}`);
|
||||
t.is(variants.get('day'), `Orchis${size}`);
|
||||
t.is(variants.get('night'), `Orchis-dark${size}`);
|
||||
});
|
||||
|
||||
test(`Orchis-dark${size}`, t => {
|
||||
const variants = Variants.guess_from(`Orchis-dark${size}`);
|
||||
t.is(variants.get('day'), `Orchis${size}`);
|
||||
t.is(variants.get('night'), `Orchis-dark${size}`);
|
||||
});
|
||||
})
|
||||
test(`Orchis-dark${size}`, t => {
|
||||
const variants = Variants.guessFrom(`Orchis-dark${size}`);
|
||||
t.is(variants.get('day'), `Orchis${size}`);
|
||||
t.is(variants.get('night'), `Orchis-dark${size}`);
|
||||
});
|
||||
});
|
||||
|
||||
+16
-16
@@ -21,21 +21,21 @@ const { Variants } = require('./_variants');
|
||||
|
||||
|
||||
['', '-Compact'].forEach(size => {
|
||||
test(`Plata${size}`, t => {
|
||||
const variants = Variants.guess_from(`Plata${size}`);
|
||||
t.is(variants.get('day'), `Plata${size}`);
|
||||
t.is(variants.get('night'), `Plata-Noir${size}`);
|
||||
});
|
||||
test(`Plata${size}`, t => {
|
||||
const variants = Variants.guessFrom(`Plata${size}`);
|
||||
t.is(variants.get('day'), `Plata${size}`);
|
||||
t.is(variants.get('night'), `Plata-Noir${size}`);
|
||||
});
|
||||
|
||||
test(`Plata-Noir${size}`, t => {
|
||||
const variants = Variants.guess_from(`Plata-Noir${size}`);
|
||||
t.is(variants.get('day'), `Plata${size}`);
|
||||
t.is(variants.get('night'), `Plata-Noir${size}`);
|
||||
});
|
||||
test(`Plata-Noir${size}`, t => {
|
||||
const variants = Variants.guessFrom(`Plata-Noir${size}`);
|
||||
t.is(variants.get('day'), `Plata${size}`);
|
||||
t.is(variants.get('night'), `Plata-Noir${size}`);
|
||||
});
|
||||
|
||||
test(`Plata-Lumine${size}`, t => {
|
||||
const variants = Variants.guess_from(`Plata-Lumine${size}`);
|
||||
t.is(variants.get('day'), `Plata-Lumine${size}`);
|
||||
t.is(variants.get('night'), `Plata-Noir${size}`);
|
||||
});
|
||||
})
|
||||
test(`Plata-Lumine${size}`, t => {
|
||||
const variants = Variants.guessFrom(`Plata-Lumine${size}`);
|
||||
t.is(variants.get('day'), `Plata-Lumine${size}`);
|
||||
t.is(variants.get('night'), `Plata-Noir${size}`);
|
||||
});
|
||||
});
|
||||
|
||||
+17
-17
@@ -21,23 +21,23 @@ const { Variants } = require('./_variants');
|
||||
|
||||
|
||||
['', '-manjaro', '-ubuntu'].forEach(color => {
|
||||
['', '-win'].forEach(alt => {
|
||||
test(`Qogir${color}${alt}`, t => {
|
||||
const variants = Variants.guess_from(`Qogir${color}${alt}`);
|
||||
t.is(variants.get('day'), `Qogir${color}${alt}`);
|
||||
t.is(variants.get('night'), `Qogir${color}${alt}-dark`);
|
||||
});
|
||||
['', '-win'].forEach(alt => {
|
||||
test(`Qogir${color}${alt}`, t => {
|
||||
const variants = Variants.guessFrom(`Qogir${color}${alt}`);
|
||||
t.is(variants.get('day'), `Qogir${color}${alt}`);
|
||||
t.is(variants.get('night'), `Qogir${color}${alt}-dark`);
|
||||
});
|
||||
|
||||
test(`Qogir${color}${alt}-dark`, t => {
|
||||
const variants = Variants.guess_from(`Qogir${color}${alt}-dark`);
|
||||
t.is(variants.get('day'), `Qogir${color}${alt}`);
|
||||
t.is(variants.get('night'), `Qogir${color}${alt}-dark`);
|
||||
});
|
||||
test(`Qogir${color}${alt}-dark`, t => {
|
||||
const variants = Variants.guessFrom(`Qogir${color}${alt}-dark`);
|
||||
t.is(variants.get('day'), `Qogir${color}${alt}`);
|
||||
t.is(variants.get('night'), `Qogir${color}${alt}-dark`);
|
||||
});
|
||||
|
||||
test(`Qogir${color}${alt}light`, t => {
|
||||
const variants = Variants.guess_from(`Qogir${color}${alt}-light`);
|
||||
t.is(variants.get('day'), `Qogir${color}${alt}-light`);
|
||||
t.is(variants.get('night'), `Qogir${color}${alt}-dark`);
|
||||
});
|
||||
});
|
||||
test(`Qogir${color}${alt}light`, t => {
|
||||
const variants = Variants.guessFrom(`Qogir${color}${alt}-light`);
|
||||
t.is(variants.get('day'), `Qogir${color}${alt}-light`);
|
||||
t.is(variants.get('night'), `Qogir${color}${alt}-dark`);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -21,17 +21,17 @@ const { Variants } = require('./_variants');
|
||||
|
||||
|
||||
['', '_Blue', '_Cyan', '_Green', '_Orange', '_Purple'].forEach(color => {
|
||||
['', '_Envolved'].forEach(variant => {
|
||||
test(`Simply_Circles${color}_Light${variant}`, t => {
|
||||
const variants = Variants.guess_from(`Simply_Circles${color}_Light${variant}`);
|
||||
t.is(variants.get('day'), `Simply_Circles${color}_Light${variant}`);
|
||||
t.is(variants.get('night'), `Simply_Circles${color}_Dark${variant}`);
|
||||
});
|
||||
['', '_Envolved'].forEach(variant => {
|
||||
test(`Simply_Circles${color}_Light${variant}`, t => {
|
||||
const variants = Variants.guessFrom(`Simply_Circles${color}_Light${variant}`);
|
||||
t.is(variants.get('day'), `Simply_Circles${color}_Light${variant}`);
|
||||
t.is(variants.get('night'), `Simply_Circles${color}_Dark${variant}`);
|
||||
});
|
||||
|
||||
test(`Simply_Circles${color}${variant}`, t => {
|
||||
const variants = Variants.guess_from(`Simply_Circles${color}_Dark${variant}`);
|
||||
t.is(variants.get('day'), `Simply_Circles${color}_Light${variant}`);
|
||||
t.is(variants.get('night'), `Simply_Circles${color}_Dark${variant}`);
|
||||
});
|
||||
})
|
||||
test(`Simply_Circles${color}${variant}`, t => {
|
||||
const variants = Variants.guessFrom(`Simply_Circles${color}_Dark${variant}`);
|
||||
t.is(variants.get('day'), `Simply_Circles${color}_Light${variant}`);
|
||||
t.is(variants.get('night'), `Simply_Circles${color}_Dark${variant}`);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
+15
-15
@@ -20,31 +20,31 @@ const test = require('ava');
|
||||
const { Variants } = require('./_variants');
|
||||
|
||||
test('Teja', t => {
|
||||
const variants = Variants.guess_from('Teja');
|
||||
t.is(variants.get('day'), 'Teja');
|
||||
t.is(variants.get('night'), 'Teja_Dark');
|
||||
const variants = Variants.guessFrom('Teja');
|
||||
t.is(variants.get('day'), 'Teja');
|
||||
t.is(variants.get('night'), 'Teja_Dark');
|
||||
});
|
||||
|
||||
test('Teja_Dark', t => {
|
||||
const variants = Variants.guess_from('Teja_Dark');
|
||||
t.is(variants.get('day'), 'Teja');
|
||||
t.is(variants.get('night'), 'Teja_Dark');
|
||||
const variants = Variants.guessFrom('Teja_Dark');
|
||||
t.is(variants.get('day'), 'Teja');
|
||||
t.is(variants.get('night'), 'Teja_Dark');
|
||||
});
|
||||
|
||||
test('Teja_Darkest', t => {
|
||||
const variants = Variants.guess_from('Teja_Darkest');
|
||||
t.is(variants.get('day'), 'Teja');
|
||||
t.is(variants.get('night'), 'Teja_Darkest');
|
||||
const variants = Variants.guessFrom('Teja_Darkest');
|
||||
t.is(variants.get('day'), 'Teja');
|
||||
t.is(variants.get('night'), 'Teja_Darkest');
|
||||
});
|
||||
|
||||
test('Teja_Black', t => {
|
||||
const variants = Variants.guess_from('Teja_Black');
|
||||
t.is(variants.get('day'), 'Teja');
|
||||
t.is(variants.get('night'), 'Teja_Black');
|
||||
const variants = Variants.guessFrom('Teja_Black');
|
||||
t.is(variants.get('day'), 'Teja');
|
||||
t.is(variants.get('night'), 'Teja_Black');
|
||||
});
|
||||
|
||||
test('Teja_Light', t => {
|
||||
const variants = Variants.guess_from('Teja_Light');
|
||||
t.is(variants.get('day'), 'Teja_Light');
|
||||
t.is(variants.get('night'), 'Teja_Dark');
|
||||
const variants = Variants.guessFrom('Teja_Light');
|
||||
t.is(variants.get('day'), 'Teja_Light');
|
||||
t.is(variants.get('night'), 'Teja_Dark');
|
||||
});
|
||||
|
||||
+17
-17
@@ -21,22 +21,22 @@ const { Variants } = require('./_variants');
|
||||
|
||||
|
||||
['', '-laptop'].forEach(size => {
|
||||
['', '-beryl', '-doder', '-ruby'].forEach(color => {
|
||||
test(`vimix${size}${color}`, t => {
|
||||
const variants = Variants.guess_from(`vimix${size}${color}`);
|
||||
t.is(variants.get('day'), `vimix${size}${color}`);
|
||||
t.is(variants.get('night'), `vimix-dark${size}${color}`);
|
||||
});
|
||||
['', '-beryl', '-doder', '-ruby'].forEach(color => {
|
||||
test(`vimix${size}${color}`, t => {
|
||||
const variants = Variants.guessFrom(`vimix${size}${color}`);
|
||||
t.is(variants.get('day'), `vimix${size}${color}`);
|
||||
t.is(variants.get('night'), `vimix-dark${size}${color}`);
|
||||
});
|
||||
|
||||
test(`vimix-dark${size}${color}`, t => {
|
||||
const variants = Variants.guess_from(`vimix-dark${size}${color}`);
|
||||
t.is(variants.get('day'), `vimix${size}${color}`);
|
||||
t.is(variants.get('night'), `vimix-dark${size}${color}`);
|
||||
});
|
||||
test(`vimix-light${size}${color}`, t => {
|
||||
const variants = Variants.guess_from(`vimix-light${size}${color}`);
|
||||
t.is(variants.get('day'), `vimix-light${size}${color}`);
|
||||
t.is(variants.get('night'), `vimix-dark${size}${color}`);
|
||||
});
|
||||
});
|
||||
test(`vimix-dark${size}${color}`, t => {
|
||||
const variants = Variants.guessFrom(`vimix-dark${size}${color}`);
|
||||
t.is(variants.get('day'), `vimix${size}${color}`);
|
||||
t.is(variants.get('night'), `vimix-dark${size}${color}`);
|
||||
});
|
||||
test(`vimix-light${size}${color}`, t => {
|
||||
const variants = Variants.guessFrom(`vimix-light${size}${color}`);
|
||||
t.is(variants.get('day'), `vimix-light${size}${color}`);
|
||||
t.is(variants.get('night'), `vimix-dark${size}${color}`);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -21,19 +21,19 @@ const { Variants } = require('./_variants');
|
||||
|
||||
|
||||
test('Yaru', t => {
|
||||
const variants = Variants.guess_from('Yaru');
|
||||
t.is(variants.get('day'), 'Yaru');
|
||||
t.is(variants.get('night'), 'Yaru-dark');
|
||||
const variants = Variants.guessFrom('Yaru');
|
||||
t.is(variants.get('day'), 'Yaru');
|
||||
t.is(variants.get('night'), 'Yaru-dark');
|
||||
});
|
||||
|
||||
test('Yaru-dark', t => {
|
||||
const variants = Variants.guess_from('Yaru-dark');
|
||||
t.is(variants.get('day'), 'Yaru');
|
||||
t.is(variants.get('night'), 'Yaru-dark');
|
||||
const variants = Variants.guessFrom('Yaru-dark');
|
||||
t.is(variants.get('day'), 'Yaru');
|
||||
t.is(variants.get('night'), 'Yaru-dark');
|
||||
});
|
||||
|
||||
test('Yaru-light', t => {
|
||||
const variants = Variants.guess_from('Yaru-light');
|
||||
t.is(variants.get('day'), 'Yaru-light');
|
||||
t.is(variants.get('night'), 'Yaru-dark');
|
||||
const variants = Variants.guessFrom('Yaru-light');
|
||||
t.is(variants.get('day'), 'Yaru-light');
|
||||
t.is(variants.get('night'), 'Yaru-dark');
|
||||
});
|
||||
|
||||
+15
-15
@@ -20,31 +20,31 @@ const test = require('ava');
|
||||
const { Variants } = require('./_variants');
|
||||
|
||||
test('base', t => {
|
||||
const variants = Variants.guess_from('base');
|
||||
t.is(variants.get('day'), 'base');
|
||||
t.is(variants.get('night'), 'base-dark');
|
||||
const variants = Variants.guessFrom('base');
|
||||
t.is(variants.get('day'), 'base');
|
||||
t.is(variants.get('night'), 'base-dark');
|
||||
});
|
||||
|
||||
test('base-dark', t => {
|
||||
const variants = Variants.guess_from('base-dark');
|
||||
t.is(variants.get('day'), 'base');
|
||||
t.is(variants.get('night'), 'base-dark');
|
||||
const variants = Variants.guessFrom('base-dark');
|
||||
t.is(variants.get('day'), 'base');
|
||||
t.is(variants.get('night'), 'base-dark');
|
||||
});
|
||||
|
||||
test('base-light', t => {
|
||||
const variants = Variants.guess_from('base-light');
|
||||
t.is(variants.get('day'), 'base-light');
|
||||
t.is(variants.get('night'), 'base-dark');
|
||||
const variants = Variants.guessFrom('base-light');
|
||||
t.is(variants.get('day'), 'base-light');
|
||||
t.is(variants.get('night'), 'base-dark');
|
||||
});
|
||||
|
||||
test('base-darker', t => {
|
||||
const variants = Variants.guess_from('base-darker');
|
||||
t.is(variants.get('day'), 'base-darker');
|
||||
t.is(variants.get('night'), 'base-dark');
|
||||
const variants = Variants.guessFrom('base-darker');
|
||||
t.is(variants.get('day'), 'base-darker');
|
||||
t.is(variants.get('night'), 'base-dark');
|
||||
});
|
||||
|
||||
test('base-darkest', t => {
|
||||
const variants = Variants.guess_from('base-darkest');
|
||||
t.is(variants.get('day'), 'base');
|
||||
t.is(variants.get('night'), 'base-darkest');
|
||||
const variants = Variants.guessFrom('base-darkest');
|
||||
t.is(variants.get('day'), 'base');
|
||||
t.is(variants.get('night'), 'base-darkest');
|
||||
});
|
||||
|
||||
@@ -20,7 +20,7 @@ const test = require('ava');
|
||||
const { Variants } = require('./_variants');
|
||||
|
||||
test('default', t => {
|
||||
const variants = Variants.guess_from('');
|
||||
t.is(variants.get('day'), '');
|
||||
t.is(variants.get('night'), '');
|
||||
const variants = Variants.guessFrom('');
|
||||
t.is(variants.get('day'), '');
|
||||
t.is(variants.get('night'), '');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user