Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Gnome 45 #164

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
1f1bd8b
Enable "Show IPs" option for gnome version >= 40
c84c Sep 9, 2021
5ce48de
Merge branch 'master' into show-ips-gnome40
c84c Apr 22, 2022
b5a9da1
better logging
c84c Jan 14, 2023
666feb7
fix: Remove Lang module
c84c Jan 22, 2023
3e736c7
Merge remote-tracking branch 'origin/remove_lang_module'
c84c Jan 22, 2023
b5f45c5
Merge remote-tracking branch 'origin/localized_numbers'
c84c Jan 22, 2023
10c4f88
style: code formatting and replace new Array with []
c84c Jan 22, 2023
fc257da
rebuild translations
c84c Jan 22, 2023
46ac0f6
build(makefile): add useful commands uninstall and reload
c84c Jan 22, 2023
0d568a6
Add gnome version 43 (tested on gnome 43.2)
c84c Jan 22, 2023
9ac93b9
style(gschema): code formatting
c84c Jan 22, 2023
50327ea
fix(translations): rename nl to nl_NL
c84c Jan 22, 2023
17375b3
fix(translations): rename nl to nl_NL
c84c Jan 22, 2023
fbf0e91
feat: refactor settings and add extension placement and position
c84c Jan 22, 2023
8e9f51e
Merge branch 'refactor_settings'
c84c Jan 22, 2023
50408da
fix: show ips follow prefs
c84c Jan 22, 2023
c88a329
Merge branch 'show-ips-gnome40'
c84c Jan 22, 2023
80d40eb
Merge branch 'defaultgw_typo'
c84c Jan 22, 2023
6807d37
switch to debug false
c84c Jan 22, 2023
10217dc
po: Add Georgian translation
NorwayFun Feb 22, 2023
af4b0a5
Add support for Gnome 43 and 44
muhammadyusuf-kurbonov May 10, 2023
232fae8
fix: typo
c84c May 14, 2023
f27b062
Add support for Gnome 45
c84c Feb 1, 2024
99c022e
add style guide tools following https://gjs.guide/guides/gjs/style-gu…
c84c Feb 1, 2024
971704c
Merge remote-tracking branch 'upstream/master'
c84c Feb 1, 2024
3011386
Gnome 46
c84c May 18, 2024
3ed7c69
fix: update po
c84c Feb 1, 2025
fc3bb2f
style: code formatting
c84c Feb 1, 2025
fe117c4
feat: Gnome 47
c84c Feb 1, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
indent_style = space
indent_size = 4
charset = utf-8
trim_trailing_whitespace = true
end_of_line = lf
insert_final_newline = true

[*.js]
quote_type = single
109 changes: 109 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# SPDX-License-Identifier: CC0-1.0
# SPDX-FileCopyrightText: No rights reserved

env:
es2021: true
extends: "eslint:recommended"
rules:
# See: https://eslint.org/docs/latest/rules/#possible-problems
array-callback-return: error
no-await-in-loop: error
no-constant-binary-expression: error
no-constructor-return: error
#no-duplicate-imports: error
no-new-native-nonconstructor: error
no-promise-executor-return: error
no-self-compare: error
no-template-curly-in-string: error
no-unmodified-loop-condition: error
no-unreachable-loop: error
no-unused-private-class-members: error
no-use-before-define:
- error
- functions: false
classes: true
variables: true
allowNamedExports: true
# See: https://eslint.org/docs/latest/rules/#suggestions
block-scoped-var: error
complexity: warn
consistent-return: error
default-param-last: error
eqeqeq: error
no-array-constructor: error
no-caller: error
no-extend-native: error
no-extra-bind: error
no-extra-label: error
no-iterator: error
no-label-var: error
no-loop-func: error
no-multi-assign: warn
no-new-object: error
no-new-wrappers: error
no-proto: error
no-shadow: warn
no-unused-vars:
- error
- varsIgnorePattern: ^_
argsIgnorePattern: ^_
no-var: warn
unicode-bom: error
# GJS Restrictions
no-restricted-globals:
- error
- name: Debugger
message: Internal use only
- name: GIRepositoryGType
message: Internal use only
- name: log
message: Use console.log()
- name: logError
message: Use console.warn() or console.error()
no-restricted-properties:
- error
- object: imports
property: format
message: Use template strings
- object: pkg
property: initFormat
message: Use template strings
- object: Lang
property: copyProperties
message: Use Object.assign()
- object: Lang
property: bind
message: Use arrow notation or Function.prototype.bind()
- object: Lang
property: Class
message: Use ES6 classes
no-restricted-syntax:
- error
- selector: >-
MethodDefinition[key.name="_init"]
CallExpression[arguments.length<=1][callee.object.type="Super"][callee.property.name="_init"]
message: Use constructor() and super()
# GJS Globals
globals:
ARGV: readonly
Debugger: readonly
GIRepositoryGType: readonly
globalThis: readonly
imports: readonly
Intl: readonly
log: readonly
logError: readonly
pkg: readonly
print: readonly
printerr: readonly
window: readonly
TextEncoder: readonly
TextDecoder: readonly
console: readonly
setTimeout: readonly
setInterval: readonly
clearTimeout: readonly
clearInterval: readonly
parserOptions:
ecmaVersion: 2022
sourceType: module
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ locale/
schemas/gschemas.compiled
*~
.idea/
node_modules/
14 changes: 11 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ UUID = [email protected]

LANGUAGES=ca de en_CA fa fr it pt_BR ru zh_CN zh_TW es_ES nl_NL ru tr zh_CN
DOC_FILES=CHANGELOG README.md
SRC_FILES=extension.js prefs.js net_speed_layout_menu_item.js net_speed.js net_speed_status_icon.js lib.js
SRC_FILES=extension.js prefs.js net_speed_layout_menu_item.js net_speed.js net_speed_status_icon.js lib.js messages.js
MO_FILES=$(foreach LANGUAGE, $(LANGUAGES), locale/$(LANGUAGE)/LC_MESSAGES/$(GETTEXT_PACKAGE).mo)
SCHEMA_FILES=schemas/gschemas.compiled schemas/org.gnome.shell.extensions.netspeed.gschema.xml
EXTENSION_FILES=stylesheet.css metadata.json
OUTPUT=$(DOC_FILES) $(SRC_FILES) $(MO_FILES) $(SCHEMA_FILES) $(EXTENSION_FILES)
POT_FILE=po/$(GETTEXT_PACKAGE).pot
LOCAL_INSTALL=~/.local/share/gnome-shell/extensions/$(UUID)
pack: $(OUTPUT)
pack: update-po schemas/gschemas.compiled $(OUTPUT)
zip $(UUID).zip $(OUTPUT)

$(POT_FILE): $(SRC_FILES)
Expand Down Expand Up @@ -42,5 +42,13 @@ enable:
disable:
gnome-extensions disable $(UUID)

reload:
uninstall:
gnome-extensions uninstall $(UUID)

reset:
gnome-extensions reset $(UUID)

reload:
# Reloading shell; Sending SIGHUP signal to gnome-shell (equivalent to alt + f2 ; r ; enter)
# busctl --verbose --user call org.gnome.Shell /org/gnome/Shell org.gnome.Shell Eval s 'Meta.restart("Restarting…")'
killall -HUP gnome-shell
71 changes: 45 additions & 26 deletions extension.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,49 @@
/*
* Copyright 2011-2013 Amir Hedayaty < hedayaty AT gmail DOT com >
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

const Extension = imports.misc.extensionUtils.getCurrentExtension();
const NetSpeed = Extension.imports.net_speed;

/**
* init
* run when gnome-shell loads
/*
* Copyright 2011-2013 Amir Hedayaty < hedayaty AT gmail DOT com >
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
function init() {
return new NetSpeed.NetSpeed();
}

import { Extension } from 'resource:///org/gnome/shell/extensions/extension.js';
import * as Main from 'resource:///org/gnome/shell/ui/main.js';

import NetSpeedStatusIcon from './net_speed_status_icon.js';
import { Logger } from './lib.js';
import { NetSpeed } from './net_speed.js';


export default class extends Extension {

enable() {
Logger.init(this);

this._netSpeed = new NetSpeed(this);
this._netSpeedMenu = new NetSpeedStatusIcon(this, this._netSpeed);

Main.panel.addToStatusArea('netSpeed', this._netSpeedMenu);
// reposition in panel trick
this._netSpeedMenu._positionInPanelChanged();

this._netSpeed.start();
}

disable() {
this._netSpeed?.stop();
this._netSpeedMenu?.destroy();
this._netSpeed = null;
this._netSpeedMenu = null;
}
}

// vim: ts=2 sw=2
Loading