Introduction
Introduction Statistics Contact Development Disclaimer Help
index.md - sites - public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log
Files
Refs
---
index.md (2360B)
---
1 Workspaces
2 ==========
3 Adds to dwm the functionality of remembering tagset, layout and mfact fo…
4 given number of workspaces. You can also define preconfigured workspaces.
5
6 Code
7 ----
8 Insert this code before your keys definitions in config.h or in an inclu…
9 file:
10
11 typedef struct Workspace Workspace;
12 struct Workspace {
13 unsigned int tagset;
14 Layout *lt;
15 float mfact;
16 };
17
18 static Workspace workspaces[] = {
19 /* tagset …
20 { (1 << 0), …
21 { (1 << 0) | (1<< 8), &layouts[0]…
22 { (1 << 0) | (1<< 1) | (1<< 8), &layouts[1], …
23 { (1<< 8), …
24 };
25
26 static unsigned int ws = 0;
27
28 static void
29 setws(int nws) {
30 workspaces[ws].tagset = tagset[seltags];
31 workspaces[ws].lt = lt[sellt];
32 workspaces[ws].mfact = (workspaces[ws].lt == &layouts[0]…
33 if(nws < LENGTH(workspaces))
34 ws = nws;
35 if(workspaces[ws].tagset) {
36 tagset[seltags] = workspaces[ws].tagset;
37 lt[sellt] = workspaces[ws].lt;
38 if(workspaces[ws].mfact != 0)
39 mfact = workspaces[ws].mfact;
40 arrange();
41 }
42 }
43
44 static void
45 prevws(const Arg *arg) {
46 setws((ws == 0) ? LENGTH(workspaces) - 1 : ws - 1);
47 }
48
49 static void
50 nextws(const Arg *arg) {
51 setws((ws == LENGTH(workspaces) - 1) ? 0 : ws + 1);
52 }
53
54 And then, you can define keys:
55
56 { MODKEY, XK_Tab, nextws, …
57 { MODKEY|ShiftMask, XK_Tab, prevws, …
58
59 Or mouse buttons:
60
61 { ClkTagBar, 0, Button4, …
62 { ClkTagBar, 0, Button5, …
63
64 Comments
65 --------
66 It is so easy to change the viewed tags, layout and mfact in dwm than ha…
67 artifacts to remember them are not necessary, this patch is just an exam…
68 how it could be implemented, but it won't be updated for future releases.
69
70 It should be easy to add to the workspaces the possibility to remember b…
71 position too.
72
73 It is not necessary to define all your workspaces (or any of them). You …
74 perfectly do:
75
76 static Workspace workspaces[16] = {
77 /* tagset …
78 { (1 << 0), …
79 { (1 << 0) | (1<< 8), &layouts[0]…
80 };
81
82 or:
83
84 static Workspace workspaces[16];
85
86 Authors
87 -------
88 * [Jesus Galan (yiyus)](mailto:yiyu dot jgl at gmail>) (aug 30 21:41:42 …
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.