fvwm-window-search 2.2.0 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (7) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/activate.c +7 -9
  4. data/fontinfo.c +0 -2
  5. data/lib.c +37 -0
  6. data/winlist.c +0 -4
  7. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3e0b567a71daca6fd7780719a9228cd34a63f9cdfbf084a4b4c854f13b60c103
4
- data.tar.gz: 8b274620b6a4ba391ad4127c91f63bfff85057c971c0678c4850b1a48cdb287b
3
+ metadata.gz: 128a87d266fc2fa55f7a0a49e4754ff7026eeb13ea1e9db1c392fa5615e6e8ea
4
+ data.tar.gz: a4da76f60401c5cf6ed56069032b1014efd2224da4deaaf11a1ff4ac5e282870
5
5
  SHA512:
6
- metadata.gz: b354e8b6cfe44214474c39f54ba10a931835c272ced4b315abf7872cd4c33017a6a146b02c4699b4fe67c633a1fb25d45ddc340f1f1f81e7d8af5d9fd3a92a9e
7
- data.tar.gz: a41ae5a0816b84a33149b60ca3a2a30556ec7ea443acd07b57a4a258c5276a5797141ba0c2a7cf93fd53d44e3f01ec3f68b16edb4be2a32c1daefc35dc6a68c3
6
+ metadata.gz: a4892c1dde0908b82df3c249aa7768572de54622033286290f92ce0ea251ccbe881538a4a068b2c98a2e21a345bffabb8247b9633ed7ceeb3ee606ee6110246f
7
+ data.tar.gz: e51b7dd7ea7c4184003873004b34d46103a4a38c673ee8368f6aba3758730993ca3578f15c26dcc6af39e091153fa312c161cba4a0b4b1fad457de32275d0d97
data/README.md CHANGED
@@ -5,7 +5,7 @@ Incremental window search & immediate switch to the selected window
5
5
 
6
6
  $ gem install fvwm-window-search
7
7
 
8
- ![demo](https://thumbs.gfycat.com/GenerousRingedFlicker-small.gif)
8
+ ![demo](https://sigwait.tk/~alex/junk/fvwm-window-search-2.2.0.gif)
9
9
 
10
10
  * Should work w/ most EWMH-compliant stackings X11 window managers.
11
11
  * Filter by window name/resource/class.
data/activate.c CHANGED
@@ -1,4 +1,3 @@
1
- #include <stdlib.h>
2
1
  #include <err.h>
3
2
  #include <stdio.h>
4
3
  #include <stdbool.h>
@@ -7,11 +6,8 @@
7
6
  #include <string.h>
8
7
  #include <limits.h>
9
8
  #include <libgen.h>
10
- #include <sys/stat.h>
11
- #include <errno.h>
9
+ #include <sys/utsname.h>
12
10
 
13
- #include <X11/Xlib.h>
14
- #include <X11/Xatom.h>
15
11
  #include <jansson.h>
16
12
 
17
13
  #include "lib.c"
@@ -81,15 +77,17 @@ char* config() {
81
77
  if (getenv("XDG_RUNTIME_HOME")) {
82
78
  snprintf(xdg_runtime_home, PATH_MAX-64, "%s", getenv("XDG_RUNTIME_HOME"));
83
79
  } else {
84
- snprintf(xdg_runtime_home, PATH_MAX-64, "/run/user/%d", getuid());
80
+ struct utsname info;
81
+ uname(&info);
82
+ char *template = 0 == strcmp(info.sysname, "Linux") ? "/run/user/%d" : "/tmp/user/%d";
83
+ snprintf(xdg_runtime_home, PATH_MAX-64, template, getuid());
85
84
  }
86
85
  char *file = (char*)malloc(PATH_MAX);
87
86
  snprintf(file, PATH_MAX, "%s/%s/%s",
88
87
  xdg_runtime_home, "fvwm-window-search", "last_window.json");
89
88
 
90
89
  char *dir = dirname(strdup(file));
91
- mkdir(xdg_runtime_home, 0755);
92
- int r = mkdir(dir, 0755); if (-1 == r && EEXIST != errno) {
90
+ if (!mkdir_p(dir, 0700)) {
93
91
  warn("failed to create %s", dir);
94
92
  return NULL;
95
93
  }
@@ -99,7 +97,7 @@ char* config() {
99
97
 
100
98
  void state_save(Display *dpy, Window id) {
101
99
  char *file = config();
102
- int fd = open(file, O_WRONLY | O_CREAT | O_TRUNC, 0644); if (-1 == fd) {
100
+ int fd = open(file, O_WRONLY | O_CREAT | O_TRUNC, 0600); if (-1 == fd) {
103
101
  warn("failed to truncate %s", file);
104
102
  return;
105
103
  }
data/fontinfo.c CHANGED
@@ -3,8 +3,6 @@
3
3
  #include <stdbool.h>
4
4
  #include <err.h>
5
5
  #include <X11/Xft/Xft.h>
6
- #include <X11/Xatom.h>
7
-
8
6
  #include "lib.c"
9
7
 
10
8
  long desktop_width(Display *dpy) {
data/lib.c CHANGED
@@ -1,3 +1,11 @@
1
+ #include <stdlib.h>
2
+ #include <string.h>
3
+ #include <errno.h>
4
+ #include <sys/stat.h>
5
+
6
+ #include <X11/Xlib.h>
7
+ #include <X11/Xatom.h>
8
+
1
9
  bool prop(Display *dpy, Window wid, Atom expected_type, const char *name,
2
10
  u_char **result, ulong *size) {
3
11
  Atom type;
@@ -58,3 +66,32 @@ WindowState state(Display *dpy, Window id) {
58
66
 
59
67
  return r;
60
68
  }
69
+
70
+ bool mkdir_p(const char *s, mode_t mode) {
71
+ char *component = strdup(s);
72
+ char *p = component;
73
+
74
+ bool status = true;
75
+ while (*p && *p == '/') p++; // skip leading '/'
76
+
77
+ do {
78
+ while (*p && *p != '/') p++;
79
+
80
+ if (!*p)
81
+ p = NULL;
82
+ else
83
+ *p = '\0';
84
+
85
+ if (-1 == mkdir(component, mode) && errno != EEXIST) {
86
+ status = false;
87
+ break;
88
+ } else if (p) {
89
+ *p++ = '/';
90
+ while (*p && *p == '/') p++;
91
+ }
92
+
93
+ } while (p);
94
+
95
+ free(component);
96
+ return status;
97
+ }
data/winlist.c CHANGED
@@ -5,15 +5,11 @@
5
5
  {"desk":0,"host":"hm76","name":"xterm","resource":"xterm","class":"XTerm","id":67108878}
6
6
  */
7
7
 
8
- #include <stdlib.h>
9
8
  #include <err.h>
10
9
  #include <stdio.h>
11
10
  #include <stdbool.h>
12
- #include <string.h>
13
11
  #include <math.h>
14
12
 
15
- #include <X11/Xlib.h>
16
- #include <X11/Xatom.h>
17
13
  #include <X11/Xutil.h>
18
14
  #include <jansson.h>
19
15
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fvwm-window-search
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Gromnitsky
8
8
  autorequire:
9
9
  bindir: "."
10
10
  cert_chain: []
11
- date: 2021-04-09 00:00:00.000000000 Z
11
+ date: 2021-04-10 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |
14
14
  A window switcher: search for windows interactively using a patched