Support for `/etc/X11/Sessions`, `/usr/share/xsessions` and `/usr/share/wayland-sessions`
As posted out on Reddit, the /etc/X11/Sessions is a default location for X11 xinit scripts. This should probably also be used as a source location.
Support for .desktop files in /usr/share/xsessions/ and /usr/share/wayland-sessions/ would be great addition.
After some bugfixes, I will have a look at this as the first feature to add again
That code snippet may help with reading exists xsessions.
use std::fs::read_dir;
use freedesktop_entry_parser::parse_entry;
pub fn search() {
let paths = read_dir("/usr/share/xsessions").unwrap();
for path in paths {
let session_path = path.unwrap().path();
println!("Name: {}", session_path.display());
let entry = parse_entry(session_path).unwrap();
let name = entry
.section("Desktop Entry")
.attr("Name")
.unwrap();
let cmd = entry
.section("Desktop Entry")
.attr("Exec")
.unwrap();
println!("{} -> {:?}", name, cmd);
}
Thank you.
I did look into this. There are two rust crates for parsing Desktop Entries and both use a license incompatible with this project. I wrote a parsing library that I’ll probably end up using.