forked from trflynn89/gnome-shell-volume-scroller
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
81 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,13 +3,7 @@ | |
"original-author": "francislavoie", | ||
"description": "Scroll up or down in the Top Bar to adjust volume.", | ||
"shell-version": [ | ||
"3.36", | ||
"3.38", | ||
"40", | ||
"41", | ||
"42", | ||
"43", | ||
"44" | ||
"45" | ||
], | ||
"url": "https://github.com/francislavoie/gnome-shell-volume-scroller", | ||
"uuid": "[email protected]", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,43 @@ | ||
const { Adw, Gio, Gtk } = imports.gi; | ||
|
||
const ExtensionUtils = imports.misc.extensionUtils; | ||
const Me = ExtensionUtils.getCurrentExtension(); | ||
|
||
|
||
function init() { | ||
import Adw from 'gi://Adw'; | ||
import Gio from 'gi://Gio'; | ||
import Gtk from 'gi://Gtk'; | ||
|
||
import {ExtensionPreferences} from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js'; | ||
|
||
export default class VolumeScrollerExtensionPreferences extends ExtensionPreferences { | ||
|
||
fillPreferencesWindow(window) { | ||
// Use the same GSettings schema as in `extension.js` | ||
window._settings = this.getSettings('org.gnome.shell.extensions.volume-scroller') | ||
|
||
// Create a preferences page and group | ||
const page = new Adw.PreferencesPage(); | ||
const group = new Adw.PreferencesGroup(); | ||
page.add(group); | ||
|
||
// Create a new preferences row | ||
const row = new Adw.ActionRow({ title: 'Granularity' }); | ||
group.add(row); | ||
|
||
// Create the value picker | ||
const granularityEntry = new Gtk.SpinButton({ | ||
adjustment: new Gtk.Adjustment({ step_increment: 1, lower: 1, upper: 50 }), | ||
value: window._settings.get_int('granularity'), | ||
valign: Gtk.Align.CENTER, | ||
halign: Gtk.Align.CENTER, | ||
}); | ||
window._settings.bind( | ||
'granularity', | ||
granularityEntry, | ||
'value', | ||
Gio.SettingsBindFlags.DEFAULT | ||
); | ||
|
||
// Add the value picker to the row | ||
row.add_suffix(granularityEntry); | ||
row.activatable_widget = granularityEntry; | ||
|
||
// Add our page to the window | ||
window.add(page); | ||
} | ||
} | ||
|
||
function fillPreferencesWindow(window) { | ||
// Use the same GSettings schema as in `extension.js` | ||
const settings = ExtensionUtils.getSettings( | ||
'org.gnome.shell.extensions.volume-scroller'); | ||
|
||
// Create a preferences page and group | ||
const page = new Adw.PreferencesPage(); | ||
const group = new Adw.PreferencesGroup(); | ||
page.add(group); | ||
|
||
// Create a new preferences row | ||
const row = new Adw.ActionRow({ title: 'Granularity' }); | ||
group.add(row); | ||
|
||
// Create the value picker | ||
const granularityEntry = new Gtk.SpinButton({ | ||
adjustment: new Gtk.Adjustment({ step_increment: 1, lower: 1, upper: 50 }), | ||
value: settings.get_int('granularity'), | ||
valign: Gtk.Align.CENTER, | ||
halign: Gtk.Align.CENTER, | ||
}); | ||
settings.bind( | ||
'granularity', | ||
granularityEntry, | ||
'value', | ||
Gio.SettingsBindFlags.DEFAULT | ||
); | ||
|
||
// Add the value picker to the row | ||
row.add_suffix(granularityEntry); | ||
row.activatable_widget = granularityEntry; | ||
|
||
// Add our page to the window | ||
window.add(page); | ||
} |