diff options
-rw-r--r-- | meson.build | 9 | ||||
-rw-r--r-- | security.d/00-defaults.in | 6 | ||||
-rw-r--r-- | sway/commands/exec_always.c | 38 | ||||
-rw-r--r-- | swaybar/meson.build | 3 | ||||
-rw-r--r-- | swaybg/meson.build | 3 |
5 files changed, 5 insertions, 54 deletions
diff --git a/meson.build b/meson.build index e40dc33c..bf266e5f 100644 --- a/meson.build +++ b/meson.build | |||
@@ -19,14 +19,6 @@ is_freebsd = host_machine.system().startswith('freebsd') | |||
19 | datadir = get_option('datadir') | 19 | datadir = get_option('datadir') |
20 | sysconfdir = get_option('sysconfdir') | 20 | sysconfdir = get_option('sysconfdir') |
21 | prefix = get_option('prefix') | 21 | prefix = get_option('prefix') |
22 | libexecdir = get_option('libexecdir') | ||
23 | |||
24 | if libexecdir == '' | ||
25 | libexecdir = 'lib' | ||
26 | endif | ||
27 | sway_libexecdir = join_paths(prefix, libexecdir, 'sway') | ||
28 | add_project_arguments('-DSWAY_LIBEXECDIR="/@0@"'.format(sway_libexecdir), language : 'c') | ||
29 | |||
30 | 22 | ||
31 | jsonc = dependency('json-c', version: '>=0.13') | 23 | jsonc = dependency('json-c', version: '>=0.13') |
32 | pcre = dependency('libpcre') | 24 | pcre = dependency('libpcre') |
@@ -121,7 +113,6 @@ config = configuration_data() | |||
121 | config.set('sysconfdir', join_paths(prefix, sysconfdir)) | 113 | config.set('sysconfdir', join_paths(prefix, sysconfdir)) |
122 | config.set('datadir', join_paths(prefix, datadir)) | 114 | config.set('datadir', join_paths(prefix, datadir)) |
123 | config.set('prefix', prefix) | 115 | config.set('prefix', prefix) |
124 | config.set('sway_libexecdir', sway_libexecdir) | ||
125 | 116 | ||
126 | configure_file( | 117 | configure_file( |
127 | configuration: config, | 118 | configuration: config, |
diff --git a/security.d/00-defaults.in b/security.d/00-defaults.in index b5ae1149..e4626477 100644 --- a/security.d/00-defaults.in +++ b/security.d/00-defaults.in | |||
@@ -11,9 +11,9 @@ | |||
11 | # Configures enabled compositor features for specific programs | 11 | # Configures enabled compositor features for specific programs |
12 | permit * fullscreen keyboard mouse | 12 | permit * fullscreen keyboard mouse |
13 | permit @prefix@/bin/swaylock lock | 13 | permit @prefix@/bin/swaylock lock |
14 | permit @prefix@/bin/swaybg background | ||
14 | permit @prefix@/bin/swaygrab screenshot | 15 | permit @prefix@/bin/swaygrab screenshot |
15 | permit @sway_libexecdir@/swaybg background | 16 | permit @prefix@/bin/swaybar panel |
16 | permit @sway_libexecdir@/swaybar panel | ||
17 | 17 | ||
18 | # Configures enabled IPC features for specific programs | 18 | # Configures enabled IPC features for specific programs |
19 | ipc @prefix@/bin/swaymsg { | 19 | ipc @prefix@/bin/swaymsg { |
@@ -24,7 +24,7 @@ ipc @prefix@/bin/swaymsg { | |||
24 | } | 24 | } |
25 | } | 25 | } |
26 | 26 | ||
27 | ipc @sway_libexecdir@/swaybar { | 27 | ipc @prefix@/bin/swaybar { |
28 | bar-config enabled | 28 | bar-config enabled |
29 | outputs enabled | 29 | outputs enabled |
30 | workspaces enabled | 30 | workspaces enabled |
diff --git a/sway/commands/exec_always.c b/sway/commands/exec_always.c index f631d7d8..af4e4965 100644 --- a/sway/commands/exec_always.c +++ b/sway/commands/exec_always.c | |||
@@ -11,7 +11,6 @@ | |||
11 | #include "log.h" | 11 | #include "log.h" |
12 | #include "stringop.h" | 12 | #include "stringop.h" |
13 | 13 | ||
14 | |||
15 | struct cmd_results *cmd_exec_always(int argc, char **argv) { | 14 | struct cmd_results *cmd_exec_always(int argc, char **argv) { |
16 | struct cmd_results *error = NULL; | 15 | struct cmd_results *error = NULL; |
17 | if (!config->active) return cmd_results_new(CMD_DEFER, NULL, NULL); | 16 | if (!config->active) return cmd_results_new(CMD_DEFER, NULL, NULL); |
@@ -52,44 +51,7 @@ struct cmd_results *cmd_exec_always(int argc, char **argv) { | |||
52 | if ((pid = fork()) == 0) { | 51 | if ((pid = fork()) == 0) { |
53 | // Fork child process again | 52 | // Fork child process again |
54 | setsid(); | 53 | setsid(); |
55 | |||
56 | if ((*child = fork()) == 0) { | 54 | if ((*child = fork()) == 0) { |
57 | // Acquire the current PATH | ||
58 | char *path = getenv("PATH"); | ||
59 | const char *extra_path = ":" SWAY_LIBEXECDIR; | ||
60 | const size_t extra_size = sizeof(SWAY_LIBEXECDIR) + 1; | ||
61 | |||
62 | if (!path) { | ||
63 | size_t n = confstr(_CS_PATH, NULL, 0); | ||
64 | path = malloc(n + extra_size); | ||
65 | if (!path) { | ||
66 | wlr_log(L_ERROR, "exec_always: Unable to allocate PATH"); | ||
67 | exit(EXIT_FAILURE); | ||
68 | } | ||
69 | confstr(_CS_PATH, path, n); | ||
70 | |||
71 | } else { | ||
72 | size_t n = strlen(path) + 1; | ||
73 | char *tmp = malloc(n + extra_size); | ||
74 | if (!tmp) { | ||
75 | wlr_log(L_ERROR, "exec_always: Unable to allocate PATH"); | ||
76 | exit(EXIT_FAILURE); | ||
77 | } | ||
78 | |||
79 | strncpy(tmp, path, n); | ||
80 | path = tmp; | ||
81 | } | ||
82 | |||
83 | // Append /usr/lib/sway to PATH | ||
84 | strcat(path, extra_path); | ||
85 | if (setenv("PATH", path, 1) == -1) { | ||
86 | free(path); | ||
87 | wlr_log(L_ERROR, "exec_always: Unable to set PATH"); | ||
88 | exit(EXIT_FAILURE); | ||
89 | } | ||
90 | free(path); | ||
91 | |||
92 | // Execute the command | ||
93 | execl("/bin/sh", "/bin/sh", "-c", cmd, (void *)NULL); | 55 | execl("/bin/sh", "/bin/sh", "-c", cmd, (void *)NULL); |
94 | // Not reached | 56 | // Not reached |
95 | } | 57 | } |
diff --git a/swaybar/meson.build b/swaybar/meson.build index 41c81a88..d65edb11 100644 --- a/swaybar/meson.build +++ b/swaybar/meson.build | |||
@@ -24,6 +24,5 @@ executable( | |||
24 | wlroots, | 24 | wlroots, |
25 | ], | 25 | ], |
26 | link_with: [lib_sway_common, lib_sway_client], | 26 | link_with: [lib_sway_common, lib_sway_client], |
27 | install: true, | 27 | install: true |
28 | install_dir: sway_libexecdir | ||
29 | ) | 28 | ) |
diff --git a/swaybg/meson.build b/swaybg/meson.build index 716178d2..8704de6d 100644 --- a/swaybg/meson.build +++ b/swaybg/meson.build | |||
@@ -14,6 +14,5 @@ executable( | |||
14 | wlroots, | 14 | wlroots, |
15 | ], | 15 | ], |
16 | link_with: [lib_sway_common, lib_sway_client], | 16 | link_with: [lib_sway_common, lib_sway_client], |
17 | install: true, | 17 | install: true |
18 | install_dir: sway_libexecdir | ||
19 | ) | 18 | ) |