You are not logged in.

#401 2013-03-27 15:38:03

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,422
Website

Re: Alopex: a tiling tagging tabbed window manager with fur

I've been doing some code cleanup - preparing for a 2.0 version coming up - and I'm getting ttwm back into it's fighting weight: now back under 800 sloc (under 900 w/ default config.h).

Multi-monitor seems to be working well here - but I do need to iron out some of the details about how focus is cycled between or accross monitors.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#402 2013-03-28 00:56:03

Richjn
Member
From: Perth (Australia)
Registered: 2004-03-22
Posts: 33

Re: Alopex: a tiling tagging tabbed window manager with fur

@Trilby

Maybe something I messed up when merging the git config.h with my own ttwm_conf.h (not git synced for a while) but when cycling through window modes with MOD1 + space ttwm crashes when returning to "ttwm" tiling mode.

In answer to your question regarding the use of borderwidth and tilegap I use both because my default layout is ttwm tiling mode and it looks better this way imho.

Richard

Offline

#403 2013-03-28 01:01:38

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,422
Website

Re: Alopex: a tiling tagging tabbed window manager with fur

Richard, you will need to merge carefully, or - better yet - just take the new config.h and add your personal configuration to it.

I *generally* try to minimize the changes to config.h to avoid this kind of problem for users.  But as v2.0 approaches there have been a lot of under-the-hood changes that required substantial changes to the config.

In this case, there is no longer a ttwm tiling mode - you'd just use rstack or bstack with 1 stackcount.  You can alternate between what used to be rstack and Rttwm modes with the new default bindings of MOD+<comma> and MOD+<period>.  Comma and Period, seem odd, but the "<" and ">" keys they are on (for an en_US qwerty keyboard) were the idea of expanding or collapsing the stack.

EDIT: but in any case, it should not crash - I will have to fix that.

EDIT2: oops - this really was a bug.  It didn't matter what was in the tiling mode array, it would always crash.  That should be fixed now.

Last edited by Trilby (2013-03-28 01:33:07)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#404 2013-03-28 02:52:58

Richjn
Member
From: Perth (Australia)
Registered: 2004-03-22
Posts: 33

Re: Alopex: a tiling tagging tabbed window manager with fur

@Trilby

Ah, yes I should have taken a bit more time with my merge.

Can confirm crash issue fix works.

Thanks again for your work.

Richard

Offline

#405 2013-03-28 06:14:31

HalosGhost
Forum Moderator
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 2,089
Website

Re: Alopex: a tiling tagging tabbed window manager with fur

You know, the more I've used Arch, the less and less I have cared about stable releases. Don't get me wrong, I think they're awesome for the community, but especially for projects like this, when I can do the whole update for any changes in 10 minutes, using the -git release is just normal for me now… Arch has ruined my love of stability tongue

Trilby, I want to thank you for the last update, cutting down on TTWM's size like that actually means a ton to me; with all my custom icons (some of which are admittedly silly—but I have yet to find a better way of doing things), and my custom config.h, It's now still less than 1300 sloc (that's a little over 200 lines that disappeared without any flaw in usage for me). And that absolutely astounds me.

So, seriously, for interrobang, for this, for everything, thank you!

All the best,

-HG

Offline

#406 2013-03-28 11:59:48

Unia
Member
From: Stockholm, Sweden
Registered: 2010-03-30
Posts: 2,486
Website

Re: Alopex: a tiling tagging tabbed window manager with fur

Sorry for going off-topic, but since you guys are now talking about SLOC, I have a question about that: how does SLOC get counted? DWM tries to always stay under 2000 SLOC, but they do "silly" things like this:

if(foo) {
    bar
}           <----
else    <----

Maybe I don't understand SLOC (probably not) but doesn't that increase it by one when you could also use } else?


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

#407 2013-03-28 12:24:14

HalosGhost
Forum Moderator
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 2,089
Website

Re: Alopex: a tiling tagging tabbed window manager with fur

Unia wrote:

Maybe I don't understand SLOC (probably not) but doesn't that increase it by one when you could also use } else?

My understanding of SLoC is that it's typically counted by doing (newlines - (newlines followed by newlines + newlines followed by comments)). So, yes, that would increase the SLoC count by one, but, I'm not sure the particular context of what you're referencing, many times, increasing the sloc count by a couple of lines in order to have everything be readable is a worthwhile sacrifice (See the ttwm icons.h file).

Anyone feel free to correct me if I am in any way wrong.

All the best,

-HG

Last edited by HalosGhost (2013-03-28 12:25:18)

Offline

#408 2013-03-28 12:27:38

Unia
Member
From: Stockholm, Sweden
Registered: 2010-03-30
Posts: 2,486
Website

Re: Alopex: a tiling tagging tabbed window manager with fur

HalosGhost wrote:
Unia wrote:

Maybe I don't understand SLOC (probably not) but doesn't that increase it by one when you could also use } else?

My understanding of SLoC is that it's typically counted by doing (newlines - (newlines followed by newlines + newlines followed by comments)). So, yes, that would increase the SLoC count by one, but, I'm not sure the particular context of what you're referencing, many times, increasing the sloc count by a couple of lines in order to have everything be readable is a worthwhile sacrifice (See the ttwm icons.h file).

I agree that code should be readable, but if your goal is to stay under a certain amount of SLOC I think this is just silly. MonsterWM is a prime example of (for me at least, TTWM comes a close second tongue) unreadable code, seeing that all the if's etc are on the same lines. However, I don't consider things like } else { instead of splitting them over two lines to be unreadable. It's a thing of habbit, I suppose.


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

#409 2013-03-28 12:29:57

HalosGhost
Forum Moderator
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 2,089
Website

Re: Alopex: a tiling tagging tabbed window manager with fur

Unia wrote:

I agree that code should be readable, but if your goal is to stay under a certain amount of SLOC I think this is just silly. MonsterWM is a prime example of (for me at least, TTWM comes a close second tongue) unreadable code, seeing that all the if's etc are on the same lines. However, I don't consider things like } else { instead of splitting them over two lines to be unreadable. It's a thing of habbit, I suppose.

I know it's wrong and kind of horrific, but I almost wish Trilby would minify TTWM's code so that it could be claimed that it's a 1 SLoC WM…

Thoughts, Trilby? tongue

All the best,

-HG

Offline

#410 2013-03-28 13:48:05

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,422
Website

Re: Alopex: a tiling tagging tabbed window manager with fur

These are some of the many reasons why lines-of-code is a meaningless measure.

If you streamline and get rid of useless bits of code (which is good) it will almost certainly reduce the number of lines of code.  But you can also do many things that will either have no effect on resource use, or even negative effects, and still reduce lines of code.

As for where the "else" goes, thats just a matter of style.  I have a consistent style of my own - closest perhaps to K&R with a few distinct modifications - that I (generally) stick to.  There is no objective reason for these, except that they are what I like and thus what I do:

1) function definitions are unindented on one line inlcuding the opening brace
2) each level of nesting (function, loop, conditional) gets one additional tab indent
3) one blank line between functions helps readability - but double (or triple) spacing within code is ridiculous and even hurts readability as one has to scroll a long way to see what is happening.  (I think gtk uses some odd triple spacing.
4) else goes on its own line at the same indentation level as the if.  With "} else {" the "else" is at a different indendation depth that the "if" which I find unappealing as they are logically of equal depth.
5) braces are omitted when there is only one subordinate command for if/while/for blocks.
6) an exception to 5 is parallelism: when any element of an if/else if/else block requires braces, they all get braces.
7) lines are limited to 80 characters (when tabs = 4 spaces).  Continuation lines are indented twice more than the line they continue.
8) blocks that are both syntactically and semantically short/simple can go on the same line as their opening statement (e.g., "if (c) focus(c)") as they can be logically considered one unit.
9) comments are minimal in my code - an only partially by design, partially by laziness.  But the design aspect is to contrast with gtk standards which drive me absolutely insane.  The following (made up, but representative) example illustrates:

/*
   Below we initiate a for loop

   We loop starting from i equal to 0

   and continue as long as i is less than count

   and increment i 1 at each loop

*/


   for

      (i = 0;

       i < count;

       i ++)

{

Compare that with

   for (i = 0; i < count; i++) {

Does the comment provide you with any information that the single line of code does not?  If you know what a for loop is, all the info in the comment is immediately clear - if you don't know what a for loop is, then the comment doesn't help.

A useful comment there might be something that specifies where "count" is defined and what it represents ... in other words, the comment should clarify what is not made explicitly clear by the code itself:

   for (i = 0; i < count; i++) {   /* count = number of windows currently in stack */

Last edited by Trilby (2013-03-28 13:52:34)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#411 2013-03-28 13:56:50

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,422
Website

Re: Alopex: a tiling tagging tabbed window manager with fur

Another reason lines of code is meaningless is that I could shave many lines of code from ttwm by simply removing (almost) all of the function prototypes and organizing the function definitions by their "dependency" on other functions.

This would reduce the number of lines of code, but it would also drastically reduce readability, and would have zero impact on the resulting binary.  Function prototypes add lines of code, aid organization and readability, but do not change the compiled binary - so here, more lines of code is indisputably/objectively better.

Also, icons.h can count for many "lines of code", when in reality there is no code in it that gets executed.  It's just all static data declaration.

Last edited by Trilby (2013-03-28 13:58:29)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#412 2013-03-28 13:57:13

Unia
Member
From: Stockholm, Sweden
Registered: 2010-03-30
Posts: 2,486
Website

Re: Alopex: a tiling tagging tabbed window manager with fur

Thanks Trilby. I see I have almost the same style as you, but it is indeed personal. As long as a developer is consistent throughout, it's fine by me and should I mess with the code, I'll stick with their style (as I'm doing in DWM now)


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

#413 2013-03-28 14:00:40

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,422
Website

Re: Alopex: a tiling tagging tabbed window manager with fur

I think my style is also pretty similar to the dwm code - and probably influenced by it.  The one big exception is I loathe split function definitions* like the following:

void
spawn(void *arg) {

*note: most coding standards do actually encourage this split, so take my view with a very large grain of salt.  I just find it horrendously ugly.  Having them on one line also helps searching for function definitons in code: "spawn(" may show up in many places, but if the declaration was all on one line "void spawn(" would only show up twice, in the prototype, and in the definition.

Last edited by Trilby (2013-03-28 14:02:22)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#414 2013-03-28 14:11:46

HalosGhost
Forum Moderator
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 2,089
Website

Re: Alopex: a tiling tagging tabbed window manager with fur

Trilby wrote:

Also, icons.h can count for many "lines of code", when in reality there is no code in it that gets executed.  It's just all static data declaration.

This is actually the thing that annoys me most about SLoC measurements. Counting header files as code is often problematic and fairly unhelpful.

Counting newlines is far less helpful than counting functions, I don't honestly know why it's still done…

All the best,

-HG

Last edited by HalosGhost (2013-03-28 14:12:25)

Offline

#415 2013-03-29 20:47:03

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,422
Website

Re: Alopex: a tiling tagging tabbed window manager with fur

I've updated the thread title from v2.0a to v2.0b.  While mostly symbolic, this symbolizes the fact that I believe all the features and modifications for 2.0 are complete - multimonitor seems to work well here.  Let the bug reports flow in.

Also, if anyone (Doomicide) is maintaining patches against the "stable" 1.0 aur package, note that that package will be upgraded soon to 2.0 once any bugs are squashed and some propper documentation is written (e.g., man page(s)).


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#416 2013-04-06 17:04:21

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,422
Website

Re: Alopex: a tiling tagging tabbed window manager with fur

I just added simple window rules.  I hope the new line at the bottom of config.h is easy to understand.  The only nonintuitive part is that "tags" are not set with individual numbers, rather it uses bit-flags.  "tags" is an integer type with each bit representing the window's presence on a tag.  Some examples should make it clear:

TAGS DESIRED ---- HEX VALUE FOR 'TAGS'
1                0x01
4                0x08
1-4             0x0F
5                0x10

If you really don't want to figure out the hex value, you can do a bitwise or of every tag with a bit shift operator:
tags 2,3:   (1<<2) | (1<<3)
tags 1-5:   (1<<1) | (1<<2) | (1<<3) | (1<<4) | (1<<5)


The only flags that would likely currenly be useful are 0 (for no change), TTWM_FLOATING, and TTWM_FULLSCREEN ... and *maybe* TTWM_URG_HINT to set a particular window to urgent status upon opening.  I say maybe on this, as most purposes for which you would want to do this, the client program will have already set the urgent hint, but perhaps you can be creative with this option.

If you try to set flags to anything else, there is no user-error checking.  If you do something to break it, it will happily break.

Last edited by Trilby (2013-04-06 17:10:09)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#417 2013-04-06 17:14:16

HalosGhost
Forum Moderator
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 2,089
Website

Re: Alopex: a tiling tagging tabbed window manager with fur

So, if I understand correctly, the "name" field for the window rules is where you specify the name of a program? And, then, tags allows you to specify on which tags the programs of that window will be assigned. Yes? No?

All the best,

-HG

Offline

#418 2013-04-06 17:32:49

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,422
Website

Re: Alopex: a tiling tagging tabbed window manager with fur

Basically.  Name is the name field of the window class property.  The terminology for this part of X11 is a bit odd, there is the actual window name that you see in the title bar (WM_NAME) and then there is the class (WM_CLASS) which has two components, the class name and class class (yeah, it's odd).   You can see these easily with xprop, though.  For example, urxvt has (by default) name="urxvt" and class="URxvt".  When you run `urxvt -name somename` you set the first of these.

The default/example rule in the new config.h sets any window that has *either* the class or name of "float" to be a floating window.  I use this for launching an external editor to enter info in these foum threads.  I have a keybinding to launch "urxvtc -name float -e vim ..." (along with creating temp files, etc), so when I hit that key binding, I can edit my entry in vim rather than in this forum itself.

I like having this window floating, otherwise the browser window gets pushed aside.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#419 2013-04-06 17:37:23

HalosGhost
Forum Moderator
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 2,089
Website

Re: Alopex: a tiling tagging tabbed window manager with fur

Ahh, I see. So then with things like Steam, which mis-report their name, I'd have to specify the mis-reported name, not the correct one? And was I correct in my understanding of tags? It's a specification of the default tags to be assigned?

All the best,

-HG

Offline

#420 2013-04-06 17:42:28

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,422
Website

Re: Alopex: a tiling tagging tabbed window manager with fur

Yes for tags; I don't know about steam, I've never used it - but xprop will tell you what it sets as both it's name and class (both on the WM_CLASS line).  You can specify a window by either the class or name to apply the rule.

EDIT: Actually, I'm about to change this as it leads to two minor problems.  Now you will be able to specify both, or leave one as NULL, if you specify both, the window will have to match both.

Last edited by Trilby (2013-04-06 17:44:00)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#421 2013-04-06 17:51:36

HalosGhost
Forum Moderator
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 2,089
Website

Re: Alopex: a tiling tagging tabbed window manager with fur

Sounds awesome, I can finally force things to open on particular tags. This is one of those "I didn't even know I wanted that feature" moments tongue

So, if I wanted to have dwb (for instance), be automatically assigned to tag 2, but not given any different flags, what would I put in the flags slot? NULL?

All the best,

-HG

Last edited by HalosGhost (2013-04-07 00:03:38)

Offline

#422 2013-04-14 00:34:55

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,422
Website

Re: Alopex: a tiling tagging tabbed window manager with fur

Oops, somehow I missed this last question.  To make no change to flags, use a zero - but I'm pretty sure NULL is always defined as zero anyways, so that might work too - I'm not sure if it'd give a type mismatch though (NULL is a zeroed pointer, zero is just an integer).  So, assuming the class name was "dwb" that would look like the following:

    { NULL,    "dwb",    2,    0 },

Also the 2 in the third colomn is only conincidentally a two, the second bit in a bit-flag integer makes the whole thing a two (binary: 00000010).


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#423 2013-04-14 06:55:29

HalosGhost
Forum Moderator
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 2,089
Website

Re: Alopex: a tiling tagging tabbed window manager with fur

Trilby wrote:
    { NULL,    "dwb",    2,    0 },

Also the 2 in the third colomn is only conincidentally a two, the second bit in a bit-flag integer makes the whole thing a two (binary: 00000010).

Awesome! Thanks!

I have a new bug here that I'll post on the issue tracker shortly; figured I'd post it here in case someone else has been having it waiting to see if others get it too.

With windows from WINE, mouse focus appears to be a little sketchy, and (perhaps as a result of the mouse focus), I cannot type in them (or use keyboard shortcuts in the given program). This applies to both games and to other programs. Do you have any idea why that might be the case?

All the best,

-HG

Offline

#424 2013-04-14 11:40:49

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,422
Website

Re: Alopex: a tiling tagging tabbed window manager with fur

Hmm, a previous issue returns.  Apparently there are more than two input focus models ... meaning there is more than one way clients can ignore the XSetInputFocus function.  I previously dealt with one, this seems to be another.

I just added a bit to the draw function that should fix this.  I tested with wine notepad before and after the change and was able to replicate the problem before and see it work as expected after.  But please confirm if this works in your cases.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#425 2013-04-14 12:26:57

HalosGhost
Forum Moderator
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 2,089
Website

Re: Alopex: a tiling tagging tabbed window manager with fur

Trilby wrote:

Hmm, a previous issue returns.  Apparently there are more than two input focus models ... meaning there is more than one way clients can ignore the XSetInputFocus function.  I previously dealt with one, this seems to be another.

I just added a bit to the draw function that should fix this.  I tested with wine notepad before and after the change and was able to replicate the problem before and see it work as expected after.  But please confirm if this works in your cases.

It works beautifully, and I can now play Limbo without any care in the world! Thank you Trilby!

All the best,

-HG

Offline

Board footer

Powered by FluxBB