Compare commits

...

3 Commits

Author SHA1 Message Date
ovalkonia
14d505129e Revert "docs: add magic constants descriptions (or at least try)"
This reverts commit f03aebf0dd.
2024-09-06 22:37:51 +03:00
ovalkonia
ae02881562 Revert "Update docs/src/magic-vars.md"
This reverts commit b3dbfadfb2.
2024-09-06 22:37:14 +03:00
ovalkonia
c322a51e6f Revert "Export magic constants during server initialization"
This reverts commit 09fbdde6c9.
2024-09-06 22:36:45 +03:00
3 changed files with 4 additions and 10 deletions

View File

@ -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()),
),

View File

@ -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 {

View File

@ -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!