Tomas-M / xlunch

Graphical app launcher for X with minimal dependencies
http://xlunch.org
GNU General Public License v3.0
219 stars 37 forks source link

Icons not top-aligned if certain icon size is used with multiple rows #75

Closed Tomas-M closed 6 years ago

Tomas-M commented 6 years ago

I am not sure if I was talking about this issue already or not, so maybe this can be fixed with using some argument?

My entries file has lots of icons. Two rows on screen. If I use certain icon size, xlunch decides to enlarge empty space between the two rows. It looks odd.

--iconsize set to 110:

virtualbox_slax live test_27_12_2017_22_19_48

--iconsize set to 120:

virtualbox_slax live test_27_12_2017_22_20_05

This is very strange. Notice the big empty space between the icon rows. Do you have any idea why this happens?

Tomas-M commented 6 years ago

Update: it is not related to iconpadding, just iconsize alone does this - the bottom line is like if it was aligned to the bottom of the screen. Strange. No other options are even used, just --iconsize ... 110 is OK (top aligned), but 120 causes the second row to be bottom aligned (on my screen, which is 1024x768)

Tomas-M commented 6 years ago

I think I found out what's the problem. xlunch auto expands the empty space between rows. My problem that I would allow three rows on screen while xlunch would allow only two. Because I expect to see icons even overlapping the bottom border, while xlunch does not want to do that.

I would need a way to put more border on top and virtually none on bottom. I was thinking that --borderratio 100 will help, but actually it does not. Because if I have default border (10% of screen), and I use --borderratio 100, it puts 20% of screen width on top and zero on bottom. Because it doubles the border.

So, in my situation, my problem would be solved if I could specify --border in percentages, this way I could use --border 5% --borderratio 100 and it would actually put 10% of border on top (since it doubles it), and zero on bottom, which is what I would like to have :) But then it would probably make problems with sideborder which would be again set to 5% while I want it 10%. ... so most likely I would also need to be able to specify sideborder in percentages. So what I am after is the ability to use this:

--border 5% --sideborder 10% --borderratio 90 --sideborderratio 50

Tomas-M commented 6 years ago

@PMunch do you possibly have any idea or suggestion what to do with this?

PMunch commented 6 years ago

Well I like your suggestion to specify border in percentages, it should fix your issue and generally make xlunch a bit more flexible. Obviously this could be implemented for everything that currently takes a pixel value (including size of icons), but that would require us to hold a lot of variables and recalculating all sizes when the window resizes.

Tomas-M commented 6 years ago

What if we introduce special parameter like --valuesArePercentages, and, if specified, it would mean that all values specified by user are in percentages (for border, and maybe even for something else). The calculation would be done only once, on startup, at the place where we assign the values from commandlines anyway. It does not need to be updated when window resizes (since the window does not resize anyway). And now it comes to my mind, if there are two options, like --valuesArePercentags and say --valuesArePixels, and if the command line arguments are read sequentially, then user could combine them. So for example user could specify something like --valuesArePercentages --border 20 --valuesArePixels --sideborder 50 --valuesArePercentages --something .... etc .... and implementation would be probably not hard. You can see where I am going? :-)

PMunch commented 6 years ago

Hmm, well there is an issue there.. We read in all the options and store their values and then run the calculation. That means you would need to store which values were percentages and not. And I think --valuesArePercentages, while it would work, would be annoying if you just want that one value as a pixel specific value.

PMunch commented 6 years ago

@Tomas-M, I finally got around to implementing this in https://github.com/Tomas-M/xlunch/commit/12070b349a329250facc768b2862c3c7d38a02ea. You can now specify border and sideborder with a percentage, currently it's only these two values, but the system is fairly simple so if you want to add support for more values in percentage format it should be fairly easy. Your first command --border 5% --sideborder 10% --borderratio 90 --sideborderratio 50 should now work as expected.

Tomas-M commented 6 years ago

Awesome! :-) Thank you very much. I will test it and close this ticked after that.

Tomas-M commented 6 years ago

It does not seem to work for me, strangely. For example, if I specify only --border 20%, it is the same as --border 5%

This is my actual command:

 xlunch --border 20%

I would expect it to have 20% border on the screen, while it does not. And if I change it to

xlunch --border 2%

it displays the same like before. Am I doing anything wrong? Combining with --sideborder or borderratios makes no difference.

Tomas-M commented 6 years ago

Furthermore specifying any percentage for --sideborder makes zero side border, regardless of the used value.

Tomas-M commented 6 years ago

I am compiling on 32bit, just for your info

PMunch commented 6 years ago

Hmm, very strange. I'll have a look at it tomorrow

PMunch commented 6 years ago

Just tried again here with a fresh git clone, and it works just fine, could you try the same? I can't think of anything in the change that should behave differently between 64 and 32 bit systems, so I doubt that that's the case..

Tomas-M commented 6 years ago

I've erased the xlunch directory, cloned from git, make, still the same

git clone https://github.com/Tomas-M/xlunch
cd xlunch
make
./xlunch --border "10%"
./xlunch --border "20%"
./xlunch --border "30%"

All commands produce the same screen.

Tomas-M commented 6 years ago

Note to add I'm trying with conf file with just 4 icons.

Tomas-M commented 6 years ago

Hm, number of icons doesn't matter as I tested 40 now with the same result.

Tomas-M commented 6 years ago

I've added some printfs after border=screen_width/10. uborder.value is 0 uborder.percent is 20 when I specify --border 20% etc so that's correct

I added printfs to calculate_percentage() function and it is never called. Maybe a WM issue? I'm using fluxbox

Tomas-M commented 6 years ago

If I comment out the if(screen.width!=ev.xconfigure.width.....) line in ConfigureNotify case, it starts to work properly.

Tomas-M commented 6 years ago

For me, in ConfigureNotify the widths/heights of screen. and ev.xconfigure. are always set and always the same.

PMunch commented 6 years ago

Ah, my bad. Forgot to add calculate_percentage to where screen_width and screen_height are initially set. This should be fixed in: https://github.com/Tomas-M/xlunch/commit/59210b041a7e02328c26c470d35d09044a642e86

Tomas-M commented 6 years ago

Thank you very much, works just fine now :)