spacemacs icon indicating copy to clipboard operation
spacemacs copied to clipboard

[develop] [visual] [low prio] `geolocation-enable-automatic-theme-changer`: theme colors only partially changed on automatic theme switch after `desktop-read`

Open stradicat opened this issue 4 years ago • 4 comments

Description :octocat:

Theme colors, when using geolocation-enable-automatic-theme-changer, are only partially changed on automatic theme switch between Emacs exit and re-opening, after desktop-read:

If I exit Emacs after sunset with the dark theme on, and then open Emacs again the next morning after dawn executing desktop-read, the saved desktop state will try to bring up the dark theme but the light theme will be enforced by the time of day. This garbles the theme colours on both light and dark themes.

This is a minor quirk/annoyance, but it's been present since the 0.100.xdays, and forces the user to hit SPC T n twice to force-cycle between light and dark themes for correct display. I'm not fluent in elisp, so I haven't been able to figure this out.

Reproduction guide :beetle:

  • Open dotfile
  • Add/enable (geolocation :variables geolocation-enable-automatic-theme-changer t)
  • Add/enable a light and a dark theme, for example dotspacemacs-themes '(spacemacs-light spacemacs-dark) (I'm using gruvbox-light and doom-one as light and dark themes respectively)
  • Start Emacs before sunset, with the light theme on.
  • Edit some files, and exit after Emacs has automatically switched to the dark theme.
  • The morning after, after sunrise, open Emacs, restore previous session with desktop-read.
  • Check current theme colours.

Alternatively:

  • Start Emacs before sunrise, with the dark theme on.
  • Edit some files, and exit Emacs after it has automatically switched to the light theme.
  • After sunset, open Emacs, restore previous session with desktop-read.
  • Check current theme colours.

Observed behaviour: :eyes: :broken_heart: Theme colours are, for the most part, partially loaded after desktop-read, some background and text colours for UI elements belong to one theme whilst simultaneously other elements' colours belong to the opposite theme.

Expected behaviour: :heart: :smile: Emacs opens with the corresponding theme correctly applied to every UI element.

System Info :computer:

  • OS: gnu/linux
  • Emacs: 27.2
  • Spacemacs: 0.300.0
  • Spacemacs branch: develop (rev. 40ae5e229)
  • Graphic display: t
  • Distribution: spacemacs
  • Editing style: vim
  • Completion: helm
  • Layers:
((c-c++ :variables c-c++-adopt-subprojects t c-c++-backend 'lsp-ccls)
 csv
 (dart :variables dart-backend 'lsp lsp-dart-flutter-sdk-dir "~/flutter/bin/cache/dart-sdk" lsp-dart-sdk-dir "~/flutter/bin/cache/dart-sdk/")
 (go :variables go-backend 'lsp go-use-golangci-lint t godoc-at-point-function 'godoc-gogetdoc go-format-before-save t gofmt-command "gofumpt")
 graphql groovy
 (html :variables web-fmt-tool 'web-beautify)
 (java :variables javascript-backend 'lsp)
 (javascript :variables javascript-backend 'lsp javascript-fmt-tool 'web-beautify javascript-import-tool 'import-js javascript-repl 'nodejs js2-include-node-externs t)
 (json :variables json-fmt-tool 'web-beautify)
 (kotlin :variables kotlin-backend 'lsp kotlin-lsp-jar-path "/home/dmayr/kotlin-language-server/server/bin/kotlin-language-server")
 markdown nginx plantuml
 (php :variables php-backend 'lsp)
 (python :variables python-backend 'lsp python-lsp-server 'pyls)
 react
 (rust :variables cargo-process-reload-on-modify t rust-backend 'lsp lsp-rust-server 'rust-analyzer)
 (shell-scripts :variables shell-scripts-backend 'lsp)
 systemd
 (sql :variables sql-backend 'lsp sql-capitalize-keywords t sql-lsp-sqls-workspace-config-path 'workspace)
 (typescript :variables typescript-backend 'lsp typescript-fmt-tool 'web-beautify)
 (vue :variables vue-backend 'lsp vue-fmt-tool 'web-beautify)
 windows-scripts yaml
 (auto-completion :variables auto-completion-enable-sort-by-usage t)
 better-defaults
 (cmake :variables cmake-backend 'lsp cmake-enable-cmake-ide-support t)
 dap debug docker emacs-lisp emoji
 (geolocation :variables geolocation-enable-automatic-theme-changer t)
 git github gtags helm import-js lsp meson multiple-cursors
 (treemacs :variables treemacs-use-collapsed-directories 3 treemacs-use-git-mode 'deferred treemacs-use-filewatch-mode t)
 (org :variables org-enable-bootstrap-support t org-enable-hugo-support t org-enable-github-support t)
 pandoc prettier restclient
 (shell :variables shell-default-height 30 shell-default-position 'bottom)
 (spell-checking :variables enable-flyspell-auto-completion t)
 sql syntax-checking
 (unicode-fonts :variables unicode-fonts-enable-ligatures t unicode-fonts-ligature-set
                '("<*" "<*>" "<+>" "<$>" "***" "<|" "|>" "<|>" "!!" "||" "===" "==>" "<<<" ">>>" "<>" "+++" "<-" "->" "=>" ">>" "<<" ">>=" "=<<" "-<" ">-" "-<<" ">>-" "/=" "==" "::" "++"))
 version-control web-beautify)
  • System configuration features: XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND GPM DBUS GSETTINGS GLIB NOTIFY INOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS LIBSYSTEMD JSON PDUMPER LCMS2 GMP

stradicat avatar Aug 03 '21 15:08 stradicat

what if the logic of checking current time is executed whenever a new file is opened?

it has several benefits. First, you don't need to manually restart Emacs daemon. Second, I think it will avoid the conflict caused by the stored (ou dated) external state. Actually we don't need to store this state at all.

Instead we can store the last time the theme is switched due to day/night transition. So on opening of a new file, it promptly passes if the last switch is not long ago enough.

lebensterben avatar Aug 04 '21 03:08 lebensterben

Or somehow establishing the corresponding theme at init time, and not letting desktop-read manage the theme state.

stradicat avatar Aug 05 '21 21:08 stradicat

not letting desktop-read manage the theme state

No, you should call desktop-read in the first place. If there's any config needs to be persistent, you should instead store them in your init file.

lebensterben avatar Aug 06 '21 01:08 lebensterben

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!

github-actions[bot] avatar Aug 06 '22 01:08 github-actions[bot]