Skip to content

Commit

Permalink
Cleanup build flags, global namespace and includes
Browse files Browse the repository at this point in the history
- Separated displays so they don't have to be all built even when the
  features are disabled.
- Removed weird linker magic for display init and replaced it with
  straightforward (and faster) template functions that behave the same.
  - Replaced disabled_display_output classes with log messages.
- Add explicit errors when feature dependent headers get included where
  they shouldn't.
- Use gperf to build perfect hash for color names instead of custom X11
  lookup. This should make it easier to add more color names to the list
  with no extra cost.
- Made alignment use a specific bit layout which greatly simplifies
  code.
- Switch BUILD_MOUSE_EVENTS dependency from OWN_WINDOW to BUILD_X11.
- Other minor improvements to some existing code which shouldn't affect
  behavior.
- Add documentation links to sample configs.

Signed-off-by: Tin Švagelj <tin.svagelj@live.com>
  • Loading branch information
Caellian committed Apr 19, 2024
1 parent d815f9a commit c23afeb
Show file tree
Hide file tree
Showing 41 changed files with 4,140 additions and 2,418 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ doc/*.html
Makefile
CMakeCache.txt
CMakeFiles
cmake_install.cmake
cmake_uninstall.cmake
CPackConfig.cmake
CPackSourceConfig.cmake

data/convertconf.h
data/defconfig.h
lua/libcairo-orig.c
Expand All @@ -19,6 +24,7 @@ lua/libimlib2.c
*.so
*.a
/config.h
/build.h

# Compiler cache
.cache
Expand Down
8 changes: 4 additions & 4 deletions cmake/ConkyBuildOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ dependent_option(BUILD_XSHAPE "Enable Xshape support" true
"BUILD_X11" false
"Xshape support requires X11")
dependent_option(BUILD_XINPUT "Build Xinput 2 support" true
"BUILD_X11;BUILD_MOUSE_EVENTS" false
"Xinput 2 support requires X11 and BUILD_MOUSE_EVENTS enabled")
"BUILD_X11" false
"Xinput 2 support requires X11")

# if we build with any GUI support
if(BUILD_X11)
Expand All @@ -206,8 +206,8 @@ if(BUILD_WAYLAND)
endif(BUILD_WAYLAND)

dependent_option(BUILD_MOUSE_EVENTS "Enable mouse event support" true
"BUILD_WAYLAND OR OWN_WINDOW" false
"Mouse event support requires Wayland or OWN_WINDOW enabled")
"BUILD_WAYLAND OR BUILD_X11" false
"Mouse event support requires Wayland or X11 enabled")

# Lua library options
option(BUILD_LUA_CAIRO "Build cairo bindings for Lua" false)
Expand Down
7 changes: 6 additions & 1 deletion data/conky-dfly-smp.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
--
-- For more on Lua, see:
-- https://www.lua.org/pil/contents.html
--
-- Conky Lua API: https://conky.cc/lua

-- Configuration settings: https://conky.cc/config_settings
conky.config = {
alignment = 'bottom_left',
background = false,
Expand All @@ -36,7 +39,8 @@ conky.config = {
extra_newline = false,
own_window = false,
own_window_class = 'Conky',
own_window_type = 'desktop',
own_window_type = 'normal',
own_window_hints = 'undecorated,sticky,below,skip_taskbar,skip_pager',
stippled_borders = 0,
update_interval = 3.0,
uppercase = false,
Expand All @@ -45,6 +49,7 @@ conky.config = {
show_graph_range = false
}

-- Variables: https://conky.cc/variables
conky.text = [[
$sysname $version on $machine
$hr
Expand Down
7 changes: 6 additions & 1 deletion data/conky.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
--
-- For more on Lua, see:
-- https://www.lua.org/pil/contents.html
--
-- Conky Lua API: https://conky.cc/lua

-- Configuration settings: https://conky.cc/config_settings
conky.config = {
alignment = 'top_left',
background = false,
Expand Down Expand Up @@ -39,7 +42,8 @@ conky.config = {
out_to_x = true,
own_window = true,
own_window_class = 'Conky',
own_window_type = 'desktop',
own_window_type = 'normal',
own_window_hints = 'undecorated,sticky,below,skip_taskbar,skip_pager',
show_graph_range = false,
show_graph_scale = false,
stippled_borders = 0,
Expand All @@ -49,6 +53,7 @@ conky.config = {
use_xft = true,
}

-- Variables: https://conky.cc/variables
conky.text = [[
${color grey}Info:$color ${scroll 32 Conky $conky_version - $sysname $nodename $kernel $machine}
$hr
Expand Down
4 changes: 4 additions & 0 deletions data/conky_no_x11.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
--
-- For more on Lua, see:
-- https://www.lua.org/pil/contents.html
--
-- Conky Lua API: https://conky.cc/lua

-- Configuration settings: https://conky.cc/config_settings
conky.config = {
background = false,
cpu_avg_samples = 2,
Expand All @@ -22,6 +25,7 @@ conky.config = {
use_spacer = 'none',
};

-- Variables: https://conky.cc/variables
conky.text =
[[${scroll 16 $nodename - $sysname $kernel on $machine | }
Uptime: $uptime
Expand Down
49 changes: 34 additions & 15 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,6 @@ set(conky_sources
display-console.hh
display-file.cc
display-file.hh
display-ncurses.cc
display-ncurses.hh
display-http.cc
display-http.hh
display-x11.cc
display-x11.hh
display-wayland.cc
display-wayland.hh
lua-config.cc
lua-config.hh
setting.cc
Expand All @@ -137,8 +129,6 @@ set(conky_sources
update-cb.hh
logging.h
semaphore.hh
x11-color.cc
x11-color.h
)

# Platform specific sources
Expand Down Expand Up @@ -236,23 +226,47 @@ if(BUILD_PORT_MONITORS)
set(optional_sources ${optional_sources} ${port_monitors})
endif(BUILD_PORT_MONITORS)

if(BUILD_HTTP)
set(http
display-http.cc
display-http.hh
)
set(optional_sources ${optional_sources} ${http})
endif(BUILD_HTTP)

if(BUILD_X11)
set(x11 x11.cc x11.h)
set(x11
display-x11.cc
display-x11.hh
x11-color.cc
x11-settings.cc
x11-settings.h
x11.cc
x11.h
)
set(optional_sources ${optional_sources} ${x11})
endif(BUILD_X11)

if(BUILD_GUI)
set(gui fonts.cc fonts.h gui.cc gui.h)
set(optional_sources ${optional_sources} ${gui})

if(BUILD_MOUSE_EVENTS)
if(BUILD_MOUSE_EVENTS OR BUILD_XINPUT)
set(mouse_events mouse-events.cc mouse-events.h)
set(optional_sources ${optional_sources} ${mouse_events})
endif(BUILD_MOUSE_EVENTS)
endif(BUILD_MOUSE_EVENTS OR BUILD_XINPUT)
endif(BUILD_GUI)


if(BUILD_WAYLAND)
set(wl_srcs wl.cc wl.h xdg-shell-protocol.c wlr-layer-shell-protocol.c)
set(wl_srcs
wl.cc
wl.h
display-wayland.cc
display-wayland.hh
xdg-shell-protocol.c
wlr-layer-shell-protocol.c
)
set(optional_sources ${optional_sources} ${wl_srcs})

# generate protocol implementations
Expand Down Expand Up @@ -324,7 +338,12 @@ if(BUILD_ICONV)
endif(BUILD_ICONV)

if(BUILD_NCURSES)
set(ncurses_srcs nc.cc nc.h)
set(ncurses_srcs
nc.cc
nc.h
display-ncurses.cc
display-ncurses.hh
)
set(optional_sources ${optional_sources} ${ncurses_srcs})
endif(BUILD_NCURSES)

Expand Down
Loading

0 comments on commit c23afeb

Please sign in to comment.