HarveyHunt / howm

A lightweight, X11 tiling window manager that behaves like vim
GNU General Public License v2.0
649 stars 24 forks source link

Visual Mode #24

Open HarveyHunt opened 9 years ago

HarveyHunt commented 9 years ago

It might be a nice idea to have a mode whereby windows can be selected that an operation will then be performed upon.

The selected windows could have a different border colour to the unselected ones?

anubhavcodes commented 9 years ago

Great Idea.

HarveyHunt commented 9 years ago

Any word on this @neo1691?

vimeitor commented 9 years ago

You also have the option of decreasing the brightness of the whole screen and only brighten the windows of those that are (being) selected, although I guess it's easier to change the border, and it actually makes more sense.

anubhavcodes commented 9 years ago

@HarveyHunt I started working on this long back, implemented it partially, and then I got off completely. I don't even know how much is changed in the code base. I was telling you how to I was going to implement it.

1) Add a is_selected variable in Client structure. 2) If we press mod+shift+v we activate visual mode. 3) The client currently selected will set it's is_selected variable true, and update it's color code. 4) now as long as any other mode is activated, any client that we focus, will set it's is_selected variable true, and consequently update it's border colors. 5) Now if we use the delete operator, the code which handles the op_cut function, it will first check if the visual-mode is on, if it's on then it will use a for-loop and then push on the stack all those client's whose is_selected variable is true, and at the same time we will change the is_selected to false ( so that they won't create problems later) 6) If we change_mode from visual mode to any other mode, (without using any operator) a for loop will run, change all clients is_selected to false, and border color to normal.

Let me know what you think about it. You can implement it in less than 30 minutes I believe. Also you need to make a decision what will happen if you use the paste operator in visual mode. Does it replace all selected clients with the clients that you want to paste, or it just paste those clients alongwith the selected clients. If you choose the former than you need to kill all those selected clients. May or may not be desierable.

Let me know if the above make sense or not. I don't think I will be able to implement it in time. So yo go ahead and finish it off.

HarveyHunt commented 9 years ago

@vimeitor I think that brightness is an issue for a compositor to deal with.

@neo1691 Thanks for the big write up- you've reminded me of everything we have talked about. I am happy to finish visual mode. I am not sure if I will be able to use your branch though - it is one release behind (soon to be two once IPC is released) and many commits behind develop.

I had a few more ideas:

Then pressing alt + q will kill the select items (workspace or client). Leaving visual mode will clear the selection. I think it should be easy to change the code in the op_* functions, I can imagine a macro such as SELECTED(x) where:

#define SELECTED(x) ((cur_mode == VISUAL_CLIENT || cur_mode == VISUAL_WORKSPACE) && x->is_selected)
anubhavcodes commented 9 years ago

Sure, don't use my branch. It's too messed up. You will be faster if you start a fresh. Let me know how it works out.

Cheers.