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

fix: support multiple inherited ubuntu session for indicators #12844

Merged
merged 3 commits into from May 16, 2018

Conversation

Projects
None yet
4 participants
@didrocks
Copy link
Contributor

didrocks commented May 7, 2018

Multiple sessions inherits the "ubuntu" base settings properties in ubuntu.
One of the most popular one is communitheme: the next ubuntu default theme
has its dedicated session, with thus duplicated indicators for dropbox.
Rather than a string comparison for ubuntu, only match a substring then.
XDG_CURRENT_DESKTOP can be of form: "communitheme:ubuntu:GNOME",
"ubuntu:GNOME", …
Fixes: #12843.

Support multiple inherited ubuntu session for indicators
Multiple sessions inherits the "ubuntu" base settings properties in ubuntu.
One of the most popular one is communitheme: the next ubuntu default theme
has its dedicated session, with thus duplicated indicators for dropbox.
Rather than a string comparison for ubuntu, only match a substring then.
XDG_CURRENT_DESKTOP can be of form: "communitheme:ubuntu:GNOME",
"ubuntu:GNOME", …
Fixes: #12843.

@didrocks didrocks requested a review from as a code owner May 7, 2018

@welcome

This comment has been minimized.

Copy link

welcome bot commented May 7, 2018

💖 Thanks for opening this pull request! 💖

We use
semantic commit messages
to streamline the release process. Before your pull request can be merged, you
should update your pull request title to start with a semantic prefix,
OR prefix at least one of your commit messages.

Examples of commit messages with semantic prefixes:

  • fix: don't overwrite prevent_default if default wasn't prevented
  • feat: add app.isPackaged() method
  • docs: app.isDefaultProtocolClient is now available on Linux

Things that will help get your PR across the finish line:

  • Follow the JavaScript, C++, and Python coding style.
  • Run npm run lint locally to catch formatting errors earlier.
  • Document any user-facing changes you've made following the documentation styleguide.
  • Include tests when adding/changing behavior.
  • Include screenshots and animated GIFs whenever possible.

We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can.

@didrocks didrocks changed the title Support multiple inherited ubuntu session for indicators fix: support multiple inherited ubuntu session for indicators May 7, 2018

@ckerr

ckerr approved these changes May 7, 2018

Copy link
Member

ckerr left a comment

LGTM, thanks for the patch.

(also, hi @didrocks! :D)

@didrocks

This comment has been minimized.

Copy link
Contributor Author

didrocks commented May 9, 2018

Thanks @ckerr and hey! ;)

if (process.platform === 'linux' && ['Pantheon', 'Unity:Unity7', 'ubuntu:GNOME', 'pop:GNOME'].includes(process.env.XDG_CURRENT_DESKTOP)) {
process.env.XDG_CURRENT_DESKTOP = 'Unity'
if (process.platform === 'linux') {
if (['Pantheon', 'Unity:Unity7', 'pop:GNOME'].includes(process.env.XDG_CURRENT_DESKTOP) || process.env.XDG_CURRENT_DESKTOP.includes('ubuntu')) {

This comment has been minimized.

@MarshallOfSound

MarshallOfSound May 14, 2018

Member

process.env.XDG_CURRENT_DESKTOP is not guaranteed to be defined, we need to handle that case.

If this is going to get bigger I'd like a better structure here. Something like

const KNOWN_XDG_DESKTOP_VALUES = ['Pantheon', 'Unity:Unity7', 'pop:GNOME']

function currentPlatformSupportsAppIndicator() {
  if (process.platform !== 'linux') return false
  const currentDesktop = process.env.XDG_CURRENT_DESKTOP

  if (!currentDesktop) return false
  if (KNOWN_XDG_DESKTOP_VALUES.includes(currentDesktop)) return true
  if (/ubuntu/ig.test(currentDesktop)) return true

  return false
}

if (currentPlatformSupportsAppIndicator()) {
  process.env.XDG_CURRENT_DESKTOP = 'Unity'
}

This comment has been minimized.

@didrocks

didrocks May 14, 2018

Author Contributor

This looks good to me. Good point about undefined XDG_CURRENT_DESKTOP, which wasn't already handled by the current implementation.

As your changes could be taken right away, do you want to redo anther MP with yours or me changing that PR to include your code?

This comment has been minimized.

@MarshallOfSound

MarshallOfSound May 14, 2018

Member

@didrocks I literally wrote that code on my phone so would be good if you could pull it into this PR and verify it still works 👍

This comment has been minimized.

@didrocks

didrocks May 14, 2018

Author Contributor

Pushed after testing your changes. I added some comments to ensure that the intent is clear. Thanks!

fix: more scalable code by factorizing appindicator support
- introduce a currentPlatformSupportsAppIndicator() function determining
  if app indicators are supported here.
- handle undefined process.env.XDG_CURRENT_DESKTOP
- added some comments to ensure that the intents are clear
Thanks MarshallOfSound
@didrocks

This comment has been minimized.

Copy link
Contributor Author

didrocks commented May 16, 2018

@MarshallOfSound: in case you didn't see my additional commit, please rereview :)

@MarshallOfSound

This comment has been minimized.

Copy link
Member

MarshallOfSound commented May 16, 2018

/home/builduser/project/lib/browser/init.js:167:45: Missing space before function parentheses.

You've got a single JS linting error, once you've fixed that @ me and I'll merge this through 👍

@didrocks

This comment has been minimized.

Copy link
Contributor Author

didrocks commented May 16, 2018

Oupsss, indeed. Thanks CI and you for spotting! Fixed :)

@jkleinsc jkleinsc merged commit 2b26206 into electron:master May 16, 2018

10 checks passed

WIP ready for review
Details
ci/circleci: electron-linux-arm Your tests passed on CircleCI!
Details
ci/circleci: electron-linux-arm-test Your tests passed on CircleCI!
Details
ci/circleci: electron-linux-arm64 Your tests passed on CircleCI!
Details
ci/circleci: electron-linux-arm64-test Your tests passed on CircleCI!
Details
ci/circleci: electron-linux-ia32 Your tests passed on CircleCI!
Details
ci/circleci: electron-linux-x64 Your tests passed on CircleCI!
Details
ci/circleci: electron-mas-x64 Your tests passed on CircleCI!
Details
ci/circleci: electron-osx-x64 Your tests passed on CircleCI!
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
@welcome

This comment has been minimized.

Copy link

welcome bot commented May 16, 2018

Congrats on merging your first pull request! 🎉🎉🎉

@trop

This comment has been minimized.

Copy link
Contributor

trop bot commented May 16, 2018

We have automatically backported this PR to "2-0-x", please check out #12964

@trop trop bot added merged/2-0-x and removed target/2-0-x labels May 16, 2018

@didrocks didrocks deleted the didrocks:fix-communitheme-session branch May 29, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.