feat(ags-v3): desktop adaptation — ultrawide scaling, brain power panel, system stats
- Scaling 16px base pour ultrawide 3440x1440 - Bar: CPU/RAM/GPU visible, media single player (skip playerctld), network tooltip LAN/WAN IPv4 - Volume: class module pour sizing cohérent - Battery: désactivé (PC fixe) - Clock: tooltip calendrier + uptime - BrainPower: panel enrichi (focus, session, intentions, todos, repos git, derniers commits) - App: BrainPower sur moniteur principal uniquement - Heartbeat: Layer.TOP pour compatibilité COSMIC
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { createPoll } from "ags/time"
|
||||
import { exec } from "ags/process"
|
||||
|
||||
function formatTime(): string {
|
||||
const now = new Date()
|
||||
@@ -10,6 +11,16 @@ function formatTime(): string {
|
||||
}
|
||||
|
||||
function formatDate(): string {
|
||||
const now = new Date()
|
||||
return now.toLocaleDateString("fr-FR", {
|
||||
weekday: "long",
|
||||
day: "numeric",
|
||||
month: "long",
|
||||
year: "numeric",
|
||||
})
|
||||
}
|
||||
|
||||
function formatDateShort(): string {
|
||||
const now = new Date()
|
||||
return now.toLocaleDateString("fr-FR", {
|
||||
weekday: "short",
|
||||
@@ -18,15 +29,44 @@ function formatDate(): string {
|
||||
})
|
||||
}
|
||||
|
||||
function getCalendar(): string {
|
||||
try {
|
||||
return exec("bash -c \"cal -h\"").trim()
|
||||
} catch {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
function getUptime(): string {
|
||||
try {
|
||||
return exec("bash -c \"uptime -p | sed 's/up //'\"").trim()
|
||||
} catch {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
function buildTooltip(): string {
|
||||
const full = formatDate()
|
||||
const cal = getCalendar()
|
||||
const up = getUptime()
|
||||
return `${full}\n\n${cal}\n\n⏱ uptime: ${up}`
|
||||
}
|
||||
|
||||
export default function Clock() {
|
||||
const time = createPoll("", 1000, () => formatTime())
|
||||
const date = createPoll("", 60000, () => formatDate())
|
||||
const date = createPoll("", 60000, () => formatDateShort())
|
||||
|
||||
return (
|
||||
<box>
|
||||
<label class="clock" label={time} />
|
||||
<label class="separator" label="│" />
|
||||
<label class="date" label={date} />
|
||||
<eventbox
|
||||
onHover={(self) => {
|
||||
self.tooltipText = buildTooltip()
|
||||
}}
|
||||
>
|
||||
<label class="date" label={date} hasTooltip />
|
||||
</eventbox>
|
||||
</box>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user