0

I can't seem to get what is described in this thread to work... I even tried entering the command into the terminal, but all I get is command not found.

I have also tried the startup applications method as described in the same thread, but that only results in an error occurring upon boot along with ubuntu wanting to send a report on it.

The lock button up to the right functions as intended though, so I'm guessing things have changed since the referred to post was made. Does anyone here happen to know how to solve this issue?


Update: Did as instructed by one of the subcomments and installed gnome-screensaver (and it still doesn't work).


Update 2: Uninstalled gnome-screensaver since xdg is apparently what handles the lock screen by default. xdg-screensaver lock works from terminal, but not from startup applications.


Update 3: Made a folder called .startup in "/home/insertusername/", and then ran I made a file called AutoLock.sh w. the contents of that being the following (ignore the empty rows in between each row):

!/bin/bash

xdg-screensaver lock

I then ran "chmod +x AutoLock.sh && chmod -w Autolock.sh". I followed that up by then adding the path for .sh-file into my .desktop file (lockscreen.desktop) within "/home/insertusername/.config/autostart/", and the contents of that is:

[Desktop Entry]

Type=Application

Name=AutoLock

Exec=/home/glacier/.startup/autostart.sh

X-GNOME-Autostart-enabled=false

Doesn't work.


Update 4: Tried adding sleep 1 into the bash script as instructed, making it look like:

#!/bin/bash

sleep 1

xdg-screensaver lock

Doesn't work either.


What am I doing wrong?

  • 1
  • GNOME3 doesn't use gnome-screensaver. Use AutomaticLoginEnable in the linked answer – Daniel T Feb 09 '24 at 18:24
  • The issue isn't automatic login (that functions as intended), and I need it for gnome remote desktop to work. The issue is that the provided methods for making it go to the lock screen after booting up doesn't work.

    I tried applying the xdg equivalent of gnome-screensaver, as I later described in what is update 2, but that didn't work either.

    What do I do now?

    – qwertyuiop Feb 10 '24 at 01:29
  • Does loginctl lock-session work? – Daniel T Feb 10 '24 at 07:42
  • Niope, same thing. It works from the terminal, but not from within startup applications. – qwertyuiop Feb 10 '24 at 12:51
  • What are the file contents and filepath you are using? Does adding a sleep 1 work? – Daniel T Feb 10 '24 at 13:14
  • How should I format it, should I just write "sleep 1 xdg-screensaver lock" (without quotation marks)? – qwertyuiop Feb 10 '24 at 13:47
  • I would create a bash script with those commands, add a hashbang, mark as executable, then put the absolute path in the desktop file, just to be safe – Daniel T Feb 10 '24 at 14:00
  • Added two updates in the post of what I tried during the previous hours were you and I were writing one another, and I included your suggested edit as well. I also tried just making another entry into the startup application preferences, while turning off the other one, and simply entered "sleep 1 xdg-screensaver lock" (didn't work either). – qwertyuiop Feb 10 '24 at 14:58
  • I also tried putting the same file in /etc/profile.d/, but that only ended up with a prompt telling me lock was an unknown command and that I should remedy the issue as soon as possible... I then tried replacing the "xdg-screensaver lock" command with the "loginctl lock-session" that you mentioned earler, but that just did nothing through this method. – qwertyuiop Feb 10 '24 at 17:12

0 Answers0