Skip to content
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

Add taskbar menu for trayless OS #411

Merged
merged 10 commits into from Feb 6, 2019
Prev

Various Fedora fixes

  • Loading branch information...
tresf committed Feb 6, 2019
commit 3a7690634d49983fb0ac3448e171bc51a39649e1
Copy path View file
@@ -155,7 +155,14 @@ function restart_it() {
# Provide user environmental variables to the sudo environment
function sudo_env() {
userid="$(logname 2>/dev/null || echo $SUDO_USER)"
pid=$(ps aux |grep "^$userid" |grep "dbus-daemon" | grep -- "--config-file=" |awk '{print $2}')
if [ -z "$1" ]; then
daemon="dbus-daemon"
lookfor="--config-file="
else
daemon="$1"
lookfor="$2"
fi
pid=$(ps aux |grep "^$userid" |grep "$daemon" | grep -- "$lookfor" |awk '{print $2}')
# Replace null delimiters with newline for grep
envt=$(cat "/proc/$pid/environ" 2> /dev/null |tr '\0' '\n')

@@ -172,9 +179,8 @@ function sudo_env() {
elif initctl --user get-env $i > /dev/null 2>&1; then
eval "$i=$(initctl --user get-env $i)" > /dev/null 2>&1
export $i > /dev/null 2>&1
fi

echo -e " $i=${!i}"
fi
# echo -e " $i=${!i}"
done

# Handle Ubuntu Gnome
@@ -239,6 +245,7 @@ if [ $? -ne 0 ]; then
else
# Start ${project.name} as the user that's logged in
sudo_env
sudo_env "ibus-daemon" "--panel"
userid="$(logname 2>/dev/null || echo $SUDO_USER)"
sudo -E -u $userid nohup "java" ${launch.opts} -jar "${jarfile}" > /dev/null 2>&1 &
progress_dialog 100 "Finished. ${project.name} should start automatically."
@@ -79,6 +79,20 @@ public void popupMenuCanceled(PopupMenuEvent popupMenuEvent) {
setState(JFrame.ICONIFIED);
}
});
this.popup.addKeyListener(new KeyListener() {
@Override
public void keyTyped(KeyEvent keyEvent) {}

@Override
public void keyPressed(KeyEvent keyEvent) {
if (keyEvent.getKeyCode() == KeyEvent.VK_ESCAPE) {
TaskbarTrayIcon.this.popup.setVisible(false);
}
}

@Override
public void keyReleased(KeyEvent keyEvent) {}
});
}

public void displayMessage(String caption, String text, TrayIcon.MessageType level) { /* noop */ }
@@ -114,6 +128,7 @@ public void windowActivated(WindowEvent windowEvent) {}

@Override
public void windowDeactivated(WindowEvent windowEvent) {
popup.setVisible(false);
setState(JFrame.ICONIFIED);
}
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.