notion-linux icon indicating copy to clipboard operation
notion-linux copied to clipboard

`notion-enhanced` updates `~/.config/mimeapps.list` unnecessarily.

Open trustin opened this issue 4 years ago • 5 comments

describe the bug

I'm currently using notion-enhanced installed from your apt repository in Ubuntu 20.04 LTS. Whenever I launch notion-enhanced by clicking the launcher from GNOME desktop, it updates or adds the following line in my ~/.config/mimeapps.list file:

text/html=notion-enhanced.desktop

I explicitly associate my web browser with text/html (e.g. text/html=x-www-browser.desktop), but it keeps getting reverted by notion-enhanced whenever it launches.

expected behaviour

notion-enhanced should never touch my mimeapps.list file.

platform

Ubuntu 20.04.2 LTS

enabled enhancements

  • notion-enhancer code
    • auto-maximise windows
  • tweaks
    • integrated scrollbars
    • thicker bold text
    • scroll database toolbars
  • indentation lines
    • style: soft
    • bulleted list
    • numbered list
    • to-do list
    • toggle list

trustin avatar Apr 13 '21 10:04 trustin

Thanks for the report, this seems to occur for the notion-desktop package as well so isn't related to Notion Enhancer.

Based on my research, this issue seems to be caused by a bug in xdg-settings which runs when Electron registers the notion: protocol, which allows you to login with Google or Apple via a web browser and return to the app.

I've found these two issues which are relevant: https://github.com/electron/electron/issues/20382 and https://github.com/signalapp/Signal-Desktop/issues/3602

Signal has worked around the xdg-settings bug by removing the dash in their app name, so similarly I would need to change notion-desktop to notiondesktop ... however this would probably break people's settings due to the folder name changing.

Right now I'm not really prioritising development of this app so I'm not sure I can fix this for now, but I think you can do the following to make a custom build which is fixed:

  • open scripts/enhance.sh and scripts/_variables-2.sh
  • replace every notion-enhanced with notionenhanced in those files
  • run the following:
    scripts/build.sh
    scripts/enhance.sh
    scripts/package-deb.sh -n notionenhanced
    

vtenfys avatar Apr 13 '21 11:04 vtenfys

Try this: https://api.cirrus-ci.com/v1/artifact/task/6146237603774464/deb/out/debs/notionenhanced_2.0.11-8_amd64.deb (and uninstall notion-enhanced)

vtenfys avatar Apr 13 '21 11:04 vtenfys

Thank you so much!

trustin avatar Apr 13 '21 12:04 trustin

By the way, I ended up fixing all Electron-based apps by putting this script (~/.local/bin/xdg-settings) in my PATH:

#!/bin/bash
if [[ "$1 $2" == "set default-url-scheme-handler" ]]; then
  DEFAULT_BROWSER="$(xdg-mime query default text/html)"
  /usr/bin/xdg-settings "$@"
  if [[ "$(xdg-mime query default text/html)" != "$DEFAULT_BROWSER" ]]; then
    echo "Reverting the default web browser to $DEFAULT_BROWSER"
    xdg-mime default "$DEFAULT_BROWSER" text/html
  fi
  exit 0
fi

exec /usr/bin/xdg-settings "$@"

trustin avatar Apr 13 '21 13:04 trustin

I'm afraid I am no longer supporting this project, so I will not be looking into this issue. Please see the updated README for more information. I will leave the issue open, in case of a new maintainer who is able to look into it.

vtenfys avatar Jun 11 '21 10:06 vtenfys