Convert tz setting to a QS menu
This commit is contained in:
Executable
+10
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
# omarchy:summary=Select and set the system timezone
|
||||
# omarchy:group=menu
|
||||
# omarchy:name=timezone
|
||||
|
||||
timezone=$(timedatectl list-timezones | omarchy-menu-select "Set timezone" -- --width 520 --maxheight 520) || exit 1
|
||||
sudo timedatectl set-timezone "$timezone"
|
||||
omarchy-shell -q Clock refresh
|
||||
omarchy-notification-send "Timezone is now set to $timezone"
|
||||
@@ -1,8 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# omarchy:summary=Select and set the system timezone
|
||||
# omarchy:requires-sudo=true
|
||||
|
||||
timezone=$(timedatectl list-timezones | gum filter --height 20 --header "Set timezone") || exit 1
|
||||
sudo timedatectl set-timezone "$timezone"
|
||||
echo "Timezone is now set to $timezone"
|
||||
@@ -286,7 +286,7 @@
|
||||
"update.hardware": {"icon":"","label":"Hardware","keywords":"restart audio wifi bluetooth trackpad"},
|
||||
"update.firmware": {"icon":"","label":"Firmware","keywords":"fwupd","action":"omarchy-launch-floating-terminal-with-presentation omarchy-update-firmware"},
|
||||
"update.password": {"icon":"","label":"Password","keywords":"drive user"},
|
||||
"update.timezone": {"icon":"","label":"Timezone","keywords":"time zone","action":"omarchy-launch-floating-terminal-with-presentation omarchy-tz-select"},
|
||||
"update.timezone": {"icon":"","label":"Timezone","keywords":"time zone","action":"omarchy-menu-timezone"},
|
||||
"update.time": {"icon":"","label":"Time","keywords":"clock ntp","action":"omarchy-launch-floating-terminal-with-presentation omarchy-update-time"},
|
||||
"update.channel.stable": {"icon":"🟢","label":"Stable","action":"omarchy-launch-floating-terminal-with-presentation 'omarchy-channel-set stable'"},
|
||||
"update.channel.rc": {"icon":"🟡","label":"RC","keywords":"release candidate","action":"omarchy-launch-floating-terminal-with-presentation 'omarchy-channel-set rc'"},
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Ensure timezone can be updated without needing to sudo
|
||||
# Ensure timezone can be updated without a password prompt
|
||||
sudo tee /etc/sudoers.d/omarchy-tzupdate >/dev/null <<EOF
|
||||
%wheel ALL=(root) NOPASSWD: /usr/bin/tzupdate, /usr/bin/timedatectl
|
||||
%wheel ALL=(root) NOPASSWD: /usr/bin/tzupdate, /usr/bin/timedatectl set-timezone *
|
||||
EOF
|
||||
sudo chmod 0440 /etc/sudoers.d/omarchy-tzupdate
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
echo "Restricting passwordless timedatectl access to timezone updates"
|
||||
|
||||
sudo tee /etc/sudoers.d/omarchy-tzupdate >/dev/null <<EOF
|
||||
%wheel ALL=(root) NOPASSWD: /usr/bin/tzupdate, /usr/bin/timedatectl set-timezone *
|
||||
EOF
|
||||
sudo chmod 0440 /etc/sudoers.d/omarchy-tzupdate
|
||||
@@ -1,5 +1,6 @@
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import qs.Commons
|
||||
import qs.Ui
|
||||
|
||||
@@ -8,11 +9,16 @@ BarWidget {
|
||||
moduleName: "Clock"
|
||||
|
||||
property bool alt: false
|
||||
property date displayDate: clock.date
|
||||
|
||||
readonly property string activeFormat: alt
|
||||
? setting("formatAlt", "dd MMMM 'W'ww yyyy")
|
||||
: (bar && bar.vertical ? setting("verticalFormat", "HH\n—\nmm") : setting("format", "dddd HH:mm"))
|
||||
|
||||
function refresh() {
|
||||
displayDate = new Date()
|
||||
}
|
||||
|
||||
function isoWeek(date) {
|
||||
var d = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()))
|
||||
var day = d.getUTCDay() || 7
|
||||
@@ -36,18 +42,24 @@ BarWidget {
|
||||
SystemClock {
|
||||
id: clock
|
||||
precision: SystemClock.Minutes
|
||||
onDateChanged: root.displayDate = date
|
||||
}
|
||||
|
||||
IpcHandler {
|
||||
target: "Clock"
|
||||
function refresh(): void { root.refresh() }
|
||||
}
|
||||
|
||||
WidgetButton {
|
||||
id: button
|
||||
anchors.fill: parent
|
||||
bar: root.bar
|
||||
text: root.formatted(clock.date)
|
||||
text: root.formatted(root.displayDate)
|
||||
horizontalMargin: 8.75
|
||||
verticalPadding: 8.75
|
||||
onPressed: function(button) {
|
||||
if (!root.bar) return
|
||||
if (button === Qt.RightButton) root.bar.run("omarchy-launch-floating-terminal-with-presentation omarchy-tz-select")
|
||||
if (button === Qt.RightButton) root.bar.run("omarchy-menu-timezone")
|
||||
else root.alt = !root.alt
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user