ags: style
This commit is contained in:
@@ -4,12 +4,8 @@ import Wp from "gi://AstalWp"
|
||||
export default function Audio() {
|
||||
const speaker = Wp.get_default()?.audio.defaultSpeaker!
|
||||
|
||||
return <box className="AudioSlider" css="min-width: 140px">
|
||||
return <box className="AudioSlider">
|
||||
<icon icon={bind(speaker, "volumeIcon")} />
|
||||
<slider
|
||||
hexpand
|
||||
onDragged={({ value }) => speaker.volume = value}
|
||||
value={bind(speaker, "volume")}
|
||||
/>
|
||||
<label label={bind(speaker, "volume").as(v => `${Math.floor(v*100)}%`)} />
|
||||
</box>
|
||||
}
|
||||
|
||||
@@ -1,28 +1,29 @@
|
||||
import { bind } from "astal"
|
||||
import { Variable, bind } from "astal"
|
||||
import { Gtk } from "astal/gtk3"
|
||||
import Mpris from "gi://AstalMpris"
|
||||
|
||||
export default function Media() {
|
||||
const mpris = Mpris.get_default()
|
||||
// console.log(bind(mpris, "players").as(ps => ps[0] ? `${ps[0].title} ${ps[0].artist} ${ps[0].get_playback_status()}` : "-"));
|
||||
|
||||
return <box className="Media">
|
||||
return <box>
|
||||
{bind(mpris, "players").as(ps => ps[0] ? (
|
||||
<box>
|
||||
<box
|
||||
className="Cover"
|
||||
valign={Gtk.Align.CENTER}
|
||||
css={bind(ps[0], "coverArt").as(cover =>
|
||||
`background-image: url('${cover}');`
|
||||
)}
|
||||
/>
|
||||
<label
|
||||
label={bind(ps[0], "title").as(() =>
|
||||
`${ps[0].title} - ${ps[0].artist}`
|
||||
)}
|
||||
/>
|
||||
</box>
|
||||
) : (
|
||||
"Nothing Playing"
|
||||
))}
|
||||
<button
|
||||
className={bind(ps[0], "playback-status").as(s => s == 0 ? "Media playing" : "Media")}
|
||||
onClicked={() => ps[0].play_pause()}>
|
||||
<box>
|
||||
<box
|
||||
className="Cover"
|
||||
valign={Gtk.Align.CENTER}
|
||||
css={bind(ps[0], "coverArt").as(cover =>
|
||||
`background-image: url('${cover}');`
|
||||
)}
|
||||
/>
|
||||
<label
|
||||
label={bind(ps[0], "title").as(() =>ps[0].title.length < 80 ? ps[0].title : `${ps[0].title.slice(0, 77)}...`)}
|
||||
/>
|
||||
</box>
|
||||
</button>
|
||||
) : ("") )}
|
||||
</box>
|
||||
}
|
||||
|
||||
@@ -4,15 +4,19 @@ import Tray from "gi://AstalTray"
|
||||
export default function SysTray() {
|
||||
const tray = Tray.get_default()
|
||||
|
||||
return <box className="SysTray">
|
||||
{bind(tray, "items").as(items => items.map(item => (
|
||||
<menubutton
|
||||
tooltipMarkup={bind(item, "tooltipMarkup")}
|
||||
usePopover={false}
|
||||
actionGroup={bind(item, "action-group").as(ag => ["dbusmenu", ag])}
|
||||
menuModel={bind(item, "menu-model")}>
|
||||
<icon gicon={bind(item, "gicon")} />
|
||||
</menubutton>
|
||||
)))}
|
||||
return <box className="item">
|
||||
{bind(tray, "items").as(i => (i.length > 0) ? (
|
||||
<box className="SysTray">
|
||||
{bind(tray, "items").as(items => items.map(item => (
|
||||
<menubutton
|
||||
tooltipMarkup={bind(item, "tooltipMarkup")}
|
||||
usePopover={false}
|
||||
actionGroup={bind(item, "action-group").as(ag => ["dbusmenu", ag])}
|
||||
menuModel={bind(item, "menu-model")}>
|
||||
<icon gicon={bind(item, "gicon")} />
|
||||
</menubutton>
|
||||
)))}
|
||||
</box>
|
||||
) : ("") )}
|
||||
</box>
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Variable, GLib } from "astal"
|
||||
|
||||
export default function Time({ format = "%H:%M - %A %e." }) {
|
||||
export default function Time({ format = "%e %b - %H:%M %a" }) {
|
||||
const time = Variable<string>("").poll(1000, () =>
|
||||
GLib.DateTime.new_now_local().format(format)!)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user