1

I've written a nifty little script that selects a random image at reboot and copies it into my home folder, naming it .face. However, my desktop environment is KDE and it seems to be ignoring that file. I tried having the image copied twice, once as .face and again as face.png, then pointing to face.png in KDE System Settings, but that only works the first time, then ignores any future changes. I suspect KDE is resizing and copying the file to which I point in system settings to a different location, but I don't know where.

1 Answers1

0

At here

Testing with the Kubuntu 14.04.2 LTS

Writing a quick&dirty perl script:

#!/usr/bin/perl

use strict;
use warnings;

# modules - package:perlmagick
use Image::Magick;

# Picture files
my @globPictures = glob "/full/path/to/image/directory/*";

# Random file
my $randomPicture = $globPictures[rand @globPictures];

# Icon
my $newIcon;
my $iconResolution = "64x64";
my $iconOut = "$ENV{ HOME }/.face.png";

$newIcon = Image::Magick->new;
$newIcon->Read($randomPicture);
$newIcon->Resize(geometry=>$iconResolution);
$newIcon = $newIcon->Montage(geometry=>$iconResolution, background=>'transparent');
$newIcon->Write($iconOut);

# rename the .face.png to .face.icon
rename $iconOut,"$ENV{ HOME }/.face.icon";

Making the script executable.

Testing the script from konsole -> working. The ~/.face.icon (format is png - not icon) is there and the KDE menu and the KDE System Settings > Account Details has the image.

Adding the script to the Startup and Shutdown > Add script; Run on Shutdown...

Log out - log in -> working

Log out - log in -> working

Seems to work at here.

----afterthought----

Testing with 'Restart/Turn Off Computer' option.

The script is not executed - older bug report: https://bugs.launchpad.net/ubuntu/+source/kde-workspace/+bug/1241870

Harald Sitter (apachelogger) wrote on 2013-10-19: #4

May be that communication between kde-workspace and lightdm is off such that latter will not wait for the session to terminate but simply kill it when it gets the shutdown instruction (which is sent before the scripts are run)...

Testing with the KDM - Make KDM the default display manager

Testing with 'Restart' option - The script is executed.

---edit----

LightDM User icons:

/var/lib/AccountsService/icons/[user name]

Kubuntu Forums: https://www.kubuntuforums.net/showthread.php?63585-How-to-get-lightdm-to-display-user-icon-when-your-is-locked-down-private

Ubuntu Forums: http://ubuntuforums.org/showthread.php?t=1969332

AskUbuntu: Where is the user's profile picture stored in Gnome 3?

Working at here when symlinking the /var/lib/AccountsService/icons/[user name] to ~/.face.icon

user26687
  • 15,174