Skip to content
Merged
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
22 changes: 22 additions & 0 deletions .claude/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"permissions": {
"allow": [
"Bash(cmake -B build *)",
"Bash(build/copyq-tests *)",
"Bash(build/copyq *)"
]
},
"env": {
"COPYQ_SESSION_NAME": "test",
"COPYQ_SETTINGS_PATH": "build/copyq-test-conf",
"COPYQ_ITEM_DATA_PATH": "build/copyq-test-data",
"COPYQ_PLUGINS": "",
"COPYQ_DEFAULT_ICON": "1",
"COPYQ_SESSION_COLOR": "#f90",
"COPYQ_THEME_PREFIX": "$PWD/shared/themes",
"COPYQ_PASSWORD": "TEST123",
"COPYQ_LOG_LEVEL": "DEBUG",
"QT_LOGGING_RULES": "*.debug=true;qt.*.debug=false",
"QT_QPA_PLATFORM": "minimal"
}
}
12 changes: 12 additions & 0 deletions .github/workflows/build-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ env:
qt6-wayland
qt6-wayland-dev
qt6-wayland-dev-tools

libqca-qt6-dev
libqca-qt6-2
libqca-qt6-plugins

qtkeychain-qt6-dev
qt5_packages: >-
qtbase5-dev
qtbase5-dev-tools
Expand All @@ -65,6 +71,12 @@ env:
qtwayland5-dev-tools

libkf5notifications-dev

libqca-qt5-2-dev
libqca-qt5-2
libqca-qt5-2-plugins

qtkeychain-qt5-dev
# FIXME: Sending signal to client process does not cause the process
# to exit with non-zero code with GitHub Actions. Why?
COPYQ_TESTS_SKIP_SIGNAL: '1'
Expand Down
11 changes: 10 additions & 1 deletion .github/workflows/build-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ jobs:

- name: Create macOS bundle
working-directory: '${{runner.workspace}}/build/copyq/${{ matrix.cmake_preset }}'
run: cpack && mv -v copyq-*.dmg CopyQ.dmg
# Retry cpack due to frequent errors: "hdiutil: create failed - Resource busy"
run: cpack || cpack || cpack && mv -v copyq-*.dmg CopyQ.dmg

- name: Upload macOS bundle
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v4
Expand All @@ -76,3 +77,11 @@ jobs:
- name: Test
working-directory: '${{runner.workspace}}/build/copyq/${{ matrix.cmake_preset }}'
run: '${{github.workspace}}/utils/github/test-macos.sh'

- name: Upload crash reports
if: failure()
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v4
with:
name: 'crash-reports${{ matrix.bundle_suffix }}'
path: '~/Library/Logs/DiagnosticReports/*'
if-no-files-found: ignore
78 changes: 78 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
## Commands

Always use the following environment variables for all `build/copyq` and
`build/copyq-tests` commands:

export COPYQ_SESSION_NAME="test"
export COPYQ_SETTINGS_PATH="build/copyq-test-conf"
export COPYQ_ITEM_DATA_PATH="build/copyq-test-data"
export COPYQ_PLUGINS=""
export COPYQ_DEFAULT_ICON="1"
export COPYQ_SESSION_COLOR="#f90"
export COPYQ_THEME_PREFIX="$PWD/shared/themes"
export COPYQ_PASSWORD="TEST123"
export COPYQ_LOG_LEVEL="DEBUG"
export QT_LOGGING_RULES="*.debug=true;qt.*.debug=false"
export QT_QPA_PLATFORM="minimal"

Run CMake to configure build:

cmake -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
-DCMAKE_INSTALL_PREFIX=$PWD/build/install \
-DCMAKE_CXX_FLAGS="-ggdb -fdiagnostics-color" \
-DWITH_TESTS=ON \
-DPEDANTIC=ON .

Build: `cmake -B build --build`

Install: `cmake -B build --target install`

Run tests after build: `build/copyq-tests $TEST_FUNCTIONS`

Run tests for specific plugin: `build/copyq-tests PLUGINS:sync $TEST_FUNCTIONS`

List tests function names: `build/copyq-tests -functions`

List tests function names for a plugin: `build/copyq-tests PLUGINS:image -functions`

Start the server process: `build/copyq`

In case any process exits with exit code 11 (SIGSEGV) use `coredumpctl` utility
to find the root cause.

Stop the server process: `build/copyq exit`

List server and client logs (server process does not need to run): `build/copyq logs`

Run a script - requires server to be running:

build/copyq source script.js

# the above command is equivalent to
build/copyq 'source("script.js")'

Scripting API documentation is in @docs/scripting-api.rst.

Useful scripts (omit the `tab(...)` call to use the default tab):

- `tab('TAB1'); add('ITEM')` - prepend ITEM text item to the TAB1 tab
- `tab('TAB1'); size()` - item count in the TAB1 tab
- `tab('TAB1'); read(0,1,2)` - read items at indexes 0, 1 and 2 in the TAB1 tab
- `config()` - list configuration options with current value and description
- `config('check_clipboard', 'false')` - set an option

## Project structure

- @plugins - code for various plugins build as dynamic modules loaded optionally by the app
- @src - main app code
- @src/app - wrappers for QCoreApplication object
- @src/common - common functionality, client/server local socket handling, logging
- @src/gui - GUI widgets and some helper modules
- @src/item - tab and item data handling, serialization code
- @src/platform - platform-specific code
- @src/scriptable - scripting capabilities
- @src/tests - tests for the main app
- @src/ui - Qt widget definition files (XML)
- @qxt - code to handle global system-wide shortcuts
25 changes: 24 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ OPTION(PEDANTIC "Enable all compiler warnings" OFF)

# Options (cmake -LH)
OPTION(WITH_PLUGINS "Compile plugins" ON)
OPTION(WITH_QCA_ENCRYPTION "Enable QCA-based tab encryption" ON)
OPTION(WITH_KEYCHAIN "Enable system keyring integration using QtKeychain" ON)

add_definitions( -DQT_USE_STRINGBUILDER )

Expand Down Expand Up @@ -60,6 +62,27 @@ endif()

list(APPEND copyq_LIBRARIES ${copyq_qt}::Widgets)

# QCA encryption support
if (WITH_QCA_ENCRYPTION)
find_package(Qca-qt${QT_DEFAULT_MAJOR_VERSION} REQUIRED)
list(APPEND copyq_LIBRARIES qca-qt${QT_DEFAULT_MAJOR_VERSION})
add_definitions(-DWITH_QCA_ENCRYPTION)
message(STATUS "QCA encryption support enabled")
else()
message(STATUS "QCA encryption support DISABLED")
set(WITH_KEYCHAIN OFF)
endif()

# QtKeychain support for system keyring integration
if (WITH_KEYCHAIN)
find_package(Qt${QT_DEFAULT_MAJOR_VERSION}Keychain REQUIRED)
list(APPEND copyq_LIBRARIES qt${QT_DEFAULT_MAJOR_VERSION}keychain)
add_definitions(-DWITH_KEYCHAIN)
message(STATUS "Keychain support enabled")
else()
message(STATUS "Keychain support disabled")
endif()

set(copyq_APP_ID com.github.hluk.copyq)
set(copyq_ICON_PREFIX src/images/icon)
set(copyq_ICON_NORMAL src/images/icon.svg)
Expand All @@ -73,7 +96,7 @@ set(copyq_MANPAGE debian/copyq.1)
if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-long-long")
set(CMAKE_CXX_FLAGS_DEBUG
"${CMAKE_CXX_FLAGS_DEBUG} -Wextra -Wall -pedantic -Wfloat-equal -Woverloaded-virtual -Wundef -Wno-inconsistent-missing-destructor-override")
"${CMAKE_CXX_FLAGS_DEBUG} -Wextra -Wall -pedantic -Wfloat-equal -Woverloaded-virtual -Wundef -Wno-inconsistent-missing-destructor-override -Wno-variadic-macro-arguments-omitted")
endif()

if (PEDANTIC)
Expand Down
1 change: 1 addition & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"installDir": "${sourceParentDir}/install/copyq/${presetName}",
"cacheVariables": {
"WITH_TESTS": "TRUE",
"WITH_QCA_ENCRYPTION": "TRUE",
"PEDANTIC": "TRUE",
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_C_COMPILER_LAUNCHER": "ccache",
Expand Down
69 changes: 2 additions & 67 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,73 +234,8 @@ Read more:

## Build from Source Code

To build CopyQ from source code, first install the required dependencies:

- [Git](https://git-scm.com/)
- [CMake](https://cmake.org/download/)
- [Qt](https://download.qt.io/archive/qt/)
- optional on Linux/X11: development files and libraries for [Xtst](https://t2-project.org/packages/libxtst.html) and [Xfixes](https://www.x.org/archive/X11R7.5/doc/man/man3/Xfixes.3.html)

### Install Dependencies

#### Ubuntu

```bash
sudo apt install \
cmake \
extra-cmake-modules \
git \
libqt5svg5 \
libqt5svg5-dev \
libqt5waylandclient5-dev \
libqt5x11extras5-dev \
libwayland-dev \
libxfixes-dev \
libxtst-dev \
qtbase5-private-dev \
qtdeclarative5-dev \
qttools5-dev \
qttools5-dev-tools \
qtwayland5 \
qtwayland5-dev-tools \
libkf5notifications-dev
```
#### RHEL / CentOS / Oracle Linux

```bash
sudo yum install \
cmake \
extra-cmake-modules \
gcc-c++ \
git \
libXfixes-devel \
libXtst-devel \
qt5-qtbase-devel \
qt5-qtdeclarative-devel \
qt5-qtsvg-devel \
qt5-qttools-devel \
qt5-qtwayland-devel \
qt5-qtx11extras-devel \
wayland-devel \
kf5-knotifications-devel
```

### Build CopyQ

Change install prefix if needed:

```bash
git clone https://github.com/hluk/CopyQ.git
cd CopyQ
cmake .
make
```

You can now run the built app.

```bash
./copyq
```
See the documentation section [Build from Source
Code](https://copyq.readthedocs.io/en/latest/build-source-code.html).

## Contributions

Expand Down
10 changes: 7 additions & 3 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ environment:
KF_BRANCH: stable
KF_PATCH: 0
SNORETOAST_VERSION: 0.9.0
QCA_VERSION: 2.3.10
QTKEYCHAIN_VERSION: 0.15.0

matrix:
- QTDIR: /c/Qt/6.8/msvc2022_64
Expand All @@ -28,11 +30,13 @@ environment:
BUILD_SUB_DIR: Release
# https://wiki.qt.io/Qt_6.8_Tools_and_Versions
# https://www.appveyor.com/docs/windows-images-software/#tools
OPENSSL_PATH: /c/OpenSSL-v30-Win64/bin
LIBSSL: libssl-3-x64.dll
LIBCRYPTO: libcrypto-3-x64.dll
LIBSSL: /c/OpenSSL-v30-Win64/bin/libssl-3-x64.dll
LIBCRYPTO: /c/OpenSSL-v30-Win64/bin/libcrypto-3-x64.dll
LIBSSL_FOR_QCA: /c/OpenSSL-Win64/bin/libssl-1_1-x64.dll
LIBCRYPTO_FOR_QCA: /c/OpenSSL-Win64/bin/libcrypto-1_1-x64.dll
GPGPATH: /c/Program Files/Git/usr/bin
WITH_NATIVE_NOTIFICATIONS: "ON"
WITH_QCA_ENCRYPTION: "ON"
WITH_QT6: "ON"
WINDEPLOYQT_ARGS: >-
--no-system-d3d-compiler
Expand Down
59 changes: 24 additions & 35 deletions docs/build-source-code.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,50 +37,36 @@ On **Ubuntu** you can install all build dependencies with:
cmake \
extra-cmake-modules \
git \
libkf5notifications-dev \
libqt5svg5 \
libqt5svg5-dev \
libqt5waylandclient5-dev \
libqt5x11extras5-dev \
libkf6guiaddons \
libkf6guiaddons-dev \
libqca-qt6-2 \
libqca-qt6-dev \
libqca-qt6-plugins \
libqt6svg6 \
libqt6svg6-dev \
libqt6waylandclient6 \
libwayland-dev \
libxfixes-dev \
libxtst-dev \
qtbase5-private-dev \
qtdeclarative5-dev \
qttools5-dev \
qttools5-dev-tools \
qtwayland5 \
qtwayland5-dev-tools
qt6-base-dev \
qt6-base-dev-tools \
qt6-base-private-dev \
qt6-declarative-dev \
qt6-l10n-tools \
qt6-tools-dev \
qt6-tools-dev-tools \
qt6-wayland \
qt6-wayland-dev \
qt6-wayland-dev-tools \
qtkeychain-qt6-dev

Fedora / RHEL / Centos
^^^^^^^^^^^^^^^^^^^^^^
On **Fedora** and derivatives you can install all build dependencies with Qt 5:
On **Fedora** and derivatives you can install all build dependencies with:

::

sudo yum install \
cmake \
extra-cmake-modules \
gcc-c++ \
git \
kf5-knotifications-devel \
libSM-devel \
libXfixes-devel \
libXtst-devel \
qt5-qtbase-devel \
qt5-qtbase-private-devel \
qt5-qtdeclarative-devel \
qt5-qtsvg-devel \
qt5-qttools-devel \
qt5-qtwayland-devel \
qt5-qtx11extras-devel \
wayland-devel

To build with Qt 6:

::

sudo yum install \
sudo dnf install \
cmake \
extra-cmake-modules \
gcc-c++ \
Expand All @@ -91,12 +77,15 @@ To build with Qt 6:
libSM-devel \
libXfixes-devel \
libXtst-devel \
qca-qt6-devel \
qca-qt6-ossl \
qt6-qtbase-devel \
qt6-qtbase-private-devel \
qt6-qtdeclarative-devel \
qt6-qtsvg-devel \
qt6-qttools-devel \
qt6-qtwayland-devel \
qtkeychain-qt6-devel \
wayland-devel

Build and Install
Expand Down
Loading
Loading