You are not logged in.

limberger

Beginner

  • "limberger" started this thread

Posts: 2

Location: Brasilia - Brasil

  • Send private message

1

Tuesday, November 14th 2006, 8:54pm

Session Time!

HI!

I want to control my children's time in KDE!

How can i do to give them one hour a day access?

Any idea??

bram85

Professional

Posts: 948

Location: Eindhoven

Occupation: Software Engineer

  • Send private message

2

Tuesday, November 14th 2006, 9:48pm

RE: Session Time!

I don't know if there's a nice and friendly way to do it, but here's my suggestion:

Make a script like this:

Source code

1
2
3
4
5
6
export DISPLAY=:0.0
sleep 1h
kdialog --msgbox "Time to log off"
sleep 5m   # Give them 5 minutes to finish their work and log off
# Force log off
dcop kdesktop default logout


I haven't checked the latter command, probably a confirmation pops up to log off. You can automate this in the Control Center -> KDE Components -> Session Management.

And create a link to an application in their autostart folder (~/.kde/Autostart), by right clicking in an empty space in Konqueror -> New -> Link to Application. This will execute the script with every login.
Bram Schoenmakers
KDE Netherlands (www.kde.nl)

limberger

Beginner

  • "limberger" started this thread

Posts: 2

Location: Brasilia - Brasil

  • Send private message

3

Wednesday, November 15th 2006, 1:59am

RE: Session Time!

Hi Thanks! :)

It works!!!!
I add a control to avoid new login in same day!!!


Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
dia=`date +"%d"`
ultimo=`cat ~/.kde/sessao`
if [ "${dia}" == "${ultimo}" ] ; then
  kdialog --msgbox "You already use your time today!!!"
  dcop kdesktop default logout
  exit 1
fi
echo ${dia} > ~/.kde/sessao
sleep 1h
kdialog --msgbox "Your time is up !!!"
sleep 5m   # 
# force logof
dcop kdesktop default logout



I think i will do a program to count parcial time, show the timer and receive diferents amounts of time depending if is a work day, weekend, vacation.... An applet in the taskbar....