mirror of
https://github.com/scorpion-26/gBar.git
synced 2024-11-23 11:42:51 +00:00
Add meson option to not link with LibSass
This commit is contained in:
parent
e58d51d140
commit
b9ab546c4f
3 changed files with 14 additions and 3 deletions
|
@ -37,8 +37,6 @@ gtk_layer_shell = dependency('gtk-layer-shell-0')
|
||||||
|
|
||||||
pulse = dependency('libpulse')
|
pulse = dependency('libpulse')
|
||||||
|
|
||||||
sass = dependency('libsass')
|
|
||||||
|
|
||||||
|
|
||||||
headers = [
|
headers = [
|
||||||
'src/Common.h',
|
'src/Common.h',
|
||||||
|
@ -72,7 +70,7 @@ sources = [
|
||||||
'src/SNI.cpp',
|
'src/SNI.cpp',
|
||||||
]
|
]
|
||||||
|
|
||||||
dependencies = [gtk, gtk_layer_shell, pulse, wayland_client, sass]
|
dependencies = [gtk, gtk_layer_shell, pulse, wayland_client]
|
||||||
|
|
||||||
if get_option('WithHyprland')
|
if get_option('WithHyprland')
|
||||||
add_global_arguments('-DWITH_HYPRLAND', language: 'cpp')
|
add_global_arguments('-DWITH_HYPRLAND', language: 'cpp')
|
||||||
|
@ -82,6 +80,10 @@ if get_option('WithWorkspaces')
|
||||||
add_global_arguments('-DWITH_WORKSPACES', language: 'cpp')
|
add_global_arguments('-DWITH_WORKSPACES', language: 'cpp')
|
||||||
headers += 'src/Workspaces.h'
|
headers += 'src/Workspaces.h'
|
||||||
endif
|
endif
|
||||||
|
if get_option('WithLibSass')
|
||||||
|
add_global_arguments('-DWITH_LIBSASS', language: 'cpp')
|
||||||
|
dependencies += dependency('libsass')
|
||||||
|
endif
|
||||||
if get_option('WithNvidia')
|
if get_option('WithNvidia')
|
||||||
add_global_arguments('-DWITH_NVIDIA', language: 'cpp')
|
add_global_arguments('-DWITH_NVIDIA', language: 'cpp')
|
||||||
headers += 'src/NvidiaGPU.h'
|
headers += 'src/NvidiaGPU.h'
|
||||||
|
|
|
@ -4,6 +4,9 @@ option('WithHyprland', type: 'boolean', value : true)
|
||||||
# Workspaces general, enables Wayland protocol
|
# Workspaces general, enables Wayland protocol
|
||||||
option('WithWorkspaces', type: 'boolean', value : true)
|
option('WithWorkspaces', type: 'boolean', value : true)
|
||||||
|
|
||||||
|
# Support for loading SCSS directly
|
||||||
|
option('WithLibSass', type: 'boolean', value : true)
|
||||||
|
|
||||||
# Tray icons
|
# Tray icons
|
||||||
option('WithSNI', type: 'boolean', value : true)
|
option('WithSNI', type: 'boolean', value : true)
|
||||||
|
|
||||||
|
|
|
@ -5,12 +5,15 @@
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
|
#ifdef WITH_LIBSASS
|
||||||
#include <sass.h>
|
#include <sass.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace CSS
|
namespace CSS
|
||||||
{
|
{
|
||||||
static GtkCssProvider* sProvider;
|
static GtkCssProvider* sProvider;
|
||||||
|
|
||||||
|
#ifdef WITH_LIBSASS
|
||||||
bool CompileAndLoadSCSS(const std::string& scssFile)
|
bool CompileAndLoadSCSS(const std::string& scssFile)
|
||||||
{
|
{
|
||||||
if (!std::ifstream(scssFile).is_open())
|
if (!std::ifstream(scssFile).is_open())
|
||||||
|
@ -43,6 +46,7 @@ namespace CSS
|
||||||
sass_delete_file_context(ctx);
|
sass_delete_file_context(ctx);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
bool LoadCSS(const std::string& cssFile)
|
bool LoadCSS(const std::string& cssFile)
|
||||||
{
|
{
|
||||||
|
@ -112,6 +116,7 @@ namespace CSS
|
||||||
|
|
||||||
for (auto& dir : locations)
|
for (auto& dir : locations)
|
||||||
{
|
{
|
||||||
|
#ifdef WITH_LIBSASS
|
||||||
if (!Config::Get().forceCSS)
|
if (!Config::Get().forceCSS)
|
||||||
{
|
{
|
||||||
if (CompileAndLoadSCSS(dir + "/style.scss"))
|
if (CompileAndLoadSCSS(dir + "/style.scss"))
|
||||||
|
@ -124,6 +129,7 @@ namespace CSS
|
||||||
LOG("Warning: Failed loading SCSS, falling back to CSS!");
|
LOG("Warning: Failed loading SCSS, falling back to CSS!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (LoadCSS(dir + "/style.css"))
|
if (LoadCSS(dir + "/style.css"))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue