💥 ags: fix startup issues (and with that, errors with focusedClient bar widget)
This commit is contained in:
@@ -1,30 +0,0 @@
|
||||
import { Gtk, Widget } from "astal/gtk3";
|
||||
|
||||
export function ButtonGrid(): Widget.Box {
|
||||
return new Widget.Box({
|
||||
child: new Gtk.Grid({
|
||||
orientation: Gtk.Orientation.HORIZONTAL,
|
||||
rowHomogeneous: true
|
||||
} as Gtk.Grid.ConstructorProps, BluetoothToggle())
|
||||
} as Widget.BoxProps);
|
||||
}
|
||||
|
||||
// Buttons and Toggles!
|
||||
|
||||
export function BluetoothToggle(): Gtk.ToggleButton {
|
||||
return new Gtk.ToggleButton({
|
||||
child: new Widget.Box({
|
||||
orientation: Gtk.Orientation.VERTICAL,
|
||||
children: [
|
||||
new Widget.Label({
|
||||
className: "title",
|
||||
label: "Bluetooth"
|
||||
} as Widget.LabelProps),
|
||||
new Widget.Label({
|
||||
className: "extra",
|
||||
label: "[dev] [dev_bat]"
|
||||
} as Widget.LabelProps)
|
||||
]
|
||||
} as Widget.BoxProps)
|
||||
});
|
||||
}
|
||||
@@ -8,45 +8,6 @@ const uptime = new Variable<string>("Just turned on")
|
||||
return Process.exec("uptime -p").replace(/^up /, "")
|
||||
})();
|
||||
|
||||
const quickActionsBox: Widget.Box = new Widget.Box({
|
||||
className: "quickactions",
|
||||
hexpand: true,
|
||||
children: [
|
||||
new Widget.Box({
|
||||
orientation: Gtk.Orientation.VERTICAL,
|
||||
halign: Gtk.Align.START,
|
||||
children: [
|
||||
new Widget.Label({
|
||||
className: "hostname",
|
||||
xalign: 0,
|
||||
label: hostname.toString()
|
||||
} as Widget.LabelProps),
|
||||
new Widget.Label({
|
||||
className: "uptime",
|
||||
xalign: 0,
|
||||
label: uptime.as((uptime: string) => ` ${uptime}`)
|
||||
} as Widget.LabelProps)
|
||||
]
|
||||
} as Widget.BoxProps),
|
||||
new Widget.Box({
|
||||
orientation: Gtk.Orientation.HORIZONTAL,
|
||||
className: "button-row",
|
||||
halign: Gtk.Align.END,
|
||||
children: [
|
||||
LockButton(),
|
||||
ColorPickerButton(),
|
||||
ScreenshotButton(),
|
||||
SelectWallpaperButton(),
|
||||
LogoutButton()
|
||||
]
|
||||
} as Widget.BoxProps)
|
||||
]
|
||||
} as Widget.BoxProps);
|
||||
|
||||
export function QuickActionsWidget(): Widget.Box {
|
||||
return quickActionsBox;
|
||||
}
|
||||
|
||||
function LockButton(): Widget.Button {
|
||||
return new Widget.Button({
|
||||
label: "",
|
||||
@@ -93,3 +54,39 @@ function LogoutButton(): Widget.Button {
|
||||
)
|
||||
} as Widget.ButtonProps);
|
||||
}
|
||||
|
||||
export const QuickActions: Widget.Box = new Widget.Box({
|
||||
className: "quickactions",
|
||||
children: [
|
||||
new Widget.Box({
|
||||
orientation: Gtk.Orientation.VERTICAL,
|
||||
halign: Gtk.Align.START,
|
||||
hexpand: true,
|
||||
children: [
|
||||
new Widget.Label({
|
||||
className: "hostname",
|
||||
xalign: 0,
|
||||
label: hostname.toString()
|
||||
} as Widget.LabelProps),
|
||||
new Widget.Label({
|
||||
className: "uptime",
|
||||
xalign: 0,
|
||||
label: uptime.as((uptime: string) => ` ${uptime}`)
|
||||
} as Widget.LabelProps)
|
||||
]
|
||||
} as Widget.BoxProps),
|
||||
new Widget.Box({
|
||||
orientation: Gtk.Orientation.HORIZONTAL,
|
||||
className: "button-row",
|
||||
halign: Gtk.Align.END,
|
||||
hexpand: true,
|
||||
children: [
|
||||
LockButton(),
|
||||
ColorPickerButton(),
|
||||
ScreenshotButton(),
|
||||
SelectWallpaperButton(),
|
||||
LogoutButton()
|
||||
]
|
||||
} as Widget.BoxProps)
|
||||
]
|
||||
} as Widget.BoxProps);
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
import { Gtk, Widget } from "astal/gtk3";
|
||||
|
||||
export const tileList: Array<Gtk.Widget> = [
|
||||
]
|
||||
|
||||
export const Tiles: Widget.Box = new Widget.Box({
|
||||
child: new Gtk.Grid({
|
||||
orientation: Gtk.Orientation.HORIZONTAL,
|
||||
rowHomogeneous: true
|
||||
} as Gtk.Grid.ConstructorProps)
|
||||
} as Widget.BoxProps);
|
||||
@@ -0,0 +1,8 @@
|
||||
import { Gtk, Widget } from "astal/gtk3";
|
||||
|
||||
export const TileInternet = new Widget.Box({
|
||||
className: "tile more internet",
|
||||
children: [
|
||||
toggleButton
|
||||
]
|
||||
} as Widget.BoxProps);
|
||||
@@ -0,0 +1,60 @@
|
||||
import { Binding } from "astal";
|
||||
import { Gtk, Widget } from "astal/gtk3";
|
||||
|
||||
export interface MoreTileProps {
|
||||
className?: string | Binding<string | undefined>;
|
||||
iconName?: string | Binding<string | undefined>;
|
||||
iconSize?: Gtk.IconSize;
|
||||
title: string | Binding<string>;
|
||||
description?: string | Binding<string | undefined>;
|
||||
defaultToggleState?: boolean;
|
||||
onToggledOn: Function;
|
||||
onToggledOff: Function;
|
||||
onClickMore: Function;
|
||||
}
|
||||
|
||||
export function MoreTile(props: MoreTileProps): Gtk.Widget {
|
||||
|
||||
let toggleState: boolean = props?.defaultToggleState !== undefined ?
|
||||
props.defaultToggleState : false;
|
||||
|
||||
const mainEventBox = new Widget.EventBox({
|
||||
onClick: () => toggleState ? props.onToggledOff() : props.onToggledOn(),
|
||||
expand: true,
|
||||
child: new Widget.Box({
|
||||
className: props?.className || "",
|
||||
expand: true,
|
||||
children: [
|
||||
new Widget.Icon({
|
||||
iconName: props?.iconName,
|
||||
visible: props.iconName !== undefined,
|
||||
iconSize: props.iconSize || Gtk.IconSize.BUTTON
|
||||
}),
|
||||
new Widget.Box({
|
||||
className: "text",
|
||||
orientation: Gtk.Orientation.VERTICAL,
|
||||
children: [
|
||||
new Widget.Label({
|
||||
className: "title",
|
||||
label: props.title
|
||||
} as Widget.LabelProps),
|
||||
new Widget.Label({
|
||||
className: "description",
|
||||
visible: props?.description !== undefined,
|
||||
label: props?.description
|
||||
} as Widget.LabelProps)
|
||||
]
|
||||
} as Widget.BoxProps),
|
||||
new Widget.Button({
|
||||
onClick: () => props.onClickMore(),
|
||||
child: new Widget.Icon({
|
||||
iconName: "go-next",
|
||||
iconSize: Gtk.IconSize.BUTTON
|
||||
} as Widget.IconProps),
|
||||
} as Widget.ButtonProps)
|
||||
]
|
||||
} as Widget.BoxProps)
|
||||
} as Widget.EventBoxProps);
|
||||
|
||||
return mainEventBox;
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
import { Binding } from "astal";
|
||||
import { Gtk, Widget } from "astal/gtk3";
|
||||
|
||||
export interface NormalTileProps {
|
||||
className?: string | Binding<string | undefined>;
|
||||
iconName?: string | Binding<string | undefined>;
|
||||
iconSize?: Gtk.IconSize;
|
||||
title: string | Binding<string>;
|
||||
description?: string | Binding<string | undefined>;
|
||||
toggleState?: boolean | Binding<boolean | undefined>;
|
||||
onToggledOn: Function;
|
||||
onToggledOff: Function;
|
||||
}
|
||||
|
||||
export function MoreTile(props: NormalTileProps): Gtk.Widget {
|
||||
|
||||
let toggleState: boolean = props?.toggleState !== undefined ?
|
||||
props.toggleState : false;
|
||||
|
||||
const mainEventBox = new Widget.EventBox({
|
||||
onClick: () => toggleState ? props.onToggledOff() : props.onToggledOn(),
|
||||
expand: true,
|
||||
child: new Widget.Box({
|
||||
className: props?.className || "",
|
||||
expand: true,
|
||||
children: [
|
||||
new Widget.Icon({
|
||||
iconName: props?.iconName,
|
||||
visible: props.iconName !== undefined,
|
||||
iconSize: props.iconSize || Gtk.IconSize.BUTTON
|
||||
}),
|
||||
new Widget.Box({
|
||||
className: "text",
|
||||
orientation: Gtk.Orientation.VERTICAL,
|
||||
children: [
|
||||
new Widget.Label({
|
||||
className: "title",
|
||||
label: props.title
|
||||
} as Widget.LabelProps),
|
||||
new Widget.Label({
|
||||
className: "description",
|
||||
visible: props?.description !== undefined,
|
||||
label: props?.description
|
||||
} as Widget.LabelProps)
|
||||
]
|
||||
} as Widget.BoxProps)
|
||||
]
|
||||
} as Widget.BoxProps)
|
||||
} as Widget.EventBoxProps);
|
||||
|
||||
function toggleOn(): void {
|
||||
mainEventBox.set_class_name(mainEventBox + "")
|
||||
props.onToggledOn();
|
||||
}
|
||||
|
||||
function toggleOff(): void {
|
||||
props.onToggledOff();
|
||||
}
|
||||
|
||||
return mainEventBox;
|
||||
}
|
||||
Reference in New Issue
Block a user