Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Service.qml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ QtObject {
root.applyConfig(text)
}

function setGroupByArea(enabled) {
if (root.groupByArea === enabled) return
root.saveConfig({ groupByArea: enabled })
}

// FileView will not create a missing parent directory, and starting the
// process is asynchronous — doing it inside saveConfig races the write it is
// supposed to enable, which on a fresh install loses the first save silently
Expand Down
36 changes: 35 additions & 1 deletion Settings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ Item {
root.resetDrafts()
try {
var payload = payloadJson ? JSON.parse(payloadJson) : {}
if (payload.tab === "entities" || payload.tab === "connection") {
if (payload.tab === "entities" || payload.tab === "connection"
|| payload.tab === "general") {
root.tab = payload.tab
}
} catch (e) {
Expand Down Expand Up @@ -183,6 +184,7 @@ Item {
fontFamily: root.family
fontSize: Style.font.caption
options: [{ value: "connection", label: "Connection" },
{ value: "general", label: "General" },
{ value: "entities", label: "Devices" }]
value: root.tab
onChanged: function(value) { root.tab = value }
Expand Down Expand Up @@ -210,6 +212,13 @@ Item {
sourceComponent: connectionTab
}

Loader {
anchors.fill: parent
active: root.tab === "general"
visible: active
sourceComponent: generalTab
}

Loader {
anchors.fill: parent
active: root.tab === "entities"
Expand Down Expand Up @@ -423,6 +432,31 @@ Item {
}
}

// ------------------------------------------------------------ general

Component {
id: generalTab

Item {
Column {
anchors { top: parent.top; left: parent.left; right: parent.right }
spacing: Style.spacing.xl

Toggle {
width: parent.width
label: "Group by area"
description: "Add area tabs for picked devices, alongside Favorites."
checked: root.service ? root.service.groupByArea : false
foreground: root.foreground
fontFamily: root.family
onClicked: if (root.service) {
root.service.setGroupByArea(!root.service.groupByArea)
}
}
}
}
}

// ------------------------------------------------------------ devices

Component {
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"schemaVersion": 1,
"id": "hass",
"name": "Home Assistant",
"version": "0.2.1",
"version": "0.2.2",
"author": "Konrad Kruk",
"license": "MIT",
"description": "View and control Home Assistant devices from the Omarchy bar.",
Expand Down
Loading