mirror of https://github.com/fairyglade/ly.git
add wayland specifier to session names (#162)
Create a config option to force ly to add " (Wayland)" to session names, as long as those names don't already contain the string.
This commit is contained in:
parent
4882cd4548
commit
33934f3ab2
|
|
@ -83,6 +83,9 @@
|
||||||
# wayland setup command
|
# wayland setup command
|
||||||
#wayland_cmd = /etc/ly/wsetup.sh
|
#wayland_cmd = /etc/ly/wsetup.sh
|
||||||
|
|
||||||
|
# add wayland specifier to session names
|
||||||
|
#wayland_specifier = false
|
||||||
|
|
||||||
# wayland desktop environments
|
# wayland desktop environments
|
||||||
#waylandsessions = /usr/share/wayland-sessions
|
#waylandsessions = /usr/share/wayland-sessions
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -184,6 +184,7 @@ void config_load(const char *cfg_path)
|
||||||
{"term_reset_cmd", &config.term_reset_cmd, config_handle_str},
|
{"term_reset_cmd", &config.term_reset_cmd, config_handle_str},
|
||||||
{"tty", &config.tty, config_handle_u8},
|
{"tty", &config.tty, config_handle_u8},
|
||||||
{"wayland_cmd", &config.wayland_cmd, config_handle_str},
|
{"wayland_cmd", &config.wayland_cmd, config_handle_str},
|
||||||
|
{"wayland_specifier", &config.wayland_specifier, config_handle_bool},
|
||||||
{"waylandsessions", &config.waylandsessions, config_handle_str},
|
{"waylandsessions", &config.waylandsessions, config_handle_str},
|
||||||
{"x_cmd", &config.x_cmd, config_handle_str},
|
{"x_cmd", &config.x_cmd, config_handle_str},
|
||||||
{"x_cmd_setup", &config.x_cmd_setup, config_handle_str},
|
{"x_cmd_setup", &config.x_cmd_setup, config_handle_str},
|
||||||
|
|
@ -289,6 +290,7 @@ void config_defaults()
|
||||||
config.term_reset_cmd = strdup("/usr/bin/tput reset");
|
config.term_reset_cmd = strdup("/usr/bin/tput reset");
|
||||||
config.tty = 2;
|
config.tty = 2;
|
||||||
config.wayland_cmd = strdup(DATADIR "/wsetup.sh");
|
config.wayland_cmd = strdup(DATADIR "/wsetup.sh");
|
||||||
|
config.wayland_specifier = false;
|
||||||
config.waylandsessions = strdup("/usr/share/wayland-sessions");
|
config.waylandsessions = strdup("/usr/share/wayland-sessions");
|
||||||
config.x_cmd = strdup("/usr/bin/X");
|
config.x_cmd = strdup("/usr/bin/X");
|
||||||
config.x_cmd_setup = strdup(DATADIR "/xsetup.sh");
|
config.x_cmd_setup = strdup(DATADIR "/xsetup.sh");
|
||||||
|
|
|
||||||
|
|
@ -89,6 +89,7 @@ struct config
|
||||||
char* term_reset_cmd;
|
char* term_reset_cmd;
|
||||||
u8 tty;
|
u8 tty;
|
||||||
char* wayland_cmd;
|
char* wayland_cmd;
|
||||||
|
bool wayland_specifier;
|
||||||
char* waylandsessions;
|
char* waylandsessions;
|
||||||
char* x_cmd;
|
char* x_cmd;
|
||||||
char* x_cmd_setup;
|
char* x_cmd_setup;
|
||||||
|
|
|
||||||
13
src/utils.c
13
src/utils.c
|
|
@ -95,6 +95,19 @@ void desktop_crawl(
|
||||||
strncat(path, dir_info->d_name, (sizeof (path)) - 1);
|
strncat(path, dir_info->d_name, (sizeof (path)) - 1);
|
||||||
configator(&desktop_config, path);
|
configator(&desktop_config, path);
|
||||||
|
|
||||||
|
// if these are wayland sessions, add " (Wayland)" to their names,
|
||||||
|
// as long as their names don't already contain that string
|
||||||
|
if (server == DS_WAYLAND && config.wayland_specifier)
|
||||||
|
{
|
||||||
|
const char wayland_specifier[] = " (Wayland)";
|
||||||
|
if (strstr(name, wayland_specifier) == NULL)
|
||||||
|
{
|
||||||
|
name = realloc(name, (strlen(name) + sizeof(wayland_specifier) + 1));
|
||||||
|
// using strcat is safe because the string is constant
|
||||||
|
strcat(name, wayland_specifier);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ((name != NULL) && (exec != NULL))
|
if ((name != NULL) && (exec != NULL))
|
||||||
{
|
{
|
||||||
input_desktop_add(target, name, exec, server);
|
input_desktop_add(target, name, exec, server);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue