Skip to content

Commit e945025

Browse files
feat: enhance Quickshell configuration with temperature unit options
- Updated the ServiceConfig.qml to set default values for temperature unit properties. - Added new toggle options in GeneralSection.qml for users to select Fahrenheit for weather and performance metrics. - Modified DashboardPane.qml to reflect the new temperature unit settings, ensuring user preferences are saved and applied correctly. - Improved user interface for temperature settings, enhancing overall configurability and user experience.
1 parent 0312d80 commit e945025

4 files changed

Lines changed: 49 additions & 4 deletions

File tree

home/.chezmoiscripts/linux/run_onchange_after_build-quickshell-plugin.sh.tmpl

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ source "${HOME}/.local/lib/dots/logging.sh"
1010
SHELL_DIR="${HOME}/.config/quickshell"
1111
PLUGIN_DIR="${SHELL_DIR}/plugin"
1212
BUILD_ROOT_DIR="${SHELL_DIR}"
13-
BUILD_DIR="${BUILD_ROOT_DIR}/build"
13+
BUILD_DIR="${XDG_CACHE_HOME:-${HOME}/.cache}/dots/quickshell/build"
1414
INSTALL_PREFIX="${HOME}/.local/lib/quickshell"
1515

1616
if [[ ! -d "$SHELL_DIR" ]]; then
@@ -30,10 +30,23 @@ if [[ ! -f "${BUILD_ROOT_DIR}/CMakeLists.txt" ]]; then
3030
exit 0
3131
fi
3232

33+
mkdir -p "$BUILD_DIR"
34+
35+
VERSION_FROM_GIT="v0.0.0"
36+
GIT_REVISION_FROM_GIT="unknown"
37+
if command -v git &>/dev/null; then
38+
if git -C "$HOME/.dotfiles" rev-parse --is-inside-work-tree &>/dev/null; then
39+
VERSION_FROM_GIT="$(git -C "$HOME/.dotfiles" describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")"
40+
GIT_REVISION_FROM_GIT="$(git -C "$HOME/.dotfiles" rev-parse HEAD 2>/dev/null || echo "unknown")"
41+
fi
42+
fi
43+
3344
cmake -S "$BUILD_ROOT_DIR" -B "$BUILD_DIR" -G Ninja \
3445
-DCMAKE_BUILD_TYPE=Release \
3546
-DCMAKE_INSTALL_PREFIX="$INSTALL_PREFIX" \
36-
-DINSTALL_QMLDIR="$INSTALL_PREFIX/qml" 2>&1 | while IFS= read -r line; do
47+
-DINSTALL_QMLDIR="$INSTALL_PREFIX/qml" \
48+
-DVERSION="$VERSION_FROM_GIT" \
49+
-DGIT_REVISION="$GIT_REVISION_FROM_GIT" 2>&1 | while IFS= read -r line; do
3750
log_debug "$line"
3851
done
3952

home/dot_config/quickshell/config/ServiceConfig.qml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import QtQuick
33

44
JsonObject {
55
property string weatherLocation: "" // A lat,long pair or empty for autodetection, e.g. "37.8267,-122.4233"
6-
property bool useFahrenheit: [Locale.ImperialUSSystem, Locale.ImperialSystem].includes(Qt.locale().measurementSystem)
7-
property bool useFahrenheitPerformance: [Locale.ImperialUSSystem, Locale.ImperialSystem].includes(Qt.locale().measurementSystem)
6+
property bool useFahrenheit: false
7+
property bool useFahrenheitPerformance: false
88
property bool useTwelveHourClock: Qt.locale().timeFormat(Locale.ShortFormat).toLowerCase().includes("a")
99
property string gpuType: ""
1010
property int visualiserBars: 45

home/dot_config/quickshell/modules/controlcenter/dashboard/DashboardPane.qml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ Item {
3232
property bool showMemory: Config.dashboard.performance.showMemory ?? true
3333
property bool showStorage: Config.dashboard.performance.showStorage ?? true
3434
property bool showNetwork: Config.dashboard.performance.showNetwork ?? true
35+
property bool useFahrenheit: Config.services.useFahrenheit ?? false
36+
property bool useFahrenheitPerformance: Config.services.useFahrenheitPerformance ?? false
3537

3638
anchors.fill: parent
3739

@@ -46,6 +48,8 @@ Item {
4648
Config.dashboard.performance.showMemory = root.showMemory;
4749
Config.dashboard.performance.showStorage = root.showStorage;
4850
Config.dashboard.performance.showNetwork = root.showNetwork;
51+
Config.services.useFahrenheit = root.useFahrenheit;
52+
Config.services.useFahrenheitPerformance = root.useFahrenheitPerformance;
4953
// Note: sizes properties are readonly and cannot be modified
5054
Config.save();
5155
}

home/dot_config/quickshell/modules/controlcenter/dashboard/GeneralSection.qml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,34 @@ SectionContainer {
3838
}
3939
}
4040

41+
SectionContainer {
42+
contentSpacing: Appearance.spacing.small
43+
44+
StyledText {
45+
text: qsTr("Temperature Units")
46+
font.pointSize: Appearance.font.size.small
47+
color: Colours.palette.m3outline
48+
}
49+
50+
SwitchRow {
51+
label: qsTr("Use Fahrenheit for weather")
52+
checked: root.rootItem.useFahrenheit
53+
onToggled: checked => {
54+
root.rootItem.useFahrenheit = checked;
55+
root.rootItem.saveConfig();
56+
}
57+
}
58+
59+
SwitchRow {
60+
label: qsTr("Use Fahrenheit for performance")
61+
checked: root.rootItem.useFahrenheitPerformance
62+
onToggled: checked => {
63+
root.rootItem.useFahrenheitPerformance = checked;
64+
root.rootItem.saveConfig();
65+
}
66+
}
67+
}
68+
4169
SectionContainer {
4270
contentSpacing: Appearance.spacing.normal
4371

0 commit comments

Comments
 (0)