Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
zzag committed May 16, 2020
0 parents commit f3a5b50
Show file tree
Hide file tree
Showing 14 changed files with 1,169 additions and 0 deletions.
36 changes: 36 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
cmake_minimum_required(VERSION 3.0)
project(kwin-effects-sliding-notifications)

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

find_package(ECM REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake/Modules)

include(FeatureSummary)
include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDECompilerSettings NO_POLICY_SCOPE)

find_package(Qt5 REQUIRED COMPONENTS
Core
DBus
Gui
)

find_package(KF5 REQUIRED COMPONENTS
Config
ConfigWidgets
CoreAddons
WindowSystem
)

find_package(kwineffects REQUIRED COMPONENTS
kwineffects
kwinglutils
)

add_subdirectory(src)

feature_summary(WHAT ALL)
625 changes: 625 additions & 0 deletions LICENSES/GPL-3.0-or-later.txt

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions LICENSES/MIT.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
MIT License Copyright (c) <year> <copyright holders>

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, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:

The above copyright notice and this permission notice (including the next
paragraph) shall be included in all copies or substantial portions of the
Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
55 changes: 55 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Sliding Notifications Effect

[Demo](https://youtu.be/6uzv8r8Oqf4)


#### Building from Git

You will need the following dependencies to build this effect:

* CMake
* any C++14 enabled compiler
* Qt
* libkwineffects
* KDE Frameworks 5:
- Config
- CoreAddons
- Extra CMake Modules
- WindowSystem

On Arch Linux

```sh
sudo pacman -S cmake extra-cmake-modules kwin
```

On Fedora

```sh
sudo dnf install cmake extra-cmake-modules kf5-kconfig-devel \
kf5-kcoreaddons-devel kf5-kwindowsystem-devel kwin-devel \
qt5-qtbase-devel
```

On Ubuntu

```sh
sudo apt install cmake extra-cmake-modules kwin-dev \
libkf5config-dev libkf5configwidgets-dev libkf5coreaddons-dev \
libkf5windowsystem-dev qtbase5-dev
```

After you installed all the required dependencies, you can build
the effect:

```sh
git clone https://github.com/zzag/kwin-effects-sliding-notifications.git
cd kwin-effects-sliding-notifications
mkdir build && cd build
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr
make
sudo make install
```

56 changes: 56 additions & 0 deletions cmake/Modules/Findepoxy.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# - Try to find libepoxy
# Once done this will define
#
# epoxy_FOUND - System has libepoxy
# epoxy_LIBRARY - The libepoxy library
# epoxy_INCLUDE_DIR - The libepoxy include dir
# epoxy_DEFINITIONS - Compiler switches required for using libepoxy
# epoxy_HAS_GLX - Whether GLX support is available

# Copyright (c) 2014 Fredrik Höglund <[email protected]>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the University nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.

if (NOT WIN32)
find_package(PkgConfig)
pkg_check_modules(PKG_epoxy QUIET epoxy)

set(epoxy_DEFINITIONS ${PKG_epoxy_CFLAGS})

find_path(epoxy_INCLUDE_DIR NAMES epoxy/gl.h HINTS ${PKG_epoxy_INCLUDEDIR} ${PKG_epoxy_INCLUDE_DIRS})
find_library(epoxy_LIBRARY NAMES epoxy HINTS ${PKG_epoxy_LIBDIR} ${PKG_epoxy_LIBRARY_DIRS})
find_file(epoxy_GLX_HEADER NAMES epoxy/glx.h HINTS ${epoxy_INCLUDE_DIR})

if (epoxy_GLX_HEADER STREQUAL "epoxy_GLX_HEADER-NOTFOUND")
set(epoxy_HAS_GLX FALSE CACHE BOOL "whether glx is available")
else ()
set(epoxy_HAS_GLX TRUE CACHE BOOL "whether glx is available")
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(epoxy DEFAULT_MSG epoxy_LIBRARY epoxy_INCLUDE_DIR)

mark_as_advanced(epoxy_INCLUDE_DIR epoxy_LIBRARY epoxy_HAS_GLX)
endif()
101 changes: 101 additions & 0 deletions cmake/Modules/Findkwineffects.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
#.rst:
# Findkwineffects
# ---------------
#
# Try to find libkwineffects.
#
# This is a component-based find module, which makes use of the COMPONENTS
# argument to find_modules. The following components are
# available::
#
# kwineffects
# kwinglutils
# kwinxrenderutils
#
# If no components are specified, this module will act as though all components
# were passed to OPTIONAL_COMPONENTS.
#
# This module will define the following variables, independently of the
# components searched for or found:
#
# ``kwineffects_FOUND``
# True if (the requestion version of) libkwineffects is available
# ``kwineffects_TARGETS``
# A list of all targets imported by this module (note that there may be more
# than the components that were requested)
# ``kwineffects_LIBRARIES``
# This can be passed to target_link_libraries() instead of the imported
# targets
# ``kwineffects_INCLUDE_DIRS``
# This should be passed to target_include_directories() if the targets are
# not used for linking
# ``kwineffects_DEFINITIONS``
# This should be passed to target_compile_options() if the targets are not
# used for linking
#
# For each searched-for components, ``kwineffects_<component>_FOUND`` will be
# set to true if the corresponding libkwineffects library was found, and false
# otherwise. If ``kwineffects_<component>_FOUND`` is true, the imported target
# ``kwineffects::<component>`` will be defined.

#=============================================================================
# Copyright 2019 Vlad Zagorodniy <[email protected]>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#=============================================================================

include(ECMFindModuleHelpers)
ecm_find_package_version_check(kwineffects)

set(kwineffects_known_components
kwineffects
kwinglutils
kwinxrenderutils
)
set(kwineffects_default_components ${kwineffects_known_components})

set(kwineffects_kwineffects_header "kwineffects.h")
set(kwineffects_kwineffects_lib "kwineffects")
set(kwineffects_kwinglutils_header "kwinglutils.h")
set(kwineffects_kwinglutils_lib "kwinglutils")
set(kwineffects_kwinxrenderutils_header "kwinxrenderutils.h")
set(kwineffects_kwinxrenderutils_lib "kwinxrenderutils")

ecm_find_package_parse_components(kwineffects
RESULT_VAR kwineffects_components
KNOWN_COMPONENTS ${kwineffects_known_components}
DEFAULT_COMPONENTS ${kwineffects_default_components}
)

ecm_find_package_handle_library_components(kwineffects
COMPONENTS ${kwineffects_components}
)

find_package_handle_standard_args(kwineffects
FOUND_VAR
kwineffects_FOUND
REQUIRED_VARS
kwineffects_LIBRARIES
HANDLE_COMPONENTS
)
20 changes: 20 additions & 0 deletions cmake/Modules/PkgConfigGetVar.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
include (UsePkgConfig)

macro (pkgconfig_getvar _package _var _output_variable)
SET (${_output_variable})

if (PKGCONFIG_EXECUTABLE)
exec_program (${PKGCONFIG_EXECUTABLE}
ARGS ${_package} --exists
RETURN_VALUE _return_VALUE
OUTPUT_VARIABLE _pkgconfigDevNull
)

if (NOT _return_VALUE)
exec_program (${PKGCONFIG_EXECUTABLE}
ARGS ${_package} --variable ${_var}
OUTPUT_VARIABLE ${_output_variable}
)
endif ()
endif ()
endmacro ()
24 changes: 24 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
set(slidingnotificationseffect_SOURCES
slidingnotificationseffect.cpp
slidingnotificationsplugin.cpp
)

kconfig_add_kcfg_files(slidingnotificationseffect_SOURCES
slidingnotificationsconfig.kcfgc
)

add_library(kwin4_effect_slidingnotifications SHARED ${slidingnotificationseffect_SOURCES})

target_link_libraries(kwin4_effect_slidingnotifications
Qt5::Core
Qt5::Gui

KF5::ConfigCore
KF5::ConfigGui
KF5::CoreAddons
KF5::WindowSystem

kwineffects::kwineffects
)

install(TARGETS kwin4_effect_slidingnotifications DESTINATION ${PLUGIN_INSTALL_DIR}/kwin/effects/plugins/)
18 changes: 18 additions & 0 deletions src/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"KPlugin": {
"Authors": [
{
"Email": "[email protected]",
"Name": "Vlad Zahorodnii"
}
],
"Category": "Appearance",
"Description": "Sliding animation for notification windows",
"EnabledByDefault": false,
"Icon": "preferences-system-windows-effect-slidingnotifications",
"Id": "kwin4_effect_slidingnotifications",
"License": "GPL",
"Name": "Sliding Notifications",
"ServiceTypes": ["KWin/Effect"]
}
}
12 changes: 12 additions & 0 deletions src/slidingnotificationsconfig.kcfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name="kwinrc"/>
<group name="Effect-SlidingNotifications">
<entry name="Duration" type="UInt">
<default>0</default>
</entry>
</group>
</kcfg>
4 changes: 4 additions & 0 deletions src/slidingnotificationsconfig.kcfgc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
File=slidingnotificationsconfig.kcfg
ClassName=SlidingNotificationsConfig
Singleton=true
Mutators=true
Loading

0 comments on commit f3a5b50

Please sign in to comment.