Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Replaced prev/next_desktop functions with rotate_desktop

  • Loading branch information...
commit 0f853ff6277e38f4de7e7bb1e5c7d2098c5e2056 1 parent 25edd0d
moetunes authored

Showing 4 changed files with 21 additions and 26 deletions. Show diff stats Hide diff stats

  1. +5 0 .gitignore
  2. +6 0 ChangeLog
  3. +3 3 config.h.def
  4. +7 23 dminiwm.c
5 .gitignore
... ... @@ -0,0 +1,5 @@
  1 +dminiwm
  2 +config.h
  3 +*.o
  4 +*.swp
  5 +*~
6 ChangeLog
... ... @@ -1,8 +1,14 @@
1 1 28/11/11
  2 + Replaced next/prev_desktop function with shorter rotate_desktop function
  3 + (thanks to c00kiemon5ter)
  4 +
  5 +28/11/11
2 6 Added last desktop function for switching back to the last opened desktop
  7 + (thanks to c00kimon5ter)
3 8
4 9 26/11/11
5 10 Added option to click on a window to focus it
  11 + (thanks to richo4)
6 12
7 13 21/11/11
8 14 Fix for transient windows not being managed
6 config.h.def
... ... @@ -1,4 +1,4 @@
1   - /* config.h for dminiwm.c [ 0.2.0 ]
  1 + /* config.h for dminiwm.c [ 0.2.1 ]
2 2 *
3 3 * Started from catwm 31/12/10
4 4 * Bad window error checking and numlock checking used from
@@ -104,8 +104,8 @@ static key keys[] = {
104 104 { MOD1|ControlMask, XK_r, spawn, {.com = rebootcmd}},
105 105 { MOD1|ControlMask, XK_s, spawn, {.com = shutdowncmd}},
106 106 // Window key + shortcut
107   - { MOD4, XK_Right, next_desktop, {NULL}},
108   - { MOD4, XK_Left, prev_desktop, {NULL}},
  107 + { MOD4, XK_Right, rotate_desktop, {.i = 1}},
  108 + { MOD4, XK_Left, rotate_desktop, {.i = -1}},
109 109 { MOD4, XK_e, spawn, {.com = mailcmd}},
110 110 { MOD4, XK_f, spawn, {.com = firefoxcmd}},
111 111 { MOD4, XK_w, spawn, {.com = webcmd}},
30 dminiwm.c
... ... @@ -1,4 +1,4 @@
1   -/* dminiwm.c [ 0.2.0 ]
  1 +/* dminiwm.c [ 0.2.1 ]
2 2 *
3 3 * I started this from catwm 31/12/10
4 4 * Bad window error checking and numlock checking used from
@@ -112,14 +112,13 @@ static void kill_client();
112 112 static void maprequest(XEvent *e);
113 113 static void move_down();
114 114 static void move_up();
115   -static void next_desktop();
116 115 static void next_win();
117   -static void prev_desktop();
118 116 static void prev_win();
119 117 static void quit();
120 118 static void remove_window(Window w);
121 119 static void resize_master(const Arg arg);
122 120 static void resize_stack(const Arg arg);
  121 +static void rotate_desktop(const Arg arg);
123 122 static void save_desktop(int i);
124 123 static void select_desktop(int i);
125 124 static void send_kill_signal(Window w);
@@ -385,26 +384,10 @@ void last_desktop() {
385 384 change_desktop(a);
386 385 }
387 386
388   -void next_desktop() {
389   - int tmp = current_desktop;
390   - if(tmp == TABLENGTH(desktops)-1)
391   - tmp = 0;
392   - else
393   - tmp++;
394   -
395   - Arg a = {.i = tmp};
396   - change_desktop(a);
397   -}
398   -
399   -void prev_desktop() {
400   - int tmp = current_desktop;
401   - if(tmp == 0)
402   - tmp = TABLENGTH(desktops)-1;
403   - else
404   - tmp--;
405   -
406   - Arg a = {.i = tmp};
407   - change_desktop(a);
  387 +void rotate_desktop(const Arg arg) {
  388 + int ndesktops = TABLENGTH(desktops);
  389 + Arg a = {.i = (current_desktop + ndesktops + arg.i) % ndesktops};
  390 + change_desktop(a);
408 391 }
409 392
410 393 void client_to_desktop(const Arg arg) {
@@ -876,6 +859,7 @@ void quit() {
876 859 logger(" \033[0;33mThanks for using!");
877 860 XCloseDisplay(dis);
878 861 logger("\033[0;31mforced shutdown");
  862 + exit (0);
879 863 }
880 864
881 865 bool_quit = 1;

0 comments on commit 0f853ff

Please sign in to comment.
Something went wrong with that request. Please try again.