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
10 changes: 10 additions & 0 deletions src/Shortcuts Window/code.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
use crate::workbench;
use gtk::prelude::*;

pub fn main() {
let shortcuts_window: gtk::ShortcutsWindow =
workbench::builder().object("shortcuts_window").unwrap();
let button: gtk::Button = workbench::builder().object("button").unwrap();

button.connect_clicked(move |_| shortcuts_window.present());
}
162 changes: 162 additions & 0 deletions src/Shortcuts Window/main.blp
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
using Gtk 4.0;
using Adw 1;

Adw.StatusPage {
title: _("Shortcuts Window");
description: _("A window showing the application's keyboard shortcuts");

Box {
spacing: 50;
halign: center;
orientation: vertical;

Button button {
label: _("Open");

styles [
"suggested-action",
"pill",
]
}

Box {
orientation: vertical;

LinkButton {
label: _("API Reference");
uri: "https://docs.gtk.org/gtk4/class.ShortcutsWindow.html";
}

LinkButton {
label: _("Human Interface Guidelines");
uri: "https://developer.gnome.org/hig/reference/keyboard.html";
}
}
}
}

Gtk.ShortcutsWindow shortcuts_window {
hide-on-close: true;

Gtk.ShortcutsSection {
section-name: _("Shortcuts");
max-height: 18;

Gtk.ShortcutsGroup {
title: _("Application");

Gtk.ShortcutsShortcut {
accelerator: "<Primary>Return";
title: _("Run Code");
}

Gtk.ShortcutsShortcut {
accelerator: "<Shift><Primary>Return";
title: _("Format");
}

Gtk.ShortcutsShortcut {
accelerator: "<Primary>N";
title: _("New Project");
}

Gtk.ShortcutsShortcut {
accelerator: "<Primary>O";
title: _("Open Project");
}

Gtk.ShortcutsShortcut {
accelerator: "<Shift><Primary>O";
title: _("Open Library");
}

Gtk.ShortcutsShortcut {
accelerator: "<Shift><Primary>I";
title: _("Inspector");
}

Gtk.ShortcutsShortcut {
accelerator: "<Primary>W";
title: _("Close Window");
}

Gtk.ShortcutsShortcut {
accelerator: "<Primary>M";
title: _("Reveal in Files");
}

Gtk.ShortcutsShortcut {
accelerator: "<Primary>question";
title: _("Keyboard Shortcuts");
}

Gtk.ShortcutsShortcut {
accelerator: "<Primary>Q";
title: _("Quit");
}
}

Gtk.ShortcutsGroup {
title: _("Editor");

Gtk.ShortcutsShortcut {
accelerator: "<Primary>X";
title: _("Cut");
}

Gtk.ShortcutsShortcut {
accelerator: "<Primary>C";
title: _("Copy");
}

Gtk.ShortcutsShortcut {
accelerator: "<Primary>V";
title: _("Paste");
}

Gtk.ShortcutsShortcut {
accelerator: "<Primary>F";
title: _("Find");
}

Gtk.ShortcutsShortcut {
accelerator: "<Primary>Z";
title: _("Undo");
}

Gtk.ShortcutsShortcut {
accelerator: "<Primary>space";
title: _("Show code suggestions");
}

Gtk.ShortcutsShortcut {
accelerator: "<Shift><Primary>Z";
title: _("Redo");
}
}

Gtk.ShortcutsGroup {
title: _("Console");

Gtk.ShortcutsShortcut {
accelerator: "<Shift><Primary>K";
title: _("Toggle Console");
}

Gtk.ShortcutsShortcut {
accelerator: "<Shift><Primary>C";
title: _("Copy");
}

Gtk.ShortcutsShortcut {
accelerator: "<Shift><Primary>A";
title: _("Select All");
}

Gtk.ShortcutsShortcut {
accelerator: "<Primary>K";
title: _("Clear");
}
}
}
}
6 changes: 6 additions & 0 deletions src/Shortcuts Window/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const shortcuts_window = workbench.builder.get_object("shortcuts_window");
const button = workbench.builder.get_object("button");

button.connect("clicked", () => {
shortcuts_window.present();
});
6 changes: 6 additions & 0 deletions src/Shortcuts Window/main.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"category": "user_interface",
"description": "A window showing the application's keyboard shortcuts",
"panels": ["ui", "preview"],
"autorun": true
}
6 changes: 6 additions & 0 deletions src/Shortcuts Window/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import workbench

shortcuts_window = workbench.builder.get_object("shortcuts_window")
button = workbench.builder.get_object("button")

button.connect("clicked", lambda *_: shortcuts_window.present())
10 changes: 10 additions & 0 deletions src/Shortcuts Window/main.vala
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#! /usr/bin/env -S vala workbench.vala --pkg gtk4 --pkg libadwaita-1

public void main() {
var shortcuts_window = (Gtk.ShortcutsWindow) workbench.builder.get_object("shortcuts_window");
var button = (Gtk.Button) workbench.builder.get_object("button");

button.clicked.connect(() => {
shortcuts_window.present();
});
}