Skip to content

Commit

Permalink
Merge commit '49f27df' into HEAD
Browse files Browse the repository at this point in the history
  • Loading branch information
WingsZeng committed Jun 1, 2024
2 parents ab05533 + 49f27df commit 35da5a1
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 11 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,6 @@ hyprland/

# Misc
compile_commands.json

# meson
build/
11 changes: 0 additions & 11 deletions Makefile

This file was deleted.

63 changes: 63 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
project(
'hyprfocus',
'cpp',
default_options: ['buildtype=release'],
)

cpp_compiler = meson.get_compiler('cpp')
if cpp_compiler.has_argument('-std=c++23')
add_global_arguments('-std=c++23', language: 'cpp')
elif cpp_compiler.has_argument('-std=c++2b')
add_global_arguments('-std=c++2b', language: 'cpp')
else
error(
'Could not configure current C++ compiler ('
+ cpp_compiler.get_id()
+ ' '
+ cpp_compiler.version()
+ ') with required C++ standard (C++23)',
)
endif

add_project_arguments(
'-fPIC',
'--no-gnu-unique',
language: 'cpp',
)

src = [
'src/main.cpp',
'src/IFocusAnimation.cpp',
]

flash = get_option('flash')
shrink = get_option('shrink')

if flash.disabled() and shrink.disabled()
error('You must enable at least one feature: flash or shrink')
endif

if not flash.disabled()
src += 'src/Flash.cpp'
add_project_arguments('-DFLASH', language: 'cpp')
endif

if not shrink.disabled()
src += 'src/Shrink.cpp'
add_project_arguments('-DSHRINK', language: 'cpp')
endif

if get_option('xwayland').disabled()
add_project_arguments('-DNO_XWAYLAND', language: 'cpp')
endif

shared_module(
meson.project_name(),
src,
dependencies: [
dependency('hyprland', version: '>=0.40'),
dependency('pixman-1'),
dependency('libdrm'),
],
install: true,
)
3 changes: 3 additions & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
option('flash', type: 'feature', value: 'auto', description: 'Enable flash')
option('shrink', type: 'feature', value: 'auto', description: 'Enable shrink')
option('xwayland', type: 'feature', value: 'auto', description: 'Enable support for X11 applications')
4 changes: 4 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,12 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
Hyprlang::STRING("flash"));
HyprlandAPI::addDispatcher(PHANDLE, "animatefocused", &flashCurrentWindow);

#ifdef FLASH
g_mAnimations["flash"] = std::make_unique<CFlash>();
#endif
#ifdef SHRINK
g_mAnimations["shrink"] = std::make_unique<CShrink>();
#endif
g_mAnimations["none"] = std::make_unique<IFocusAnimation>();

for (auto &[name, pAnimation] : g_mAnimations) {
Expand Down

0 comments on commit 35da5a1

Please sign in to comment.