XDGkit
The ultimate XDG library and command line tool! Everything is copy-pasted from (freedesktop.org)[http://freedesktop.org] and rustified as enums and structs with implementations in main for a binary tool to use the specs!
This work could technically regenerate the website documentation via doxygen because Rust is like that. But I didn't actually do anything to make it possible, though the code is stupidly simple... really mostly Ctrl+C in firefox and Ctrl+V in Kate.
I had to make up some enums for things like Type
in the desktop_entry format.
NOTICE FOR ALL FIELDS IN STRUCTS
CamelCase
is converted consistently as camel_case
, as you would expect knowing rust's compiler from compiling once differently.
Type
is xdg_type
which is quickly intuitive WHY, since type
is a reserved word. Type
occurs in all of the ini-style configuration files in the XDG standards.
enums are generally fine as-is, however I added IconContext::Unknown
basedir
This uses std::env and returns Result<String, VarError> as does std::env This provides all the normal XDG variables, as well as locations for icons, menu/directory files, desktop files, and the autostart directories
desktop_entry
Reads in a desktop file and turns it into a struct which can be accessed for any of the desktop file features you will find in the freedesktop spec.
As a library this returns a struct of mostly Option<whatever>
As a CLI utility it returns a String printed on a new line (or a blank line if the field is empty that you are looking for. In other words, you will need something like:
icon_theme
Reads an index.theme
ini-style file and turns it into a struct of Option<whatever>
which can be accessed for any of the icon theme spec features you will find in the freedesktop spec, or the documentation of this library/program.
As a CLI utility it returns a String printed on a new line (or a blank line if the field is empty that you are looking for. In other words, you will need something like:
The thought is that someeone could use terminal GUI libraries and map out svg
files perhaps as icons (in the current theme).
WORKS IN PROGRESS
desktop_menu
This reads the menu file and generates a struct containing the entire menu which can be fed into another program to output it into a specific format.
directory_file
This reads the directory files used by the desktop_menu