Add floating window logic

Signed-off-by: Vasiliy Doylov <nekocwd@mainlining.org>
This commit is contained in:
Vasiliy Doylov 2025-03-15 17:37:54 +03:00
parent f9442af5ed
commit 2e12fa26c4
Signed by: NekoCWD
GPG key ID: B7BE22D44474A582
21 changed files with 335 additions and 98 deletions

View file

@ -1,5 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<schemalist gettext-domain="pipetap">
<schema id="io.gitlab.nekocwd.pipetap" path="/io/gitlab/nekocwd/pipetap/">
<schema id="io.gitlab.nekocwd.pipetap.adjustments">
<key name='start-x' type='d'>
<default>0</default>
</key>
<key name='start-y' type='d'>
<default>0</default>
</key>
<key name='end-x' type='d'>
<default>0</default>
</key>
<key name='end-y' type='d'>
<default>0</default>
</key>
<key name='orientation' type='b'>
<default>false</default>
</key>
</schema>
</schemalist>
<schema id="io.gitlab.nekocwd.pipetap" path="/io/gitlab/nekocwd/pipetap/">
<child name="main-controls-pos" schema="io.gitlab.nekocwd.pipetap.adjustments"></child>
</schema>
</schemalist>

View file

@ -28,7 +28,9 @@ test(
)
install_data(
'io.gitlab.nekocwd.pipetap.gschema.xml',
[
'io.gitlab.nekocwd.pipetap.gschema.xml',
],
install_dir: get_option('datadir') / 'glib-2.0' / 'schemas',
)

View file

@ -19,6 +19,9 @@
*/
public class PipeTap.Application : Adw.Application {
public Settings settings;
public bool adjust_overlay_visible { get; set; }
public Application () {
Object (
application_id: "io.gitlab.nekocwd.pipetap",
@ -30,15 +33,25 @@ public class PipeTap.Application : Adw.Application {
ActionEntry[] action_entries = {
{ "about", this.on_about_action },
{ "preferences", this.on_preferences_action },
{ "quit", this.quit }
{ "quit", this.quit },
{ "adjust-overlays", () => { adjust_overlay_visible = !adjust_overlay_visible; } }
};
this.add_action_entries (action_entries, this);
this.set_accels_for_action ("app.quit", { "<primary>q" });
settings = new Settings ("io.gitlab.nekocwd.pipetap");
}
public override void activate () {
base.activate ();
var win = this.active_window ?? new PipeTap.Window (this);
var styling = new Gtk.CssProvider ();
styling.load_from_resource ("/io/gitlab/nekocwd/pipetap/style.css");
Gtk.StyleContext.add_provider_for_display (Gdk.Display.get_default (),
styling,
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
var win = this.active_window ?? new PipeTap.Ui.MainBar (this);
var win2 = new PipeTap.Ui.MainBar (this);
win.present ();
}

75
src/gui/main_bar.blp Normal file
View file

@ -0,0 +1,75 @@
using Gtk 4.0;
using Adw 1;
template $PipeTapUiMainBar: $PipeTapUiFloatingWindow {
title: _("PipeTap");
window-name: "main-controls";
default-width: 60;
default-height: 60;
content: Gtk.Box {
orientation: bind template.orientation;
halign: fill;
homogeneous: true;
spacing: 10;
Gtk.Button {
icon-name: "camera-iso-symbolic";
tooltip-text: _("Exposure");
styles [
"flat",
]
}
Gtk.Button {
icon-name: "camera-focus-symbolic";
tooltip-text: _("Focus");
styles [
"flat",
]
}
Gtk.MenuButton {
primary: true;
icon-name: "open-menu-symbolic";
tooltip-text: _("Main Menu");
menu-model: primary_menu;
styles [
"flat",
]
}
};
}
menu primary_menu {
section {
item {
label: _("_Adjust overlays");
action: "app.adjust-overlays";
}
item {
label: _("_Preferences");
action: "app.preferences";
}
/*
item {
label: _("_Keyboard Shortcuts");
action: "win.show-help-overlay";
}
*/
item {
label: _("_About PipeTap");
action: "app.about";
}
item {
label: _("Quit");
action: "app.quit";
}
}
}

6
src/gui/main_bar.vala Normal file
View file

@ -0,0 +1,6 @@
[GtkTemplate (ui = "/io/gitlab/nekocwd/pipetap/gui/main_bar.ui")]
public class PipeTap.Ui.MainBar : PipeTap.Ui.FloatingWindow {
public MainBar (Gtk.Application app) {
base (app);
}
}

50
src/gui/window.blp Normal file
View file

@ -0,0 +1,50 @@
using Gtk 4.0;
using Adw 1;
template $PipeTapUiFloatingWindow: Gtk.Window {
title: _("PipeTap");
default-width: 800;
default-height: 100;
styles [
"pt-transparent",
"osd",
]
Box {
orientation: bind template.orientation;
Button resize {
visible: bind template.resize-visible;
styles [
"flat",
]
}
Adw.Bin content_bin {
valign: fill;
halign: fill;
hexpand: true;
vexpand: true;
}
Button rotate {
visible: bind template.rotate-visible;
icon-name: "angled-arrows-symbolic";
styles [
"flat",
]
}
Button move {
visible: bind template.move-visible;
icon-name: "move-tool-symbolic";
styles [
"flat",
]
}
}
}

121
src/gui/window.vala Normal file
View file

@ -0,0 +1,121 @@
/* window.vala
*
* Copyright 2025 Vasiliy Doylov <nekocwd@mainlining.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
/*
* That's shitcode!!!!
* TODO: Refactor it before first release (or at least somewhen)
*/
[GtkTemplate (ui = "/io/gitlab/nekocwd/pipetap/gui/window.ui")]
public class PipeTap.Ui.FloatingWindow : Gtk.Window, Gtk.Orientable {
[GtkChild]
private unowned Gtk.Button move;
[GtkChild]
private unowned Gtk.Button resize;
[GtkChild]
private unowned Gtk.Button rotate;
[GtkChild]
private unowned Adw.Bin content_bin;
public Gtk.Orientation orientation { get; set; default = Gtk.Orientation.HORIZONTAL; }
public bool resize_visible { get; set; }
public bool rotate_visible { get; set; }
public bool move_visible { get; set; }
public string window_name { get; set; default = ""; }
protected double pos_sy { get; set; }
protected double pos_sx { get; set; }
protected double pos_ex { get; set; }
protected double pos_ey { get; set; }
public Gtk.Widget content { get { return content_bin.get_child (); } set { content_bin.set_child (value); } }
public FloatingWindow (Gtk.Application app) {
Object (application: app);
GtkLayerShell.init_for_window (this);
var move_controller = new Gtk.GestureDrag ();
move_controller.drag_update.connect ((ox, oy) => {
pos_sy += (int) oy;
pos_sx -= (int) ox;
});
move_controller.end.connect (move_controller.reset);
move.add_controller (move_controller);
var resize_controller = new Gtk.GestureDrag ();
resize_controller.drag_update.connect ((ox, oy) => {
pos_ex += (int) ox;
pos_ey += (int) oy;
});
resize_controller.end.connect (resize_controller.reset);
resize.add_controller (resize_controller);
bind_property ("orientation", resize, "icon_name", GLib.BindingFlags.SYNC_CREATE, (binding, src, ref dst) => {
dst.set_string (orientation == Gtk.Orientation.VERTICAL ? "double-ended-arrows-vertical-symbolic" : "double-ended-arrows-horizontal-symbolic");
return true;
});
rotate.clicked.connect (() => {
orientation = orientation == Gtk.Orientation.HORIZONTAL ? Gtk.Orientation.VERTICAL : Gtk.Orientation.HORIZONTAL;
});
var positions = ((PipeTap.Application) app).settings.get_child (window_name + "-pos");
positions.bind_with_mapping ("orientation", this, "orientation", GLib.SettingsBindFlags.DEFAULT,
(value, variant) =>
{ value = variant.get_boolean () ? Gtk.Orientation.VERTICAL : Gtk.Orientation.HORIZONTAL; return true; },
(value) =>
{ return ((Gtk.Orientation) value) == Gtk.Orientation.VERTICAL; },
null, null
);
positions.bind ("start-x", this, "pos-sx", GLib.SettingsBindFlags.DEFAULT);
positions.bind ("start-y", this, "pos-sy", GLib.SettingsBindFlags.DEFAULT);
positions.bind ("end-x", this, "pos-ex", GLib.SettingsBindFlags.DEFAULT);
positions.bind ("end-y", this, "pos-ey", GLib.SettingsBindFlags.DEFAULT);
notify["pos-sx"].connect (set_position);
notify["pos-sy"].connect (set_position);
notify["pos-ex"].connect (set_position);
notify["pos-ey"].connect (set_position);
notify["orientation"].connect (set_position);
set_position ();
app.bind_property ("adjust-overlay-visible", this, "move-visible", GLib.BindingFlags.SYNC_CREATE);
app.bind_property ("adjust-overlay-visible", this, "resize-visible", GLib.BindingFlags.SYNC_CREATE);
app.bind_property ("adjust-overlay-visible", this, "rotate-visible", GLib.BindingFlags.SYNC_CREATE);
}
void set_position () {
var vertical = orientation == Gtk.Orientation.VERTICAL;
GtkLayerShell.set_anchor (this, GtkLayerShell.Edge.TOP, true);
GtkLayerShell.set_anchor (this, GtkLayerShell.Edge.BOTTOM, vertical);
GtkLayerShell.set_anchor (this, GtkLayerShell.Edge.RIGHT, true);
GtkLayerShell.set_anchor (this, GtkLayerShell.Edge.LEFT, !vertical);
var y = pos_sy;
if (vertical)
y = pos_ey + pos_sy;
GtkLayerShell.set_margin (this, GtkLayerShell.Edge.TOP, int.max ((int) y, 0));
GtkLayerShell.set_margin (this, GtkLayerShell.Edge.RIGHT, int.max ((int) pos_sx, 0));
GtkLayerShell.set_margin (this, GtkLayerShell.Edge.LEFT, int.max ((int) (pos_ex - pos_sx), 0));
GtkLayerShell.set_margin (this, GtkLayerShell.Edge.BOTTOM, int.max ((int) (-pos_sy), 0));
}
}

View file

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" height="16px" viewBox="0 0 16 16" width="16px"><path d="m 6.976562 -0.0195312 c -0.796874 0.0078124 -1.59375 0.3125002 -2.199218 0.9101562 l -2.777344 2.707031 v -0.597656 c 0 -0.554688 -0.445312 -1 -1 -1 c -0.550781 0 -1 0.445312 -1 1 v 3 c 0.00390625 0.550781 0.449219 1 1 1 h 3 c 0.554688 0 1 -0.449219 1 -1 c 0 -0.554688 -0.445312 -1 -1 -1 h -0.574219 l 2.757813 -2.707031 c 0.363281 -0.359375 1.242187 -0.371094 1.597656 -0.019531 l 5.519531 5.4375 c 0.394531 0.386718 1.027344 0.382812 1.414063 -0.011719 c 0.386718 -0.390625 0.382812 -1.027344 -0.011719 -1.414063 l -5.515625 -5.414062 c -0.613281 -0.601563 -1.414062 -0.8906252 -2.210938 -0.8906252 z m -4.824218 8.0312502 c -0.316406 -0.046875 -0.636719 0.058593 -0.863282 0.285156 c -0.386718 0.394531 -0.382812 1.027344 0.011719 1.414063 l 5.480469 5.378906 c 0.621094 0.609375 1.441406 0.875 2.246094 0.882812 c 0.800781 0.007813 1.636718 -0.246094 2.265625 -0.871094 l 2.707031 -2.6875 v 0.585938 c 0 0.550781 0.449219 1 1 1 c 0.554688 0 1 -0.449219 1 -1 v -3 c 0 -0.554688 -0.445312 -1 -1 -1 h -3 c -0.550781 0 -1 0.445312 -1 1 c 0 0.550781 0.449219 1 1 1 h 0.589844 l -2.714844 2.710938 c -0.15625 0.15625 -0.476562 0.285156 -0.828125 0.28125 c -0.355469 0 -0.695313 -0.140626 -0.863281 -0.308594 l -5.480469 -5.394532 c -0.148437 -0.148437 -0.34375 -0.246093 -0.550781 -0.277343 z m 0 0" fill="#2e3436"/></svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" height="16px" viewBox="0 0 16 16" width="16px"><g fill="#222222"><path d="m 8 5 c -1.644531 0 -3 1.355469 -3 3 s 1.355469 3 3 3 s 3 -1.355469 3 -3 s -1.355469 -3 -3 -3 z m 0 2 c 0.5625 0 1 0.4375 1 1 s -0.4375 1 -1 1 s -1 -0.4375 -1 -1 s 0.4375 -1 1 -1 z m 0 0"/><path d="m 3 1 s -0.457031 -0.015625 -0.949219 0.230469 c -0.488281 0.246093 -1.050781 0.9375 -1.050781 1.769531 v 3 h 2 v -3 h 3 v -2 z m 0 0"/><path d="m 10 1 v 2 h 3 v 3 h 2 v -3 c 0 -0.832031 -0.5625 -1.523438 -1.050781 -1.769531 c -0.492188 -0.246094 -0.949219 -0.230469 -0.949219 -0.230469 z m 0 0"/><path d="m 1 10 v 3 c 0 0.832031 0.5625 1.523438 1.050781 1.769531 c 0.492188 0.246094 0.949219 0.230469 0.949219 0.230469 h 3 v -2 h -3 v -3 z m 0 0"/><path d="m 13 10 v 3 h -3 v 2 h 3 s 0.457031 0.015625 0.949219 -0.230469 c 0.488281 -0.246093 1.050781 -0.9375 1.050781 -1.769531 v -3 z m 0 0"/></g></svg>

After

Width:  |  Height:  |  Size: 956 B

View file

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" height="16px" viewBox="0 0 16 16" width="16px"><path d="m 2.5 0 c -1.367188 0 -2.5 1.132812 -2.5 2.5 v 11 c 0 1.367188 1.132812 2.5 2.5 2.5 h 11 c 1.367188 0 2.5 -1.132812 2.5 -2.5 v -11 c 0 -1.367188 -1.132812 -2.5 -2.5 -2.5 z m 1.5 2 h 2 v 2 h 2 v 2 h -2 v 2 h -2 v -2 h -2 v -2 h 2 z m 9.859375 0.136719 c 0.089844 0.089843 0.140625 0.214843 0.140625 0.363281 v 11 c 0 0.292969 -0.207031 0.5 -0.5 0.5 h -11 c -0.148438 0 -0.273438 -0.050781 -0.359375 -0.136719 z m -5.859375 7.863281 v 2 h 5 v -2 z m 0 0" fill="#222222"/></svg>

After

Width:  |  Height:  |  Size: 611 B

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg height="16px" viewBox="0 0 16 16" width="16px" xmlns="http://www.w3.org/2000/svg">
<g fill="#2e3434">
<path d="m 6.5 0 c -0.265625 0 -0.519531 0.105469 -0.707031 0.292969 l -1.707031 1.707031 h -1.085938 c -1.644531 0 -3 1.355469 -3 3 v 7 c 0 1.644531 1.355469 3 3 3 h 10 c 1.644531 0 3 -1.355469 3 -3 v -7 c 0 -1.644531 -1.355469 -3 -3 -3 h -1.085938 l -1.707031 -1.707031 c -0.1875 -0.1875 -0.441406 -0.292969 -0.707031 -0.292969 z m 0.414062 2 h 2.171876 l 1.707031 1.707031 c 0.1875 0.1875 0.441406 0.292969 0.707031 0.292969 h 1.5 c 0.570312 0 1 0.429688 1 1 v 7 c 0 0.570312 -0.429688 1 -1 1 h -10 c -0.570312 0 -1 -0.429688 -1 -1 v -7 c 0 -0.570312 0.429688 -1 1 -1 h 1.5 c 0.265625 0 0.519531 -0.105469 0.707031 -0.292969 z m 0 0"/>
<path d="m 8 4 c -2.199219 0 -4 1.800781 -4 4 s 1.800781 4 4 4 s 4 -1.800781 4 -4 s -1.800781 -4 -4 -4 z m 0 2 c 1.117188 0 2 0.882812 2 2 s -0.882812 2 -2 2 s -2 -0.882812 -2 -2 s 0.882812 -2 2 -2 z m 0 0"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1 KiB

View file

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" height="16px" viewBox="0 0 16 16" width="16px"><path d="m 3.988281 4 c -0.265625 0.003906 -0.519531 0.113281 -0.703125 0.300781 l -2.917968 3 c -0.3789068 0.390625 -0.3789068 1.007813 0 1.398438 l 2.917968 3 c 0.382813 0.394531 1.015625 0.402343 1.414063 0.015625 c 0.394531 -0.382813 0.402343 -1.015625 0.019531 -1.414063 l -1.269531 -1.300781 h 9.183593 l -1.265624 1.300781 c -0.386719 0.398438 -0.378907 1.03125 0.019531 1.417969 c 0.394531 0.382812 1.027343 0.375 1.414062 -0.019531 l 2.917969 -3 c 0.375 -0.390625 0.375 -1.007813 0 -1.394531 l -2.917969 -3 c -0.1875 -0.191407 -0.441406 -0.300782 -0.703125 -0.300782 c -0.265625 -0.007812 -0.523437 0.09375 -0.710937 0.28125 c -0.398438 0.382813 -0.40625 1.015625 -0.019531 1.414063 l 1.265624 1.300781 h -9.183593 l 1.269531 -1.300781 c 0.382812 -0.398438 0.375 -1.03125 -0.019531 -1.417969 c -0.191407 -0.183594 -0.449219 -0.285156 -0.710938 -0.28125 z m 0 0" fill="#222222" fill-rule="evenodd"/></svg>

After

Width:  |  Height:  |  Size: 1 KiB

View file

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" height="16px" viewBox="0 0 16 16" width="16px"><path d="m 12 3.984375 c -0.003906 -0.261719 -0.113281 -0.515625 -0.300781 -0.703125 l -3 -2.917969 c -0.390625 -0.3749998 -1.007813 -0.3749998 -1.394531 0 l -3 2.917969 c -0.398438 0.386719 -0.40625 1.019531 -0.019532 1.414062 c 0.382813 0.398438 1.015625 0.40625 1.414063 0.019532 l 1.300781 -1.265625 v 9.183593 l -1.300781 -1.269531 c -0.398438 -0.382812 -1.03125 -0.375 -1.414063 0.019531 c -0.386718 0.398438 -0.378906 1.03125 0.019532 1.414063 l 3 2.917969 c 0.386718 0.378906 1.003906 0.378906 1.394531 0 l 3 -2.917969 c 0.1875 -0.183594 0.296875 -0.4375 0.300781 -0.703125 c 0.003906 -0.261719 -0.097656 -0.519531 -0.28125 -0.710938 c -0.386719 -0.394531 -1.019531 -0.402343 -1.414062 -0.019531 l -1.304688 1.269531 v -9.183593 l 1.304688 1.265625 c 0.394531 0.386718 1.027343 0.378906 1.414062 -0.019532 c 0.183594 -0.1875 0.285156 -0.445312 0.28125 -0.710937 z m 0 0" fill="#222222" fill-rule="evenodd"/></svg>

After

Width:  |  Height:  |  Size: 1 KiB

View file

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" height="16px" viewBox="0 0 16 16" width="16px"><path d="m 10.292969 1.292969 l -6 6 c -0.390625 0.390625 -0.390625 1.023437 0 1.414062 l 6 6 c 0.390625 0.390625 1.023437 0.390625 1.414062 0 s 0.390625 -1.023437 0 -1.414062 l -5.292969 -5.292969 l 5.292969 -5.292969 c 0.390625 -0.390625 0.390625 -1.023437 0 -1.414062 s -1.023437 -0.390625 -1.414062 0 z m 0 0" fill="#222222" fill-rule="evenodd"/></svg>

After

Width:  |  Height:  |  Size: 483 B

View file

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" height="15.980469px" viewBox="0 0 16 15.980469" width="16px"><path d="m 8.019531 -0.0195312 l -3.019531 3.0156252 h 2.03125 v 4.019531 c -1.34375 -0.011719 -2.6875 -0.019531 -4.03125 -0.027344 v -1.996093 l -3 2.976562 l 3 3.019531 v -2.007812 c 1.34375 0.003906 2.6875 0.007812 4.03125 0.011719 v 3.992187 h -2.03125 l 3.019531 2.996094 l 2.980469 -2.996094 h -2 v -3.992187 c 1.332031 0.003906 2.667969 0 4 -0.007813 v 2 l 3 -3.019531 l -3 -2.972656 v 2.007812 c -1.332031 0.023438 -2.667969 0.03125 -4 0.027344 v -4.03125 h 2 z m 0 0" fill="#222222"/></svg>

After

Width:  |  Height:  |  Size: 640 B

View file

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" height="16px" viewBox="0 0 16 16" width="16px"><path d="m 5.707031 1.292969 l 6 6 c 0.390625 0.390625 0.390625 1.023437 0 1.414062 l -6 6 c -0.390625 0.390625 -1.023437 0.390625 -1.414062 0 s -0.390625 -1.023437 0 -1.414062 l 5.292969 -5.292969 l -5.292969 -5.292969 c -0.390625 -0.390625 -0.390625 -1.023437 0 -1.414062 s 1.023437 -0.390625 1.414062 0 z m 0 0" fill="#222222" fill-rule="evenodd"/></svg>

After

Width:  |  Height:  |  Size: 484 B

View file

@ -1,7 +1,8 @@
pipetap_sources = [
'main.vala',
'application.vala',
'window.vala',
'gui/window.vala',
'gui/main_bar.vala',
]
pipetap_deps = [
@ -15,7 +16,8 @@ blueprints = custom_target(
'blueprints',
input: files(
'gtk/help-overlay.blp',
'window.blp',
'gui/main_bar.blp',
'gui/window.blp',
),
output: '.',
command: [

View file

@ -1,7 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/io/gitlab/nekocwd/pipetap">
<file preprocess="xml-stripblanks">window.ui</file>
<file preprocess="xml-stripblanks">gui/window.ui</file>
<file preprocess="xml-stripblanks">gui/main_bar.ui</file>
<file preprocess="xml-stripblanks">gtk/help-overlay.ui</file>
<file>style.css</file>
</gresource>
</gresources>
<gresource prefix="/io/gitlab/nekocwd/pipetap/icons/scalable/actions/">
<file preprocess="xml-stripblanks" alias="right-large-symbolic.svg">icons/right-large-symbolic.svg</file>
<file preprocess="xml-stripblanks" alias="left-large-symbolic.svg">icons/left-large-symbolic.svg</file>
<file preprocess="xml-stripblanks" alias="camera-photo-symbolic.svg">icons/camera-photo-symbolic.svg</file>
<file preprocess="xml-stripblanks" alias="move-tool-symbolic.svg">icons/move-tool-symbolic.svg</file>
<file preprocess="xml-stripblanks" alias="double-ended-arrows-horizontal-symbolic.svg">icons/double-ended-arrows-horizontal-symbolic.svg</file>
<file preprocess="xml-stripblanks" alias="double-ended-arrows-vertical-symbolic.svg">icons/double-ended-arrows-vertical-symbolic.svg</file>
<file preprocess="xml-stripblanks" alias="camera-iso-symbolic.svg">icons/camera-iso-symbolic.svg</file>
<file preprocess="xml-stripblanks" alias="camera-focus-symbolic.svg">icons/camera-focus-symbolic.svg</file>
<file preprocess="xml-stripblanks" alias="angled-arrows-symbolic.svg">icons/angled-arrows-symbolic.svg</file>
</gresource>
</gresources>

3
src/style.css Normal file
View file

@ -0,0 +1,3 @@
.pt-transparent {
border-radius: 10px;
}

View file

@ -1,48 +0,0 @@
using Gtk 4.0;
using Adw 1;
template $PipeTapWindow: Adw.ApplicationWindow {
title: _("PipeTap");
default-width: 800;
default-height: 600;
content: Adw.ToolbarView {
[top]
Adw.HeaderBar {
[end]
MenuButton {
primary: true;
icon-name: "open-menu-symbolic";
tooltip-text: _("Main Menu");
menu-model: primary_menu;
}
}
content: Label label {
label: _("Hello, World!");
styles [
"title-1",
]
};
};
}
menu primary_menu {
section {
item {
label: _("_Preferences");
action: "app.preferences";
}
item {
label: _("_Keyboard Shortcuts");
action: "win.show-help-overlay";
}
item {
label: _("_About PipeTap");
action: "app.about";
}
}
}

View file

@ -1,41 +0,0 @@
/* window.vala
*
* Copyright 2025 Vasiliy Doylov <nekocwd@mainlining.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
[GtkTemplate(ui = "/io/gitlab/nekocwd/pipetap/window.ui")]
public class PipeTap.Window : Adw.ApplicationWindow {
[GtkChild]
private unowned Gtk.Label label;
public Window(Gtk.Application app) {
Object(application: app);
GtkLayerShell.init_for_window(this);
set_position();
}
void set_position() {
GtkLayerShell.set_anchor(this, GtkLayerShell.Edge.BOTTOM, true);
GtkLayerShell.set_anchor(this, GtkLayerShell.Edge.BOTTOM, true);
GtkLayerShell.set_anchor(this, GtkLayerShell.Edge.LEFT, true);
GtkLayerShell.set_margin(this, GtkLayerShell.Edge.TOP, 100);
GtkLayerShell.set_margin(this, GtkLayerShell.Edge.BOTTOM, 100);
GtkLayerShell.set_margin(this, GtkLayerShell.Edge.LEFT, 100);
}
}