ags: make osd work, new window management system, lots of improvements

This commit is contained in:
retrozinndev
2025-02-07 16:02:58 -03:00
parent 0bd0b53589
commit b0bd785ddd
24 changed files with 559 additions and 254 deletions
+12 -6
View File
@@ -1,6 +1,6 @@
import { bind, Process } from "astal";
import { Widget } from "astal/gtk3";
import AstalWp from "gi://AstalWp?version=0.1";
import AstalWp from "gi://AstalWp";
import { Wireplumber } from "../../scripts/volume";
const wp = AstalWp.get_default();
@@ -26,8 +26,8 @@ export function Audio() {
} as Widget.LabelProps),
new Widget.Label({
className: "icon nf",
label: bind(wp!.defaultSpeaker, "volume").as((volume: number) =>
Math.round(volume * 100).toString() + "%")
label: bind(Wireplumber.getDefault().getDefaultSink(), "volume").as((volume: number) =>
Math.floor(volume * 100) + "%")
} as Widget.LabelProps)
]
})
@@ -46,12 +46,18 @@ export function Audio() {
label: "󰍬"
} as Widget.LabelProps),
new Widget.Label({
label: bind(wp!.defaultMicrophone, "volume").as((volume: number) =>
Math.round(volume * 100).toString() + "%")
label: bind(Wireplumber.getDefault().getDefaultSource(), "volume").as((volume: number) =>
Math.floor(volume * 100) + "%")
} as Widget.LabelProps)
]
})
} as Widget.EventBoxProps)
} as Widget.EventBoxProps),
new Widget.Box({
className: "notification-bell",
child: new Widget.Label({
label: "󰂚"
} as Widget.LabelProps)
} as Widget.BoxProps)
]
} as Widget.BoxProps)
} as Widget.EventBoxProps);
+3
View File
@@ -1,11 +1,14 @@
import { Widget } from "astal/gtk3";
import { getDateTime } from "../../scripts/time";
import { GLib } from "astal";
import { Windows } from "../../windows";
import { CenterWindow } from "../../window/CenterWindow";
export function Clock(): JSX.Element {
return new Widget.Box({
className: "clock",
child: new Widget.Button({
onClick: () => Windows.toggle(CenterWindow),
label: getDateTime().as((dateTime: GLib.DateTime) => {
return dateTime.format("%A %d, %H:%M")
})
@@ -1,13 +1,13 @@
import { Widget } from "astal/gtk3";
import { Box, Button } from "astal/gtk3/widget";
import AstalHyprland from "gi://AstalHyprland";
import { tr } from "../../i18n/intl";
export function Logo() {
return new Widget.Box({
className: "logo",
//tooltipText: tr("bar.logo.tooltip"),
child:
<Button onClick={ () => AstalHyprland.get_default().dispatch("exec", "anyrun") } label={""} />
child: new Widget.Button({
onClick: () => AstalHyprland.get_default().dispatch("exec", "anyrun"),
label: ""
} as Widget.ButtonProps)
} as Widget.BoxProps);
}
+10 -3
View File
@@ -1,4 +1,4 @@
import { bind } from "astal";
import { bind, Process } from "astal";
import { Gtk, Widget } from "astal/gtk3";
import AstalMpris from "gi://AstalMpris";
import { Separator, SeparatorProps } from "../Separator";
@@ -13,7 +13,7 @@ const playerIcons = {
firefox: '󰈹'
}
export function Media(): JSX.Element {
export function Media(): Gtk.Widget {
const mediaControlsRevealer: Widget.Revealer = new Widget.Revealer({
transitionType: Gtk.RevealerTransitionType.SLIDE_RIGHT,
transitionDuration: 260,
@@ -24,6 +24,13 @@ export function Media(): JSX.Element {
homogeneous: false,
children: bind(mpris, "players").as((players: Array<AstalMpris.Player>) =>
players[0] ? [
new Widget.Button({
className: "link",
label: "󰌷",
visible: bind(players[0], "metadata").as(metadata =>
metadata?.["xesam:url"] ? true : false),
onClick: () => Process.exec(`echo ${players[0].metadata.url}"`)
} as Widget.ButtonProps),
new Widget.Button({
className: "previous",
label: "󰒮",
@@ -82,7 +89,7 @@ export function Media(): JSX.Element {
label: bind(players[0], "artist").as((artist: string) => artist || "No Artist")
} as Widget.LabelProps)
] : new Widget.Label({
label: "Crazy to think this widget didn't disappear yet!"
label: "Crazy to think this widget haven't disappeared yet!"
} as Widget.LabelProps)
)
} as Widget.BoxProps),
+2 -1
View File
@@ -62,6 +62,7 @@ export const QuickActions: Widget.Box = new Widget.Box({
orientation: Gtk.Orientation.VERTICAL,
halign: Gtk.Align.START,
hexpand: true,
className: "left",
children: [
new Widget.Label({
className: "hostname",
@@ -77,7 +78,7 @@ export const QuickActions: Widget.Box = new Widget.Box({
} as Widget.BoxProps),
new Widget.Box({
orientation: Gtk.Orientation.HORIZONTAL,
className: "button-row",
className: "right button-row",
halign: Gtk.Align.END,
hexpand: true,
children: [
+54
View File
@@ -0,0 +1,54 @@
import { bind } from "astal";
import { Gtk, Widget } from "astal/gtk3";
import { Wireplumber } from "../../scripts/volume";
export const Sliders: Gtk.Widget = new Widget.Box({
className: "sliders",
orientation: Gtk.Orientation.VERTICAL,
expand: true,
children: [
new Widget.Box({
className: "sink speaker",
children: [
new Widget.Icon({
icon: "audio-volume-high-symbolic"
} as Widget.IconProps),
new Widget.Slider({
drawValue: false,
hexpand: true,
value: bind(Wireplumber.getDefault().getDefaultSink(), "volume").as((volume: number) =>
Math.floor(volume * 100)),
max: Wireplumber.getDefault().getMaxSinkVolume(),
onDragged: (slider: Gtk.Scale) => Wireplumber.getDefault().setSinkVolume(slider.get_value())
} as Widget.SliderProps)
]
} as Widget.BoxProps),
new Widget.Box({
className: "source microphone",
children: [
new Widget.Icon({
icon: "microphone-sensitivity-high-symbolic"
} as Widget.IconProps),
new Widget.Slider({
drawValue: false,
hexpand: true,
value: bind(Wireplumber.getDefault().getDefaultSource(), "volume").as((volume: number) =>
Math.floor(volume * 100)),
max: Wireplumber.getDefault().getMaxSourceVolume(),
onDragged: (slider: Gtk.Scale) => Wireplumber.getDefault().setSourceVolume(slider.get_value())
} as Widget.SliderProps)
]
} as Widget.BoxProps),
/*new Widget.Box({
className: "brightness screen",
children: [
new Widget.Slider({
drawValue: false,
hexpand: true,
value: 216,
max: 255
} as Widget.SliderProps)
]
} as Widget.BoxProps)*/
]
} as Widget.BoxProps);