Skip to content

Zig terminal history stats viewer with Raylib. Take a look at your commands frequency on a GUI.

License

Notifications You must be signed in to change notification settings

RomaricKc1/zistory

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ZISTORY

Zig terminal history stats viewer with Raylib. Take a look at your commands frequency on a GUI.

Pretty rough visuals (WIP). But it kinda works.

Made with Raylib-zig and two (2) custom widgets designed specificaly for the project. Nonetheless, they can be adapted to suit ones own need.

Raylib-bar_char and Raylib-list

Tested on Zig version 0.15.0-dev.936+fc2c1883b, 0.14.1.

Demo

Main screen About (empty now)
main about

The bar graph widget shows the current command count and the day of the week. e.g.: the cmd clear has been recored 39x on thursday, from today's date 19/7/2025 (dd/mm/yyyy). This is the weekly data view.

The list widget shows all the recored commands with -> indicating all instances of the current active one.

Usage

Important

The reader looks by default for "~/.zsh_history_backup" meaning that you have to create a backup of your history file in case anything goes wrong. I don't think it will, but better be safe.

You can also pass a file as you wish, using the -f option.

Note

This is configured to work on wayland. If you are on x11, you'll need to change the display backend.

In all of the raylib dependency.

const raylib_dep = b.dependency("raylib_zig", .{
    .target = target,
    .optimize = optimize,
    .linux_display_backend = .X11,
});

Key-bindings

j and k => to cycle through the list of commands on the list widget.

h and l => to cycle through the timespan of the data shown. Currently support is only avail for week and month.

a to exit. Somehow, raylib requires the key a on my french keyboard to exit. There's a flag for a custom key (-q).

Note

Only support history files with timestamps. Right now it's tailored to zsh history.

Options

Options:
    -L, --window_width <WIDTH>                        window width (default 800)
    -l, --window_height <HEIGHT>                      window height (default 540)
    -s, --fps <FPS>                                   fps count (default 60)
    -n, --cmd_cnt <CMD_CNT>                           number of entries to read from the history file (default 103)
    -t, --time <TIME>                                 timestamp from which to read the entries (default current time)
    -k, --elm_on_list_cnt <LIST_SHOWN_CNT>            the number of the list's entries to show at once
    -f, --history_file <HIST_FILE>                    your history file. default for zsh -> "~/.zsh_history", make a backup ( "~/.zsh_history_backup") for it first
    -q, --exit_key <EXIT_KEY>                         key used to exit. default ('a')
    -v, --version                                     Display version information.
    -h, --help                                        Display this help and exit.

TODO:

  • option to target wayland / x11 automatically
  • ui element won't scale up pretty well when changing the default window dimensions
  • add key-binding for gg and GG to quickly jump to the beginning and the end of the list
  • maybe, add a search support to quicly jump into a desired command data
  • look for integrating other shell history file.

But why?

It is a toy project on my journey of learning ZIG. I learned a lot while making this project.

About

Zig terminal history stats viewer with Raylib. Take a look at your commands frequency on a GUI.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages