Implemented the calendar menu that displays time, calendar and weather (WIP).
This commit is contained in:
@@ -1,145 +1,196 @@
|
||||
export const substitutes = {
|
||||
"transmission-gtk": "transmission",
|
||||
"blueberry.py": "blueberry",
|
||||
"Caprine": "facebook-messenger",
|
||||
"com.raggesilver.BlackBox-symbolic": "terminal-symbolic",
|
||||
"org.wezfurlong.wezterm-symbolic": "terminal-symbolic",
|
||||
"audio-headset-bluetooth": "audio-headphones-symbolic",
|
||||
"audio-card-analog-usb": "audio-speakers-symbolic",
|
||||
"audio-card-analog-pci": "audio-card-symbolic",
|
||||
"preferences-system": "emblem-system-symbolic",
|
||||
"com.github.Aylur.ags-symbolic": "controls-symbolic",
|
||||
"com.github.Aylur.ags": "controls-symbolic",
|
||||
}
|
||||
"transmission-gtk": "transmission",
|
||||
"blueberry.py": "blueberry",
|
||||
Caprine: "facebook-messenger",
|
||||
"com.raggesilver.BlackBox-symbolic": "terminal-symbolic",
|
||||
"org.wezfurlong.wezterm-symbolic": "terminal-symbolic",
|
||||
"audio-headset-bluetooth": "audio-headphones-symbolic",
|
||||
"audio-card-analog-usb": "audio-speakers-symbolic",
|
||||
"audio-card-analog-pci": "audio-card-symbolic",
|
||||
"preferences-system": "emblem-system-symbolic",
|
||||
"com.github.Aylur.ags-symbolic": "controls-symbolic",
|
||||
"com.github.Aylur.ags": "controls-symbolic",
|
||||
};
|
||||
|
||||
export default {
|
||||
missing: "image-missing-symbolic",
|
||||
nix: {
|
||||
nix: "nix-snowflake-symbolic",
|
||||
missing: "image-missing-symbolic",
|
||||
nix: {
|
||||
nix: "nix-snowflake-symbolic",
|
||||
},
|
||||
app: {
|
||||
terminal: "terminal-symbolic",
|
||||
},
|
||||
fallback: {
|
||||
executable: "application-x-executable",
|
||||
notification: "dialog-information-symbolic",
|
||||
video: "video-x-generic-symbolic",
|
||||
audio: "audio-x-generic-symbolic",
|
||||
},
|
||||
ui: {
|
||||
close: "window-close-symbolic",
|
||||
colorpicker: "color-select-symbolic",
|
||||
info: "info-symbolic",
|
||||
link: "external-link-symbolic",
|
||||
lock: "system-lock-screen-symbolic",
|
||||
menu: "open-menu-symbolic",
|
||||
refresh: "view-refresh-symbolic",
|
||||
search: "system-search-symbolic",
|
||||
settings: "emblem-system-symbolic",
|
||||
themes: "preferences-desktop-theme-symbolic",
|
||||
tick: "object-select-symbolic",
|
||||
time: "hourglass-symbolic",
|
||||
toolbars: "toolbars-symbolic",
|
||||
warning: "dialog-warning-symbolic",
|
||||
avatar: "avatar-default-symbolic",
|
||||
arrow: {
|
||||
right: "pan-end-symbolic",
|
||||
left: "pan-start-symbolic",
|
||||
down: "pan-down-symbolic",
|
||||
up: "pan-up-symbolic",
|
||||
},
|
||||
app: {
|
||||
terminal: "terminal-symbolic",
|
||||
},
|
||||
audio: {
|
||||
mic: {
|
||||
muted: "microphone-disabled-symbolic",
|
||||
low: "microphone-sensitivity-low-symbolic",
|
||||
medium: "microphone-sensitivity-medium-symbolic",
|
||||
high: "microphone-sensitivity-high-symbolic",
|
||||
},
|
||||
fallback: {
|
||||
executable: "application-x-executable",
|
||||
notification: "dialog-information-symbolic",
|
||||
video: "video-x-generic-symbolic",
|
||||
audio: "audio-x-generic-symbolic",
|
||||
volume: {
|
||||
muted: "audio-volume-muted-symbolic",
|
||||
low: "audio-volume-low-symbolic",
|
||||
medium: "audio-volume-medium-symbolic",
|
||||
high: "audio-volume-high-symbolic",
|
||||
overamplified: "audio-volume-overamplified-symbolic",
|
||||
},
|
||||
ui: {
|
||||
close: "window-close-symbolic",
|
||||
colorpicker: "color-select-symbolic",
|
||||
info: "info-symbolic",
|
||||
link: "external-link-symbolic",
|
||||
lock: "system-lock-screen-symbolic",
|
||||
menu: "open-menu-symbolic",
|
||||
refresh: "view-refresh-symbolic",
|
||||
search: "system-search-symbolic",
|
||||
settings: "emblem-system-symbolic",
|
||||
themes: "preferences-desktop-theme-symbolic",
|
||||
tick: "object-select-symbolic",
|
||||
time: "hourglass-symbolic",
|
||||
toolbars: "toolbars-symbolic",
|
||||
warning: "dialog-warning-symbolic",
|
||||
avatar: "avatar-default-symbolic",
|
||||
arrow: {
|
||||
right: "pan-end-symbolic",
|
||||
left: "pan-start-symbolic",
|
||||
down: "pan-down-symbolic",
|
||||
up: "pan-up-symbolic",
|
||||
},
|
||||
type: {
|
||||
headset: "audio-headphones-symbolic",
|
||||
speaker: "audio-speakers-symbolic",
|
||||
card: "audio-card-symbolic",
|
||||
},
|
||||
audio: {
|
||||
mic: {
|
||||
muted: "microphone-disabled-symbolic",
|
||||
low: "microphone-sensitivity-low-symbolic",
|
||||
medium: "microphone-sensitivity-medium-symbolic",
|
||||
high: "microphone-sensitivity-high-symbolic",
|
||||
},
|
||||
volume: {
|
||||
muted: "audio-volume-muted-symbolic",
|
||||
low: "audio-volume-low-symbolic",
|
||||
medium: "audio-volume-medium-symbolic",
|
||||
high: "audio-volume-high-symbolic",
|
||||
overamplified: "audio-volume-overamplified-symbolic",
|
||||
},
|
||||
type: {
|
||||
headset: "audio-headphones-symbolic",
|
||||
speaker: "audio-speakers-symbolic",
|
||||
card: "audio-card-symbolic",
|
||||
},
|
||||
mixer: "mixer-symbolic",
|
||||
mixer: "mixer-symbolic",
|
||||
},
|
||||
powerprofile: {
|
||||
balanced: "power-profile-balanced-symbolic",
|
||||
"power-saver": "power-profile-power-saver-symbolic",
|
||||
performance: "power-profile-performance-symbolic",
|
||||
},
|
||||
asusctl: {
|
||||
profile: {
|
||||
Balanced: "power-profile-balanced-symbolic",
|
||||
Quiet: "power-profile-power-saver-symbolic",
|
||||
Performance: "power-profile-performance-symbolic",
|
||||
},
|
||||
powerprofile: {
|
||||
balanced: "power-profile-balanced-symbolic",
|
||||
"power-saver": "power-profile-power-saver-symbolic",
|
||||
performance: "power-profile-performance-symbolic",
|
||||
mode: {
|
||||
Integrated: "processor-symbolic",
|
||||
Hybrid: "controller-symbolic",
|
||||
},
|
||||
asusctl: {
|
||||
profile: {
|
||||
Balanced: "power-profile-balanced-symbolic",
|
||||
Quiet: "power-profile-power-saver-symbolic",
|
||||
Performance: "power-profile-performance-symbolic",
|
||||
},
|
||||
mode: {
|
||||
Integrated: "processor-symbolic",
|
||||
Hybrid: "controller-symbolic",
|
||||
},
|
||||
},
|
||||
battery: {
|
||||
charging: "battery-flash-symbolic",
|
||||
warning: "battery-empty-symbolic",
|
||||
},
|
||||
bluetooth: {
|
||||
enabled: "bluetooth-active-symbolic",
|
||||
disabled: "bluetooth-disabled-symbolic",
|
||||
},
|
||||
brightness: {
|
||||
indicator: "display-brightness-symbolic",
|
||||
keyboard: "keyboard-brightness-symbolic",
|
||||
screen: "display-brightness-symbolic",
|
||||
},
|
||||
powermenu: {
|
||||
sleep: "weather-clear-night-symbolic",
|
||||
reboot: "system-reboot-symbolic",
|
||||
logout: "system-log-out-symbolic",
|
||||
shutdown: "system-shutdown-symbolic",
|
||||
},
|
||||
recorder: {
|
||||
recording: "media-record-symbolic",
|
||||
},
|
||||
notifications: {
|
||||
noisy: "org.gnome.Settings-notifications-symbolic",
|
||||
silent: "notifications-disabled-symbolic",
|
||||
message: "chat-bubbles-symbolic",
|
||||
},
|
||||
trash: {
|
||||
full: "user-trash-full-symbolic",
|
||||
empty: "user-trash-symbolic",
|
||||
},
|
||||
mpris: {
|
||||
shuffle: {
|
||||
enabled: "media-playlist-shuffle-symbolic",
|
||||
disabled: "media-playlist-consecutive-symbolic",
|
||||
},
|
||||
battery: {
|
||||
charging: "battery-flash-symbolic",
|
||||
warning: "battery-empty-symbolic",
|
||||
loop: {
|
||||
none: "media-playlist-repeat-symbolic",
|
||||
track: "media-playlist-repeat-song-symbolic",
|
||||
playlist: "media-playlist-repeat-symbolic",
|
||||
},
|
||||
bluetooth: {
|
||||
enabled: "bluetooth-active-symbolic",
|
||||
disabled: "bluetooth-disabled-symbolic",
|
||||
},
|
||||
brightness: {
|
||||
indicator: "display-brightness-symbolic",
|
||||
keyboard: "keyboard-brightness-symbolic",
|
||||
screen: "display-brightness-symbolic",
|
||||
},
|
||||
powermenu: {
|
||||
sleep: "weather-clear-night-symbolic",
|
||||
reboot: "system-reboot-symbolic",
|
||||
logout: "system-log-out-symbolic",
|
||||
shutdown: "system-shutdown-symbolic",
|
||||
},
|
||||
recorder: {
|
||||
recording: "media-record-symbolic",
|
||||
},
|
||||
notifications: {
|
||||
noisy: "org.gnome.Settings-notifications-symbolic",
|
||||
silent: "notifications-disabled-symbolic",
|
||||
message: "chat-bubbles-symbolic",
|
||||
},
|
||||
trash: {
|
||||
full: "user-trash-full-symbolic",
|
||||
empty: "user-trash-symbolic",
|
||||
},
|
||||
mpris: {
|
||||
shuffle: {
|
||||
enabled: "media-playlist-shuffle-symbolic",
|
||||
disabled: "media-playlist-consecutive-symbolic",
|
||||
},
|
||||
loop: {
|
||||
none: "media-playlist-repeat-symbolic",
|
||||
track: "media-playlist-repeat-song-symbolic",
|
||||
playlist: "media-playlist-repeat-symbolic",
|
||||
},
|
||||
playing: "media-playback-pause-symbolic",
|
||||
paused: "media-playback-start-symbolic",
|
||||
stopped: "media-playback-start-symbolic",
|
||||
prev: "media-skip-backward-symbolic",
|
||||
next: "media-skip-forward-symbolic",
|
||||
},
|
||||
system: {
|
||||
cpu: "org.gnome.SystemMonitor-symbolic",
|
||||
ram: "drive-harddisk-solidstate-symbolic",
|
||||
temp: "temperature-symbolic",
|
||||
},
|
||||
color: {
|
||||
dark: "dark-mode-symbolic",
|
||||
light: "light-mode-symbolic",
|
||||
},
|
||||
}
|
||||
playing: "media-playback-pause-symbolic",
|
||||
paused: "media-playback-start-symbolic",
|
||||
stopped: "media-playback-start-symbolic",
|
||||
prev: "media-skip-backward-symbolic",
|
||||
next: "media-skip-forward-symbolic",
|
||||
},
|
||||
system: {
|
||||
cpu: "org.gnome.SystemMonitor-symbolic",
|
||||
ram: "drive-harddisk-solidstate-symbolic",
|
||||
temp: "temperature-symbolic",
|
||||
},
|
||||
color: {
|
||||
dark: "dark-mode-symbolic",
|
||||
light: "light-mode-symbolic",
|
||||
},
|
||||
weather: {
|
||||
sunny: "weather-clear-symbolic",
|
||||
clear: "weather-clear-night-symbolic",
|
||||
partly_cloudy: "weather-few-clouds-symbolic",
|
||||
cloudy: "weather-overcast-symbolic",
|
||||
overcast: "weather-overcast-symbolic",
|
||||
mist: "weather-overcast-symbolic",
|
||||
patchy_rain_possible: "weather-showers-scattered-symbolic",
|
||||
patchy_snow_possible: "weather-snow-symbolic",
|
||||
patchy_sleet_possible: "weather-snow-symbolic",
|
||||
patchy_freezing_drizzle_possible: "weather-showers-scattered-symbolic",
|
||||
thundery_outbreaks_possible: "weather-overcast-symbolic",
|
||||
blowing_snow: "weather-snow-symbolic",
|
||||
blizzard: "weather-snow-symbolic",
|
||||
fog: "weather-fog-symbolic",
|
||||
freezing_fog: "weather-fog-symbolic",
|
||||
patchy_light_drizzle: "weather-showers-scattered-symbolic",
|
||||
light_drizzle: "weather-showers-symbolic",
|
||||
freezing_drizzle: "weather-showers-symbolic",
|
||||
heavy_freezing_drizzle: "weather-showers-symbolic",
|
||||
patchy_light_rain: "weather-showers-scattered-symbolic",
|
||||
light_rain: "weather-showers-symbolic",
|
||||
moderate_rain_at_times: "weather-showers-symbolic",
|
||||
moderate_rain: "weather-showers-symbolic",
|
||||
heavy_rain_at_times: "weather-showers-symbolic",
|
||||
heavy_rain: "weather-showers-symbolic",
|
||||
light_freezing_rain: "weather-showers-symbolic",
|
||||
moderate_or_heavy_freezing_rain: "weather-showers-symbolic",
|
||||
light_sleet: "weather-snow-symbolic",
|
||||
moderate_or_heavy_sleet: "weather-snow-symbolic",
|
||||
patchy_light_snow: "weather-snow-symbolic",
|
||||
light_snow: "weather-snow-symbolic",
|
||||
patchy_moderate_snow: "weather-snow-symbolic",
|
||||
moderate_snow: "weather-snow-symbolic",
|
||||
patchy_heavy_snow: "weather-snow-symbolic",
|
||||
heavy_snow: "weather-snow-symbolic",
|
||||
ice_pellets: "weather-showers-symbolic",
|
||||
light_rain_shower: "weather-showers-symbolic",
|
||||
moderate_or_heavy_rain_shower: "weather-showers-symbolic",
|
||||
torrential_rain_shower: "weather-showers-symbolic",
|
||||
light_sleet_showers: "weather-showers-symbolic",
|
||||
moderate_or_heavy_sleet_showers: "weather-showers-symbolic",
|
||||
light_snow_showers: "weather-snow-symbolic",
|
||||
moderate_or_heavy_snow_showers: "weather-snow-symbolic",
|
||||
light_showers_of_ice_pellets: "weather-showers-symbolic",
|
||||
moderate_or_heavy_showers_of_ice_pellets: "weather-showers-symbolic",
|
||||
patchy_light_rain_with_thunder: "weather-showers-scattered-symbolic",
|
||||
moderate_or_heavy_rain_with_thunder: "weather-showers-symbolic",
|
||||
patchy_light_snow_with_thunder: "weather-snow-symbolic",
|
||||
moderate_or_heavy_snow_with_thunder: "weather-snow-symbolic",
|
||||
},
|
||||
};
|
||||
|
||||
@@ -5,7 +5,7 @@ export default () => {
|
||||
const connectedDevices = (btDevices) => {
|
||||
const noDevices = () => {
|
||||
return Widget.Box({
|
||||
hpack: "start",
|
||||
hpack: "center",
|
||||
hexpand: true,
|
||||
child: Widget.Label({
|
||||
class_name: "dim",
|
||||
|
||||
@@ -1,5 +1,242 @@
|
||||
import PopupWindow from "../PopupWindow.js";
|
||||
import icons from "../../icons/index.js";
|
||||
import { keyRing } from "../../../../../Documents/Keys/keyList.js";
|
||||
|
||||
const time = Variable("", {
|
||||
poll: [1000, 'date "+%I:%M:%S"'],
|
||||
});
|
||||
|
||||
const period = Variable("", {
|
||||
poll: [1000, 'date "+%p"'],
|
||||
});
|
||||
const defaultWeather = {
|
||||
current: {
|
||||
temp_f: 0,
|
||||
wind_mph: 0,
|
||||
condition: {
|
||||
text: "Clear",
|
||||
},
|
||||
forecast: {
|
||||
forecastday: [
|
||||
{
|
||||
day: {
|
||||
daily_chance_of_rain: 0,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const theWeather = Variable(defaultWeather);
|
||||
|
||||
const getIcon = (fahren) => {
|
||||
const icons = {
|
||||
100: "",
|
||||
75: "",
|
||||
50: "",
|
||||
25: "",
|
||||
0: "",
|
||||
};
|
||||
const colors = {
|
||||
100: "weather-color red",
|
||||
75: "weather-color orange",
|
||||
50: "weather-color lavender",
|
||||
25: "weather-color blue",
|
||||
0: "weather-color sky",
|
||||
};
|
||||
|
||||
const threshold =
|
||||
fahren < 0
|
||||
? 0
|
||||
: [100, 75, 50, 25, 0].find((threshold) => threshold <= fahren);
|
||||
|
||||
return {
|
||||
icon: icons[threshold],
|
||||
color: colors[threshold],
|
||||
};
|
||||
};
|
||||
|
||||
const TimeWidget = () => {
|
||||
return Widget.Box({
|
||||
class_name: "calendar-menu-item-container clock",
|
||||
hexpand: true,
|
||||
vpack: "center",
|
||||
hpack: "fill",
|
||||
child: Widget.Box({
|
||||
hexpand: true,
|
||||
vpack: "center",
|
||||
hpack: "center",
|
||||
class_name: "clock-content-items",
|
||||
children: [
|
||||
Widget.Box({
|
||||
hpack: "center",
|
||||
children: [
|
||||
Widget.Label({
|
||||
class_name: "clock-content-time",
|
||||
label: time.bind(),
|
||||
}),
|
||||
],
|
||||
}),
|
||||
Widget.Box({
|
||||
hpack: "center",
|
||||
children: [
|
||||
Widget.Label({
|
||||
vpack: "end",
|
||||
class_name: "clock-content-period",
|
||||
label: period.bind(),
|
||||
}),
|
||||
],
|
||||
}),
|
||||
],
|
||||
}),
|
||||
});
|
||||
};
|
||||
|
||||
const CalendarWidget = () => {
|
||||
return Widget.Box({
|
||||
class_name: "calendar-menu-item-container calendar",
|
||||
hpack: "fill",
|
||||
vpack: "fill",
|
||||
expand: true,
|
||||
child: Widget.Box({
|
||||
class_name: "calendar-container-box",
|
||||
child: Widget.Calendar({
|
||||
expand: true,
|
||||
hpack: "fill",
|
||||
vpack: "fill",
|
||||
class_name: "calendar-menu-widget",
|
||||
showDayNames: true,
|
||||
showDetails: false,
|
||||
showHeading: true,
|
||||
}),
|
||||
}),
|
||||
});
|
||||
};
|
||||
|
||||
const WeatherWidget = () => {
|
||||
return Widget.Box({
|
||||
class_name: "calendar-menu-item-container weather",
|
||||
child: Widget.Box({
|
||||
class_name: "weather-container-box",
|
||||
setup: (self) => {
|
||||
Utils.interval(6000, () => {
|
||||
Utils.execAsync(
|
||||
`curl "https://api.weatherapi.com/v1/forecast.json?key=${keyRing.weatherapi}&q=93722&days=1&aqi=no&alerts=no"`,
|
||||
).then((res) => {
|
||||
theWeather.value = JSON.parse(res);
|
||||
});
|
||||
});
|
||||
|
||||
return (self.child = Widget.Box({
|
||||
class_name: "calendar-menu-weather today",
|
||||
hexpand: true,
|
||||
children: [
|
||||
Widget.Box({
|
||||
vpack: "center",
|
||||
hpack: "start",
|
||||
class_name: "calendar-menu-weather today icon container",
|
||||
children: [
|
||||
Widget.Icon({
|
||||
class_name: "calendar-menu-weather today icon",
|
||||
icon: theWeather.bind("value").as((v) => {
|
||||
return icons.weather[
|
||||
v.current.condition.text
|
||||
.toLowerCase()
|
||||
.replaceAll(" ", "_")
|
||||
];
|
||||
}),
|
||||
}),
|
||||
],
|
||||
}),
|
||||
Widget.Box({
|
||||
hexpand: true,
|
||||
vpack: "center",
|
||||
hpack: "center",
|
||||
class_name: "calendar-menu-weather today temp container",
|
||||
vertical: true,
|
||||
children: [
|
||||
Widget.Box({
|
||||
children: [
|
||||
Widget.Label({
|
||||
class_name: "calendar-menu-weather today temp label",
|
||||
label: theWeather
|
||||
.bind("value")
|
||||
.as((v) => `${Math.ceil(v.current.temp_f)}° F`),
|
||||
}),
|
||||
Widget.Label({
|
||||
class_name: theWeather
|
||||
.bind("value")
|
||||
.as(
|
||||
(v) =>
|
||||
`calendar-menu-weather today temp label icon ${getIcon(Math.ceil(v.current.temp_f)).color}`,
|
||||
),
|
||||
label: theWeather
|
||||
.bind("value")
|
||||
.as((v) => getIcon(Math.ceil(v.current.temp_f)).icon),
|
||||
}),
|
||||
],
|
||||
}),
|
||||
Widget.Label({
|
||||
class_name: theWeather
|
||||
.bind("value")
|
||||
.as(
|
||||
(v) =>
|
||||
`calendar-menu-weather today condition label ${getIcon(Math.ceil(v.current.temp_f)).color}`,
|
||||
),
|
||||
label: theWeather
|
||||
.bind("value")
|
||||
.as((v) => v.current.condition.text),
|
||||
}),
|
||||
],
|
||||
}),
|
||||
Widget.Box({
|
||||
class_name: "calendar-menu-weather today stats container",
|
||||
hpack: "end",
|
||||
vpack: "start",
|
||||
vertical: true,
|
||||
children: [
|
||||
Widget.Box({
|
||||
class_name: "weather wind",
|
||||
children: [
|
||||
Widget.Label({
|
||||
class_name: "weather wind icon",
|
||||
label: "",
|
||||
}),
|
||||
Widget.Label({
|
||||
class_name: "weather wind label",
|
||||
label: theWeather
|
||||
.bind("value")
|
||||
.as((v) => `${Math.floor(v.current.wind_mph)} mph`),
|
||||
}),
|
||||
],
|
||||
}),
|
||||
Widget.Box({
|
||||
class_name: "weather precip",
|
||||
children: [
|
||||
Widget.Label({
|
||||
class_name: "weather precip icon",
|
||||
label: "",
|
||||
}),
|
||||
Widget.Label({
|
||||
class_name: "weather precip label",
|
||||
label: theWeather
|
||||
.bind("value")
|
||||
.as(
|
||||
(v) =>
|
||||
`${v.forecast.forecastday[0].day.daily_chance_of_rain}%`,
|
||||
),
|
||||
}),
|
||||
],
|
||||
}),
|
||||
],
|
||||
}),
|
||||
],
|
||||
}));
|
||||
},
|
||||
}),
|
||||
});
|
||||
};
|
||||
|
||||
export default () => {
|
||||
return PopupWindow({
|
||||
@@ -14,17 +251,12 @@ export default () => {
|
||||
children: [
|
||||
Widget.Box({
|
||||
class_name: "calendar-content-container",
|
||||
vertical: true,
|
||||
children: [
|
||||
Widget.Box({
|
||||
class_name: "calendar-content-items",
|
||||
children: [
|
||||
Widget.Calendar({
|
||||
class_name: "calendar-menu-calendar",
|
||||
showDayNames: true,
|
||||
showDetails: true,
|
||||
showHeading: true,
|
||||
}),
|
||||
],
|
||||
vertical: true,
|
||||
children: [TimeWidget(), CalendarWidget(), WeatherWidget()],
|
||||
}),
|
||||
],
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user