From 5e96d42fe8849bc13a1e5f2eed2b41a460bb3988 Mon Sep 17 00:00:00 2001 From: Conzer Date: Mon, 2 Dec 2024 13:52:27 -0500 Subject: [PATCH] Add the main functions --- README.md | 10 +++++++++- build.sh | 3 +++ src/main.vala | 45 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 57 insertions(+), 1 deletion(-) create mode 100755 build.sh create mode 100644 src/main.vala diff --git a/README.md b/README.md index 7588891..2c5ec9c 100644 --- a/README.md +++ b/README.md @@ -3,4 +3,12 @@ Desktop gadgets for Linux! # Building -Looker can be built using vala. \ No newline at end of file +Looker can be built using vala. +On an elementary OS system (the only officially supported by me platform) +## Installing dependencies +`sudo apt install elementary-sdk` +## Using Valac directly +`valac --pkg gtk4 /src/main.vala` +## Using build sh +`chmod +x build.sh` +`./build.sh` diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..8f7c962 --- /dev/null +++ b/build.sh @@ -0,0 +1,3 @@ +# Building Looker + +valac --pkg gtk4 /src/main.vala \ No newline at end of file diff --git a/src/main.vala b/src/main.vala new file mode 100644 index 0000000..5d93c45 --- /dev/null +++ b/src/main.vala @@ -0,0 +1,45 @@ +using Gtk; +using Gdk; + +public class LookerControl : Application { + private Overlay overlay; + private Button add_gadget_button; + + public LookerControl() { + Object(application_id: "app.hackclub.conzie.LookerControl", + flags: ApplicationFlags.FLAGS_NONE); + } + + protected override void activate() { + var window = new ApplicationWindow(this); + window.set_decorated(false); + window.fullscreen(); + window.set_app_paintable(true); + window.override_background_color(StateFlags.NORMAL, new RGBA(0, 0, 0, 0.5)); + + overlay = new Overlay(); + + add_gadget_button = new Button.from_icon_name("list-add", IconSize.LARGE); + add_gadget_button.halign = Align.END; + add_gadget_button.valign = Align.END; + add_gadget_button.margin_end = 20; + add_gadget_button.margin_bottom = 20; + add_gadget_button.clicked.connect(() => add_clock_gadget()); + + overlay.add_overlay(add_gadget_button); + window.add(overlay); + + window.show_all; + } + + private void add_clock_gadget() { + var clock_gadget = new DraggableClock(); + overlay.add(clock_gadget); + window.show_all; + } + + public static int main(string[] args) { + var app = new LookerControl(); + return app.run(args); + } +} \ No newline at end of file