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

resizing a window to a specific size in floating mode. #1949

Closed
edge226 opened this Issue Sep 22, 2015 · 19 comments

Comments

Projects
None yet
6 participants
@edge226

edge226 commented Sep 22, 2015

i3-msg resize only allows "grow, shrink" as requested in #1948 .

I propose the ability to run:
i3-msg resize set height 50 ppt ## Set the height to 50% of the usable space, - what the bar is using.
i3-msg resize set width 50 ppt ## Same as above but set the width to 50%

This should set the side to the % of the current monitor or display. It could also be used to set the height or width in pixels.

The main use case for this would be being able to set windows to specific sizes for the floating interface. From what I understand you aim to do the tiling layout in the best way possible and i3 does a really good job of it, i3 is probably the most understandable and easy to use tiling window manager I've used.

@Airblader

This comment has been minimized.

Member

Airblader commented Sep 22, 2015

Does #1893 cover your usecase? It uses px and not ppt, but it works (only) for floating windows.

@edge226

This comment has been minimized.

edge226 commented Sep 22, 2015

@Airblader It would cover it if it allowed ppt as well. Due to both of my monitors being different sizes being able to resize percentages works better for working correctly on both monitors without having to make seperate shortcuts for each monitor.

@edge226

This comment has been minimized.

edge226 commented Sep 22, 2015

Since these are new features going in I suppose it is best if I switch to the git stream of i3. Right?

@Airblader

This comment has been minimized.

Member

Airblader commented Sep 22, 2015

Personally, I think the change is rather minor and I'm not opposed to it. Let's see what @stapelberg decides.

My only concern is that we currently always set both width and height and we can't change that for px anymore and I'd really like to avoid introducing entirely different syntax. Would it be OK for you to always specify width and height? So we could have

resize set 30 ppt 40 ppt
resize set 30 ppt 100 px

while introducing

resize set width 30 ppt
resize set height 50 px

would be more complexity in the commands spec. Although we could allow special values w and y which indicate "no change":

# change height to 30 ppt, don't change width
resize set w 30 ppt

xdotool does this with "x" and "y" for windowmove.

Since these are new features going in I suppose it is best if I switch to the git stream of i3. Right?

There are two git streams. master is the current stable branch, next is the development branch. New features will be in next until the next non-bugfix release, so for "early access" (once implemented) you need to use that, yes.

@edge226

This comment has been minimized.

edge226 commented Sep 22, 2015

Sounds good. All the changes I want are fairly minor but would allow a much more robust capability for configuring i3 as a floating manager or a tiling manager.

@Airblader

This comment has been minimized.

Member

Airblader commented Sep 22, 2015

much more robust capability for configuring i3 as a floating manager

Yes, but this is not a good argument – i3 is a tiling window manager, not a floating one. If a feature only serves to make it a floating window manager, it will probably be rejected.

@edge226

This comment has been minimized.

edge226 commented Sep 22, 2015

Fair enough. I think the vast majority of how i3 is done is absolutely fantastic. Other things are purely a taste issue.

@Airblader

This comment has been minimized.

Member

Airblader commented Sep 22, 2015

For the record, I think this usecase can be covered with wmutils as well (it certainly can be scripted). So there's no immediate need to have it be part of i3. I'm not sure how well wmutils supports multi-screen, though. Maybe we want to find that out before making a decision.

@edge226

This comment has been minimized.

edge226 commented Sep 22, 2015

Alright ill grab them and check them out. Thanks.

@Airblader

This comment has been minimized.

Member

Airblader commented Sep 22, 2015

Yeah, it'd be good if you can give it a try and see whether or not it covers your needs. If you find it lacks multi-screen support or other issues, let us know. I think that's helpful information to make a case for the feature.

@edge226

This comment has been minimized.

edge226 commented Sep 22, 2015

Great I will do that.

@edge226

This comment has been minimized.

edge226 commented Sep 22, 2015

I cant seem to get wmutils to actually trigger on any window including the terminal window I am testing it with, It also does not function at all in percentages.

@edge226

This comment has been minimized.

edge226 commented Sep 22, 2015

I suppose I'll wait and see what @stapelberg decides.

To be honest I am looking for a lightweight WM that I can use as the default for a Linux distribution I am working on. With how customizable and well documented everything is in i3 it fits in with the standards that I want within the distro.

Some people enjoy a tiling experience and others a floating experience. I just thought it would be cool if amazing experiences in both could be had within i3.

I've heard that the window manager in cinnamon can perform the result I desire however I do not want something that heavy, especially on a distribution based on Linux from Scratch.

I think looking at these features as something that 'just' benefits i3 on the floating mode side is not neccessarily a good perspective that would have the most positive outcome for i3. The benefit overall is that the changes I have requested would widen the use case for i3 which allows more people to use the cool features that i3 provides in the way they may want to.

If i3 does not force a specific use case on the user but instead allows more freedom to do things the way the user wants. I think this would nothing but benefit the window manager.

@Airblader

This comment has been minimized.

Member

Airblader commented Sep 22, 2015

The following script I just hacked together works fine for me to resize the focused floating window to a given percentage:

#!/usr/bin/env bash

RATIO=$1

WID=$(pfw)
ROOT=$(lsw -r)
SW=$(wattr w $ROOT)
SH=$(wattr h $ROOT)

wrs -a $((RATIO * SW / 100)) $((RATIO * SH / 100)) $WID

Usage being /path/to/script 35 60. What it doesn't do is multi-screen, though, as it just uses the root output. There was an issue that wmutils/opt would get support for it, but I can't see any there yet.

So in conclusion, as of now, this doesn't seem to be properly available in wmutils.

@stapelberg

This comment has been minimized.

Member

stapelberg commented Sep 24, 2015

The comments in #1949 (comment) make for a fairly good description of why introducing this feature is rather tricky. Given that this functionality can be achieved with a couple lines of shell, let’s not add it to i3.

@stapelberg stapelberg closed this Sep 24, 2015

@zakstar

This comment has been minimized.

zakstar commented Sep 24, 2016

@edge226 Although this is closed exactly an year ago. As a death anniversary to this ;) I would like to suggest you a solution, which was suggested in https://faq.i3wm.org/question/1177/set-window-to-fixed-percentage-size.1.html

Use this:
resize shrink width 10000px; resize grow width 400px; resize shrink height 10000px; resize grow height 800px

Hope this helps :)

@rodfersou

This comment has been minimized.

rodfersou commented Sep 2, 2017

the script don't work when you have multiple monitors.. it looks like it sum up the both monitors size.

@zakstar

This comment has been minimized.

zakstar commented Dec 4, 2017

@rodfersou I use multiple monitors all the time and the script/config I suggested works for me.

Are you referring to my config or some one else's? Please be more clear on which script you are referring to.

@rodfersou

This comment has been minimized.

rodfersou commented Dec 13, 2017

@zakstar sorry, I don't remember how I fixed it.. or if I give up on this configuration I was working.. 😄

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