First version
commit
f785812da8
|
|
@ -0,0 +1,249 @@
|
||||||
|
# Ping Monitor for GNOME Shell 48+
|
||||||
|
|
||||||
|
A GNOME Shell extension that displays network ping information in the status bar. This is a modernized version compatible with GNOME Shell 45, 46, 47, and 48.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- Monitor multiple network endpoints simultaneously
|
||||||
|
- Visual status indicators with customizable colors
|
||||||
|
- Real-time ping statistics in the panel
|
||||||
|
- Configurable refresh intervals and ping parameters
|
||||||
|
- Tooltip with detailed ping information
|
||||||
|
- Dropdown menu with comprehensive statistics
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
This extension requires GNOME Shell 45 or later (tested on GNOME Shell 48.4).
|
||||||
|
|
||||||
|
Before installing this extension, ensure you have the necessary system packages installed:
|
||||||
|
|
||||||
|
### On Ubuntu/Debian:
|
||||||
|
```bash
|
||||||
|
sudo apt-get install gir1.2-gtop-2.0 gir1.2-clutter-1.0
|
||||||
|
```
|
||||||
|
|
||||||
|
### On Fedora:
|
||||||
|
```bash
|
||||||
|
sudo dnf install libgtop2-devel
|
||||||
|
```
|
||||||
|
|
||||||
|
### On Arch Linux:
|
||||||
|
```bash
|
||||||
|
sudo pacman -S libgtop
|
||||||
|
```
|
||||||
|
|
||||||
|
### On openSUSE:
|
||||||
|
```bash
|
||||||
|
sudo zypper install gnome-shell-devel libgtop-devel libgtop-2_0-10 typelib-1_0-GTop-2_0
|
||||||
|
```
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
### Method 1: Manual Installation
|
||||||
|
|
||||||
|
1. Clone or download this repository:
|
||||||
|
```bash
|
||||||
|
cd ~/Downloads
|
||||||
|
# If you already have the ping-monitor-gnome48 directory, you're good to go
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Copy the extension to your local extensions directory:
|
||||||
|
```bash
|
||||||
|
mkdir -p ~/.local/share/gnome-shell/extensions
|
||||||
|
cp -r ~/Downloads/ping-monitor-gnome48 ~/.local/share/gnome-shell/extensions/ping-monitor@sfont.teldat.com
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Compile the schema (required):
|
||||||
|
```bash
|
||||||
|
cd ~/.local/share/gnome-shell/extensions/ping-monitor@sfont.teldat.com
|
||||||
|
glib-compile-schemas schemas/
|
||||||
|
```
|
||||||
|
|
||||||
|
4. Restart GNOME Shell:
|
||||||
|
- On X11: Press `Alt + F2`, type `r`, and press Enter
|
||||||
|
- On Wayland: Log out and log back in
|
||||||
|
|
||||||
|
5. Enable the extension:
|
||||||
|
```bash
|
||||||
|
gnome-extensions enable ping-monitor@sfont.teldat.com
|
||||||
|
```
|
||||||
|
|
||||||
|
### Method 2: Development/Testing Installation (with symlink)
|
||||||
|
|
||||||
|
If you want to easily test changes:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mkdir -p ~/.local/share/gnome-shell/extensions
|
||||||
|
cd ~/.local/share/gnome-shell/extensions
|
||||||
|
ln -s ~/Downloads/ping-monitor-gnome48 ping-monitor@sfont.teldat.com
|
||||||
|
cd ping-monitor@sfont.teldat.com
|
||||||
|
glib-compile-schemas schemas/
|
||||||
|
gnome-extensions enable ping-monitor@sfont.teldat.com
|
||||||
|
```
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
### Create Configuration File
|
||||||
|
|
||||||
|
The extension reads its configuration from `~/.config/ping-monitor.conf`. Create this file with the following structure:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"debug_output": false,
|
||||||
|
"ping_config": [
|
||||||
|
{
|
||||||
|
"tag": "google",
|
||||||
|
"name": "Google",
|
||||||
|
"address": "8.8.8.8",
|
||||||
|
"ping_count": 2,
|
||||||
|
"ping_interval": 0.3,
|
||||||
|
"ping_deadline": 3,
|
||||||
|
"refresh_interval": 2000,
|
||||||
|
"active": true,
|
||||||
|
"visible": true,
|
||||||
|
"show_name": true,
|
||||||
|
"show_address": true,
|
||||||
|
"show_tooltip": true,
|
||||||
|
"warning_threshold": 20
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tag": "router",
|
||||||
|
"name": "Router",
|
||||||
|
"address": "192.168.0.1",
|
||||||
|
"ping_count": 2,
|
||||||
|
"ping_interval": 0.3,
|
||||||
|
"ping_deadline": 3,
|
||||||
|
"refresh_interval": 2000,
|
||||||
|
"active": true,
|
||||||
|
"visible": true,
|
||||||
|
"show_name": true,
|
||||||
|
"show_address": true,
|
||||||
|
"show_tooltip": true,
|
||||||
|
"warning_threshold": 20
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Configuration Parameters
|
||||||
|
|
||||||
|
- **debug_output**: Enable debug logging (true/false)
|
||||||
|
- **tag**: Unique identifier for the ping target
|
||||||
|
- **name**: Display name shown in the panel
|
||||||
|
- **address**: IP address or hostname to ping
|
||||||
|
- **ping_count**: Number of ping packets to send
|
||||||
|
- **ping_interval**: Interval between ping packets (seconds)
|
||||||
|
- **ping_deadline**: Maximum time to wait for all pings (seconds)
|
||||||
|
- **refresh_interval**: Time between ping operations (milliseconds)
|
||||||
|
- **active**: Enable this ping target (true/false)
|
||||||
|
- **visible**: Show in the status bar (true/false)
|
||||||
|
- **show_name**: Display the name in the panel (true/false)
|
||||||
|
- **show_address**: Display the address below the name (true/false)
|
||||||
|
- **show_tooltip**: Show tooltip on hover (true/false)
|
||||||
|
- **warning_threshold**: Ping time in ms to trigger warning color
|
||||||
|
|
||||||
|
### Color Preferences
|
||||||
|
|
||||||
|
You can customize the status indicator colors through the extension preferences:
|
||||||
|
|
||||||
|
1. Open Extension Preferences:
|
||||||
|
```bash
|
||||||
|
gnome-extensions prefs ping-monitor@sfont.teldat.com
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Adjust the colors for:
|
||||||
|
- **Good**: Successful ping with normal latency
|
||||||
|
- **Warning**: Successful ping with high latency
|
||||||
|
- **Bad**: Failed ping or timeout
|
||||||
|
- **Loss**: Partial packet loss
|
||||||
|
|
||||||
|
### Reloading Configuration
|
||||||
|
|
||||||
|
After modifying `~/.config/ping-monitor.conf`:
|
||||||
|
|
||||||
|
1. Click on the Ping Monitor icon in the status bar
|
||||||
|
2. Select "Reload config" from the dropdown menu
|
||||||
|
|
||||||
|
Or restart GNOME Shell (Alt + F2, type 'r', press Enter on X11).
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
### Extension doesn't appear after installation
|
||||||
|
|
||||||
|
1. Make sure the schema is compiled:
|
||||||
|
```bash
|
||||||
|
cd ~/.local/share/gnome-shell/extensions/ping-monitor@sfont.teldat.com
|
||||||
|
glib-compile-schemas schemas/
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Check if the extension is enabled:
|
||||||
|
```bash
|
||||||
|
gnome-extensions list
|
||||||
|
gnome-extensions enable ping-monitor@sfont.teldat.com
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Restart GNOME Shell
|
||||||
|
|
||||||
|
### No ping data showing
|
||||||
|
|
||||||
|
1. Verify your configuration file exists and is valid JSON:
|
||||||
|
```bash
|
||||||
|
cat ~/.config/ping-monitor.conf
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Check the logs for errors:
|
||||||
|
```bash
|
||||||
|
journalctl -f -o cat /usr/bin/gnome-shell
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Ensure you have network connectivity and can ping the configured addresses:
|
||||||
|
```bash
|
||||||
|
ping -c 2 8.8.8.8
|
||||||
|
```
|
||||||
|
|
||||||
|
### Permission errors
|
||||||
|
|
||||||
|
The ping.sh script needs to be executable:
|
||||||
|
```bash
|
||||||
|
chmod +x ~/.local/share/gnome-shell/extensions/ping-monitor@sfont.teldat.com
|
||||||
|
```
|
||||||
|
|
||||||
|
## What's New in This Version
|
||||||
|
|
||||||
|
This is a complete modernization for GNOME Shell 45-48:
|
||||||
|
|
||||||
|
- ✅ Converted to ES6 modules
|
||||||
|
- ✅ Uses modern Extension API
|
||||||
|
- ✅ Updated to GTK4 for preferences
|
||||||
|
- ✅ Removed deprecated APIs (Lang.bind, old imports system)
|
||||||
|
- ✅ Modern async/await patterns
|
||||||
|
- ✅ Compatible with Wayland and X11
|
||||||
|
- ✅ Updated GObject registration
|
||||||
|
- ✅ Modern file dialog APIs
|
||||||
|
|
||||||
|
## Credits
|
||||||
|
|
||||||
|
Original extension by [samuelba](https://github.com/samuelba)
|
||||||
|
|
||||||
|
Based on [gnome-shell-system-monitor-applet](https://github.com/paradoxxxzero/gnome-shell-system-monitor-applet)
|
||||||
|
|
||||||
|
Modernized for GNOME Shell 48+ by Claude
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
Copyright (C) 2019 Samuel Bachmann aka samuelba
|
||||||
|
|
||||||
|
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/>.
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,58 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Ping Monitor Extension Installer for GNOME Shell 48+
|
||||||
|
# This script installs the Ping Monitor extension to your local GNOME Shell extensions directory
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
EXTENSION_UUID="ping-monitor@sfont.teldat.com"
|
||||||
|
EXTENSION_DIR="$HOME/.local/share/gnome-shell/extensions/$EXTENSION_UUID"
|
||||||
|
|
||||||
|
echo "Installing Ping Monitor Extension for GNOME Shell 48+"
|
||||||
|
echo "======================================================"
|
||||||
|
echo
|
||||||
|
|
||||||
|
# Create extensions directory if it doesn't exist
|
||||||
|
echo "Creating extensions directory..."
|
||||||
|
mkdir -p "$HOME/.local/share/gnome-shell/extensions"
|
||||||
|
|
||||||
|
# Copy extension files
|
||||||
|
echo "Copying extension files..."
|
||||||
|
if [ -d "$EXTENSION_DIR" ]; then
|
||||||
|
echo "Extension directory already exists. Removing old version..."
|
||||||
|
rm -rf "$EXTENSION_DIR"
|
||||||
|
fi
|
||||||
|
|
||||||
|
cp -r "$(dirname "$0")" "$EXTENSION_DIR"
|
||||||
|
|
||||||
|
# Compile schema
|
||||||
|
echo "Compiling GSettings schema..."
|
||||||
|
cd "$EXTENSION_DIR"
|
||||||
|
glib-compile-schemas schemas/
|
||||||
|
|
||||||
|
# Make ping.sh executable
|
||||||
|
echo "Setting permissions..."
|
||||||
|
chmod +x "$EXTENSION_DIR/ping.sh"
|
||||||
|
|
||||||
|
# Create example config if it doesn't exist
|
||||||
|
if [ ! -f "$HOME/.config/ping-monitor.conf" ]; then
|
||||||
|
echo "Creating example configuration file at ~/.config/ping-monitor.conf..."
|
||||||
|
cp "$EXTENSION_DIR/ping-monitor.conf.example" "$HOME/.config/ping-monitor.conf"
|
||||||
|
echo "You can edit this file to configure your ping targets."
|
||||||
|
else
|
||||||
|
echo "Configuration file already exists at ~/.config/ping-monitor.conf"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "Installation complete!"
|
||||||
|
echo
|
||||||
|
echo "To enable the extension:"
|
||||||
|
echo " 1. On X11: Press Alt+F2, type 'r', and press Enter to restart GNOME Shell"
|
||||||
|
echo " 2. On Wayland: Log out and log back in"
|
||||||
|
echo " 3. Run: gnome-extensions enable $EXTENSION_UUID"
|
||||||
|
echo
|
||||||
|
echo "Or use the Extensions app to enable it."
|
||||||
|
echo
|
||||||
|
echo "Configuration file: ~/.config/ping-monitor.conf"
|
||||||
|
echo "Edit this file and reload the extension to change ping targets."
|
||||||
|
echo
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"shell-version": ["45", "46", "47", "48"],
|
||||||
|
"uuid": "ping-monitor@sfont.teldat.com",
|
||||||
|
"name": "Ping Monitor",
|
||||||
|
"url": "https://github.com/anybotics/gnome-shell-ping-monitor-applet",
|
||||||
|
"description": "Display ping information. Read the readme to see how it is configured.",
|
||||||
|
"settings-schema": "org.gnome.shell.extensions.ping-monitor",
|
||||||
|
"gettext-domain": "ping-monitor",
|
||||||
|
"version": 2
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
{
|
||||||
|
"debug_output": false,
|
||||||
|
"ping_config": [
|
||||||
|
{
|
||||||
|
"tag": "google",
|
||||||
|
"name": "Google",
|
||||||
|
"address": "8.8.8.8",
|
||||||
|
"ping_count": 2,
|
||||||
|
"ping_interval": 0.3,
|
||||||
|
"ping_deadline": 3,
|
||||||
|
"refresh_interval": 2000,
|
||||||
|
"active": true,
|
||||||
|
"visible": true,
|
||||||
|
"show_name": true,
|
||||||
|
"show_address": true,
|
||||||
|
"show_tooltip": true,
|
||||||
|
"warning_threshold": 20
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tag": "router",
|
||||||
|
"name": "Router",
|
||||||
|
"address": "192.168.0.1",
|
||||||
|
"ping_count": 2,
|
||||||
|
"ping_interval": 0.3,
|
||||||
|
"ping_deadline": 3,
|
||||||
|
"refresh_interval": 2000,
|
||||||
|
"active": true,
|
||||||
|
"visible": true,
|
||||||
|
"show_name": true,
|
||||||
|
"show_address": true,
|
||||||
|
"show_tooltip": true,
|
||||||
|
"warning_threshold": 20
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tag": "cloudflare",
|
||||||
|
"name": "Cloudflare",
|
||||||
|
"address": "1.1.1.1",
|
||||||
|
"ping_count": 2,
|
||||||
|
"ping_interval": 0.3,
|
||||||
|
"ping_deadline": 3,
|
||||||
|
"refresh_interval": 2000,
|
||||||
|
"active": true,
|
||||||
|
"visible": true,
|
||||||
|
"show_name": true,
|
||||||
|
"show_address": false,
|
||||||
|
"show_tooltip": true,
|
||||||
|
"warning_threshold": 20
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
#!/bin/bash
|
||||||
|
##################################################################################
|
||||||
|
# This file is part of Ping Monitor Gnome extension.
|
||||||
|
# Apt Update Indicator 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.
|
||||||
|
# Apt Update Indicator 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 System Monitor. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
# Copyright 2019 Samuel Bachmann, sbachmann@anybotics.com.
|
||||||
|
##################################################################################
|
||||||
|
|
||||||
|
############
|
||||||
|
# #
|
||||||
|
# Ping #
|
||||||
|
# #
|
||||||
|
############
|
||||||
|
|
||||||
|
ADDRESS=$1
|
||||||
|
COUNT=$2
|
||||||
|
DEADLINE=$3
|
||||||
|
INTERVAL=$4
|
||||||
|
|
||||||
|
ping -c ${COUNT} -w ${DEADLINE} -i ${INTERVAL} ${ADDRESS}
|
||||||
|
|
@ -0,0 +1,158 @@
|
||||||
|
import Gtk from 'gi://Gtk';
|
||||||
|
import Adw from 'gi://Adw';
|
||||||
|
import Gio from 'gi://Gio';
|
||||||
|
import Gdk from 'gi://Gdk';
|
||||||
|
import GLib from 'gi://GLib';
|
||||||
|
|
||||||
|
import {ExtensionPreferences, gettext as _} from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js';
|
||||||
|
|
||||||
|
function color_to_hex(rgba) {
|
||||||
|
const red = Math.round(rgba.red * 255);
|
||||||
|
const green = Math.round(rgba.green * 255);
|
||||||
|
const blue = Math.round(rgba.blue * 255);
|
||||||
|
const alpha = Math.round(rgba.alpha * 255);
|
||||||
|
return `#${red.toString(16).padStart(2, '0')}${green.toString(16).padStart(2, '0')}${blue.toString(16).padStart(2, '0')}${alpha.toString(16).padStart(2, '0')}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function hex_to_rgba(hex) {
|
||||||
|
const rgba = new Gdk.RGBA();
|
||||||
|
rgba.parse(hex);
|
||||||
|
return rgba;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default class PingMonitorPreferences extends ExtensionPreferences {
|
||||||
|
fillPreferencesWindow(window) {
|
||||||
|
const settings = this.getSettings();
|
||||||
|
|
||||||
|
// Create preferences page
|
||||||
|
const page = new Adw.PreferencesPage({
|
||||||
|
title: _('Preferences'),
|
||||||
|
icon_name: 'dialog-information-symbolic'
|
||||||
|
});
|
||||||
|
|
||||||
|
// Create color preferences group
|
||||||
|
const colorGroup = new Adw.PreferencesGroup({
|
||||||
|
title: _('Color Settings'),
|
||||||
|
description: _('Configure colors for different ping states')
|
||||||
|
});
|
||||||
|
page.add(colorGroup);
|
||||||
|
|
||||||
|
// Good color
|
||||||
|
const goodRow = this._createColorRow(
|
||||||
|
settings,
|
||||||
|
_('Good'),
|
||||||
|
_('Color for good ping response'),
|
||||||
|
'ping-good-color'
|
||||||
|
);
|
||||||
|
colorGroup.add(goodRow);
|
||||||
|
|
||||||
|
// Warning color
|
||||||
|
const warningRow = this._createColorRow(
|
||||||
|
settings,
|
||||||
|
_('Warning'),
|
||||||
|
_('Color for warning ping response'),
|
||||||
|
'ping-warning-color'
|
||||||
|
);
|
||||||
|
colorGroup.add(warningRow);
|
||||||
|
|
||||||
|
// Bad color
|
||||||
|
const badRow = this._createColorRow(
|
||||||
|
settings,
|
||||||
|
_('Bad'),
|
||||||
|
_('Color for bad ping response'),
|
||||||
|
'ping-bad-color'
|
||||||
|
);
|
||||||
|
colorGroup.add(badRow);
|
||||||
|
|
||||||
|
// Loss color
|
||||||
|
const lossRow = this._createColorRow(
|
||||||
|
settings,
|
||||||
|
_('Loss'),
|
||||||
|
_('Color for ping packet loss'),
|
||||||
|
'ping-loss-color'
|
||||||
|
);
|
||||||
|
colorGroup.add(lossRow);
|
||||||
|
|
||||||
|
// Create configuration file group
|
||||||
|
const configGroup = new Adw.PreferencesGroup({
|
||||||
|
title: _('Configuration'),
|
||||||
|
description: _('Configure the path to the configuration file')
|
||||||
|
});
|
||||||
|
page.add(configGroup);
|
||||||
|
|
||||||
|
// Config path row
|
||||||
|
const configRow = new Adw.ActionRow({
|
||||||
|
title: _('Configuration File'),
|
||||||
|
subtitle: settings.get_string('ping-config-path') || _('No file selected')
|
||||||
|
});
|
||||||
|
|
||||||
|
const fileButton = new Gtk.Button({
|
||||||
|
label: _('Select File'),
|
||||||
|
valign: Gtk.Align.CENTER
|
||||||
|
});
|
||||||
|
|
||||||
|
fileButton.connect('clicked', () => {
|
||||||
|
const dialog = new Gtk.FileDialog();
|
||||||
|
dialog.set_title(_('Open configuration file'));
|
||||||
|
|
||||||
|
const initialFolder = Gio.File.new_for_path(GLib.getenv('HOME') + '/.config');
|
||||||
|
dialog.set_initial_folder(initialFolder);
|
||||||
|
|
||||||
|
const currentPath = settings.get_string('ping-config-path');
|
||||||
|
if (currentPath) {
|
||||||
|
const currentFile = Gio.File.new_for_path(currentPath);
|
||||||
|
dialog.set_initial_file(currentFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
dialog.open(window, null, (source, result) => {
|
||||||
|
try {
|
||||||
|
const file = dialog.open_finish(result);
|
||||||
|
if (file) {
|
||||||
|
const path = file.get_path();
|
||||||
|
settings.set_string('ping-config-path', path);
|
||||||
|
configRow.subtitle = path;
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
if (e.matches(Gtk.DialogError, Gtk.DialogError.DISMISSED)) {
|
||||||
|
// User cancelled, do nothing
|
||||||
|
} else {
|
||||||
|
log('Error selecting file: ' + e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
configRow.add_suffix(fileButton);
|
||||||
|
configRow.activatable_widget = fileButton;
|
||||||
|
configGroup.add(configRow);
|
||||||
|
|
||||||
|
window.add(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
_createColorRow(settings, title, subtitle, key) {
|
||||||
|
const row = new Adw.ActionRow({
|
||||||
|
title: title,
|
||||||
|
subtitle: subtitle
|
||||||
|
});
|
||||||
|
|
||||||
|
const colorButton = new Gtk.ColorButton({
|
||||||
|
valign: Gtk.Align.CENTER
|
||||||
|
});
|
||||||
|
colorButton.set_use_alpha(true);
|
||||||
|
|
||||||
|
// Set initial color
|
||||||
|
const currentColor = settings.get_string(key);
|
||||||
|
const rgba = hex_to_rgba(currentColor);
|
||||||
|
colorButton.set_rgba(rgba);
|
||||||
|
|
||||||
|
// Connect color change signal
|
||||||
|
colorButton.connect('color-set', (button) => {
|
||||||
|
settings.set_string(key, color_to_hex(button.get_rgba()));
|
||||||
|
});
|
||||||
|
|
||||||
|
row.add_suffix(colorButton);
|
||||||
|
row.activatable_widget = colorButton;
|
||||||
|
|
||||||
|
return row;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,72 @@
|
||||||
|
<schemalist gettext-domain="ping-monitor">
|
||||||
|
<enum id="org.gnome.shell.extensions.ping-monitor.display-style">
|
||||||
|
<value value="0" nick="digit"/>
|
||||||
|
<value value="1" nick="graph"/>
|
||||||
|
<value value="2" nick="both"/>
|
||||||
|
</enum>
|
||||||
|
<enum id="org.gnome.shell.extensions.ping-monitor.disk-usage-style">
|
||||||
|
<value value="0" nick="pie"/>
|
||||||
|
<value value="1" nick="bar"/>
|
||||||
|
<value value="2" nick="none"/>
|
||||||
|
</enum>
|
||||||
|
<schema id="org.gnome.shell.extensions.ping-monitor" path="/org/gnome/shell/extensions/ping-monitor/">
|
||||||
|
<key name="ping-good-color" type="s">
|
||||||
|
<default>'#00ff00'</default>
|
||||||
|
<summary>Color of good ping status.</summary>
|
||||||
|
</key>
|
||||||
|
<key name="ping-warning-color" type="s">
|
||||||
|
<default>'#ffaa00'</default>
|
||||||
|
<summary>Color of warning ping status.</summary>
|
||||||
|
</key>
|
||||||
|
<key name="ping-bad-color" type="s">
|
||||||
|
<default>'#ff0000'</default>
|
||||||
|
<summary>Color of bad ping status.</summary>
|
||||||
|
</key>
|
||||||
|
<key name="ping-loss-color" type="s">
|
||||||
|
<default>'#ff00d3'</default>
|
||||||
|
<summary>Color of loss ping status.</summary>
|
||||||
|
</key>
|
||||||
|
<key name="ping-config-path" type="s">
|
||||||
|
<default>''</default>
|
||||||
|
<summary>Configuration path.</summary>
|
||||||
|
</key>
|
||||||
|
|
||||||
|
<key name="icon-display" type="b">
|
||||||
|
<default>true</default>
|
||||||
|
<summary>Display ping monitor icon</summary>
|
||||||
|
<description>Set to true to display ping monitor icon in status bar.(NOTICE: The icon will be shown when none of the others is shown.)</description>
|
||||||
|
</key>
|
||||||
|
|
||||||
|
<key name="background" type="s">
|
||||||
|
<default>'#ffffffff'</default>
|
||||||
|
<summary>Color of background</summary>
|
||||||
|
</key>
|
||||||
|
|
||||||
|
<key name="ping-ids" type="as">
|
||||||
|
<default>['0', '1', '2']</default>
|
||||||
|
<summary>Ping ids.</summary>
|
||||||
|
<description></description>
|
||||||
|
</key>
|
||||||
|
<key name="ping-tags" type="as">
|
||||||
|
<default>['lpc', 'npc', 'apc']</default>
|
||||||
|
<summary>Ping tags.</summary>
|
||||||
|
<description></description>
|
||||||
|
</key>
|
||||||
|
<key name="ping-names" type="as">
|
||||||
|
<default>['LPC', 'NPC', 'APC']</default>
|
||||||
|
<summary>Ping names.</summary>
|
||||||
|
<description></description>
|
||||||
|
</key>
|
||||||
|
<key name="ping-ip-addresses" type="as">
|
||||||
|
<default>['8.8.8.8', '192.168.0.1', '192.168.0.100']</default>
|
||||||
|
<summary>Ping ip addresses.</summary>
|
||||||
|
<description></description>
|
||||||
|
</key>
|
||||||
|
<key name="ping-show-text" type="as">
|
||||||
|
<default>['true', 'true', 'true']</default>
|
||||||
|
<summary>Ping show text.</summary>
|
||||||
|
<description></description>
|
||||||
|
</key>
|
||||||
|
|
||||||
|
</schema>
|
||||||
|
</schemalist>
|
||||||
|
|
@ -0,0 +1,45 @@
|
||||||
|
/* Ping Monitor Extension Styles */
|
||||||
|
|
||||||
|
.ping-chart {
|
||||||
|
padding: 0px;
|
||||||
|
margin: 0px 4px;
|
||||||
|
min-width: 12px;
|
||||||
|
min-height: 12px;
|
||||||
|
width: 12px;
|
||||||
|
height: 12px;
|
||||||
|
border-radius: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ping-status-label {
|
||||||
|
padding: 1px 5px;
|
||||||
|
font-size: 0.9em;
|
||||||
|
line-height: 1.2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ping-status-value {
|
||||||
|
padding: 0px 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ping-perc-label {
|
||||||
|
padding: 0px 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ping-title {
|
||||||
|
font-weight: bold;
|
||||||
|
padding: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ping-value-left {
|
||||||
|
padding: 5px;
|
||||||
|
min-width: 150px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ping-tooltip-box {
|
||||||
|
background-color: rgba(0, 0, 0, 0.8);
|
||||||
|
border-radius: 5px;
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ping-tooltip-item {
|
||||||
|
padding: 5px;
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue