mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-16 22:01:22 +01:00
feat(hotkeys): the binding IR, key names to Qt codes and a fixture corpus
komorebi users keep their bindings to komorebic in the file of a hotkey daemon: an skhdrc on macOS, a whkdrc on Windows, an sxhkdrc on X11. On KDE Plasma the program that runs a command on a key is KDE's global shortcut daemon, so the bindings have to be read and turned into shortcuts. This adds `komorebi-hotkeys`, a crate of its own that does not depend on the daemon, with the model all three formats are read into: a `Keymap` of modes of bindings, each a chord, an edge and a body (a command, a mode switch, or one action per application), and `Diagnostic`s with spans. A key is a Qt key code with the modifier flags or'ed in, which is what kglobalacceld stores, so the same key is the same value whatever file named it. `qt::key_to_qt` knows the three vocabularies: skhd's literals and macOS keycodes, whkd's virtual key names and sxhkd's X keysyms, including the XF86 media keys. `Combo` applies the shifted symbol rule measured on KWin 6.8.1 (Alt+Shift+1 arrives as Alt+!), and its fields are private so that no combo skips it; a `compile_fail` example proves it. Positions are read as on a US layout. The fixture corpus writes each case in every format that can express it; the parsers are written against it. The flake's source filter keeps the fixtures, so that the nix checks can read them.
This commit is contained in:
1 parent
44f7236698
commit
0520068b48
38 files changed
+2024
-2
No files matched your search
Generated
+4
@@ -2497,6 +2497,10 @@ dependencies = [
|
||||
"serde_json_lenient",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "komorebi-hotkeys"
|
||||
version = "0.1.0"
|
||||
|
||||
[[package]]
|
||||
name = "komorebi-layouts"
|
||||
version = "0.1.42"
|
||||
|
||||
+7
-1
@@ -1,7 +1,13 @@
|
||||
[workspace]
|
||||
|
||||
resolver = "2"
|
||||
members = ["komorebi", "komorebi-client", "komorebic", "version"]
|
||||
members = [
|
||||
"komorebi",
|
||||
"komorebi-client",
|
||||
"komorebi-hotkeys",
|
||||
"komorebic",
|
||||
"version",
|
||||
]
|
||||
|
||||
[workspace.package]
|
||||
version = "0.1.0"
|
||||
|
||||
@@ -91,6 +91,11 @@ without a checkout of the toolchain.
|
||||
- [`komorebi-client`](komorebi-client): a library that sends messages to the
|
||||
daemon, reads its answers, subscribes to its notifications, and re-exports
|
||||
the types they are made of.
|
||||
- [`komorebi-hotkeys`](komorebi-hotkeys): the key bindings of skhd, whkd and
|
||||
sxhkd files in one model, with the keys as KDE stores them. It does not depend
|
||||
on the daemon. Its tests read the files in
|
||||
[`komorebi-hotkeys/tests/fixtures`](komorebi-hotkeys/tests/fixtures), where
|
||||
each case is written in every format that can express it.
|
||||
- [`komorebic`](komorebic): the command line. A subcommand that asks something
|
||||
of the daemon is one message on its socket; `quickstart`, `enable-autostart`,
|
||||
`disable-autostart`, `start`, `check`, `configuration`, `log`, `data-directory`,
|
||||
|
||||
@@ -48,6 +48,11 @@ crate = "komorebi-client"
|
||||
expression = "LicenseRef-Komorebi-2.0"
|
||||
license-files = []
|
||||
|
||||
[[licenses.clarify]]
|
||||
crate = "komorebi-hotkeys"
|
||||
expression = "LicenseRef-Komorebi-2.0"
|
||||
license-files = []
|
||||
|
||||
[[licenses.clarify]]
|
||||
crate = "komorebi-layouts"
|
||||
expression = "LicenseRef-Komorebi-2.0"
|
||||
|
||||
@@ -1564,6 +1564,46 @@ A window is shown, and ends up on a tile:
|
||||
6. There are no more lines, so `read_commands_uds` returns and the connection is closed.
|
||||
`send_query` has read to the end, and returns the JSON, which `komorebic` prints.
|
||||
|
||||
## Key bindings
|
||||
|
||||
[`komorebi-hotkeys`](../../komorebi-hotkeys/src/lib.rs) is a crate of its own, which does not
|
||||
depend on the daemon. Its model is the content of a key binding file of any of three hotkey
|
||||
daemons: skhd (macOS), whkd (Windows) and sxhkd (X11).
|
||||
|
||||
### The model
|
||||
|
||||
- **Keymap**: one file: its modes, the applications in which no binding is active (a
|
||||
blacklist), a binding that turns the others off and on (a pause binding), and the names the
|
||||
file defined.
|
||||
- **Mode**: bindings that are active together. A keymap starts in the mode `default`.
|
||||
- **Binding**: a chord (one or more combos, pressed one after the other), whether it fires on
|
||||
press or on release, and a body: an action (run a command, or switch to a mode), or an action
|
||||
per application (scopes).
|
||||
- **Combo**: a key and its modifiers, as the integer KDE stores (a Qt key code with the modifier
|
||||
flags or'ed in) and the portable text a `.desktop` file writes (`Alt+H`).
|
||||
- **Diagnostic**: something about a file its user should know: its span (byte offsets and line),
|
||||
its severity (error, warning, note) and how faithfully the construct is realized (exactly,
|
||||
approximated, not at all).
|
||||
|
||||
### The parts
|
||||
|
||||
- [`qt`](../../komorebi-hotkeys/src/qt.rs): key names to Qt key codes, in the vocabulary of each
|
||||
format (skhd's literals and macOS keycodes, whkd's virtual key names, sxhkd's X keysyms), and
|
||||
`Combo`, which applies the shifted symbol rule: KWin matches the character a key press
|
||||
produced, so Alt+Shift+1 is registered as Alt+!.
|
||||
- [`ir`](../../komorebi-hotkeys/src/ir.rs): the model.
|
||||
- [`tests/fixtures`](../../komorebi-hotkeys/tests/fixtures): the corpus, `<case>.skhdrc`,
|
||||
`<case>.whkdrc` and `<case>.sxhkdrc`, each case in every format that can express it.
|
||||
|
||||
### What is guaranteed, and by what
|
||||
|
||||
| Rule | Enforced by | Proof | Escape hatch |
|
||||
|---|---|---|---|
|
||||
| A combo is in the form KWin matches (the shifted symbol rule is applied) | type system: `Combo`'s fields are private, and `Combo::new` applies the rule | `compile_fail,E0451` on `Combo`; `shift_on_a_symbol_key_is_the_symbol_it_types` | none |
|
||||
| A key has the same code whichever vocabulary names it | test | `the_three_vocabularies_name_the_same_keys` | none |
|
||||
| Positional key names (macOS keycodes, `oem_*`) are read as on a US layout | convention only | none | none |
|
||||
| The files of a corpus case mean the same keymap | convention only | `the_files_of_a_case_say_what_it_is_about_in_the_same_words` checks only that they start with the same comment | none |
|
||||
|
||||
## Where to look in the code
|
||||
|
||||
- [`komorebi/src/backend/mod.rs`](../../komorebi/src/backend/mod.rs): the trait.
|
||||
@@ -1738,6 +1778,8 @@ A window is shown, and ends up on a tile:
|
||||
[`nix/tests/vm/suites/kwin-contract`](../../nix/tests/vm/suites/kwin-contract/test.py), the
|
||||
behavior of KWin's per-output virtual desktops komorebi relies on, with two outputs and no
|
||||
komorebi.
|
||||
- [`komorebi-hotkeys/src/lib.rs`](../../komorebi-hotkeys/src/lib.rs): the key binding model, and
|
||||
[`komorebi-hotkeys/src/qt.rs`](../../komorebi-hotkeys/src/qt.rs) the keys.
|
||||
- [`nix/nixos-module.nix`](../../nix/nixos-module.nix): the NixOS module;
|
||||
[`nix/tests/nixos-module.nix`](../../nix/tests/nixos-module.nix), its scenarios, evaluated in
|
||||
real NixOS systems; and [`nix/tests/vm/suites/module`](../../nix/tests/vm/suites/module/test.py),
|
||||
|
||||
@@ -54,7 +54,9 @@
|
||||
# with the example file
|
||||
|| (pkgs.lib.hasSuffix "docs/example-configurations.md" path)
|
||||
# the example a test loads, to see that the docs show one that works
|
||||
|| (pkgs.lib.hasSuffix "docs/usage/wallpapers.md" path);
|
||||
|| (pkgs.lib.hasSuffix "docs/usage/wallpapers.md" path)
|
||||
# the key binding files the komorebi-hotkeys tests read
|
||||
|| (pkgs.lib.hasInfix "/komorebi-hotkeys/tests/fixtures/" path);
|
||||
};
|
||||
|
||||
commonArgs = {
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
[package]
|
||||
name = "komorebi-hotkeys"
|
||||
version.workspace = true
|
||||
description = "Reads skhd, whkd and sxhkd key binding files and plans them as KDE global shortcuts"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
@@ -0,0 +1,307 @@
|
||||
//! The model every file is read into: a keymap of modes of bindings, and the diagnostics about it.
|
||||
|
||||
use crate::Format;
|
||||
use crate::qt::Combo;
|
||||
use std::fmt;
|
||||
|
||||
/// The name of the mode a keymap starts in.
|
||||
pub const DEFAULT_MODE: &str = "default";
|
||||
|
||||
/// The key bindings read from one file.
|
||||
///
|
||||
/// A keymap is a list of [modes](Mode), each with its bindings, and the settings that apply to
|
||||
/// every mode: the applications in which no binding is active ([`Keymap::blacklist`]), the binding
|
||||
/// that turns every other binding off and on ([`Keymap::pause`]), and the templates the file
|
||||
/// defined ([`Keymap::defines`]).
|
||||
///
|
||||
/// All three formats read into this one structure, so a binding means the same thing whatever
|
||||
/// file it came from: `alt - h : komorebic focus left` in an skhdrc and `alt + h : komorebic focus
|
||||
/// left` in a whkdrc are equal [`Binding`]s, apart from where each was written
|
||||
/// ([`Binding::span`] and [`Binding::source`]); the keymaps differ only in [`Keymap::format`].
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use komorebi_hotkeys::{Binding, Body, DEFAULT_MODE, Edge, Format, Keymap, Run, Span};
|
||||
/// use komorebi_hotkeys::qt::{Combo, Mods, key_to_qt};
|
||||
///
|
||||
/// let mut keymap = Keymap::new(Format::Skhd);
|
||||
/// keymap.modes[0].bindings.push(Binding {
|
||||
/// chord: vec![Combo::new(Mods::ALT, key_to_qt(Format::Skhd, "h").unwrap())],
|
||||
/// edge: Edge::Press,
|
||||
/// body: Body::Run(Run::Command("komorebic focus left".into())),
|
||||
/// span: Span::default(),
|
||||
/// source: "alt - h : komorebic focus left".into(),
|
||||
/// });
|
||||
///
|
||||
/// let default = keymap.mode(DEFAULT_MODE).unwrap();
|
||||
/// assert_eq!(default.bindings[0].chord[0].to_string(), "Alt+H");
|
||||
/// assert!(!keymap.declares_modes());
|
||||
/// ```
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct Keymap {
|
||||
/// The format of the file the keymap was read from.
|
||||
pub format: Format,
|
||||
/// The modes, the [default mode](DEFAULT_MODE) first.
|
||||
pub modes: Vec<Mode>,
|
||||
/// The applications in which no binding is active, as the file names them.
|
||||
pub blacklist: Vec<String>,
|
||||
/// The binding that turns every other binding off, and on again.
|
||||
pub pause: Option<Pause>,
|
||||
/// The names the file defined. Their uses are already expanded in the bindings; they are kept
|
||||
/// to be listed.
|
||||
pub defines: Vec<Define>,
|
||||
}
|
||||
|
||||
impl Keymap {
|
||||
/// Returns a keymap with an empty default mode and nothing else.
|
||||
pub fn new(format: Format) -> Keymap {
|
||||
Keymap {
|
||||
format,
|
||||
modes: vec![Mode::new(DEFAULT_MODE)],
|
||||
blacklist: Vec::new(),
|
||||
pause: None,
|
||||
defines: Vec::new(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the mode with this name.
|
||||
pub fn mode(&self, name: &str) -> Option<&Mode> {
|
||||
self.modes.iter().find(|mode| mode.name == name)
|
||||
}
|
||||
|
||||
/// Returns true if and only if the keymap has a mode other than the default one.
|
||||
pub fn declares_modes(&self) -> bool {
|
||||
self.modes.iter().any(|mode| mode.name != DEFAULT_MODE)
|
||||
}
|
||||
}
|
||||
|
||||
/// A set of bindings that are active together.
|
||||
///
|
||||
/// Only one mode is active at a time. A keymap starts in the [default mode](DEFAULT_MODE), and a
|
||||
/// binding whose body is [`Run::Mode`] switches to another.
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct Mode {
|
||||
/// The mode's name.
|
||||
pub name: String,
|
||||
/// Whether the mode swallows every key that none of its bindings is for (skhd's `@`).
|
||||
pub capture: bool,
|
||||
/// A command to run each time the mode is entered.
|
||||
pub on_enter: Option<String>,
|
||||
/// The bindings, in the order the file has them.
|
||||
pub bindings: Vec<Binding>,
|
||||
}
|
||||
|
||||
impl Mode {
|
||||
/// Returns an empty mode with this name, which does not capture and runs nothing when it is
|
||||
/// entered.
|
||||
pub fn new(name: impl Into<String>) -> Mode {
|
||||
Mode {
|
||||
name: name.into(),
|
||||
capture: false,
|
||||
on_enter: None,
|
||||
bindings: Vec::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// One binding: the keys, when it fires, and what it does.
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct Binding {
|
||||
/// The combos to press, one after the other. A plain binding has one; a chord chain (sxhkd's
|
||||
/// `alt + w ; h`) has more.
|
||||
pub chord: Vec<Combo>,
|
||||
/// Whether the binding fires when the last combo is pressed or when it is released.
|
||||
pub edge: Edge,
|
||||
/// What the binding does.
|
||||
pub body: Body,
|
||||
/// Where the binding was written.
|
||||
pub span: Span,
|
||||
/// The binding as it was written, on one line, for logs and for the comment of a generated
|
||||
/// shortcut file.
|
||||
pub source: String,
|
||||
}
|
||||
|
||||
/// When a binding fires.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||
pub enum Edge {
|
||||
/// When the last combo of the chord is pressed.
|
||||
Press,
|
||||
/// When the last combo of the chord is released (sxhkd's `@`).
|
||||
Release,
|
||||
}
|
||||
|
||||
/// What a binding does.
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub enum Body {
|
||||
/// The same thing in every application.
|
||||
Run(Run),
|
||||
/// A different thing depending on the application that has the focus.
|
||||
///
|
||||
/// The scope that names the focused application applies, the first one if several do; when
|
||||
/// none does, the [`App::Other`] scope applies, wherever it is in the list. When there is no
|
||||
/// such scope, or its [`Then`] is [`Then::Ignore`], the binding does nothing and the key
|
||||
/// reaches the application.
|
||||
Scoped(Vec<Scope>),
|
||||
}
|
||||
|
||||
/// An action.
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub enum Run {
|
||||
/// Runs a command.
|
||||
Command(String),
|
||||
/// Switches to the mode with this name, and runs its [`Mode::on_enter`] command.
|
||||
Mode(String),
|
||||
}
|
||||
|
||||
/// What a scoped binding does in some applications.
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct Scope {
|
||||
/// The applications the scope is for.
|
||||
pub app: App,
|
||||
/// What the binding does in them.
|
||||
pub then: Then,
|
||||
}
|
||||
|
||||
/// The applications a [`Scope`] applies to.
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub enum App {
|
||||
/// The application with this name, as the file writes it.
|
||||
Named(String),
|
||||
/// Every application no other scope of the binding names (skhd's `*`, whkd's `Default`).
|
||||
Other,
|
||||
}
|
||||
|
||||
/// What a scoped binding does in the applications of its scope.
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub enum Then {
|
||||
/// It runs this action.
|
||||
Run(Run),
|
||||
/// Nothing: the key reaches the application (skhd's `~`, whkd's `Ignore`).
|
||||
Ignore,
|
||||
}
|
||||
|
||||
/// The binding that turns every other binding off, and on again (whkd's `.pause`).
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct Pause {
|
||||
/// The keys.
|
||||
pub combo: Combo,
|
||||
/// A command to run each time the bindings are turned off or on (whkd's `.pause_hook`).
|
||||
pub hook: Option<String>,
|
||||
/// Where the binding was written.
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
/// A name the file defined (skhd's `.define`).
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct Define {
|
||||
/// The name.
|
||||
pub name: String,
|
||||
/// What the name stands for.
|
||||
pub value: DefineValue,
|
||||
/// Where it was defined.
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
/// What a [`Define`] stands for.
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub enum DefineValue {
|
||||
/// A command, with placeholders `{{1}}`, `{{2}}`... for its arguments.
|
||||
Command(String),
|
||||
/// A group of applications.
|
||||
Apps(Vec<String>),
|
||||
}
|
||||
|
||||
/// A range of the text a keymap was read from.
|
||||
///
|
||||
/// The default value, all zeros, is a span that points nowhere, for a binding that was not read
|
||||
/// from a file.
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
|
||||
pub struct Span {
|
||||
/// The byte offset of the first byte.
|
||||
pub start: usize,
|
||||
/// The byte offset one past the last byte.
|
||||
pub end: usize,
|
||||
/// The line of the first byte, counted from 1.
|
||||
pub line: usize,
|
||||
}
|
||||
|
||||
/// Something about a file that its user should know.
|
||||
///
|
||||
/// A diagnostic is either about text that could not be read ([`Severity::Error`]), or about a
|
||||
/// binding komorebi realizes differently from the file's own daemon, or not at all
|
||||
/// ([`Severity::Warning`]), or a remark ([`Severity::Note`]). [`Diagnostic::support`] says how
|
||||
/// faithfully the construct it is about is realized.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use komorebi_hotkeys::{Diagnostic, Severity, Span, Support};
|
||||
///
|
||||
/// let diagnostic = Diagnostic {
|
||||
/// span: Span { start: 40, end: 47, line: 3 },
|
||||
/// severity: Severity::Warning,
|
||||
/// support: Support::Approximated,
|
||||
/// msg: "`lalt` is Alt: KDE does not tell left and right apart".into(),
|
||||
/// };
|
||||
/// assert_eq!(
|
||||
/// diagnostic.to_string(),
|
||||
/// "line 3: warning: `lalt` is Alt: KDE does not tell left and right apart",
|
||||
/// );
|
||||
/// ```
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct Diagnostic {
|
||||
/// The text the diagnostic is about.
|
||||
pub span: Span,
|
||||
/// How much it matters.
|
||||
pub severity: Severity,
|
||||
/// How faithfully the construct is realized.
|
||||
pub support: Support,
|
||||
/// The message, which starts in lower case and does not end with a period.
|
||||
pub msg: String,
|
||||
}
|
||||
|
||||
/// Writes `line N: severity: message`.
|
||||
impl fmt::Display for Diagnostic {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(
|
||||
f,
|
||||
"line {}: {}: {}",
|
||||
self.span.line, self.severity, self.msg
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/// How much a [`Diagnostic`] matters.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
pub enum Severity {
|
||||
/// A remark: nothing is lost.
|
||||
Note,
|
||||
/// The text is valid in its format, but komorebi does not realize it the way the format's own
|
||||
/// daemon does.
|
||||
Warning,
|
||||
/// The text is not valid in its format, and is skipped.
|
||||
Error,
|
||||
}
|
||||
|
||||
/// Writes `note`, `warning` or `error`.
|
||||
impl fmt::Display for Severity {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.write_str(match self {
|
||||
Severity::Note => "note",
|
||||
Severity::Warning => "warning",
|
||||
Severity::Error => "error",
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/// How faithfully komorebi realizes the construct a [`Diagnostic`] is about.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||
pub enum Support {
|
||||
/// As the file's own daemon would.
|
||||
Exact,
|
||||
/// In a way that differs from the file's own daemon, which the message describes.
|
||||
Approximated,
|
||||
/// Not at all: the construct is left out.
|
||||
Unsupported,
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
//! One model for the key bindings of skhd, whkd and sxhkd files, with the keys as KDE stores them.
|
||||
//!
|
||||
//! skhd (macOS), whkd (Windows) and sxhkd (X11) are hotkey daemons: each reads a file of key
|
||||
//! bindings and runs a command when a combination of keys is pressed. komorebi users keep their
|
||||
//! bindings to `komorebic` in such a file. On KDE Plasma under Wayland no client sees the keys of
|
||||
//! another, and the program that runs a command on a key is KDE's global shortcut daemon. The
|
||||
//! three files say much the same things in three syntaxes, so this crate has one model for all of
|
||||
//! them, [`Keymap`], and the keys as KDE stores them, [`qt`].
|
||||
//!
|
||||
//! # The model
|
||||
//!
|
||||
//! - A [`Keymap`] is the content of one file: its [modes](Mode), and the settings that apply to
|
||||
//! every mode (a blacklist of applications, a pause binding, the names the file defined).
|
||||
//! - A [`Mode`] is a set of [bindings](Binding) that are active together. A keymap starts in the
|
||||
//! [default mode](DEFAULT_MODE).
|
||||
//! - A [`Binding`] is a chord (one or more [combos](qt::Combo) pressed one after the other), an
|
||||
//! [edge](Edge) (press or release) and a [body](Body): either an action ([`Run`]: a command or
|
||||
//! a mode switch), or a different action per application ([`Scope`]s).
|
||||
//! - A [`Diagnostic`] is something about the file its user should know, with the [`Span`] of the
|
||||
//! text it is about, its [`Severity`] and how faithfully the construct is realized
|
||||
//! ([`Support`]).
|
||||
//!
|
||||
//! # Keys
|
||||
//!
|
||||
//! Each format names keys in its own vocabulary: skhd writes `0x21` or `return`, whkd `oem_4` or
|
||||
//! `return`, sxhkd `bracketleft` or `Return`. [`qt::key_to_qt`] turns a name into a Qt key code,
|
||||
//! and [`qt::Combo`] holds a key with its modifiers in the form KWin matches, so that the same key
|
||||
//! is the same value whatever file named it:
|
||||
//!
|
||||
//! ```rust
|
||||
//! use komorebi_hotkeys::Format;
|
||||
//! use komorebi_hotkeys::qt::{Combo, Mods, key_to_qt};
|
||||
//!
|
||||
//! let skhd = Combo::new(Mods::ALT | Mods::SHIFT, key_to_qt(Format::Skhd, "0x21").unwrap());
|
||||
//! let whkd = Combo::new(Mods::ALT | Mods::SHIFT, key_to_qt(Format::Whkd, "oem_4").unwrap());
|
||||
//! assert_eq!(skhd, whkd);
|
||||
//! // Shift+[ types {, and KWin matches the character
|
||||
//! assert_eq!(skhd.to_string(), "Alt+{");
|
||||
//! ```
|
||||
//!
|
||||
//! Key names are read as on a US keyboard layout; [the `qt` module](qt#a-us-layout-only) says
|
||||
//! what that means for other layouts.
|
||||
|
||||
#![deny(missing_docs)]
|
||||
|
||||
mod ir;
|
||||
pub mod qt;
|
||||
|
||||
pub use ir::App;
|
||||
pub use ir::Binding;
|
||||
pub use ir::Body;
|
||||
pub use ir::DEFAULT_MODE;
|
||||
pub use ir::Define;
|
||||
pub use ir::DefineValue;
|
||||
pub use ir::Diagnostic;
|
||||
pub use ir::Edge;
|
||||
pub use ir::Keymap;
|
||||
pub use ir::Mode;
|
||||
pub use ir::Pause;
|
||||
pub use ir::Run;
|
||||
pub use ir::Scope;
|
||||
pub use ir::Severity;
|
||||
pub use ir::Span;
|
||||
pub use ir::Support;
|
||||
pub use ir::Then;
|
||||
|
||||
/// The file formats this crate reads.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||
pub enum Format {
|
||||
/// skhd's `skhdrc`, macOS's hotkey daemon, and the dialect of skhd.zig.
|
||||
Skhd,
|
||||
/// whkd's `whkdrc`, the hotkey daemon komorebi for Windows uses.
|
||||
Whkd,
|
||||
/// sxhkd's `sxhkdrc`, the X11 hotkey daemon.
|
||||
Sxhkd,
|
||||
}
|
||||
|
||||
impl Format {
|
||||
/// Returns the name the format's daemon gives its file.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use komorebi_hotkeys::Format;
|
||||
///
|
||||
/// assert_eq!(Format::Whkd.file_name(), "whkdrc");
|
||||
/// ```
|
||||
pub const fn file_name(self) -> &'static str {
|
||||
match self {
|
||||
Format::Skhd => "skhdrc",
|
||||
Format::Whkd => "whkdrc",
|
||||
Format::Sxhkd => "sxhkdrc",
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,65 @@
|
||||
//! The fixture corpus: key binding files that say the same thing in each format that can say it.
|
||||
//!
|
||||
//! Each case is a file per format in `tests/fixtures`, `<case>.skhdrc`, `<case>.whkdrc` and
|
||||
//! `<case>.sxhkdrc`, for the formats that can express the case. The files of a case mean the same
|
||||
//! keymap, and start with the same comment, which says what the case is about.
|
||||
|
||||
use std::path::PathBuf;
|
||||
|
||||
/// Every case, and the formats it is written in.
|
||||
const CASES: &[(&str, &[&str])] = &[
|
||||
("plain", &["skhdrc", "whkdrc", "sxhkdrc"]),
|
||||
("modifiers", &["skhdrc", "whkdrc", "sxhkdrc"]),
|
||||
("keycodes", &["skhdrc", "whkdrc", "sxhkdrc"]),
|
||||
("comments", &["skhdrc", "whkdrc", "sxhkdrc"]),
|
||||
("braces", &["skhdrc", "whkdrc", "sxhkdrc"]),
|
||||
("sample", &["skhdrc", "whkdrc", "sxhkdrc"]),
|
||||
("scopes", &["skhdrc", "whkdrc"]),
|
||||
("define", &["skhdrc", "whkdrc"]),
|
||||
("blacklist", &["skhdrc"]),
|
||||
("modes", &["skhdrc"]),
|
||||
("pause", &["whkdrc"]),
|
||||
("chords", &["sxhkdrc"]),
|
||||
("release", &["sxhkdrc"]),
|
||||
];
|
||||
|
||||
fn fixtures() -> PathBuf {
|
||||
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("tests/fixtures")
|
||||
}
|
||||
|
||||
fn read(case: &str, extension: &str) -> String {
|
||||
let path = fixtures().join(format!("{case}.{extension}"));
|
||||
std::fs::read_to_string(&path).unwrap_or_else(|e| panic!("{}: {e}", path.display()))
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_corpus_is_the_files_the_table_names() {
|
||||
let mut on_disk: Vec<String> = std::fs::read_dir(fixtures())
|
||||
.unwrap()
|
||||
.map(|entry| entry.unwrap().file_name().into_string().unwrap())
|
||||
.collect();
|
||||
on_disk.sort();
|
||||
|
||||
let mut named: Vec<String> = CASES
|
||||
.iter()
|
||||
.flat_map(|(case, extensions)| extensions.iter().map(move |e| format!("{case}.{e}")))
|
||||
.collect();
|
||||
named.sort();
|
||||
|
||||
assert_eq!(on_disk, named);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_files_of_a_case_say_what_it_is_about_in_the_same_words() {
|
||||
for (case, extensions) in CASES {
|
||||
let first_lines: Vec<String> = extensions
|
||||
.iter()
|
||||
.map(|e| read(case, e).lines().next().unwrap_or_default().to_string())
|
||||
.collect();
|
||||
assert!(first_lines[0].starts_with("# "), "{case}: {first_lines:?}");
|
||||
assert!(
|
||||
first_lines.iter().all(|line| *line == first_lines[0]),
|
||||
"{case}: {first_lines:?}"
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
# no binding is active while steam or dota2 has the focus
|
||||
.blacklist [
|
||||
"steam"
|
||||
"dota2"
|
||||
]
|
||||
|
||||
alt - h : komorebic focus left
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
# what sxhkd writes with braces, one line each
|
||||
alt - h : komorebic focus left
|
||||
alt - j : komorebic focus down
|
||||
alt - k : komorebic focus up
|
||||
alt - l : komorebic focus right
|
||||
alt - 1 : komorebic focus-workspace 0
|
||||
alt - 2 : komorebic focus-workspace 1
|
||||
alt - 3 : komorebic focus-workspace 2
|
||||
alt + shift - 1 : komorebic move-to-workspace 0
|
||||
alt + shift - 2 : komorebic move-to-workspace 1
|
||||
alt + shift - 3 : komorebic move-to-workspace 2
|
||||
@@ -0,0 +1,5 @@
|
||||
# what sxhkd writes with braces, one line each
|
||||
alt + {h,j,k,l}
|
||||
komorebic focus {left,down,up,right}
|
||||
alt + {_,shift + }{1-3}
|
||||
komorebic {focus,move-to}-workspace {0-2}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
# what sxhkd writes with braces, one line each
|
||||
.shell pwsh
|
||||
|
||||
alt + h : komorebic focus left
|
||||
alt + j : komorebic focus down
|
||||
alt + k : komorebic focus up
|
||||
alt + l : komorebic focus right
|
||||
alt + 1 : komorebic focus-workspace 0
|
||||
alt + 2 : komorebic focus-workspace 1
|
||||
alt + 3 : komorebic focus-workspace 2
|
||||
alt + shift + 1 : komorebic move-to-workspace 0
|
||||
alt + shift + 2 : komorebic move-to-workspace 1
|
||||
alt + shift + 3 : komorebic move-to-workspace 2
|
||||
@@ -0,0 +1,7 @@
|
||||
# chord chains: alt + w and then a second key; alt + r and then any number of h or l
|
||||
alt + w ; h
|
||||
komorebic move left
|
||||
alt + w ; l
|
||||
komorebic move right
|
||||
alt + r : {h,l}
|
||||
komorebic resize-edge {left,right} increase
|
||||
@@ -0,0 +1,6 @@
|
||||
# comments, trailing comments and a command continued on the next line
|
||||
|
||||
# a comment on a line of its own
|
||||
alt - h : komorebic focus left # a trailing comment is not part of the command
|
||||
alt - x : komorebic \
|
||||
flip-layout horizontal
|
||||
@@ -0,0 +1,8 @@
|
||||
# comments, trailing comments and a command continued on the next line
|
||||
|
||||
# a comment on a line of its own
|
||||
alt + h
|
||||
komorebic focus left # a trailing comment is not part of the command
|
||||
alt + x
|
||||
komorebic \
|
||||
flip-layout horizontal
|
||||
@@ -0,0 +1,6 @@
|
||||
# comments, trailing comments and a command continued on the next line
|
||||
.shell pwsh
|
||||
|
||||
# a comment on a line of its own
|
||||
alt + h : komorebic focus left # a trailing comment is not part of the command
|
||||
alt + x : komorebic flip-layout horizontal
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
# a group of applications and a command template, both from .define
|
||||
.define browsers ["firefox", "chromium"]
|
||||
.define focus : komorebic focus {{1}}
|
||||
|
||||
alt - b [
|
||||
@browsers : komorebic toggle-monocle
|
||||
* ~
|
||||
]
|
||||
alt - h : @focus("left")
|
||||
alt - l : @focus("right")
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
# a group of applications and a command template, both from .define
|
||||
.shell pwsh
|
||||
|
||||
alt + b [
|
||||
firefox : komorebic toggle-monocle
|
||||
chromium : komorebic toggle-monocle
|
||||
Default : Ignore
|
||||
]
|
||||
|
||||
alt + h : komorebic focus left
|
||||
alt + l : komorebic focus right
|
||||
@@ -0,0 +1,7 @@
|
||||
# keys that skhd can only name by their macOS keycode, a position on a US keyboard
|
||||
alt - 0x21 : komorebic cycle-stack previous
|
||||
alt - 0x1E : komorebic cycle-stack next
|
||||
alt - 0x29 : komorebic unstack
|
||||
alt - 0x18 : komorebic resize-axis horizontal increase
|
||||
alt - 0x1B : komorebic resize-axis horizontal decrease
|
||||
alt + shift - 0x21 : komorebic cycle-focus previous
|
||||
@@ -0,0 +1,13 @@
|
||||
# keys that skhd can only name by their macOS keycode, a position on a US keyboard
|
||||
alt + bracketleft
|
||||
komorebic cycle-stack previous
|
||||
alt + bracketright
|
||||
komorebic cycle-stack next
|
||||
alt + semicolon
|
||||
komorebic unstack
|
||||
alt + equal
|
||||
komorebic resize-axis horizontal increase
|
||||
alt + minus
|
||||
komorebic resize-axis horizontal decrease
|
||||
alt + shift + bracketleft
|
||||
komorebic cycle-focus previous
|
||||
@@ -0,0 +1,9 @@
|
||||
# keys that skhd can only name by their macOS keycode, a position on a US keyboard
|
||||
.shell pwsh
|
||||
|
||||
alt + oem_4 : komorebic cycle-stack previous
|
||||
alt + oem_6 : komorebic cycle-stack next
|
||||
alt + oem_1 : komorebic unstack
|
||||
alt + oem_plus : komorebic resize-axis horizontal increase
|
||||
alt + oem_minus : komorebic resize-axis horizontal decrease
|
||||
alt + shift + oem_4 : komorebic cycle-focus previous
|
||||
@@ -0,0 +1,7 @@
|
||||
# alt - r enters a resize mode, escape leaves it, alt - q works in both
|
||||
:: resize @ : notify-send resize
|
||||
alt - r ; resize
|
||||
resize < h : komorebic resize-edge left increase
|
||||
resize < l : komorebic resize-edge right increase
|
||||
resize < escape ; default
|
||||
default, resize < alt - q : komorebic close
|
||||
@@ -0,0 +1,9 @@
|
||||
# every modifier, and Shift on a key that types a symbol
|
||||
cmd - return : konsole
|
||||
ctrl + alt - left : komorebic stack left
|
||||
alt + shift - h : komorebic move left
|
||||
ctrl + shift - right : komorebic resize-edge right increase
|
||||
alt + shift - 1 : komorebic move-to-workspace 0
|
||||
ctrl + alt + shift - 9 : komorebic move-to-workspace 8
|
||||
hyper - a : komorebic retile
|
||||
meh - m : komorebic toggle-monocle
|
||||
@@ -0,0 +1,17 @@
|
||||
# every modifier, and Shift on a key that types a symbol
|
||||
super + Return
|
||||
konsole
|
||||
ctrl + alt + Left
|
||||
komorebic stack left
|
||||
alt + shift + h
|
||||
komorebic move left
|
||||
ctrl + shift + Right
|
||||
komorebic resize-edge right increase
|
||||
alt + shift + 1
|
||||
komorebic move-to-workspace 0
|
||||
ctrl + alt + shift + 9
|
||||
komorebic move-to-workspace 8
|
||||
super + ctrl + alt + shift + a
|
||||
komorebic retile
|
||||
ctrl + alt + shift + m
|
||||
komorebic toggle-monocle
|
||||
@@ -0,0 +1,11 @@
|
||||
# every modifier, and Shift on a key that types a symbol
|
||||
.shell pwsh
|
||||
|
||||
win + return : konsole
|
||||
ctrl + alt + left : komorebic stack left
|
||||
alt + shift + h : komorebic move left
|
||||
ctrl + shift + right : komorebic resize-edge right increase
|
||||
alt + shift + 1 : komorebic move-to-workspace 0
|
||||
ctrl + alt + shift + 9 : komorebic move-to-workspace 8
|
||||
win + ctrl + alt + shift + a : komorebic retile
|
||||
ctrl + alt + shift + m : komorebic toggle-monocle
|
||||
@@ -0,0 +1,6 @@
|
||||
# alt + shift + p turns every other binding off and on again
|
||||
.shell pwsh
|
||||
.pause alt + shift + p
|
||||
.pause_hook komorebic toggle-pause
|
||||
|
||||
alt + h : komorebic focus left
|
||||
@@ -0,0 +1,6 @@
|
||||
# plain bindings: modifiers, a key and a command
|
||||
alt - h : komorebic focus left
|
||||
alt - j : komorebic focus down
|
||||
alt - k : komorebic focus up
|
||||
alt - l : komorebic focus right
|
||||
alt - q : komorebic close
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
# plain bindings: modifiers, a key and a command
|
||||
alt + h
|
||||
komorebic focus left
|
||||
alt + j
|
||||
komorebic focus down
|
||||
alt + k
|
||||
komorebic focus up
|
||||
alt + l
|
||||
komorebic focus right
|
||||
alt + q
|
||||
komorebic close
|
||||
@@ -0,0 +1,8 @@
|
||||
# plain bindings: modifiers, a key and a command
|
||||
.shell pwsh
|
||||
|
||||
alt + h : komorebic focus left
|
||||
alt + j : komorebic focus down
|
||||
alt + k : komorebic focus up
|
||||
alt + l : komorebic focus right
|
||||
alt + q : komorebic close
|
||||
@@ -0,0 +1,3 @@
|
||||
# a binding that runs when the key is released
|
||||
alt + @space
|
||||
komorebic toggle-float
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
# the komorebi sample configuration
|
||||
|
||||
# Focus windows
|
||||
alt - h : komorebic focus left
|
||||
alt - j : komorebic focus down
|
||||
alt - k : komorebic focus up
|
||||
alt - l : komorebic focus right
|
||||
alt + shift - 0x21 : komorebic cycle-focus previous # 0x21 is [
|
||||
alt + shift - 0x1E : komorebic cycle-focus next # 0x1E is ]
|
||||
|
||||
# Move windows
|
||||
alt + shift - h : komorebic move left
|
||||
alt + shift - j : komorebic move down
|
||||
alt + shift - k : komorebic move up
|
||||
alt + shift - l : komorebic move right
|
||||
alt + shift - return : komorebic promote
|
||||
|
||||
# Stack windows
|
||||
ctrl + alt - left : komorebic stack left
|
||||
ctrl + alt - down : komorebic stack down
|
||||
ctrl + alt - up : komorebic stack up
|
||||
ctrl + alt - right : komorebic stack right
|
||||
alt - 0x29 : komorebic unstack # 0x29 is ;
|
||||
alt - 0x21 : komorebic cycle-stack previous # 0x21 is [
|
||||
alt - 0x1E : komorebic cycle-stack next # 0x1E is ]
|
||||
|
||||
# Workspace layer
|
||||
alt + shift - 0x29 : komorebic toggle-workspace-layer # 0x29 is ;
|
||||
|
||||
# Resize
|
||||
alt - 0x18 : komorebic resize-axis horizontal increase # 0x18 is +
|
||||
alt - 0x1B : komorebic resize-axis horizontal decrease # 0x1B is -
|
||||
alt + shift - 0x18 : komorebic resize-axis vertical increase
|
||||
alt + shift - 0x1B : komorebic resize-axis vertical decrease
|
||||
|
||||
# Manipulate windows
|
||||
alt - t : komorebic toggle-float
|
||||
alt + shift - t : komorebic toggle-workspace-float-override
|
||||
alt + shift - f : komorebic toggle-monocle
|
||||
|
||||
# Window manager options
|
||||
alt + shift - r : komorebic retile
|
||||
alt - p : komorebic toggle-pause
|
||||
alt - 0 : komorebic toggle-window-container-behaviour
|
||||
|
||||
# Layouts
|
||||
alt - x : komorebic flip-layout horizontal
|
||||
alt - y : komorebic flip-layout vertical
|
||||
alt + shift - x : komorebic session-float-rule
|
||||
|
||||
# Workspaces
|
||||
alt - 1 : komorebic focus-workspace 0
|
||||
alt - 2 : komorebic focus-workspace 1
|
||||
alt - 3 : komorebic focus-workspace 2
|
||||
alt - 4 : komorebic focus-workspace 3
|
||||
alt - 5 : komorebic focus-workspace 4
|
||||
alt - 6 : komorebic focus-workspace 5
|
||||
alt - 7 : komorebic focus-workspace 6
|
||||
alt - 8 : komorebic focus-workspace 7
|
||||
alt - 9 : komorebic focus-workspace 8
|
||||
|
||||
# Move windows across workspaces
|
||||
alt + shift - 1 : komorebic move-to-workspace 0
|
||||
alt + shift - 2 : komorebic move-to-workspace 1
|
||||
alt + shift - 3 : komorebic move-to-workspace 2
|
||||
alt + shift - 4 : komorebic move-to-workspace 3
|
||||
alt + shift - 5 : komorebic move-to-workspace 4
|
||||
alt + shift - 6 : komorebic move-to-workspace 5
|
||||
alt + shift - 7 : komorebic move-to-workspace 6
|
||||
alt + shift - 8 : komorebic move-to-workspace 7
|
||||
alt + shift - 9 : komorebic move-to-workspace 8
|
||||
+121
@@ -0,0 +1,121 @@
|
||||
# the komorebi sample configuration
|
||||
|
||||
# Focus windows
|
||||
alt + h
|
||||
komorebic focus left
|
||||
alt + j
|
||||
komorebic focus down
|
||||
alt + k
|
||||
komorebic focus up
|
||||
alt + l
|
||||
komorebic focus right
|
||||
alt + shift + bracketleft
|
||||
komorebic cycle-focus previous
|
||||
alt + shift + bracketright
|
||||
komorebic cycle-focus next
|
||||
|
||||
# Move windows
|
||||
alt + shift + h
|
||||
komorebic move left
|
||||
alt + shift + j
|
||||
komorebic move down
|
||||
alt + shift + k
|
||||
komorebic move up
|
||||
alt + shift + l
|
||||
komorebic move right
|
||||
alt + shift + Return
|
||||
komorebic promote
|
||||
|
||||
# Stack windows
|
||||
ctrl + alt + Left
|
||||
komorebic stack left
|
||||
ctrl + alt + Down
|
||||
komorebic stack down
|
||||
ctrl + alt + Up
|
||||
komorebic stack up
|
||||
ctrl + alt + Right
|
||||
komorebic stack right
|
||||
alt + semicolon
|
||||
komorebic unstack
|
||||
alt + bracketleft
|
||||
komorebic cycle-stack previous
|
||||
alt + bracketright
|
||||
komorebic cycle-stack next
|
||||
|
||||
# Workspace layer
|
||||
alt + shift + semicolon
|
||||
komorebic toggle-workspace-layer
|
||||
|
||||
# Resize
|
||||
alt + equal
|
||||
komorebic resize-axis horizontal increase
|
||||
alt + minus
|
||||
komorebic resize-axis horizontal decrease
|
||||
alt + shift + equal
|
||||
komorebic resize-axis vertical increase
|
||||
alt + shift + minus
|
||||
komorebic resize-axis vertical decrease
|
||||
|
||||
# Manipulate windows
|
||||
alt + t
|
||||
komorebic toggle-float
|
||||
alt + shift + t
|
||||
komorebic toggle-workspace-float-override
|
||||
alt + shift + f
|
||||
komorebic toggle-monocle
|
||||
|
||||
# Window manager options
|
||||
alt + shift + r
|
||||
komorebic retile
|
||||
alt + p
|
||||
komorebic toggle-pause
|
||||
alt + 0
|
||||
komorebic toggle-window-container-behaviour
|
||||
|
||||
# Layouts
|
||||
alt + x
|
||||
komorebic flip-layout horizontal
|
||||
alt + y
|
||||
komorebic flip-layout vertical
|
||||
alt + shift + x
|
||||
komorebic session-float-rule
|
||||
|
||||
# Workspaces
|
||||
alt + 1
|
||||
komorebic focus-workspace 0
|
||||
alt + 2
|
||||
komorebic focus-workspace 1
|
||||
alt + 3
|
||||
komorebic focus-workspace 2
|
||||
alt + 4
|
||||
komorebic focus-workspace 3
|
||||
alt + 5
|
||||
komorebic focus-workspace 4
|
||||
alt + 6
|
||||
komorebic focus-workspace 5
|
||||
alt + 7
|
||||
komorebic focus-workspace 6
|
||||
alt + 8
|
||||
komorebic focus-workspace 7
|
||||
alt + 9
|
||||
komorebic focus-workspace 8
|
||||
|
||||
# Move windows across workspaces
|
||||
alt + shift + 1
|
||||
komorebic move-to-workspace 0
|
||||
alt + shift + 2
|
||||
komorebic move-to-workspace 1
|
||||
alt + shift + 3
|
||||
komorebic move-to-workspace 2
|
||||
alt + shift + 4
|
||||
komorebic move-to-workspace 3
|
||||
alt + shift + 5
|
||||
komorebic move-to-workspace 4
|
||||
alt + shift + 6
|
||||
komorebic move-to-workspace 5
|
||||
alt + shift + 7
|
||||
komorebic move-to-workspace 6
|
||||
alt + shift + 8
|
||||
komorebic move-to-workspace 7
|
||||
alt + shift + 9
|
||||
komorebic move-to-workspace 8
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
# the komorebi sample configuration
|
||||
.shell pwsh
|
||||
|
||||
# Focus windows
|
||||
alt + h : komorebic focus left
|
||||
alt + j : komorebic focus down
|
||||
alt + k : komorebic focus up
|
||||
alt + l : komorebic focus right
|
||||
alt + shift + oem_4 : komorebic cycle-focus previous # oem_4 is [
|
||||
alt + shift + oem_6 : komorebic cycle-focus next # oem_6 is ]
|
||||
|
||||
# Move windows
|
||||
alt + shift + h : komorebic move left
|
||||
alt + shift + j : komorebic move down
|
||||
alt + shift + k : komorebic move up
|
||||
alt + shift + l : komorebic move right
|
||||
alt + shift + return : komorebic promote
|
||||
|
||||
# Stack windows
|
||||
ctrl + alt + left : komorebic stack left
|
||||
ctrl + alt + down : komorebic stack down
|
||||
ctrl + alt + up : komorebic stack up
|
||||
ctrl + alt + right : komorebic stack right
|
||||
alt + oem_1 : komorebic unstack # oem_1 is ;
|
||||
alt + oem_4 : komorebic cycle-stack previous # oem_4 is [
|
||||
alt + oem_6 : komorebic cycle-stack next # oem_6 is ]
|
||||
|
||||
# Workspace layer
|
||||
alt + shift + oem_1 : komorebic toggle-workspace-layer # oem_1 is ;
|
||||
|
||||
# Resize
|
||||
alt + oem_plus : komorebic resize-axis horizontal increase # oem_plus is +
|
||||
alt + oem_minus : komorebic resize-axis horizontal decrease # oem_minus is -
|
||||
alt + shift + oem_plus : komorebic resize-axis vertical increase
|
||||
alt + shift + oem_minus : komorebic resize-axis vertical decrease
|
||||
|
||||
# Manipulate windows
|
||||
alt + t : komorebic toggle-float
|
||||
alt + shift + t : komorebic toggle-workspace-float-override
|
||||
alt + shift + f : komorebic toggle-monocle
|
||||
|
||||
# Window manager options
|
||||
alt + shift + r : komorebic retile
|
||||
alt + p : komorebic toggle-pause
|
||||
alt + 0 : komorebic toggle-window-container-behaviour
|
||||
|
||||
# Layouts
|
||||
alt + x : komorebic flip-layout horizontal
|
||||
alt + y : komorebic flip-layout vertical
|
||||
alt + shift + x : komorebic session-float-rule
|
||||
|
||||
# Workspaces
|
||||
alt + 1 : komorebic focus-workspace 0
|
||||
alt + 2 : komorebic focus-workspace 1
|
||||
alt + 3 : komorebic focus-workspace 2
|
||||
alt + 4 : komorebic focus-workspace 3
|
||||
alt + 5 : komorebic focus-workspace 4
|
||||
alt + 6 : komorebic focus-workspace 5
|
||||
alt + 7 : komorebic focus-workspace 6
|
||||
alt + 8 : komorebic focus-workspace 7
|
||||
alt + 9 : komorebic focus-workspace 8
|
||||
|
||||
# Move windows across workspaces
|
||||
alt + shift + 1 : komorebic move-to-workspace 0
|
||||
alt + shift + 2 : komorebic move-to-workspace 1
|
||||
alt + shift + 3 : komorebic move-to-workspace 2
|
||||
alt + shift + 4 : komorebic move-to-workspace 3
|
||||
alt + shift + 5 : komorebic move-to-workspace 4
|
||||
alt + shift + 6 : komorebic move-to-workspace 5
|
||||
alt + shift + 7 : komorebic move-to-workspace 6
|
||||
alt + shift + 8 : komorebic move-to-workspace 7
|
||||
alt + shift + 9 : komorebic move-to-workspace 8
|
||||
@@ -0,0 +1,7 @@
|
||||
# one key, a different command in each application; kitty gets the key itself
|
||||
alt - n [
|
||||
"firefox" : komorebic focus-workspace 1
|
||||
"kitty" ~
|
||||
* : komorebic focus-workspace 0
|
||||
]
|
||||
alt - h : komorebic focus left
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
# one key, a different command in each application; kitty gets the key itself
|
||||
.shell pwsh
|
||||
|
||||
alt + n [
|
||||
firefox : komorebic focus-workspace 1
|
||||
kitty : Ignore
|
||||
Default : komorebic focus-workspace 0
|
||||
]
|
||||
|
||||
alt + h : komorebic focus left
|
||||
Reference in new issue
Block a user