Skip to content

Commit

Permalink
Merge branch 'release/0.7'
Browse files Browse the repository at this point in the history
  • Loading branch information
jahnf committed Feb 22, 2020
2 parents 1aa72cd + 74037a8 commit 10f9a3e
Show file tree
Hide file tree
Showing 35 changed files with 1,386 additions and 371 deletions.
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ matrix:
- os: linux
dist: bionic
env: DOCKER_IMG=jahnf/projecteur:fedora-31
- os: linux
dist: bionic
env: DOCKER_IMG=jahnf/projecteur:centos-8
script:
- git fetch --tags
- "[ -f $(git rev-parse --git-dir)/shallow ] && git fetch --unshallow || echo No need to unshallow..."
Expand All @@ -33,7 +36,7 @@ script:
- docker exec -it build /bin/bash -c "mkdir -p /build/dist-pkg && cd /build && cmake /source"
- docker exec -it build /bin/bash -c "cd /build && cmake --build ."
- docker exec -it build /bin/bash -c "cd /build && cmake --build . --target dist-package"
- docker exec -it build /bin/bash -c "cd /build && ./projecteur --version"
- docker exec -it build /bin/bash -c "cd /build && ./projecteur -f"
- "[ \"${BUILD_SOURCE_PKG}\" = 1 ] && docker exec -it build /bin/bash -c \"cd /build && cmake --build . --target source-archive\" || true"
- docker cp build:/build/dist-pkg .
- docker cp build:/build/travis-ci-bintray-deploy.json .
Expand Down
20 changes: 20 additions & 0 deletions 55-projecteur.rules.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Set up permissions for non root users to open the Logitech Spotlight USB Receiver and other
# supported devices. Enables the Projecteur application to access the device.

# Copy the generated file `55-projecteur.rules` from the build directory
# to /lib/udev/rules.d/55-projecteur.rules

# Rule for the Logitech Spotlight USB Receiver
SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c53e", MODE="0660", TAG+="uaccess"

# Additional supported USB devices @EXTRA_USB_UDEV_RULES@

# Rule fot the Logitech Spotlight when connected via Bluetooth
# Updated rule, thanks to Torsten Maehne (https://github.com/maehne)
SUBSYSTEMS=="input", ENV{LIBINPUT_DEVICE_GROUP}="5/46d/b503*", ATTRS{name}=="SPOTLIGHT*", MODE="0660", TAG+="uaccess"

# Additional supported Bluetooth devices @EXTRA_BLUETOOTH_UDEV_RULES@

# Rules for uninput: Essential for creating a virtual input device that
# Projecteur use for forwarding device events to the system after grabbing it
KERNEL=="uinput", SUBSYSTEM=="misc", TAG+="uaccess", OPTIONS+="static_node=uinput"
11 changes: 0 additions & 11 deletions 55-spotlight.rules.in

This file was deleted.

61 changes: 57 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ set(CMAKE_AUTORCC ON)
find_package(Qt5 5.7 COMPONENTS Core Gui Quick Widgets REQUIRED)
find_package(Qt5 QUIET COMPONENTS X11Extras)
set(HAS_Qt5_X11Extras ${Qt5_FOUND})
find_package(Qt5 QUIET COMPONENTS DBus)
set(HAS_Qt5_DBus ${Qt5_FOUND})

# Qt 5.8 seems to have issues with the way Projecteur shows the full screen overlay window,
# let's warn the user about it.
Expand All @@ -43,22 +45,36 @@ add_executable(projecteur
src/main.cc
src/aboutdlg.cc src/aboutdlg.h
src/colorselector.cc src/colorselector.h
src/linuxdesktop.cc src/linuxdesktop.h
src/imageitem.cc src/imageitem.h
src/logging.cc src/logging.h
src/preferencesdlg.cc src/preferencesdlg.h
src/projecteurapp.cc src/projecteurapp.h
src/runguard.cc src/runguard.h
src/settings.cc src/settings.h
src/spotlight.cc src/spotlight.h
src/spotshapes.cc src/spotshapes.h
src/virtualdevice.h src/virtualdevice.cc
resources.qrc qml/qml.qrc)

target_include_directories(projecteur PRIVATE src)

target_link_libraries(projecteur
PRIVATE Qt5::Core Qt5::Quick Qt5::Widgets
)

if(HAS_Qt5_X11Extras)
target_link_libraries(projecteur PRIVATE Qt5::X11Extras)
target_compile_definitions(projecteur PRIVATE HAS_Qt5_X11Extras=1)
else()
message(STATUS "Compiling without Qt5::X11Extras.")
endif()

if(HAS_Qt5_DBus)
target_link_libraries(projecteur PRIVATE Qt5::DBus)
target_compile_definitions(projecteur PRIVATE HAS_Qt5_DBus=1)
else()
message(STATUS "Compiling without Qt5::DBus.")
endif()

target_compile_options(projecteur
Expand All @@ -76,7 +92,7 @@ target_compile_definitions(projecteur PRIVATE
# VERSION_TYPE must be either 'release' or 'develop'
set_target_properties(projecteur PROPERTIES
VERSION_MAJOR 0
VERSION_MINOR 6
VERSION_MINOR 7
VERSION_PATCH 0
VERSION_TYPE release
)
Expand All @@ -96,7 +112,9 @@ add_translations_target("projecteur" "${CMAKE_CURRENT_BINARY_DIR}" "${ts_directo
add_translation_update_task("projecteur" "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/i18n" "${languages}")

# Add target with non-source files for convenience when using IDEs like QtCreator and others
add_custom_target(non-sources SOURCES README.md LICENSE.md)
add_custom_target(non-sources SOURCES README.md LICENSE.md devices.conf
src/extra-devices.cc.in 55-projecteur.rules.in
cmake/templates/Projecteur.desktop.in)

# Install
install(TARGETS projecteur DESTINATION bin)
Expand Down Expand Up @@ -127,8 +145,43 @@ mark_as_advanced(CMAKE_INSTALL_UDEVRULESDIR)
set(OUTDIR "${CMAKE_CURRENT_BINARY_DIR}")
set(TMPLDIR "${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates")

configure_file("55-spotlight.rules.in" "55-spotlight.rules" @ONLY)
install(FILES "${OUTDIR}/55-spotlight.rules" DESTINATION ${CMAKE_INSTALL_UDEVRULESDIR}/)
# Read devices.conf file
set(idRegex "0x([0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])")
set(lineRegex "^[ \t]*${idRegex}[ \t]*,[ \t]*${idRegex}[ \t]*,[ \t]*(usb|bt)[ \t]*,[ \t]*(.*)[ \t]*")
file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/devices.conf" CONFLINES REGEX "${lineRegex}")
foreach(line ${CONFLINES})
#message(STATUS "## ${line}")
if(line MATCHES "${lineRegex}")
# message(STATUS "vendorId: ${CMAKE_MATCH_1}, productId: ${CMAKE_MATCH_2}, ${CMAKE_MATCH_3}, '${CMAKE_MATCH_4}'")
set(vendorId "${CMAKE_MATCH_1}")
set(productId "${CMAKE_MATCH_2}")

if("${CMAKE_MATCH_3}" STREQUAL "usb")
string(APPEND EXTRA_USB_UDEV_RULES "\n## Extra-Device: ${CMAKE_MATCH_4}")
string(APPEND EXTRA_USB_UDEV_RULES "\nSUBSYSTEMS==\"usb\", ATTRS{idVendor}==\"${vendorId}\"")
string(APPEND EXTRA_USB_UDEV_RULES ", ATTRS{idProduct}==\"${productId}\", MODE=\"0660\", TAG+=\"uaccess\"")
string(APPEND SUPPORTED_EXTRA_DEVICES "\n {0x${vendorId}, 0x${productId}, false, \"${CMAKE_MATCH_4}\"}, // ${CMAKE_MATCH_4}")
elseif("${CMAKE_MATCH_3}" STREQUAL "bt")
string(APPEND SUPPORTED_EXTRA_DEVICES "\n {0x${vendorId}, 0x${productId}, true, \"${CMAKE_MATCH_4}\"}, // ${CMAKE_MATCH_4}")
if("${vendorId}" MATCHES "0*([0-9a-fA-F]+)")
set(vendorId "${CMAKE_MATCH_1}")
endif()
if("${productId}" MATCHES "0*([0-9a-fA-F]+)")
set(productId "${CMAKE_MATCH_1}")
endif()
string(APPEND EXTRA_BLUETOOTH_UDEV_RULES "\n## Extra-Device: ${CMAKE_MATCH_4}")
string(APPEND EXTRA_BLUETOOTH_UDEV_RULES "\nSUBSYSTEMS==\"input\", ")
string(APPEND EXTRA_BLUETOOTH_UDEV_RULES "ENV{LIBINPUT_DEVICE_GROUP}=\"5/${vendorId}/${productId}*\", ")
string(APPEND EXTRA_BLUETOOTH_UDEV_RULES "MODE=\"0660\", TAG+=\"uaccess\"")
endif()
endif()
endforeach()

configure_file("src/extra-devices.cc.in" "src/extra-devices.cc" @ONLY)
set_property(TARGET projecteur APPEND PROPERTY SOURCES "${CMAKE_CURRENT_BINARY_DIR}/src/extra-devices.cc")

configure_file("55-projecteur.rules.in" "55-projecteur.rules" @ONLY)
install(FILES "${OUTDIR}/55-projecteur.rules" DESTINATION ${CMAKE_INSTALL_UDEVRULESDIR}/)

install(FILES icons/projecteur-tray.svg DESTINATION /usr/share/icons/hicolor/48x48/apps/ RENAME projecteur.svg)
install(FILES icons/projecteur-tray.svg DESTINATION /usr/share/icons/hicolor/64x64/apps/ RENAME projecteur.svg)
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2018-2019, Jahn Fuchs
Copyright 2018-2020, Jahn Fuchs

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction,
Expand Down
93 changes: 78 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
develop: [![Build Status develop](https://travis-ci.org/jahnf/Projecteur.svg?branch=develop)](https://travis-ci.org/jahnf/Projecteur)
master: [![Build Status master](https://travis-ci.org/jahnf/Projecteur.svg?branch=master)](https://travis-ci.org/jahnf/Projecteur)

Linux/X11 application for the Logitech Spotlight device. \
Linux/X11 application for the Logitech Spotlight device (and similar devices). \
See **[Download](#download)** section for binary packages.

## Motivation
Expand All @@ -15,12 +15,29 @@ done by additional software.

So here it is: a Linux application for the Logitech Spotlight.

## Table of Contents

* [Motivation](#motivation)
* [Features](#features)
* [Supported Environments](#supported-environments)
* [How it works](#how-it-works)
* [Download](#download)
* [Building](#building)
* [Installation/Running](#installationrunning)
* [Pre-requisites](#pre-requisites)
* [Application Menu](#application-menu)
* [Command Line Interface](#command-line-interface)
* [Device Support](#device-support)
* [Troubleshooting](#troubleshooting)
* [License](#license)

## Features

* Configurable desktop spotlight
* Configurable desktop spotlight
* _shade color_, _opacity_, _cursor_, _border_, _center dot_ and different _shapes_.
* Zoom (magnifier) functionality.
* Multiple screen support
* Support of devices besides the Logitech Spotlight (see [Device Support](#device-support))

### Screenshots

Expand All @@ -30,9 +47,8 @@ So here it is: a Linux application for the Logitech Spotlight.

### Planned features

* Support other devices besides the Logitech Spotlight
* Support for device button configuration/mapping
* Vibration (Timer) Support (Logitech Spotlight)
* Support for device button configuration

## Supported Environments

Expand All @@ -56,10 +72,18 @@ we will 'turn on' the desktop spot.

For more details: Have a look at the source code ;)

### Notes about v0.7

This version implemented a virtual device by default (You can still disable it with
the `--disable-uinput` command line option). _Projecteur_ will now **grab** all device
events and forward it to the virtual 'uniput' device. While this does currently not
change any behavior or feature from `v0.6`, this prepares _Projecteur_ for the planned
button mapping feature.

## Download

The latest binary packages for some Linux distributions are available for download on bintray.
Currently binary packages for _Ubuntu_, _Debian_, _Fedora_, _OpenSuse_ and
Currently binary packages for _Ubuntu_, _Debian_, _Fedora_, _OpenSuse_, _CentOS_ and
_Arch_ Linux are automatically built.

* Latest develop:
Expand Down Expand Up @@ -96,14 +120,15 @@ the Qt version that comes with the distribution's package management.

The input devices detected from the Spotlight device must be readable to the
user running the application. To make this easier there is a udev rule template
file in this repository: `55-spotlight.rules.in`
file in this repository: `55-projecteur.rules.in`

* Copy that file to `/lib/udev/rules.d/55-spotlight.rules`
* During the CMake run, the file `55-projecteur.rules` will be created from this template
in your **build directory**. Copy that generated file to `/lib/udev/rules.d/55-projecteur.rules`
* Most recent systems (using systemd) will automatically pick up the rule.
If not, run `sudo udevadm control --reload-rules` and `sudo udevadm trigger`
to load the rules without a reboot.
* After that the input devices from the Logitech USB Receiver (but also the Bluetooth device)
in /dev/input should be readable/writeable by you.
in /dev/input should be readable/writeable by you.
(See also about [device detection](#device-shows-as-not-connected))
* When building against the Qt version that comes with your distribution's packages
you might need to install some additional QML module packages. For example this
Expand Down Expand Up @@ -131,6 +156,8 @@ Usage: projecteur [option]
-v, --version Print application version.
--cfg FILE Set custom config file.
-d, --device-scan Print device-scan results.
-l, --log-level LEVEL Set log level (dbg,inf,wrn,err), default is 'inf'.
-D DEVICE Additional accepted device; DEVICE=vendorId:productId
-c COMMAND|PROPERTY Send command/property to a running instance.
<Commands>
Expand All @@ -141,6 +168,25 @@ Usage: projecteur [option]

All the properties that can be set via the command line, are listed with the `--help-all` option.

### Device Support

#### Compile Time

Besides the Logitech Spotlight, similar devices can be used and are supported.
Additional devices can be added to `devices.conf`. At CMake configuration time
the project will be configured to support these devices and also create entries
for them in the generated udev-rule file.

#### Runtime

_Projecteur_ will also accept devices as supported when added via the `-D`
command line option.

Example: `projecteur -D 04b3:310c`

This will enable devices for _Projecteur_, but it is up to the user to make sure
the device is accessible (via udev rules).

### Troubleshooting

#### Opaque Spotlight / No Transparency
Expand All @@ -162,27 +208,44 @@ dialog, to test the spotlight, quit the application or set spotlight properties.
See [Command Line Interface](#command-line-interface).

On some distributions that have a **GNOME Desktop** by default there is **no system tray extensions**
installed (_Fedora_ for example). You can install the "TopIcons Plus" GNOME extension to have
a system tray that can show the Projecteur tray icon (and also from other
applications like Dropbox or Skype)
installed (_Fedora_ for example). You can install the
[KStatusNotifierItem/AppIndicator Support](https://extensions.gnome.org/extension/615/appindicator-support/)
or the [TopIcons Plus](https://extensions.gnome.org/extension/1031/topicons/)
GNOME extension to have a system tray that can show the Projecteur tray icon
(and also from other applications like Dropbox or Skype).

#### Zoom is not updated while spotlight is shown

That is due to the fact how the zoom currently works. A screenshot is taken shortly before the
overlay window is shown, and then a magnified section is shown wherever the mouse/spotlight is.
If the zoom would be updated while the overlay window is shown, the overlay window it self would
show up in the magnified section. That is a general problem, that also other magnifier tools face,
although they can get around the problem by showing the magnified content rectangle always in the
same position on the screen.

#### Wayland

While not developed with Wayland in mind, some users reported _Projecteur_ works with
While not developed with Wayland in mind, users reported _Projecteur_ works with
Wayland. If you experience problems, you can try to set the `QT_QPA_PLATFORM` environment
variable to `wayland`:
variable to `wayland`, example:

```
user@ubuntu1904:~/Projecteur/build$ QT_QPA_PLATFORM=wayland ./projecteur
Using Wayland-EGL
```

#### Wayland Zoom

On Wayland the Zoom feature is currently only implemented on KDE and GNOME. This is done with
the help of their respective DBus interfaces for screen capturing. On other environemnts with
Wayland, the zoom feature is currently not supported.

#### Device shows as not connected

If the device shows as not connected, there are some things you can do:

* Check for devices with _Projecteur_'s command line option `-d` or `--device-scan` option.
This will show you a list of all supported and detected devices and also if
This will show you a list of all supported and detected devices and also if
they are readable/writable. If a detected device is not readable/writable it is an indicator,
that there is something wrong with the installed _udev_ rules.
* Manually on the shell: Check if the device is detected by the Linux system: Run
Expand All @@ -196,6 +259,6 @@ If the device shows as not connected, there are some things you can do:

## License

Copyright 2018-2019 Jahn Fuchs
Copyright 2018-2020 Jahn Fuchs

This project is distributed under the [MIT License](https://opensource.org/licenses/MIT), see [LICENSE.md](./LICENSE.md) for more information.
5 changes: 4 additions & 1 deletion cmake/modules/LinuxPackaging.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ list(APPEND _LinuxPackaging_MAP_dist_pkgtype
"opensuse::RPM"
"opensuse-leap::RPM"
"fedora::RPM"
"centos::RPM"
"rhel::RPM"
"arch::PKGBUILD"
"archlinux::PKGBUILD"
)
Expand Down Expand Up @@ -245,6 +247,7 @@ function(_makepkg_packaging)
set(PKGBUILD_OUTPUT_FILE "${PKG_NAME}-${PKG_PKGBUILD_VER}-${PKG_PKGBUILD_PKGREL}-${PKG_PKGBUILD_ARCH}.pkg.tar.xz")
set(PKGBUILD_OUTPUT_PATH "${PKG_SOURCE_ARCHIVE_DIR}/${PKGBUILD_OUTPUT_FILE}")
set(PKGBUILD_FINAL_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/dist-pkg")
set(PKGBUILD_FINAL_FILE "${PKG_NAME}-${PKG_PKGBUILD_VER}-${PKG_PKGBUILD_PKGREL}_${LINUX_DIST_NAME}-${PKG_PKGBUILD_ARCH}.pkg.tar.xz")

add_custom_target(dist-package
COMMAND ${MAKEPKG_EXECUTABLE} -f --log --skipinteg
Expand All @@ -257,7 +260,7 @@ function(_makepkg_packaging)
)

add_custom_command(TARGET dist-package POST_BUILD
COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different "${PKGBUILD_OUTPUT_PATH}" "${PKGBUILD_FINAL_OUTPUT_DIR}/${PKGBUILD_OUTPUT_FILE}"
COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different "${PKGBUILD_OUTPUT_PATH}" "${PKGBUILD_FINAL_OUTPUT_DIR}/${PKGBUILD_FINAL_FILE}"
)

add_dependencies(dist-package source-archive)
Expand Down
Loading

0 comments on commit 10f9a3e

Please sign in to comment.