howm icon indicating copy to clipboard operation
howm copied to clipboard

Visual Mode

Open HarveyHunt opened this issue 10 years ago • 6 comments

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?

HarveyHunt avatar Sep 14 '14 21:09 HarveyHunt

Great Idea.

anubhavcodes avatar Sep 15 '14 00:09 anubhavcodes

Any word on this @neo1691?

HarveyHunt avatar Oct 19 '14 15:10 HarveyHunt

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.

vimeitor avatar Oct 20 '14 08:10 vimeitor

@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.

anubhavcodes avatar Oct 20 '14 10:10 anubhavcodes

@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:

  • Mod + v is visual client mode (select clients).
  • Mod + Shift + v is visual workspace mode (select workspaces).

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)

HarveyHunt avatar Oct 21 '14 12:10 HarveyHunt

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.

anubhavcodes avatar Oct 21 '14 12:10 anubhavcodes