last day (14 days later) » 

2:22 PM
#!/bin/bash
for szUserName in /home/* ;
do
szBaseUserName=$(basename "$szUserName")
sudo --set-home --user=$szBaseUserName gsettings set org.gnome.settings-daemon.plugins.power lid-close-suspend-with-external-monitor false
sudo --set-home --user=$szBaseUserName gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type 'nothing'
sudo --set-home --user=$szBaseUserName gsettings set org.gnome.settings-daemon.plugins.power button-sleep 'nothing'
sudo --set-home --user=$szBaseUserName gsettings set org.gnome.settings-daemon.plugins.power button-suspend 'nothing'
 
Is that above the new script?
 
yep!
 
Shouldn't I try terdon's answer first? I did all he told me and now would just have to test it, but the many browser tabs want to be processed first...
 
Up to you!
The only error I had was a typo in szBaseUserName
 
I think Fabby's approach will only affect things running through the GUI and only those GUIs based on GNOME at that
 
2:25 PM
I save the script and execute it later, if I still need to, okay?
 
There are 3 people waiting in this room
I bow to the master...
;-)
OK...
 
Also, that will 1) only affect users whose home is in /home (so, not system users) and 2) tat is a very bad way to get usernames. Anything can be in /home, including a lost+found folder.
 
Let's leave this room then!
 
Nobody tells the people to wait in here, just get a cup of coffee or read the news... ;-)
 
@Terdon:
I wanted a list of users that actually have a GUI
 
2:27 PM
13
A: Can the /home folder in Linux contain anything else but user folders?

terdonI assume you're using a Linux system, but it shouldn't make any difference anyway. You can have anything you like in /home, there is no restriction. It is simply the standard place where user home directories are kept but many systems have them in different locations. OSX, for example, uses /User...

@Fabby The gdm/mdm/lightdm user does and their home is not in /home
 
Okay, I let you argue in here and hurry up to finish my browser work...
 
Do you have a different algorithm then?
 
So with your approach, I think that you can still suspend from the login screen.
 
I've only been using Ubuntu for a bit more then a year now...
 
In any case, you'll still be able to suspend from sudo pm-suspend
 
2:28 PM
yes!
If you want to you still can!
It's just the automatic suspend that's disabled...
(as this was the original question)
ByteCommander has modified his requirements since then,
 
@Fabby Oh, is that what he wants? I thought he wanted to disable it completely at the "kernel level"
 
But I proposed to continue working on my solution
to his original requirements
 
Also, I don't think your method (not sure, mind you) would work on lxde or any non-gnome family DE
 
(no, he doesn't)
yeah!
He installed LXDE just to see oif it would help him!
>:)
 
To remember: all users (including login-screen = no user), all DEs, all triggers (including manually)
 
2:31 PM
ANd did it?
 
nah
 
@ByteCommander Then use the one I found on SF. I tested with pm-suspend and with a GUI suspend command and neither worked.
 
that's why I continued working on my solution... Just in case no one else would come up with anything
Yes!
My opinion exactly...
 
@Fabby Yeah, those settings are gnome stuff (including gnome-derived like unity, cinnamon, mate etc)
 
That's what I meant by "my answer will be deleted forever"
 
2:32 PM
Erm, can't I close the desktop notification window somehow without switching to the chat tab?
 
Anyway,
 
That annoys me somehow...
 
@Terdon: I don't see an algorithm in your post to get users with a GUI...
(or which one)
Would you have smth like that lying around?
("no" is a perfectly valid answer)
;-)
 
@Fabby You mean find all users that can login graphically?
 
Yup...
 
2:34 PM
I would guess that any user with a real login shell can do that. Root is a special case.
 
passwd?
 
@Fabby That's what I'm thinking
 
Yeah, but that's CLI stuiff: says nothing about GUI...
That's why I did the ls /home/*
:P
 
@Fabby Yes, but all of those could log in I think.
@Fabby And that's perfectly reasonable but misses many.
 
:D
Not on my system...
except the lost+found!
OK...
No worries!
 
2:37 PM
This might work:
grep -f /etc/shells /etc/passwd | cut -d: -f1
@Fabby Yes, on your system too. You miss the login manager user and they most certainly run a GUI. You also miss various default users.
 
I'll think it over, I have 2 possibilities to look up users: passwd and shells
 
The thing I pasted above will look for any users in /etc/passwd that have valid login shells.
 
I didn't even know about /etc/shells!
Now I do!
 
So it will ignore any whose login is /bin/false or /usr/sbin/nologin or whatever
 
Indeed...
 
2:39 PM
That's probably a good proxy for users who can login.
 
Still no lightdm though (which is the user on the log-in screen...
but that I can handle... Now I know it is...
@terdon: Thank you for the lesson master!
;-)
 
Yes, lightdm specifically is ignored with that one. The shell is /bin/false. Same for the other login manager users. SO that won't work :(
 
I'll think up something! Not urgent anyway...
Thanks for the info you've already given me!
Anything else???
I need to make up for lost rep given to the bounty!
>:)
by then! C U in general room!
 
OK
 
@terdon I leave this room now too. My tabs are tidied up now and I will try if I can get my machine to suspend...
 

last day (14 days later) »