1

I have 2 screen where one is normal horizontal, and the other one is vertical.

After I changed that files that I download to desktop are no longer visible. I can see them in Nautilus->Desktop, but not by bare eye. I guess Ubuntu puts those files in the virtual area below BenQ monitor and leftOf the vertical monitor.

Any ideas how to solve this?

Note: Files on my desktop are manually sorted and Keep Aligned is ticked off!

This is not the duplicate of How to configure GNOME 3 to show icons on desktop as this does not deal with desktop icons like Trash, My Network, etc. The actual file is not visible on BENQ screen. I also installed this app, but it neither helps nor has the feature mentioned in that post. I guess the post is too old and the app had changed as of then.

ubuntico
  • 2,802
  • I see no files on my desktop either, one mo, I need to find the dupe – Tim May 04 '15 at 12:59
  • 1
    It is most likely a bug, but that does not mean we cannot solve it :). To confirm your assumption, please open your Desktop Folder, open a terminal window and run: gvfs-info + a space, then drag one of the "hidden" items over the terminal window. Then look for the coordinates in the line: metadata::nautilus-icon-position: Please post back the coordinates. – Jacob Vlijm May 04 '15 at 13:19
  • @ubuntico that still applies I think... Try it? – Tim May 04 '15 at 13:29
  • @JacobVlijm metadata::nautilus-icon-position: 64,1382. So I was right, it's on the virtual space below BENQ which forms invisible square – ubuntico May 04 '15 at 13:53
  • 1
    Then the assumption is correct, that is below the left screen (1080), but on the left of the right screen, in the "blind" section. I will look into it, will get back. – Jacob Vlijm May 04 '15 at 13:55
  • 1
    Don't think I am forgetting you, but it'll be tomorrow :) – Jacob Vlijm May 04 '15 at 20:38
  • What happens if you move the file to /tmp and then move it to your desktop? (not /home/user/desktop, but the actual desktop) – Fabby May 04 '15 at 22:07
  • It stays where I place it. This happens when I download a file and its auto-placed. – ubuntico May 05 '15 at 07:35
  • @ubuntico I made a background script, it does work, but it is still buggy, deleted it for now, still working on it. In the meantime, I am curious: what happens if you press F5? – Jacob Vlijm May 05 '15 at 10:34
  • @JacobVlijm Thanks. Nothing happens as all sorting has been turned off. I manually sort things. I think this is an odd buy in Ubuntu. I have no idea how it works on other systems. There is more: if I move the cursor to the right screen to the part below 1080px and try to move left, the cursor will not jump to screen left, but it will hit the invisible wall. If I move up, up along the wall, at 1080px of Y axis I will appear on the left screen. I am also surprised that there are no other users like me. Linux users don't use vertical displays :) – ubuntico May 05 '15 at 13:30
  • The last thing you mention is expected behavior, since both screens are in/on the same virtual desktop. The main issue of this question is a bug however. I am pretty sure I can get it fixed and it is a nice challenge to do. It will take some time however :) – Jacob Vlijm May 05 '15 at 13:35
  • ubuntico, is the problem still "allive" . I have a perfectly working script, can post it tonight if still needed. – Jacob Vlijm May 20 '15 at 08:31
  • @JacobVlijm Yes, but I "solved" it by turning the monitor back to horizontal :). Post it and I will test it. It will also help others. – ubuntico May 20 '15 at 12:17
  • Just curious, but did you have the opportunity to test? – Jacob Vlijm May 27 '15 at 14:11

1 Answers1

2

What happens

Your assumption that the downloaded files "landed" in the "blind" area is correct: You can get the icons position with the command:

gvfs-info <item>

This outputs the coordinates 64,1382 (x/y), which makes clear the icon is positioned below the left screen (1382 > 1080).

This is most likely the result of a bug.

The script below can be used to move newly created files on the virtual (spanning) desktop from one area (e.g. the invisible section) to another location (in this case: the visible section).

Properties of the script

Although the script seems extended, it is written in such a way that unnecessary actions and routines are avoided. If no new items appear on the desktop, it only checks for new files, causing a processor load of practically none.

What it does

  • Once per second, the script checks for new items in the desktop folder
  • If new item(s) are found, it checks the location, moves them into the visible area if necessary

enter image description here

However, the desktop needs to be refreshed after the items are moved, which can only be done if the desktop is the frontmost "folder". The script therefore sets refresh to True. On the first occasion the desktop is in front, the script:

  • refreshes the desktop.

How to use

The script needs both xdotool and wmctrl to be installed:

sudo apt-get install xdotool
sudo apt-get install wmctrl

xautomation should already be on your system, but in case it is not:

sudo apt-get install xautomation

Then:

  • Copy the script below into an empty file, save it as blind_area.py
  • In the head section of the script, set the size of your left screen:

    left_scr = [1920, 1080]
    
  • Set the localized name for your desktop folder (probably just "Desktop", but in Dutch it would be "Bureaublad" for example)

  • Set the resolution of the left screen if it is different from what I set
  • Test-run the script by the command:

    python3 /path/to/blind_area.py
    
  • I test-ran it by setting the vertical size of my screen to half its actual size, which moved all new(!) icons to the top 50% of my screen.

  • Note that the move actions will be visible once you clicked the desktop (or have the desktop in front in any way).
  • If all works fine, add it to your startup applications: Dash > Startup Applications > Add the command:

    /bin/bash -c "sleep 15&&python3 /path/to/blind_area.py"
    

The script

#!/usr/bin/env python3
import subprocess
import os
import time

#--- set localized name of the Desktop folder below
desktop_name = "Desktop"
#--- set the resolution of the left screen below
left_scr = [1920, 1080]
#---

get = lambda cmd: subprocess.check_output(["/bin/bash", "-c", cmd]).decode("utf-8")
home = os.environ["HOME"]
dr = home+"/"+desktop_name
# used strings
val = " 'metadata::nautilus-icon-position' "
search = "gvfs-info -a"+val
set_val = "gvfs-set-attribute -t string "
refresh_cmd = "xte 'key F5'"
# function to check if desktop is in front
def check_frontmost():
    try:
        frontmost = str(hex(int(get("xdotool getwindowfocus").strip())))
        frontmost = frontmost[:2]+"0"+frontmost[2:]
        w_list = [l.split() for l in get("wmctrl -lG").splitlines()]
    except subprocess.CalledProcessError:
        return False
    else:
        check = len([l for l in w_list if all([str(space[0]) in l, frontmost in l, str(space[1]) in l])]) > 0
        return check
# function to get the resolution
def get_res():
    xr = get("xrandr").split(); pos = xr.index("current")
    return [int(xr[pos+1]), int(xr[pos+3].replace(",", "") )]

dtfiles_1 = []
refresh = False

while True:
    # check current files
    time.sleep(1)
    dtfiles_2 = os.listdir(dr)
    # check for new files, move if necessary
    newfiles = [f for f in dtfiles_2 if all([
        not f in dtfiles_1,
        not f.endswith("~"),
        not f.startswith("."),
        ])]
    if len(newfiles) != 0:
        # check desktop size (only if new files appear)
        space = get_res()
    for f in newfiles:
        fdir = os.path.join(dr, f);  fdir = "'"+fdir+"'" if fdir.count(" ") != 0 else fdir
        try:
            loc = [int(n) for n in eval(get(search+fdir).split()[-1:][0])]
        except:
            pass
        else:
            if all([loc[0] < left_scr[0], loc[1] > left_scr[1]]):
                command = set_val+fdir+" "+val+str(loc[0])+","+str(loc[1]-left_scr[1])
                subprocess.Popen(["/bin/bash", "-c", command])
                refresh = True
    if all([refresh == True, check_frontmost() == True]):
        subprocess.Popen(["/bin/bash", "-c", refresh_cmd])
        refresh = False
    dtfiles_1 = dtfiles_2

Notes

  • Although I tested it for a long time on my system, the bug does not appear on my system, so the "real" test can only be done by you :)
  • If the desktop is really crowded with lots if items, the refresh action might arrange icons into a "forbidden" area. I could not test however if that is the case in your situation, for the same reason as above.
  • The script, as it is, assumes the screens are top-alligned, so the "blind" area is only on the left bottom corner.
Jacob Vlijm
  • 83,767