Git Product home page Git Product logo

sapphire-wm's Introduction

SapphireWM

A minimal, lightweight, and extendable tile window manager written in Rust

Customization

One of the goals of Sapphire is to be as customizable as possible. Similar to awesome and dwm, Sapphire allows you to customize the behavior of the window manager by modifying the source code.

Keyboard and Keybindings

You can use the Keyboard struct to control keyboard events; a useful instance resides under your WindowManager instance.

To add a simple keybinding event, you can do:

wm.keyboard.append_keybindings(&[
    Keybinding::new()
        .on(&[modkey], "1")
        .group("Tag")
        .description("View tag[1].")
        .execute(Box::new(|ctx: EventContext| {
            let mut screen = ctx.screen.lock().unwrap();
            screen.view_tag(id)
        })),
]);

Mouse

The Mouse struct allows you to control globally events triggered by the mouse, such as clicks and entering on clients.

To enable the focus on click feature you can do something like:

wm.mouse.on(MouseEvent::Click, Box::new(|ctx: EventContext, info: MouseInfo| {
    let mut screen = ctx.screen.lock().unwrap();

    let tag = screen.get_focused_tag_mut()?;
    let focus_id = tag.get_focused_client().map_or(0, |c| c.id);

    if focus_id != info.c_id {
        tag.set_focused_client_if(info.c_id, |c| c.is_controlled());
    }

    Ok(())
}));

sapphire-wm's People

Contributors

heiytor avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.