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.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/activate.c +7 -9
- data/fontinfo.c +0 -2
- data/lib.c +37 -0
- data/winlist.c +0 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 128a87d266fc2fa55f7a0a49e4754ff7026eeb13ea1e9db1c392fa5615e6e8ea
|
4
|
+
data.tar.gz: a4da76f60401c5cf6ed56069032b1014efd2224da4deaaf11a1ff4ac5e282870
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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://
|
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/
|
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
|
-
|
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
|
-
|
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,
|
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
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.
|
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-
|
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
|