Exemplo n.º 1
0
Arquivo: config.c Projeto: Engil/wmfs
static void
config_client(void)
{
     struct conf_sec *sec, **mb;
     char *tmp;

     /* [client] */
     sec = fetch_section_first(NULL, "client");

     W->padding = fetch_opt_first(sec, "0", "padding").num;
     W->client_mod = modkey_keysym(fetch_opt_first(sec, "Super", "key_modifier").str);

     if(fetch_opt_first(sec, "0", "autofocus").boolean)
          W->flags |= WMFS_AUTOFOCUS;

     /* Get theme */
     tmp = fetch_opt_first(sec, "default", "theme").str;
     W->ctheme = name_to_theme(tmp);

     /* Get focus configuration */
     W->cfocus = 0;
     tmp = fetch_opt_first(sec, "enter", "focus").str;
     if(strstr(tmp, "enter"))
          W->cfocus |= CFOCUS_ENTER;
     if(strstr(tmp, "click"))
          W->cfocus |= CFOCUS_CLICK;

     /* [mouse] */
     /* for client frame AND titlebar */
     if((mb = fetch_section(sec, "mouse")))
     {
          config_mouse_section(&W->tmp_head.client, mb);
          free(mb);
     }
}
Exemplo n.º 2
0
static void
config_keybind(void)
{
     int i, n;
     size_t j;
     struct conf_sec *sec, **ks;
     struct opt_type *opt;
     char *cmd;
     struct keybind *k;

     /* [keys] */
     sec = fetch_section_first(NULL, "keys");
     ks = fetch_section(sec, "key");
     n = fetch_section_count(ks);

     SLIST_INIT(&W->h.keybind);

     /* [key] */
     for(i = 0; i < n; ++i)
     {
          k = (struct keybind*)xcalloc(1, sizeof(struct keybind));

          /* mod = {} */
          opt = fetch_opt(ks[i], "", "mod");

          for(j = k->mod = 0; j < fetch_opt_count(opt); ++j)
               k->mod |= modkey_keysym(opt[j].str);

          free(opt);

          /* key = */
          k->keysym = XStringToKeysym(fetch_opt_first(ks[i], "None", "key").str);

          /* func = */
          if(!(k->func = uicb_name_func(fetch_opt_first(ks[i], "", "func").str)))
          {
               warnxl("configuration: Unknown Function \"%s\".",
                         fetch_opt_first(ks[i], "", "func").str);
               k->func = uicb_spawn;
          }

          /* cmd = */
          if((cmd = fetch_opt_first(ks[i], "", "cmd").str))
               k->cmd = xstrdup(cmd);

          SLIST_INSERT_HEAD(&W->h.keybind, k, next);
     }

     wmfs_grab_keys();

     free(ks);
}
Exemplo n.º 3
0
static void
config_client(void)
{
     struct conf_sec *sec, **mb;
     char *tmp;

     /* [client] */
     sec = fetch_section_first(NULL, "client");

     W->client_mod = modkey_keysym(fetch_opt_first(sec, "Super", "key_modifier").str);
     tmp = fetch_opt_first(sec, "default", "theme").str;
     W->ctheme = name_to_theme(tmp);

     /* [mouse] */
     /* for client frame AND titlebar */
     if((mb = fetch_section(sec, "mouse")))
     {
          config_mouse_section(&W->tmp_head.client, mb);
          free(mb);
     }
}