Skip to content

Commit

Permalink
Add Gnome 42 support #31
Browse files Browse the repository at this point in the history
Fixes for Gnome 42
  • Loading branch information
prateekmedia authored Apr 9, 2022
2 parents 09bdf39 + 3e79af5 commit d87015f
Show file tree
Hide file tree
Showing 4 changed files with 266 additions and 312 deletions.
92 changes: 0 additions & 92 deletions convenience.js

This file was deleted.

22 changes: 11 additions & 11 deletions extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const Clutter = imports.gi.Clutter,
PanelMenu = imports.ui.panelMenu,
Mainloop = imports.mainloop,
Me = imports.misc.extensionUtils.getCurrentExtension(),
Convenience = Me.imports.convenience,
ExtensionUtils = imports.misc.extensionUtils,
schema = 'org.gnome.shell.extensions.netspeedsimplified',
ButtonName = "ShowNetSpeedButton",
rCConst = 4; //Right Click 4 times to toggle Vertical Alignment
Expand Down Expand Up @@ -84,10 +84,10 @@ function speedToString(amount, rMode = 0) {

let speed_map = B_UNITS.map(
(rMode == 1 && (crStng.mode == 1 || crStng.mode == 3 || crStng.mode == 4)) ? v => v : //KB
(rMode == 1 && (crStng.mode == 0 || crStng.mode == 2)) ? v => v.toLowerCase() : //kb
(crStng.mode == 0 || crStng.mode == 2) ? v => v.toLowerCase() + "/s" : //kb/s
(crStng.mode == 1 || crStng.mode == 3) ? v => v + "/s" : //KB/s
v => v); // Others
(rMode == 1 && (crStng.mode == 0 || crStng.mode == 2)) ? v => v.toLowerCase() : //kb
(crStng.mode == 0 || crStng.mode == 2) ? v => v.toLowerCase() + "/s" : //kb/s
(crStng.mode == 1 || crStng.mode == 3) ? v => v + "/s" : //KB/s
v => v); // Others

if (amount === 0) return " 0.0 " + speed_map[0];
if (crStng.mode == 0 || crStng.mode == 2) amount = amount * 8;
Expand Down Expand Up @@ -248,7 +248,7 @@ function initNs() {
//Create the button and add to Main.panel
nsButton = new PanelMenu.Button(0.0, ButtonName);

(!crStng.lckMuseAct) ? nsButton.connect('button-press-event', mouseEventHandler): null;
(!crStng.lckMuseAct) ? nsButton.connect('button-press-event', mouseEventHandler) : null;
nsButton.add_child(nsActor);

Main.panel.addToStatusArea(ButtonName, nsButton, nsPosAdv(), nsPos());
Expand Down Expand Up @@ -339,7 +339,7 @@ function parseStat() {
resetCount = count;
}

(speed || speedUp) ? hideCount = 0: hideCount <= 8 ? hideCount++ : null
(speed || speedUp) ? hideCount = 0 : hideCount <= 8 ? hideCount++ : null

if (hideCount <= 8) {
nsButton == null ? initNs() : null
Expand Down Expand Up @@ -378,13 +378,13 @@ function _settingsChanged() {
}
}

function init() {}
function init() { }

function enable() {
settings = Convenience.getSettings(schema);
settings = ExtensionUtils.getSettings(schema);

fetchSettings(); // Automatically creates the netSpeed Button.
this._settingsChangedId = this.settings.connect('changed', this._settingsChanged);
this._settingsChangedId = settings.connect('changed', this._settingsChanged);
parseStat();

//Run infinite loop.
Expand All @@ -394,4 +394,4 @@ function enable() {
function disable() {
Mainloop.source_remove(timeout);
nsDestroy();
}
}
14 changes: 3 additions & 11 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,15 @@
"description": "A Net Speed extension With Loads of Customization. Fork of simplenetspeed \n \nWhat's new\n\u261e Add Use System Color Scheme option \n\u261e Update Preferences logic \n\u261e Filter more devices for net speed indicator \n\nFull CHANGELOG can be found on github releases page \n\nFeatures \n1. Clean UI \n2. Adjustable Refresh rate \n3. Preferences to manage extension \n4. Vertical Alignment Support \n5. Two Icon sets for Indicators \n\nFeature Highlights for Preferences \n1. Lock Mouse Actions option \n2. Advance Position options to pinpoint where to place the indicator on the Panel. \n3. Refresh time option by which you can change refresh rate value between 1.0 sec to 10.0 sec. \n4. Show Upload First option to show upload speed first \n5. Color Customizations for speed indicators \n6. Hide when Disconnected option \n7. Use Shorten Units option \n8. Limit Unit option and more... \n\nModes \n- Total net speed in b/s, kb/s, ... \n- Total net speed in B/s, KB/s, ... \n- Up & down speed in b/s, kb/s, ... \n- Up & down speed in B/s, KB/s, ... \n- Total downloads in B, KB, ... (Right click to reset counter) \n\nMouse Events \n- Left click to change modes \n- Right click(in 1-4 modes): Toggle the visibility of total loaded. \n- Right click(in 5th mode): Reset total downloaded. \n- Right Click(Four consecutive times): Toggle through horizontal/vertical alignment. \n- Middle click: Cycle through the font sizes.",
"name": "Net speed Simplified",
"shell-version": [
"3.14",
"3.16",
"3.18",
"3.20",
"3.22",
"3.24",
"3.26",
"3.28",
"3.30",
"3.32",
"3.34",
"3.36",
"3.38",
"40",
"41"
"41",
"42"
],
"url": "https://github.com/prateekmedia/netspeedsimplified",
"uuid": "[email protected]",
"version": 33
"version": 34
}
Loading

0 comments on commit d87015f

Please sign in to comment.