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 = '';
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())
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)
notifTime = 'Yesterday';
else
+3 -3
View File
@@ -34,9 +34,9 @@ const BarClock = () => Widget.Box({
children: [
Widget.Label({
className: 'bar-clock',
label: GLib.DateTime.new_now_local().format("%H:%M"),
setup: (self) => self.poll(5000, label => {
label.label = GLib.DateTime.new_now_local().format("%H:%M");
label: GLib.DateTime.new_now_local().format(userOptions.time.format),
setup: (self) => self.poll(userOptions.time.interval, label => {
label.label = GLib.DateTime.new_now_local().format(userOptions.time.format);
}),
}),
Widget.Label({
@@ -17,9 +17,9 @@ const TimeAndDate = () => Box({
Label({
className: 'bg-time-clock',
xalign: 0,
label: GLib.DateTime.new_now_local().format("%H:%M"),
setup: (self) => self.poll(5000, label => {
label.label = GLib.DateTime.new_now_local().format("%H:%M");
label: GLib.DateTime.new_now_local().format(userOptions.time.format),
setup: (self) => self.poll(userOptions.time.interval, label => {
label.label = GLib.DateTime.new_now_local().format(userOptions.time.format);
}),
}),
Label({
+35 -28
View File
@@ -2,27 +2,27 @@
let userConfigOptions = {
// General stuff
'ai': {
'defaultGPTProvider': 'openai',
'defaultGPTProvider': "openai",
'defaultTemperature': 0.9,
'writingCursor': ' ...', // Warning: Using weird characters can mess up Markdown rendering
'writingCursor': " ...", // Warning: Using weird characters can mess up Markdown rendering
},
'animations': {
'durationSmall': 110,
'durationLarge': 180,
},
'apps': {
'imageViewer': 'loupe',
'terminal': 'foot', // This is only for shell actions
'imageViewer': "loupe",
'terminal': "foot", // This is only for shell actions
},
'battery': {
'low': 20,
'critical': 10,
},
'music': {
'preferredPlayer': 'plasma-browser-integration',
'preferredPlayer': "plasma-browser-integration",
},
'onScreenKeyboard': {
'layout': 'qwerty_full', // See modules/onscreenkeyboard/onscreenkeyboard.js for available layouts
'layout': "qwerty_full", // See modules/onscreenkeyboard/onscreenkeyboard.js for available layouts
},
'overview': {
'scale': 0.18, // Relative to screen size
@@ -32,14 +32,21 @@ let userConfigOptions = {
'wsNumMarginScale': 0.07,
},
'sidebar': {
'imageColumns': 3,
'imageColumns': 2,
},
'search': {
'engineBaseUrl': 'https://www.google.com/search?q=',
'excludedSites': ['quora.com'],
'engineBaseUrl': "https://www.google.com/search?q=",
'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': {
'city': '',
'city': "",
},
'workspaces': {
'shown': 10,
@@ -47,15 +54,15 @@ let userConfigOptions = {
// Longer stuff
'icons': {
substitutions: {
'code-url-handler': 'visual-studio-code',
'Code': 'visual-studio-code',
'GitHub Desktop': 'github-desktop',
'Minecraft* 1.20.1': 'minecraft',
'gnome-tweaks': 'org.gnome.tweaks',
'pavucontrol-qt': 'pavucontrol',
'wps': 'wps-office2019-kprometheus',
'wpsoffice': 'wps-office2019-kprometheus',
'': 'image-missing',
'code-url-handler': "visual-studio-code",
'Code': "visual-studio-code",
'GitHub Desktop': "github-desktop",
'Minecraft* 1.20.1': "minecraft",
'gnome-tweaks': "org.gnome.tweaks",
'pavucontrol-qt': "pavucontrol",
'wps': "wps-office2019-kprometheus",
'wpsoffice': "wps-office2019-kprometheus",
'': "image-missing",
}
},
'keybinds': {
@@ -63,19 +70,19 @@ let userConfigOptions = {
// 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)
'overview': {
'altMoveLeft': 'Ctrl+b',
'altMoveRight': 'Ctrl+f',
'deleteToEnd': 'Ctrl+k',
'altMoveLeft': "Ctrl+b",
'altMoveRight': "Ctrl+f",
'deleteToEnd': "Ctrl+k",
},
'sidebar': {
'apis': {
'nextTab': 'Page_Down',
'prevTab': 'Page_Up',
'nextTab': "Page_Down",
'prevTab': "Page_Up",
},
'pin': 'Ctrl+p',
'cycleTab': 'Ctrl+Tab',
'nextTab': 'Ctrl+Page_Down',
'prevTab': 'Ctrl+Page_Up',
'pin': "Ctrl+p",
'cycleTab': "Ctrl+Tab",
'nextTab': "Ctrl+Page_Down",
'prevTab': "Ctrl+Page_Up",
},
},
}