mirror of
https://github.com/swaywm/sway.git
synced 2026-04-18 06:46:56 -04:00
chore: add patch for regolith customizations of sway
This commit is contained in:
parent
1339e0bbbc
commit
e89f875bac
2 changed files with 201 additions and 0 deletions
200
debian/patches/regolith-trawl.patch
vendored
Normal file
200
debian/patches/regolith-trawl.patch
vendored
Normal file
|
|
@ -0,0 +1,200 @@
|
|||
Index: sway-regolith/include/sway/commands.h
|
||||
===================================================================
|
||||
--- sway-regolith.orig/include/sway/commands.h
|
||||
+++ sway-regolith/include/sway/commands.h
|
||||
@@ -172,6 +172,7 @@ sway_cmd cmd_resize;
|
||||
sway_cmd cmd_scratchpad;
|
||||
sway_cmd cmd_seamless_mouse;
|
||||
sway_cmd cmd_set;
|
||||
+sway_cmd cmd_set_from_resource;
|
||||
sway_cmd cmd_shortcuts_inhibitor;
|
||||
sway_cmd cmd_show_marks;
|
||||
sway_cmd cmd_smart_borders;
|
||||
Index: sway-regolith/meson.build
|
||||
===================================================================
|
||||
--- sway-regolith.orig/meson.build
|
||||
+++ sway-regolith/meson.build
|
||||
@@ -1,5 +1,5 @@
|
||||
project(
|
||||
- 'sway',
|
||||
+ 'sway-regolith',
|
||||
'c',
|
||||
version: '1.9',
|
||||
license: 'MIT',
|
||||
@@ -45,6 +45,27 @@ subproject(
|
||||
version: wlroots_version,
|
||||
)
|
||||
wlroots = dependency('wlroots', version: wlroots_version)
|
||||
+xkbcommon = dependency('xkbcommon')
|
||||
+cairo = dependency('cairo')
|
||||
+pango = dependency('pango')
|
||||
+pangocairo = dependency('pangocairo')
|
||||
+gdk_pixbuf = dependency('gdk-pixbuf-2.0', required: get_option('gdk-pixbuf'))
|
||||
+pixman = dependency('pixman-1')
|
||||
+glesv2 = dependency('glesv2')
|
||||
+libevdev = dependency('libevdev')
|
||||
+libinput = dependency('libinput', version: '>=1.6.0')
|
||||
+xcb = dependency('xcb', required: get_option('xwayland'))
|
||||
+drm_full = dependency('libdrm') # only needed for drm_fourcc.h
|
||||
+drm = drm_full.partial_dependency(compile_args: true, includes: true)
|
||||
+libudev = dependency('libudev')
|
||||
+bash_comp = dependency('bash-completion', required: false)
|
||||
+fish_comp = dependency('fish', required: false)
|
||||
+math = cc.find_library('m')
|
||||
+rt = cc.find_library('rt')
|
||||
+xcb_icccm = dependency('xcb-icccm', required: get_option('xwayland'))
|
||||
+threads = dependency('threads') # for pthread_setschedparam
|
||||
+trawldb = dependency('trawldb-0')
|
||||
+
|
||||
wlroots_features = {
|
||||
'xwayland': false,
|
||||
'libinput_backend': false,
|
||||
@@ -248,7 +269,7 @@ configure_file(
|
||||
)
|
||||
|
||||
install_data(
|
||||
- 'sway.desktop',
|
||||
+ 'sway-regolith.desktop',
|
||||
install_dir: join_paths(datadir, 'wayland-sessions')
|
||||
)
|
||||
|
||||
Index: sway-regolith/sway-regolith.desktop
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ sway-regolith/sway-regolith.desktop
|
||||
@@ -0,0 +1,5 @@
|
||||
+[Desktop Entry]
|
||||
+Name=Sway Regolith
|
||||
+Comment=A sway variant with support for trawl resource manager
|
||||
+Exec=sway
|
||||
+Type=Application
|
||||
Index: sway-regolith/sway/commands.c
|
||||
===================================================================
|
||||
--- sway-regolith.orig/sway/commands.c
|
||||
+++ sway-regolith/sway/commands.c
|
||||
@@ -84,6 +84,7 @@ static const struct cmd_handler handlers
|
||||
{ "popup_during_fullscreen", cmd_popup_during_fullscreen },
|
||||
{ "seat", cmd_seat },
|
||||
{ "set", cmd_set },
|
||||
+ { "set_from_resource", cmd_set_from_resource},
|
||||
{ "show_marks", cmd_show_marks },
|
||||
{ "smart_borders", cmd_smart_borders },
|
||||
{ "smart_gaps", cmd_smart_gaps },
|
||||
@@ -279,8 +280,8 @@ list_t *execute_command(char *_exec, str
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
- // Var replacement, for all but first argument of set
|
||||
- for (int i = handler->handle == cmd_set ? 2 : 1; i < argc; ++i) {
|
||||
+ // Var replacement, for all but first argument of set and xresource
|
||||
+ for (int i = handler->handle == cmd_set || handler->handle == cmd_set_from_resource ? 2 : 1; i < argc; ++i) {
|
||||
argv[i] = do_var_replacement(argv[i]);
|
||||
}
|
||||
|
||||
@@ -392,7 +393,7 @@ struct cmd_results *config_command(char
|
||||
}
|
||||
|
||||
// Do variable replacement
|
||||
- if (handler->handle == cmd_set && argc > 1 && *argv[1] == '$') {
|
||||
+ if ((handler->handle == cmd_set || handler->handle == cmd_set_from_resource )&& argc > 1 && *argv[1] == '$') {
|
||||
// Escape the variable name so it does not get replaced by one shorter
|
||||
char *temp = calloc(1, strlen(argv[1]) + 2);
|
||||
temp[0] = '$';
|
||||
@@ -407,7 +408,7 @@ struct cmd_results *config_command(char
|
||||
free(command);
|
||||
|
||||
// Strip quotes and unescape the string
|
||||
- for (int i = handler->handle == cmd_set ? 2 : 1; i < argc; ++i) {
|
||||
+ for (int i = handler->handle == cmd_set || handler->handle == cmd_set_from_resource ? 2 : 1; i < argc; ++i) {
|
||||
if (handler->handle != cmd_exec && handler->handle != cmd_exec_always
|
||||
&& handler->handle != cmd_mode
|
||||
&& handler->handle != cmd_bindsym
|
||||
@@ -415,6 +416,7 @@ struct cmd_results *config_command(char
|
||||
&& handler->handle != cmd_bindswitch
|
||||
&& handler->handle != cmd_bindgesture
|
||||
&& handler->handle != cmd_set
|
||||
+ && handler->handle != cmd_set_from_resource
|
||||
&& handler->handle != cmd_for_window
|
||||
&& (*argv[i] == '\"' || *argv[i] == '\'')) {
|
||||
strip_quotes(argv[i]);
|
||||
Index: sway-regolith/sway/commands/set_from_resource.c
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ sway-regolith/sway/commands/set_from_resource.c
|
||||
@@ -0,0 +1,47 @@
|
||||
+#define _POSIX_C_SOURCE 200809L
|
||||
+#include "log.h"
|
||||
+#include "stringop.h"
|
||||
+#include "sway/commands.h"
|
||||
+#include "sway/config.h"
|
||||
+#include <trawldb/client_api.h>
|
||||
+#include <stdio.h>
|
||||
+#include <string.h>
|
||||
+#include <strings.h>
|
||||
+
|
||||
+struct cmd_results *cmd_set_from_resource(int argc, char **argv) {
|
||||
+ struct cmd_results *error = NULL;
|
||||
+ if ((error = checkarg(argc, "set", EXPECTED_AT_LEAST, 2))) {
|
||||
+ return error;
|
||||
+ }
|
||||
+ if (argv[0][0] != '$') {
|
||||
+ return cmd_results_new(CMD_INVALID, "variable '%s' must start with $",
|
||||
+ argv[0]);
|
||||
+ }
|
||||
+
|
||||
+ conf_client proxy = NULL;
|
||||
+ GError *err = NULL;
|
||||
+ conf_client_init(&proxy, &err);
|
||||
+
|
||||
+ char *resource_value = NULL;
|
||||
+ conf_client_get(proxy, argv[1], &resource_value, &err);
|
||||
+
|
||||
+ if (err || resource_value == NULL || strlen(resource_value) == 0) {
|
||||
+ if (argc < 3) {
|
||||
+ return cmd_results_new(CMD_FAILURE,
|
||||
+ "failed to fetch value of resource '%s' and "
|
||||
+ "fallback value not provided",
|
||||
+ argv[1]);
|
||||
+ }
|
||||
+ resource_value = join_args(argv + 2, argc - 2);
|
||||
+ }
|
||||
+ char **argv_new = calloc(argc - 1, sizeof(char *));
|
||||
+ argv_new[0] = strdup(argv[0]);
|
||||
+ for (int i = 2; i < argc; i++) {
|
||||
+ argv_new[i - 1] = argv[i];
|
||||
+ }
|
||||
+
|
||||
+ argv_new[1] = strdup(resource_value);
|
||||
+
|
||||
+ free(resource_value);
|
||||
+ return cmd_set(2, argv_new);
|
||||
+}
|
||||
Index: sway-regolith/sway/meson.build
|
||||
===================================================================
|
||||
--- sway-regolith.orig/sway/meson.build
|
||||
+++ sway-regolith/sway/meson.build
|
||||
@@ -102,6 +102,7 @@ sway_sources = files(
|
||||
'commands/seat/shortcuts_inhibitor.c',
|
||||
'commands/seat/xcursor_theme.c',
|
||||
'commands/set.c',
|
||||
+ 'commands/set_from_resource.c',
|
||||
'commands/show_marks.c',
|
||||
'commands/shortcuts_inhibitor.c',
|
||||
'commands/smart_borders.c',
|
||||
@@ -230,6 +231,7 @@ sway_deps = [
|
||||
xkbcommon,
|
||||
xcb,
|
||||
xcb_icccm,
|
||||
+ trawldb,
|
||||
]
|
||||
|
||||
if have_xwayland
|
||||
@@ -241,7 +243,7 @@ if wlroots_features['libinput_backend']
|
||||
endif
|
||||
|
||||
executable(
|
||||
- 'sway',
|
||||
+ 'sway-regolith',
|
||||
sway_sources + wl_protos_src,
|
||||
include_directories: [sway_inc],
|
||||
dependencies: sway_deps,
|
||||
1
debian/patches/series
vendored
Normal file
1
debian/patches/series
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
regolith-trawl.patch
|
||||
Loading…
Add table
Add a link
Reference in a new issue