-
Notifications
You must be signed in to change notification settings - Fork 14
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
56 changed files
with
3,957 additions
and
785 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
UUID = [email protected] | ||
VERSION = 35 | ||
VERSION = 36 | ||
|
||
ifeq ($(strip $(DESTDIR)),) | ||
INSTALLBASE = $(HOME)/.local/share/gnome-shell/extensions | ||
|
@@ -10,7 +10,10 @@ endif | |
all: compile-resources compile-schemas | ||
|
||
compile-resources: | ||
glib-compile-resources --target=./$(UUID)/resources/org.gnome.Shell.Extensions.DeskChanger.gresource --sourcedir=./resources ./resources/org.gnome.Shell.Extensions.DeskChanger.gresource.xml | ||
glib-compile-resources \ | ||
--target=./$(UUID)/resources/org.gnome.Shell.Extensions.DeskChanger.gresource \ | ||
--sourcedir=./resources \ | ||
./resources/org.gnome.Shell.Extensions.DeskChanger.gresource.xml | ||
|
||
compile-schemas: | ||
glib-compile-schemas ./$(UUID)/schemas/ | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
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,2 @@ | ||
export const APP_ID = 'org.gnome.extensions.desk-changer'; | ||
export const APP_PATH = '/org/gnome/extensions/desk-changer'; |
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,23 @@ | ||
import Interface from "../daemon/interface.js"; | ||
import { getCaller } from "./utils.js"; | ||
|
||
export function debug(message, caller = null) { | ||
if (Interface.force_debug || Interface.settings.debug) { | ||
let _caller = caller || getCaller(), | ||
method = _caller.substring(0, _caller.indexOf('@')), | ||
re = new RegExp(`^.*${Interface.metadata.uuid}/`); | ||
|
||
// do some magic to make it neat | ||
_caller = _caller.substring(_caller.indexOf('@') + 1) | ||
.replace(re, '') | ||
.replace(/(:[0-9]+):[0-9]+$/gi, `@${method}$1`); | ||
|
||
console.log(`[${Interface.metadata.uuid}/${_caller}] ${message}`); | ||
} | ||
} | ||
|
||
export function error(exception, message = null) { | ||
let caller = getCaller(); | ||
|
||
console.error(`[] ${message}`, exception); | ||
} |
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,136 @@ | ||
import Gio from 'gi://Gio'; | ||
import GObject from 'gi://GObject'; | ||
|
||
const RotationMode = new GObject.registerClass({ | ||
Properties: { | ||
'key': GObject.param_spec_string( | ||
'key', | ||
'Key', | ||
'Rotation mode identifier', | ||
null, | ||
GObject.ParamFlags.READWRITE | ||
), | ||
'rotation': GObject.param_spec_string( | ||
'rotation', | ||
'Rotation', | ||
'Rotation mode type for daemon', | ||
null, | ||
GObject.ParamFlags.READWRITE | ||
), | ||
'label': GObject.param_spec_string( | ||
'label', | ||
'Label', | ||
'Label for rotation mode', | ||
null, | ||
GObject.ParamFlags.READWRITE | ||
), | ||
'interval': GObject.param_spec_uint( | ||
'interval', | ||
'Interval', | ||
'Interval value to pass to daemon', | ||
0, | ||
86400, | ||
0, | ||
GObject.ParamFlags.READWRITE | ||
), | ||
} | ||
}, | ||
class DeskChangerRotationMode extends GObject.Object { | ||
constructor(params={key: null, rotation: null, label: null, interval: 0}) { | ||
super(); | ||
|
||
this._key = params['key']; | ||
this._rotation = params['rotation']; | ||
this._label = params['label']; | ||
this._interval = params['interval']; | ||
} | ||
|
||
get interval() { | ||
return this._interval; | ||
} | ||
|
||
get key() { | ||
return this._key; | ||
} | ||
|
||
get label() { | ||
return this._label; | ||
} | ||
|
||
get rotation() { | ||
return this._rotation; | ||
} | ||
}); | ||
|
||
const RotationModes = Gio.ListStore.new(RotationMode); | ||
|
||
RotationModes.append(new RotationMode({ | ||
key: 'oneminute', | ||
rotation: 'interval', | ||
label: 'One minute interval', | ||
interval: 60, | ||
})); | ||
|
||
RotationModes.append(new RotationMode({ | ||
key: 'fiveminute', | ||
rotation: 'interval', | ||
label: 'Five minute interval', | ||
interval: 300, | ||
})); | ||
|
||
RotationModes.append(new RotationMode({ | ||
key: 'thirtyminute', | ||
rotation: 'interval', | ||
label: '30 Minute Interval', | ||
interval: 1800, | ||
})); | ||
RotationModes.append(new RotationMode({ | ||
key: 'onehour', | ||
rotation: 'interval', | ||
label: '1 Hour Interval', | ||
interval: '3600', | ||
})); | ||
RotationModes.append(new RotationMode({ | ||
key: 'sixhour', | ||
rotation: 'interval', | ||
label: '6 Hour Interval', | ||
interval: '21600', | ||
})); | ||
RotationModes.append(new RotationMode({ | ||
key: 'twelvehour', | ||
rotation: 'interval', | ||
label: '12 Hour Interval', | ||
interval: '43200', | ||
})); | ||
RotationModes.append(new RotationMode({ | ||
key: 'twentyfourhour', | ||
rotation: 'interval', | ||
label: '24 Hour Interval', | ||
interval: '86400', | ||
})); | ||
RotationModes.append(new RotationMode({ | ||
key: 'interval', | ||
rotation: 'interval', | ||
label: 'Custom Interval', | ||
interval: '0', | ||
})); | ||
RotationModes.append(new RotationMode({ | ||
key: 'hourly', | ||
rotation: 'hourly', | ||
label: 'Hourly Timer', | ||
interval: '0', | ||
})); | ||
RotationModes.append(new RotationMode({ | ||
key: 'daily', | ||
rotation: 'daily', | ||
label: 'Daily Timer', | ||
interval: '0', | ||
})); | ||
RotationModes.append(new RotationMode({ | ||
key: 'disabled', | ||
rotation: 'disabled', | ||
label: 'Disabled', | ||
interval: '0', | ||
})); | ||
|
||
export default RotationModes; |
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,14 @@ | ||
'use strict'; | ||
|
||
import Gio from 'gi://Gio'; | ||
|
||
import Interface from '../daemon/interface.js'; | ||
|
||
export function makeProxyWrapper() { | ||
let proxy = Gio.DBusProxy.makeProxyWrapper(Interface.dbusxml); | ||
return new proxy( | ||
Gio.DBus.session, | ||
Interface.app_id, | ||
Interface.app_path | ||
); | ||
} |
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,162 @@ | ||
import Gio from "gi://Gio"; | ||
import GLib from "gi://GLib"; | ||
import GObject from "gi://GObject"; | ||
|
||
import { debug } from './logging.js'; | ||
import { getCaller } from "./utils.js"; | ||
import DeskChanger from "../deskchanger.js"; | ||
|
||
let settings = null; | ||
|
||
const Settings = GObject.registerClass({ | ||
GTypeName: "DeskChangerSettings", | ||
}, | ||
class DeskChangerSettings extends Gio.Settings { | ||
_init() { | ||
super._init({ | ||
settings_schema: DeskChanger.gschema.lookup(DeskChanger.app_id, true), | ||
}); | ||
} | ||
|
||
get allowed_mime_types() { | ||
return this.get_value('allowed-mime-types').recursiveUnpack(); | ||
} | ||
|
||
set allowed_mime_types(value) { | ||
this.set_value('allowed-mime-types', new GLib.Variant('as', value)); | ||
debug(`set allowed-mime-types: ${value}`); | ||
} | ||
|
||
get auto_start() { | ||
return this.get_boolean('auto-start'); | ||
} | ||
|
||
set auto_start(value) { | ||
value = Boolean(value); | ||
this.set_boolean('auto-start', value); | ||
debug(`set auto-start: ${value}`, getCaller()); | ||
} | ||
|
||
get current_profile() { | ||
return this.get_string('current-profile'); | ||
} | ||
|
||
set current_profile(value) { | ||
this.set_string('current-profile', value); | ||
debug(`set current-profile: ${value}`, getCaller()); | ||
} | ||
|
||
get debug() { | ||
return this.get_boolean('debug'); | ||
} | ||
|
||
set debug(value) { | ||
this.set_boolean('debug', Boolean(value)); | ||
debug(`setdebug: ${value}`, getCaller()); | ||
} | ||
|
||
get icon_preview() { | ||
return this.get_boolean('icon-preview'); | ||
} | ||
|
||
set icon_preview(value) { | ||
this.set_boolean('icon-preview', Boolean(value)); | ||
debug(`set icon-preview: ${value}`,getCaller()); | ||
} | ||
|
||
get interval() { | ||
return this.get_int('interval'); | ||
} | ||
|
||
set interval(value) { | ||
this.set_int('interval', value); | ||
debug(`set interval: ${value}`,getCaller()); | ||
} | ||
|
||
get notifications() { | ||
return this.get_boolean('notifications'); | ||
} | ||
|
||
set notifications(value) { | ||
value = Boolean(value); | ||
this.set_boolean('notifications', value); | ||
debug(`set notifications: ${value}`,getCaller()); | ||
} | ||
|
||
get profile_state() { | ||
return this.get_value('profile-state').recursiveUnpack(); | ||
} | ||
|
||
set profile_state(value) { | ||
this.set_value('profile-state', new GLib.Variant('a{sas}', value)); | ||
} | ||
|
||
get profiles() { | ||
return this.get_value('profiles').recursiveUnpack(); | ||
} | ||
|
||
set profiles(value) { | ||
this.set_value('profiles', new GLib.Variant('a{sa(sb)}', value)); | ||
debug(`set profiles: ${value}`,getCaller()); | ||
} | ||
|
||
get random() { | ||
return this.get_boolean('random'); | ||
} | ||
|
||
set random(value) { | ||
value = Boolean(value); | ||
this.set_boolean('random', value); | ||
debug(`set random: ${value}`,getCaller()); | ||
} | ||
|
||
get remember_profile_state() { | ||
return this.get_boolean('remember-profile-state'); | ||
} | ||
|
||
set remember_profile_state(value) { | ||
value = Boolean(value); | ||
this.set_boolean('remember-profile-state', value); | ||
debug(`set remember-profile-state: ${value}`,getCaller()); | ||
} | ||
|
||
get rotation() { | ||
return this.get_string('rotation'); | ||
} | ||
|
||
set rotation(value) { | ||
this.set_string('rotation', value); | ||
debug(`set rotation: ${value}`,getCaller()); | ||
} | ||
|
||
connect(signal, callback) { | ||
let handler_id = super.connect(signal, callback); | ||
|
||
debug(`connect ${signal} (${handler_id})`,getCaller()); | ||
return handler_id; | ||
} | ||
|
||
disconnect(handler_id) { | ||
debug(`disconnect (${handler_id})`,getCaller()); | ||
return super.disconnect(handler_id); | ||
} | ||
|
||
getKeybinding(name) { | ||
let array = this.get_strv(name); | ||
return (typeof array[0] === 'undefined')? null : array[0]; | ||
} | ||
|
||
setKeybinding(name, value) { | ||
this.set_strv(name, [value,]); | ||
} | ||
|
||
get singleton() { | ||
if (!settings) | ||
settings = new Settings(); | ||
|
||
return settings; | ||
} | ||
} | ||
); | ||
|
||
export default Settings; |
Oops, something went wrong.