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

Add support to resize floating container in percentage #2816

Closed
alexherbo2 opened this Issue Jun 18, 2017 · 6 comments

Comments

Projects
None yet
3 participants
@alexherbo2

Use case

for_window [floating] resize set 30% 90%, move position center
@Airblader

This comment has been minimized.

Show comment
Hide comment
@Airblader

Airblader Jun 18, 2017

Member

Percent of what?

And that's not a Usecase, that's a command. What is the actual usecase?

Member

Airblader commented Jun 18, 2017

Percent of what?

And that's not a Usecase, that's a command. What is the actual usecase?

@alexherbo2

This comment has been minimized.

Show comment
Hide comment
@alexherbo2

alexherbo2 Jun 18, 2017

Percent of the size of the monitor.

Use case is when enabling floating, resize windows to a certain amount of the screen.

Percent of the size of the monitor.

Use case is when enabling floating, resize windows to a certain amount of the screen.

@Airblader

This comment has been minimized.

Show comment
Hide comment
@Airblader

Airblader Jun 18, 2017

Member

Again, that's a description of the feature and not a usecase. A Usecase would explain why you would want to resize the window in relation to the size of the screen.

We don't even have this for tiled windows. Floating windows are intentionally kept simple in i3 and resizing dependent of the screen size is a trivial task to do with a script or a number of tools which are independent of the window manager. Therefore I don't see a compelling reason to implement this in i3.

Member

Airblader commented Jun 18, 2017

Again, that's a description of the feature and not a usecase. A Usecase would explain why you would want to resize the window in relation to the size of the screen.

We don't even have this for tiled windows. Floating windows are intentionally kept simple in i3 and resizing dependent of the screen size is a trivial task to do with a script or a number of tools which are independent of the window manager. Therefore I don't see a compelling reason to implement this in i3.

@alexherbo2

This comment has been minimized.

Show comment
Hide comment
@alexherbo2

alexherbo2 Jun 18, 2017

I think that is not as trivial as you suggest.

i3/config snippet:

for_window [floating] exec i3-msg resize set $(get-monitor-size -window <id> -format '<x> * 0.3' | bc) $(get-monitor-size -window <id> -format '<y> * 0.9' | bc), move position center

get-monitor-size script: get monitor dimensions of the active or given window if precised.

Options:

  • -window <id> (default: active)
  • -format <text> (default: <x> <y>)

The -window option is needed, as i3 exec command does not run in the context of the container (focus is not passed to the matched one).

Still, I don’t know how to get the window ID (or any info) of a matched container.

Could command criteria benefit from string formatting to access info?

alexherbo2 commented Jun 18, 2017

I think that is not as trivial as you suggest.

i3/config snippet:

for_window [floating] exec i3-msg resize set $(get-monitor-size -window <id> -format '<x> * 0.3' | bc) $(get-monitor-size -window <id> -format '<y> * 0.9' | bc), move position center

get-monitor-size script: get monitor dimensions of the active or given window if precised.

Options:

  • -window <id> (default: active)
  • -format <text> (default: <x> <y>)

The -window option is needed, as i3 exec command does not run in the context of the container (focus is not passed to the matched one).

Still, I don’t know how to get the window ID (or any info) of a matched container.

Could command criteria benefit from string formatting to access info?

@Airblader

This comment has been minimized.

Show comment
Hide comment
@Airblader

Airblader Jun 20, 2017

Member

OK, giving it more thought I think this is OK provided the implementation effort is reasonable (which I expect it to be). Of course the command should integrate with the existing one, so it should probably look like this:

resize set 20 ppt 30 ppt

The ppt is in line with resize grow|shrink for tiled containers.

Member

Airblader commented Jun 20, 2017

OK, giving it more thought I think this is OK provided the implementation effort is reasonable (which I expect it to be). Of course the command should integrate with the existing one, so it should probably look like this:

resize set 20 ppt 30 ppt

The ppt is in line with resize grow|shrink for tiled containers.

@i3 i3 deleted a comment from i3bot Jun 20, 2017

@i3 i3 deleted a comment from i3bot Jun 20, 2017

@alexherbo2

This comment has been minimized.

Show comment
Hide comment

Cool :)

orestisf1993 added a commit to orestisf1993/i3 that referenced this issue Oct 17, 2017

Add support to resize floating container in percentage
resize set is modified to accept both 'px' and 'ppt' height and width.

Fixes #2816.

@Airblader Airblader closed this in #3023 Nov 5, 2017

livanh pushed a commit to livanh/i3 that referenced this issue Feb 18, 2018

Add support to resize floating container in percentage
resize set is modified to accept both 'px' and 'ppt' height and width.

Fixes #2816.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment