Can settings be toggled with speed dial?

199 views
Skip to first unread message

Arindam Biswas

unread,
May 25, 2019, 5:18:44 AM5/25/19
to comp.mobile.nokia.8110
Hello,

Is there a way of toggling settings (usb tehtering, bluetooth, wifi, power-saving mode, etc.) by long-pressing number keys at the home screen? Any of ya guys have an idea of how to go about doing this?

ProgrammAbel

unread,
May 25, 2019, 6:51:47 AM5/25/19
to comp.mobile.nokia.8110
search up custom shortcuts in the forum, that'll give you a basic starting point. ill give you more info when i get home.

Arindam Biswas

unread,
May 25, 2019, 7:28:37 AM5/25/19
to comp.mobile.nokia.8110
Having looked at Customize shortcuts and more shortcuts, I understand that I have to edit around line 4600 (after formatting using beautifier.io) of launcher.gaiamobile.org/dist/app.bundle.js. This is around line 4311 of the same file:
}, {
                        name: "network",
                        icon: "network-activity",
                        iconInactived: "network-activity-off",
                        title: "cellular-data",
                        observerSetting: "ril.data.enabled",
                        order: {
                            portrait: 3,
                            landscape: 4
                        },
                        cskType: "toggle"
                    }, {

It toggles data. I want to toggle usb tethering, etc. in a similar fashion. Do you know how that could be done? This little snippet of code doesn't seem to call the Settings API directly, but uses some other function in app.bundle.js and I can't understand how it's toggling data.

Sylvain D

unread,
May 25, 2019, 5:34:25 PM5/25/19
to banana...@googlegroups.com
You can replace with tethering.usb.enabled and tethering.wifi.enabled the observerSettings. The toggle will work but I didn't find a way to get the subtitle, or a new icon. 

In the following snippet extract of the app.bundle.js, you will find that I also included the 'settings' shortcut (with icon !) instead of calculator.
 A bit after line 4300 : 

 
_ = function(e) {
               
function t() {
                    o
(this, t);
                   
var e = r(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this));
                   
return e.name = "InstantSettingsStore", e.oriSettings = [{
                        name
: "volume",
                        icon
: "sound-max",
                        isShortcut
: !0,
                        title
: "volume",
                        order
: {
                            portrait
: 1,
                            landscape
: 1
                       
},
                        click
: function(t) {
                           
return e.volumeManagerTimer ? void("ArrowUp" !== t && "ArrowDown" !== t || (e.enterVolumeManagerMode(), navigator.volumeManager["request" + t.slice(5)]())) : (e.enterVolumeManagerMode(), void navigator.volumeManager.requestShow())
                       
}
                   
}, {
                        name
: "brightness",
                        icon
: "brightness",
                        isShortcut
: !0,
                        title
: "brightness",
                        subtitle
: "percentage-number",
                        order
: {
                            portrait
: 2,
                            landscape
: 2
                       
},
                        cskType
: "toggle",
                        click
: e.toggleBrightness.bind(e)
                   
}, {
                        name
: "flashlight",
                        icon
: "flashlight-on",
                        iconInactived
: "flashlight-off",
                        title
: "flashlight",
                        removed
: !0,
                        order
: {
                            portrait
: 4,
                            landscape
: 3
                       
},
                        cskType
: "toggle",
                        click
: v.default.toggle.bind(v.default)
                   
}, {
                        name
: "camera",
                        icon
: "camera",
                        isShortcut
: !0,
                        title
: "camera",
                        order
: {
                            portrait
: 7,
                            landscape
: 6
                       
},
                        cskType
: "launch",
                        click
: function() {
                            y
.default.launch("manifestURL", "app://camera.gaiamobile.org/manifest.webapp")
                       
}
                   
}, {
                        name
: "calculator",
                        icon
: "settings",
                        isShortcut
: !0,
                        title
: "settings",
                        order
: {
                            portrait
: 5,
                            landscape
: -1
                       
},
                        cskType
: "launch",
                        click
: function() {
                            y
.default.launch("manifestURL", "app://settings.gaiamobile.org/manifest.webapp")
                       
}
                   
}, {
                        name
: "airplane-mode",
                        icon
: "airplane-mode",
                        iconInactived
: "airplane-mode-off",
                        title
: "airplane-mode",
                        observerSetting
: "airplaneMode.enabled",
                        order
: {
                            portrait
: 8,
                            landscape
: 7
                       
},
                        cskType
: "toggle"
                   
}, {
                        name
: "wifi",
                        icon
: "wifi-32px",
                        iconInactived
: "wifi-off-32px",
                        title
: "wifi-tether",
                        observerSetting
: "tethering.wifi.enabled",
                        removed
: !0,
                        order
: {
                            portrait
: 0,
                            landscape
: 0
                       
},
                        cskType
: "toggle"

                   
}, {
                        name
: "network",
                        icon
: "network-activity",
                        iconInactived
: "network-activity-off",

                        title
: "usb-tether",
                        observerSetting
: "tethering.usb.enabled",

                        order
: {
                            portrait
: 3,
                            landscape
: 4
                       
},
                        cskType
: "toggle"
                   
}, {

                        name
: "bluetooth",
                        icon
: "bluetooth-32px",
                        iconInactived
: "bluetooth-off-32px",
                        title
: "bluetooth",
                        removed
: !0,
                        observerSetting
: "bluetooth.enabled",
                        order
: {
                            portrait
: 6,
                            landscape
: 5
                       
},
                        cskType
: "toggle"
                   
}], e.brightnessMap = {
                       
100: .1,
                       
10: .4,
                       
40: .7,
                       
70: 1
                   
}, e.orderType = w.isLandscape ? "landscape" : "portrait", e
               
}
               
return s(t, e), l(t, [{
                    key
: "start",
                    value
: function() {
                       
var e = this,
                            t
= this.orderType;
                       
this.settings = this.oriSettings.filter(function(e) {
                           
return -1 !== e.order[t]
                       
}).sort(function(e, n) {
                           
return e.order[t] - n.order[t]
                       
}), this.settings.forEach(function(t) {
                            t
.observerSetting && !t.removed && e.initSettingObserver(t)
                       
}), this.initSettingObserverForBrightness(), d.default.addObserver("airplaneMode.status", this), navigator.hasFeature && navigator.hasFeature("device.capability.torch").then(function(t) {
                           
if (t) {
                                e
.getSetting("flashlight").removed = !1, v.default.on("ready", e.updateFlashlightState.bind(e)), v.default.on("change", e.updateFlashlightState.bind(e))
                           
}
                       
}), navigator.hasFeature && navigator.hasFeature("device.capability.bt").then(function(t) {
                           
if (t) {
                                navigator
.mozBluetooth.defaultAdapter || (navigator.mozBluetooth.onattributechanged = function(e) {
                                    e
.attrs.includes("defaultAdapter") && (navigator.mozBluetooth.onattributechanged = null)
                               
});
                               
var n = e.getSetting("bluetooth");
                                n
.removed = !1, e.initSettingObserver(n)
                           
}
                       
}), navigator.hasFeature && navigator.hasFeature("device.capability.wifi").then(function(t) {
                           
if (t) {
                               
var n = e.getSetting("wifi");
                                n
.removed = !1, e.initSettingObserver(n)
                           
}
                       
}), this.emit("change")
                   
}
               
}, {
                    key
: "initSettingObserver",
                    value
: function(e) {
                       
var t = this;
                        d
.default.addObserver(e.observerSetting, this), this["_observe_" + e.observerSetting] = function(n) {
                           
var i = t.getSetting(e.name);
                            i
.isActive = n, !0 === n ? i.subtitle = "on" : !1 === n ? i.subtitle = "off" : i.subtitle = n.toString(), t.emit("change")
                       
}
                   
}
               
}, {
                    key
: "initSettingObserverForBrightness",
                    value
: function() {
                       
var e = this;
                        d
.default.addObserver("screen.brightness", this), this["_observe_screen.brightness"] = function(t) {
                            e
.getSetting("brightness").subtitleArgs = {
                                number
: 100 * t
                           
}, e.emit("change")
                       
}
                   
}
               
}, {
                    key
: "_observe_airplaneMode.status",
                    value
: function(e) {
                       
var t = "enabling" === e || "disabling" === e;
                       
this.getSetting("airplane-mode").isDisabled = t, this.emit("change")
                   
}
               
}, {
                    key
: "updateFlashlightState",
                    value
: function() {
                       
dump("cck updateFlashlightState entry");
                       
var e = this.getSetting("flashlight"),
                            t
= v.default.flashlightManager.flashlightEnabled;
                       
dump("cck updateFlashlightState _flashlightEnabled=" + t), e.isActive = t, e.subtitle = t ? "on" : "off", this.emit("change")
                   
}
               
}, {
                    key
: "checkSimCardState",
                    value
: function() {
                       
var e = h.default.noSIMCardOnDevice() || h.default.noSIMCardConnectedToNetwork(),
                            t
= -1 !== h.default.getSlots().map(function(e) {
                               
return e.conn.voice.state
                           
}).indexOf("searching"),
                            n
= this.getSetting("network"),
                            i
= this.getSetting("airplane-mode");
                        n
.isDisabled = i.isActive || e, !t && e && n.isActive && this.toggleSetting(n), this.emit("change")
                   
}
               
}, {
                    key
: "addSimCardObserver",
                    value
: function() {
                       
var e = this;
                       
if (!this.isSimCardObserverAdded) {
                           
this.isSimCardObserverAdded = !0, this.checkSimCardState();
                           
var t = window.navigator.mozMobileConnections;
                            t
&& Array.from(t).forEach(function(t) {
                                t
.addEventListener("voicechange", e)
                           
}, this)
                       
}
                   
}
               
}, {
                    key
: "removeSimCardObserver",
                    value
: function() {
                       
var e = this;
                       
this.isSimCardObserverAdded = !1;
                       
var t = window.navigator.mozMobileConnections;
                        t
&& Array.from(t).forEach(function(t) {
                            t
.removeEventListener("voicechange", e)
                       
}, this)
                   
}
               
}, {
                    key
: "_handle_voicechange",
                    value
: function() {
                       
this.checkSimCardState()
                   
}
               
}, {
                    key
: "getIndex",
                    value
: function(e) {
                       
var t = this.settings.findIndex(function(t) {
                           
return t.name === e
                       
});
                       
return t
                   
}
               
}, {
                    key
: "getSetting",
                    value
: function(e) {
                       
var t = this.settings.find(function(t) {
                           
return t.name === e
                       
});
                       
return t
                   
}
               
}, {
                    key
: "toggleSetting",
                    value
: function(e) {
                       
var t = this;
                        e
.isDisabled = !0, this.emit("change");
                       
var n = function() {
                            e
.isDisabled = !1, t.emit("change")
                       
};
                        d
.default.get(e.observerSetting).then(function(t) {
                           
var i = {};
                            i
[e.observerSetting] = !t, d.default.set(i).then(function() {
                               
switch (e.name) {
                                   
case "airplane-mode":
                                       
break;
                                   
case "bluetooth":
                                        w
.toggleBletooth(t ? "disable" : "enable").then(function() {
                                           
return n()
                                       
}, function(e) {
                                            n
()
                                       
});
                                       
break;
                                   
default:
                                        n
()
                               
}
                           
})
                       
})
                   
}
               
}, {
                    key
: "toggleBrightness",
                    value
: function() {
                       
var e = this.getSetting("brightness").subtitleArgs.number;
                        d
.default.set({
                           
"screen.brightness": this.brightnessMap[e] || .1
                       
})
                   
}
               
}, {
                    key
: "enterVolumeManagerMode",
                    value
: function() {
                       
var e = this;
                       
this.volumeManagerTimer && this.exitVolumeManagerMode(), this.volumeManagerTimer = setTimeout(function() {
                            e
.exitVolumeManagerMode()
                       
}, 2e3)
                   
}
               
}, {
                    key
: "exitVolumeManagerMode",
                    value
: function() {
                        window
.clearTimeout(this.volumeManagerTimer), this.volumeManagerTimer = null
                   
}
               
}, {
                    key
: "click",
                    value
: function(e, t) {
                       
var n = this.getSetting(e);
                       
if (n && !n.isDisabled)
                           
if ("toggle" === n.cskType && n.observerSetting) this.toggleSetting(n);
                           
else if (n.click) return n.click(t), n.cskType
                   
}
               
}]),

happy indian

unread,
Sep 9, 2019, 7:09:20 AM9/9/19
to comp.mobile.nokia.8110
By editing appbundle.js in launcher.gaiamobile.org i succesfully remap key shortcut for different app
I also able to edit wifi to tethering.wifi.enabled but problem is in jiophone that when you change title of quick setting menus they disapear.
for example i change calendar for camera icon changed but when i change title , title disapeared.
Any suggestion

martincheco

unread,
Sep 13, 2019, 11:55:55 AM9/13/19
to comp.mobile.nokia.8110
I wonder if perry's custom-launcher can help, it has the ability to toggle bluetooth/wifi/tethering/data/airplane mode (pressing right arrow you will get this menu)

On 8110g mapping e.g. ArrowUp or Down to this launcher allows me to toggle these things with less clicking than normally (down-right-3xdown-enter)

Aaron Rolls

unread,
Sep 14, 2019, 3:20:30 PM9/14/19
to comp.mobile.nokia.8110
Great idea Arindam, HELPFUL launcher 0.0.2 will have a similar feature, making it easy for anybody to adjust. I'll be releasing it once my new 8110 arrives. I would like to test it and get it working on v16 before sharing it.
Reply all
Reply to author
Forward
0 new messages