user config: add time format #307

This commit is contained in:
end-4
2024-03-06 15:27:41 +07:00
parent da338dbc61
commit 239231b5cf
4 changed files with 42 additions and 35 deletions
@@ -218,7 +218,7 @@ export default ({
let notifTime = ''; let notifTime = '';
const messageTime = GLib.DateTime.new_from_unix_local(notifObject.time); const messageTime = GLib.DateTime.new_from_unix_local(notifObject.time);
if (messageTime.get_day_of_year() == GLib.DateTime.new_now_local().get_day_of_year()) if (messageTime.get_day_of_year() == GLib.DateTime.new_now_local().get_day_of_year())
notifTime = messageTime.format('%H:%M'); notifTime = messageTime.format(userOptions.time.format);
else if (messageTime.get_day_of_year() == GLib.DateTime.new_now_local().get_day_of_year() - 1) else if (messageTime.get_day_of_year() == GLib.DateTime.new_now_local().get_day_of_year() - 1)
notifTime = 'Yesterday'; notifTime = 'Yesterday';
else else
+3 -3
View File
@@ -34,9 +34,9 @@ const BarClock = () => Widget.Box({
children: [ children: [
Widget.Label({ Widget.Label({
className: 'bar-clock', className: 'bar-clock',
label: GLib.DateTime.new_now_local().format("%H:%M"), label: GLib.DateTime.new_now_local().format(userOptions.time.format),
setup: (self) => self.poll(5000, label => { setup: (self) => self.poll(userOptions.time.interval, label => {
label.label = GLib.DateTime.new_now_local().format("%H:%M"); label.label = GLib.DateTime.new_now_local().format(userOptions.time.format);
}), }),
}), }),
Widget.Label({ Widget.Label({
@@ -17,9 +17,9 @@ const TimeAndDate = () => Box({
Label({ Label({
className: 'bg-time-clock', className: 'bg-time-clock',
xalign: 0, xalign: 0,
label: GLib.DateTime.new_now_local().format("%H:%M"), label: GLib.DateTime.new_now_local().format(userOptions.time.format),
setup: (self) => self.poll(5000, label => { setup: (self) => self.poll(userOptions.time.interval, label => {
label.label = GLib.DateTime.new_now_local().format("%H:%M"); label.label = GLib.DateTime.new_now_local().format(userOptions.time.format);
}), }),
}), }),
Label({ Label({
+35 -28
View File
@@ -2,27 +2,27 @@
let userConfigOptions = { let userConfigOptions = {
// General stuff // General stuff
'ai': { 'ai': {
'defaultGPTProvider': 'openai', 'defaultGPTProvider': "openai",
'defaultTemperature': 0.9, 'defaultTemperature': 0.9,
'writingCursor': ' ...', // Warning: Using weird characters can mess up Markdown rendering 'writingCursor': " ...", // Warning: Using weird characters can mess up Markdown rendering
}, },
'animations': { 'animations': {
'durationSmall': 110, 'durationSmall': 110,
'durationLarge': 180, 'durationLarge': 180,
}, },
'apps': { 'apps': {
'imageViewer': 'loupe', 'imageViewer': "loupe",
'terminal': 'foot', // This is only for shell actions 'terminal': "foot", // This is only for shell actions
}, },
'battery': { 'battery': {
'low': 20, 'low': 20,
'critical': 10, 'critical': 10,
}, },
'music': { 'music': {
'preferredPlayer': 'plasma-browser-integration', 'preferredPlayer': "plasma-browser-integration",
}, },
'onScreenKeyboard': { 'onScreenKeyboard': {
'layout': 'qwerty_full', // See modules/onscreenkeyboard/onscreenkeyboard.js for available layouts 'layout': "qwerty_full", // See modules/onscreenkeyboard/onscreenkeyboard.js for available layouts
}, },
'overview': { 'overview': {
'scale': 0.18, // Relative to screen size 'scale': 0.18, // Relative to screen size
@@ -32,14 +32,21 @@ let userConfigOptions = {
'wsNumMarginScale': 0.07, 'wsNumMarginScale': 0.07,
}, },
'sidebar': { 'sidebar': {
'imageColumns': 3, 'imageColumns': 2,
}, },
'search': { 'search': {
'engineBaseUrl': 'https://www.google.com/search?q=', 'engineBaseUrl': "https://www.google.com/search?q=",
'excludedSites': ['quora.com'], 'excludedSites': ["quora.com"],
},
'time': {
// See https://docs.gtk.org/glib/method.DateTime.format.html
// Here's the 12h format: "%I:%M%P"
// For seconds, add "%S" and set interval to 1000
'format': "%H:%M",
'interval': 5000,
}, },
'weather': { 'weather': {
'city': '', 'city': "",
}, },
'workspaces': { 'workspaces': {
'shown': 10, 'shown': 10,
@@ -47,15 +54,15 @@ let userConfigOptions = {
// Longer stuff // Longer stuff
'icons': { 'icons': {
substitutions: { substitutions: {
'code-url-handler': 'visual-studio-code', 'code-url-handler': "visual-studio-code",
'Code': 'visual-studio-code', 'Code': "visual-studio-code",
'GitHub Desktop': 'github-desktop', 'GitHub Desktop': "github-desktop",
'Minecraft* 1.20.1': 'minecraft', 'Minecraft* 1.20.1': "minecraft",
'gnome-tweaks': 'org.gnome.tweaks', 'gnome-tweaks': "org.gnome.tweaks",
'pavucontrol-qt': 'pavucontrol', 'pavucontrol-qt': "pavucontrol",
'wps': 'wps-office2019-kprometheus', 'wps': "wps-office2019-kprometheus",
'wpsoffice': 'wps-office2019-kprometheus', 'wpsoffice': "wps-office2019-kprometheus",
'': 'image-missing', '': "image-missing",
} }
}, },
'keybinds': { 'keybinds': {
@@ -63,19 +70,19 @@ let userConfigOptions = {
// Modifiers: Shift Ctrl Alt Hyper Meta // Modifiers: Shift Ctrl Alt Hyper Meta
// See https://docs.gtk.org/gdk3/index.html#constants for the other keys (they are listed as KEY_key) // See https://docs.gtk.org/gdk3/index.html#constants for the other keys (they are listed as KEY_key)
'overview': { 'overview': {
'altMoveLeft': 'Ctrl+b', 'altMoveLeft': "Ctrl+b",
'altMoveRight': 'Ctrl+f', 'altMoveRight': "Ctrl+f",
'deleteToEnd': 'Ctrl+k', 'deleteToEnd': "Ctrl+k",
}, },
'sidebar': { 'sidebar': {
'apis': { 'apis': {
'nextTab': 'Page_Down', 'nextTab': "Page_Down",
'prevTab': 'Page_Up', 'prevTab': "Page_Up",
}, },
'pin': 'Ctrl+p', 'pin': "Ctrl+p",
'cycleTab': 'Ctrl+Tab', 'cycleTab': "Ctrl+Tab",
'nextTab': 'Ctrl+Page_Down', 'nextTab': "Ctrl+Page_Down",
'prevTab': 'Ctrl+Page_Up', 'prevTab': "Ctrl+Page_Up",
}, },
}, },
} }