oxwm

https://git.tonybtw.com/oxwm.git git://git.tonybtw.com/oxwm.git

Merge branch 'master' into bugfixes-floating-fullscreen

Commit
ae6ee0d01daa924e0ab8a9a38c42198e843a1fae
Parents
093d71c 44c9e5e
Author
Tony, btw. <tonyoutoften@gmail.com>
Date
2025-11-17 04:25:59

Diff

diff --cc src/bin/main.rs
index 4619a09,1fb28d6..33c1e76
--- a/src/bin/main.rs
+++ b/src/bin/main.rs
@@@ -73,9 -73,6 +73,8 @@@ fn load_config(custom_path: Option<Path
                  println!("   Please manually port your configuration to the new Lua format.");
                  println!("   See the new config.lua template for examples.\n");
              }
 +        } else {
-             // Always update LSP files to match the running version
 +            update_lsp_files()?;
          }
  
          lua_path
@@@ -105,42 -102,18 +104,38 @@@ fn init_config() -> Result<()> 
      let config_path = config_dir.join("config.lua");
      std::fs::write(&config_path, config_template)?;
  
-     // Update LSP files
 -    let oxwm_lua_template = include_str!("../../templates/oxwm.lua");
 -    let oxwm_lua_path = config_dir.join("oxwm.lua");
 -    std::fs::write(&oxwm_lua_path, oxwm_lua_template)?;
 +    update_lsp_files()?;
  
      println!("✓ Config created at {:?}", config_path);
 -    println!("✓ LSP definitions installed at {:?}", oxwm_lua_path);
 +    println!("✓ LSP definitions installed at {:?}/lib/oxwm.lua", config_dir);
      println!("  Edit the file and reload with Mod+Shift+R");
      println!("  No compilation needed - changes take effect immediately!");
  
      Ok(())
  }
  
 +fn update_lsp_files() -> Result<()> {
 +    let config_dir = get_config_path();
 +
-     // Create lib directory for LSP files
 +    let lib_dir = config_dir.join("lib");
 +    std::fs::create_dir_all(&lib_dir)?;
 +
-     // Always overwrite oxwm.lua with the version from this binary
 +    let oxwm_lua_template = include_str!("../../templates/oxwm.lua");
 +    let oxwm_lua_path = lib_dir.join("oxwm.lua");
 +    std::fs::write(&oxwm_lua_path, oxwm_lua_template)?;
 +
-     // Create/update .luarc.json for LSP configuration
 +    let luarc_content = r#"{
 +  "workspace.library": [
 +    "lib"
 +  ]
 +}
 +"#;
 +    let luarc_path = config_dir.join(".luarc.json");
 +    std::fs::write(&luarc_path, luarc_content)?;
 +
 +    Ok(())
 +}
 +
  fn get_config_path() -> PathBuf {
      dirs::config_dir()
          .expect("Could not find config directory")