mattintosh note

どこかのエンジニアモドキの備忘録

🐧 Xfce 環境のスクリーンセーバの変更

Linux Mint 17 Xfce で xscreensaver を gnome-screensaver に変更したときのメモ。

Settings Manager にスクリーンセーバの切り替え項目はなく、/usr/bin/xflock4light-locker-commandxscreensaver-commandgnome-screensaver-command の優先順位で自動的にスクリーンセーバコマンドを検出するようになっている。

/usr/bin/xflock4

#!/bin/sh
#
#  xfce4
#
#  Copyright (C) 1999, 2003 Olivier Fourdan (fourdan@xfce.org)
#  Copyright (C) 2011       Guido Berhoerster (guido+xfce.org@berhoerster.name)
#  Copyright (C) 2011       Jarno Suni (8@iki.fi)
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#

PATH=/bin:/usr/bin
export PATH

# Lock by xscreensaver, gnome-screensaver, or light-locker, if a respective daemon is running
for lock_cmd in \
    "light-locker-command -l" \
    "xscreensaver-command -lock" \
    "gnome-screensaver-command --lock"
do
    $lock_cmd >/dev/null 2>&1 && exit
done

# else run another access locking utility, if installed
for lock_cmd in \
  "xlock -mode blank" \
  "slock"
  do
    set -- $lock_cmd
    if command -v -- $1 >/dev/null 2>&1; then
        $lock_cmd >/dev/null 2>&1 &
    # turn off display backlight:
    xset dpms force off
        exit
    fi
done

# else access locking failed
exit 1

xscreensaver を削除して gnome-screensaver を新たにインストールする。xscreensaver の方は xscreensaver-data などのパッケージもあるので不要それらも削除する。

sudo apt-get remove xscreensaver
sudo apt-get install gnome-screensaver