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
    Testing with the Kubuntu 14.10 and Kubuntu 15.04. The user account image is: '.face.icon', 64x64 png. – user26687 May 19 '15 at 15:09
  • I should have mentioned that I'm running Kubuntu 14.04 LTS. There was no image by that name in my home folder, so I changed the script to write out to .face.icon. The system's still ignoring any changes. – Edd Baisley May 19 '15 at 18:53
  • What display manager are you using LightDM ? KDM ? – user26687 May 21 '15 at 19:34
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

  • I'm using LightDM, and I know the script is executed when using the Restart option, because in Dolphin the file is there, usually changed (but sometimes random gives you the same one, of course). I didn't add the script in autostart, but used cron to execute it @reboot. The little image next to my user name in the Kicker menu changes, just not the image shown at login, or in System Settings -> User Manager. – Edd Baisley May 22 '15 at 3:30
  • The LightDM user icon is at /var/lib/AccountsService/icons/[user name] – user26687 May 22 '15 at 14:44
  • That did the trick, mang. I was actually doing this for my brother-in-law's computer, which he tasked me with fixing. Now, every time he logs on, he'll be greeted with a different Jeffrey (Goldblum, Fatt, Bridges, etc.). He'll either think it's funny or become infuriated. I appreciate your help. – Edd Baisley May 23 '15 at 13:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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