Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
03d8a51
Detect Gnome and the presence of the app indicator extention to condi…
mominul Apr 15, 2025
e440cce
Implement Gnome Input sources configuration
mominul Apr 15, 2025
e3cb013
Package the ibus and fcitx backends together
mominul Apr 16, 2025
c24bc55
Merge branch 'develop' into auto_config
mominul Apr 19, 2025
0d806d5
Merge branch 'develop' into ibus_fcitx_merged
mominul Apr 19, 2025
4b690ef
Support Ubuntu flavoured appindicator extension
mominul Apr 19, 2025
010f8cb
Change package name
mominul Apr 19, 2025
54cb627
Fix pkg name in build script
mominul Apr 19, 2025
4727f8d
Forgot to add both subdirectories for ENABLE_BOTH
mominul Apr 19, 2025
9ebf77f
Merge branch 'develop' into auto_config
mominul Jul 5, 2025
08dd63b
Merge branch 'ibus_fcitx_merged' into auto_config
mominul Feb 4, 2026
488dce3
Merge branch 'develop' into auto_config
mominul Feb 4, 2026
c44c64b
macOS platform specific Swift code integration support
mominul Feb 4, 2026
efa4389
Initial auto-config on macOS
mominul Feb 6, 2026
e829d86
Fix code signature invalidation during packaging
mominul Feb 6, 2026
f964fe4
Conditional dependencies for deb and rpm packages
mominul Feb 14, 2026
872a8b5
fix build
mominul Feb 14, 2026
4b6fc0e
Fix build
mominul Feb 14, 2026
d4ee4ad
test pkg build
mominul Feb 14, 2026
af9d2c4
pkg+
mominul Feb 14, 2026
040008e
pkg+
mominul Feb 14, 2026
633f887
pkg+
mominul Feb 14, 2026
df94cc8
pkg+
mominul Feb 14, 2026
7a6ea32
pkg+
mominul Feb 14, 2026
ce8b378
pkg+
mominul Feb 14, 2026
c6a16c8
Implement auto-config for KDE Fcitx
mominul Mar 6, 2026
87a60ce
Implement fcitx5 autoconfig for Deepin OS
mominul Mar 8, 2026
a0e7532
Fix autoconfig on mac
mominul Mar 23, 2026
9780087
Fix postinstall script
mominul Mar 23, 2026
1388961
Implement autoconfig for Cinnamon DE
mominul Apr 4, 2026
fc51697
Implement autoconfig for ZorinOS
mominul Apr 4, 2026
6c33a24
Implement autoconfig for Xfce DE
mominul Apr 4, 2026
bfc9408
Implement autoconfig for Mate DE
mominul Apr 4, 2026
e674304
Implement autoconfig for Budgie DE
mominul Apr 4, 2026
c361a25
Implement autoconfig for LXQt DE
mominul Apr 4, 2026
3d13a86
postinstall script for deb and rpm
mominul Apr 11, 2026
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
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
run: |
mkdir build
cd build
cmake .. -DENABLE_IBUS=ON -DENABLE_FCITX=ON
cmake .. -DENABLE_BOTH=ON
make

build-macos:
Expand All @@ -44,7 +44,7 @@ jobs:
submodules: recursive

- name: install-deps
run: brew install cmake qt@5 zstd
run: brew install cmake qt@5 zstd ninja

- name: setup-qt
run: echo "$(brew --prefix qt@5)/bin" >> $GITHUB_PATH
Expand All @@ -53,6 +53,6 @@ jobs:
run: |
mkdir build
cd build
cmake .. -DCMAKE_PREFIX_PATH="$(brew --prefix qt@5);$(brew --prefix zstd)"
make
cmake .. -DCMAKE_PREFIX_PATH="$(brew --prefix qt@5);$(brew --prefix zstd)" -GNinja
ninja

10 changes: 2 additions & 8 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,17 @@ jobs:
strategy:
matrix:
# container: [ "ubuntu:18.04", "ubuntu:20.04", "ubuntu:22.04", "ubuntu:23.04", "debian:11", "fedora:37", "fedora:38", "archlinux:latest" ]
container: [ "ubuntu:20.04", "ubuntu:22.04", "ubuntu:24.04", "debian:11", "debian:12", "fedora:40", "fedora:41", "opensuse/tumbleweed" ]
container: [ "ubuntu:22.04", "ubuntu:24.04", "debian:11", "debian:12", "fedora:40", "fedora:41", "opensuse/tumbleweed" ]
# this list should be updated from time to time by consulting these pages:
# https://releases.ubuntu.com/
# https://wiki.debian.org/DebianReleases#Production_Releases
# https://fedoraproject.org/wiki/Releases
# https://en.wikipedia.org/wiki/OpenSUSE#Version_history
ime: [ "ibus", "fcitx" ]
# Some distributions doesn't have the required version of fcitx library, so we exclude them.
exclude:
- container: "ubuntu:20.04"
ime: "fcitx"
runs-on: "ubuntu-latest"
container:
image: ${{ matrix.container }}
env:
DIST: ${{ matrix.container }}
IME: ${{ matrix.ime }}
DEBIAN_FRONTEND: noninteractive
steps:
- name: install-git
Expand Down Expand Up @@ -64,7 +58,7 @@ jobs:
- name: upload-artifacts
uses: actions/upload-artifact@v4
with:
name: pkg-${{ steps.sanitizer.outputs.sanitized_container }}-${{ matrix.ime }}
name: pkg-${{ steps.sanitizer.outputs.sanitized_container }}
path: artifact

release:
Expand Down
1 change: 1 addition & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"${workspaceRoot}"
],
"defines": [],
"compileCommands": "build/compile_commands.json",
"intelliSenseMode": "clang-x64",
"browse": {
"path": [
Expand Down
63 changes: 54 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.10)
cmake_minimum_required(VERSION 3.18...3.29)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")

file(STRINGS "${CMAKE_SOURCE_DIR}/version.txt" VERSION_STRING LIMIT_COUNT 1 REGEX "^.+")
Expand All @@ -17,6 +17,20 @@ if(NOT WIN32 AND NOT APPLE)
include(CMakeCargo)
endif()

if(APPLE)
enable_language(Swift)

if("${CMAKE_Swift_COMPILER_VERSION}" VERSION_LESS 5.9)
message(FATAL_ERROR "Bidirectional C++ Interop requires Swift 5.9 or greater. Have ${CMAKE_Swift_COMPILER_VERSION}")
endif()

# Set up swiftrt.o and runtime library search paths
include(InitializeSwift)
# cmake/modules/AddSwift.cmake provides the function for creating the Swift to
# C++ bridging header
include(AddSwift)
endif()

find_package(Qt5 COMPONENTS Widgets Network REQUIRED)

message(STATUS "Qt5 framework version: ${Qt5Core_VERSION}")
Expand Down Expand Up @@ -66,10 +80,14 @@ if(OS_LINUX)

option(ENABLE_IBUS "Enable IBus support" OFF)
option(ENABLE_FCITX "Enable Fcitx support" OFF)
option(ENABLE_BOTH "Enable both IBus and Fcitx support" OFF)

if((NOT ENABLE_IBUS) AND (NOT ENABLE_FCITX))
message(FATAL_ERROR "Please set atleast ENABLE_IBUS or ENABLE_FCITX to be ON to build a backend")
if((NOT ENABLE_IBUS) AND (NOT ENABLE_FCITX) AND (NOT ENABLE_BOTH))
message(FATAL_ERROR "Please set atleast ENABLE_IBUS or ENABLE_FCITX or ENABLE_BOTH to be ON to build a backend")
endif()

## Find zstd ##
pkg_check_modules(ZSTD REQUIRED libzstd)

## Find iBus ##
if(ENABLE_IBUS)
Expand All @@ -81,13 +99,16 @@ if(OS_LINUX)
find_package(Fcitx5Core 5.0.5 REQUIRED)
endif()

## Find zstd ##
pkg_check_modules(ZSTD REQUIRED libzstd)
if(ENABLE_BOTH)
pkg_check_modules(IBUS REQUIRED ibus-1.0)
find_package(Fcitx5Core 5.0.5 REQUIRED)
endif()
endif()

# For Windows
if(WIN32)
find_package(zstd CONFIG REQUIRED)

set(PROJECT_DATADIR "$ENV{LOCALAPPDATA}\\OpenBangla" CACHE PATH "Path to Data Directory")
set(BIN_DIR "${PROJECT_DATADIR}/bin")
add_definitions(-DPROJECT_DATADIR="${PROJECT_DATADIR}")
Expand All @@ -100,6 +121,14 @@ if(APPLE)

set(CMAKE_OSX_DEPLOYMENT_TARGET 10.15)
set(CMAKE_INSTALL_PREFIX "/")

# Determine host architectures for the .pkg installer distribution.
# Without hostArchitectures, macOS assumes x86_64 and prompts for Rosetta.
if(CMAKE_OSX_ARCHITECTURES)
string(REPLACE ";" "," CPACK_HOST_ARCHITECTURES "${CMAKE_OSX_ARCHITECTURES}")
else()
set(CPACK_HOST_ARCHITECTURES "${CMAKE_SYSTEM_PROCESSOR}")
endif()
endif()

add_subdirectory(src/engine)
Expand All @@ -124,16 +153,21 @@ set(CPACK_DEBIAN_PACKAGE_MAINTAINER "OpenBangla Team <openbanglateam@gmail.com>"
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/data/Readme.txt")
set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/data/Readme.txt")
if(APPLE)
set(CPACK_PACKAGE_NAME "OpenBangla Keyboard")
# macOS productbuild requires license files with .txt, .rtf, .rtfd, or .html extension
configure_file("${CMAKE_SOURCE_DIR}/LICENSE" "${CMAKE_BINARY_DIR}/LICENSE.txt" COPYONLY)
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_BINARY_DIR}/LICENSE.txt")
else()
set(CPACK_PACKAGE_NAME "openbangla-keyboard")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE")

# Stripping on macOS invalidates ad-hoc code signatures, causing
# installed apps to be killed by the system.
set(CPACK_STRIP_FILES TRUE)
endif()
set(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}")
set(CPACK_STRIP_FILES TRUE)
set(CPACK_PRODUCTBUILD_IDENTITY_NAME "" CACHE STRING "Code signing identity for productbuild")
set(CPACK_PRODUCTBUILD_KEYCHAIN_PATH "" CACHE STRING "Keychain path for code signing")
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://openbangla.org/")
Expand All @@ -142,6 +176,9 @@ set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
set(CPACK_RPM_PACKAGE_LICENSE "GPLv3")
set(CPACK_RPM_PACKAGE_URL "https://openbangla.org/")
set(CPACK_RPM_PACKAGE_RELEASE_DIST ON)
configure_file("${CMAKE_SOURCE_DIR}/data/linux/postinst.in" "${CMAKE_BINARY_DIR}/postinst" @ONLY)
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_BINARY_DIR}/postinst")
set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${CMAKE_BINARY_DIR}/postinst")
# Prevents CPack from generating file conflicts
set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/usr/share/applications" "/usr/share/metainfo" "/usr/share/pixmaps"
"/usr/share/icons" "/usr/share/icons/hicolor"
Expand All @@ -155,18 +192,24 @@ set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}_${PROJECT_VERSION}-$ENV{DIST}
# Configure CPack on the basis of which backend we are building for.
if(ENABLE_IBUS)
## IBUS
set(CPACK_PACKAGE_NAME "ibus-openbangla")
# set(CPACK_PACKAGE_NAME "ibus-openbangla")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "ibus (>= 1.5.1)")
set(CPACK_RPM_PACKAGE_REQUIRES "qt5-qtbase >= 5.9.0, ibus >= 1.5.1, ibus-libs >= 1.5.1, libzstd >= 1.3.3")
list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/usr/share/ibus" "/usr/share/ibus/component")
elseif(ENABLE_FCITX)
## FCITX
set(CPACK_PACKAGE_NAME "fcitx-openbangla")
# set(CPACK_PACKAGE_NAME "fcitx-openbangla")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "fcitx5 (>= 5.0.5)")
set(CPACK_RPM_PACKAGE_REQUIRES "qt5-qtbase >= 5.9.0, libzstd >= 1.3.3, fcitx5 >= 5.0.5")
list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/usr/lib64/fcitx5" "/usr/share/fcitx5" "/usr/share/fcitx5/inputmethod" "/usr/share/fcitx5/addon")
elseif(ENABLE_BOTH)
set(CPACK_DEBIAN_PACKAGE_DEPENDS "fcitx5 (>= 5.0.5) | ibus (>= 1.5.1)")
set(CPACK_RPM_PACKAGE_REQUIRES
"(ibus >= 1.5.1 if gnome-shell else fcitx5 >= 5.0.5), (gnome-shell-extension-appindicator if gnome-shell), qt5-qtbase >= 5.15.0, libzstd >= 1.3.3"
)
list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/usr/share/ibus" "/usr/share/ibus/component" "/usr/lib64/fcitx5"
"/usr/share/fcitx5" "/usr/share/fcitx5/inputmethod" "/usr/share/fcitx5/addon")
elseif(APPLE)
set(CPACK_PACKAGE_NAME "OpenBangla Keyboard")
set(CPACK_PACKAGE_VENDOR "OpenBangla")
set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}")
set(CPACK_PACKAGE_FILE_NAME "OpenBangla-Keyboard-${PROJECT_VERSION}")
Expand All @@ -175,7 +218,9 @@ elseif(APPLE)
set(CPACK_COMPONENTS_ALL IME GUI)
set(CPACK_COMPONENT_IME_REQUIRED TRUE)
set(CPACK_COMPONENT_GUI_REQUIRED TRUE)
set(CPACK_COMPONENT_GUI_DEPENDS IME)
set(CPACK_COMPONENT_UNSPECIFIED_REQUIRED "FALSE")
set(CPACK_POSTFLIGHT_GUI_SCRIPT "${CMAKE_SOURCE_DIR}/data/productbuild/postinstall")
set(CPACK_PRODUCTBUILD_RESOURCES_DIR "${CMAKE_SOURCE_DIR}/data/productbuild")
set(CPACK_PRODUCTBUILD_BACKGROUND "installer.png")
set(CPACK_PRODUCTBUILD_BACKGROUND_ALIGNMENT "left")
Expand Down
78 changes: 78 additions & 0 deletions cmake/AddSwift.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# This source file is part of the Swift open source project
#
# Copyright (c) 2023 Apple Inc. and the Swift project authors.
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.txt for license information


# Generate the bridging header from Swift to C++
#
# target: the name of the target to generate headers for.
# This target must build swift source files.
# header: the name of the header file to generate.
#
# NOTE: This logic will eventually be unstreamed into CMake.
function(_swift_generate_cxx_header target header)
if(NOT TARGET ${target})
message(FATAL_ERROR "Target ${target} not defined.")
endif()

if(NOT DEFINED CMAKE_Swift_COMPILER)
message(WARNING "Swift not enabled in project. Cannot generate headers for Swift files.")
return()
endif()

cmake_parse_arguments(ARG "" "" "SEARCH_PATHS;MODULE_NAME" ${ARGN})

if(NOT ARG_MODULE_NAME)
set(target_module_name $<TARGET_PROPERTY:${target},Swift_MODULE_NAME>)
set(ARG_MODULE_NAME $<IF:$<BOOL:${target_module_name}>,${target_module_name},${target}>)
endif()

if(ARG_SEARCH_PATHS)
list(TRANSFORM ARG_SEARCH_PATHS PREPEND "-I")
endif()

if(APPLE AND CMAKE_OSX_SYSROOT)
set(SDK_FLAGS "-sdk" "${CMAKE_OSX_SYSROOT}")
elseif(WIN32)
set(SDK_FLAGS "-sdk" "$ENV{SDKROOT}")
elseif(CMAKE_SYSROOT)
set(SDK_FLAGS "-sdk" "${CMAKE_SYSROOT}")
endif()

cmake_path(APPEND CMAKE_CURRENT_BINARY_DIR include
OUTPUT_VARIABLE base_path)

cmake_path(APPEND base_path ${header}
OUTPUT_VARIABLE header_path)

cmake_path(APPEND CMAKE_CURRENT_BINARY_DIR "${ARG_MODULE_NAME}.emit-module.d" OUTPUT_VARIABLE depfile_path)

set(_AllSources $<PATH:ABSOLUTE_PATH,$<TARGET_PROPERTY:${target},SOURCES>,${CMAKE_CURRENT_SOURCE_DIR}>)
set(_SwiftSources $<FILTER:${_AllSources},INCLUDE,\\.swift$>)
add_custom_command(OUTPUT ${header_path}
DEPENDS ${_SwiftSources}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND
${CMAKE_Swift_COMPILER} -typecheck
${ARG_SEARCH_PATHS}
${_SwiftSources}
${SDK_FLAGS}
-module-name "${ARG_MODULE_NAME}"
-cxx-interoperability-mode=default
-emit-clang-header-path ${header_path}
-emit-dependencies
DEPFILE "${depfile_path}"
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT
"Generating '${header_path}'"
COMMAND_EXPAND_LISTS)

# Added to public interface for dependees to find.
target_include_directories(${target} PUBLIC ${base_path})
# Added to the target to ensure target rebuilds if header changes and is used
# by sources in the target.
target_sources(${target} PRIVATE ${header_path})
endfunction()
24 changes: 24 additions & 0 deletions cmake/CPack.distribution.dist.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<installer-gui-script minSpecVersion="1.0">
<title>@CPACK_PACKAGE_NAME@</title>
<welcome file="@CPACK_RESOURCE_FILE_WELCOME_NOPATH@"/>
<readme file="@CPACK_RESOURCE_FILE_README_NOPATH@"/>
<license file="@CPACK_RESOURCE_FILE_LICENSE_NOPATH@"/>

<options allow-external-scripts="no" customize="allow" hostArchitectures="@CPACK_HOST_ARCHITECTURES@"/>
<domains enable_anywhere="true" enable_currentUserHome="false" enable_localSystem="true"/>
<choices-outline>
<line choice="GUIChoice"></line>
<line choice="IMEChoice"></line>
</choices-outline>
<choice id="GUIChoice" title="GUI" start_selected="true" start_enabled="false" start_visible="true" selected="my.choice.selected &amp;&amp; choices[&apos;IMEChoice&apos;].selected">
<pkg-ref id="com.@CPACK_PACKAGE_VENDOR@.@CPACK_PACKAGE_NAME@.GUI"/>
</choice>
<pkg-ref id="com.@CPACK_PACKAGE_VENDOR@.@CPACK_PACKAGE_NAME@.GUI" version="@CPACK_PACKAGE_VERSION@" onConclusion="None">file:./Contents/Packages/@CPACK_PACKAGE_FILE_NAME@-GUI.pkg</pkg-ref>
<choice id="IMEChoice" title="IME" start_selected="true" start_enabled="false" start_visible="true" selected="my.choice.selected || choices[&apos;GUIChoice&apos;].selected">
<pkg-ref id="com.@CPACK_PACKAGE_VENDOR@.@CPACK_PACKAGE_NAME@.IME"/>
</choice>
<pkg-ref id="com.@CPACK_PACKAGE_VENDOR@.@CPACK_PACKAGE_NAME@.IME" version="@CPACK_PACKAGE_VERSION@" onConclusion="None">file:./Contents/Packages/@CPACK_PACKAGE_FILE_NAME@-IME.pkg</pkg-ref>
<background file="installer.png" alignment="left"/>
<background-darkAqua file="installer.png" alignment="left"/>
</installer-gui-script>
Loading
Loading