ags(bar,scripts,i18n): added i18n system(wip), changed some bar stuff and started doing control center
This commit is contained in:
@@ -0,0 +1,95 @@
|
||||
import { Process, Variable } from "astal";
|
||||
import { Gtk, Widget } from "astal/gtk3";
|
||||
import AstalHyprland from "gi://AstalHyprland";
|
||||
|
||||
const hostname: string = Process.exec("cat /etc/hostname") || "GNU/Linux";
|
||||
const uptime = new Variable<string>("Just turned on")
|
||||
.poll(1000, () => {
|
||||
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: "",
|
||||
onClick: () => AstalHyprland.get_default().dispatch("exec", "hyprlock")
|
||||
} as Widget.ButtonProps)
|
||||
}
|
||||
|
||||
function ColorPickerButton(): Widget.Button {
|
||||
return new Widget.Button({
|
||||
label: "",
|
||||
onClick: () => AstalHyprland.get_default().dispatch(
|
||||
"exec",
|
||||
"sh $HOME/.config/eww/scripts/color-picker.sh"
|
||||
)
|
||||
} as Widget.ButtonProps)
|
||||
}
|
||||
|
||||
function ScreenshotButton(): Widget.Button {
|
||||
return new Widget.Button({
|
||||
label: "",
|
||||
onClick: () => Process.exec_async(
|
||||
"bash -c 'hyprshot -m region -o $HOME/Screenshots'",
|
||||
() => {}
|
||||
)
|
||||
} as Widget.ButtonProps);
|
||||
}
|
||||
|
||||
function SelectWallpaperButton(): Widget.Button {
|
||||
return new Widget.Button({
|
||||
label: "",
|
||||
onClick: () => Process.exec_async(
|
||||
"bash -c 'sh $HOME/.config/hypr/scripts/change-wallpaper.sh'",
|
||||
() => {}
|
||||
)
|
||||
} as Widget.ButtonProps);
|
||||
}
|
||||
|
||||
function LogoutButton(): Widget.Button {
|
||||
return new Widget.Button({
|
||||
label: "",
|
||||
onClick: () => Process.exec_async(
|
||||
"bash -c 'loginctl terminate-user $USER'",
|
||||
() => {}
|
||||
)
|
||||
} as Widget.ButtonProps);
|
||||
}
|
||||
Reference in New Issue
Block a user