Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moving NoteKit closer to similar "GNOME" applications #99

Closed
wants to merge 28 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
3e06e86
Convergence to GNOME HIG
sp1ritCS May 16, 2021
8052f49
HIG: Minor Changes
sp1ritCS May 17, 2021
3b41fe6
Fixed llvm patch
sp1ritCS May 17, 2021
c33cef9
Initial support for "Zen" mode
sp1ritCS May 17, 2021
04fabe2
Added keybind to toggle sidebar
sp1ritCS May 17, 2021
7f95ddb
Added support for custom version string
sp1ritCS May 17, 2021
85f6dff
Merged upstream/master into gnome
sp1ritCS May 17, 2021
4ce2b23
Updated hotkeys
sp1ritCS May 17, 2021
ea91e5b
Initial Glib schema impl
sp1ritCS May 19, 2021
9064f93
Dropped jsoncpp in favour of GSettings
sp1ritCS May 20, 2021
cf8d5d0
Moved from seven static (dddd) colorN setting keys to one a(dddd)
sp1ritCS May 21, 2021
25eac2c
MinGW: updated patch
sp1ritCS May 21, 2021
e29e99e
Updated Preferences, renamed schemafile
sp1ritCS May 21, 2021
212c7c6
Droped string/hash switch statement in favour of settingmap_t
sp1ritCS May 22, 2021
30f9c4c
GSettings now saves the state of the headerbar & zen mode
sp1ritCS May 22, 2021
babac0d
Fixed the fallback close button of the AboutDiag
sp1ritCS May 22, 2021
de39add
Changed color button integer start to 0
sp1ritCS May 22, 2021
52eb837
Fixed bug that the sourceview pen color was not updated if the color …
sp1ritCS May 22, 2021
6f21ad8
Fixed bug with filepicker, added title to preferences
sp1ritCS May 22, 2021
7d3b3af
Moved settingupdate singal near the top, that the default basepath ch…
sp1ritCS May 22, 2021
76bac97
Added gsettings migrate script, improved icon filesize of fullscreen …
sp1ritCS May 22, 2021
a2440ba
Dropped jsoncpp for good
sp1ritCS May 23, 2021
88356b2
fixed windows compile issues
sp1ritCS May 23, 2021
2ce5827
removed postinstall script from homebrew
sp1ritCS May 23, 2021
deef660
droped latest release action in favour of static linking clatexmath w…
sp1ritCS May 25, 2021
02112c4
Merge remote-tracking branch 'origin/master' into gnome
sp1ritCS May 25, 2021
b2a40c5
Backports from sp1rit/global-menu
sp1ritCS May 26, 2021
d21e7a0
xdg-decoration support
sp1ritCS May 26, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 6 additions & 35 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,39 +13,10 @@ jobs:
- ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setting up cLaTeXMath cache 🗂
id: cache-clatexmath
uses: actions/cache@v2
with:
path: ~/cLaTeXMath/
key: ${{ runner.os }}-clatexmath
- name: Downloading dependencies 📥
run: sudo apt-get install build-essential libfontconfig1-dev zlib1g-dev libjsoncpp-dev libgtksourceviewmm-3.0-dev libgtkmm-3.0-dev libtinyxml2-dev python3 python3-pip python3-setuptools
- name: Download the latest version of Meson 🧰
run: |
sudo pip3 install meson ninja
- name: Build cLaTeXMath from cache ✏
id: build-clatexmath_cache
if: steps.cache-clatexmath.outputs.cache-hit == 'true'
run: |
pushd ~/cLaTeXMath/
git pull
meson _build --reconfigure
ninja -C _build
sudo meson install -C _build
popd
- name: Build cLaTeXMath from source 🖋
if: steps.cache-clatexmath.outputs.cache-hit != 'true' || steps.build-clatexmath_cache == 'failure'
run: |
rm -rf ~/cLaTeXMath/
git clone https://github.com/NanoMichael/cLaTexMath ~/cLaTeXMath/
pushd ~/cLaTeXMath/
meson _build
ninja -C _build
sudo meson install -C _build
popd
run: sudo apt-get install build-essential meson libfontconfig1-dev zlib1g-dev libgtksourceviewmm-3.0-dev libgtkmm-3.0-dev libtinyxml2-dev
- name: Configure 🔧
run: meson _build
run: meson _build --default-library static
- name: Compile 🎲
run: ninja -C _build
- name: Compress build artifacts 📦
Expand All @@ -71,7 +42,7 @@ jobs:
dnf install -y gcc-c++ meson
dnf install -y mingw64-filesystem mingw64-gcc-c++
dnf install -y mingw64-winpthreads-static
dnf install -y mingw64-gtkmm30 mingw64-gtksourceviewmm3 mingw64-jsoncpp mingw64-zlib mingw64-fontconfig mingw64-librsvg2
dnf install -y mingw64-gtkmm30 mingw64-gtksourceviewmm3 mingw64-zlib mingw64-fontconfig mingw64-librsvg2
- name: Install cLaTeXMath 🖋
run: |
dnf config-manager --add-repo https://download.opensuse.org/repositories/home:sp1rit:mingw/Fedora_33/home:sp1rit:mingw.repo
Expand All @@ -80,8 +51,8 @@ jobs:
run: patch -p1 < windows.patch
- name: Configure 🔧
run: |
export CFLAGS="-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4 -mwindows" \
LDFLAGS="-fstack-protector -lssp -mwindows -Wl,--subsystem,windows"
export CFLAGS="-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4" \
LDFLAGS="-fstack-protector -lssp"
export CXXFLAGS="$CFLAGS"
meson --prefix=/ --cross-file=/usr/share/mingw/toolchain-mingw64.meson --default-library shared x86_64-w64-mingw32
- name: Compile 🎲
Expand Down Expand Up @@ -114,7 +85,7 @@ jobs:
- name: Download dependencies 📥
run: |
brew install meson ninja pkg-config
brew install fontconfig gtkmm3 gtksourceviewmm3 jsoncpp librsvg sp1ritCS/tap/clatexmath zlib
brew install fontconfig gtkmm3 gtksourceviewmm3 librsvg sp1ritCS/tap/clatexmath zlib
- name: Patch NoteKit 🩹
run: patch -p1 < Apple/llvm.patch
- name: Configure 🔧
Expand Down
36 changes: 0 additions & 36 deletions .github/workflows/latest-release.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/package-deb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: removing gcc10
run: sudo apt remove libgcc-10-dev
- name: setting the dependencies up
run: sudo apt install libfontconfig1-dev zlib1g-dev libjsoncpp-dev libgtksourceviewmm-3.0-dev libgtkmm-3.0-dev libtinyxml2-dev cmake debhelper=12.1.1ubuntu1~ubuntu18.04.1 dpkg-dev
run: sudo apt install libfontconfig1-dev zlib1g-dev libgtksourceviewmm-3.0-dev libgtkmm-3.0-dev libtinyxml2-dev cmake debhelper=12.1.1ubuntu1~ubuntu18.04.1 dpkg-dev
- name: running debhelper
run: dpkg-buildpackage -b -uc
- uses: "marvinpinto/action-automatic-releases@latest"
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
dnf install -y gcc-c++ meson
dnf install -y mingw64-filesystem mingw64-gcc-c++
dnf install -y mingw64-winpthreads-static
dnf install -y mingw64-gtkmm30 mingw64-gtksourceviewmm3 mingw64-jsoncpp mingw64-zlib mingw64-fontconfig mingw64-librsvg2
dnf install -y mingw64-gtkmm30 mingw64-gtksourceviewmm3 mingw64-zlib mingw64-fontconfig mingw64-librsvg2
dnf install -y adwaita-icon-theme gtk-update-icon-cache
- name: Install Rust 🦀
run: |
Expand Down Expand Up @@ -72,6 +72,8 @@ jobs:
cp -r /usr/share/icons/Adwaita/ dist/bin/data/icons/
# generate icon cache for notekit icons
gtk-update-icon-cache dist/bin/data/icons/hicolor/
# recompile gsettings schema cache
glib-compile-schemas dist/bin/share/glib-2.0/schemas/gnome
# add rust uutils coreutils
cp coreutils/target/x86_64-pc-windows-gnu/release/{mkdir,touch,mv,rm}.exe dist/bin/
# add notesbase folder and put README.md into it
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ config.h

# protection against over-aggresive fontconfig
data/fonts/.uuid

# compile gsettings schemas
gnome/gschemas.compiled
20 changes: 13 additions & 7 deletions Apple/llvm.patch
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
From e93560b8fe25d16836230eb78d037f52b577ab5d Mon Sep 17 00:00:00 2001
From 908df6ddfa9dcb9bb8093c91d3759d1bdbec19b2 Mon Sep 17 00:00:00 2001
From: sp1rit <[email protected]>
Date: Tue, 27 Apr 2021 09:31:41 +0200
Date: Sun, 23 May 2021 18:55:26 +0200
Subject: [PATCH] tweaks to llvm clang build

Signed-off-by: sp1rit <[email protected]>
---
main.cpp | 4 ++--
meson.build | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
meson.build | 3 +--
2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/main.cpp b/main.cpp
index 1fc7c32..9f1077c 100644
index 61d25dd..aada02f 100644
--- a/main.cpp
+++ b/main.cpp
@@ -9,8 +9,8 @@ int main (int argc, char *argv[])
Expand All @@ -25,16 +25,22 @@ index 1fc7c32..9f1077c 100644
} );

diff --git a/meson.build b/meson.build
index 5a9f407..e55b597 100644
index 34bba29..a9553f3 100644
--- a/meson.build
+++ b/meson.build
@@ -1,6 +1,6 @@
project('notekit', 'cpp',
version : '0.1',
version : '0.1.0',
- default_options : ['warning_level=3', 'cpp_std=c++14']
+ default_options : ['warning_level=3', 'cpp_std=c++17']
)

conf_data = configuration_data()
@@ -52,4 +52,3 @@ executable('notekit',
install : true
)

-meson.add_install_script('build-aux/postinstall.py')
--
2.31.1

38 changes: 32 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# NoteKit
This program is a structured notetaking application based on GTK+ 3. Write your notes in instantly-formatted Markdown, organise them in a tree of folders that can be instantly navigated from within the program, and add hand-drawn notes by mouse, touchscreen or digitiser.

![Screenshot](/screenshots/notekit-example.png?raw=true)
![Screenshot](/screenshots/notekit.png?raw=true)

We have a [Discord server](https://discord.gg/WVas9aX6Ee) for questions and discussing the project's development.
We have a [Discord server](https://discord.gg/WVas9aX6Ee) and a bridged [Matrix space](https://matrix.to/#/!qrAsPfOWegCOsSGhWc:tchncs.de?via=tchncs.de&via=matrix.org&via=t2bot.io) for questions and discussing the project's development.

## Why?

Expand Down Expand Up @@ -33,15 +33,31 @@ Moreover, there is also

To run the binary, you will in addition require at least the following packages: `libgtkmm-3.0-1v5 libgtksourceviewmm-3.0-0v5 libjsoncpp1 zlib1g libxml2`, where the version of `libgtkmm-3.0-1v5` is at least 3.20. (In particular, this means that Ubuntu 16.04 LTS (xenial) and derived distributions are too old.) If the binary does not work for you, it is recommended that you build from source, as described below.

## How to build
## How to build from source

### Building with meson

Invoke `meson _build` followed by `ninja -C _build` to compile NoteKit. You can then install NoteKit by invoking `meson install -C _build` (If you don't have polkit running, you'll need to execute it as uid 0).

Required dependencies (pkg-config names):

* `gtkmm-3.0`
* `gtksourceview-3.0`
* `zlib`
* `fontconfig`
* `clatexmath`*

\* If clatexmath is not installed, meson will automatically build it too (you'll need the additional `tinyxml2` dependency). If you do not want cLaTeXMath, you can give meson the `-Dclatexmath=false` option.

### Building with cmake

Either invoke `cmake .` followed by `make` (which will build a binary at `cmake-build-Release/output/notekit`), or get [CodeLite](https://codelite.org/), open and build the workspace.

Required libraries:

* `cmake`.
* `libgtkmm-3.0-dev`>=3.20 (UI stuff)
* `libgtksourceviewmm-3.0-dev`>=3.18 (more UI stuff)
* `libjsoncpp-dev` ~ 1.7.4 (config files; older versions may work)
* `zlib1g-dev`
* `libfontconfig1-dev` ~ 2.13 (to use custom fonts)

Expand All @@ -50,6 +66,7 @@ If you want to enable LaTeX math rendering support, you moreover need:
* Set the CMAKE variable `HAVE_CLATEXMATH` to ON.
* Run `install-clatexmath.sh` to clone [cLaTeXMath](https://github.com/NanoMichael/cLaTeXMath) into a subfolder and build it as a static library.
* If you observe linker errors, make sure your `gcc` is sufficiently new.
* `libtinyxml2-dev` >= 7.0.1

For older LaTeX math support using [lasem](https://github.com/GNOME/lasem), you can proceed as follows:

Expand All @@ -59,8 +76,17 @@ For older LaTeX math support using [lasem](https://github.com/GNOME/lasem), you

Development and testing was exclusively conducted on X11-based Linux. The one tested way of building on Windows involves [MSYS2](https://www.msys2.org/)'s mingw-w64 package family (following the `cmake` route outlined above). Since MSYS2's `coreutils` depend on its Cygwin fork, the released Windows binary packages instead include a subset of coreutils from [GnuWin32](http://gnuwin32.sourceforge.net/).

### Development environment with meson

NoteKit provides a virtual environment that sets everything up for you.

If you have bash or zsh (other shells *may* work too, but havn't been tested) you can run `source devel/bin/active` to turn it on. Then you can then simply run `configure _build` followed by `ninja -C _build` (you might also need to regenerate the gsettings cache by running `glib-compile-schemas devel/gnome/`). Running NoteKit should be as easy as executing the `notekit` binary within `_build`.

To deactivate the environment, simply invoke `deactivate`.

## Installation notes
* By default, configuration is saved in `$HOME/.config/notekit`, and notes are in `$HOME/.local/share/notekit`. This may depend on your `$XDG_` environmental variables, and the notes base path can be changed in the `config.json` file in the configuration folder.
* The settings are handled by GSettings. This means NoteKit will store it's preferences in an "OS native" way (dconf on Linux, registry on Windows and plist files on OS X). However if you dont want this, you can set the `GSETTINGS_BACKEND` environment variable to `keyfile`, to store all gsettings in an ini file.
* By default, the notes are stored in `$HOME/.local/share/notekit`. This may depend on your `$XDG_` environmental variables, and the notes base path can be set in the preferences.
* Resources (`data/` and `sourceview/`) are searched in `/notekit/` under `$XDG_DATA_DIRS` (default: `/usr/local/share:/usr/share`), followed by the current working directory `.`. If packaging Notekit or otherwise preparing it for system-wide installation, these two folders should probably be copied into `/usr/share/notekit/data` and `/usr/share/notekit/sourceview` respectively.

## Usage notes
Expand Down Expand Up @@ -88,7 +114,7 @@ Development and testing was exclusively conducted on X11-based Linux. The one te

### Syntax highlighting

![Screenshot](/screenshots/syntax-highlighting.png?raw=true)
![Screenshot](/screenshots/notekit-syntax_highlighting.png?raw=true)

### Misc

Expand Down
16 changes: 16 additions & 0 deletions about.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include "about.h"
#include <config.h>

AboutDiag::AboutDiag() {
set_program_name("NoteKit");
set_logo_icon_name("com.github.blackhole89.notekit");
set_comments("A GTK3 hierarchical markdown notetaking\napplication with tablet support.");
set_version(NK_VERSION);
set_website("https://github.com/blackhole89/notekit");
set_website_label("GitHub: @blackhole89/notekit");
set_copyright("Almighty Archjanitor: Matvey Soloviev");
set_license_type(Gtk::LICENSE_GPL_3_0);

set_authors(contributers);
set_artists(artists);
}
29 changes: 29 additions & 0 deletions about.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include <gtkmm.h>

class AboutDiag : public Gtk::AboutDialog {
public:
AboutDiag();
protected:
/* modified version of
* ```sh
* echo "std::vector<Glib::ustring> contributers {" && \
* git shortlog -sn | awk '{$1 = ""; print "\t\""substr($0, 2)"\"," }' && \
* echo "};"
* ```
* Modifications:
* - Merged my (sp1rit) names into one
*/
std::vector<Glib::ustring> contributers {
"Matvey Soloviev",
"Florian \"sp1rit\"",
"noasakurajin",
"Bilal Elmoussaoui",
"Lyes Saadi",
"proxi",
"大黄老鼠",
};
std::vector<Glib::ustring> artists {
"Thomas Kole",
"James & Orman Clark @ iconic.app http://iconic.app"
};
};
19 changes: 19 additions & 0 deletions build-aux/postinstall.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/python3

from os import environ, path
from subprocess import call

prefix = environ.get('MESON_INSTALL_PREFIX', '/usr/local')
datadir = path.join(prefix, 'share')
destdir = environ.get('DESTDIR', '')

# Package managers set this so we don't need to run
if not destdir:
print('Updating icon cache...')
call(['gtk-update-icon-cache', '-qtf', path.join(datadir, 'icons', 'hicolor')])

print('Updating desktop database...')
call(['update-desktop-database', '-q', path.join(datadir, 'applications')])

print('Compiling GSettings schemas...')
call(['glib-compile-schemas', path.join(datadir, 'glib-2.0', 'schemas')])
1 change: 1 addition & 0 deletions config.h.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// global config

#define NK_VERSION "0.1.0"
#cmakedefine HAVE_LASEM
#cmakedefine HAVE_CLATEXMATH
1 change: 1 addition & 0 deletions config.h.meson.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// global config

#define NK_VERSION "@version@"
#mesondefine HAVE_CLATEXMATH
6 changes: 6 additions & 0 deletions data/icons/hicolor/scalable/emblems/maximize-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions data/icons/hicolor/scalable/emblems/maximize.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions data/icons/hicolor/scalable/emblems/minimize-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions data/icons/hicolor/scalable/emblems/minimize.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading