Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Visual Mode #24

Open
HarveyHunt opened this issue Sep 14, 2014 · 6 comments
Open

Visual Mode #24

HarveyHunt opened this issue Sep 14, 2014 · 6 comments

Comments

@HarveyHunt
Copy link
Owner

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
Copy link
Contributor

Great Idea.

@HarveyHunt
Copy link
Owner Author

Any word on this @neo1691?

@vimeitor
Copy link

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
Copy link
Contributor

@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
Copy link
Owner Author

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

@anubhavcodes
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants