You are not logged in.

#76 2010-07-08 08:07:41

itsbrad212
Member
From: Chicago, USA
Registered: 2010-01-23
Posts: 1,848

Re: catwm, Cute and Tiny Window Manager

pyknite wrote:

Eh guys... You're awesome \o/

Alot happens when you're away. smile

Last edited by itsbrad212 (2010-07-08 08:08:18)

Offline

#77 2010-07-08 08:28:37

pyknite
Member
Registered: 2010-03-03
Posts: 166

Re: catwm, Cute and Tiny Window Manager

itsbrad212 wrote:
pyknite wrote:

Eh guys... You're awesome \o/

Alot happens when you're away. smile

Yep I saw that... It's great wink

Offline

#78 2010-07-08 08:33:53

itsbrad212
Member
From: Chicago, USA
Registered: 2010-01-23
Posts: 1,848

Re: catwm, Cute and Tiny Window Manager

pyknite wrote:
itsbrad212 wrote:
pyknite wrote:

Eh guys... You're awesome \o/

Alot happens when you're away. smile

Yep I saw that... It's great wink

Well, actually, we didn't really do anything except write a function, write a patch, and  then agree not to use that function tongue

It's 3:38 AM and I'm tired out of my mind, so I'm going to finally sleep. Night wink

Last edited by itsbrad212 (2010-07-08 08:36:37)

Offline

#79 2010-07-08 08:36:24

pyknite
Member
Registered: 2010-03-03
Posts: 166

Re: catwm, Cute and Tiny Window Manager

itsbrad212 wrote:
pyknite wrote:
itsbrad212 wrote:

Alot happens when you're away. smile

Yep I saw that... It's great wink

Well, actually, we didn't really do anything except write a function, write a patch, and  then agree not to use that function tongue

The force kill doesn't work, but the kill client work no? (I didn't try it)

Offline

#80 2010-07-08 08:37:51

itsbrad212
Member
From: Chicago, USA
Registered: 2010-01-23
Posts: 1,848

Re: catwm, Cute and Tiny Window Manager

pyknite wrote:
itsbrad212 wrote:
pyknite wrote:

Yep I saw that... It's great wink

Well, actually, we didn't really do anything except write a function, write a patch, and  then agree not to use that function tongue

The force kill doesn't work, but the kill client work no? (I didn't try it)

The force kill didn't really have much of a use, but the kill_client() works great. It now allows a single child window to be closed without disturbing the parent.

Offline

#81 2010-07-08 08:46:34

pyknite
Member
Registered: 2010-03-03
Posts: 166

Re: catwm, Cute and Tiny Window Manager

itsbrad212 wrote:
pyknite wrote:
itsbrad212 wrote:

Well, actually, we didn't really do anything except write a function, write a patch, and  then agree not to use that function tongue

The force kill doesn't work, but the kill client work no? (I didn't try it)

The force kill didn't really have much of a use, but the kill_client() works great. It now allows a single child window to be closed without disturbing the parent.

Great thing!! I will commit your patch wink

Offline

#82 2010-07-08 16:46:36

pyknite
Member
Registered: 2010-03-03
Posts: 166

Re: catwm, Cute and Tiny Window Manager

I don't know if some people are interested, but it can be a great idea to switch to xcb no? Plus, there is not a lot of code for the moment, so the port will be more easier...

Last edited by pyknite (2010-07-08 16:46:53)

Offline

#83 2010-07-08 16:50:28

itsbrad212
Member
From: Chicago, USA
Registered: 2010-01-23
Posts: 1,848

Re: catwm, Cute and Tiny Window Manager

pyknite wrote:

I don't know if some people are interested, but it can be a great idea to switch to xcb no? Plus, there is not a lot of code for the moment, so the port will be more easier...

I like the idea. It would save me the trouble of having to learn crappy Xlib wink My vote is yes.

Last edited by itsbrad212 (2010-07-08 16:51:40)

Offline

#84 2010-07-08 16:54:33

pyknite
Member
Registered: 2010-03-03
Posts: 166

Re: catwm, Cute and Tiny Window Manager

itsbrad212 wrote:
pyknite wrote:

I don't know if some people are interested, but it can be a great idea to switch to xcb no? Plus, there is not a lot of code for the moment, so the port will be more easier...

I like the idea. It would save me the trouble of having to learn crappy Xlib wink My vote is yes.

Yep but you'all have to learn the "crappy" (by crappy, I mean docless wink ) xcb wink

Offline

#85 2010-07-08 16:59:23

itsbrad212
Member
From: Chicago, USA
Registered: 2010-01-23
Posts: 1,848

Re: catwm, Cute and Tiny Window Manager

pyknite wrote:
itsbrad212 wrote:
pyknite wrote:

I don't know if some people are interested, but it can be a great idea to switch to xcb no? Plus, there is not a lot of code for the moment, so the port will be more easier...

I like the idea. It would save me the trouble of having to learn crappy Xlib wink My vote is yes.

Yep but you'all have to learn the "crappy" (by crappy, I mean docless wink ) xcb wink

?

http://xcb.freedesktop.org/XcbApi/
http://xcb.freedesktop.org/tutorial/
http://xcb.freedesktop.org/XcbNotes/

EDIT: I thought there was short documentation because it was lightweight...

Last edited by itsbrad212 (2010-07-08 17:00:57)

Offline

#86 2010-07-08 17:01:50

pyknite
Member
Registered: 2010-03-03
Posts: 166

Re: catwm, Cute and Tiny Window Manager

itsbrad212 wrote:
pyknite wrote:
itsbrad212 wrote:

I like the idea. It would save me the trouble of having to learn crappy Xlib wink My vote is yes.

Yep but you'all have to learn the "crappy" (by crappy, I mean docless wink ) xcb wink

?

http://xcb.freedesktop.org/XcbApi/
http://xcb.freedesktop.org/tutorial/
http://xcb.freedesktop.org/XcbNotes/

EDIT: I thought there was short documentation because it was lightweight...

Ok, they add some stuffs since my last look wink

Offline

#87 2010-07-08 17:04:05

itsbrad212
Member
From: Chicago, USA
Registered: 2010-01-23
Posts: 1,848

Re: catwm, Cute and Tiny Window Manager

pyknite wrote:
itsbrad212 wrote:
pyknite wrote:

Yep but you'all have to learn the "crappy" (by crappy, I mean docless wink ) xcb wink

?

http://xcb.freedesktop.org/XcbApi/
http://xcb.freedesktop.org/tutorial/
http://xcb.freedesktop.org/XcbNotes/

EDIT: I thought there was short documentation because it was lightweight...

Ok, they add some stuffs since my last look wink

Haha it's fine smile However, I read through some of the docs, and it seems like it is almost too lightweight. Like Xlib with anorexia tongue

Offline

#88 2010-07-08 17:08:56

pyknite
Member
Registered: 2010-03-03
Posts: 166

Re: catwm, Cute and Tiny Window Manager

itsbrad212 wrote:
pyknite wrote:
itsbrad212 wrote:

?

http://xcb.freedesktop.org/XcbApi/
http://xcb.freedesktop.org/tutorial/
http://xcb.freedesktop.org/XcbNotes/

EDIT: I thought there was short documentation because it was lightweight...

Ok, they add some stuffs since my last look wink

Haha it's fine smile However, I read through some of the docs, and it seems like it is almost too lightweight. Like Xlib with anorexia tongue

What do you mean by "too lightweight"? Seems to be pretty much complete... For example look at awesome, it's done with xcb

Offline

#89 2010-07-08 17:12:36

itsbrad212
Member
From: Chicago, USA
Registered: 2010-01-23
Posts: 1,848

Re: catwm, Cute and Tiny Window Manager

pyknite wrote:
itsbrad212 wrote:
pyknite wrote:

Ok, they add some stuffs since my last look wink

Haha it's fine smile However, I read through some of the docs, and it seems like it is almost too lightweight. Like Xlib with anorexia tongue

What do you mean by "too lightweight"? Seems to be pretty much complete... For example look at awesome, it's done with xcb

The Public API, for example, has only 16 functions (not including the other APIs). Xlib has all of these: http://tronche.com/gui/x/xlib/function-index.html

EDIT: Unless I'm missing a big portion of XCB functions

Last edited by itsbrad212 (2010-07-08 17:18:01)

Offline

#90 2010-07-08 17:26:47

pyknite
Member
Registered: 2010-03-03
Posts: 166

Re: catwm, Cute and Tiny Window Manager

itsbrad212 wrote:
pyknite wrote:
itsbrad212 wrote:

Haha it's fine smile However, I read through some of the docs, and it seems like it is almost too lightweight. Like Xlib with anorexia tongue

What do you mean by "too lightweight"? Seems to be pretty much complete... For example look at awesome, it's done with xcb

The Public API, for example, has only 16 functions (not including the other APIs). Xlib has all of these: http://tronche.com/gui/x/xlib/function-index.html

EDIT: Unless I'm missing a big portion of XCB functions

http://xcb.freedesktop.org/manual/group … __API.html and http://xcb.freedesktop.org/manual/modules.html  seems to be suffiscient big_smile

Offline

#91 2010-07-08 17:30:40

itsbrad212
Member
From: Chicago, USA
Registered: 2010-01-23
Posts: 1,848

Re: catwm, Cute and Tiny Window Manager

pyknite wrote:
itsbrad212 wrote:
pyknite wrote:

What do you mean by "too lightweight"? Seems to be pretty much complete... For example look at awesome, it's done with xcb

The Public API, for example, has only 16 functions (not including the other APIs). Xlib has all of these: http://tronche.com/gui/x/xlib/function-index.html

EDIT: Unless I'm missing a big portion of XCB functions

http://xcb.freedesktop.org/manual/group … __API.html and http://xcb.freedesktop.org/manual/modules.html  seems to be suffiscient big_smile

Oh wow! I stand corrected big_smile I am also excited about XCB being asynchronous!

Last edited by itsbrad212 (2010-07-08 17:32:59)

Offline

#92 2010-07-08 19:15:30

knopwob
Member
From: Hannover, Germany
Registered: 2010-01-30
Posts: 237
Website

Re: catwm, Cute and Tiny Window Manager

Hey, i am currently writing for a patch to move a window up and down on the stack area with shift+alt+j and shift+alt+k.

Here is what i have so far:

--- ../../../../build/aur/catwm-git/src/catwm/config.h    2010-07-08 19:09:31.656601298 +0200
+++ config.h    2010-07-08 21:06:09.239234722 +0200
@@ -59,6 +59,8 @@ static struct key keys[] = {
     {  MOD,             XK_k,                       prev_win,       {NULL}},
     {  MOD,             XK_Return,                  swap_master,    {NULL}},
     {  MOD,             XK_space,                   switch_mode,    {NULL}},
+    {  MOD|ShiftMask,   XK_k,                       move_up,        {NULL}},
+    {  MOD|ShiftMask,   XK_j,                       move_down,      {NULL}},
     {  MOD,             XK_c,                       spawn,          {.com = lockcmd}},
     {  0,               XF86XK_AudioNext,           spawn,          {.com = next}},
     {  0,               XF86XK_AudioPrev,           spawn,          {.com = prev}},

and

--- ../../../../build/aur/catwm-git/src/catwm/catwm.c    2010-07-08 19:09:02.702439492 +0200
+++ catwm.c    2010-07-08 21:08:36.468378372 +0200
@@ -80,6 +80,8 @@ static void increase();
 static void keypress(XEvent *e);
 static void kill_client();
 static void maprequest(XEvent *e);
+static void move_down();
+static void move_up();
 static void next_desktop();
 static void next_win();
 static void prev_desktop();
@@ -92,6 +94,7 @@ static void setup();
 static void sigchld(int unused);
 static void spawn(const Arg arg);
 static void start();
+static void swap();
 static void swap_master();
 static void switch_mode();
 static void tile();
@@ -319,6 +322,24 @@ void maprequest(XEvent *e) {
     update_current();
 }
 
+void move_down() {
+    if(current == NULL || current->next == NULL) {
+        return;
+    }
+    swap(current, current->next);
+    tile();
+    update_current();
+}
+
+void move_up() {
+    if(current == NULL || current->prev == head) {
+        return;
+    }
+    swap(current->prev, current);
+    tile();
+    update_current();
+}
+
 void next_desktop() {
     int tmp = current_desktop;
     if(tmp== 9)
@@ -506,6 +527,29 @@ void start() {
     }
 }
 
+void swap(client *c1, client *c2) {
+    client *temp;
+
+    temp = c1->next;
+    c1->next = c2->next;
+    c2 -> next = temp;
+    if(c1->next != NULL) {
+        c1->next->prev = c1;
+    }
+    if(c2->next != NULL) {
+        c2->next->prev = c2;
+    }
+    temp = c1->prev;
+    c1->prev = c2->prev;
+    c2 -> prev = temp;
+    if(c1 -> prev != NULL) {
+        c1->prev->next = c1;
+    }
+    if(c2->prev != NULL) {
+        c2->prev->next = c2;
+    }
+}
+
 void swap_master() {
     Window tmp;

moving a window up works just fine, but it doesn't seem to recognize the move down. For example, if current is a terminal it just prints "J" when i push shift+alt+j but it should move the window down. Does anyone of you see were the problem is?

EDIT:
ignore the "it doesn't work stuff" actually it works. The problem was, that gcc didn't compile catwm again, because i only changed the config.h in the last try and gcc thought, that nothing changed and so there's nothing to compile. So in short: it works

EDIT EDIT:
DON'T USE THIS VERSION. there's a better one a few posts below

Last edited by knopwob (2010-07-09 16:37:38)

Offline

#93 2010-07-08 23:39:09

itsbrad212
Member
From: Chicago, USA
Registered: 2010-01-23
Posts: 1,848

Re: catwm, Cute and Tiny Window Manager

Works great! Thanks for the patch and I'll update the wiki. smile

EDIT: Wiki updated

Last edited by itsbrad212 (2010-07-08 23:40:44)

Offline

#94 2010-07-08 23:48:11

itsbrad212
Member
From: Chicago, USA
Registered: 2010-01-23
Posts: 1,848

Re: catwm, Cute and Tiny Window Manager

Bug report: Attempting to move a window down when there is nothing below it causes the wm to crash.

Steps to reproduce:
1) Go to empty desktop
2) Open a single program (a terminal emulator for example)
3) Hit Mod+Shift+j and watch X die wink

I'll see if there is a fix for this.

Last edited by itsbrad212 (2010-07-09 02:05:38)

Offline

#95 2010-07-09 01:59:25

itsbrad212
Member
From: Chicago, USA
Registered: 2010-01-23
Posts: 1,848

Re: catwm, Cute and Tiny Window Manager

Yay! My first bugfix! smile I'll post a patch ASAP. The problem was with the head->win. Trying to move it up/down caused an error.

EDIT:

catwm.c.patch:

*** catwm.c    2010-07-08 21:04:17.801621166 -0500
--- catwm2.c    2010-07-08 21:02:36.484950596 -0500
***************
*** 323,329 ****
  }
  
  void move_down() {
!     if(current == NULL || current->next == NULL) {
          return;
      }
      swap(current, current->next);
--- 323,329 ----
  }
  
  void move_down() {
!     if(current == NULL || current->next == NULL || current->win == head->win || current->prev == NULL) {
          return;
      }
      swap(current, current->next);
***************
*** 332,338 ****
  }
  
  void move_up() {
!     if(current == NULL || current->prev == head) {
          return;
      }
      swap(current->prev, current);
--- 332,338 ----
  }
  
  void move_up() {
!     if(current == NULL || current->prev == head || current->win == head->win) {
          return;
      }
      swap(current->prev, current);

EDIT EDIT: Fixed patch

Oh and about the whole XCB switch thing, I was thinking about it, and it seemed like too much work to be worth-while (pardon my laziness). It may make catwm a bit faster, but as it is, I don't any need for a speed improvement. Also, XCB would be just another dependency of catwm.

Last edited by itsbrad212 (2010-07-09 02:15:15)

Offline

#96 2010-07-09 08:04:27

knopwob
Member
From: Hannover, Germany
Registered: 2010-01-30
Posts: 237
Website

Re: catwm, Cute and Tiny Window Manager

oh man, by seeing your patch i just realized, that my way of doing this was way to complicated. Theres no reason to swap the actual nodes in the linked list, i just could swap the content of the nodes.

Here's a new version of the patch(with itsbrad212's fixes included):

--- ../../../../build/aur/catwm-git/src/catwm/catwm.c    2010-07-08 19:09:02.702439492 +0200
+++ catwm.c    2010-07-09 10:14:30.454973968 +0200
@@ -80,6 +80,8 @@ static void increase();
 static void keypress(XEvent *e);
 static void kill_client();
 static void maprequest(XEvent *e);
+static void move_down();
+static void move_up();
 static void next_desktop();
 static void next_win();
 static void prev_desktop();
@@ -318,6 +320,33 @@ void maprequest(XEvent *e) {
     tile();
     update_current();
 }
+
+void move_down() {
+    Window tmp;
+    if(current == NULL || current->next == NULL || current->win == head->win || current->prev == NULL) {
+        return;
+    }
+    tmp = current->win;
+    current->win = current->next->win;
+    current->next->win = tmp;
+    //keep the moved window activated
+    next_win();
+    tile();
+    update_current();
+}
+
+void move_up() {
+    Window tmp;
+    if(current == NULL || current->prev == head || current->win == head->win) {
+        return;
+    }
+    tmp = current->win;
+    current->win = current->prev->win;
+    current->prev->win = tmp;
+    prev_win();
+    tile();
+    update_current();
+}
 
 void next_desktop() {
     int tmp = current_desktop;

EDIT:
here's the patch for config.h again to have both in one post:

--- ../../../../build/aur/catwm-git/src/catwm/config.h    2010-07-08 19:09:31.656601298 +0200
+++ config.h    2010-07-08 21:06:09.239234722 +0200
@@ -59,6 +59,8 @@ static struct key keys[] = {
     {  MOD,             XK_k,                       prev_win,       {NULL}},
     {  MOD,             XK_Return,                  swap_master,    {NULL}},
     {  MOD,             XK_space,                   switch_mode,    {NULL}},
+    {  MOD|ShiftMask,   XK_k,                       move_up,        {NULL}},
+    {  MOD|ShiftMask,   XK_j,                       move_down,      {NULL}},
     {  MOD,             XK_c,                       spawn,          {.com = lockcmd}},
     {  0,               XF86XK_AudioNext,           spawn,          {.com = next}},
     {  0,               XF86XK_AudioPrev,           spawn,          {.com = prev}},

Last edited by knopwob (2010-07-09 16:40:29)

Offline

#97 2010-07-09 13:02:56

Misfit138
Misfit Emeritus
From: USA
Registered: 2006-11-27
Posts: 4,170

Re: catwm, Cute and Tiny Window Manager

Great project.
Just a suggestion-- you may want to go back and edit the first post to give a more complete and informational introduction to catwm, to draw more attention and interest. smile

Offline

#98 2010-07-09 16:25:44

itsbrad212
Member
From: Chicago, USA
Registered: 2010-01-23
Posts: 1,848

Re: catwm, Cute and Tiny Window Manager

knopwob wrote:

oh man, by seeing your patch i just realized, that my way of doing this was way to complicated. Theres no reason to swap the actual nodes in the linked list, i just could swap the content of the nodes.

Here's a new version of the patch(with itsbrad212's fixes included):

--- ../../../../build/aur/catwm-git/src/catwm/catwm.c    2010-07-08 19:09:02.702439492 +0200
+++ catwm.c    2010-07-09 10:14:30.454973968 +0200
@@ -80,6 +80,8 @@ static void increase();
 static void keypress(XEvent *e);
 static void kill_client();
 static void maprequest(XEvent *e);
+static void move_down();
+static void move_up();
 static void next_desktop();
 static void next_win();
 static void prev_desktop();
@@ -318,6 +320,33 @@ void maprequest(XEvent *e) {
     tile();
     update_current();
 }
+
+void move_down() {
+    Window tmp;
+    if(current == NULL || current->next == NULL || current->win == head->win || current->prev == NULL) {
+        return;
+    }
+    tmp = current->win;
+    current->win = current->next->win;
+    current->next->win = tmp;
+    //keep the moved window activated
+    next_win();
+    tile();
+    update_current();
+}
+
+void move_up() {
+    Window tmp;
+    if(current == NULL || current->prev == head || current->win == head->win) {
+        return;
+    }
+    tmp = current->win;
+    current->win = current->prev->win;
+    current->prev->win = tmp;
+    prev_win();
+    tile();
+    update_current();
+}
 
 void next_desktop() {
     int tmp = current_desktop;

Don't forget to remove swap() wink

Offline

#99 2010-07-09 16:36:23

knopwob
Member
From: Hannover, Germany
Registered: 2010-01-30
Posts: 237
Website

Re: catwm, Cute and Tiny Window Manager

it's not ment as a patch for the patch, but as a replacement for it. So there's no swap() that needs to be removed ;-)
But i'll edit the posts so this becomes more clear

Offline

#100 2010-07-09 16:42:01

itsbrad212
Member
From: Chicago, USA
Registered: 2010-01-23
Posts: 1,848

Re: catwm, Cute and Tiny Window Manager

knopwob wrote:

it's not ment as a patch for the patch, but as a replacement for it. So there's no swap() that needs to be removed ;-)
But i'll edit the posts so this becomes more clear

Oh, disregard that then wink

Offline

Board footer

Powered by FluxBB