Announcement

Collapse
No announcement yet.

Right click wallpaper changer.

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Right click wallpaper changer.

    The ability to change your current desktop wallpaper "on-the-fly" has always been missing from kde4. From what I can tell, it's mostly because kde4 has so many varying ways to change or set your background that it's too complicated (at least for now) to use a simple command. I'm a pretty simple guy and my desktop isn't fancy - I only use one desktop anymore - but I like to change the image once in a while. Well, doing this requires several steps, locate image, right-click desktop, select Default Desktop Settings... etc., etc., ad nauseum. I wanted to be able to do it with a single right-click on the image - and now I can.

    Note: This is a very specific use case. AFAIK, it only works as I describe - on a single desktop - nothing fancy. YMMV

    Turns out our KDE4 has a slideshow setting for desktop wallpaper. If you only have one slide; nothing changes, the desktop image remains the same.

    So I wrote a servicemenu that erases the previous desktop image and replaces it with your new selection. Here's how to do this:

    1. Create a folder for your "slideshow" of one. I used a hidden folder in my home called .background. You can use any location you like.
    2. Right-click on your desktop and select "Default Desktop Settings" then under Wallpaper, select "Slideshow" and add your directory using the "Add Folder" button, set the "change image every.." to 10 seconds, Apply, and exit. You desktop will go black - this is normal (no images yet to display).
    3. Open kate (or your favorite text editor) and paste in this text:

    Code:
    [Desktop Entry]Type=Service
    ServiceTypes=KonqPopupMenu/Plugin
    MimeType=image/*
    Actions=Background
    
    
    [Desktop Action Background]
    Icon=image-x-generic
    Name=Set Wallpaper
    Exec=/bin/rm ~/.background/* && /bin/cp %f ~/.background
    Don't forget the extra blank line at the end.

    4. Save this file as wallpaper.desktop in your home under ~/.kde/share/kde4/services/ServiceMenus/
    5. Close any currently open instances of Dolphin and then open Dolphin.
    6. Navigate to any image with Dolphin, right-click on it and select "Set Wallpaper"

    It should appear almost immediately. Repeat #6 and see your new image show up.

    If you want to use this to add an image to your desktop slideshow rather than replace it, use this servicemenu with both options (Set or Add)

    Code:
    [Desktop Entry]Type=Service
    ServiceTypes=KonqPopupMenu/Plugin
    MimeType=image/*
    Actions=Background;Add
    
    
    [Desktop Action Background]
    Icon=image-x-generic
    Name=Set Wallpaper
    Exec=/bin/rm ~/.background/* && /bin/cp %f ~/.background
    
    
    [Desktop Action Add]
    Icon=image-x-generic
    Name=Add Wallpaper
    Exec=/bin/cp %f ~/.background
    If you do this one, you might want longer than 10 seconds with each image.

    Simple and fun!
    Last edited by oshunluvr; Nov 01, 2014, 06:39 AM.

    Please Read Me

    #2
    Originally posted by oshunluvr View Post
    The ability to change your current desktop wallpaper "on-the-fly" has always been missing from kde4. From what I can tell, it's mostly because kde4 has so many varying ways to change or set your background that it's too complicated (at least for now) to use a simple command. I'm a pretty simple guy and my desktop isn't fancy - I only use one desktop anymore - but I like to change the image once in a while. Well, doing this requires several steps, locate image, right-click desktop, select Default Desktop Settings... etc., etc., ad nauseum. I wanted to be able to do it with a single right-click on the image - and now I can.
    Just FYI, there is a fairly simple and straight forward method of changing the wallpaper:
    1. Unlock widgets (if locked)
    2. Drag-and-drop the image file to the desktop
    3. Choose wallpaper from the pop-up menu

    Don't wish to take anything away from your service menu, though, creative thinking on your part

    EDIT: you can probably also change the wallpaper with a dbus call or kwriteconfig, if one is looking for a CLI way (to be used in a script or service menu)
    Last edited by kubicle; Nov 01, 2014, 07:15 AM.

    Comment


      #3
      Older, Two click wallpaper change : https://www.kubuntuforums.net/showth...l=1#post195650
      Have you tried ?

      - How to Ask a Question on the Internet and Get It Answered
      - How To Ask Questions The Smart Way

      Comment


        #4
        Originally posted by kubicle View Post
        Just FYI, there is a fairly simple and straight forward method of changing the wallpaper:
        1. Unlock widgets (if locked)
        2. Drag-and-drop the image file to the desktop
        3. Choose wallpaper from the pop-up menu

        Don't wish to take anything away from your service menu, though, creative thinking on your part

        EDIT: you can probably also change the wallpaper with a dbus call or kwriteconfig, if one is looking for a CLI way (to be used in a script or service menu)
        I didn't know about the drag-n-drop function. That's very cool. Like I said - lots of new ways to change wallpaper with kde4. Now I have two ways to do it.

        All my research showed the older dbus and kwriteconfig ways only worked if you re-start plasma, which seems like using a sledge hammer to hang a picture.

        Please Read Me

        Comment


          #5
          dbus

          https://code.google.com/p/ksetwallpaper/
          Code:
          Usage example
          
          dbus-send --session --dest=org.new_wallpaper.Plasmoid --type=method_call \
              /org/new_wallpaper/Plasmoid/0 org.new_wallpaper.Plasmoid.SetWallpaper \ 
              string:/path/to/your/wallpaper



          More links

          - Set Wallpaper from Command-line in KDE4: http://blog.zx2c4.com/699
          Last edited by Rog132; Nov 01, 2014, 09:38 AM.
          A good place to start: Topic: Top 20 Kubuntu FAQs & Answers
          Searching FAQ's: Google Search 'FAQ from Kubuntuforums'

          Comment


            #6
            I looked for a half hour for that Rog and never found it. Now we have 3 ways to do it!

            Please Read Me

            Comment


              #7
              dbus with the plasma 5

              Bug 217950 - Ability to set desktop wallpaper via a dbus command: https://bugs.kde.org/show_bug.cgi?id=217950
              --> Comment 42: https://bugs.kde.org/show_bug.cgi?id=217950#c42
              Add method to run a script from DBus directly
              That is - run a java scrip to set the plasma wallpaper - Plasma reviewboard has an example script: https://git.reviewboard.kde.org/r/125648/



              From cli:
              Code:
              qdbus org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.evaluateScript 'var allDesktops = desktops();print (allDesktops);for (i=0;i<allDesktops.length;i++) {d = allDesktops[i];d.wallpaperPlugin = "org.kde.image";d.currentConfigGroup = Array("Wallpaper", "org.kde.image", "General");d.writeConfig("Image", "file:///media/sda2/Background/SpaceWall/Escape_Function.jpg")}'

              Full images:
              - http://i.imgur.com/4akLnoK.jpg
              - http://i.imgur.com/myMSA7E.jpg

              Seems to work.

              Will be available with the Plasma 5.6+
              --> Plasma 5.7 planned release: https://community.kde.org/Schedules/Plasma_5
              5.7.0 Release Tue 2016-07-05
              Last edited by Rog131; May 10, 2016, 05:46 AM.
              Before you edit, BACKUP !

              Why there are dead links ?
              1. Thread: Please explain how to access old kubuntu forum posts
              2. Thread: Lost Information

              Comment

              Working...
              X