Results 1 to 10 of 10

Thread: LightDM login and logout scripts

Hybrid View

  1. #1
    Join Date
    Apr 2013
    Beans
    1

    Re: LightDM login and logout scripts

    Unfortunately this blog is the best documentation of the session-cleanup-script-option, that I found. That's why I'm posting my solution here.

    I wanted a cleanup-possibility on a by-user-basis... this is how i did it:

    in /etc/lightdm/lightdm.conf:
    Code:
    user-session=ubuntu
    greeter-session=unity-greeter
    session-cleanup-script=/usr/local/bin/lightdm_cleanup.sh
    in /usr/local/bin/lightdm_cleanup.sh:
    Code:
    #! /bin/sh
    if [ -e $HOME/.lightdm_cleanup.sh ]; then su -c "$HOME/.lightdm_cleanup.sh" $USER; fi
    now every user can create his own .lightdm_cleanup.

  2. #2
    Join Date
    May 2008
    Location
    United Kingdom
    Beans
    4,407
    Distro
    Lubuntu 16.04 Xenial Xerus

    Re: LightDM login and logout scripts

    Quote Originally Posted by johnklemen View Post
    I wanted a cleanup-possibility on a by-user-basis... this is how i did it…
    Gosh, I had forgotten about this thread! There is another thread where I have done exactly as you have done (see post #9 of that thread).

    However, there still remains a problem (post #20):

    The script runs when I log out by restarting the machine, but it does not run when I merely log out without restarting. So, restarting will run the script, but logging out and then either logging back in or restarting will not run the script.

    I have yet to find a solution to that problem.
    Full system encryption with dual-boot —— Full Circle Magazine —— Problems with WINE?
    In my day, we had the outdoors in which to run, play, and socialise. Now people use computers for that.

  3. #3
    Join Date
    Apr 2012
    Location
    Quebec, Canada
    Beans
    261
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: LightDM login and logout scripts

    For some reason, I never got this to work.

    Here's my lightdm.conf file:

    Code:
    [SeatDefaults]
    user-session=ubuntu
    greeter-session=unity-greeter
    display-setup-script=/etc/lightdm/lightdmxrandr.sh
    allow-guest=false
    session-setup-script=/home/Scripts/wallpaper_logon.sh
    session-cleanup-script=/home/Scripts/wallpaper_logoff.sh
    I have an XML file as background, which LightDM does not display (Instead, I can choose a custom background for LightDM!). However, during login, the wallpaper does not fade, and I would love to.

    When I log in, LightDM would be supposed to run this script (Yes, my scripts are executables):

    Code:
    #!/bin/sh
    sleep 4
    gsettings set org.gnome.desktop.background picture-options 'stretched'
    gsettings set org.gnome.desktop.background picture-uri file:///usr/share/backgrounds/friendship_v3/background-1.xml
    Nothing happen. Running the script manually, or adding it to startup applications work, however...

    And at logoff, I want to change it back to LightDM background:

    Code:
    #!/bin/sh
    gsettings set org.gnome.desktop.background picture-uri file:///usr/share/backgrounds/LoginWallpaper4.jpg
    sleep 2
    gnome-session-quit --no-prompt
    gnome-session-quit --no-prompt actually logoff properly, if I run the script manually.

    This is really confusing. Where are my wallpapers supposed to be located? In my Home, or in /Etc/Lightdm ? Same question for the login and logoff scripts ?

    Thank you!

  4. #4
    Join Date
    May 2008
    Location
    United Kingdom
    Beans
    4,407
    Distro
    Lubuntu 16.04 Xenial Xerus

    Re: LightDM login and logout scripts

    GameX2, I'm not entirely sure about your situation. I have two questions:

    1. Which version of Ubuntu are you using?
    2. Why do you have the sleep commands in your scripts? Try doing this again without the sleep.
    Full system encryption with dual-boot —— Full Circle Magazine —— Problems with WINE?
    In my day, we had the outdoors in which to run, play, and socialise. Now people use computers for that.

  5. #5
    Join Date
    Apr 2012
    Location
    Quebec, Canada
    Beans
    261
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: LightDM login and logout scripts

    Quote Originally Posted by Paddy Landau View Post
    GameX2, I'm not entirely sure about your situation. I have two questions:

    1. Which version of Ubuntu are you using?
    2. Why do you have the sleep commands in your scripts? Try doing this again without the sleep.
    Thanks for your reply.

    I now use Ubuntu 13.04, but I also have Ubuntu 12.04 installed on the same computer. I can't get it to work on both versions.

    I can put my script "LoginWallpaper.sh" in my startup applications, and it's working. The reason why I have to put the sleep command, is that otherwise, I login, and the background immediately change (Right now, without any delay. I don't see the background fading). I want to avoid such a rapid change. My goal: I have a custom LightDM background - when I login, I still see the LightDM background, then 3-4 seconds later, the background fade to my XML.

    If I run the script Wallpaper_Logoff.sh manually, which set my Desktop background identical to the LightDM background and log me out automatically, this work. But I can't make the script run everytime I logoff/reboot/shutdown.

    A workaround would probably be to run this script, only at login:

    Code:
    gsettings set org.gnome.desktop.background picture-uri file:///usr/share/backgrounds/LoginWallpaper4.jpg
    sleep 4
    gsettings set org.gnome.desktop.background picture-options 'stretched'
    gsettings set org.gnome.desktop.background picture-uri file:///usr/share/backgrounds/friendship_v3/background-1.xml
    At login, I assume LightDM would immediately change my desktop background to the current LightDM background (This sentence sound weird.. Well, my current Desktop background would be identical to the LightDM background). Then 4 seconds later, when the Desktop will appear, the background should fade to the other one.

    Can I even run the command " gsettings set org.gnome.desktop.background picture " from LightDM at all ? I've tried so many times, and never got it working. Even tried changing ownership of the backgrounds to root or "LightDM", no luck.


    Thank you very much.

  6. #6
    Join Date
    May 2008
    Location
    United Kingdom
    Beans
    4,407
    Distro
    Lubuntu 16.04 Xenial Xerus

    Re: LightDM login and logout scripts

    Quote Originally Posted by GameX2 View Post
    Can I even run the command " gsettings set org.gnome.desktop.background picture " from LightDM at all?
    That's a good question. Remember that LightDM runs as root, as I recall, so you'd have to run gsettings as yourself:
    Code:
    su "${USER}" --command gsettings
    Beware if you have other users on the same computer, as the code will affect them. You can put in a condition (replace gamex2 with your user name):
    Code:
    if [[ "${USER}" == 'gamex2' ]]
    then
            su "${USER}" --command gsettings
    fi
    This is not something that I have tried, particularly XML wallpaper (I didn't realise that it was possible), so I cannot be sure that this will work.
    Full system encryption with dual-boot —— Full Circle Magazine —— Problems with WINE?
    In my day, we had the outdoors in which to run, play, and socialise. Now people use computers for that.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •