}
#endif
if (ibus_addr == NULL) {
- gchar *display, *host, *id;
+ gchar *display, *host, *id, *username;
display = g_strdup (g_getenv ("DISPLAY"));
if (display != NULL) {
id = host = display;
else {
host = id = "";
}
- ibus_addr = g_strdup_printf ("unix:path=/tmp/ibus-%s/ibus-%s-%s", getlogin (), host, id);
+
+ username = getlogin();
+ if (username == NULL)
+ username = getenv("LOGNAME");
+ if (username == NULL)
+ username = getenv("USER");
+ if (username == NULL)
+ username = getenv("LNAME");
+ if (username == NULL)
+ username = getenv("USERNAME");
+
+ ibus_addr = g_strdup_printf ("unix:path=/tmp/ibus-%s/ibus-%s-%s", username, host, id);
g_free (display);
}
{
QString address;
QString session;
+ QString username;
QDBusConnection *connection = NULL;
if (ibus != NULL)
session = getenv ("DISPLAY");
session.replace (":", "-");
- address = QString("unix:path=/tmp/ibus-%1/ibus-%2").arg (getlogin(), session);
+
+ username = getlogin ();
+ if (username.isNull ())
+ username = getenv ("LOGNAME");
+ if (username.isNull ())
+ username = getenv ("USER");
+ if (username.isNull ())
+ username = getenv ("LNAME");
+ if (username.isNull ())
+ username = getenv ("USERNAME");
+
+ address = QString("unix:path=/tmp/ibus-%1/ibus-%2").arg (username, session);
connection = new QDBusConnection (
QDBusConnection::connectToBus (
address,