-
Notifications
You must be signed in to change notification settings - Fork 3
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
1 parent
b3417c2
commit f9723ca
Showing
7 changed files
with
98 additions
and
133 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
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,10 @@ | ||
{ | ||
"name": "Default Workspace", | ||
"description": "Switches to the specified workspace on login.\nUseful for fixed number of workspace setups where the first workspace isn't the main one.", | ||
"shell-version": ["40", "41", "42", "43", "44"], | ||
"shell-version": ["45"], | ||
"url": "https://github.com/MateusRodCosta/gnome-shell-extension-default-workspace", | ||
"uuid": "default-workspace@mateusrodcosta.com", | ||
"version": 3 | ||
"settings-schema": "org.gnome.shell.extensions.default-workspace", | ||
"version": 5 | ||
|
||
} |
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,47 +1,29 @@ | ||
const {GObject, Gtk, Gio} = imports.gi; | ||
const ExtensionUtils = imports.misc.extensionUtils; | ||
const Me = ExtensionUtils.getCurrentExtension(); | ||
import Gio from 'gi://Gio'; | ||
import Gtk from 'gi://Gtk'; | ||
import {ExtensionPreferences} from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js'; | ||
|
||
const DEFAULT_WORKSPACE_SCHEMA = 'org.gnome.shell.extensions.default-workspace'; | ||
const DEFAULT_WORKSPACE_KEY = 'default-workspace-number'; | ||
|
||
const DefaultWorkspaceBuilderScope = GObject.registerClass({ | ||
Implements: [Gtk.BuilderScope], | ||
}, class DefaultWorkspaceBuilderScope extends GObject.Object { | ||
export default class DefaultWorkspacePreferences extends ExtensionPreferences { | ||
|
||
vfunc_create_closure(builder, handlerName, flags, connectObject) { | ||
if (flags & Gtk.BuilderClosureFlags.SWAPPED) | ||
throw new Error('Unsupported template signal flag "swapped"'); | ||
fillPreferencesWindow(window) { | ||
let settings = this.getSettings(); | ||
|
||
if (typeof this[handlerName] === 'undefined') | ||
throw new Error(`${handlerName} is undefined`); | ||
let builder = new Gtk.Builder(); | ||
|
||
return this[handlerName].bind(connectObject || this); | ||
} | ||
|
||
}); | ||
|
||
function init () {} | ||
|
||
function buildPrefsWidget () { | ||
builder.add_from_file(`${this.path}/ui/prefs.ui`); | ||
|
||
this.settings = ExtensionUtils.getSettings(DEFAULT_WORKSPACE_SCHEMA); | ||
let spin_row = builder.get_object('default_workspace_spinrow'); | ||
if (spin_row) { | ||
settings.bind( | ||
DEFAULT_WORKSPACE_KEY, | ||
spin_row, | ||
'value', | ||
Gio.SettingsBindFlags.DEFAULT | ||
); | ||
} | ||
|
||
let builder = new Gtk.Builder(); | ||
|
||
builder.set_scope(new DefaultWorkspaceBuilderScope()); | ||
builder.set_translation_domain('gettext-domain'); | ||
builder.add_from_file(Me.dir.get_path() + '/ui/prefs.ui'); | ||
|
||
let sb = builder.get_object('default_workspace_spinbutton'); | ||
if(sb) { | ||
this.settings.bind( | ||
DEFAULT_WORKSPACE_KEY, | ||
sb, | ||
'value', | ||
Gio.SettingsBindFlags.DEFAULT | ||
); | ||
let page = builder.get_object('preferences_main_page'); | ||
window.add(page); | ||
} | ||
|
||
return builder.get_object('box'); | ||
} |
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version='1.0' encoding='UTF-8' standalone='no'?> | ||
<!DOCTYPE cambalache-project SYSTEM "cambalache-project.dtd"> | ||
<cambalache-project version="0.13.1" target_tk="gtk-4.0"> | ||
<ui> | ||
(1,None,"defaultworkspace.ui","defaultworkspace.ui",None,None,None,None,None,None,None) | ||
</ui> | ||
<object> | ||
(1,1,"AdwPreferencesPage","preferences_main_page",None,None,None,None,-1,None), | ||
(1,2,"AdwPreferencesGroup","workspace_group",1,None,None,None,-1,None), | ||
(1,3,"AdwSpinRow","default_workspace_spinrow",2,None,None,None,-1,None), | ||
(1,4,"GtkAdjustment","default_workspace_adjustment",3,None,None,None,-1,None) | ||
</object> | ||
<object_property> | ||
(1,2,"AdwPreferencesGroup","title","Workspace",None,None,None,None,None,None,None,None,None), | ||
(1,3,"AdwPreferencesRow","title","Default Workspace",None,None,None,None,None,None,None,None,None), | ||
(1,3,"AdwSpinRow","adjustment",None,None,None,None,None,4,None,None,None,None), | ||
(1,4,"GtkAdjustment","lower","1.0",None,None,None,None,None,None,None,None,None), | ||
(1,4,"GtkAdjustment","page-increment","1.0",None,None,None,None,None,None,None,None,None), | ||
(1,4,"GtkAdjustment","page-size","1.0",None,None,None,None,None,None,None,None,None), | ||
(1,4,"GtkAdjustment","step-increment","1.0",None,None,None,None,None,None,None,None,None), | ||
(1,4,"GtkAdjustment","upper","37.0",None,None,None,None,None,None,None,None,None), | ||
(1,4,"GtkAdjustment","value","1.0",None,None,None,None,None,None,None,None,None) | ||
</object_property> | ||
</cambalache-project> |
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,56 +1,29 @@ | ||
<?xml version='1.0' encoding='UTF-8'?> | ||
<interface domain="my-gettext-domain"> | ||
<!-- Created with Cambalache 0.16.0 --> | ||
<interface> | ||
<!-- interface-name defaultworkspace.ui --> | ||
<requires lib="gtk" version="4.0"/> | ||
<object class="GtkBox" id="box"> | ||
<property name="orientation">vertical</property> | ||
<property name="halign">center</property> | ||
<property name="spacing">12</property> | ||
<property name="margin_top">36</property> | ||
<property name="margin_bottom">36</property> | ||
<property name="margin_start">36</property> | ||
<property name="margin_end">36</property> | ||
<requires lib="libadwaita" version="1.4"/> | ||
<object class="AdwPreferencesPage" id="preferences_main_page"> | ||
<child> | ||
<object class="GtkFrame" id="frame"> | ||
<object class="AdwPreferencesGroup" id="workspace_group"> | ||
<property name="title">Workspace</property> | ||
<child> | ||
<object class="GtkListBox" id="list_box"> | ||
<property name="selection-mode">none</property> | ||
<property name="show_separators">true</property> | ||
<child> | ||
<object class="GtkListBoxRow" id="default_workspace_row"> | ||
<child> | ||
<object class="GtkBox" id="default_workspace_box"> | ||
<property name="spacing">12</property> | ||
<property name="margin_top">6</property> | ||
<property name="margin_bottom">6</property> | ||
<property name="margin_start">6</property> | ||
<property name="margin_end">6</property> | ||
<child> | ||
<object class="GtkLabel" id="default_workspace_label"> | ||
<property name="label">Default Workspace</property> | ||
<property name="hexpand">true</property> | ||
<property name="xalign">0</property> | ||
</object> | ||
</child> | ||
<child> | ||
<object class="GtkSpinButton" id="default_workspace_spinbutton"> | ||
<property name="adjustment">default_workspace_adjustment</property> | ||
</object> | ||
</child> | ||
</object> | ||
</child> | ||
<object class="AdwSpinRow" id="default_workspace_spinrow"> | ||
<property name="adjustment"> | ||
<object class="GtkAdjustment" id="default_workspace_adjustment"> | ||
<property name="lower">1.0</property> | ||
<property name="page-increment">1.0</property> | ||
<property name="page-size">1.0</property> | ||
<property name="step-increment">1.0</property> | ||
<property name="upper">37.0</property> | ||
<property name="value">1.0</property> | ||
</object> | ||
</child> | ||
</property> | ||
<property name="title">Default Workspace</property> | ||
</object> | ||
</child> | ||
</object> | ||
</child> | ||
</object> | ||
<object class="GtkAdjustment" id="default_workspace_adjustment"> | ||
<property name="lower">1.0</property> | ||
<property name="page-increment">1.0</property> | ||
<property name="page-size">1.0</property> | ||
<property name="step-increment">1.0</property> | ||
<property name="upper">37.0</property> | ||
<property name="value">1.0</property> | ||
</object> | ||
</interface> |