weekly notes : 02/2025

  • Released Bender v1.2.0
  • Learned reading config from $XDG_CONFIG_HOME in gjs GTK application
    • use Gio.get_user_config_dir to get $XDG_CONFIG_HOME
    • use Gio.get_user_data_dir to get $XDG_DATA_HOME
      let dataDir = GLib.get_user_data_dir();
      console.debug("🚀 ~ file: MainWindow.ts:109 ~ dataDir:", dataDir);
      const configFilePath = GLib.build_filenamev([
        dataDir,
        "bender",
        "config.yaml",
      ]);
      this.configFile = Gio.File.new_for_path(configFilePath);
      
    
      try {
        const [contents, eTag] = await this.configFile.load_contents_async(null);
        const decoder = new TextDecoder("utf-8");
        const contentString = decoder.decode(contents);
    
        console.debug("read config file success : ", contentString);
        return contentString;
      } catch (err) {
        console.debug("read config file failed. ");
        console.debug(err);
        return "";
      }
    }
    
  • Learned non-blocking way to get stdin input in GTK app.
  • Learned about String.prototype.normalize to return the Unicode normalization form of string. Planned to write a blog post in detail.
    • Useful for compare and get length of string.
    • NFC: use composed form - use the single codepoint form
    • NFD: use decomposed form - use multiple codepoint form
      const str = 'Köln';
      const normalizedStr = str.normalize('NFD').replace(/\p{Diacritic}/gu, '');
      console.log(normalizedStr); // koln
      
  • Made some CSS improvements on https://blog.revathskumar.com
  • Looked into rendering tags and categories on blog posts on Jekyll, yet to implement.
If you find my work helpful, You can buy me a coffee.