[Meson] Prepare
This commit is contained in:
parent
99a7a59cf7
commit
3e5136fdbb
@ -1,4 +1,4 @@
|
|||||||
import { bind, readFile, Variable, writeFile } from "astal";
|
import { bind, readFile, writeFile } from "astal";
|
||||||
import { Gtk } from "astal/gtk4";
|
import { Gtk } from "astal/gtk4";
|
||||||
import AstalBluetooth from "gi://AstalBluetooth";
|
import AstalBluetooth from "gi://AstalBluetooth";
|
||||||
import BTDevice from "./Device";
|
import BTDevice from "./Device";
|
||||||
@ -74,7 +74,7 @@ const openBTPicker = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const BluetoothPickerList = () => {
|
const BluetoothPickerList = () => {
|
||||||
let btEnableState = readFile("./btconf") === "true" ? true : false;
|
let btEnableState = readFile(`${DATADIR}./btconf`) === "true" ? true : false;
|
||||||
bt.adapter.set_powered(btEnableState);
|
bt.adapter.set_powered(btEnableState);
|
||||||
|
|
||||||
const updateState = () => {
|
const updateState = () => {
|
||||||
|
@ -3,6 +3,7 @@ import { bind, GObject } from "astal";
|
|||||||
import AstalHyprland from "gi://AstalHyprland";
|
import AstalHyprland from "gi://AstalHyprland";
|
||||||
import { Gtk } from "astal/gtk4";
|
import { Gtk } from "astal/gtk4";
|
||||||
|
|
||||||
|
const hypr = AstalHyprland.get_default();
|
||||||
const SYNC = GObject.BindingFlags.SYNC_CREATE;
|
const SYNC = GObject.BindingFlags.SYNC_CREATE;
|
||||||
|
|
||||||
const SysTray = () => {
|
const SysTray = () => {
|
||||||
@ -48,8 +49,6 @@ const SysTray = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const Workspace = () => {
|
const Workspace = () => {
|
||||||
const hypr = AstalHyprland.get_default();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<box>
|
<box>
|
||||||
{bind(hypr, "workspaces").as(wss =>
|
{bind(hypr, "workspaces").as(wss =>
|
||||||
@ -61,9 +60,9 @@ const Workspace = () => {
|
|||||||
cssClasses={bind(hypr, "focusedWorkspace").as(fw =>
|
cssClasses={bind(hypr, "focusedWorkspace").as(fw =>
|
||||||
ws === fw
|
ws === fw
|
||||||
? [
|
? [
|
||||||
"focused-workspace-button",
|
"focused-workspace-button",
|
||||||
"workspace-button",
|
"workspace-button",
|
||||||
]
|
]
|
||||||
: ["workspace-button"],
|
: ["workspace-button"],
|
||||||
)}
|
)}
|
||||||
onButtonPressed={() => ws.focus()}
|
onButtonPressed={() => ws.focus()}
|
||||||
@ -80,88 +79,13 @@ const Workspace = () => {
|
|||||||
* displaying all available clients
|
* displaying all available clients
|
||||||
*/
|
*/
|
||||||
const ActiveWindow = () => {
|
const ActiveWindow = () => {
|
||||||
const hypr = AstalHyprland.get_default();
|
|
||||||
const focused = bind(hypr, "focusedClient");
|
const focused = bind(hypr, "focusedClient");
|
||||||
|
|
||||||
const WindowPopover = (): Gtk.Popover => {
|
const WindowPopover = (): Gtk.Popover => {
|
||||||
// Set up boxes + Popover
|
// Set up boxes + Popover
|
||||||
const clients = new Map<string, Gtk.Button>();
|
|
||||||
const popover = new Gtk.Popover();
|
const popover = new Gtk.Popover();
|
||||||
const popoverBox = new Gtk.Box({
|
|
||||||
orientation: Gtk.Orientation.VERTICAL,
|
|
||||||
});
|
|
||||||
|
|
||||||
const widgetTitle = new Gtk.Label({
|
const popoverBox = WindowPopoverBox();
|
||||||
cssClasses: ["title-2"],
|
|
||||||
label: "Available Windows",
|
|
||||||
});
|
|
||||||
|
|
||||||
popoverBox.append(widgetTitle);
|
|
||||||
|
|
||||||
const seaparator = new Gtk.Separator({
|
|
||||||
marginTop: 5,
|
|
||||||
marginBottom: 10,
|
|
||||||
});
|
|
||||||
|
|
||||||
popoverBox.append(seaparator);
|
|
||||||
|
|
||||||
const addClient = (client: AstalHyprland.Client) => {
|
|
||||||
const clientBox = new Gtk.Box();
|
|
||||||
|
|
||||||
// Workspace description
|
|
||||||
const descWS = new Gtk.Label({ label: "(WS " });
|
|
||||||
|
|
||||||
// Workpsace information
|
|
||||||
const workspace = new Gtk.Label();
|
|
||||||
client.workspace.bind_property("name", workspace, "label", SYNC);
|
|
||||||
|
|
||||||
const windowClassDesc = new Gtk.Label({ label: ") [" });
|
|
||||||
|
|
||||||
const windowClass = new Gtk.Label();
|
|
||||||
windowClass.label = client.get_initial_class();
|
|
||||||
|
|
||||||
const titleDesc = new Gtk.Label({ label: "] " });
|
|
||||||
titleDesc.set_margin_end(2);
|
|
||||||
|
|
||||||
const title = new Gtk.Label();
|
|
||||||
client.bind_property("title", title, "label", SYNC);
|
|
||||||
|
|
||||||
clientBox.append(descWS);
|
|
||||||
clientBox.append(workspace);
|
|
||||||
clientBox.append(windowClassDesc);
|
|
||||||
clientBox.append(windowClass);
|
|
||||||
clientBox.append(titleDesc);
|
|
||||||
clientBox.append(title);
|
|
||||||
|
|
||||||
const button = new Gtk.Button();
|
|
||||||
button.connect( 'clicked', () => {
|
|
||||||
client.workspace.focus();
|
|
||||||
} );
|
|
||||||
button.set_child(clientBox);
|
|
||||||
|
|
||||||
popoverBox.append(button);
|
|
||||||
|
|
||||||
clients.set(client.get_address(), button);
|
|
||||||
};
|
|
||||||
|
|
||||||
// Populate with already added clients
|
|
||||||
const c = hypr.get_clients();
|
|
||||||
for (let index = 0; index < c.length; index++) {
|
|
||||||
addClient(c[index]);
|
|
||||||
}
|
|
||||||
|
|
||||||
hypr.connect("client-added", (_, client) => {
|
|
||||||
addClient(client);
|
|
||||||
});
|
|
||||||
|
|
||||||
hypr.connect("client-removed", (_, client) => {
|
|
||||||
const c = clients.get(client);
|
|
||||||
if (c) {
|
|
||||||
popoverBox.remove(c);
|
|
||||||
c.run_dispose();
|
|
||||||
clients.delete(client);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
popover.set_child(popoverBox);
|
popover.set_child(popoverBox);
|
||||||
return popover;
|
return popover;
|
||||||
@ -177,19 +101,37 @@ const ActiveWindow = () => {
|
|||||||
<button
|
<button
|
||||||
onClicked={() => windowPopover.popup()}
|
onClicked={() => windowPopover.popup()}
|
||||||
cssClasses={["bar-button"]}
|
cssClasses={["bar-button"]}
|
||||||
>
|
child={
|
||||||
{focused.as(
|
focused.as(
|
||||||
client =>
|
client =>
|
||||||
client && (
|
client && (
|
||||||
<label label={bind(client, "title").as(String)} />
|
<label label={bind(client, "title").as(String)} />
|
||||||
),
|
),
|
||||||
)}
|
)
|
||||||
</button>
|
}></button>
|
||||||
{windowPopover}
|
{windowPopover}
|
||||||
</box>
|
</box >
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const WindowPopoverBox = () => {
|
||||||
|
return <box vertical>
|
||||||
|
<label label={"Available Windows"} cssClasses={['title-2']}></label>
|
||||||
|
<Gtk.Separator marginTop={5} marginBottom={5}></Gtk.Separator>
|
||||||
|
<box vertical>
|
||||||
|
{bind(hypr, 'clients').as(clients => {
|
||||||
|
return clients.map(client => {
|
||||||
|
return <box>
|
||||||
|
<label label={bind(client, 'workspace').as(w => `(WS ${w})`)}></label>
|
||||||
|
<label label={bind(client, 'initialClass').as(c => `[${c}]`)}></label>
|
||||||
|
<label label={bind(client, 'title')}></label>
|
||||||
|
</box>
|
||||||
|
})
|
||||||
|
})}
|
||||||
|
</box>
|
||||||
|
</box>
|
||||||
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
Workspace,
|
Workspace,
|
||||||
ActiveWindow,
|
ActiveWindow,
|
||||||
|
1
config/astal/env.d.ts
vendored
1
config/astal/env.d.ts
vendored
@ -1,4 +1,5 @@
|
|||||||
declare const SRC: string
|
declare const SRC: string
|
||||||
|
declare const DATADIR: string
|
||||||
|
|
||||||
declare module "inline:*" {
|
declare module "inline:*" {
|
||||||
const content: string
|
const content: string
|
||||||
|
27
config/astal/meson.build
Normal file
27
config/astal/meson.build
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
pkgdatadir = get_option('prefix') / get_option('datadir') / meson.project_name()
|
||||||
|
main = meson.project_name() + '.wrapped'
|
||||||
|
|
||||||
|
custom_target(
|
||||||
|
command: [
|
||||||
|
find_program('ags'),
|
||||||
|
'bundle',
|
||||||
|
'--root', meson.project_source_root(),
|
||||||
|
meson.project_source_root() / 'app.ts',
|
||||||
|
main,
|
||||||
|
],
|
||||||
|
output: main,
|
||||||
|
input: files('app.ts'),
|
||||||
|
install: true,
|
||||||
|
install_dir: pkgdatadir,
|
||||||
|
)
|
||||||
|
|
||||||
|
configure_file(
|
||||||
|
input: files('wrapper.sh'),
|
||||||
|
output: meson.project_name(),
|
||||||
|
configuration: {
|
||||||
|
'MAIN_PROGRAM': pkgdatadir / main,
|
||||||
|
'LAYER_SHELL_LIBDIR': dependency('gtk4-layer-shell-0').get_variable('libdir'),
|
||||||
|
},
|
||||||
|
install: true,
|
||||||
|
install_dir: get_option('prefix') / get_option('bindir'),
|
||||||
|
)
|
2789
config/astal/runner
Executable file
2789
config/astal/runner
Executable file
File diff suppressed because one or more lines are too long
2
config/astal/wrapper.sh
Executable file
2
config/astal/wrapper.sh
Executable file
@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
LD_PRELOAD="@LAYER_SHELL_LIBDIR@/libgtk4-layer-shell.so" @MAIN_PROGRAM@ $@
|
@ -5,17 +5,17 @@
|
|||||||
# ────────────────────────────────────────────────────────────────────
|
# ────────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
source = ./colors.conf
|
source = ./colors.conf
|
||||||
exec-once = ags run ~/projects/active/dotfiles/config/ags/notifications/
|
|
||||||
exec-once = ~/.config/hypr/xdg-portal-hyprland
|
exec-once = ~/.config/hypr/xdg-portal-hyprland
|
||||||
exec-once = dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP XAUTHORITY DISPLAY
|
exec-once = dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP XAUTHORITY DISPLAY
|
||||||
exec-once = systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
|
exec-once = systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
|
||||||
exec-once = /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
|
exec-once = /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
|
||||||
# exec-once = waybar
|
# exec-once = waybar
|
||||||
exec-once = /bin/bash -c "ags run ~/projects/active/dotfiles/config/astal --gtk4"
|
|
||||||
exec-once = hypridle
|
exec-once = hypridle
|
||||||
|
|
||||||
exec-once = nm-applet
|
exec-once = nm-applet
|
||||||
exec-once = nextcloud --background
|
exec-once = nextcloud --background
|
||||||
|
exec = ags run ~/projects/active/dotfiles/config/astal/ --gtk4
|
||||||
|
exec = ags run ~/projects/active/dotfiles/config/ags/notifications/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
exec = hyprctl setcursor oreo_spark_blue_cursors 24
|
exec = hyprctl setcursor oreo_spark_blue_cursors 24
|
||||||
|
10
setup
10
setup
@ -68,6 +68,16 @@ cp -r ./config/wlogout/ ~/.config/
|
|||||||
cp -r ./config/yazi ~/.config/
|
cp -r ./config/yazi ~/.config/
|
||||||
cp -r ./config/zathura ~/.config/
|
cp -r ./config/zathura ~/.config/
|
||||||
|
|
||||||
|
echo "
|
||||||
|
=> Bundling Astal projects
|
||||||
|
"
|
||||||
|
|
||||||
|
cd ./config/astal
|
||||||
|
ags bundle app.ts runner
|
||||||
|
|
||||||
|
cd ../ags/notifications
|
||||||
|
ags bundle app.ts notifier
|
||||||
|
|
||||||
echo "
|
echo "
|
||||||
=> Installing yazi plugins
|
=> Installing yazi plugins
|
||||||
"
|
"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user