┌──────────────────────────────────┐
	│ bgce.                            │
	│     |\                           │
	│      ^                           │
	│                   ┌───────┐      │
	│      ┌───────┐    │       │      │
	│      │       │    │       │      │
	│      │       │    │       │      │
	│      │       │    │       │      │
	│      └───────┘    └───────┘      │
	│                                  │
	└──────────────────────────────────┘

log | tree | refs


bgce: brian's graphical computer environment

bgce is a minimal graphical environment for linux
written in c. it acts as a bare-bones window system
similar to xorg or wayland, but much simpler and
designed to run without root privileges.

zoomable virtual desktop — the canvas is larger
than the screen. zoom in to focus, zoom out to see
the whole workspace, pan to move around.


overview

the system is split into two components:

- server: manages video buffer, input events, and
  window stacking.
- client: applications that render to their own
  buffers and request drawing through the server.

to keep track of the develoment check the commit log
on the feed.

here's a screenshot.


zoom & virtual desktop

the desktop is a virtual canvas larger than the
physical display, with a zoomable viewport:

- canvas: 2× physical size on each axis
  (4× screen area)
- zoom range: 50%–400% (100% = 1:1 pixels)
- alt + scroll — zoom in/out toward the cursor
- alt + left-drag on empty space — pan
- alt + left-drag on a window — move
- alt + right-drag on a window — resize

new apps size themselves for the current zoom so an
800×600 window still looks about that large on screen
whether you are zoomed in or out. wallpaper can cover
the full virtual desktop (scaled mode stretches across
the whole canvas).

pan and window moves only repaint revealed edges —
fast on a pure software compositor.


download

source snapshot (no git history):

bgce.tar.gz

curl -fsSL -o bgce.tar.gz https://terminal.pink/bgce/bgce.tar.gz
tar xzf bgce.tar.gz
cd bgce

or clone the repository:

git clone https://terminal.pink/bgce
cd bgce

 
goals

- minimal, understandable graphics stack in c
- no external dependencies like opengl, x11 etc
- educational reference for framebuffer-based
  compositing, zoom/pan, and ipc


build instructions

make all client
./bgce   # run server
./client # run test client (in another tty)

  
configuration

bgce supports configuration through a config file.
by default, it looks for `~/.config/bgce.conf`.

config file format

[background]
# background type: "color" or "image"
type = color

# for color background:
color = #rrggbb   # hex color code
# or
color = #rrggbbaa # hex color with alpha

# for image background:
#path = /path/to/image.png
#mode = tiled     # or "scaled"

[shortcuts]
# define keyboard shortcuts. format:
#  = :
#
# type is one of:
#   builtin  - value must be "exit" or "screenshot"
#   command  - program + args (execvp, no shell; "quote" args)
#
# combo examples: ctrl+alt+q, sysrq, f12, ctrl+shift+s, super+r

# defaults (active when no [shortcuts] section is present or it is empty):
# ctrl+alt+q = builtin:exit
# sysrq = builtin:screenshot


example config file

[background]
type = color
color = #336699

or

[background]
type = image
path = /usr/share/backgrounds/default.png
mode = scaled

with custom shortcuts:

[shortcuts]
ctrl+alt+q = builtin:exit
sysrq = builtin:screenshot

# launch programs: fork + execvp (no /bin/sh)
ctrl+alt+t = command:alacritty
super+r = command:rofi -show drun
f12 = command:import -window root /tmp/screenshot.png


notes

- scaled images look horrible.


developing client applications

bgce clients should write directly to the buffer
and call draw(), so the server will draw it to the
screen. when users resize the window an event is
sent to the client, applications then should adjust
its content and call draw().

you are free to choose any libraries to help with
drawing graphical elements. to be honest i don't
know if the most common ones can directly handle
buffers. so i am creating a toolkit: bgtk, check it
out if you want.

license

bsd 2-clause license.