LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-12-2018, 01:23 AM   #1
Longman
LQ Newbie
 
Registered: Jan 2018
Posts: 1

Rep: Reputation: Disabled
How to Lock screen programatically on any Linux distro?


I understand that unfortunately there won't be one solution for all, but maybe there is anything that fits most of distros? Does it depend on desktop environment or something else? How do I even find this for all distros?
 
Old 01-12-2018, 02:11 AM   #2
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 11,353

Rep: Reputation: 3418Reputation: 3418Reputation: 3418Reputation: 3418Reputation: 3418Reputation: 3418Reputation: 3418Reputation: 3418Reputation: 3418Reputation: 3418Reputation: 3418
what I can imagine: Ctrl-Alt-L (or anything else) can be used to lock screen and you can try to send that event programatically.
 
Old 01-12-2018, 02:13 AM   #3
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 9,713
Blog Entries: 7

Rep: Reputation: 2399Reputation: 2399Reputation: 2399Reputation: 2399Reputation: 2399Reputation: 2399Reputation: 2399Reputation: 2399Reputation: 2399Reputation: 2399Reputation: 2399
i'd start with
Code:
xset s activate
- does that lock the screen?

if not, i'd look at systemd next:
Code:
systemctl | grep lock
PS:
https://www.linuxquestions.org/quest...5/#post5805335

Last edited by ondoho; 01-12-2018 at 02:17 AM.
 
Old 01-12-2018, 02:05 PM   #4
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: Slackware
Posts: 8,421

Rep: Reputation: 3448Reputation: 3448Reputation: 3448Reputation: 3448Reputation: 3448Reputation: 3448Reputation: 3448Reputation: 3448Reputation: 3448Reputation: 3448Reputation: 3448
xlock is fairly universal, no?
 
Old 01-12-2018, 04:50 PM   #5
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: MID-SOUTH USA
Distribution: Slackware 14.2 / Slackware 14.2 current / Manjaro / Parrot
Posts: 6,912

Rep: Reputation: 1396Reputation: 1396Reputation: 1396Reputation: 1396Reputation: 1396Reputation: 1396Reputation: 1396Reputation: 1396Reputation: 1396Reputation: 1396
I use i3lock is it for i3 wm but I use'd it in Fluxbox and WindowManager just program it in the keyboard short cuts...
 
Old 01-13-2018, 03:25 AM   #6
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 9,713
Blog Entries: 7

Rep: Reputation: 2399Reputation: 2399Reputation: 2399Reputation: 2399Reputation: 2399Reputation: 2399Reputation: 2399Reputation: 2399Reputation: 2399Reputation: 2399Reputation: 2399
Quote:
Originally Posted by dugan View Post
xlock is fairly universal, no?
not on my system, had to install it separately.
i'm also pretty sure op meant "a universal way to activate an already installed screenlocker".
let's se what they have to say for themselves.

there's also the distinction between Xorg and Wayland to be made...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Lock Shutdown and other related options when lock screen. hack3rcon Linux - Newbie 6 12-07-2016 06:03 AM
Lock X screen and lock ctrl/alt keys Mr. Alex Linux - Software 4 02-10-2012 08:03 AM
Disable lock session (lock screen) when switch user in KDE 4.x Murz Linux - Desktop 4 12-01-2010 08:28 AM
Num lock OFF and Caps & Screen Lock ON at Linux startup. Reversing? peteyperson Linux - Newbie 2 02-28-2009 11:44 AM
How to find screen resolution programatically in Suse dipk_23 Programming 1 05-04-2007 07:22 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:03 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration