I found a solution from here https://askubuntu.com/a/543861/718511, though they wanted to do the reverse so it's slightly modified. Essentially a script is made to disable dpms and lightdm told to run it.
In /etc/lightdm/lightdm.conf.d/ make a file 50-dpms.conf:
sudo nano /etc/lightdm/lightdm.conf.d/50-dpms.conf
Add the lines
[SeatDefaults]
display-setup-script=/usr/local/bin/dpms-stop
Close the file
In /usr/local/bin/ create a file dpms-stop:
sudo nano /usr/local/bin/dpms-stop
Add the lines
#!/bin/sh
sudo xhost +si:localuser:lightdm # grants localuser rights to X session
sudo su lightdm -s /bin/bash <<HERE
/usr/bin/xset -dpms
exit
HERE
Close the file
Make the file executable:
sudo chmod +x /usr/local/bin/dpms-stop
At reboot it worked for me.
In a fresh install of Ubuntu 20.04,
the default shell theme.. and lock screen both are configured to use the css file
Yaru/gnome-shell.css
which is inside the /usr/share/gnome-shell/theme/Yaru/gnome-shell-theme.gresource
this is configured in the file /usr/share/gnome-shell/modes/ubuntu.json
{
"parentMode": "user",
"stylesheetName": "Yaru/gnome-shell.css",
"themeResourceName": "theme/Yaru/gnome-shell-theme.gresource",
"debugFlags": ["backtrace-crashes-all"],
"enabledExtensions": ["ubuntu-dock@ubuntu.com", "ubuntu-appindicators@ubuntu.com", "desktop-icons@csoriano"]
}
So, you can pointout what ever .gresource
file you want to use and the corresponding gnome-shell.css
for example, If I want Yaru-dark theme, I can simply point out like this by editing the file /usr/share/gnome-shell/modes/ubuntu.json
Take Backup of the file /usr/share/gnome-shell/modes/ubuntu.json
before editing
{
"parentMode": "user",
"stylesheetName": "Yaru-dark/gnome-shell.css",
"themeResourceName": "theme/Yaru/gnome-shell-theme.gresource",
"debugFlags": ["backtrace-crashes-all"],
"enabledExtensions": ["ubuntu-dock@ubuntu.com", "ubuntu-appindicators@ubuntu.com", "desktop-icons@csoriano"]
}
Please note that Default shell theme and lock screen uses same file.. so If you want Yaru shell theme for the desktop session.. you need to install it as a local theme which is another topic.
I have not tried with full path of the .gresource
file.. in the line
"themeResourceName": "theme/Yaru/gnome-shell-theme.gresource",
this means.. theme/Yaru/gnome-shell-theme.gresource
is a relative path of the base /usr/share/gnome-shell
Best Answer
You can do the following:
gnome-screensaver-command -l
will lock your session, andgdmflexiserver
will take you to the login screen. Your session will be locked, but will unlock automatically when you enter your password at the login screen.As a script: