Animated desktop companion, making Ferris the crab move across your screen and react to your scrolling and clicks.
ferris-animated-wall
is a simple Rust application that spawns a transparent, borderless window on X11-based Linux desktops, rendering an animated Ferris crab that wanders across your screen, without affecting the interaction with the rest of the system.
This project was originally created as a first exploration of the Rust programming language, serving as a way to learn and better understand its ecosystem.
- Create a new X11 window with given opacity and type (desktop vs dock)
- Load the .png images
- Communicate with the X11 server to get the relevant system information
- Use the XFixes and Shape extensions extension to make the window click-through
- Use the Shape extension to remove the background of the image
- Use the XInput to catch raw button press events
- Make the created image move randomly on click and in the direction of the cursor on scroll events
Prerequisites :
- A Linux system with X11 server running. Shape / XFixes / XInput extensions are also needed.
- Rust installed (with
cargo
package manager).
Installation steps :
- Clone the repository.
git clone https://github.com/delcourtfl/ferris-animated-wall.git
- Navigate to the project directory.
cd ferris-animated-wall/
- Build and run the project.
cargo run --release
# or with custom parameters:
cargo run --release -- --speed 50 --width 100 --opacity 120
-
--width
(u16
, default:120
)
The ouput width of the displayed image in pixels. -
--height
(u16
, default:120
)
The ouput height of the displayed image in pixels. -
--alpha_threshold
(u8
, default:200
)
The minimum alpha (transparency) value the image pixel must have to be visible. -
--opacity
(u8
, default:192
)
The opacity of the application window. -
--speed
(u16
, default:80
)
The speed at which the image moves to the cursor position. -
--in_background
(bool
, default:false
)
If set totrue
, the window will stay behind all others (desktop/background mode).
Iffalse
, the window stays on top (dock/overlay mode).
- Rust programming language.
- x11rb for rust X11 bindings.
- X11 server the X Window System for window management (client-server architecture).
- Support multiple animations / images at the same time.
- Fetch and display messages (Xft over x11 core font as they are deprecated ?).
- React to some user events.
- The nice
x11rb
repository tutorial, examples, and xtrace implementation (https://github.com/psychon/x11rb/tree/master/x11rb/examples) which helped a lot. X11 protocol
documentation website (https://www.x.org/releases/X11R7.6/doc/).Ferris
artworks by the Rust community (https://rustacean.net/).