summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAylur <[email protected]>2024-10-15 11:47:26 +0000
committerAylur <[email protected]>2024-10-15 11:47:26 +0000
commitdde50e333a237efb4ddaf522398dedf1a69999d1 (patch)
treecd15cbff14d971ea7dd570520c379156c9761a6e
parentede8890a08b3fbbb1f6df3b8c277ab6424d1befd (diff)
docs: update references flake
-rw-r--r--.gitignore1
-rw-r--r--docs/default.nix135
-rw-r--r--lib/astal/gtk3/src/application.vala9
-rw-r--r--lib/astal/io/application.vala4
4 files changed, 87 insertions, 62 deletions
diff --git a/.gitignore b/.gitignore
index f047207..5459a17 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
build/
result
+result-dev
.cache/
test.sh
tmp/
diff --git a/docs/default.nix b/docs/default.nix
index 3d91a63..5a85fc3 100644
--- a/docs/default.nix
+++ b/docs/default.nix
@@ -7,50 +7,39 @@
toTOML = (pkgs.formats.toml {}).generate;
- genRefForPkg = {
- name,
- pkg,
- version ? "0.1",
- outPath,
- metaData,
- }: let
- data = toTOML name metaData;
- output = self.packages.${pkgs.system}.${pkg}.dev;
- in ''
- mkdir -p $out/${outPath}
- cat ${urlmap} > urlmap.js
- gi-docgen generate -C ${data} ${output}/share/gir-1.0/${name}-${version}.gir
- cp -r ${name}-${version}/* $out/${outPath}
- '';
-
- genLib = name: namespace: {
- description,
+ genLib = {
+ flakepkg,
+ gir,
version,
+ description,
api-ver ? "0.1",
authors ? "Aylur",
dependencies ? {},
- out ? "libastal/${name}",
- }:
- genRefForPkg {
- name = "Astal${namespace}";
- pkg = name;
- outPath = out;
- version = api-ver;
- metaData = {
- library = {
- inherit description authors;
- version = readVer version;
- license = "LGPL-2.1";
- browse_url = "https://github.com/aylur/astal";
- repository_url = "https://github.com/aylur/aylur.git";
- website_url = "https://aylur.github.io/astal";
- dependencies = ["GObject-2.0"] ++ (builtins.attrNames dependencies);
- };
+ out ? "libastal/${flakepkg}",
+ }: let
+ name = "Astal${gir}-${api-ver}";
+ src = self.packages.${pkgs.system}.${flakepkg}.dev;
- extra.urlmap_file = "urlmap.js";
- dependencies = {inherit (dependency) "GObject-2.0";} // dependencies;
+ data = toTOML gir {
+ library = {
+ inherit description authors;
+ version = readVer version;
+ license = "LGPL-2.1";
+ browse_url = "https://github.com/aylur/astal";
+ repository_url = "https://github.com/aylur/aylur.git";
+ website_url = "https://aylur.github.io/astal";
+ dependencies = ["GObject-2.0"] ++ (builtins.attrNames dependencies);
};
+
+ extra.urlmap_file = "urlmap.js";
+ dependencies = {inherit (dependency) "GObject-2.0";} // dependencies;
};
+ in ''
+ mkdir -p $out/${out}
+ cat ${urlmap} > urlmap.js
+ gi-docgen generate -C ${data} ${src}/share/gir-1.0/${name}.gir
+ cp -r ${name}/* $out/${out}
+ '';
dependency = {
"GObject-2.0" = {
@@ -63,6 +52,11 @@
description = "The GTK toolkit";
docs_url = "https://docs.gtk.org/gtk3/";
};
+ "AstalIO-0.1" = {
+ name = "AstalIO";
+ description = "Astal Core library";
+ docs_url = "https://aylur.github.io/libastal/io";
+ };
"NM-1.0" = {
name = "NetworkManager";
description = "The standard Linux network configuration tool suite";
@@ -83,6 +77,7 @@
["Gdk" "https://docs.gtk.org/gdk3/"]
["Gtk" "https://docs.gtk.org/gtk3/"]
["GdkPixbuf" "https://docs.gtk.org/gdk-pixbuf/"]
+ ["AstalIO" "https://aylur.github.io/libastal/io"]
# FIXME: these are not gi-docgen generated, therefore links are broken
["NM" "https://networkmanager.dev/docs/libnm/latest/"]
@@ -91,7 +86,7 @@
'';
in
pkgs.stdenvNoCC.mkDerivation {
- name = "library-reference";
+ name = "reference";
src = ./.;
nativeBuildInputs = with pkgs; [
@@ -105,69 +100,99 @@ in
libdbusmenu-gtk3
wireplumber
networkmanager
+ self.packages.${system}.io
];
installPhase = ''
runHook preInstall
- ${genLib "io" "IO" {
- description = "Astal IO library";
+ ${genLib {
+ flakepkg = "io";
+ gir = "IO";
+ api-ver = "0.1";
+ description = "Astal Core library";
version = ../lib/astal/io/version;
}}
- ${genLib "astal3" "" {
+ ${genLib {
+ flakepkg = "astal3";
+ gir = "";
api-ver = "3.0";
- description = "Astal GTK3 library";
+ description = "Astal GTK3 widget library";
version = ../lib/astal/gtk3/version;
- dependencies = {inherit (dependency) "Gtk-3.0";};
+ dependencies = {inherit (dependency) "AstalIO-0.1" "Gtk-3.0";};
}}
- ${genLib "apps" "Apps" {
+ ${genLib {
+ flakepkg = "apps";
+ gir = "Apps";
description = "Application query library";
version = ../lib/apps/version;
}}
- ${genLib "auth" "Auth" {
+ ${genLib {
+ flakepkg = "auth";
+ gir = "Auth";
authors = "kotontrion";
description = "Authentication using pam";
version = ../lib/auth/version;
}}
- ${genLib "battery" "Battery" {
+ ${genLib {
+ flakepkg = "battery";
+ gir = "Battery";
description = "DBus proxy for upowerd devices";
version = ../lib/battery/version;
}}
- ${genLib "bluetooth" "Bluetooth" {
+ ${genLib {
+ flakepkg = "bluetooth";
+ gir = "Bluetooth";
description = "DBus proxy for bluez";
version = ../lib/bluetooth/version;
}}
- ${genLib "hyprland" "Hyprland" {
+ ${genLib {
+ flakepkg = "hyprland";
+ gir = "Hyprland";
description = "IPC client for Hyprland";
version = ../lib/hyprland/version;
}}
- ${genLib "mpris" "Mpris" {
+ ${genLib {
+ flakepkg = "mpris";
+ gir = "Mpris";
description = "Control mpris players";
version = ../lib/mpris/version;
}}
- ${genLib "network" "Network" {
+ ${genLib {
+ flakepkg = "network";
+ gir = "Network";
description = "NetworkManager wrapper library";
version = ../lib/network/version;
dependencies = {inherit (dependency) "NM-1.0";}; # FIXME: why does this not work?
}}
- ${genLib "notifd" "Notifd" {
+ ${genLib {
+ flakepkg = "notifd";
+ gir = "Notifd";
description = "Notification daemon library";
version = ../lib/notifd/version;
}}
- ${genLib "powerprofiles" "PowerProfiles" {
+ ${genLib {
+ flakepkg = "powerprofiles";
+ gir = "PowerProfiles";
description = "DBus proxy for upowerd profiles";
version = ../lib/powerprofiles/version;
}}
- ${genLib "river" "River" {
+ ${genLib {
+ flakepkg = "river";
+ gir = "River";
description = "IPC client for River";
version = ../lib/river/version;
authors = "kotontrion";
}}
- ${genLib "tray" "Tray" {
+ ${genLib {
+ flakepkg = "tray";
+ gir = "Tray";
description = "StatusNotifierItem implementation";
version = ../lib/tray/version;
authors = "kotontrion";
}}
- ${genLib "wireplumber" "Wp" {
+ ${genLib {
+ flakepkg = "wireplumber";
+ gir = "Wp";
description = "Wrapper library over the wireplumber API";
version = ../lib/wireplumber/version;
authors = "kotontrion";
diff --git a/lib/astal/gtk3/src/application.vala b/lib/astal/gtk3/src/application.vala
index 2255333..1210d88 100644
--- a/lib/astal/gtk3/src/application.vala
+++ b/lib/astal/gtk3/src/application.vala
@@ -4,8 +4,7 @@ public class Astal.Application : Gtk.Application, AstalIO.Application {
private SocketService service;
private DBusConnection conn;
private string _instance_name = "astal";
-
- public string socket_path { get; private set; }
+ private string socket_path { get; private set; }
[DBus (visible=false)]
public signal void monitor_added(Gdk.Monitor monitor);
@@ -45,13 +44,11 @@ public class Astal.Application : Gtk.Application, AstalIO.Application {
get { return get_windows(); }
}
- [DBus (visible=false)]
- public Gtk.Settings settings {
+ private Gtk.Settings settings {
get { return Gtk.Settings.get_default(); }
}
- [DBus (visible=false)]
- public Gdk.Screen screen {
+ private Gdk.Screen screen {
get { return Gdk.Screen.get_default(); }
}
diff --git a/lib/astal/io/application.vala b/lib/astal/io/application.vala
index 60318ed..b32de34 100644
--- a/lib/astal/io/application.vala
+++ b/lib/astal/io/application.vala
@@ -11,7 +11,9 @@ public interface Application : Object {
public abstract string instance_name { owned get; construct set; }
public abstract void acquire_socket() throws Error;
- public abstract void request(string msg, SocketConnection conn) throws Error;
+ public virtual void request(string msg, SocketConnection conn) throws Error {
+ write_sock.begin(conn, @"missing response implementation on $instance_name");
+ }
}
public SocketService acquire_socket(Application app, out string sock) throws Error {