Do have this right for common linux installations of KDE and Gnome?
Another method for gnome.
xdg-screensaver lock
#lock screen
if "$LockScreenCommand" == '1' ]];then
#printf "Desktop: %s
" $XDG_CURRENT_DESKTOP
if $(wmctrl -m | grep KWin) ]]; then
loginctl unlock-session 1
fi
if $(wmctrl -m | grep GNOME) ]]; then
gnome-screensaver-command --lock
fi
fi
Hi
For gnome, nope not in current versions… look at the gsettings schema, keys and settings, seems a bit intrusive over riding a user desktop setup choice?
#lock screen
if "$LockScreenCommand" == '1' ]];then
#printf "Desktop: %s
" $XDG_CURRENT_DESKTOP
if $(wmctrl -m | grep KWin) ]]; then
loginctl unlock-session
fi
if $(wmctrl -m | grep GNOME) ]]; then
dbus-send --type=method_call --dest=org.gnome.ScreenSaver /org/gnome/ScreenSaver org.gnome.ScreenSaver.Lock
fi
fi
Hi
Shouldn’t you ask the end user (as in check their preferences) before invoking something that may have been disabled, or an option to disable in your code? I have screenlock disabled…
Hi
There are multiple ways to implement screen locking in GNOME, the method you used works, then there is super+L and gsettings. What I’m saying is that your section of code potentially overrides a user setting/workflow. If you start doing lots of coded checks, especially for different desktops, it is probably more efficient to add and source a user config file, start with some defaults that the user can override if wanting to?
scanvirus was always designed from the start to not use any windowed environment (desktop). The three functions are only extras. You can use scanvirus without ever using these extra functions. Also, you can do these functions manually. Again, these commands are extra shortcuts.
I should separate the suspend and power off from send command to background. These functions are limited and are that way for a reason.
Adding the commands into the config file creates security issues.