~zethra/my-website

17bce2122d8789c2506de77d47a75a87cc7d8518 — zethra 10 months ago 858cc69
Some changes, idk

Signed-off-by: zethra <benaagoldberg@gmail.com>
14 files changed, 122 insertions(+), 49 deletions(-)

M .gitignore
M config.toml
A content/_index.md
A content/blog/_index.md
A content/blog/qt+rust.md
A content/blog/test_post.md
D sass/animations.scss
M sass/fonts.scss
M sass/main.scss
A static/.gitkeep
R templates/{page.html => base.html}
A templates/blog_index.html
A templates/blog_post.html
M templates/index.html
M .gitignore => .gitignore +2 -1
@@ 1,1 1,2 @@
/old
\ No newline at end of file
/old
/public
\ No newline at end of file

M config.toml => config.toml +9 -1
@@ 1,5 1,5 @@
# The URL the site will be built for
base_url = "https://bengoldberg.info"
base_url = "https://benaaron.dev"

# Whether to automatically compile all Sass files in the sass directory
compile_sass = true


@@ 11,5 11,13 @@ highlight_code = true
# Whether to build a search index to be used later on by a JavaScript library
build_search_index = false

generate_rss = true
highlight_theme = "dracula"

[slugify]
paths = "on"
taxonomies = "on"
anchors = "on"

[extra]
# Put all your custom variables here

A content/_index.md => content/_index.md +2 -0
@@ 0,0 1,2 @@
+++
+++
\ No newline at end of file

A content/blog/_index.md => content/blog/_index.md +6 -0
@@ 0,0 1,6 @@
+++
template = "blog_index.html"
page_template = "blog_post.html"

sort_by = "date"
+++
\ No newline at end of file

A content/blog/qt+rust.md => content/blog/qt+rust.md +42 -0
@@ 0,0 1,42 @@
+++
title = "Qt and Rust"
date = 2020-01-22
+++

For the past few months I've been working on an [application
launcher](https://git.sr.ht/~zethra/poki-launcher) for Linux.  This has been my
first foray into writing desktop apps for Linux so I didn't have a go to tool
set.  I wanted to use my current hobby language Rust, so I looked into the
existing GUI libraries available on crates.io and looked at existing Rust GUI
apps.

The most popular library of the bunch was [gtk-rs](https://gtk-rs.org/), the
Rust bindings for the GTK toolkit.  I'd never used GTK before so there was a
learning curve, but I got something working.  GTK worked but I found it hard to
use, possible due to my lack of experience with the library, so I decided to try
something else.  Most of the other Rust GUI libraries were very new and
unstable, which is a non-starter for me.

The other major GUI framework used besides GTK is Qt; so I looked into that.
The first Qt library I found for Rust was
[rust-qt-binding-generator](https://github.com/KDE/rust-qt-binding-generator).
With this, I'd write my application logic in Rust, my UI in QML and write a JSON
file to define the objects shared between the two.  With this library I was able
to get my app working but it was far from perfect.  Having to maintain two
definitions of my UI object was a pain and I couldn't access the parts of Qt the
library didn't expose.  The later of which was a problem because I needed a
mechanism to load icons by name from the icon cache, which Qt provided but I
couldn't access.

Enter [qmetaobject-rs](https://github.com/woboq/qmetaobject-rs/).  A library the
exposed, at least part, of the the Qt API using the cpp crate and a lot of
marcos.  This library had a few advantages over rust-qt-binding-generator: It
had a nicer API, I didn't have to maintain a separate definition of my UI object
in JSON, and most importantly to me, I could access the part of the Qt API I
needed even though it wasn't exposed through the library.  This still wasn't
perfect, as I needed to write some C++ code and fork qmetaobject to do what I
needed but I was able to do it.  I plan to try to upstream my changes at some
point but I need to polish them up first.

So if you are interested in writing a desktop app in Rust I recommend checking
out qmetaobject.
\ No newline at end of file

A content/blog/test_post.md => content/blog/test_post.md +6 -0
@@ 0,0 1,6 @@
+++
title = "Test Post"
date = 2020-02-17
+++

Here is some content
\ No newline at end of file

D sass/animations.scss => sass/animations.scss +0 -29
@@ 1,29 0,0 @@
@keyframes flash {
  0% {
    opacity: 1;
  }
  49% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
  100% {
    opacity: 0;
  }
}

@keyframes jump {
  0% {
    transform: translateY(0);
  }
  20% {
    transform: translateY(-0.075em);
  }
  80% {
    transform: translateY(0.025em);
  }
  100% {
    transform: translateY(0);
  }
}

M sass/fonts.scss => sass/fonts.scss +2 -4
@@ 1,4 1,2 @@
@import url("https://fonts.googleapis.com/css?family=Roboto|Roboto+Mono&display=swap");

$font-reg: "'Roboto', sans-serif";
$font-mono: "'Roboto Mono', monospace";
$font-reg: "sans-serif";
$font-mono: "monospace";

M sass/main.scss => sass/main.scss +15 -8
@@ 1,5 1,4 @@
@import "colors";
@import "animations";
@import "fonts";

body {


@@ 8,20 7,28 @@ body {
  color: $fg;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1rem;
}

@mixin animation($param) {
  animation: $param;
  -moz-animation: $param;
  -webkit-animation: $param;
  -o-animation: $param;
a {
  color: $green;
}

.blinky {
  @include animation(flash 0.75s infinite alternate);
a:visited {
  color: $cyan;
}

nav a {
  font-size: 2rem;
  padding-right: 1rem;
}

.date {
  color: #c7c7c7;
  margin: 0.5rem 0;
}

.prompt {

A static/.gitkeep => static/.gitkeep +0 -0
R templates/page.html => templates/base.html +13 -5
@@ 5,15 5,23 @@
    <title>Code is Spooky</title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
    <meta property="og:title" content="Ben Goldberg’s Blog" />
    <meta property="og:locale" content="en_US" />
    <meta property="og:site_name" content="Ben Goldberg’s Blog" />
    <meta name="twitter:card" content="summary" />
    <meta property="twitter:title" content="Ben Goldberg’s Blog" />
    <link rel="stylesheet" href="/main.css" />
    <!-- <link href="https://fonts.googleapis.com/css?family=Roboto|Roboto+Mono|Pacifico&display=swap" rel="stylesheet"> -->
    <link href="https://fonts.googleapis.com/css?family=Pacifico&display=swap" rel="stylesheet">
</head>

{% set index_path = get_url(path="/")%}
{% set blog_path = get_url(path="/blog")%}

<body>
    <main>
        {% block content %} {% endblock content %}
    </main>
    <nav>
        <a href="{{ index_path | safe }}">Home</a>
        <a href="{{ blog_path | safe }}">Blog</a>
    </nav>
    {% block content %} {% endblock content %}
</body>

</html>
\ No newline at end of file

A templates/blog_index.html => templates/blog_index.html +10 -0
@@ 0,0 1,10 @@
{% extends "base.html" %}


{% block content %}

{% set section = get_section(path="blog/_index.md") %}
{% for post in section.pages %}
<h1><a href="{{ post.permalink }}">{{ post.title }}</a></h1>
{% endfor %}
{% endblock content %}
\ No newline at end of file

A templates/blog_post.html => templates/blog_post.html +10 -0
@@ 0,0 1,10 @@
{% extends "base.html" %}


{% block content %}
<h1>{{ page.title }}</h1>
<p class="date">Post published: {{ page.date }}</p>
<article>
    {{ page.content | safe }}
</article>
{% endblock content %}
\ No newline at end of file

M templates/index.html => templates/index.html +5 -1
@@ 1,4 1,4 @@
{% extends "page.html" %}
{% extends "base.html" %}


{% block content %}


@@ 14,4 14,8 @@
    </h1>
</header>

<main>

</main>

{% endblock content %}
\ No newline at end of file