Add the main functions

This commit is contained in:
Conzer 2024-12-02 13:52:27 -05:00
parent 0d8c53af76
commit 5e96d42fe8
3 changed files with 57 additions and 1 deletions

View file

@ -3,4 +3,12 @@
Desktop gadgets for Linux!
# Building
Looker can be built using vala.
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`

3
build.sh Executable file
View file

@ -0,0 +1,3 @@
# Building Looker
valac --pkg gtk4 /src/main.vala

45
src/main.vala Normal file
View file

@ -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);
}
}