A small tool to use along with i3/Sway to add CSS-powered decorations to your focused windows, for better usability.

Related tags

GUI css i3 gtk3
Overview

glimmer

What

A tool for decorating i3 windows when they get focused, written in Rust.

classic.mp4

Why

When using i3-gaps I ran into the following problems.

  • Glitches when using regular borders and titlebars that showed up in the background (as described here), which as far as I know haven't been solved yet.
  • The above meant usually relying on transparency or dimming to have a 'highlighted' state, which for me at least beats the purpose of having all your windows in a tiled fashion. To get the highlighted effect you have to lower the opacity or dim it to the point it's too hard to read.
  • Even if borders and titlebars did work properly. They just don't gel very well with the a e s t h e t i c anyway.

Eventually I gave up and continued using vanilla i3 instead, but had this idea floating around. It focuses on those shortcomings. Does it solve them? Not too sure myself, but it was a fun experiment.

Requirements

  • i3 (Note that Sway is not currently supported)
  • A compositor, since it literally draws windows on top of your windows.
  • GTK needs to be on your system to build this application, follow the instructions here

For building:

  • Rust v1.5x, currently only tested with v1.53.0
cargo build && cargo run

Installation

Pre built binaries

You can download a pre built-binary from the releases page

Cargo

Remember to read the requirements above!

cargo install glimmer

Running and customizing

glimmer --styles=./path/to/your/theme.css

The css file dictates how the window decorations look like, and they have 2 elements to customize, #box which represents the boundaries of the window and #label, which has the window title. Additionally, there's an .animate class applied to the parent which can help triggering animations for both the box and label.

There are some examples of this in the themes directory. Feel free to contribute more!

Note that the CSS is not full spec, and you can see the supported properties by GTK here

A simple example for this, animated using transitions:

#box {
  background: rgba(255, 200, 0, 0.2);
  transition: background 2s ease, margin 0.2s ease;
  margin: 10px;
}

.animate #box {
  background: transparent;
  margin: 0px;
}

#label {
  opacity: 0; /* Hide the label */
}

This will produce the following

flash.mp4
Comments
  • [Sway] Cannot run

    [Sway] Cannot run

    Hi,

    When I run cargo run, I got this error:

    $ cargo run
        Finished dev [unoptimized + debuginfo] target(s) in 0.05s
         Running `target/debug/glimmer`
    thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: Custom { kind: InvalidData, error: Error("unknown variant `none`, expected one of `splith`, `splitv`, `stacked`, `tabbed`, `dockarea`, `output`", line: 1, column: 181) }', src/actors/i3_ipc.rs:74:51
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    

    Cargo and Rust version:

    $ cargo --version
    cargo 1.53.0 (4369396ce 2021-04-27)
    
    $ rustc --version
    rustc 1.53.0 (53cb7b09b 2021-06-17)
    

    Really like the idea, so I really want to try it.

    opened by ductri 9
  • Question: is the normal i3 (not i3-gaps) supported?

    Question: is the normal i3 (not i3-gaps) supported?

    Versions

    %i3 --version
    i3 version 4.20.1 (2021-11-03) © 2009 Michael Stapelberg and contributors
    

    I've downloaded the prebuilt glimmer 0.0.2 from the release page.

    Problem

    I'm using the normal i3, not i3-gaps. When I try to use glimmer, I get the following error.

    %./glimmer --styles ~/git_repository/glimmer/themes/example.css 
    thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: Custom { kind: InvalidData, error: Error("unknown variant `machine`, expected one of `title`, `instance`, `class`, `window_role`, `transient_for`", line: 1, column: 727) }', src/actors/i3_ipc.rs:74:51
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    ^C
    

    Is this error due to not using i3-gaps? If it is, can I submit a PR to replace all the occurrences of the word i3 with i3-gaps to remove the confusion?

    Reproduction

    1. Download the binary
    2. Run glimmer
    3. Change the window focus by moving the mouse cursor.

    (BTW, i3-gaps is merged into i3 (PR). I think all the occurrences of i3-gaps should be replaced with "i3 with the gaps feature" or something.)

    opened by toku-sa-n 3
  • `cargo install glimmer` raises a few compile errors

    `cargo install glimmer` raises a few compile errors

    Hello. I tried to install glimmer via cargo install glimmer, but it failed due to several compile errors.

        Updating crates.io index
      Installing glimmer v0.0.1
       Compiling proc-macro2 v1.0.47
       Compiling quote v1.0.21
       Compiling unicode-ident v1.0.5
       Compiling syn v1.0.103
       Compiling thiserror v1.0.37
       Compiling serde v1.0.147
       Compiling serde_derive v1.0.147
       Compiling unicode-segmentation v1.10.0
       Compiling anyhow v1.0.66
       Compiling smallvec v1.10.0
       Compiling either v1.8.0
       Compiling pkg-config v0.3.26
       Compiling version-compare v0.0.11
       Compiling strum v0.21.0
       Compiling libc v0.2.137
       Compiling autocfg v1.1.0
       Compiling futures-core v0.3.25
       Compiling pin-project-lite v0.2.9
       Compiling cfg-if v1.0.0
       Compiling version_check v0.9.4
       Compiling futures-task v0.3.25
       Compiling futures-util v0.3.25
       Compiling once_cell v1.16.0
       Compiling pin-utils v0.1.0
       Compiling bitflags v1.3.2
       Compiling scopeguard v1.1.0
       Compiling futures-channel v0.3.25
       Compiling parking_lot_core v0.9.4
       Compiling log v0.4.17
       Compiling memchr v2.5.0
       Compiling ucd-trie v0.1.5
       Compiling bytes v1.2.1
       Compiling gio v0.14.8
       Compiling serde_json v1.0.88
       Compiling crossbeam-utils v0.8.12
       Compiling futures-io v0.3.25
       Compiling parking_lot_core v0.8.5
       Compiling futures-sink v0.3.25
       Compiling ryu v1.0.11
       Compiling itoa v1.0.4
       Compiling os_str_bytes v6.4.0
       Compiling hashbrown v0.12.3
       Compiling strsim v0.10.0
       Compiling termcolor v1.1.3
       Compiling textwrap v0.16.0
       Compiling itertools v0.10.5
       Compiling cfg-expr v0.8.1
       Compiling instant v0.1.12
       Compiling slab v0.4.7
       Compiling lock_api v0.4.9
       Compiling tokio v1.22.0
       Compiling memoffset v0.6.5
       Compiling indexmap v1.9.2
       Compiling heck v0.3.3
       Compiling proc-macro-error-attr v1.0.4
       Compiling proc-macro-error v1.0.4
       Compiling gtk v0.14.3
       Compiling clap_lex v0.2.4
       Compiling crossbeam-channel v0.5.6
       Compiling signal-hook-registry v1.4.0
       Compiling num_cpus v1.14.0
       Compiling mio v0.8.5
       Compiling socket2 v0.4.7
       Compiling atty v0.2.14
       Compiling parking_lot v0.12.1
       Compiling clap v3.2.23
       Compiling parking_lot v0.11.2
       Compiling futures-executor v0.3.25
       Compiling thiserror-impl v1.0.37
       Compiling strum_macros v0.21.1
       Compiling tokio-macros v1.8.0
       Compiling serde_repr v0.1.9
       Compiling actix_derive v0.6.0
       Compiling pest v2.4.1
       Compiling semver-parser v0.10.2
       Compiling semver v0.11.0
       Compiling rustc_version v0.3.3
       Compiling field-offset v0.3.4
       Compiling tokio-util v0.6.10
       Compiling tokio-stream v0.1.11
       Compiling actix-rt v2.7.0
       Compiling actix v0.12.0
       Compiling toml v0.5.9
       Compiling i3ipc-types v0.12.0
       Compiling system-deps v3.2.0
       Compiling proc-macro-crate v1.2.1
       Compiling glib-macros v0.14.1
       Compiling gtk3-macros v0.14.0
       Compiling glib-sys v0.14.0
       Compiling gobject-sys v0.14.0
       Compiling gio-sys v0.14.0
       Compiling cairo-sys-rs v0.14.9
       Compiling gdk-pixbuf-sys v0.14.0
       Compiling pango-sys v0.14.0
       Compiling atk-sys v0.14.0
       Compiling gdk-sys v0.14.0
       Compiling gtk-sys v0.14.0
       Compiling tokio-i3ipc v0.12.1
       Compiling glib v0.14.8
       Compiling pango v0.14.8
       Compiling cairo-rs v0.14.9
       Compiling atk v0.14.0
       Compiling gdk-pixbuf v0.14.0
       Compiling gdk v0.14.3
       Compiling glimmer v0.0.1
    error[E0432]: unresolved import `clap::Clap`
     --> /home/hiroki/.cargo/registry/src/github.com-1ecc6299db9ec823/glimmer-0.0.1/src/main.rs:3:25
      |
    3 | use clap::{AppSettings, Clap};
      |                         ^^^^ no `Clap` in the root
    
    error: cannot determine resolution for the derive macro `Clap`
     --> /home/hiroki/.cargo/registry/src/github.com-1ecc6299db9ec823/glimmer-0.0.1/src/main.rs:8:10
      |
    8 | #[derive(Clap)]
      |          ^^^^
      |
      = note: import resolution is stuck, try simplifying macro imports
    
    error: cannot find attribute `clap` in this scope
     --> /home/hiroki/.cargo/registry/src/github.com-1ecc6299db9ec823/glimmer-0.0.1/src/main.rs:9:3
      |
    9 | #[clap(version = "0.0.1")]
      |   ^^^^
      |
      = note: `clap` is in scope, but it is a crate, not an attribute
    
    error: cannot find attribute `clap` in this scope
      --> /home/hiroki/.cargo/registry/src/github.com-1ecc6299db9ec823/glimmer-0.0.1/src/main.rs:10:3
       |
    10 | #[clap(setting = AppSettings::ColoredHelp)]
       |   ^^^^
       |
       = note: `clap` is in scope, but it is a crate, not an attribute
    
    error: cannot find attribute `clap` in this scope
      --> /home/hiroki/.cargo/registry/src/github.com-1ecc6299db9ec823/glimmer-0.0.1/src/main.rs:12:7
       |
    12 |     #[clap(short, long, default_value = "./style.css")]
       |       ^^^^
       |
       = note: `clap` is in scope, but it is a crate, not an attribute
    
    error[E0599]: no function or associated item named `parse` found for struct `Opts` in the current scope
      --> /home/hiroki/.cargo/registry/src/github.com-1ecc6299db9ec823/glimmer-0.0.1/src/main.rs:17:22
       |
    11 | struct Opts {
       | ----------- function or associated item `parse` not found for this
    ...
    17 |     let opts = Opts::parse();
       |                      ^^^^^ function or associated item not found in `Opts`
       |
       = help: items from traits can only be used if the trait is implemented and in scope
       = note: the following traits define an item `parse`, perhaps you need to implement one of them:
               candidate #1: `Parser`
               candidate #2: `TypedValueParser`
    
    Some errors have detailed explanations: E0432, E0599.
    For more information about an error, try `rustc --explain E0432`.
    error: failed to compile `glimmer v0.0.1`, intermediate artifacts can be found at `/tmp/cargo-install8YUZGp`
    
    Caused by:
      could not compile `glimmer` due to 6 previous errors
    
    
    I can build both 0.0.1 and 0.0.2 by cloning the repository and checking out the versions.

    Rustc: 1.65.0

    For rustc 1.53.0 which is a tested version (as the readme says), an error related to Rust 2021 is raised.

        Updating crates.io index
      Installing glimmer v0.0.1
    error: failed to compile `glimmer v0.0.1`, intermediate artifacts can be found at `/tmp/cargo-install2wxhGA`
    
    Caused by:
      failed to download `clap v3.2.23`
    
    Caused by:
      unable to get packages from source
    
    Caused by:
      failed to parse manifest at `/home/hiroki/.cargo/registry/src/github.com-1ecc6299db9ec823/clap-3.2.23/Cargo.toml`
    
    Caused by:
      feature `edition2021` is required
    
      this Cargo does not support nightly features, but if you
      switch to nightly channel you can add
      `cargo-features = ["edition2021"]` to enable this feature
    
    opened by toku-sa-n 2
  • Make previous decoration disappear when switching workspaces/windows

    Make previous decoration disappear when switching workspaces/windows

    Hello,

    First of all, thank you for this nice tool, I really like it. Customizing it with css is awesome.

    I noticed that when you switch windows very quickly, they end up all having decorations which is a bit distracting but OK. The issue is more pronounced when you have a window taking a part of your monitor, switch to it, then quickly change to another workspace containing a full screen window.

    You'll end up seeing the frame of the half size window inside the full screen window whereas it is not even in the same workspace. Weird :)

    Anyway, it's a small thing but I wonder if it would be possible to cancel the ongoing animation when switching windows.

    opened by geowarin 1
  • Draft: Feat/sway

    Draft: Feat/sway

    This is my go at adding sway compatibility. This shouldn't break anything on i3.

    • I updated the dependencies
    • Added a --use-sway option (probably some way to detect automatically)
    • I used swayipc to do the equivalent of i3_ipc
    • I wrapped their different (but quite similar) types for the rest of the program to run similarly.

    There is at least one bug I am aware of, there are probably more : On sway + weston + xwayland,

    • the popup windows steal focus
    • because they steal focus, when they die, the focus changes and a popup window spawns again

    I am unsure how to solve this, even less how to investigate, this might be a xwayland bug or a weston bug or something else.

    Please let me know your feedback, thoughts and ideas. Have a nice day.

    opened by nardoor 0
Owner
Daniel Acuña
Concerned about concerns.
Daniel Acuña
A cross-platform GUI library for Rust focused on simplicity and type-safety

A cross-platform GUI library for Rust, inspired by Elm

Héctor Ramón 17.5k Jan 8, 2023
Better GNOME Desktop Experience

Better GNOME Desktop Experience Tired of having the best feeling DE with the worst defaults? This app is for you. Transform the default GNOME look to:

Dimitar Dimitrov 3 May 10, 2022
A small tool to display markdown files as a slideshow.

Rusty Slider A small tool to display markdown files as a slideshow. Demo Try out Rusty Slider online: Example slideshows. Download Rusty Slider is ava

Olle Wreede 37 Dec 21, 2022
A Modern, Open Source GTK4 ebook manager powered by Rust.

Bookx An MVP in progress: An ebook reader with .epub support Context menu for each book (delete, rename book, info) On click switch the carousal to th

Anurag Dhadse 12 Dec 28, 2022
OS-native file dialogs on Linux, OS X and Windows

nfd-rs nfd-rs is a Rust binding to the library nativefiledialog, that provides a convenient cross-platform interface to opening file dialogs on Linux,

Saurav Sachidanand 152 Nov 9, 2022
Rust docs for the Windows API

Windows API documentation for Rust This is an experimental documentation generator for the Rust for Windows project. The documentation is published he

Microsoft 52 Dec 9, 2022
A tiling window manager for Windows

komorebi Tiling Window Management for Windows. About komorebi is a tiling window manager that works as an extension to Microsoft's Desktop Window Mana

Jade (جاد) 2.6k Jan 1, 2023
Tiny library for handling rust strings in windows.

tinywinstr Tiny library for handling rust strings in windows.

Ed Way 1 Oct 25, 2021
OS native dialogs for Windows, MacOS, and Linux

?? nfd2 nfd2 is a Rust binding to the nativefiledialog library, that provides a convenient cross-platform interface to opening file dialogs on Windows

Embark 33 May 15, 2022
A light windows GUI toolkit for rust

Native Windows GUI Welcome to Native Windows GUI (aka NWG). A rust library to develop native GUI applications on the desktop for Microsoft Windows. NW

Gabriel Dube 1.6k Jan 7, 2023
Winsafe-examples - Examples of native Windows applications written in Rust with WinSafe.

WinSafe examples This repo contains several examples of native Win32 applications written in Rust with WinSafe. All examples follow the same program s

Rodrigo 40 Dec 14, 2022
A cross-platform Mod Manager for RimWorld intended to work with macOS, linux and Windows

TODOs are available here. Discussions, PRs and Issues are open for anyone who is willing to contribute. rrm Inspired by Spoons rmm. This is a cross-pl

Alejandro Osornio 7 Sep 5, 2022
⚡ A blazing fast alternative to the default Windows delete.

Turbo Delete A blazing fast alternative to the default Windows delete. Turbodelete is a blazing fast alternative to the default Windows delete functio

Tejas Ravishankar 165 Dec 4, 2022
Vibe - a library for acrylic/vibrancy effects for Electron on Windows 10/11

vibe is a library for acrylic/vibrancy effects for Electron on Windows 10/11. Any Electron version compatible with N-API v6 (Electron v11+) is supported.

pyke 23 Dec 14, 2022
Windows Native Undocumented API for Rust Language 🔥

Windows Native   The Windows-Native Rust library provides a convenient and safe way to access the native Windows undocumented APIs using the Rust prog

null 3 Aug 22, 2023
A powerful desktop widget app for windows, built with Vue and Tauri.

DashboardX Widgets A powerful desktop widget app for windows, built with Vue and Tauri. Still in development Currently only runs on windows (uses nati

DashboardX Widgets 3 Oct 25, 2023
A small dice roller app with GUI written in Rust 🦀🎲

?? Mini Dice A small dice roller written in Rust and using the egui library. Demo ?? A short introduction... I started creating Mini Dice with the goa

Angelica Raborar 4 May 16, 2023
An easy-to-use, 2D GUI library written entirely in Rust.

Conrod An easy-to-use, 2D GUI library written entirely in Rust. Guide What is Conrod? A Brief Summary Screenshots and Videos Feature Overview Availabl

PistonDevelopers 3.3k Jan 1, 2023
egui: an easy-to-use immediate mode GUI in pure Rust

?? egui: an easy-to-use GUI in pure Rust egui is a simple, fast, and highly portable immediate mode GUI library for Rust. egui runs on the web, native

Emil Ernerfeldt 12.6k Jan 3, 2023