summaryrefslogtreecommitdiff
path: root/src/bin/e_deskenv.c
blob: c8844714fb4203cf1fa03755929d91ae91c8aa52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include "e.h"

EINTERN int
e_deskenv_init(void)
{
#ifndef HAVE_WAYLAND_ONLY
   char buf[PATH_MAX], buf2[PATH_MAX + sizeof("xrdb -load ")];

   // run xdrb -load .Xdefaults & .Xresources
   // NOTE: one day we should replace this with an e based config + service
   if (e_config->deskenv.load_xrdb)
     {
        e_user_homedir_concat(buf, sizeof(buf), ".Xdefaults");
        if (ecore_file_exists(buf))
          {
             snprintf(buf2, sizeof(buf2), "xrdb -load %s", buf);
             ecore_exe_run(buf2, NULL);
          }
        e_user_homedir_concat(buf, sizeof(buf), ".Xresources");
        if (ecore_file_exists(buf))
          {
             snprintf(buf2, sizeof(buf2), "xrdb -load %s", buf);
             ecore_exe_run(buf2, NULL);
          }
     }

   e_deskenv_xmodmap_run();
   // make gnome apps happy
   // NOTE: one day we should replace this with an e based config + service
   if (e_config->deskenv.load_gnome)
     {
        ecore_exe_run("gnome-settings-daemon", NULL);
     }

   // make kde apps happy
   // NOTE: one day we should replace this with an e based config + service ??
   if (e_config->deskenv.load_kde)
     {
        ecore_exe_run("kdeinit", NULL);
     }
#endif
   return 1;
}

EINTERN int
e_deskenv_shutdown(void)
{
   return 1;
}

E_API void
e_deskenv_xmodmap_run(void)
{
#ifndef HAVE_WAYLAND_ONLY
   char buf[PATH_MAX], buf2[PATH_MAX + sizeof("xmodmap ")];
   // load ~/.Xmodmap
   // NOTE: one day we should replace this with an e based config + service
   if (!e_config->deskenv.load_xmodmap) return;
   e_user_homedir_concat(buf, sizeof(buf), ".Xmodmap");
   if (!ecore_file_exists(buf)) return;
   snprintf(buf2, sizeof(buf2), "xmodmap %s", buf);
   ecore_exe_run(buf2, NULL);
#endif
}