use dbus-run-session and set XDG_CURRENT_DESKTOP
This commit is contained in:
parent
df9f2092e8
commit
1b13865ea0
2 changed files with 28 additions and 20 deletions
1
debian/control
vendored
1
debian/control
vendored
|
|
@ -21,6 +21,7 @@ Depends:
|
||||||
bash,
|
bash,
|
||||||
cosmic-comp,
|
cosmic-comp,
|
||||||
cosmic-greeter-daemon,
|
cosmic-greeter-daemon,
|
||||||
|
dbus,
|
||||||
greetd,
|
greetd,
|
||||||
${misc:Depends},
|
${misc:Depends},
|
||||||
${shlibs:Depends}
|
${shlibs:Depends}
|
||||||
|
|
|
||||||
|
|
@ -133,10 +133,9 @@ pub fn main() -> Result<(), Box<dyn Error>> {
|
||||||
.map(|dir| (dir, SessionType::Wayland))
|
.map(|dir| (dir, SessionType::Wayland))
|
||||||
.chain(
|
.chain(
|
||||||
xdg::BaseDirectories::with_prefix("xsessions")
|
xdg::BaseDirectories::with_prefix("xsessions")
|
||||||
.map_or(
|
.map_or(vec![PathBuf::from("/usr/share/xsessions")], |xdg_dirs| {
|
||||||
vec![PathBuf::from("/usr/share/xsessions")],
|
xdg_dirs.get_data_dirs()
|
||||||
|xdg_dirs| xdg_dirs.get_data_dirs(),
|
})
|
||||||
)
|
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|dir| (dir, SessionType::X11)),
|
.map(|dir| (dir, SessionType::X11)),
|
||||||
);
|
);
|
||||||
|
|
@ -207,6 +206,8 @@ pub fn main() -> Result<(), Box<dyn Error>> {
|
||||||
SessionType::X11 => {
|
SessionType::X11 => {
|
||||||
//TODO: xinit may be better, but more complicated to set up
|
//TODO: xinit may be better, but more complicated to set up
|
||||||
vec![
|
vec![
|
||||||
|
"dbus-run-session".to_string(),
|
||||||
|
"--".to_string(),
|
||||||
"startx".to_string(),
|
"startx".to_string(),
|
||||||
"/usr/bin/env".to_string(),
|
"/usr/bin/env".to_string(),
|
||||||
"XDG_SESSION_TYPE=x11".to_string(),
|
"XDG_SESSION_TYPE=x11".to_string(),
|
||||||
|
|
@ -214,12 +215,18 @@ pub fn main() -> Result<(), Box<dyn Error>> {
|
||||||
}
|
}
|
||||||
SessionType::Wayland => {
|
SessionType::Wayland => {
|
||||||
vec![
|
vec![
|
||||||
|
"dbus-run-session".to_string(),
|
||||||
|
"--".to_string(),
|
||||||
"/usr/bin/env".to_string(),
|
"/usr/bin/env".to_string(),
|
||||||
"XDG_SESSION_TYPE=wayland".to_string(),
|
"XDG_SESSION_TYPE=wayland".to_string(),
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if let Some(desktop_names) = entry.section("Desktop Entry").attr("DesktopNames") {
|
||||||
|
command.push(format!("XDG_CURRENT_DESKTOP={desktop_names}"));
|
||||||
|
}
|
||||||
|
|
||||||
match shlex::split(exec) {
|
match shlex::split(exec) {
|
||||||
Some(args) => {
|
Some(args) => {
|
||||||
for arg in args {
|
for arg in args {
|
||||||
|
|
@ -500,22 +507,22 @@ impl cosmic::Application for App {
|
||||||
let selected_session = session_names.first().cloned().unwrap_or(String::new());
|
let selected_session = session_names.first().cloned().unwrap_or(String::new());
|
||||||
|
|
||||||
let mut app = App {
|
let mut app = App {
|
||||||
core,
|
core,
|
||||||
flags,
|
flags,
|
||||||
surface_ids: HashMap::new(),
|
surface_ids: HashMap::new(),
|
||||||
active_surface_id_opt: None,
|
active_surface_id_opt: None,
|
||||||
surface_images: HashMap::new(),
|
surface_images: HashMap::new(),
|
||||||
surface_names: HashMap::new(),
|
surface_names: HashMap::new(),
|
||||||
text_input_ids: HashMap::new(),
|
text_input_ids: HashMap::new(),
|
||||||
network_icon_opt: None,
|
network_icon_opt: None,
|
||||||
power_info_opt: None,
|
power_info_opt: None,
|
||||||
socket_state: SocketState::Pending,
|
socket_state: SocketState::Pending,
|
||||||
username_opt: None,
|
username_opt: None,
|
||||||
prompt_opt: None,
|
prompt_opt: None,
|
||||||
session_names,
|
session_names,
|
||||||
selected_session,
|
selected_session,
|
||||||
error_opt: None,
|
error_opt: None,
|
||||||
};
|
};
|
||||||
let command = app.update(Message::Reconnect);
|
let command = app.update(Message::Reconnect);
|
||||||
(app, command)
|
(app, command)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue