Merge branch 'main' into kvark-linux
This commit is contained in:
commit
67555ee5b4
238 changed files with 6624 additions and 3524 deletions
|
@ -44,7 +44,7 @@ use std::{
|
|||
thread,
|
||||
time::Duration,
|
||||
};
|
||||
use theme::{ActiveTheme, ThemeRegistry, ThemeSettings};
|
||||
use theme::{ActiveTheme, SystemAppearance, ThemeRegistry, ThemeSettings};
|
||||
use util::{
|
||||
async_maybe,
|
||||
http::{self, HttpClient, ZedHttpClient},
|
||||
|
@ -127,6 +127,7 @@ fn main() {
|
|||
AppCommitSha::set_global(AppCommitSha(build_sha.into()), cx);
|
||||
}
|
||||
|
||||
SystemAppearance::init(cx);
|
||||
OpenListener::set_global(listener.clone(), cx);
|
||||
|
||||
load_embedded_fonts(cx);
|
||||
|
@ -475,6 +476,7 @@ fn init_paths() {
|
|||
fn init_logger() {
|
||||
if stdout_is_a_pty() {
|
||||
Builder::new()
|
||||
.parse_default_env()
|
||||
.format(|buf, record| {
|
||||
use env_logger::fmt::Color;
|
||||
|
||||
|
@ -814,7 +816,7 @@ async fn load_login_shell_environment() -> Result<()> {
|
|||
"SHELL environment variable is not assigned so we can't source login environment variables",
|
||||
)?;
|
||||
let output = Command::new(&shell)
|
||||
.args(["-lic", &format!("echo {marker} && /usr/bin/env -0")])
|
||||
.args(["-l", "-i", "-c", &format!("echo {marker}; /usr/bin/env -0")])
|
||||
.output()
|
||||
.await
|
||||
.context("failed to spawn login shell to source login environment variables")?;
|
||||
|
@ -896,27 +898,39 @@ fn load_user_themes_in_background(fs: Arc<dyn fs::Fs>, cx: &mut AppContext) {
|
|||
if let Some(theme_registry) =
|
||||
cx.update(|cx| ThemeRegistry::global(cx).clone()).log_err()
|
||||
{
|
||||
if let Some(()) = theme_registry
|
||||
.load_user_themes(&paths::THEMES_DIR.clone(), fs)
|
||||
let themes_dir = paths::THEMES_DIR.as_ref();
|
||||
match fs
|
||||
.metadata(themes_dir)
|
||||
.await
|
||||
.log_err()
|
||||
.ok()
|
||||
.flatten()
|
||||
.map(|m| m.is_dir)
|
||||
{
|
||||
cx.update(|cx| {
|
||||
let mut theme_settings = ThemeSettings::get_global(cx).clone();
|
||||
|
||||
if let Some(requested_theme) = theme_settings.requested_theme.clone() {
|
||||
if let Some(_theme) = theme_settings.switch_theme(&requested_theme, cx)
|
||||
{
|
||||
ThemeSettings::override_global(theme_settings, cx);
|
||||
}
|
||||
}
|
||||
})
|
||||
.log_err();
|
||||
Some(is_dir) => {
|
||||
anyhow::ensure!(is_dir, "Themes dir path {themes_dir:?} is not a directory")
|
||||
}
|
||||
None => {
|
||||
fs.create_dir(themes_dir).await.with_context(|| {
|
||||
format!("Failed to create themes dir at path {themes_dir:?}")
|
||||
})?;
|
||||
}
|
||||
}
|
||||
theme_registry.load_user_themes(themes_dir, fs).await?;
|
||||
cx.update(|cx| {
|
||||
let mut theme_settings = ThemeSettings::get_global(cx).clone();
|
||||
if let Some(theme_selection) = theme_settings.theme_selection.clone() {
|
||||
let theme_name = theme_selection.theme(*SystemAppearance::global(cx));
|
||||
|
||||
if let Some(_theme) = theme_settings.switch_theme(&theme_name, cx) {
|
||||
ThemeSettings::override_global(theme_settings, cx);
|
||||
}
|
||||
}
|
||||
})?;
|
||||
}
|
||||
anyhow::Ok(())
|
||||
}
|
||||
})
|
||||
.detach();
|
||||
.detach_and_log_err(cx);
|
||||
}
|
||||
|
||||
//todo!(linux): Port fsevents to linux
|
||||
|
@ -945,11 +959,14 @@ fn watch_themes(fs: Arc<dyn fs::Fs>, cx: &mut AppContext) {
|
|||
cx.update(|cx| {
|
||||
let mut theme_settings = ThemeSettings::get_global(cx).clone();
|
||||
|
||||
if let Some(requested_theme) =
|
||||
theme_settings.requested_theme.clone()
|
||||
if let Some(theme_selection) =
|
||||
theme_settings.theme_selection.clone()
|
||||
{
|
||||
let theme_name =
|
||||
theme_selection.theme(*SystemAppearance::global(cx));
|
||||
|
||||
if let Some(_theme) =
|
||||
theme_settings.switch_theme(&requested_theme, cx)
|
||||
theme_settings.switch_theme(&theme_name, cx)
|
||||
{
|
||||
ThemeSettings::override_global(theme_settings, cx);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue