dylanaraps / sowm

An itsy bitsy floating window manager (220~ sloc!).
MIT License
915 stars 73 forks source link

Focus cycle to root window #78

Open huijunchen9260 opened 4 years ago

huijunchen9260 commented 4 years ago

Today I tried sowm, and I realize some problems.

Let's say we have two windows in the same workspace. When I cycle through them, it does not cycle between them. It is cycling window1, window 2, root window, which is very annoying. Also, if I cycled on root window and close it, the whole windows manager crash, and I have to use tty to get rid of it.

Another possible improvement is let the focused window have some hint, like colored border or something.

Unixsys commented 4 years ago

Another possible improvement is let the focused window have some hint, like colored border or something.

See PR #74, specifically my comment regarding it. However, the README.md file clearly states

  • No borders

I hope #74 gets fixed soon, though.

It is cycling window1, window 2, root window, which is very annoying.

From what I've gathered from context and looking at the source code with my untrained eye, it appears that windows are in an array. Therefore, why not try removing the root window from the array? On second thought, that would surely break things.

huijunchen9260 commented 4 years ago

See PR #74, specifically my comment regarding it. However, the README.md file clearly states

  • No borders I hope #74 gets fixed soon, though.

I don't really think PR #74 really solve the problem I mentioned. I am not saying the window border, but a kind of visual hint that indicating this window is focused. Border is just a possible way of visual hint, but PR #74 is just adding border to every window, rather provide such visual hint on focused window

It is cycling window1, window 2, root window, which is very annoying.

From what I've gathered from context and looking at the source code with my untrained eye, it appears that windows are in an array. Therefore, why not try removing the root window from the array? On second thought, that would surely break things.

I really know nothing about c...I just cannot help to solve this bug, and hope that someone can fix it soon.

Unixsys commented 4 years ago

@huijunchen9260, I'm looking into dynamically colored borders.

Another possible improvement is let the focused window have some hint, like colored border or something.

Also, you probably would want to make a new issue for that. I hope this finds you well.

kjjjnob commented 4 years ago

Let's say we have two windows in the same workspace. When I cycle through them, it does not cycle between them. It is cycling window1, window 2, root window, which is very annoying. Also, if I cycled on root window and close it, the whole windows manager crash, and I have to use tty to get rid of it.

The exact same thing has happened to me but I was able to identify it after a notification from Telegram arrived (ws2) working on ws1. Then the desktop behaves like another window. Is there a way to debug these compartments?

2020-06-23-191033_1920x1080_scrot

Unixsys commented 4 years ago

@kjjjnob Woah, trippy. I'm thinking of adding a check in win_kill (via PR) to avoid killing the root window. Example:

void win_kill(const Arg arg) {
    if (cur) XKillClient(d, cur->w);
}

to

void win_kill(const Arg arg) {
    if !(cl.res_class == 'root_window') { /* I'd have to find out the class of the root window */
        if (cur) XKillClient(d, cur->w);
    }
}

I can make this smaller, just a prototype. Also I'm going to have to brush up on C.

I haven't been able to test because I don't have a sowm nearby, but I think someone can use xdotool. Something like sleep 10; xdotool getactivewindow to give some delay to switch to the root window.

EDIT:

Is there a way to debug these compartments?

You could just add a bunch of calls to printf to debug.

kjjjnob commented 4 years ago
void win_kill(const Arg arg) {
    if !(cl.res_class == 'root_window') { /* I'd have to find out the class of the root window */
        if (cur) XKillClient(d, cur->w);
    }
}

This conditional kill 'root_window' if is present? I can test and try a solution if you need. I dont understand much about C development, but if you need some help with something Im here. Thanks!

r-odriguez commented 1 year ago

Wouldn't be better if the window cycle skipped the root window? that could be implemented in win_next() and win_prev(). Unfortunately I'm not a C dev neither have familiarity with X11 lib. If someone wants this bug fixed I'd gladly help but I don't know how to do it.

If you have some good resource to learn that, I would appreciate a lot, and, fix this afterwards.