Skip to content
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
1 change: 1 addition & 0 deletions .github/workflows/build-and-test-linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ jobs:
libxft-dev \
libxinerama-dev \
libxml2-dev \
libgit2-dev \
libxmmsclient-dev \
libxnvctrl-dev \
ncurses-dev \
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build-and-test-macos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ jobs:
gettext \
gperf \
imlib2 \
libgit2 \
lcov \
librsvg \
libxfixes \
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ jobs:
libmysqlclient-dev \
libpulse-dev \
librsvg2-dev \
libgit2-dev \
libsystemd-dev \
libwayland-bin \
libwayland-dev \
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/publish-appimage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ jobs:
libimlib2-dev \
libircclient-dev \
libiw-dev \
libgit2-dev \
liblua5.3-dev \
libmicrohttpd-dev \
libmysqlclient-dev \
Expand Down
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,15 @@ set(conky_sources ${CMAKE_BINARY_DIR}/config.h ${CMAKE_BINARY_DIR}/build.h)
add_subdirectory(3rdparty)
set(conky_libs ${conky_libs} toluapp_lib_static)
set(conky_libs ${conky_libs} Vc)

set(conky_includes ${conky_includes} "${CMAKE_SOURCE_DIR}/3rdparty/Vc")

# Finally, add some code
add_subdirectory(lua)
add_subdirectory(data)
add_subdirectory(doc)

# find_package(PkgConfig REQUIRED)
# pkg_check_modules(LIBGIT2 REQUIRED IMPORTED_TARGET libgit2)
if(BUILD_EXTRAS)
add_subdirectory(extras)
endif(BUILD_EXTRAS)
Expand All @@ -74,6 +76,7 @@ if(BUILD_TESTING)
include(Catch)
endif()


add_subdirectory(src)

if(BUILD_TESTING)
Expand Down
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ RUN apt-get update \
libxdamage-dev \
libxext-dev \
libxft-dev \
libgit2-dev \
libxinerama-dev \
libxml2-dev \
libxmmsclient-dev \
Expand Down
6 changes: 6 additions & 0 deletions cmake/ConkyBuildOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,12 @@ option(BUILD_PULSEAUDIO
option(BUILD_INTEL_BACKLIGHT
"Enable support for Intel backlight" false)

option(BUILD_PRESETS "Enable theme presets support" true)

set(PRESETS_REPO_URL "https://github.com/Cetttok/testRepoForConkyThemes")

set(PRESETS_REPO_PATH "/var/lib/conky/themes")

run_dependency_checks()

message(STATUS "CMAKE_C_FLAGS: " ${CMAKE_C_FLAGS})
Expand Down
9 changes: 9 additions & 0 deletions cmake/ConkyPlatformChecks.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,14 @@ if(WANT_CURL)
set(conky_includes ${conky_includes} ${CURL_INCLUDE_DIRS})
endif(WANT_CURL)

if(BUILD_PRESETS)
find_package(PkgConfig REQUIRED)
pkg_check_modules(LIBGIT2 REQUIRED IMPORTED_TARGET libgit2)
set(conky_libs ${conky_libs} PkgConfig::LIBGIT2)
set(WANT_LIBXML2 true)
endif(BUILD_PRESETS)


if(WANT_LIBXML2)
include(FindLibXml2)

Expand Down Expand Up @@ -738,3 +746,4 @@ if(DEBUG)
OUTPUT_VARIABLE COMMIT_COUNT
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif(DEBUG)

4 changes: 3 additions & 1 deletion cmake/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
#define DEFAULT_TEXT_BUFFER_SIZE @DEFAULT_TEXT_BUFFER_SIZE@
#define MAX_NET_INTERFACES @MAX_NET_INTERFACES@
#define HTTPPORT @HTTPPORT@
#define PRESETS_REPO_URL "@PRESETS_REPO_URL@"
#define PRESETS_REPO_PATH "@PRESETS_REPO_PATH@"

#cmakedefine BUILD_I18N 1

Expand Down Expand Up @@ -55,7 +57,7 @@
#cmakedefine BUILD_MOUSE_EVENTS 1

#cmakedefine BUILD_XDAMAGE 1

#cmakedefine BUILD_PRESETS 1
#cmakedefine BUILD_XINERAMA 1

#cmakedefine BUILD_XFT 1
Expand Down
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
libxml2
llvmPackages_18.libcxx
lua5_4
libgit2
ncurses
xorg.libICE
xorg.libSM
Expand Down
2 changes: 2 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ set(conky_sources
update-cb.hh
logging.h
semaphore.hh
theme-presets-manager.hh
theme-presets-manager.cc
)

# Platform specific sources
Expand Down
23 changes: 22 additions & 1 deletion src/conky.cc
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@

#ifdef BUILD_BUILTIN_CONFIG
#include "defconfig.h"
#include "theme-presets-manager.hh"

namespace {
const char builtin_config_magic[] = "==builtin==";
Expand Down Expand Up @@ -2151,7 +2152,23 @@ inline void reset_optind() {
optind = 0;
#endif
}

bool tryToReplaceAliasToPresetPath(std::string pathToPresetsRepo, std::string urlToCloneRepo){
if (current_config.empty()){
return false;
}
advanced_git_repo_source dataSource = advanced_git_repo_source(pathToPresetsRepo/*"/var/lib/conky/themes"*/, urlToCloneRepo/*"https://github.com/Cetttok/testRepoForConkyThemes"*/);
if (!dataSource.load_themes_db()){
return false;
}
theme_presets_manager presets(&dataSource);
std::string configPath = presets.get_theme_path(current_config);
if ( configPath.empty()){
return false;
}
current_config = configPath;
NORM_ERR(("use preset theme with path " + current_config.string() ).c_str());
return true;
}
void set_current_config() {
/* load current_config, CONFIG_FILE or SYSTEM_CONFIG_FILE */
struct stat s {};
Expand All @@ -2173,6 +2190,9 @@ void set_current_config() {
current_config = SYSTEM_CONFIG_FILE;
}




/* No readable config found */
if (current_config.empty()) {
#define NOCFGFILEFOUND "no personal or system-wide config file found"
Expand Down Expand Up @@ -2210,6 +2230,7 @@ const char *getopt_string =
const struct option longopts[] = {
{"help", 0, nullptr, 'h'}, {"version", 0, nullptr, 'v'},
{"short-version", 0, nullptr, 'V'}, {"quiet", 0, nullptr, 'q'},
//{"Style", 1, nullptr, 'S'},
{"debug", 0, nullptr, 'D'}, {"config", 1, nullptr, 'c'},
#ifdef BUILD_BUILTIN_CONFIG
{"print-config", 0, nullptr, 'C'},
Expand Down
1 change: 1 addition & 0 deletions src/conky.h
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,7 @@ extern conky::simple_config_setting<bool> out_to_stdout;

void setup_inotify();
void initialisation(int argc, char **argv);
bool tryToReplaceAliasToPresetPath(std::string pathToPresetsRepo, std::string urlToCloneRepo);
void set_current_config();
void main_loop();

Expand Down
13 changes: 10 additions & 3 deletions src/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@
#include "output/x11.h"
#endif /* BUILD_X11 */

#ifdef BUILD_PRESETS
#include "theme-presets-manager.hh"
#endif

#ifdef BUILD_CURL
#include "data/network/ccurl_thread.h"
#endif /* BUILD_CURL */
Expand Down Expand Up @@ -69,6 +73,7 @@

#ifdef BUILD_OLD_CONFIG
#include "convertconf.h"

#endif /* BUILD_OLD_CONFIG */
#endif /* BUILD_BUILTIN_CONFIG */

Expand Down Expand Up @@ -255,7 +260,7 @@ static void print_help(const char *prog_name) {
" -q, --quiet quiet mode\n"
" -D, --debug increase debugging output, ie. -DD for "
"more debugging\n"
" -c, --config=FILE config file to load\n"
" -c, --config=FILE config file to load or theme preset alias\n"
#ifdef BUILD_BUILTIN_CONFIG
" -C, --print-config print the builtin default config to "
"stdout\n"
Expand Down Expand Up @@ -300,7 +305,6 @@ inline void reset_optind() {
optind = 0;
#endif
}

int main(int argc, char **argv) {
#ifdef BUILD_I18N
setlocale(LC_ALL, "");
Expand Down Expand Up @@ -338,6 +342,7 @@ int main(int argc, char **argv) {
while (1) {
int c = getopt_long(argc, argv, getopt_string, longopts, nullptr);


if (c == -1) { break; }

switch (c) {
Expand Down Expand Up @@ -392,7 +397,9 @@ int main(int argc, char **argv) {

try {
set_current_config();

#ifdef BUILD_PRESETS
tryToReplaceAliasToPresetPath(PRESETS_REPO_PATH , PRESETS_REPO_URL);
#endif
state = std::make_unique<lua::state>();

conky::export_symbols(*state);
Expand Down
Loading
Loading