ags: lot of stuff lmao

This commit is contained in:
retrozinndev
2025-02-28 10:21:37 -03:00
parent ff4365ab6d
commit 1a1a5d63f8
31 changed files with 748 additions and 217 deletions
+7 -8
View File
@@ -1,20 +1,19 @@
import { Astal, Gtk, Widget } from "astal/gtk3";
import { Gtk, Widget } from "astal/gtk3";
import { bind, GLib } from "astal";
import { getDateTime } from "../scripts/time";
import { BigMedia } from "../widget/center-window/BigMedia";
import { Separator, SeparatorProps } from "../widget/Separator";
import { PopupWindow, PopupWindowProps } from "../widget/PopupWindow";
export const CenterWindow: Widget.Window = new Widget.Window({
export const CenterWindow: Widget.Window = PopupWindow({
className: "center-window",
namespace: "center-window",
canFocus: true,
monitor: 0,
layer: Astal.Layer.OVERLAY,
exclusivity: Astal.Exclusivity.NORMAL,
visible: false,
margin_top: 10,
anchor: Astal.WindowAnchor.TOP,
marginTop: 10,
valign: Gtk.Align.START,
halign: Gtk.Align.CENTER,
child: new Widget.Box({
className: "center-window-container",
children: [
@@ -69,4 +68,4 @@ export const CenterWindow: Widget.Window = new Widget.Window({
} as Widget.BoxProps)
]
} as Widget.BoxProps)
} as Widget.WindowProps);
} as PopupWindowProps);
+15 -12
View File
@@ -1,26 +1,29 @@
import { Astal, Gtk, Widget } from "astal/gtk3";
import { Gtk, Widget } from "astal/gtk3";
import { QuickActions } from "../widget/control-center/QuickActions";
import { Tiles } from "../widget/control-center/Tiles";
import { Sliders } from "../widget/control-center/Sliders";
import { PopupWindow, PopupWindowProps } from "../widget/PopupWindow";
import { hidePages, PagesWidget } from "../widget/control-center/Pages";
const widgetsContainer: Widget.Box = new Widget.Box({
className: "control-center-container",
orientation: Gtk.Orientation.VERTICAL,
widthRequest: 400,
} as Widget.BoxProps,
QuickActions,
Sliders,
Tiles);
Tiles,
PagesWidget);
export const ControlCenter: Widget.Window = new Widget.Window({
export const ControlCenter: Widget.Window = PopupWindow({
className: "control-center",
namespace: "control-center",
canFocus: true,
exclusivity: Astal.Exclusivity.NORMAL,
anchor: Astal.WindowAnchor.TOP | Astal.WindowAnchor.RIGHT,
layer: Astal.Layer.OVERLAY,
margin_top: 10,
margin_right: 10,
width_request: 400,
marginTop: 10,
marginRight: 10,
monitor: 0,
visible: false
} as Widget.WindowProps, widgetsContainer);
onClose: () => hidePages(),
halign: Gtk.Align.END,
valign: Gtk.Align.START,
visible: false,
child: widgetsContainer
} as PopupWindowProps);
-64
View File
@@ -1,71 +1,7 @@
import { Astal, Gtk, Widget } from "astal/gtk3";
import AstalNotifd from "gi://AstalNotifd";
import { bind } from "astal";
import { Notifications } from "../scripts/notification-handler";
function NotificationWidget(notification: AstalNotifd.Notification): Gtk.Widget {
return new Widget.Box({
className: "notification",
homogeneous: false,
expand: false,
orientation: Gtk.Orientation.VERTICAL,
children: [
new Widget.Box({
className: "top",
orientation: Gtk.Orientation.HORIZONTAL,
hexpand: true,
vexpand: false,
children: [
new Widget.Icon({
className: "icon",
visible: notification.appIcon !== "",
icon: notification.appIcon || "image-missing",
iconSize: Gtk.IconSize.DND,
css: ".icon { font-size: 24px; }"
}),
new Widget.Label({
className: "app-name",
halign: Gtk.Align.START,
label: notification.appName || "Unknown Application"
} as Widget.LabelProps),
new Widget.Button({
className: "close nf",
onClick: () => notification.dismiss(),
label: "󰅖"
} as Widget.ButtonProps)
]
} as Widget.BoxProps),
new Widget.Box({
className: "content",
orientation: Gtk.Orientation.HORIZONTAL,
children: [
new Widget.Box({
className: "image",
visible: notification.image !== "",
css: `box.image { background-image: url('${notification.image}'); }`
} as Widget.BoxProps),
new Widget.Box({
className: "text",
orientation: Gtk.Orientation.VERTICAL,
children: [
new Widget.Label({
className: "summary",
useMarkup: true,
label: notification.summary
}),
new Widget.Label({
className: "body",
useMarkup: true,
label: notification.body
} as Widget.LabelProps)
]
} as Widget.BoxProps)
]
} as Widget.BoxProps)
]
} as Widget.BoxProps);
}
export const FloatingNotifications: Widget.Window = new Widget.Window({
namespace: "floating-notifications",
canFocus: false,
+13 -7
View File
@@ -1,6 +1,6 @@
import { Astal, Gdk, Gtk, Widget } from "astal/gtk3";
import { getDateTime } from "../scripts/time";
import { execAsync, GLib, Process } from "astal";
import { execAsync, GLib } from "astal";
const { TOP, LEFT, RIGHT, BOTTOM } = Astal.WindowAnchor;
@@ -10,19 +10,25 @@ export const LogoutMenu: Widget.Window = new Widget.Window({
anchor: TOP | LEFT | RIGHT | BOTTOM,
layer: Astal.Layer.OVERLAY,
exclusivity: Astal.Exclusivity.IGNORE,
keymode: Astal.Keymode.EXCLUSIVE,
monitor: 0,
visible: false,
onKeyPressEvent: (_, event: Gdk.Event) => {
event.get_keyval()[1] === Gdk.KEY_Escape &&
execAsync("astal close logout-menu")
},
child: new Widget.EventBox({
className: "logout-menu",
onClick: () => Process.exec_async("astal close logout-menu", () => {}),
onClick: () => execAsync("astal close logout-menu"),
child: new Widget.Box({
homogeneous: false,
expand: true,
orientation: Gtk.Orientation.VERTICAL,
children: [
new Widget.Box({
className: "top",
expand: true,
expand: false,
orientation: Gtk.Orientation.VERTICAL,
valign: Gtk.Align.START,
children: [
new Widget.Label({
className: "time",
@@ -45,17 +51,17 @@ export const LogoutMenu: Widget.Window = new Widget.Window({
new Widget.Button({
className: "poweroff nf",
label: "󰐥",
onClick: "ask user if it's fr!"
onClick: () => execAsync("systemctl poweroff")
} as Widget.ButtonProps),
new Widget.Button({
className: "reboot nf",
label: "󰜉",
onClick: "ask user if it's fr!"
onClick: () => execAsync("systemctl reboot")
} as Widget.ButtonProps),
new Widget.Button({
className: "suspend nf",
label: "󰤄",
onClick: "ask user if it's fr!"
onClick: () => execAsync("systemctl suspend")
} as Widget.ButtonProps),
new Widget.Button({
className: "logout nf",
+7 -3
View File
@@ -1,10 +1,12 @@
import { Variable } from "astal";
import { Astal, Gtk, Widget } from "astal/gtk3";
import { PopupWindow, PopupWindowProps } from "../widget/PopupWindow";
// TODO
export interface RunnerProps {
anchor?: Astal.WindowAnchor;
halign?: Gtk.Align;
valign?: Gtk.Align;
width?: number;
height?: number;
entryPlaceHolder?: string;
@@ -20,8 +22,10 @@ export function Runner(props?: RunnerProps) {
} as Widget.BoxProps);
return new Widget.Window({
return PopupWindow({
namespace: "runner",
halign: props?.halign || Gtk.Align.CENTER,
valign: props?.valign || Gtk.Align.CENTER,
widthRequest: props?.width || 600,
heightRequest: props?.height || 500,
child: new Widget.Box({
@@ -33,5 +37,5 @@ export function Runner(props?: RunnerProps) {
} as Widget.EntryProps),
]
} as Widget.BoxProps)
} as Widget.WindowProps);
} as PopupWindowProps);
}
View File
+44
View File
@@ -0,0 +1,44 @@
import { Variable } from "astal";
import { Astal, Gdk, Gtk, Widget } from "astal/gtk3";
import { restartInstance } from "../scripts/reload-handler";
const { LEFT, RIGHT, TOP, BOTTOM } = Astal.WindowAnchor;
const wallpaper: Variable<string|undefined> = new Variable<string|undefined>(undefined);
const changeWallpaperButton = new Gtk.MenuItem();
changeWallpaperButton.set_label("Change wallpaper");
const reloadShellButton = new Gtk.MenuItem();
reloadShellButton.set_label("Reload Shell");
reloadShellButton.connect("activate", (_) => restartInstance());
const desktopMenuButtons: Array<Gtk.MenuItem> = [
changeWallpaperButton,
reloadShellButton
];
export const Wallpaper: Widget.Window = new Widget.Window({
namespace: "wallpaper",
layer: Astal.Layer.BACKGROUND,
anchor: LEFT | RIGHT | TOP | BOTTOM,
exclusivity: Astal.Exclusivity.IGNORE,
keymode: Astal.Keymode.NONE,
visible: true,
monitor: 0, //Needs rework for all monitors
child: new Widget.Box({
className: "wallpaper",
} as Widget.BoxProps),
onButtonPressEvent: (_, event: Gdk.Event) => {
const [ , x, y ] = event.get_coords();
if(event.get_button()[1] === Gdk.BUTTON_SECONDARY)
desktopMenu.popup_at_pointer(Gdk.Event.peek());
}
} as Widget.WindowProps);
const desktopMenu: Gtk.Menu = new Gtk.Menu({
visible: true,
monitor: Wallpaper.monitor || 0
} as Gtk.Menu.ConstructorProps);
desktopMenuButtons.map((item: Gtk.MenuItem) =>
desktopMenu.insert(item, -1))