Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I want Ctrl+Alt+L and being idle to trigger

dm-tool switch-to-greeter

(goes to login screen)

instead of lock screen I intend to replace every event where lockscreen would appear to show login screen(but still logged in)

how do I do it?

share|improve this question
    
I have 12.04 TLS according to my help file –  Jani Kovacs Jan 28 at 16:28
add comment

1 Answer 1

To create the shortcut

  • Go to the Settings Manager from the menu.
  • Go to Keyboard.
  • In the Application Shortcuts tab press on Add.
  • Enter dm-tool switch-to-greeter then press OK.
  • Press the desired hotkey.

To run a command after 2 idle minutes

  • Create a bash script, containing:
#!/bin/bash

# The target may depend on your system. i8042 is mouse and keyboard on mine.
log=/proc/interrupts
target=i8042

measure_activity() 
{ 
    count=$1
    interrupts_start=`grep $target $log | awk '{ print $2 }'`
    interrupts_stop=`sleep 1 && grep $target $log | awk '{ print $2 }'`

    if [ "$interrupts_start" == "$interrupts_stop" ] ; then
        ((count++))
        if [ $count -eq 120 ] ; then
            dm-tool switch-to-greeter
            measure_activity 0
        else
            measure_activity $count
        fi
    else
        measure_activity
    fi
}

measure_activity 0 &
  • Make it executable.

  • Add it to Application Autostart tab of Session and Startup.

P.S.: I've got the script from here and I edited it for you.

share|improve this answer
    
thank you this part works, but I also want to go to greeter after being idle for 2 minutes or so. –  Jani Kovacs Jan 28 at 16:35
    
You're right. I didn't see the second part of the question the first time I read it. Now I hope that my answer is complete. –  qxp Jan 28 at 17:45
    
For me it goes to greeter regardless of me moving the mouse or not.. I guess it is because target is not i8042 for me –  Jani Kovacs Jan 28 at 19:36
    
Open /proc/interrupts, move the mouse then open it again. Compare the two logs. The last column is the input, you want to change instead of i8042. Figure out which row you need. It must have different values between the two logs in the first column to be the row, corresponding to mouse movements. It should be one of the "usb" ones. –  qxp Jan 29 at 20:58
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.