Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 9 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
APP_NAME := graptos
APP_ID := io.github.graptos.Editor
VERSION := 0.23.68
VERSION := 0.23.73
PREFIX ?= /usr/local
CC ?= cc
BUILD_DIR := build
Expand Down Expand Up @@ -44,6 +44,7 @@ SOURCES := \
$(SRC_DIR)/project_init.c \
$(SRC_DIR)/project_init_ui.c \
$(SRC_DIR)/project_search.c \
$(SRC_DIR)/plugin.c \
$(SRC_DIR)/git.c \
$(SRC_DIR)/codex_protocol.c \
$(SRC_DIR)/codex_client.c \
Expand Down Expand Up @@ -89,7 +90,7 @@ else
$(error GtkSourceView 5 is required but not detected. Install gtksourceview-5 development files.)
endif

GTK_PKG := gtk4 gtksourceview-5 json-glib-1.0 vte-2.91-gtk4
GTK_PKG := gtk4 gtksourceview-5 json-glib-1.0 vte-2.91-gtk4 gmodule-2.0
GTK_CFLAGS := $(shell $(PKG_CONFIG) --cflags $(GTK_PKG))
GTK_SYSTEM_CFLAGS := $(foreach flag,$(GTK_CFLAGS),$(if $(filter -I%,$(flag)),-isystem $(patsubst -I%,%,$(flag)),$(flag)))
GTK_LIBS := $(shell $(PKG_CONFIG) --libs $(GTK_PKG))
Expand Down Expand Up @@ -129,8 +130,8 @@ check: $(VERSION_HEADER)
test: $(BUILD_DIR)/unit_tests
$<

$(BUILD_DIR)/unit_tests: $(TEST_DIR)/unit_tests.c $(SRC_DIR)/codex_protocol.c $(SRC_DIR)/syntax_diagnostics.c $(SRC_DIR)/project_init.c $(SRC_DIR)/formatter.c $(SRC_DIR)/formatter_lexer.c $(SRC_DIR)/formatter_layout.c $(SRC_DIR)/formatter_spacing.c $(SRC_DIR)/formatter_scope.c $(SRC_DIR)/syntax.c $(SRC_DIR)/editor_notes.c | $(BUILD_DIR)
$(CC) $(CPPFLAGS) $(CFLAGS) $(WARNINGS) $(GTK_SYSTEM_CFLAGS) -std=c11 $^ $(GTK_LIBS) -o $@
$(BUILD_DIR)/unit_tests: $(TEST_DIR)/unit_tests.c $(SRC_DIR)/codex_protocol.c $(SRC_DIR)/syntax_diagnostics.c $(SRC_DIR)/project_init.c $(SRC_DIR)/formatter.c $(SRC_DIR)/formatter_lexer.c $(SRC_DIR)/formatter_layout.c $(SRC_DIR)/formatter_spacing.c $(SRC_DIR)/formatter_scope.c $(SRC_DIR)/syntax.c $(SRC_DIR)/editor_notes.c $(SRC_DIR)/plugin.c | $(BUILD_DIR)
$(CC) $(CPPFLAGS) -DGRAPTOS_PLUGIN_NO_UI $(CFLAGS) $(WARNINGS) $(GTK_SYSTEM_CFLAGS) -std=c11 $^ $(GTK_LIBS) -o $@

smoke-test: $(BUILD_DIR)/smoke_window
$<
Expand Down Expand Up @@ -160,6 +161,10 @@ install: $(BUILD_DIR)/$(APP_NAME)
cp -R data/fonts/Inconsolata/. $(DESTDIR)$(DATADIR)/fonts/Inconsolata/
install -d $(DESTDIR)$(DATADIR)/project-templates
cp -R data/project-templates/. $(DESTDIR)$(DATADIR)/project-templates/
@if [ -d data/plugins ]; then \
install -d $(DESTDIR)$(DATADIR)/plugins; \
cp -R data/plugins/. $(DESTDIR)$(DATADIR)/plugins/; \
fi
install -Dm644 data/$(APP_ID).desktop $(DESTDIR)$(PREFIX)/share/applications/$(APP_ID).desktop

uninstall:
Expand Down
25 changes: 22 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
![cleaf](https://i.snipboard.io/1oBVMY.jpg)
<div align="center">

<img src="data/logos/graptos-logo-dark.png" alt="drawing" width="200"/>

### γραπτός: Grap-Tos; adj, written or inscribed

# Graptoς _Previously Cleaf_
[![C CI](https://github.com/Logic-gate/Graptos/actions/workflows/c-cpp.yml/badge.svg)](https://github.com/Logic-gate/Graptos/actions/workflows/c-cpp.yml)
![C](https://img.shields.io/badge/language-C-blue)
![Open Source Friendly](https://img.shields.io/badge/open--source-friendly-22c55e)
![Pull Requests Welcome](https://img.shields.io/badge/pull%20requests-welcome-2563eb)

</div>

![cleaf](https://i.snipboard.io/1oBVMY.jpg)

γραπτός: Grap-Tos; adj, written or inscribed

Graptoς is a small text editor for Linux, written in pure C with GTK 4 and
GtkSourceView 5. It is still under active development and is not ready for
Expand Down Expand Up @@ -477,6 +487,15 @@ icon: LOG
index: false
```

## Plugins

Graptoς plugins are local folders with a `plugin.yaml` manifest. The plugin
layer is the boundary between Graptoς internals and extensions: plugins declare
what they contribute, and Graptoς decides how those contributions are loaded and
executed.

See [docs/PLUGINS.md](docs/PLUGINS.md) for more information.

### AI Policy

AI contributions are based on [AI USAGE POLICY VERSION 1](https://github.com/Logic-gate/AI-USAGE-POLICY/blob/main/POLICY/VERSION_1.0.0.md) [docs/AI_USAGE_POLICY.md](docs/AI_USAGE_POLICY.md).
Expand Down
Binary file removed data/logos/cleaf-logo-dark.png
Binary file not shown.
Binary file removed data/logos/cleaf-logo-light.png
Binary file not shown.
Binary file modified data/logos/graptos-logo-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified data/logos/graptos-logo-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 40 additions & 0 deletions data/plugins/full-demo/plugin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
id: full-demo
name: Full Demo Plugin
version: 1.0
description: Shows every current permission in one manifest.
graptos_api_version: 1
enabled: false
native: lib/libgraptos_full_demo.so

permissions:
- editor.read
- editor.write
- project.read
- project.write
- ui
- syntax
- theme
- template
- git
- terminal
- command
- native

contributes:
syntaxes:
- syntax
themes:
- themes
templates:
- templates
commands:
- show-plugin-info
- line-word-count
- insert-section-banner
- project-summary
- git-blame-line
- run-current-file-in-terminal
- run-external-formatter
- native-demo-command
menus:
- editor-line:Full Demo Info:show-plugin-info
70 changes: 70 additions & 0 deletions data/plugins/full-demo/syntax/full-demo-log.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Full Demo Log
extensions: [.fulldemo]
line_comment: "#"
auto_indent: false
indent_openers: []
indent_closers: []
close_pairs: ["(=>)", "{=>}", "[=>]"]
icon: demo
filenames: []
index: false
import_style: none
lsp_command:
lsp_language_id:
lsp_args: []
import_keywords: []
import_from_keywords: []
import_member_keywords: []
import_roots: []
import_env: []
import_extensions: []
import_member_files: []
import_strip_extensions: true
import_dot_modules: false
import_static_modules: []
completions: [INFO, WARN, ERROR, TODO]
line_close_pairs: []
statement_required_enders: []
statement_exempt_prefixes: ["#", "INFO", "WARN", "ERROR", "TODO"]
statement_exempt_suffixes: []
formatting:
enabled: false
scope: selection_or_block
profile: none
block_style: none
statement_style: newline
brace_style: attach
one_statement_per_line: false
space_before_block_opener: false
space_after_comma: true
space_after_control_keyword: true
space_around_binary_operators: true
space_around_logical_operators: true
logical_operators: []
binary_operators: []
unary_prefix_operators: []
protected_scopes: [comment]
pointer_alignment: name
continuation_indent: 2
max_column: 100
wrap_after_comma: false
case_indent: 0
preserve_blank_lines: true
max_blank_lines: 1
collapse_empty_blocks: false
rules:
- name: comment
scope: comment
pattern: "#.*$"
color: "#6A9955"
- name: error
pattern: "^ERROR\\b.*$"
color: "#FF6B6B"
bold: true
- name: warn
pattern: "^WARN\\b.*$"
color: "#F9C74F"
bold: true
- name: info
pattern: "^INFO\\b.*$"
color: "#57CC99"
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Full demo plugin project
INFO Owner: ${owner}
WARN This is a showcase template
ERROR This line is only here to demonstrate highlighting
19 changes: 19 additions & 0 deletions data/plugins/full-demo/templates/full-demo-project/template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: 1
id: full-demo-project
name: Full Demo Project
description: Project template contributed by the full demo plugin.
language: Full Demo Log

variables:
owner:
label: Owner
type: text
default: ${project_name}

files:
- path: demo.fulldemo
template: files/demo.fulldemo

open:
project: .
file: demo.fulldemo
6 changes: 6 additions & 0 deletions data/plugins/full-demo/themes/full-demo.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/* Full demo theme contribution. */
@define-color graptos_editor_bg #101014;
@define-color graptos_editor_fg #f1f5f9;
@define-color graptos_tab_active_border #f9c74f;
@define-color graptos_dialog_bg #15151c;
@define-color graptos_dialog_fg #f1f5f9;
13 changes: 13 additions & 0 deletions data/plugins/permission-command/plugin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
id: permission-command
name: External Command Demo
version: 1.0
description: Demonstrates the command permission shape for future external process commands.
graptos_api_version: 1
enabled: false

permissions:
- command

contributes:
commands:
- run-external-formatter
15 changes: 15 additions & 0 deletions data/plugins/permission-editor-read/plugin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
id: permission-editor-read
name: Editor Read Demo
version: 1.0
description: Adds a line word-count action that only reads editor text.
graptos_api_version: 1
enabled: false

permissions:
- editor.read

contributes:
commands:
- line-word-count
menus:
- editor-line:Count Words On This Line:line-word-count
15 changes: 15 additions & 0 deletions data/plugins/permission-editor-write/plugin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
id: permission-editor-write
name: Editor Write Demo
version: 1.0
description: Adds an action that inserts a section banner above the clicked line.
graptos_api_version: 1
enabled: false

permissions:
- editor.write

contributes:
commands:
- insert-section-banner
menus:
- editor-line:Insert Section Banner:insert-section-banner
16 changes: 16 additions & 0 deletions data/plugins/permission-git/plugin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
id: permission-git
name: Git Blame Demo
version: 1.0
description: Adds Git blame to the right-click editor line menu.
graptos_api_version: 1
enabled: false

permissions:
- editor.read
- git

contributes:
commands:
- git-blame-line
menus:
- editor-line:Git Blame This Line:git-blame-line
44 changes: 44 additions & 0 deletions data/plugins/permission-native/native_demo.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/**
* @file native_demo.c
* @brief Example native Graptoς plugin.
* @details The manifest owns identity and permissions. This shared library
* owns the command label and behavior.
*/

#include "plugin_api.h"

/**
* @brief Show text for the active editor line.
* @param context Command context supplied by Graptoς.
* @param user_data Plugin data supplied during registration.
*/
static void native_demo_line_info(GraptosPluginCommandContext *context,
gpointer user_data) {
(void)user_data;
guint line = graptos_plugin_context_line(context);
char *text = graptos_plugin_context_line_text(context, line);
char *body = g_strdup_printf("Line: %u\n\n%s", line, text ? text : "");
graptos_plugin_context_show_output(context,
"Native Demo",
"Native Line Info",
body);
g_free(body);
g_free(text);
}

/**
* @brief Register this plugin with Graptoς.
* @param host Host capability object supplied by Graptoς.
* @return TRUE when registration succeeds.
*/
gboolean graptos_plugin_register(GraptosPluginHost *host) {
if (graptos_plugin_host_api_version(host) != GRAPTOS_PLUGIN_API_VERSION) {
return FALSE;
}
return graptos_plugin_host_register_editor_line_command(host,
"native-demo-line-info",
"Native Demo Line Info",
native_demo_line_info,
NULL,
NULL);
}
12 changes: 12 additions & 0 deletions data/plugins/permission-native/plugin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
id: permission-native
name: Native ABI Demo
version: 1.0
description: Demonstrates the native permission and ABI manifest shape.
graptos_api_version: 1
enabled: true
native: lib/libgraptos_native_demo.so

permissions:
- native
- editor.read
- ui
15 changes: 15 additions & 0 deletions data/plugins/permission-project-read/plugin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
id: permission-project-read
name: Project Read Demo
version: 1.0
description: Shows a small project summary without writing files.
graptos_api_version: 1
enabled: false

permissions:
- project.read

contributes:
commands:
- project-summary
menus:
- editor-line:Show Project Summary:project-summary
13 changes: 13 additions & 0 deletions data/plugins/permission-project-write/plugin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
id: permission-project-write
name: Project Write Demo
version: 1.0
description: Demonstrates the project.write permission shape for future scaffolding commands.
graptos_api_version: 1
enabled: false

permissions:
- project.write

contributes:
commands:
- create-project-note
13 changes: 13 additions & 0 deletions data/plugins/permission-syntax/plugin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
id: permission-syntax
name: QML Syntax Demo
version: 1.0
description: Contributes a small QML syntax definition.
graptos_api_version: 1
enabled: false

permissions:
- syntax

contributes:
syntaxes:
- syntax
Loading