LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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: 3

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 Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,895

Rep: Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317
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: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
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: distro hopper
Posts: 11,235

Rep: Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320
xlock is fairly universal, no?
 
Old 01-12-2018, 04:50 PM   #5
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
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: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
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



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 07:22 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
Open Source Consulting | Domain Registration