richardgv / skippy-xd

A full-screen Exposé-style standalone task switcher for X11.
GNU General Public License v2.0
341 stars 78 forks source link

Enable icon + thumbnail mode #40

Open alejandro-perez opened 10 years ago

alejandro-perez commented 10 years ago

Hi,

I love skippy, but sometime the thumbnail is not enough to quicly distinguish a chrome window from a PDF viewer window (too much white). I don't like the icon-only view mode so, would it be possible to add a mix mode where both thumbnail and icon are overlapped. this is typical in other compositors like compiz or kwin.

Regaeds

richardgv commented 10 years ago

Sorry for the late reply, firstly. Pretty busy this week.

Yes, it's possible. I will look into it when I have some time, but maybe this won't occur very soon...

alejandro-perez commented 10 years ago

Thanks for the response. Not too late, don't worry. I will patiently wait for it.

I have a further question, although not directly related to this issue. When I use skippy-xd with xfwm4, windows located at different virtual desktops are not shown. I have seen this is the expected behaviour. However, if I load kwin, then all the previews are correctly loaded, regardless the virtual desktop they are placed. And AFAIK, kwin does not use viewports, but proper desktops.

Regards and thanks for your great work!

richardgv commented 10 years ago

I have a further question, although not directly related to this issue. When I use skippy-xd with xfwm4, windows located at different virtual desktops are not shown. I have seen this is the expected behaviour. However, if I load kwin, then all the previews are correctly loaded, regardless the virtual desktop they are placed. And AFAIK, kwin does not use viewports, but proper desktops.

Unfortunately I don't have a full-blown KDE desktop here, and I cannot enter the workspace settings section because of missing packages -- systemsettings simply crashes. It would be an annoying thing to compile and install the whole suite on Gentoo.

skippy-xd uses _NET_WM_DESKTOP (then fallback to _WIN_WORKSPACE) to determine what virtual desktop a window is on, so if kwin is following the rules, only the windows in current desktop will be displayed. But somehow I saw kwin giving _NET_WM_DESKTOP = 0xFFFFFFFF to windows, which means the window would appear on every desktop. Not really sure what's happening.

By the way, if you want windows on other desktops be displayed, set showAllDesktops and showUnmapped to true in skippy-xd.rc.

alejandro-perez commented 10 years ago

Thanks for the response. I have those options set, but that does not work. [general] distance = 50 useNetWMFullscreen = true ignoreSkipTaskbar = true updateFreq = 60.0 lazyTrans = false pipePath = /tmp/skippy-xd-fifo movePointerOnStart = false movePointerOnSelect = false movePointerOnRaise = false switchDesktopOnActivate = true useNameWindowPixmap = false forceNameWindowPixmap = false includeFrame = true allowUpscale = false showAllDesktops = true showUnmapped = true preferredIconSize = 64 clientDisplayModes = thumbnail icon fill none iconFillSpec = orig mid mid #555555 fillSpec = orig mid mid #000000 background =

capture

alejandro-perez commented 10 years ago

Hi again. I misunderstood your response. Yes, I know that I can see all the windows from all desktops, but I'd love to see their previews (not the icon). When using kwin, this happens. Not sure what xfwm lacks to support that.

Thanks!

richardgv commented 10 years ago

You won't see thumbnails of windows from other desktops because that's normal. Most window managers unmap windows on other virtual desktop, and content of unmapped windows is not accessible (or, actually, undefined), as far as I know. Probably kwin doesn't unmap windows on other virtual desktops so you don't see the problem. Not really sure. I couldn't get kwin's virtual desktop functioning here.

alejandro-perez commented 10 years ago

Thanks for the response. It's clear now.

alejandro-perez commented 10 years ago

Just a comment. I've been playing with wmctrl, and I figured out a workaround for this. You could, prior performing the skippy-xd usual functionality, save (in memory) current window state. Then, move all of them to the current desktop, and uniconify them. Do the selection job. And then, restore all windows to their original position. And give focus to whatever the user selected.

How does it sound? I tried to make a python script that did that, but I was not able to restore it right as I didn't know which window skippy-xd chose.

richardgv commented 10 years ago

I've been playing with wmctrl, and I figured out a workaround for this. You could, prior performing the skippy-xd usual functionality, save (in memory) current window state. Then, move all of them to the current desktop, and uniconify them. Do the selection job. And then, restore all windows to their original position. And give focus to whatever the user selected.

It's an interesting idea, but I guess I won't introduce it in skippy-xd (or at least, will not make it the default behavior), because mapping a window is an action that may have side effects -- the most common one I could think of is, quite a few games pause when they are unmapped and resume when mapped. (So if someone iconified his favorite FPS, went doing something else, opened skippy-xd for some reasons, went back to the game, and he may find him died already.) (Not only could the application be the source of the problem, WM may apply certain rules on windows when you do such actions.)

but I was not able to restore it right as I didn't know which window skippy-xd chose.

Just use the currently focused window. Or you could modify skippy-xd's code to print the window that got focus (around line 643 of src/skippy.c, currently).

alejandro-perez commented 10 years ago

Thanks, it did it with xdotool. Here it is my dirty python3 scrypt:

import subprocess
import re

desktop_pattern = re.compile("(\S+)\s+(\S+).+")
window_pattern = re.compile("(\S+)+\s+(\S+).+")

current_desktop = 0
desktops = subprocess.check_output(["wmctrl", "-d"], universal_newlines=True)
for line in desktops.split("\n"):
    match = desktop_pattern.match(line)
    if (match is not None and match.group(2) is "*"):
        current_desktop = match.group(1)

windows = subprocess.check_output(["wmctrl", "-l"], universal_newlines=True)
moved_windows = {}
for line in windows.split("\n"):
    match = window_pattern.match(line)
    if match is not None and match.group(2) != "-1" and match.group(2) != current_desktop:
        moved_windows[match.group(1)] = match.group(2)
        subprocess.call(["wmctrl", "-i", "-r", match.group(1), "-t", current_desktop])

subprocess.call(["skippy-xd"])

active_window = subprocess.check_output(["xdotool", "getactivewindow"], universal_newlines=True)

for window in moved_windows:
    subprocess.call(["wmctrl", "-i", "-r", window, "-t", moved_windows[window]])

subprocess.call(["wmctrl", "-i", "-a", active_window])

This works, but it is far to be optimal (you can actually see windows being moved :). Nevertheless, I never meant to iconified widnwos, but to windows from other desktops. Anyway, after I have tried it, I'd rather prefer having the showIconOnTopOfPreview functionality. Sometimes you look for a specific window you recognize by the window content, but sometimes is way faster is you want to go directly to thunderbird (true story). I hardly differenciate thunderbird from thunar if both are maximized and I have 20 more windows opened. But the icon... :)

alejandro-perez commented 10 years ago

Hi, I finally made a patch to enable icons on top of thumbnails. This is essential to me. It seems I cannot attach files, but it is small enough to be pasted here:

(Correction, the patch file looks horrible). Let me put it on dropbox: https://www.dropbox.com/s/uc37ln1bqwcqk8f/iconsOnThumbnails.patch

richardgv commented 10 years ago

Well, I'm coming with another, more complicated implementation in d037ecb. (Although this is very late, sorry...) I use the specification in iconFillSpec to position the icon (so that you could even tile the icon... Which looks horrifying. :-D), and use rectangle cropping to avoid corruption when a region on the window not including the area of the icon get damaged.

alejandro-perez commented 10 years ago

Well, that's was the idea :), mi implementation was more like a proof-of-concept (although I use it everyday). I've tested yours, and it seems to work quite fine! Thanks!

richardgv commented 10 years ago

Great! :-)

alejandro-perez commented 10 years ago

make: *\ No rule to make target 'skippy-xd.rc-default', needed by 'install'. Alto.

It seems the file was renamed to skippy-xd.sample.rc. Wasn't it? The Makefile should be updated

richardgv commented 10 years ago

Ooooops, sorry, I've pushed the fix to master. Thanks for reporting!

arkq commented 10 years ago

I've found a little bug in the thumbnail-icon mode. However, I don't know if it is skippy related, or maybe some image library on my box. Firstly, icon transparency is not correctly recognized, and secondly image's rows are shifted to the right. screenshot-2014-10-04-09 35 35

landroni commented 10 years ago

@Arkq Please report this issue that you're seeing as a separate ticket, and include info on your system and version of skippy-xd.