0

AFAIK alias is usually used to make 'shortcut' for long command. But what to do if I want to alias one command to another?

I need this because I replaced gnome-screensaver with xscreensaver, so the lock screen button does not work.

How to alias gnome-screensaver-command -l to be resolved into xscreensaver-command -lock?

Danatela
  • 13,243
  • 11
  • 45
  • 72
  • I expect you're using Unity but in XFCE the lock function is handled by /usr/bin/xflock4. That's a script you can edit to prioritize gnome-screensaver or xscreensaver (or others). I don't know if it exists in Unity systems but something similar must. – Sean Apr 12 '14 at 03:40
  • Thanks for the quick feedback, but in Unity there is no xflock4. changed my question to be more relevant to the actual problem. – Danatela Apr 12 '14 at 04:22
  • @Danatela - duplicate of this? http://askubuntu.com/questions/75692/lock-screen-when-xscreensaver-is-installed?rq=1 – fossfreedom Apr 12 '14 at 12:18
  • @fossfreedom no, sudo ln -s /usr/bin/xscreensaver-command /usr/bin/gnome-screensaver-command doesn't work. – Danatela Apr 13 '14 at 07:00
  • what version of Ubuntu are you using? – fossfreedom Apr 13 '14 at 08:51
  • @fossfreedom 13.10 – Danatela Apr 14 '14 at 01:57

1 Answers1

0

It was easier than I thought. I had to create such shell script:

#!/bin/bash

case "$1" in
    -l)
        xscreensaver-command -lock
        ;;
    *)
        xscreensaver-command "$@"
        ;;
esac

Saved it as /usr/bin/gnome-screensaver-command and added execute permission:

sudo chmod +x /usr/bin/gnome-screensaver-command

Now, executing gnome-screensaver-command -l launches xscreensaver-command -lock and locks my screen.

Danatela
  • 13,243
  • 11
  • 45
  • 72