How to enable extension for the gdm user?

I am on Gnome 45.
I have gone through the documentation extensions port guide for v45.

I remember, the session modes are introduced way back from 42 or 43. Since then I tried to enable extension for gdm user. tried many places to install the extensions, for example home directory of gdm user which is /var/lib/gdm/. Access gdm users via machinectl and then try to copy paste the files as a gdm user to /var/lib/gdm/.local/share/gnome-shell/extensions/ etc.

Today I have strictly followed the steps provided in the docs.

gdm

Extensions that specify this key are allowed to run, or keep running, on the login screen. This session mode is only available for system extensions that are enabled for the “gdm” user.

  1. System Extensions in above context is the extensions under these two paths? /usr/share/gnome-shell/extensions/ or /usr/local/share/gnome-shell/extensions/

  2. session-modes: ["gdm"], this line in metadata.json file

How to enable the extension for gdm user?

To test it, I made the extension like this

1 Like

The extension should be enabled by default. GDM extension should be installed wherever your distributions puts system extensions for GNOME Shell. Usually this is /usr/share/gnome-shell/extensions.

Hi, Can you go through below. I did not see any color change on top bar on GDM screen as per stylesheet.css

admin@ANTARCTICA ~ $ gnome-extensions info gdm
gdm
  Name: gdm
  Description: gdm
  Path: /usr/share/gnome-shell/extensions/gdm
  State: INITIALIZED
admin@ANTARCTICA ~ $ cat /usr/share/gnome-shell/extensions/gdm/metadata.json 
{
  "session-modes": ["gdm"],
  "name": "gdm",
  "description": "gdm",
  "uuid": "gdm",
  "shell-version": [
    "45"
  ]
}
admin@ANTARCTICA ~ $ cat /usr/share/gnome-shell/extensions/gdm/extension.js 

import { Extension } from 'resource:///org/gnome/shell/extensions/extension.js';

export default class GdmTestExtension extends Extension {
    enable() {
        console.log('GDM test extension is working');
    }

    disable() {

    }
}
admin@ANTARCTICA ~ $ cat /usr/share/gnome-shell/extensions/gdm/stylesheet.css 
/* Add your custom extension styling here */
#panel {
    background-color: orange;
}

#lockDialogGroup {
    background-color: red;
}admin@ANTARCTICA ~ $

I don’t see any errors here. Maybe compare with an existing system extension for permissions, etc?

I have tried for atleast 2hours but session-modes gdm is not working.

To test,
I have installed extension as root in /usr/share/gnome-shell/extensions/.
Kept the session-modes as [“user”, “unlock-dialog”, “gdm”]

the extension has only stylesheet.css that has

#panel {
  background-color: orange
}

The panel background is orange when in user mode and in unlock-dialog mode but not in gdm.

The extension is system-wide. When I create new user, this extension is availabe.

I am in doubt of this statement from docs

  • gdm

Extensions that specify this key are allowed to run, or keep running, on the login screen. This session mode is only available for system extensions that are enabled for the “gdm” user.

In above, system extensions is achieved. but Enabling for gdm user is the catch here. How to enable the extension for gdm user?

Did you enable the extension for the gdm user? (I didn’t see your question at the end)

You can either change the dconf defaults for the gdm profile or try using gsettings as gdm user.

The sysadmin guide has a relevant section (although you’ll have to replace “user” with “gdm”).

1 Like

I tried with machinectl to become gdm user n made some testing with gsettings. No use. What I noticed is the gsettings are working for the schemas those are available for login under dconf settings but not for enaled extensions related.

I will try with this way.

Thanks.

If you’re using a SElinux distro like Fedora, check SElinux logs to be sure it’s not blocking some file access.

I am using Arch Linux and it worked after following the link (Lock down enabled extensions) provided by fmuellner. But this way I loose the capability of changing login-screen schemas via gdm user by machinectl shell gdm@ /bin/bash. These capabilities are overridden due to the dconf profile I set.

I am very happy that after 3 years, my dream came true which is to have the capability of setting GDM background with an extension.

I am sorry for above comment, in my Arch Linux it is possible to set by becoming as gdm user.

sudo machinectl shell gdm@ /bin/bash

then as gdm user

gsettings set org.gnome.shell enabled-extensions "['extensions_uuid']"

What I missed was the format required to set enabled-extensions key is “as” (array string)
I was setting the value without quotations and thus not worked.
This means without setting any dconf profile and db. The extension is working.

Thanks for all your support.

1 Like

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.