Compare commits
4 Commits
| Author | SHA256 | Date | |
|---|---|---|---|
| f08f023a69 | |||
|
|
f446fe3c0b | ||
|
|
d5fab7d4a4 | ||
|
|
40fd33da76 |
36
29329779b72cb0a7958b7491296782816de8e477.patch
Normal file
36
29329779b72cb0a7958b7491296782816de8e477.patch
Normal file
@@ -0,0 +1,36 @@
|
||||
From 29329779b72cb0a7958b7491296782816de8e477 Mon Sep 17 00:00:00 2001
|
||||
From: Willow Barraco <contact@willowbarraco.fr>
|
||||
Date: Thu, 5 Dec 2024 07:55:17 +0100
|
||||
Subject: [PATCH] fix build error on redefinition of prctl_mm_map
|
||||
|
||||
When including both linux/prctl.h and sys/prctl.h, the build fails with:
|
||||
|
||||
In file included from lswt.c:35:
|
||||
/usr/include/sys/prctl.h:88:8: error: redefinition of 'struct prctl_mm_map'
|
||||
88 | struct prctl_mm_map {
|
||||
| ^~~~~~~~~~~~
|
||||
In file included from lswt.c:34:
|
||||
/usr/include/linux/prctl.h:134:8: note: originally defined here
|
||||
134 | struct prctl_mm_map {
|
||||
| ^~~~~~~~~~~~
|
||||
|
||||
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
|
||||
---
|
||||
lswt.c | 1 -
|
||||
1 file changed, 1 deletion(-)
|
||||
|
||||
diff --git a/lswt.c b/lswt.c
|
||||
index 385a780..9201975 100644
|
||||
--- a/lswt.c
|
||||
+++ b/lswt.c
|
||||
@@ -31,7 +31,6 @@
|
||||
#ifdef __linux__
|
||||
#include <features.h>
|
||||
#include <linux/landlock.h>
|
||||
-#include <linux/prctl.h>
|
||||
#include <sys/prctl.h>
|
||||
#include <sys/syscall.h>
|
||||
#ifdef __GLIBC__
|
||||
--
|
||||
2.45.2
|
||||
|
||||
62
55a29650a110928cb7ad612182c8096424ebb70a.patch
Normal file
62
55a29650a110928cb7ad612182c8096424ebb70a.patch
Normal file
@@ -0,0 +1,62 @@
|
||||
From 55a29650a110928cb7ad612182c8096424ebb70a Mon Sep 17 00:00:00 2001
|
||||
From: Leon Henrik Plickat <leonhenrik.plickat@stud.uni-goettingen.de>
|
||||
Date: Sat, 24 Aug 2024 18:21:02 +0200
|
||||
Subject: [PATCH] improve watch mode messages
|
||||
|
||||
---
|
||||
lswt.c | 25 ++++++++++++++++++++-----
|
||||
1 file changed, 20 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/lswt.c b/lswt.c
|
||||
index 675cfd0..e90808d 100644
|
||||
--- a/lswt.c
|
||||
+++ b/lswt.c
|
||||
@@ -239,8 +239,15 @@ static void toplevel_destroy (struct Toplevel *self)
|
||||
static void toplevel_set_title (struct Toplevel *self, const char *title)
|
||||
{
|
||||
if ( mode == WATCH || debug_log )
|
||||
- fprintf(stdout, "toplevel %ld: set title: '%s' -> '%s'\n",
|
||||
- self->id, self->title, title);
|
||||
+ {
|
||||
+ if ( self->title == NULL )
|
||||
+ fprintf(stdout, "toplevel %ld: set title: '%s'\n",
|
||||
+ self->id, title);
|
||||
+
|
||||
+ else
|
||||
+ fprintf(stdout, "toplevel %ld: change title: '%s' -> '%s'\n",
|
||||
+ self->id, self->title, title);
|
||||
+ }
|
||||
|
||||
if ( self->title != NULL )
|
||||
free(self->title);
|
||||
@@ -254,8 +261,16 @@ static size_t real_strlen (const char *str);
|
||||
static void toplevel_set_app_id (struct Toplevel *self, const char *app_id)
|
||||
{
|
||||
if ( mode == WATCH || debug_log )
|
||||
- fprintf(stdout, "toplevel %ld: set app-id: '%s' -> '%s'\n",
|
||||
- self->id, self->app_id, app_id);
|
||||
+ {
|
||||
+ if ( self->app_id == NULL )
|
||||
+ fprintf(stdout, "toplevel %ld: set app-id: '%s'\n",
|
||||
+ self->id, app_id);
|
||||
+
|
||||
+ else
|
||||
+ fprintf(stdout, "toplevel %ld: change app-id: '%s' -> '%s'\n",
|
||||
+ self->id, self->app_id, app_id);
|
||||
+ }
|
||||
+
|
||||
|
||||
if ( self->app_id != NULL )
|
||||
free(self->app_id);
|
||||
@@ -282,7 +297,7 @@ static void toplevel_set_identifier (struct Toplevel *self, const char *identifi
|
||||
if ( self->identifier != NULL )
|
||||
{
|
||||
fputs(
|
||||
- "ERROR: protocol-error: Compositor changed identifier of toplevel, "
|
||||
+ "ERROR: protocol-error: Server changed identifier of toplevel, "
|
||||
"which is forbidden by the protocol. Continuing anyway...\n",
|
||||
stderr
|
||||
);
|
||||
--
|
||||
2.45.2
|
||||
|
||||
42
8d76a317ad2da073a638d72eac8a24df33ae01f1.patch
Normal file
42
8d76a317ad2da073a638d72eac8a24df33ae01f1.patch
Normal file
@@ -0,0 +1,42 @@
|
||||
From 8d76a317ad2da073a638d72eac8a24df33ae01f1 Mon Sep 17 00:00:00 2001
|
||||
From: Leon Henrik Plickat <leonhenrik.plickat@stud.uni-goettingen.de>
|
||||
Date: Sun, 19 May 2024 10:05:34 +0200
|
||||
Subject: [PATCH] restrict landlock to linux
|
||||
|
||||
---
|
||||
lswt.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/lswt.c b/lswt.c
|
||||
index 0963da3..82f64b2 100644
|
||||
--- a/lswt.c
|
||||
+++ b/lswt.c
|
||||
@@ -1199,6 +1199,7 @@ static void handle_error (int signum)
|
||||
kill(getpid(), signum);
|
||||
}
|
||||
|
||||
+#ifdef __linux__
|
||||
static void lock_the_land (void)
|
||||
{
|
||||
/* For ABI versions 1 to 3 repsectively. */
|
||||
@@ -1250,6 +1251,7 @@ static void lock_the_land (void)
|
||||
|
||||
close(ruleset_fd);
|
||||
}
|
||||
+#endif
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
@@ -1257,7 +1259,9 @@ int main(int argc, char *argv[])
|
||||
signal(SIGFPE, handle_error);
|
||||
signal(SIGINT, handle_interrupt);
|
||||
|
||||
+#ifdef __linux__
|
||||
lock_the_land();
|
||||
+#endif
|
||||
|
||||
if ( argc > 0 ) for (int i = 1; i < argc; i++)
|
||||
{
|
||||
--
|
||||
2.45.2
|
||||
|
||||
17
_service
17
_service
@@ -1,17 +0,0 @@
|
||||
<services>
|
||||
<service name="obs_scm" mode="manual">
|
||||
<param name="url">https://git.sr.ht/~leon_plickat/lswt</param>
|
||||
<param name="filename">lswt</param>
|
||||
<param name="scm">git</param>
|
||||
<param name="exclude">.git</param>
|
||||
<param name="revision">v2.0.0</param>
|
||||
<param name="versionformat">@PARENT_TAG@</param>
|
||||
<param name="versionrewrite-pattern">v(.*)</param>
|
||||
</service>
|
||||
<service name="set_version" mode="manual"/>
|
||||
<service mode="buildtime" name="tar" />
|
||||
<service mode="buildtime" name="recompress">
|
||||
<param name="file">*.tar</param>
|
||||
<param name="compression">zst</param>
|
||||
</service>
|
||||
</services>
|
||||
171
a39b55080dcb50edc9321d38af8775af22cf852f.patch
Normal file
171
a39b55080dcb50edc9321d38af8775af22cf852f.patch
Normal file
@@ -0,0 +1,171 @@
|
||||
From a39b55080dcb50edc9321d38af8775af22cf852f Mon Sep 17 00:00:00 2001
|
||||
From: Leon Henrik Plickat <leonhenrik.plickat@stud.uni-goettingen.de>
|
||||
Date: Thu, 5 Dec 2024 15:45:49 +0100
|
||||
Subject: [PATCH] add --force-protocol option
|
||||
|
||||
---
|
||||
lswt.1 | 22 ++++++++++++++----
|
||||
lswt.c | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++-----
|
||||
2 files changed, 84 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/lswt.1 b/lswt.1
|
||||
index a84ce02..4414120 100644
|
||||
--- a/lswt.1
|
||||
+++ b/lswt.1
|
||||
@@ -11,6 +11,7 @@ lswt \- list Wayland toplevels
|
||||
.OP \-\-json
|
||||
.OP \-c custom-format
|
||||
.OP \-\-custom custom-format
|
||||
+.OP \-\-force\-protocol protocol
|
||||
.YS
|
||||
.
|
||||
.SY lswt
|
||||
@@ -49,6 +50,13 @@ which specifies the information about the toplevels lswt should
|
||||
print.
|
||||
The JSON output is versioned.
|
||||
.P
|
||||
+lswt also supports a watch mode, which will run continuosly and log whenever
|
||||
+toplevels change their app-id or title.
|
||||
+The watch mode is incompatible with the JSON and CSV output formats.
|
||||
+.
|
||||
+.
|
||||
+.SH SUPPORTED PROTOCOLS
|
||||
+.P
|
||||
The information is querried from the Wayland server via one of
|
||||
the following protocols:
|
||||
.IP \(bu 2
|
||||
@@ -58,10 +66,6 @@ wlr-foreign-toplevel-management-unstable-v1
|
||||
.P
|
||||
As of now, only the ext- protocol supports unique toplevel IDs and
|
||||
only the wlr- protocol supports toplevel states.
|
||||
-.P
|
||||
-lswt also supports a watch mode, which will run continuosly and log whenever
|
||||
-toplevels change their app-id or title.
|
||||
-The watch mode is incompatible with the JSON and CSV output formats.
|
||||
.
|
||||
.
|
||||
.SH OPTIONS
|
||||
@@ -133,6 +137,16 @@ T}
|
||||
.RE
|
||||
.
|
||||
.
|
||||
+.P
|
||||
+\fB--force-protocol\fR \fIprotocol-name\fR
|
||||
+.RS
|
||||
+Force the use of the specified protocl.
|
||||
+lswt will not fall back onto another protocol if the specified one is not
|
||||
+supported.
|
||||
+See the \fBSUPPORTED PROTOCOLS\fR section for protocol names.
|
||||
+.RE
|
||||
+.
|
||||
+.
|
||||
.SH AUTHOR
|
||||
.P
|
||||
.MT leonhenrik.plickat@stud.uni-goettingen.de
|
||||
diff --git a/lswt.c b/lswt.c
|
||||
index 9201975..5376af0 100644
|
||||
--- a/lswt.c
|
||||
+++ b/lswt.c
|
||||
@@ -56,7 +56,8 @@ const char usage[] =
|
||||
" and app-id events.\n"
|
||||
" -W, --verbose-watch Like --watch, but also log activated, fullscreen,\n"
|
||||
" minimized and maximized state.\n"
|
||||
- " -c <fmt>, --custom <fmt> Define a custom line-based output format.\n";
|
||||
+ " -c <fmt>, --custom <fmt> Define a custom line-based output format.\n"
|
||||
+ " --force-protocol <name> Use specified protocol, do not fall back onto others.";
|
||||
|
||||
enum Output_format
|
||||
{
|
||||
@@ -103,6 +104,7 @@ enum UsedProtocol
|
||||
EXT_FOREIGN_TOPLEVEL,
|
||||
};
|
||||
enum UsedProtocol used_protocol;
|
||||
+bool force_protocol = false;
|
||||
|
||||
struct wl_list toplevels;
|
||||
|
||||
@@ -1136,11 +1138,40 @@ static void sync_handle_done
|
||||
/* First sync: The registry finished advertising globals.
|
||||
* Now we can check whether we have everything we need.
|
||||
*/
|
||||
- if ( zwlr_toplevel_manager != NULL )
|
||||
- used_protocol = ZWLR_FOREIGN_TOPLEVEL;
|
||||
- if ( ext_toplevel_list != NULL )
|
||||
+ if (force_protocol)
|
||||
+ {
|
||||
+ switch (used_protocol)
|
||||
+ {
|
||||
+ case ZWLR_FOREIGN_TOPLEVEL:
|
||||
+ if ( zwlr_toplevel_manager == NULL )
|
||||
+ {
|
||||
+ fputs("ERROR: Wayland server does not support zwlr-foreign-toplevel-management-unstable-v1 version 3.\n", stderr);
|
||||
+ ret = EXIT_FAILURE;
|
||||
+ loop = false;
|
||||
+ return;
|
||||
+ }
|
||||
+ break;
|
||||
+
|
||||
+ case EXT_FOREIGN_TOPLEVEL:
|
||||
+ if ( ext_toplevel_list == NULL )
|
||||
+ {
|
||||
+ fputs("ERROR: Wayland server does not support ext-foreign-toplevel-list-v1 version 1.\n", stderr);
|
||||
+ ret = EXIT_FAILURE;
|
||||
+ loop = false;
|
||||
+ return;
|
||||
+ }
|
||||
+ break;
|
||||
+
|
||||
+ case NONE: /* Unreachable. */
|
||||
+ assert(false);
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ else if ( ext_toplevel_list != NULL )
|
||||
used_protocol = EXT_FOREIGN_TOPLEVEL;
|
||||
- if ( used_protocol == NONE )
|
||||
+ else if ( zwlr_toplevel_manager != NULL )
|
||||
+ used_protocol = ZWLR_FOREIGN_TOPLEVEL;
|
||||
+ else
|
||||
{
|
||||
const char *err_message =
|
||||
"ERROR: Wayland server supports none of the protocol extensions required for getting toplevel information:\n"
|
||||
@@ -1366,6 +1397,36 @@ int main(int argc, char *argv[])
|
||||
mode = WATCH;
|
||||
else if ( strcmp(argv[i], "-W") == 0 || strcmp(argv[i], "--verbose-watch") == 0 )
|
||||
mode = VERBOSE_WATCH;
|
||||
+ else if ( strcmp(argv[i], "--force-protocol") == 0 )
|
||||
+ {
|
||||
+ if (force_protocol)
|
||||
+ {
|
||||
+ fputs("ERROR: Forced protocol may only be specified once.\n", stderr);
|
||||
+ ret = EXIT_FAILURE;
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+ force_protocol = true;
|
||||
+
|
||||
+ if ( argc == i + 1 )
|
||||
+ {
|
||||
+ fprintf(stderr, "ERROR: Flag '%s' requires a parameter.\n", argv[i]);
|
||||
+ ret = EXIT_FAILURE;
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+
|
||||
+ if ( strcmp(argv[i+1], "ext-foreign-toplevel-list-v1") == 0 )
|
||||
+ used_protocol = EXT_FOREIGN_TOPLEVEL;
|
||||
+ else if ( strcmp (argv[i+1], "zwlr-foreign-toplevel-management-unstable-v1") == 0 )
|
||||
+ used_protocol = ZWLR_FOREIGN_TOPLEVEL;
|
||||
+ else
|
||||
+ {
|
||||
+ fprintf(stderr, "ERROR: Unknown protocol: '%s'.\n", argv[i+1]);
|
||||
+ ret = EXIT_FAILURE;
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+
|
||||
+ i++;
|
||||
+ }
|
||||
else if ( strcmp(argv[i], "-v") == 0 || strcmp(argv[i], "--version") == 0 )
|
||||
{
|
||||
fputs("lswt version " VERSION "\n", stderr);
|
||||
--
|
||||
2.45.2
|
||||
|
||||
230
ade15dbc3d11325a2569a0efd543d43a3ecb3547.patch
Normal file
230
ade15dbc3d11325a2569a0efd543d43a3ecb3547.patch
Normal file
@@ -0,0 +1,230 @@
|
||||
From ade15dbc3d11325a2569a0efd543d43a3ecb3547 Mon Sep 17 00:00:00 2001
|
||||
From: Leon Henrik Plickat <leonhenrik.plickat@stud.uni-goettingen.de>
|
||||
Date: Sat, 24 Aug 2024 18:44:52 +0200
|
||||
Subject: [PATCH] add verbose watcch mode
|
||||
|
||||
---
|
||||
lswt.c | 105 +++++++++++++++++++++++++++++++++++++--------------------
|
||||
1 file changed, 69 insertions(+), 36 deletions(-)
|
||||
|
||||
diff --git a/lswt.c b/lswt.c
|
||||
index e90808d..d564e53 100644
|
||||
--- a/lswt.c
|
||||
+++ b/lswt.c
|
||||
@@ -50,11 +50,14 @@
|
||||
|
||||
const char usage[] =
|
||||
"Usage: lswt [options...]\n"
|
||||
- " -h, --help Print this helpt text and exit.\n"
|
||||
- " -v, --version Print version and exit.\n"
|
||||
- " -j, --json Output data in JSON format.\n"
|
||||
- " -w, --watch Run continously and log events.\n"
|
||||
- " -c <fmt>, --custom <fmt> Define a custom line-based output format.\n";
|
||||
+ " -h, --help Print this helpt text and exit.\n"
|
||||
+ " -v, --version Print version and exit.\n"
|
||||
+ " -j, --json Output data in JSON format.\n"
|
||||
+ " -w, --watch Run continously and log title, identifier\n"
|
||||
+ " and app-id events.\n"
|
||||
+ " -W, --verbose-watch Like --watch, but also log activated, fullscreen,\n"
|
||||
+ " minimized and maximized state.\n"
|
||||
+ " -c <fmt>, --custom <fmt> Define a custom line-based output format.\n";
|
||||
|
||||
enum Output_format
|
||||
{
|
||||
@@ -70,6 +73,7 @@ enum Mode
|
||||
{
|
||||
LIST,
|
||||
WATCH,
|
||||
+ VERBOSE_WATCH,
|
||||
};
|
||||
enum Mode mode = LIST;
|
||||
|
||||
@@ -208,7 +212,7 @@ static struct Toplevel *toplevel_new (void)
|
||||
new->maximized = false;
|
||||
new->minimized = false;
|
||||
|
||||
- if ( mode == WATCH || debug_log )
|
||||
+ if ( mode == WATCH || mode == VERBOSE_WATCH || debug_log )
|
||||
fprintf(stdout, "toplevel %ld: created\n", new->id);
|
||||
|
||||
return new;
|
||||
@@ -217,7 +221,7 @@ static struct Toplevel *toplevel_new (void)
|
||||
/** Destroys a toplevel and removes it from the list, if it is listed. */
|
||||
static void toplevel_destroy (struct Toplevel *self)
|
||||
{
|
||||
- if ( mode == WATCH || debug_log )
|
||||
+ if ( mode == WATCH || mode == VERBOSE_WATCH || debug_log )
|
||||
fprintf(stdout, "toplevel %ld: destroyed\n", self->id);
|
||||
|
||||
if ( self->zwlr_handle != NULL )
|
||||
@@ -238,15 +242,21 @@ static void toplevel_destroy (struct Toplevel *self)
|
||||
/** Set the title of the toplevel. Called from protocol implementations. */
|
||||
static void toplevel_set_title (struct Toplevel *self, const char *title)
|
||||
{
|
||||
- if ( mode == WATCH || debug_log )
|
||||
+ if ( mode == WATCH || mode == VERBOSE_WATCH || debug_log )
|
||||
{
|
||||
if ( self->title == NULL )
|
||||
- fprintf(stdout, "toplevel %ld: set title: '%s'\n",
|
||||
- self->id, title);
|
||||
+ fprintf(
|
||||
+ stdout,
|
||||
+ "toplevel %ld: set title: '%s'\n",
|
||||
+ self->id, title
|
||||
+ );
|
||||
|
||||
else
|
||||
- fprintf(stdout, "toplevel %ld: change title: '%s' -> '%s'\n",
|
||||
- self->id, self->title, title);
|
||||
+ fprintf(
|
||||
+ stdout,
|
||||
+ "toplevel %ld: change title: '%s' -> '%s'\n",
|
||||
+ self->id, self->title, title
|
||||
+ );
|
||||
}
|
||||
|
||||
if ( self->title != NULL )
|
||||
@@ -260,18 +270,23 @@ static void toplevel_set_title (struct Toplevel *self, const char *title)
|
||||
static size_t real_strlen (const char *str);
|
||||
static void toplevel_set_app_id (struct Toplevel *self, const char *app_id)
|
||||
{
|
||||
- if ( mode == WATCH || debug_log )
|
||||
+ if ( mode == WATCH || mode == VERBOSE_WATCH || debug_log )
|
||||
{
|
||||
if ( self->app_id == NULL )
|
||||
- fprintf(stdout, "toplevel %ld: set app-id: '%s'\n",
|
||||
- self->id, app_id);
|
||||
+ fprintf(
|
||||
+ stdout,
|
||||
+ "toplevel %ld: set app-id: '%s'\n",
|
||||
+ self->id, app_id
|
||||
+ );
|
||||
|
||||
else
|
||||
- fprintf(stdout, "toplevel %ld: change app-id: '%s' -> '%s'\n",
|
||||
- self->id, self->app_id, app_id);
|
||||
+ fprintf(
|
||||
+ stdout,
|
||||
+ "toplevel %ld: change app-id: '%s' -> '%s'\n",
|
||||
+ self->id, self->app_id, app_id
|
||||
+ );
|
||||
}
|
||||
|
||||
-
|
||||
if ( self->app_id != NULL )
|
||||
free(self->app_id);
|
||||
self->app_id = strdup(app_id);
|
||||
@@ -290,9 +305,12 @@ static void toplevel_set_app_id (struct Toplevel *self, const char *app_id)
|
||||
/** Set the identifier of the toplevel. Called from protocol implementations. */
|
||||
static void toplevel_set_identifier (struct Toplevel *self, const char *identifier)
|
||||
{
|
||||
- if ( mode == WATCH || debug_log )
|
||||
- fprintf(stdout, "toplevel %ld: set identifier: %s\n",
|
||||
- self->id, identifier);
|
||||
+ if ( mode == WATCH || mode == VERBOSE_WATCH || debug_log )
|
||||
+ fprintf(
|
||||
+ stdout,
|
||||
+ "toplevel %ld: set identifier: %s\n",
|
||||
+ self->id, identifier
|
||||
+ );
|
||||
|
||||
if ( self->identifier != NULL )
|
||||
{
|
||||
@@ -310,33 +328,46 @@ static void toplevel_set_identifier (struct Toplevel *self, const char *identifi
|
||||
|
||||
static void toplevel_set_fullscreen (struct Toplevel *self, bool fullscreen)
|
||||
{
|
||||
- if (debug_log)
|
||||
- fprintf(stdout, "[toplevel %ld: set fullscreen: %d]\n",
|
||||
- self->id, fullscreen);
|
||||
+ if ( mode == VERBOSE_WATCH || debug_log )
|
||||
+ fprintf(
|
||||
+ stdout,
|
||||
+ "toplevel %ld: fullscreen: %s\n",
|
||||
+ self->id, BOOL_TO_STR(fullscreen)
|
||||
+ );
|
||||
+
|
||||
self->fullscreen = fullscreen;
|
||||
}
|
||||
|
||||
static void toplevel_set_activated (struct Toplevel *self, bool activated)
|
||||
{
|
||||
- if (debug_log)
|
||||
- fprintf(stdout, "[toplevel %ld: set activated: %d]\n",
|
||||
- self->id, activated);
|
||||
+ if ( mode == VERBOSE_WATCH || debug_log )
|
||||
+ fprintf(
|
||||
+ stdout,
|
||||
+ "toplevel %ld: activated (focused): %s\n",
|
||||
+ self->id, BOOL_TO_STR(activated)
|
||||
+ );
|
||||
self->activated = activated;
|
||||
}
|
||||
|
||||
static void toplevel_set_maximized (struct Toplevel *self, bool maximized)
|
||||
{
|
||||
- if (debug_log)
|
||||
- fprintf(stdout, "[toplevel %ld: set maximized: %d]\n",
|
||||
- self->id, maximized);
|
||||
+ if ( mode == VERBOSE_WATCH || debug_log )
|
||||
+ fprintf(
|
||||
+ stdout,
|
||||
+ "toplevel %ld: maximized: %s\n",
|
||||
+ self->id, BOOL_TO_STR(maximized)
|
||||
+ );
|
||||
self->maximized = maximized;
|
||||
}
|
||||
|
||||
static void toplevel_set_minimized (struct Toplevel *self, bool minimized)
|
||||
{
|
||||
- if (debug_log)
|
||||
- fprintf(stdout, "[toplevel %ld: set minimized: %d]\n",
|
||||
- self->id, minimized);
|
||||
+ if ( mode == VERBOSE_WATCH || debug_log )
|
||||
+ fprintf(
|
||||
+ stdout,
|
||||
+ "toplevel %ld: minimized: %s\n",
|
||||
+ self->id, BOOL_TO_STR(minimized)
|
||||
+ );
|
||||
self->minimized = minimized;
|
||||
}
|
||||
|
||||
@@ -407,7 +438,7 @@ static void ext_foreign_handle_handle_closed
|
||||
)
|
||||
{
|
||||
/* We only care when watching for events. */
|
||||
- if ( mode == WATCH )
|
||||
+ if ( mode == WATCH || mode == VERBOSE_WATCH )
|
||||
{
|
||||
struct Toplevel *toplevel = (struct Toplevel *)data;
|
||||
toplevel_destroy(toplevel);
|
||||
@@ -534,7 +565,7 @@ static void zwlr_foreign_handle_handle_closed
|
||||
)
|
||||
{
|
||||
/* We only care when watching for events. */
|
||||
- if ( mode == WATCH )
|
||||
+ if ( mode == WATCH || mode == VERBOSE_WATCH )
|
||||
{
|
||||
struct Toplevel *toplevel = (struct Toplevel *)data;
|
||||
toplevel_destroy(toplevel);
|
||||
@@ -1326,6 +1357,8 @@ int main(int argc, char *argv[])
|
||||
debug_log = true;
|
||||
else if ( strcmp(argv[i], "-w") == 0 || strcmp(argv[i], "--watch") == 0 )
|
||||
mode = WATCH;
|
||||
+ else if ( strcmp(argv[i], "-W") == 0 || strcmp(argv[i], "--verbose-watch") == 0 )
|
||||
+ mode = VERBOSE_WATCH;
|
||||
else if ( strcmp(argv[i], "-v") == 0 || strcmp(argv[i], "--version") == 0 )
|
||||
{
|
||||
fputs("lswt version " VERSION "\n", stderr);
|
||||
@@ -1347,7 +1380,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
- if ( mode == WATCH && output_format != NORMAL )
|
||||
+ if ( ( mode == WATCH || mode == VERBOSE_WATCH ) && output_format != NORMAL )
|
||||
{
|
||||
fputs("ERROR: Alternative output formats are not supported in watch mode.\n", stderr);
|
||||
ret = EXIT_FAILURE;
|
||||
--
|
||||
2.45.2
|
||||
|
||||
110
c1ea4ee2a6e4a4e579a17f1e15351f225cb23a1d.patch
Normal file
110
c1ea4ee2a6e4a4e579a17f1e15351f225cb23a1d.patch
Normal file
@@ -0,0 +1,110 @@
|
||||
From c1ea4ee2a6e4a4e579a17f1e15351f225cb23a1d Mon Sep 17 00:00:00 2001
|
||||
From: Leon Henrik Plickat <leonhenrik.plickat@stud.uni-goettingen.de>
|
||||
Date: Sun, 19 May 2024 09:17:05 +0200
|
||||
Subject: [PATCH] use landlock on linux to restrict fs access
|
||||
|
||||
---
|
||||
lswt.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
|
||||
1 file changed, 59 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/lswt.c b/lswt.c
|
||||
index 4e4bb16..0963da3 100644
|
||||
--- a/lswt.c
|
||||
+++ b/lswt.c
|
||||
@@ -31,6 +31,8 @@
|
||||
#ifdef __linux__
|
||||
#include <features.h>
|
||||
#include <linux/landlock.h>
|
||||
+#include <linux/prctl.h>
|
||||
+#include <sys/prctl.h>
|
||||
#include <sys/syscall.h>
|
||||
#ifdef __GLIBC__
|
||||
#include<execinfo.h>
|
||||
@@ -44,6 +46,8 @@
|
||||
|
||||
#define VERSION "2.0.1-dev"
|
||||
|
||||
+#define max_supported_landlock_abi 3
|
||||
+
|
||||
const char usage[] =
|
||||
"Usage: lswt [options...]\n"
|
||||
" -h, --help Print this helpt text and exit.\n"
|
||||
@@ -1135,7 +1139,7 @@ static void free_data (void)
|
||||
|
||||
struct Toplevel *t, *tmp;
|
||||
wl_list_for_each_safe(t, tmp, &toplevels, link)
|
||||
- toplevel_destroy(t);
|
||||
+ toplevel_destroy(t);
|
||||
}
|
||||
|
||||
static void handle_interrupt (int signum)
|
||||
@@ -1195,12 +1199,66 @@ static void handle_error (int signum)
|
||||
kill(getpid(), signum);
|
||||
}
|
||||
|
||||
+static void lock_the_land (void)
|
||||
+{
|
||||
+ /* For ABI versions 1 to 3 repsectively. */
|
||||
+ static uint64_t landlock_access_rights[max_supported_landlock_abi] = {
|
||||
+ (1ULL << 13) - 1, (1ULL << 14) - 1, (1ULL << 15) - 1
|
||||
+ };
|
||||
+
|
||||
+ /* Query for supported ABI, if any. */
|
||||
+ long int abi = syscall(
|
||||
+ SYS_landlock_create_ruleset,
|
||||
+ NULL, 0, LANDLOCK_CREATE_RULESET_VERSION
|
||||
+ );
|
||||
+
|
||||
+ if ( abi < 0 )
|
||||
+ {
|
||||
+ /* Landlock unsupported or disabled. */
|
||||
+ if ( errno == ENOSYS || errno == EOPNOTSUPP )
|
||||
+ return;
|
||||
+
|
||||
+ fprintf(stderr, "ERROR: landlock_create_ruledset: %s\n", strerror(errno));
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if ( abi > max_supported_landlock_abi )
|
||||
+ abi = max_supported_landlock_abi;
|
||||
+
|
||||
+ if ( prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0) < 0 )
|
||||
+ {
|
||||
+ fprintf(stderr, "ERROR: prctl: %s\n", strerror(errno));
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ struct landlock_ruleset_attr attr = {
|
||||
+ .handled_access_fs = landlock_access_rights[abi - 1],
|
||||
+ };
|
||||
+
|
||||
+ int ruleset_fd = (int)syscall(
|
||||
+ SYS_landlock_create_ruleset,
|
||||
+ &attr, sizeof(attr), 0
|
||||
+ );
|
||||
+ if ( ruleset_fd < 0 )
|
||||
+ {
|
||||
+ fprintf(stderr, "ERROR: landlock_create_ruleset: %s\n", strerror(errno));
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if ( syscall(SYS_landlock_restrict_self, ruleset_fd, 0) != 0 )
|
||||
+ fprintf(stderr, "ERROR: landlock_restrict_self: %s\n", strerror(errno));
|
||||
+
|
||||
+ close(ruleset_fd);
|
||||
+}
|
||||
+
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
signal(SIGSEGV, handle_error);
|
||||
signal(SIGFPE, handle_error);
|
||||
signal(SIGINT, handle_interrupt);
|
||||
|
||||
+ lock_the_land();
|
||||
+
|
||||
if ( argc > 0 ) for (int i = 1; i < argc; i++)
|
||||
{
|
||||
if ( strcmp(argv[i], "-j") == 0 || strcmp(argv[i], "--json") == 0 )
|
||||
--
|
||||
2.45.2
|
||||
|
||||
33
d35786da4383388c19f5437128fd393a6f16f74f.patch
Normal file
33
d35786da4383388c19f5437128fd393a6f16f74f.patch
Normal file
@@ -0,0 +1,33 @@
|
||||
From d35786da4383388c19f5437128fd393a6f16f74f Mon Sep 17 00:00:00 2001
|
||||
From: Leon Henrik Plickat <leonhenrik.plickat@stud.uni-goettingen.de>
|
||||
Date: Thu, 5 Dec 2024 05:48:44 +0100
|
||||
Subject: [PATCH] fix JSON formatting of identifier string
|
||||
|
||||
---
|
||||
lswt.c | 10 +++++++++-
|
||||
1 file changed, 9 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/lswt.c b/lswt.c
|
||||
index d564e53..385a780 100644
|
||||
--- a/lswt.c
|
||||
+++ b/lswt.c
|
||||
@@ -933,7 +933,15 @@ static void out_write_toplevel (struct Toplevel *toplevel)
|
||||
if (support_maximized)
|
||||
fprintf(stdout, " \"maximized\": %s,\n", BOOL_TO_STR(toplevel->maximized));
|
||||
if (support_identifier)
|
||||
- fprintf(stdout, " \"identifier\": %s,\n", toplevel->identifier);
|
||||
+ {
|
||||
+ /* Identifiers may contain all
|
||||
+ * printable ASCII bytes, including
|
||||
+ * quotes.
|
||||
+ */
|
||||
+ fputs(" \"identifier\": ", stdout);
|
||||
+ write_json(toplevel->identifier, stdout);
|
||||
+ fputs(",\n", stdout);
|
||||
+ }
|
||||
|
||||
/* Whoever designed JSON made the incredibly weird
|
||||
* mistake of enforcing that there is no comma on the
|
||||
--
|
||||
2.45.2
|
||||
|
||||
25
e4ebefcb30053a990cb821a75c4e1310fc967673.patch
Normal file
25
e4ebefcb30053a990cb821a75c4e1310fc967673.patch
Normal file
@@ -0,0 +1,25 @@
|
||||
From e4ebefcb30053a990cb821a75c4e1310fc967673 Mon Sep 17 00:00:00 2001
|
||||
From: Leon Henrik Plickat <leonhenrik.plickat@stud.uni-goettingen.de>
|
||||
Date: Sat, 24 Aug 2024 17:57:36 +0200
|
||||
Subject: [PATCH] print errno when connecting to display fails
|
||||
|
||||
---
|
||||
lswt.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/lswt.c b/lswt.c
|
||||
index 60c6ce7..675cfd0 100644
|
||||
--- a/lswt.c
|
||||
+++ b/lswt.c
|
||||
@@ -1361,7 +1361,7 @@ int main(int argc, char *argv[])
|
||||
wl_display = wl_display_connect(display_name);
|
||||
if ( wl_display == NULL )
|
||||
{
|
||||
- fputs("ERROR: Can not connect to wayland display.\n", stderr);
|
||||
+ fprintf(stderr, "ERROR: Can not connect to wayland display: %s\n", strerror(errno));
|
||||
ret = EXIT_FAILURE;
|
||||
goto cleanup;
|
||||
}
|
||||
--
|
||||
2.45.2
|
||||
|
||||
25
ea45c1a8cf66d102e6525d29b03126693949e562.patch
Normal file
25
ea45c1a8cf66d102e6525d29b03126693949e562.patch
Normal file
@@ -0,0 +1,25 @@
|
||||
From ea45c1a8cf66d102e6525d29b03126693949e562 Mon Sep 17 00:00:00 2001
|
||||
From: Leon Henrik Plickat <leonhenrik.plickat@stud.uni-goettingen.de>
|
||||
Date: Fri, 17 May 2024 14:53:57 +0200
|
||||
Subject: [PATCH] update version to 2.0.1-dev
|
||||
|
||||
---
|
||||
lswt.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/lswt.c b/lswt.c
|
||||
index 2b4b2ed..4e4bb16 100644
|
||||
--- a/lswt.c
|
||||
+++ b/lswt.c
|
||||
@@ -42,7 +42,7 @@
|
||||
|
||||
#define BOOL_TO_STR(B) (B) ? "true" : "false"
|
||||
|
||||
-#define VERSION "2.0.0"
|
||||
+#define VERSION "2.0.1-dev"
|
||||
|
||||
const char usage[] =
|
||||
"Usage: lswt [options...]\n"
|
||||
--
|
||||
2.45.2
|
||||
|
||||
25
fbb7be4354508b41552ce2159b1203db123916ac.patch
Normal file
25
fbb7be4354508b41552ce2159b1203db123916ac.patch
Normal file
@@ -0,0 +1,25 @@
|
||||
From fbb7be4354508b41552ce2159b1203db123916ac Mon Sep 17 00:00:00 2001
|
||||
From: Leon Henrik Plickat <leonhenrik.plickat@stud.uni-goettingen.de>
|
||||
Date: Fri, 28 Jun 2024 11:29:09 +0200
|
||||
Subject: [PATCH] remove accidental characters from license comment
|
||||
|
||||
---
|
||||
lswt.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/lswt.c b/lswt.c
|
||||
index 47dcfdd..60c6ce7 100644
|
||||
--- a/lswt.c
|
||||
+++ b/lswt.c
|
||||
@@ -13,7 +13,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
- sdcsdc * along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <ctype.h>
|
||||
--
|
||||
2.45.2
|
||||
|
||||
37
fdf0932f2939696a8398b63871ccc85335274c1f.patch
Normal file
37
fdf0932f2939696a8398b63871ccc85335274c1f.patch
Normal file
@@ -0,0 +1,37 @@
|
||||
From fdf0932f2939696a8398b63871ccc85335274c1f Mon Sep 17 00:00:00 2001
|
||||
From: Joe Edmonds <joe@elem.com>
|
||||
Date: Thu, 27 Jun 2024 09:27:00 +0200
|
||||
Subject: [PATCH] support titles with backslashes
|
||||
|
||||
---
|
||||
lswt.c | 7 ++++++-
|
||||
1 file changed, 6 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/lswt.c b/lswt.c
|
||||
index 82f64b2..47dcfdd 100644
|
||||
--- a/lswt.c
|
||||
+++ b/lswt.c
|
||||
@@ -13,7 +13,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
+ sdcsdc * along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <ctype.h>
|
||||
@@ -648,6 +648,11 @@ static void quoted_fputs (size_t *len, char *str, FILE *restrict f)
|
||||
l += 2;
|
||||
fputs("\\t", f);
|
||||
}
|
||||
+ else if ( *str == '\\' )
|
||||
+ {
|
||||
+ l += 2;
|
||||
+ fputs("\\\\", f);
|
||||
+ }
|
||||
else
|
||||
{
|
||||
l += 1;
|
||||
--
|
||||
2.45.2
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:c7ac241140622b5a8de399646caba767eaa78ef9442d16892296e06b1c76464a
|
||||
size 96267
|
||||
3
lswt-2.0.0.tar.gz
Normal file
3
lswt-2.0.0.tar.gz
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:8e23cc5c00bb715b0a1610938111cb76eb9efe1eea87408123620a8a7155e6ab
|
||||
size 27758
|
||||
27
lswt.changes
27
lswt.changes
@@ -1,3 +1,30 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Dec 13 05:36:10 UTC 2024 - Soc Virnyl Estela <uncomfyhalomacro@opensuse.org>
|
||||
|
||||
- Add ea45c1a8cf66d102e6525d29b03126693949e562.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Dec 13 05:33:25 UTC 2024 - Soc Virnyl Estela <uncomfyhalomacro@opensuse.org>
|
||||
|
||||
- Add the following patches:
|
||||
* 55a29650a110928cb7ad612182c8096424ebb70a.patch
|
||||
* 8d76a317ad2da073a638d72eac8a24df33ae01f1.patch
|
||||
* ade15dbc3d11325a2569a0efd543d43a3ecb3547.patch
|
||||
* c1ea4ee2a6e4a4e579a17f1e15351f225cb23a1d.patch
|
||||
* e4ebefcb30053a990cb821a75c4e1310fc967673.patch
|
||||
* fbb7be4354508b41552ce2159b1203db123916ac.patch
|
||||
* fdf0932f2939696a8398b63871ccc85335274c1f.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Dec 13 05:27:15 UTC 2024 - Soc Virnyl Estela <uncomfyhalomacro@opensuse.org>
|
||||
|
||||
- Add the following patches:
|
||||
* 29329779b72cb0a7958b7491296782816de8e477.patch
|
||||
* a39b55080dcb50edc9321d38af8775af22cf852f.patch
|
||||
* d35786da4383388c19f5437128fd393a6f16f74f.patch
|
||||
- Remove _service file
|
||||
- Set source tarball to archived sources.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sat Jun 08 05:48:16 UTC 2024 - Joshua Smith <smolsheep@opensuse.org>
|
||||
|
||||
|
||||
15
lswt.spec
15
lswt.spec
@@ -23,8 +23,19 @@ Summary: Wayland toplevel lister
|
||||
License: GPL-3.0-only
|
||||
Group: System/X11/Utilities
|
||||
URL: https://git.sr.ht/~leon_plickat/lswt
|
||||
Source: %{name}-%{version}.tar.zst
|
||||
Source: https://git.sr.ht/~leon_plickat/lswt/archive/v2.0.0.tar.gz#/%{name}-%{version}.tar.gz
|
||||
Patch0: Makefile.patch
|
||||
Patch1: https://git.sr.ht/~leon_plickat/lswt/commit/ea45c1a8cf66d102e6525d29b03126693949e562.patch
|
||||
Patch2: https://git.sr.ht/~leon_plickat/lswt/commit/c1ea4ee2a6e4a4e579a17f1e15351f225cb23a1d.patch
|
||||
Patch3: https://git.sr.ht/~leon_plickat/lswt/commit/8d76a317ad2da073a638d72eac8a24df33ae01f1.patch
|
||||
Patch4: https://git.sr.ht/~leon_plickat/lswt/commit/fdf0932f2939696a8398b63871ccc85335274c1f.patch
|
||||
Patch5: https://git.sr.ht/~leon_plickat/lswt/commit/fbb7be4354508b41552ce2159b1203db123916ac.patch
|
||||
Patch6: https://git.sr.ht/~leon_plickat/lswt/commit/e4ebefcb30053a990cb821a75c4e1310fc967673.patch
|
||||
Patch7: https://git.sr.ht/~leon_plickat/lswt/commit/55a29650a110928cb7ad612182c8096424ebb70a.patch
|
||||
Patch8: https://git.sr.ht/~leon_plickat/lswt/commit/ade15dbc3d11325a2569a0efd543d43a3ecb3547.patch
|
||||
Patch9: https://git.sr.ht/~leon_plickat/lswt/commit/d35786da4383388c19f5437128fd393a6f16f74f.patch
|
||||
Patch10: https://git.sr.ht/~leon_plickat/lswt/commit/29329779b72cb0a7958b7491296782816de8e477.patch
|
||||
Patch11: https://git.sr.ht/~leon_plickat/lswt/commit/a39b55080dcb50edc9321d38af8775af22cf852f.patch
|
||||
BuildRequires: scdoc >= 1.9.2
|
||||
BuildRequires: pkgconfig(wayland-client)
|
||||
|
||||
@@ -35,7 +46,7 @@ Requires the Wayland server to implement the foreign-toplevel-management-unstabl
|
||||
protocol extension.
|
||||
|
||||
%prep
|
||||
%autosetup
|
||||
%autosetup -n %{name}-v%{version} -p1
|
||||
|
||||
%build
|
||||
%make_build
|
||||
|
||||
Reference in New Issue
Block a user