* Fwd: [util-linux] cal: add landscape layout for yearly views (#117) [not found] ` <CAP0zEAb8y+P-McdLc23dJyqG3_=mFQw9PEmkaLLbzGzmWL7p-A@mail.gmail.com> @ 2014-09-17 12:22 ` Gennady Kovshenin 2014-09-17 13:18 ` Karel Zak 0 siblings, 1 reply; 8+ messages in thread From: Gennady Kovshenin @ 2014-09-17 12:22 UTC (permalink / raw) To: util-linux This is a follow-up to: https://github.com/karelzak/util-linux/pull/117#issuecomment-55868722 > With the high availability of wide screens and high-resolution emulated > terminals and terminal window managers it's sometimes useful to change > the output of cal(1) yearly views to more stretched out ones > horizontally. > > This patch adds a new -l/--landscape flag that stretches out the yearly > view to 3x4 and 4x3 months in Julian mode and 4x3 and 6x2 in regular > mode. The flag can be used up to two times. Thank you for your response, Karel :) "It would be better to make it completely dynamical and fill-in all terminal horizontally if possible. It means to determine the number of the months dynamically according to terminal width rather than hardcode number of months (or require more -l options (ctl.landscape++))." I don't think the filling in the terminal completely is a logical approach. I feel that calendar year output has to be rectangular. T here are always 12 months and the only way to arrange them into a nice rectangular shape is 1x12, 2x6, 3x4, 4x3, 6x2, 12x1, other shapes don't make much sense UI-wise, do they? All the printed mini calendars I get are always laid out in 3x4, 4x3 or 6x2 (rare). This is what actually inspired me to hack cal in the first place. Someone asked me to put together a simple mini calendar from print, it had to be in landscape mode (4x3 months). cal would only output 3x4 so I couldn't just copy and paste into GIMP. I couldn't even find a tool online that would output nice text to paste in. Ended up downloading the source and hacking a quick 4x3 mode for a once-off purpose, writing down "cal landscape mode" in my todo list. I did pick the most useful extensions of 4x3 and 6x2 for regular, and 3x4 and 4x3 for the Julian one. I have a 1080p monitor and 6x2 is the largest it goes without wrapping on a 12pt mono font for a regular calendar (Julian is a bit wider even so 6x2 barely fits). If 12x1 is really useful (i.e. full length with month wrapping) adding another -l to extend would work. But not having the flexibility of wrapping to predefined sizes seems like a missing feature. I mean we could resize the terminal window and wrap along the edges, but that's not good UI. Forcing the user to resize the terminal window to get perfect rectangular layouts seems like a hack. I did pick the repetition of the flag to stretch out the layout akin to the way verbose flags work in many programs, by repeating -vvvv one gets more verbosity out of the program. And by repeating -lll one gets more lanscape out of cal. Hope this makes sense. I appreciate your feedback and hope to sort this feature out with more input and brainstorming. Regards, Gennady Kovshenin On Wed, Sep 17, 2014 at 3:18 PM, Karel Zak <notifications@github.com> wrote: > > Hi Gennady, > don't care about po/ stuff, it's automatically updated before release. > > The request to make cal(1) more friendly to large screens makes sense, but your -l implementation does not seem to be user-friendly. > > It would be better to make it completely dynamical and fill-in all terminal horizontally if possible. It means to determine the number of the months dynamically according to terminal width rather than hardcode number > of months (or require more -l options (ctl.landscape++)). > > See lib/ttyutils.c and get_terminal_width(). > > Note the best way to discuss new features is util-linux@vger.kernel.org mailing > list. You don't have to subscribe to send to the list. > > — > Reply to this email directly or view it on GitHub. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Fwd: [util-linux] cal: add landscape layout for yearly views (#117) 2014-09-17 12:22 ` Fwd: [util-linux] cal: add landscape layout for yearly views (#117) Gennady Kovshenin @ 2014-09-17 13:18 ` Karel Zak 2014-09-17 15:52 ` Gennady Kovshenin 0 siblings, 1 reply; 8+ messages in thread From: Karel Zak @ 2014-09-17 13:18 UTC (permalink / raw) To: util-linux; +Cc: Gennady Kovshenin On Wed, Sep 17, 2014 at 06:22:36PM +0600, Gennady Kovshenin wrote: > I don't think the filling in the terminal completely is a logical > approach. I feel that calendar year output has to be rectangular. T > here are always 12 months and the only way to arrange them into a > nice rectangular shape is 1x12, 2x6, 3x4, 4x3, 6x2, 12x1, other shapes > don't make much sense UI-wise, do they? All the printed mini calendars > I get are always laid out in 3x4, 4x3 or 6x2 (rare). Well, "fill-in all terminal horizontally" does not mean that I want to generate any unreadable mess :-) I'd like to see "cal --landscape" *just works* and it automatically selects the best output format (3x4, 4x3, 6x2, ...) which fits into the current terminal width. That's all the story. As user I don't want to think about number of -l options. Additionally we can add a new option --format={3x4, 4x3, auto, ...} to provide full control on the output for scripts that generate something from cal(1) output. IMHO, it's mistake that for example -y or -3 ignores terminal width so on small terminals it's unreadable. Karel -- Karel Zak <kzak@redhat.com> http://karelzak.blogspot.com ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Fwd: [util-linux] cal: add landscape layout for yearly views (#117) 2014-09-17 13:18 ` Karel Zak @ 2014-09-17 15:52 ` Gennady Kovshenin 2014-09-22 11:33 ` Karel Zak 0 siblings, 1 reply; 8+ messages in thread From: Gennady Kovshenin @ 2014-09-17 15:52 UTC (permalink / raw) Cc: util-linux I like the format=auto idea. But we can keep it to just the number of columns instead of a full CxR format. i.e. format=2 (2x6), format=3 (3x4), format=4 (4x3), and so on. perhaps the parameter should be called --columns/-c instead of format. We can either have an additional auto value to the format, or have it be on by default. Having auto on by default means breaking compatibility. Some users might be parsing output expecting the default 3x4 view in place and if we abruptly change this to be stretched automatically their scripts might break. Any thoughts on the above? --format vs. --columns? And the default value thereof. Regards, Gennady Kovshenin Regards, Gennady Kovshenin On Wed, Sep 17, 2014 at 7:18 PM, Karel Zak <kzak@redhat.com> wrote: > On Wed, Sep 17, 2014 at 06:22:36PM +0600, Gennady Kovshenin wrote: >> I don't think the filling in the terminal completely is a logical >> approach. I feel that calendar year output has to be rectangular. T >> here are always 12 months and the only way to arrange them into a >> nice rectangular shape is 1x12, 2x6, 3x4, 4x3, 6x2, 12x1, other shapes >> don't make much sense UI-wise, do they? All the printed mini calendars >> I get are always laid out in 3x4, 4x3 or 6x2 (rare). > > Well, "fill-in all terminal horizontally" does not mean that I want to > generate any unreadable mess :-) > > I'd like to see "cal --landscape" *just works* and it automatically > selects the best output format (3x4, 4x3, 6x2, ...) which fits into > the current terminal width. That's all the story. As user I don't > want to think about number of -l options. > > Additionally we can add a new option --format={3x4, 4x3, auto, ...} > to provide full control on the output for scripts that generate > something from cal(1) output. > > IMHO, it's mistake that for example -y or -3 ignores terminal width > so on small terminals it's unreadable. > > Karel > > -- > Karel Zak <kzak@redhat.com> > http://karelzak.blogspot.com ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Fwd: [util-linux] cal: add landscape layout for yearly views (#117) 2014-09-17 15:52 ` Gennady Kovshenin @ 2014-09-22 11:33 ` Karel Zak 2014-09-22 11:38 ` Gennady Kovshenin 0 siblings, 1 reply; 8+ messages in thread From: Karel Zak @ 2014-09-22 11:33 UTC (permalink / raw) To: Gennady Kovshenin; +Cc: util-linux On Wed, Sep 17, 2014 at 09:52:36PM +0600, Gennady Kovshenin wrote: > I like the format=auto idea. But we can keep it to just the number of > columns instead of a full CxR format. It would be the best to talk about number of months ;-) > i.e. format=2 (2x6), format=3 (3x4), format=4 (4x3), and so on. > perhaps the parameter should be called --columns/-c instead of format. > We can either have an additional auto value to the format, or have it > be on by default. > Having auto on by default means breaking compatibility. Some users > might be parsing output expecting the default 3x4 view in place and if > we abruptly change this to be stretched automatically their scripts > might break. > > Any thoughts on the above? --format vs. --columns? And the default > value thereof. Or something else --horizontal-months[=<num>|auto] and think we can support arbitrary <num> in range 1-12. Karel -- Karel Zak <kzak@redhat.com> http://karelzak.blogspot.com ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Fwd: [util-linux] cal: add landscape layout for yearly views (#117) 2014-09-22 11:33 ` Karel Zak @ 2014-09-22 11:38 ` Gennady Kovshenin 2014-09-22 12:02 ` Sami Kerola 0 siblings, 1 reply; 8+ messages in thread From: Gennady Kovshenin @ 2014-09-22 11:38 UTC (permalink / raw) To: Karel Zak; +Cc: util-linux Agreed. And the default would still be 3, right? For back compatibility. What's the short version of the flag -z? And would the auto mode try to still limit itself to a rectangle? Or stretch indefinitely? I appreciate your time brainstorming about this, Karel. Thank you. Regards, Gennady Kovshenin On Mon, Sep 22, 2014 at 5:33 PM, Karel Zak <kzak@redhat.com> wrote: > On Wed, Sep 17, 2014 at 09:52:36PM +0600, Gennady Kovshenin wrote: >> I like the format=auto idea. But we can keep it to just the number of >> columns instead of a full CxR format. > > It would be the best to talk about number of months ;-) > >> i.e. format=2 (2x6), format=3 (3x4), format=4 (4x3), and so on. >> perhaps the parameter should be called --columns/-c instead of format. >> We can either have an additional auto value to the format, or have it >> be on by default. >> Having auto on by default means breaking compatibility. Some users >> might be parsing output expecting the default 3x4 view in place and if >> we abruptly change this to be stretched automatically their scripts >> might break. >> >> Any thoughts on the above? --format vs. --columns? And the default >> value thereof. > > Or something else --horizontal-months[=<num>|auto] > > and think we can support arbitrary <num> in range 1-12. > > Karel > > -- > Karel Zak <kzak@redhat.com> > http://karelzak.blogspot.com ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Fwd: [util-linux] cal: add landscape layout for yearly views (#117) 2014-09-22 11:38 ` Gennady Kovshenin @ 2014-09-22 12:02 ` Sami Kerola 2014-09-23 6:14 ` Gennady Kovshenin 0 siblings, 1 reply; 8+ messages in thread From: Sami Kerola @ 2014-09-22 12:02 UTC (permalink / raw) To: Gennady Kovshenin; +Cc: Karel Zak, util-linux > On Mon, Sep 22, 2014 at 5:33 PM, Karel Zak <kzak@redhat.com> wrote: >> On Wed, Sep 17, 2014 at 09:52:36PM +0600, Gennady Kovshenin wrote: >>> I like the format=auto idea. But we can keep it to just the number of >>> columns instead of a full CxR format. >> >> It would be the best to talk about number of months ;-) >> >>> i.e. format=2 (2x6), format=3 (3x4), format=4 (4x3), and so on. >>> perhaps the parameter should be called --columns/-c instead of format. >>> We can either have an additional auto value to the format, or have it >>> be on by default. >>> Having auto on by default means breaking compatibility. Some users >>> might be parsing output expecting the default 3x4 view in place and if >>> we abruptly change this to be stretched automatically their scripts >>> might break. >>> >>> Any thoughts on the above? --format vs. --columns? And the default >>> value thereof. >> >> Or something else --horizontal-months[=<num>|auto] >> >> and think we can support arbitrary <num> in range 1-12. >> >> Karel On 22 September 2014 12:38, Gennady Kovshenin <gennady@kovshenin.com> wrote: > Agreed. And the default would still be 3, right? For back compatibility. > > What's the short version of the flag -z? Mind the fact the cal is part of posix, so adding short options may cause (theoretically) necessity to be either backwards incompatible or break the standard. http://pubs.opengroup.org/onlinepubs/9699919799/utilities/cal.html > And would the auto mode try to still limit itself to a rectangle? Or > stretch indefinitely? IMHO rectangles are fine if the they are requested with an option something like --geometry=x:y But if the number of months is wanted to be --begin=<date> --end=<date> Then the default geometry 3xN should be applied, unless otherwise defined by user. When --geometry=5:3 is defined and --begin && --end define a period of a year (for example), then the last three 'month' entries should be blanks. Would that make sense? -- Sami Kerola http://www.iki.fi/kerolasa/ ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Fwd: [util-linux] cal: add landscape layout for yearly views (#117) 2014-09-22 12:02 ` Sami Kerola @ 2014-09-23 6:14 ` Gennady Kovshenin 2014-10-01 7:31 ` Karel Zak 0 siblings, 1 reply; 8+ messages in thread From: Gennady Kovshenin @ 2014-09-23 6:14 UTC (permalink / raw) To: kerolasa; +Cc: Karel Zak, util-linux On Mon, Sep 22, 2014 at 6:02 PM, Sami Kerola <kerolasa@iki.fi> wrote: >> On Mon, Sep 22, 2014 at 5:33 PM, Karel Zak <kzak@redhat.com> wrote: >>> On Wed, Sep 17, 2014 at 09:52:36PM +0600, Gennady Kovshenin wrote: >>>> I like the format=auto idea. But we can keep it to just the number of >>>> columns instead of a full CxR format. >>> >>> It would be the best to talk about number of months ;-) >>> >>>> i.e. format=2 (2x6), format=3 (3x4), format=4 (4x3), and so on. >>>> perhaps the parameter should be called --columns/-c instead of format. >>>> We can either have an additional auto value to the format, or have it >>>> be on by default. >>>> Having auto on by default means breaking compatibility. Some users >>>> might be parsing output expecting the default 3x4 view in place and if >>>> we abruptly change this to be stretched automatically their scripts >>>> might break. >>>> >>>> Any thoughts on the above? --format vs. --columns? And the default >>>> value thereof. >>> >>> Or something else --horizontal-months[=<num>|auto] >>> >>> and think we can support arbitrary <num> in range 1-12. >>> >>> Karel > > On 22 September 2014 12:38, Gennady Kovshenin <gennady@kovshenin.com> wrote: > >> Agreed. And the default would still be 3, right? For back compatibility. >> >> What's the short version of the flag -z? > > Mind the fact the cal is part of posix, so adding short options may > cause (theoretically) necessity to be either backwards incompatible or > break the standard. > > http://pubs.opengroup.org/onlinepubs/9699919799/utilities/cal.html > >> And would the auto mode try to still limit itself to a rectangle? Or >> stretch indefinitely? > > IMHO rectangles are fine if the they are requested with an option > something like > > --geometry=x:y > > But if the number of months is wanted to be > > --begin=<date> > --end=<date> I haven't seen these flags anywhere in cal. Output is always limited to 12 months in year view. Why even bother with the rows when asking for the columns is enough? I'd just go with "width", or "horizontal" as Karel suggested. "width" makes perfect sense wherein users just supply the number of columns in their year view and a value of 0 or auto would autoset it based on the width of the current terminal (limited to a nice rectangle). Karel, how do you feel about the --width -w option? > > Then the default geometry 3xN should be applied, unless otherwise > defined by user. > > When --geometry=5:3 is defined and --begin && --end define a period of > a year (for example), then the last three 'month' entries should be > blanks. > > Would that make sense? > > -- > Sami Kerola > http://www.iki.fi/kerolasa/ ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Fwd: [util-linux] cal: add landscape layout for yearly views (#117) 2014-09-23 6:14 ` Gennady Kovshenin @ 2014-10-01 7:31 ` Karel Zak 0 siblings, 0 replies; 8+ messages in thread From: Karel Zak @ 2014-10-01 7:31 UTC (permalink / raw) To: Gennady Kovshenin; +Cc: kerolasa, util-linux On Tue, Sep 23, 2014 at 12:14:31PM +0600, Gennady Kovshenin wrote: > Karel, how do you feel about the --width -w option? --width seems like option with mandatory argument, command line without another argument (e.g. "cal --width") seems strange. --horizontal[=<months>] where default is "auto" seems better ;-) > > Then the default geometry 3xN should be applied, unless otherwise > > defined by user. 3xN should be be default when no --horizontal is specified. cal -y ==> 3 columns cal --horizontal ==> depends on terminal width cal --horizontal=6 ==> 6 columns Karel -- Karel Zak <kzak@redhat.com> http://karelzak.blogspot.com ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2014-10-01 7:31 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <karelzak/util-linux/pull/117@github.com>
[not found] ` <karelzak/util-linux/pull/117/c55868722@github.com>
[not found] ` <CAP0zEAb8y+P-McdLc23dJyqG3_=mFQw9PEmkaLLbzGzmWL7p-A@mail.gmail.com>
2014-09-17 12:22 ` Fwd: [util-linux] cal: add landscape layout for yearly views (#117) Gennady Kovshenin
2014-09-17 13:18 ` Karel Zak
2014-09-17 15:52 ` Gennady Kovshenin
2014-09-22 11:33 ` Karel Zak
2014-09-22 11:38 ` Gennady Kovshenin
2014-09-22 12:02 ` Sami Kerola
2014-09-23 6:14 ` Gennady Kovshenin
2014-10-01 7:31 ` Karel Zak
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).