Hi,
Got a good tips from OpenBSD.newbies mailing list. How to lock the machine after suspend. Ok, normally, if I didn't xlock my X session and put the machine under suspend mode (eg: close the lid), my session will be restored when the machine wakes. My session is exposed. So here's how to automatically lock the session when the machine goes into suspend mode.
1) Create a suspend file inside /etc/apm.
In my machine, there's no /etc/apm folder. So I need to create it first. Then create a suspend file inside it.
$ doas mkdir /etc/apm
$ doas vi /etc/apm/suspend
----- /etc/apm/suspend starts -----
#!/bin/sh
pkill -USR1 xidle
----- /etc/apm/suspend ends -----
Then I need to make this suspend executable.
$ doas chmod 744 /etc/apm/suspend
2) Get xidle running on start.
I edited my
.xsession file and add this text:
----- ~/.xsession starts -----
xidle &
----- ~/.xsession ends -----
Then I run the xidle program.
$ xidle &
So basically when I close my machine's lid, suspend will trigger xidle to lock the machine. Nice stuff.
Reference:
http://www.mail-archive.com/openbsd-newbies@sfobug.theapt.org/msg00043.html
Showing posts with label .xsession. Show all posts
Showing posts with label .xsession. Show all posts
Wednesday, September 30, 2015
Friday, December 17, 2010
OpenBSD NC4200: Another rough tweak for xdm with multiple window manager.
After reading Gentoo Wiki I found another way to get xdm to let you choose desired window manager. This is rougher than the previous tweak I posted. For this one, I need to edit 3 files.
Step 1: Edit /etc/X11/xdm/Xresources.
I edited the file with these values:
xlogin*login.translations: #override \
*default bits ignored*
<Key>F1: set-session-argument(failsafe) finish-field()\n\
<Key>F2: set-session-argument(fvwm) finish-field()\n\
<Key>F3: set-session-argument(xfce4) finish-field()\n\
*default bits ignore*
The bolded parts are the values I inserted.
Step 2: Edit /etc/X11/xdm/Xsession.
I edited the file with these values:
case $# in
1)
case $1 in
*default bits ignored*
fvwm)
xscreensaver -no-splash &
nohup sh ~/davmail/davmail.sh ~/davmail/davmail.properties &
eval `cat ~/.fehbg`
exec fvwm
;;
xfce4)
exec startxfce4
;;
esac
esac
Like Step 1, bolded parts are the values I inserted. Basically these 2 steps will tell xdm to load fvwm if I press F2 after I type my username and password or load xfce4 if I press F3 after I type my username and password. Eh, what about my fav-o-win-manager wmii?. Ahh. For that one I need to go to Step 3.
Step 3: Edit ~/.xsession.
This one is the long one. Trust me if I know a shorter way I would put it here. For this I edit:
xscreensaver -no-splash &
nohup sh ~/davmail/davmail.sh ~/davmail/davmail.properties &
eval `cat ~/.fehbg`
exec wmii
Gotcha! Ho boy I love to do that. Well it's basically very short. So now if I press Return (Enter) key after I type my username & password, wmii will load. Personally, I prefer the previous tweak I posted earlier because I don't need to edit a few files. For previous tweak, I will know which window manager I will choose but for this tweak, I have to memorize which F* key will load which window manager.
Sure, SLiM looks prettier but xdm comes with X11 by default. Later.
Step 1: Edit /etc/X11/xdm/Xresources.
I edited the file with these values:
xlogin*login.translations: #override \
*default bits ignored*
<Key>F1: set-session-argument(failsafe) finish-field()\n\
<Key>F2: set-session-argument(fvwm) finish-field()\n\
<Key>F3: set-session-argument(xfce4) finish-field()\n\
*default bits ignore*
The bolded parts are the values I inserted.
Step 2: Edit /etc/X11/xdm/Xsession.
I edited the file with these values:
case $# in
1)
case $1 in
*default bits ignored*
fvwm)
xscreensaver -no-splash &
nohup sh ~/davmail/davmail.sh ~/davmail/davmail.properties &
eval `cat ~/.fehbg`
exec fvwm
;;
xfce4)
exec startxfce4
;;
esac
esac
Like Step 1, bolded parts are the values I inserted. Basically these 2 steps will tell xdm to load fvwm if I press F2 after I type my username and password or load xfce4 if I press F3 after I type my username and password. Eh, what about my fav-o-win-manager wmii?. Ahh. For that one I need to go to Step 3.
Step 3: Edit ~/.xsession.
This one is the long one. Trust me if I know a shorter way I would put it here. For this I edit:
xscreensaver -no-splash &
nohup sh ~/davmail/davmail.sh ~/davmail/davmail.properties &
eval `cat ~/.fehbg`
exec wmii
Gotcha! Ho boy I love to do that. Well it's basically very short. So now if I press Return (Enter) key after I type my username & password, wmii will load. Personally, I prefer the previous tweak I posted earlier because I don't need to edit a few files. For previous tweak, I will know which window manager I will choose but for this tweak, I have to memorize which F* key will load which window manager.
Sure, SLiM looks prettier but xdm comes with X11 by default. Later.
Subscribe to:
Posts (Atom)
6.5 amd64: Modify existing certbot certificates.
Hi, It's been quite some time eh. As you can see, I still upgrade my OpenBSD system regularly but currently I do not have the time to ...
-
Firstly, yeah I changed the blog's title. As I'm using ONLY OpenBSD nowadays, I think it's appropriate to change the title as I...
-
Ah. Now I'm back to using xdm as my login manager. Using Wikibook's Guide to X11 as a guideline, I managed to write a rough hack to...
-
Hi, OpenBSD 5.7 is out and what am I gonna wait for? Ok now I'm running 5.7-CURRENT using snapshot, newly upgraded from 5.7-RELEASE b...