-
Notifications
You must be signed in to change notification settings - Fork 286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect Look and Feel After Initial Install #136
Comments
I've noticed this as well. I'm not sure what causes it but I have a feeling it has something to do with launching from We may need to source the environment for the user before launching: https://github.com/qzind/tray/blob/2.0/ant/linux/linux-installer.sh.in#L202 |
This seems to stem from the
This article explains the exact cause which is the I'd like to see if someone can figure out a one-liner to circumvent this without making any assumptions about the desktop environment. Edit: Posted a question on stackoverflow: http://stackoverflow.com/questions/40603418/have-script-detect-gnome-session |
Closing as |
@dyorgio has provided a solution here: https://stackoverflow.com/a/46329597/3196753. Reopening until we have a chance to test and commit. |
@dyorgio's solution helped understand the problem but only works if additional flags are provided at install time. Closing as won't fix for now. Will reopen if more information surfaces. |
Hi @tresf! How are you? :) My approach to run software after my installer run (installer was call with sudo) is working with SystemTray lib that uses GTK native Menus, not sure if works with Swing, checkout: // Get user
String user = System.getenv("SUDO_USER");
if (user == null) {
user = System.getProperty("user.name");
}
// Get dbus-daemon PID
Process process = Runtime.getRuntime().exec(new String[]{//
"/bin/sh", "-c", //
"ps aux | grep \"^" + user + " \" | grep \"dbus-daemon\" | grep \"unix:\" | awk '{print $2}'" //
});
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
String pid = reader.readLine();
reader.close();
// Read DBUS process env values
Map dbusEnv = new HashMap();
// put some defaults
dbusEnv.put("XDG_CURRENT_DESKTOP", "Unity");// Ubuntu Rules!
dbusEnv.put("DISPLAY", ":0");// display default
process = Runtime.getRuntime().exec(new String[]{//
"/bin/sh", "-c", //
"cat /proc/" + pid + "/environ | tr '\\0' '\\n'" //
});
reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
String line;
int splitIndex;
while ((line = reader.readLine()) != null) {
splitIndex = line.indexOf('=');
if (splitIndex != -1) {
dbusEnv.put(line.substring(0, splitIndex), line.substring(splitIndex + 1));
}
}
reader.close();
// Run
process = Runtime.getRuntime().exec(new String[]{//
"runuser", //
user,//
"-c",//
"/bin/sh -c \"DISPLAY=" + dbusEnv.get("DISPLAY") + " DBUS_SESSION_BUS_ADDRESS=" + dbusEnv.get("DBUS_SESSION_BUS_ADDRESS") + " XDG_CURRENT_DESKTOP=" + dbusEnv.get("XDG_CURRENT_DESKTOP") + " nohup YOUR_COMMAND_HERE\""//
}); |
@dyorgio thanks. We're already inside Java when the theming issues occur. Could this technique be adopted to |
I don't see why not :P |
@dyorgio thanks for your code, it helped a lot! I've documented the full solution here: https://stackoverflow.com/a/48712378/3196753. In short, read the user's |
@dyorgio, on Ubuntu 18.04, |
Workaround added e0900bb. |
Tested on Ubuntu 14.04 and 16.04
After an install, the tray menu defaults to the
legacy versionMetal
Look and Feel.Restart QZ Tray and the menu is correct (
GTKLookAndFeel
)The text was updated successfully, but these errors were encountered: