Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/v1.10 port #34

Open
wants to merge 10 commits into
base: upstream/v1.10
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
931 changes: 931 additions & 0 deletions debian/changelog

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions debian/config.d/50-systemd-user.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# import variables into system-user enviroment
# based on the instructions in the sway wiki
# see also https://github.com/swaywm/sway/issues/5732
# and https://github.com/systemd/systemd/blob/dfc637d0ff756889e8e5b7cb4ec991eb06069aa1/xorg/50-systemd-user.sh

exec systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK

exec hash dbus-update-activation-environment 2>/dev/null && \
dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK
49 changes: 49 additions & 0 deletions debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
Source: sway-regolith
Section: x11
Priority: optional
Maintainer: Soumya Ranjan Patnaik <[email protected]>
Build-Depends: debhelper-compat (= 13),
libcairo2-dev,
libcap-dev,
libdbus-1-dev (>= 1.10),
libevdev-dev,
libgdk-pixbuf-2.0-dev,
libinput-dev (>= 1.6.0),
libjson-c-dev (>= 0.13),
libpam0g-dev,
libpango1.0-dev,
libpcre2-dev,
libpixman-1-dev,
libseat-dev,
libsystemd-dev (>= 239) | libelogind-dev (>= 239),
libtrawldb,
libwayland-dev (>= 1.20.0),
libwayland-egl1,
libwlroots-0.18-dev,
libxkbcommon-dev,
meson (>=0.48),
pkgconf,
scdoc (>= 1.9.2),
tree,
wayland-protocols (>= 1.24)
Standards-Version: 4.6.1.0
Rules-Requires-Root: no

Package: sway-regolith
Architecture: any
Depends: libgl1-mesa-dri,
libtrawldb,
polkitd,
swaybg,
${misc:Depends},
${shlibs:Depends}
Suggests: xdg-desktop-portal-wlr
Provides: sway
Conflicts: sway
Replaces: sway
Description: i3-compatible Wayland compositor for the Regolith desktop environment
sway (SirCmpwn's Wayland compositor) is a tiling Wayland compositor and a
drop-in replacement for the i3 window manager for X11. It works with your
existing i3 configuration and supports most of i3's features, plus a few
extras. This means it is a minimalist, tiling window manager. This variant
supports trawl integration.
83 changes: 83 additions & 0 deletions debian/copyright
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Source: https://github.com/swaywm/sway

Files: *
Copyright: © 2016-2018 Drew DeVault <[email protected]>
License: Expat

Files: protocols/wlr-layer-shell-unstable-v1.xml
Copyright: © 2017 Drew DeVault
License: MIT-like

Files: protocols/wlr-input-inhibitor-unstable-v1.xml
Copyright: © 2018 Drew DeVault
License: MIT-like

Files: protocols/idle.xml
Copyright: (C) 2015 Martin Gräßlin
License: LGPL-2.1+

Files: protocols/wlr-output-power-management-unstable-v1.xml
Copyright: (C) 2019 Purism SPC
License: Expat

Files: debian/*
Copyright: © 2018 Nicolas Braud-Santoni <[email protected]>
© 2018-2022 Birger Schacht <[email protected]>
License: Expat

License: LGPL-2.1+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1, or (at your option)
any later version.
.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
.
You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
.
On Debian systems, the complete text of the GNU Lesser General Public
License version 2.1 can be found in ‘/usr/share/common-licenses/LGPL-2.1’.

License: Expat
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

License: MIT-like
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that the
above copyright notice appear in all copies and that both that copyright notice
and this permission notice appear in supporting documentation, and that the
name of the copyright holders not be used in advertising or publicity
pertaining to distribution of the software without specific, written prior
permission. The copyright holders make no representations about the suitability
of this software for any purpose. It is provided "as is" without express or
implied warranty.
.
THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
2 changes: 2 additions & 0 deletions debian/gbp.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[DEFAULT]
debian-branch = master
152 changes: 152 additions & 0 deletions debian/patches/01-regolith-trawl.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
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.10.1',
license: 'MIT',
@@ -80,6 +80,7 @@ math = cc.find_library('m')
rt = cc.find_library('rt')
xcb_icccm = wlroots_features['xwayland'] ? dependency('xcb-icccm') : null_dep
threads = dependency('threads') # for pthread_setschedparam
+trawldb = dependency('trawldb-0')

if get_option('sd-bus-provider') == 'auto'
if not get_option('tray').disabled()
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/include/sway/commands.h
===================================================================
--- sway-regolith.orig/include/sway/commands.h
+++ sway-regolith/include/sway/commands.h
@@ -173,6 +173,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/sway/commands.c
===================================================================
--- sway-regolith.orig/sway/commands.c
+++ sway-regolith/sway/commands.c
@@ -83,6 +83,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/meson.build
===================================================================
--- sway-regolith.orig/sway/meson.build
+++ sway-regolith/sway/meson.build
@@ -103,6 +103,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',
@@ -234,6 +235,7 @@ sway_deps = [
xkbcommon,
xcb,
xcb_icccm,
+ trawldb,
]

if wlroots_features['xwayland']
35 changes: 35 additions & 0 deletions debian/patches/02-version-fix.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
Index: sway-regolith/meson.build
===================================================================
--- sway-regolith.orig/meson.build
+++ sway-regolith/meson.build
@@ -157,18 +156,18 @@ endif
add_project_arguments('-DSYSCONFDIR="/@0@"'.format(join_paths(prefix, sysconfdir)), language : 'c')

version = '"@0@"'.format(meson.project_version())
-git = find_program('git', native: true, required: false)
-if git.found()
- git_commit = run_command([git, '--git-dir=.git', 'rev-parse', '--short', 'HEAD'], check: false)
- git_branch = run_command([git, '--git-dir=.git', 'rev-parse', '--abbrev-ref', 'HEAD'], check: false)
- if git_commit.returncode() == 0 and git_branch.returncode() == 0
- version = '"@0@-@1@ (" __DATE__ ", branch \'@2@\')"'.format(
- meson.project_version(),
- git_commit.stdout().strip(),
- git_branch.stdout().strip(),
- )
- endif
-endif
+# git = find_program('git', native: true, required: false)
+# if git.found()
+# git_commit = run_command([git, '--git-dir=.git', 'rev-parse', '--short', 'HEAD'], check: false)
+# git_branch = run_command([git, '--git-dir=.git', 'rev-parse', '--abbrev-ref', 'HEAD'], check: false)
+# if git_commit.returncode() == 0 and git_branch.returncode() == 0
+# version = '"@0@-@1@ (" __DATE__ ", branch \'@2@\')"'.format(
+# meson.project_version(),
+# git_commit.stdout().strip(),
+# git_branch.stdout().strip(),
+# )
+# endif
+# endif
add_project_arguments('-DSWAY_VERSION=@0@'.format(version), language: 'c')

# Compute the relative path used by compiler invocations.
Loading