wireplumber
This commit is contained in:
parent
5bf54c73ce
commit
aec1423ebe
3 changed files with 84 additions and 3 deletions
32
style.scss
32
style.scss
|
|
@ -11,14 +11,16 @@ $rosewater: #f4dbd6;
|
||||||
button {
|
button {
|
||||||
all: initial;
|
all: initial;
|
||||||
}
|
}
|
||||||
|
* {
|
||||||
|
font-family: JetBrainsMono Nerd Font;
|
||||||
|
}
|
||||||
|
|
||||||
window.Bar {
|
window.Bar {
|
||||||
font-family: JetBrainsMono Nerd Font;
|
|
||||||
background: transparent;
|
background: transparent;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
|
||||||
> centerbox {
|
> centerbox {
|
||||||
background: $base;
|
background: rgba($color: $base, $alpha: 0.75);
|
||||||
|
|
||||||
> box {
|
> box {
|
||||||
margin: 6px;
|
margin: 6px;
|
||||||
|
|
@ -42,7 +44,6 @@ window.Bar {
|
||||||
|
|
||||||
.Pywal {
|
.Pywal {
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
text-align: center;
|
|
||||||
padding: 4px 18px 4px 12px;
|
padding: 4px 18px 4px 12px;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
background: $surface0;
|
background: $surface0;
|
||||||
|
|
@ -73,4 +74,29 @@ window.Bar {
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
background: $surface0;
|
background: $surface0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.Button-Active {
|
||||||
|
background: $rosewater;
|
||||||
|
color: $base;
|
||||||
|
}
|
||||||
|
|
||||||
|
.WirePlumberMenu {
|
||||||
|
contents {
|
||||||
|
all: initial;
|
||||||
|
}
|
||||||
|
|
||||||
|
arrow {
|
||||||
|
all: initial;
|
||||||
|
}
|
||||||
|
|
||||||
|
box {
|
||||||
|
padding: 12px;
|
||||||
|
border-radius: 8px;
|
||||||
|
background: rgba($color: $base, $alpha: 0.9);
|
||||||
|
|
||||||
|
& > * {
|
||||||
|
margin: 2px 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import OS from "./OS";
|
||||||
import Pywal from "./Pywal";
|
import Pywal from "./Pywal";
|
||||||
import Tray from "./Tray";
|
import Tray from "./Tray";
|
||||||
import SwayNC from "./SwayNC";
|
import SwayNC from "./SwayNC";
|
||||||
|
import WirePlumber from "./WirePlumber";
|
||||||
|
|
||||||
export default function Bar(gdkmonitor: Gdk.Monitor) {
|
export default function Bar(gdkmonitor: Gdk.Monitor) {
|
||||||
const { TOP, LEFT, RIGHT } = Astal.WindowAnchor;
|
const { TOP, LEFT, RIGHT } = Astal.WindowAnchor;
|
||||||
|
|
@ -31,6 +32,7 @@ export default function Bar(gdkmonitor: Gdk.Monitor) {
|
||||||
</box>
|
</box>
|
||||||
<box halign={Gtk.Align.END}>
|
<box halign={Gtk.Align.END}>
|
||||||
<Pywal />
|
<Pywal />
|
||||||
|
<WirePlumber />
|
||||||
<Internet />
|
<Internet />
|
||||||
<Calendar />
|
<Calendar />
|
||||||
<SwayNC />
|
<SwayNC />
|
||||||
|
|
|
||||||
53
widget/WirePlumber.tsx
Normal file
53
widget/WirePlumber.tsx
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
import { bind, derive } from "astal";
|
||||||
|
import { Gdk } from "astal/gtk4";
|
||||||
|
import AstalWp from "gi://AstalWp";
|
||||||
|
|
||||||
|
const WirePlumber = function () {
|
||||||
|
const audio = AstalWp.get_default()?.audio!;
|
||||||
|
|
||||||
|
const speakers = bind(audio, "speakers");
|
||||||
|
|
||||||
|
return (
|
||||||
|
<menubutton>
|
||||||
|
{speakers.as((speakers) => {
|
||||||
|
const defaultSpeaker = speakers.find((speaker) => speaker.is_default);
|
||||||
|
if (!defaultSpeaker) {
|
||||||
|
return <></>;
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<label
|
||||||
|
cursor={Gdk.Cursor.new_from_name("pointer", null)}
|
||||||
|
label={bind(defaultSpeaker, "volume").as(
|
||||||
|
(volume) => ` ${Math.floor(volume * 100)}%`,
|
||||||
|
)}
|
||||||
|
cssClasses={["Button"]}
|
||||||
|
hasTooltip={true}
|
||||||
|
tooltipText={bind(defaultSpeaker, "description").as(
|
||||||
|
(description) => description,
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
<popover cssClasses={["WirePlumberMenu"]}>
|
||||||
|
<box vertical>
|
||||||
|
{speakers.as((speakers) =>
|
||||||
|
speakers.map((speaker) => (
|
||||||
|
<button
|
||||||
|
cssClasses={bind(speaker, "is_default").as((is_default) => [
|
||||||
|
"Button",
|
||||||
|
is_default ? "Button-Active" : "",
|
||||||
|
])}
|
||||||
|
cursor={Gdk.Cursor.new_from_name("pointer", null)}
|
||||||
|
onClicked={() => speaker.set_is_default(true)}
|
||||||
|
>
|
||||||
|
{speaker.description}
|
||||||
|
</button>
|
||||||
|
)),
|
||||||
|
)}
|
||||||
|
</box>
|
||||||
|
</popover>
|
||||||
|
</menubutton>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default WirePlumber;
|
||||||
Loading…
Add table
Reference in a new issue