Initial commit
This commit is contained in:
commit
403c95ca18
7
README.md
Normal file
7
README.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
# gnome-shell-screenpad
|
||||
|
||||
A simple brightness slider for ASUS Zenbook Duo laptops' second "ScreenPad Plus" screens, that appears in the "Quick Settings" dropdown.
|
||||
|
||||
Requires the [asus-wmi-screenpad](https://github.com/Plippo/asus-wmi-screenpad) or [asus-wmi-screenpad-module](https://github.com/MatthewCash/asus-wmi-screenpad-module) kernel module, which provides the `/sys/class/leds/asus::screenpad/brightness` file.
|
||||
|
||||
This _will_ allow you to quickly turn the second screen back on if it doesn't wake from sleep.
|
60
extension.js
Normal file
60
extension.js
Normal file
|
@ -0,0 +1,60 @@
|
|||
/* extension.js
|
||||
*
|
||||
* 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 2 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/>.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
import GObject from 'gi://GObject';
|
||||
import GLib from 'gi://GLib';
|
||||
import Gio from 'gi://Gio';
|
||||
|
||||
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
|
||||
|
||||
import {Extension, gettext as _} from 'resource:///org/gnome/shell/extensions/extension.js';
|
||||
import {QuickSlider, SystemIndicator} from 'resource:///org/gnome/shell/ui/quickSettings.js';
|
||||
|
||||
const ScreenpadSlider = GObject.registerClass(
|
||||
class ScreenpadSlider extends QuickSlider {
|
||||
constructor() {
|
||||
super({ iconName: 'keyboard-brightness-symbolic' });
|
||||
|
||||
this._sliderChangedId = this.slider.connect('notify::value', this._sliderChanged.bind(this));
|
||||
this.slider.accessible_name = _('Screenpad');
|
||||
this.slider.value = 0.5;
|
||||
}
|
||||
|
||||
_sliderChanged() {
|
||||
const byte = Math.round(this.slider.value * 255);
|
||||
const brightness_file = Gio.File.new_for_path("/sys/class/leds/asus::screenpad/brightness");
|
||||
brightness_file.replace_contents(new TextEncoder().encode(byte.toString()), null, false, Gio.FileCreateFlags.NONE, null);
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
export default class ScreenpadExtension extends Extension {
|
||||
enable() {
|
||||
this._slider = new SystemIndicator();
|
||||
this._slider.quickSettingsItems.push(new ScreenpadSlider());
|
||||
|
||||
Main.panel.statusArea.quickSettings.addExternalIndicator(this._slider, 2);
|
||||
}
|
||||
|
||||
disable() {
|
||||
for (const item of this._slider.quickSettingsItems) {
|
||||
item.destroy();
|
||||
}
|
||||
this._slider.destroy();
|
||||
this._slider = null;
|
||||
}
|
||||
}
|
9
metadata.json
Normal file
9
metadata.json
Normal file
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"name": "Screenpad",
|
||||
"description": "Control Zenbook Duo Screenpad",
|
||||
"uuid": "screenpad@information-superhighway.net",
|
||||
"shell-version": [
|
||||
"46"
|
||||
],
|
||||
"url": "https://git.information-superhighway.net/SpindleyQ/gnome-shell-screenpad"
|
||||
}
|
Loading…
Reference in a new issue