The value of imports.ui.main.sessionMode.currentMode (ubuntu) is not the
login name, but the name of the ubuntu session.

I'm sorry to say it but the gjs guide is wrong in assuming that's always
the case as further sessions can be added.

However, you can definitely check whether the used session is an user
one by just ensuring:

imports.ui.main.sessionMode.currentMode === 'user' ||
imports.ui.main.sessionMode.parentMode === 'user'

As any custom session that is still an user session will have the
parentMode set.

** Changed in: gjs (Ubuntu)
       Status: New => Won't Fix

-- 
You received this bug notification because you are a member of Desktop
Packages, which is subscribed to gjs in Ubuntu.
https://bugs.launchpad.net/bugs/1975402

Title:
  GJS returns wrong session mode

Status in gjs package in Ubuntu:
  Won't Fix

Bug description:
  As stated in the documentation
  (https://gjs.guide/extensions/topics/session-modes.html#example-
  usage), when a user is logged in, the Shell is in the `user` mode. I
  checked it on Fedora 36, and that's how it works.

  But in Ubuntu, for some reason, `imports.ui.main.currentMode` returns
  the login name of the current user instead of the `user` constant,
  which breaks extensions that use it.

  ---
  ProblemType: Bug
  Architecture: amd64
  CurrentDesktop: ubuntu:GNOME
  DistroRelease: Ubuntu 22.04
  Package: gjs 1.72.0-3
  PackageArchitecture: amd64
  ProcVersionSignature: Ubuntu 5.15.0-30.31-generic 5.15.30
  RelatedPackageVersions: mutter-common 42.0-3ubuntu2
  Tags: jammy
  Uname: Linux 5.15.0-30-generic x86_64

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gjs/+bug/1975402/+subscriptions


-- 
Mailing list: https://launchpad.net/~desktop-packages
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~desktop-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to