-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from saccuz/dev
Dev
- Loading branch information
Showing
4 changed files
with
86 additions
and
3 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 |
---|---|---|
@@ -1,8 +1,11 @@ | ||
{ | ||
"name": "Week Start Modifier", | ||
"description": "Modify starting day of the week", | ||
"uuid": "week-start-modifier@saccuzm@gmail.com", | ||
"uuid": "weekstartmodifier@saccuzm@gmail.com", | ||
"shell-version": [ | ||
"45" | ||
] | ||
], | ||
"url":"https://github.com/saccuz/week-start-modifier", | ||
"settings-schema": "org.gnome.shell.extensions.weekstartmodifier", | ||
"gettext-domain": "weekstartmodifier@saccuzm@gmail.com" | ||
} |
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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import Gio from 'gi://Gio'; | ||
import Gtk from 'gi://Gtk'; | ||
import Adw from 'gi://Adw'; | ||
|
||
import {ExtensionPreferences, gettext as _} from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js'; | ||
|
||
|
||
export default class ExamplePreferences extends ExtensionPreferences { | ||
fillPreferencesWindow(window) { | ||
|
||
const days = [ | ||
['Sunday', _('Sunday')], | ||
['Monday', _('Monday')], | ||
['Tuesday', _('Tuesday')], | ||
['Wednesday', _('Wednesday')], | ||
['Thursday', _('Thursday')], | ||
['Friday', _('Friday')], | ||
['Saturday', _('Saturday')], | ||
]; | ||
|
||
// Create a preferences page, with a single group | ||
const page = new Adw.PreferencesPage({ | ||
title: _('General'), | ||
icon_name: 'dialog-information-symbolic', | ||
}); | ||
window.add(page); | ||
|
||
const group = new Adw.PreferencesGroup({ | ||
title: _('Starting day of the week'), | ||
}); | ||
page.add(group); | ||
|
||
let stringList = new Gtk.StringList(); | ||
days.forEach((it) => { | ||
stringList.append(it[1]); | ||
}); | ||
|
||
// Create a new preferences row | ||
const row = new Adw.ComboRow({ | ||
title: _('Day'), | ||
subtitle: _('Select the day on which the week start'), | ||
model: stringList | ||
}); | ||
group.add(row); | ||
|
||
// Create a settings object and bind the row to the `day` key | ||
window._settings = this.getSettings(); | ||
window._settings.bind('day', row, 'selected', Gio.SettingsBindFlags.DEFAULT); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/schemas/org.gnome.shell.extensions.weekstartmodifier.gschema.xml
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<schemalist> | ||
<schema id="org.gnome.shell.extensions.weekstartmodifier" path="/org/gnome/shell/extensions/weekstartmodifier/"> | ||
<key name="day" type="i"> | ||
<range min="0" max="6"/> | ||
<default>1</default> | ||
</key> | ||
</schema> | ||
</schemalist> |