nick-shmyrev / improved-osk-gnome-ext

Improved On Screen Keyboard for Gnome Shell
https://extensions.gnome.org/extension/4413/improved-osk/
94 stars 30 forks source link

metadata: Add session modes #39

Closed PhilDevProg closed 1 year ago

PhilDevProg commented 1 year ago

This adds the session modes user, lock-screen and unlock-dialog to the metadata.json file making the extension operable on the lock screen and in the unlock dialog. See https://gjs.guide/extensions/topics/session-modes.html#example-usage I also tried to add gdm but it didn't work.

PhilDevProg commented 1 year ago

Great find! This is exactly what's needed to fix the issue with screensaver in #36 :+1:

Also, I've found a way to get it working with GDM - the extension needs to be installed and enabled as a machine-wide extension in order for it to show up on login screen: https://help.gnome.org/admin/system-admin-guide/stable/extensions-enable.html.en. Once I'll have some time, I'll add another section to README with instructions and maybe a bash script to do all that the easy way.

Hmm, that doesn't work for me... The extension doesn't even show up in the Extensions app... Does it work for you?

nick-shmyrev commented 1 year ago

So far, I've only tried this in Fedora 37, but it did work for me. What I did:

  1. I installed the extension into /usr/share/gnome-shell/extensions dir, so that the .zip file contents ended up at this path: /usr/share/gnome-shell/extensions/improvedosk@nick-shmyrev.dev/.
  2. I then followed the 1st step from here. In my case, there already was a user profile, so I didn't have to do anything.
  3. Then I followed the 2nd step from here. I created a 00-extensions file in /etc/dconf/db/local.d/ dir, and added the following lines to that file:
    [org/gnome/shell]
    # List all extensions that you want to have enabled for all users
    enabled-extensions=['improvedosk@nick-shmyrev.dev']
  4. Then I ran dconf update in the terminal, and rebooted.

Once I got to the login screen, Extended OSK showed up. It also showed up in the list of installed extensions at https://extensions.gnome.org/local/, however since it's now a system extension, there was no button to uninstall it.

PhilDevProg commented 1 year ago

Hmm, I did the same on Fedora 37... I'll redo it later.

PhilDevProg commented 1 year ago

@nick-shmyrev I tried again by completely following your guide but the extension still doesn't show up on GDM or in the Extensions app...

nick-shmyrev commented 1 year ago

@PhilDevProg Hm, that's weird...

A few ideas of what might've gone wrong:

Finally, as a last resort, here's a script that hopefully would go through the whole installation process for you. Full disclosure: I only wrote the pseudocode for it, fed that to ChatGPT, then tweaked a few lines here and there. It did work in a Fedora 37 VM, but I'd be extra careful using it on a live device.

#!/bin/bash

zip_filename="improvedosk@nick-shmyrev.dev.shell-extension.zip"

# Check if "improvedosk@nick-shmyrev.dev.shell-extension.zip" exists in the current directory
if [ ! -f "$zip_filename" ]; then
    echo "$zip_filename file not found, exiting..."
    exit
fi

# Extract .zip into "/usr/share/gnome-shell/extensions/" directory
sudo unzip -o "$zip_filename" -d /usr/share/gnome-shell/extensions/improvedosk@nick-shmyrev.dev/

# Check if "user" file exists in "/etc/dconf/profile/" directory
if [ ! -f /etc/dconf/profile/user ]; then
    # If "user" file doesn't exist, create it
    sudo touch /etc/dconf/profile/user
fi

# Check if "user" file has line "user-db:user"
if ! grep -q "^user-db:user$" /etc/dconf/profile/user; then
    # If "user" file doesn't have line "user-db:user", add it to file
    echo "user-db:user" | sudo tee -a /etc/dconf/profile/user > /dev/null
fi

# Check if "user" file has line "system-db:local"
if ! grep -q "^system-db:local$" /etc/dconf/profile/user; then
    # If "user" file doesn't have line "system-db:local", add it to file
    echo "system-db:local" | sudo tee -a /etc/dconf/profile/user > /dev/null
fi

# Check if "00-extensions" file exists in "/etc/dconf/db/local.d/" directory
if [ ! -f /etc/dconf/db/local.d/00-extensions ]; then
    # If "00-extensions" file doesn't exist, create it
    sudo touch /etc/dconf/db/local.d/00-extensions

    # Add "[org/gnome/shell]" line to the top of the file 
    echo "[org/gnome/shell]" | sudo tee /etc/dconf/db/local.d/00-extensions > /dev/null

fi

# Check if enabled-extensions=[ line exists in 00-extensions file 
if grep -q "enabled-extensions=\[" "/etc/dconf/db/local.d/00-extensions"; then 
    # If enabled-extensions=[ line exists, but improvedosk@nick-shmyrev.dev is not included,
    # add it to the line starting with enabled-extensions=[ right after enabled-extensions=[
    sudo sed -i '/enabled-extensions=\[/ s/\]/, \x27improvedosk@nick-shmyrev.dev\x27\]/' /etc/dconf/db/local.d/00-extensions  
else  
    # If enabled-extension=[ line does not exist, add enabled-extension=[improvedosk@nick-shmyrev.dev] to the end of the file.  
    echo "enabled-extensions=['improvedosk@nick-shmyrev.dev']" | sudo tee --append /etc/dconf/db/local.d/00-extensions > /dev/null  
fi 

# Update dconf database with new settings 
sudo dconf update

echo "$zip_filename installed as a system-wide extension. Please reboot to apply changes."
nick-shmyrev commented 1 year ago

Another thing worth trying is enabling "Screen Keyboard" in Accessibility Options in upper right corner on Login screen.

PhilDevProg commented 1 year ago

Now it's installed! Thank you, but it still doesn't work on GDM... I also tried activating the osk in the accessibility menu but I just get the normal OSK from GNOME.

nick-shmyrev commented 1 year ago

I've made a separate issue to further discuss this problem here: https://github.com/nick-shmyrev/improved-osk-gnome-ext/issues/41