lemurs icon indicating copy to clipboard operation
lemurs copied to clipboard

Support for `/etc/X11/Sessions`, `/usr/share/xsessions` and `/usr/share/wayland-sessions`

Open coastalwhite opened this issue 3 years ago • 4 comments

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.

coastalwhite avatar Nov 22 '22 21:11 coastalwhite

Support for .desktop files in /usr/share/xsessions/ and /usr/share/wayland-sessions/ would be great addition.

Piroro-hs avatar Dec 04 '22 15:12 Piroro-hs

After some bugfixes, I will have a look at this as the first feature to add again

coastalwhite avatar Dec 04 '22 20:12 coastalwhite

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);
}

vit1251 avatar May 06 '23 12:05 vit1251

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.

coastalwhite avatar May 06 '23 13:05 coastalwhite