mirror of
https://github.com/elkowar/eww.git
synced 2024-10-03 22:48:31 +03:00
Compare commits
3 Commits
bd09b881af
...
14d505129e
Author | SHA1 | Date | |
---|---|---|---|
|
14d505129e | ||
|
ae02881562 | ||
|
c322a51e6f |
@ -81,17 +81,17 @@ macro_rules! define_magic_constants {
|
||||
}
|
||||
}
|
||||
define_magic_constants! { eww_paths,
|
||||
// @desc EWW_CONFIG_DIR (Magic constant) - Path to the eww configuration of the current process
|
||||
// @desc EWW_CONFIG_DIR - Path to the eww configuration of the current process
|
||||
"EWW_CONFIG_DIR" => DynVal::from_string(eww_paths.get_config_dir().to_string_lossy().into_owned()),
|
||||
|
||||
// @desc EWW_CMD (Magic constant) - eww command running in the current configuration, useful in event handlers. I.e.: `:onclick "${EWW_CMD} update foo=bar"`
|
||||
// @desc EWW_CMD - eww command running in the current configuration, useful in event handlers. I.e.: `:onclick "${EWW_CMD} update foo=bar"`
|
||||
"EWW_CMD" => DynVal::from_string(
|
||||
format!("\"{}\" --config \"{}\"",
|
||||
std::env::current_exe().map(|x| x.to_string_lossy().into_owned()).unwrap_or_else(|_| "eww".to_string()),
|
||||
eww_paths.get_config_dir().to_string_lossy().into_owned()
|
||||
)
|
||||
),
|
||||
// @desc EWW_EXECUTABLE (Magic constant) - Full path of the eww executable
|
||||
// @desc EWW_EXECUTABLE - Full path of the eww executable
|
||||
"EWW_EXECUTABLE" => DynVal::from_string(
|
||||
std::env::current_exe().map(|x| x.to_string_lossy().into_owned()).unwrap_or_else(|_| "eww".to_string()),
|
||||
),
|
||||
|
@ -33,6 +33,7 @@ pub fn initialize_server<B: DisplayBackend>(
|
||||
log::info!("Loading paths: {}", &paths);
|
||||
|
||||
let read_config = config::read_from_eww_paths(&paths);
|
||||
|
||||
let eww_config = match read_config {
|
||||
Ok(config) => config,
|
||||
Err(err) => {
|
||||
@ -41,10 +42,6 @@ pub fn initialize_server<B: DisplayBackend>(
|
||||
}
|
||||
};
|
||||
|
||||
for (name, definition) in config::inbuilt::get_magic_constants(&paths) {
|
||||
std::env::set_var(name.0, definition.initial_value.0);
|
||||
}
|
||||
|
||||
cleanup_log_dir(paths.get_log_dir())?;
|
||||
|
||||
if should_daemonize {
|
||||
|
@ -4,6 +4,3 @@ These are variables that are always there, without you having to import them.
|
||||
|
||||
The delay between all the updating variables except `EWW_TIME` is 2s, for `EWW_TIME` it is 1s.
|
||||
|
||||
There are also `magic constants`, marked with `(Magic constant)` after the variable's name. As the name implies, they do not change.
|
||||
You can also access them in your scripts since they are automatically exported as environmental variables!
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user