A live wallpaper program and desktop icons in mate

Everything about X, Gnome, KDE, ... and everything running on it

A live wallpaper program and desktop icons in mate

Postby Ezingers » 2018-10-29 03:13

I am using Debian 9 (stretch) with Mate desktop. komorebi wallpaper manager with live wallpaper. It works fine with mate along with compiz reloaded. The problem is that all the basic icons on the on the desktop when komorebi is running. In the basic icon pack for mate is trash folder, home folder, computer: which is all the filing system folders, and the mounts which is for the cd/dvd and external mounted devices. All it shows is the trash folder and it does show any new folder I make. And as you see from the script below, it seem to be the only icons it's suppose to show. What code do I need to add to this script to show all the basic icons on the desktop when komorebi is running.
Code: Select all
using Gtk;
using Gee;
using Clutter;

using Komorebi.Utilities;

using GLib.Environment;

namespace Komorebi.OnScreen {

    // File/Directory info Window
    InfoWindow infoWindow;

    public class DesktopIcons : ResponsiveGrid {

        BackgroundWindow parent;
        public BackgroundWindow window { get { return parent; } }

        /* Desktops path */
        string DesktopPath = Environment.get_user_special_dir(UserDirectory.DESKTOP);

        FileMonitor fileMonitor;

        // List of icons (used to make things faster when reloading)
        public Gee.ArrayList<Icon> iconsList { get; private set; }

        public DesktopIcons (BackgroundWindow parent) {
            this.parent = parent;

            infoWindow = new InfoWindow();
            iconsList = new Gee.ArrayList<Icon>();

            margin_top = 60;
            margin_left = 120;
            y_expand = true;
            iconSize = 64;

            monitorChanges();
            getDesktops();
        }

        /* Watch for Changes */
        void monitorChanges () {

            fileMonitor = File.new_for_path(DesktopPath).monitor(0);

            fileMonitor.changed.connect((e,a,event) => {
                if(event == FileMonitorEvent.DELETED || event == FileMonitorEvent.CREATED) {
                    getDesktops();
                    addIconsFromQueue();
                }


            });
        }

        /* Get .desktop(s) */
        public void getDesktops () {

            iconsList.clear();
            grabDesktopPaths();
            addTrashIcon();
        }

        /* Adds all icons from the queue */
        public void addIconsFromQueue () {

            itemsLimit = (int)Math.round(screenHeight / (83 + verticalLayout.spacing));

            clearIcons();
            destroy_all_children();

            foreach (var icon in iconsList) {
                append(icon);
                icon.unDimIcon();
            }
        }

        /* Async get desktop items */
        public void grabDesktopPaths () {

            var desktopFile = File.new_for_path (DesktopPath);

            // Reads all files in the directory
            var Enum = desktopFile.enumerate_children ("standard::*", FileQueryInfoFlags.NOFOLLOW_SYMLINKS);
            FileInfo info;

            while ((info = Enum.next_file ()) != null) {

                // Location of the file
                string FilePath = DesktopPath + "/" + info.get_name ();

                string name = info.get_name();
                Gdk.Pixbuf iconPixbuf = null;
                var Path = FilePath;
                var DFile = File.new_for_path(FilePath);
                OnScreen.Icon icon = null;

                /* Check if the file is .desktop */
                if(DFile.get_basename().has_suffix(".desktop")) {

                    var keyFile = new KeyFile();
                    keyFile.load_from_file(DFile.get_path(), 0);

                    // make sure the keyFile has the required keys
                    if(!keyFile.has_key(KeyFileDesktop.GROUP, KeyFileDesktop.KEY_NAME) ||
                        !keyFile.has_key(KeyFileDesktop.GROUP, KeyFileDesktop.KEY_ICON) ||
                        !keyFile.has_key(KeyFileDesktop.GROUP, KeyFileDesktop.KEY_EXEC))
                        continue;

                    name = keyFile.get_string(KeyFileDesktop.GROUP, KeyFileDesktop.KEY_NAME);

                    var iconPath = keyFile.get_string(KeyFileDesktop.GROUP, KeyFileDesktop.KEY_ICON);

                    iconPixbuf = Utilities.getIconFrom(iconPath, iconSize);

                    Path = keyFile.get_string(KeyFileDesktop.GROUP, KeyFileDesktop.KEY_EXEC);

                    icon = new Icon(this, name, iconPixbuf, Path, DFile.get_path(), true);



                } else {

                    string iconPath = LoadIcon(DFile);

                    if(iconPath == null) {
                        if(DFile.query_file_type(FileQueryInfoFlags.NONE) == FileType.DIRECTORY)
                            iconPath = "folder";
                        else {

                            var iconQuery = DFile.query_info("standard::icon", 0).get_icon ().to_string().split(" ");
                            if(iconQuery.length > 1)
                                iconPath = iconQuery[iconQuery.length - 1];
                        }

                        iconPixbuf = Utilities.getIconFrom(iconPath, iconSize);

                    } else
                        iconPixbuf = new Gdk.Pixbuf.from_file_at_scale(iconPath, iconSize, iconSize, false);


                    icon = new Icon(this, name, iconPixbuf, "", DFile.get_path(), false);
                }


                iconsList.add(icon);

            }
        }

        /* Adds trash icon */
        private void addTrashIcon() {

            iconsList.add(new Icon.Trash(this));
        }


        /* Creates a new folder */
        public void createNewFolder () {

            var untitledFolder = File.new_for_path(getUntitledFolderName());
            untitledFolder.make_directory_async();

        }

        /* Pastes a file from a given path to desktop */
        public void copyToDesktop (string path) {

            // Get the actual GLib file
            var file = File.new_for_path(path);
            var desktopFile = File.new_for_path(desktopPath + "/" + file.get_basename());
            file.copy(desktopFile, FileCopyFlags.NONE, null);

        }

        /* Finds the icon of a file and returns as string */
        string LoadIcon (File file) {

            /* Check if it's a .desktop */
            if(file.get_basename().has_suffix(".desktop")) {

                try {

                    var _KeyFile = new KeyFile();

                    _KeyFile.load_from_file(file.get_path(), 0);

                    return _KeyFile.get_string(KeyFileDesktop.GROUP,
                                               KeyFileDesktop.KEY_ICON);

                } catch {


                }

            }

            var Standard = FileAttribute.STANDARD_ICON;
            var Thumb = FileAttribute.THUMBNAIL_PATH;
            var CustomName = "metadata::custom-icon-name";
            var CustomIcon = "standard::icon";

            var Query = "%s,%s,%s,%s".printf(Thumb, Standard, CustomIcon, CustomName);

            var Info = file.query_info (Query, 0);

            // look for a thumbnail
            var thumb_icon = Info.get_attribute_byte_string (Thumb);
            if (thumb_icon != null && thumb_icon != "")
                return thumb_icon;

            // otherwise try to get the icon from the fileinfo
            return null;

        }

        public void fadeIn () {

            save_easing_state ();
            set_easing_duration (200);
            opacity = 255;
            set_easing_mode (Clutter.AnimationMode.EASE_IN_SINE);
            restore_easing_state ();

        }

        public void fadeOut () {

            save_easing_state ();
            set_easing_duration (200);
            opacity = 0;
            set_easing_mode (Clutter.AnimationMode.EASE_IN_SINE);
            restore_easing_state ();

        }

        /* Returns a new Untitled Folder name */
        private string getUntitledFolderName(int count = 0) {

            string path = desktopPath + @"/New Folder($(count.to_string()))";
            if(File.new_for_path(path).query_exists())
                path = getUntitledFolderName(count + 1);

            return path;
        }

    }
}
Ezingers
 
Posts: 40
Joined: 2015-02-28 18:32

Re: A live wallpaper program and desktop icons in mate

Postby bw123 » 2018-10-29 13:38

User avatar
bw123
 
Posts: 3572
Joined: 2011-05-09 06:02
Location: TN_USA

Re: A live wallpaper program and desktop icons in mate

Postby Ezingers » 2018-10-30 04:09

Tried that. Doesn't seem to be answering his posts. And I search for MATE forums and it gives me a list of linux distros. I click on Debian and this is where it sends me. Don't know where else to go if he's not answering his posts.

P.S. Found this code in (komorebi-master/data/other/postrm). Don't know if MATE uses gnome or nemo for it's icons. I don't even know what nemo is.

Code: Select all
#!/bin/bash
echo "[INFO] Ignore any errors"
echo "[*] Resetting desktop configuration"
gsettings set org.gnome.desktop.background show-desktop-icons true || true
gsettings set org.nemo.desktop show-desktop-icons true || true
Ezingers
 
Posts: 40
Joined: 2015-02-28 18:32

Re: A live wallpaper program and desktop icons in mate

Postby debiman » 2018-10-30 06:28

0. komorebi is not in debian stable repos. how are you even using it.

1.
Ezingers wrote:Tried that.
tried what? there's 89 open and 49 closed issues. i don't think the idea was to just open another one, but to look at existing issues.

I search for MATE forums and it gives me a list of linux distros. I click on Debian and this is where it sends me.

erm, what???
User avatar
debiman
 
Posts: 3064
Joined: 2013-03-12 07:18

Re: A live wallpaper program and desktop icons in mate

Postby stevepusser » 2018-10-30 18:42

Either the OP compiled it themself, is using an Ubuntu or Debian deb from the developer, a PPA version, or the version I built on Stretch for MX Linux: http://mxrepo.com/mx/testrepo/pool/test/k/komorebi/

It does offer some nice eye-candy. Here's one wallpaper I made for it that's garish, though--disco forever!!!!

https://drive.google.com/open?id=10Fyo8 ... wRUSOHBGSh
The MX Linux repositories: Backports galore! If we don't have something, just ask and we'll try--we like challenges. New packages: Flightgear 2018.2.2, tlp-ui, wine-staging 3.21, Pale Moon 28.2.2, Mesa 18.2.6, Midori 7.0
User avatar
stevepusser
 
Posts: 10245
Joined: 2009-10-06 05:53

Re: A live wallpaper program and desktop icons in mate

Postby Innovate » 2018-11-02 22:10

Not worth it, known that feel...
I've already tried it before on Xfce it's like other desktop environment shell masking.
All your wallpaper, desktop icons & right click menu are replace with komorebi!
It's not that just simple wallpaper like you think it's more than that.
It can be handy with openbox but your right click option will be replace.
The dev himself perhaps didn't aware he already create DE already.
If the dev add more utilities, plugin functions for komorebi it'd become complete new DE.
Making wallpaper changer shouldn't affect icons & mutate desktop menu
otherwise it'd become desktop environment passively.

It's interesting app but it need more implements not to mess by replace desktop icons
& DEdesktop menu permanently it should give option use to switch back return
default DE's desktop icons & context menu back & keep komorebi's changing
wallpaper function with any other DEs.
Innovate
 
Posts: 174
Joined: 2015-12-27 01:28
Location: /dev/urandom


Return to Desktop & Multimedia

Who is online

Users browsing this forum: No registered users and 3 guests

fashionable