lxsession-logout customization and improvements

Please post all general support questions for LXDE here.
Locked
v43
Posts: 6
Joined: Tue Feb 08, 2011 10:58 pm

lxsession-logout customization and improvements

Post by v43 »

hi guys!
i know i can change the logout menu banner and prompt, but i'm wondering, is there any way to add another command to the menu? i'd like one to lock and power off the screen. well, it's not essential, since i already made a script to do that, but it would be nice =)

far more important, i'd like to navigate the menu with my keyboard, but i can't figure out how to catch the focus without clicking the cursor! i think this is a basic feature (and improves accessibility too)

so long! keep up the good work, i'm really enjoying my lxde
v43
Posts: 6
Joined: Tue Feb 08, 2011 10:58 pm

Re: lxsession-logout customization and improvements

Post by v43 »

i got rid of the login manager, with a little trick!
i put this line in my .bash_profile
pgrep X >/dev/null || exec startx

so the display manager will start after i login to the console! it couldn't be easier and faster! (are you sure lxde needs a login manager after all? :lol: )

the problem is, when i close the lxde session, it won't logout my user. so i need to change the lxsession-logout commands.
how can i do that?

thank you

EDIT: as suggested by the friends of the arch forum, it was sufficient to change the string to:
pgrep X >/dev/null || exec startx && exit

marvellous!
v43
Posts: 6
Joined: Tue Feb 08, 2011 10:58 pm

Re: lxsession-logout customization and improvements

Post by v43 »

i further improved this not-a-login-manager:
case "`tty`" in
/dev/tty1) clear && startx &>/dev/null && exit;;
esac

so it will automatically start in console 1 only.



now, IT:
i got rid of hal, so now i use hibernate-script to suspend the machine, but the button disappeared from the menu.
so i made a custom script with Xdialog:

Code: Select all

#!/bin/bash


if [ "$1" = "g" ]; then

	if [ -z $DISPLAY ]; then
		cmd='dialog  --clear';
	else
  		cmd='Xdialog';

 		pid=$(pidof -x $(basename $0));
		if [ ${#pid} -gt 6 ]; then 
			exit;
		fi
	fi

	up=`uptime|cut -d, -f 1|cut -c 14-`
	me=`who -s|tail -1|cut -d\  -f 1`

	scelta=$($cmd --title "   $me @ Arch" --shadow \
		--menu "Operativo da: $up \n Terminare la sessione?" 17 35 35 \
		"l" "Log Out"	\
		"s" "Suspend"	\
		"h" "Hibernate"	\
		"k" "Shut Down"	\
		"r" "Restart"	\
		2>&1 >/dev/tty);

# todo: get X focus!
else
	scelta=$1;	
fi


case $scelta in
l)
	sudo killall X;;
k)
	sudo /sbin/shutdown -h now;;
r)
	sudo /sbin/reboot now;;
s)
	sudo hibernate -F /etc/hibernate/ususpend-ram.conf;;
h)
	sudo hibernate -F /etc/hibernate/ususpend-disk.conf;;
*)
	echo "argomento ($scelta) non valido (l logout; k arresta; r riavvia; s sispendi; h iberna; g gui)"; exit;;
esac

exit

and placed it in the main menu ~/.config/lxpanel/LXDE/panels/panel.
to make this work one should edit the sudoers file someway like this:

Code: Select all

%power ALL = (ALL) NOPASSWD: /sbin/halt
%power ALL = (ALL) NOPASSWD: /sbin/shutdown
%power ALL = (ALL) NOPASSWD: /sbin/reboot
%power ALL = (ALL) NOPASSWD: /usr/sbin/s2ram
%power ALL = (ALL) NOPASSWD: /usr/sbin/s2disk
%power ALL = (ALL) NOPASSWD: /usr/sbin/hibernate
%power ALL = (ALL) NOPASSWD: /usr/bin/killall X

i'm just not sure if "killall X" is the proper way to terminate the session.
which commands does lxsession-logout use during the logout??

i think this simple script is more lxde-alike than the lxsession-logout itself! simple, fast, customizable =)

EDITED 18/02: just a little improvement
Locked