Skip to content

Commit 50856ab

Browse files
committed
chore: 🎉 init commit
0 parents  commit 50856ab

10 files changed

+999
-0
lines changed

.gitignore

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Generated by Cargo
2+
# will have compiled files and executables
3+
debug/
4+
target/
5+
6+
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
7+
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
8+
Cargo.lock
9+
10+
# These are backup files generated by rustfmt
11+
**/*.rs.bk
12+
13+
# MSVC Windows builds of rustc generate these, which store debugging information
14+
*.pdb
15+
16+
17+
# Added by cargo
18+
19+
/target

Cargo.toml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[package]
2+
name = "tangent"
3+
version = "0.1.0"
4+
edition = "2021"
5+
license = "GPL-3.0"
6+
readme = "README.md"
7+
repository = "https://github.com/mollersuite/tangent"
8+
9+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
10+
11+
[dependencies]
12+
webkit6 = "0.1.0"
13+
relm4 = {version = "0.6.0", features = ["libadwaita"]}
14+
relm4-components = "0.6.0"
15+
adw = { package = "libadwaita", version = "0.4", features = ["v1_3", "gtk_v4_10"] }

LICENSE

+674
Large diffs are not rendered by default.

README.md

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<div align="center">
2+
<h1>Tangent from Etcetera</h1>
3+
4+
Go on tangents.
5+
6+
[screenshot here]
7+
8+
`nix run github:mollersuite/tangent`
9+
</div>
10+
11+
<div align="right">
12+
<a href="https://jack.cab">
13+
—Jack, founder of Etcetera
14+
</a>
15+
</div>

docs/Screenshot_20230621_151237.png

41.4 KB
Loading

docs/index.html

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<meta name="color-scheme" content="dark light">
7+
<title>This is Tangent</title>
8+
</head>
9+
<body>
10+
<h1>
11+
Go on tangents.
12+
</h1>
13+
<p>
14+
After three years of research, we're proud to introduce the only browser built for rabbit holes.
15+
Tangent features tree-style tabs, <strong>many-worlds time travel</strong>, and other features designed for you to make sense of your tabs.
16+
We built Tangent in Relm4 and WebKitGTK making it among the lightest browsers for Linux.
17+
</p>
18+
</body>
19+
</html>

flake.lock

+82
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
inputs = {
3+
flake-utils.url = "github:numtide/flake-utils";
4+
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
5+
naersk.url = "github:nix-community/naersk";
6+
naersk.inputs.nixpkgs.follows = "nixpkgs";
7+
};
8+
9+
outputs = { self, flake-utils, naersk, nixpkgs}:
10+
flake-utils.lib.eachDefaultSystem (system:
11+
let
12+
pkgs = (import nixpkgs) {
13+
inherit system;
14+
};
15+
16+
naersk' = pkgs.callPackage naersk { };
17+
18+
in
19+
{
20+
# For `nix build` & `nix run`:
21+
defaultPackage = naersk'.buildPackage {
22+
src = ./.;
23+
nativeBuildInputs = [ pkgs.pkg-config ];
24+
buildInputs = [
25+
pkgs.webkitgtk_6_0
26+
pkgs.gtk4
27+
pkgs.libadwaita
28+
pkgs.glib-networking
29+
];
30+
};
31+
32+
# For `nix develop`:
33+
devShell = pkgs.mkShell {
34+
nativeBuildInputs = [
35+
pkgs.rustc
36+
pkgs.cargo
37+
pkgs.pkg-config
38+
pkgs.rust-analyzer
39+
pkgs.rustfmt
40+
pkgs.webkitgtk_6_0
41+
pkgs.gtk4
42+
pkgs.libadwaita
43+
];
44+
RUST_SRC_PATH = pkgs.rustPlatform.rustLibSrc;
45+
};
46+
}
47+
);
48+
}

image.png

15.9 KB
Loading

src/main.rs

+127
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
use adw::prelude::*;
2+
use gtk::prelude::*;
3+
use relm4::prelude::*;
4+
use relm4::{
5+
binding::{ConnectBindingExt, StringBinding},
6+
gtk, ComponentParts, ComponentSender, RelmApp, RelmWidgetExt, SimpleComponent,
7+
};
8+
use webkit6::{traits::*, WebView};
9+
10+
struct AppModel {}
11+
12+
#[derive(Debug)]
13+
enum AppMsg {
14+
Go,
15+
About,
16+
}
17+
18+
#[relm4::component]
19+
impl SimpleComponent for AppModel {
20+
type Init = (); // These would be the props but this is the entry point
21+
22+
type Input = AppMsg;
23+
type Output = ();
24+
25+
view! {
26+
adw::ApplicationWindow {
27+
set_title: Some("Tangent"),
28+
set_default_width: 300,
29+
set_default_height: 100,
30+
adw::Leaflet {
31+
gtk::Box {
32+
set_orientation: gtk::Orientation::Horizontal,
33+
gtk::Box {
34+
set_valign: gtk::Align::Start,
35+
set_vexpand: true,
36+
set_orientation: gtk::Orientation::Vertical,
37+
inline_css: "max-width: 200px",
38+
gtk::Button {
39+
adw::ButtonContent {
40+
set_label: "About",
41+
set_icon_name: "help-about-symbolic"
42+
},
43+
connect_clicked => AppMsg::About,
44+
},
45+
adw::EntryRow {
46+
set_title: "URL"
47+
},
48+
gtk::Box {
49+
set_valign: gtk::Align::Start,
50+
set_vexpand: true,
51+
set_orientation: gtk::Orientation::Vertical,
52+
set_spacing: 10,
53+
set_margin_all: 10,
54+
gtk::Button {
55+
set_label: "Introducing Tangent - Etcetera",
56+
},
57+
gtk::Button {
58+
inline_css: "margin-left: 1ch;",
59+
set_label: "The WWWorst App Store - GNU Project - Free Software Foundation",
60+
add_css_class: "link-button"
61+
}
62+
}
63+
},
64+
65+
WebView {
66+
// set_editable: true,
67+
set_valign: gtk::Align::Fill,
68+
set_vexpand: true,
69+
set_halign: gtk::Align::Fill,
70+
set_hexpand: true,
71+
load_uri: "http://127.0.0.1:3000/"
72+
}
73+
}
74+
}
75+
}
76+
}
77+
78+
// Initialize the UI.
79+
fn init(
80+
init: Self::Init,
81+
root: &Self::Root,
82+
sender: ComponentSender<Self>,
83+
) -> ComponentParts<Self> {
84+
let model = AppModel {};
85+
86+
// Insert the macro code generation here
87+
let widgets = view_output!();
88+
89+
ComponentParts { model, widgets }
90+
}
91+
92+
fn update(&mut self, msg: Self::Input, _sender: ComponentSender<Self>) {
93+
match msg {
94+
AppMsg::Go => {
95+
println!("Go!");
96+
}
97+
AppMsg::About => {
98+
let dialog = adw::AboutWindow::builder()
99+
// .transient_for(&self.widgets.root)
100+
.modal(true)
101+
.application_name("Tangent")
102+
.comments("Go on tangents. The only browser built for rabbit holes.")
103+
.developer_name("Etcetera")
104+
.developers(["Jack W. https://jack.cab"])
105+
.designers([
106+
"Jack W. https://jack.cab",
107+
"Jack H. https://hunktwink123.webflow.io",
108+
])
109+
.license_type(gtk::License::Gpl30)
110+
.version(option_env!("CARGO_PKG_VERSION").unwrap_or("unknown"))
111+
.issue_url("https://github.com/mollersuite/tangent/issues")
112+
.website("https://github.com/mollersuite/tangent") // for now
113+
.build();
114+
dialog.add_acknowledgement_section(
115+
None,
116+
&["Molly the Beagle, 2009-2022 🕊️ https://mola.pages.dev"],
117+
);
118+
dialog.present()
119+
}
120+
}
121+
}
122+
}
123+
124+
fn main() {
125+
let app = RelmApp::new("uk.cetera.Tangent");
126+
app.run::<AppModel>(());
127+
}

0 commit comments

Comments
 (0)