├── .clang-format
├── .github
├── actions
│ ├── dep-artifact-generic
│ │ └── action.yml
│ └── dep-artifacts
│ │ └── action.yml
└── workflows
│ ├── build.yml
│ ├── change.yml
│ ├── clang-format.yml
│ ├── commit-lint.yml
│ ├── install.yml
│ ├── package.yml
│ └── rebuild.yml
├── .gitignore
├── .gitlab-ci.yml
├── .reuse
└── dep5
├── .versionrc.json
├── CHANGELOG.md
├── CMakeLists.txt
├── CONTRIBUTING.md
├── LICENSE
├── LICENSES
├── GPL-2.0-only.txt
├── GPL-2.0-or-later.txt
├── GPL-3.0-only.txt
├── LGPL-2.0-only.txt
├── LGPL-2.0-or-later.txt
└── MIT.txt
├── Messages.sh
├── README.md
├── cmake
└── modules
│ └── Packing.cmake
├── config-theseus-ship.h.cmake
├── docs
└── assets
│ ├── desktop-screenshot.png
│ └── logo.png
├── kcms
├── CMakeLists.txt
├── common
│ ├── CMakeLists.txt
│ ├── Messages.sh
│ ├── effectsmodel.cpp
│ ├── effectsmodel.h
│ ├── generic_scripted_config.cpp
│ ├── generic_scripted_config.h
│ └── generic_scripted_config.json
├── compositing
│ ├── CMakeLists.txt
│ ├── Messages.sh
│ ├── compositing.ui
│ ├── kwincompositing.json
│ ├── kwincompositing_setting.kcfg
│ ├── kwincompositing_setting.kcfgc
│ ├── kwincompositingdata.cpp
│ ├── kwincompositingdata.h
│ └── main.cpp
├── decoration
│ ├── CMakeLists.txt
│ ├── Messages.sh
│ ├── declarative-plugin
│ │ ├── CMakeLists.txt
│ │ ├── buttonsmodel.cpp
│ │ ├── buttonsmodel.h
│ │ ├── previewbridge.cpp
│ │ ├── previewbridge.h
│ │ ├── previewbutton.cpp
│ │ ├── previewbutton.h
│ │ ├── previewclient.cpp
│ │ ├── previewclient.h
│ │ ├── previewitem.cpp
│ │ ├── previewitem.h
│ │ ├── previewsettings.cpp
│ │ ├── previewsettings.h
│ │ └── types.h
│ ├── decorationmodel.cpp
│ ├── decorationmodel.h
│ ├── kcm.cpp
│ ├── kcm.h
│ ├── kcm_kwindecoration.json
│ ├── kwin-applywindowdecoration.cpp
│ ├── kwindecorationsettings.kcfg
│ ├── kwindecorationsettings.kcfgc
│ ├── ui
│ │ ├── ButtonGroup.qml
│ │ ├── Buttons.qml
│ │ ├── ConfigureTitlebar.qml
│ │ ├── Themes.qml
│ │ └── main.qml
│ ├── utils.cpp
│ ├── utils.h
│ └── window-decorations.knsrc.cmake
├── desktop
│ ├── CMakeLists.txt
│ ├── Messages.sh
│ ├── animationsmodel.cpp
│ ├── animationsmodel.h
│ ├── desktopsmodel.cpp
│ ├── desktopsmodel.h
│ ├── kcm_kwin_virtualdesktops.json
│ ├── ui
│ │ └── main.qml
│ ├── virtualdesktops.cpp
│ ├── virtualdesktops.h
│ ├── virtualdesktopsdata.cpp
│ ├── virtualdesktopsdata.h
│ ├── virtualdesktopssettings.kcfg
│ └── virtualdesktopssettings.kcfgc
├── effects
│ ├── CMakeLists.txt
│ ├── Messages.sh
│ ├── desktopeffectsdata.cpp
│ ├── desktopeffectsdata.h
│ ├── effectsfilterproxymodel.cpp
│ ├── effectsfilterproxymodel.h
│ ├── kcm.cpp
│ ├── kcm.h
│ ├── kcm_kwin_effects.json
│ ├── kwineffect.knsrc
│ └── ui
│ │ ├── Effect.qml
│ │ ├── Video.qml
│ │ └── main.qml
├── options
│ ├── CMakeLists.txt
│ ├── Messages.sh
│ ├── actions.ui
│ ├── advanced.ui
│ ├── focus.ui
│ ├── kcm_kwinoptions.json
│ ├── kwinoptions_kdeglobals_settings.kcfg
│ ├── kwinoptions_kdeglobals_settings.kcfgc
│ ├── kwinoptions_settings.kcfg
│ ├── kwinoptions_settings.kcfgc
│ ├── main.cpp
│ ├── main.h
│ ├── mouse.cpp
│ ├── mouse.h
│ ├── mouse.ui
│ ├── moving.ui
│ ├── windows.cpp
│ └── windows.h
├── rules
│ ├── CMakeLists.txt
│ ├── Messages.sh
│ ├── kcm_kwinrules.json
│ ├── kcmrules.cpp
│ ├── kcmrules.h
│ ├── optionsmodel.cpp
│ ├── optionsmodel.h
│ ├── rulebookmodel.cpp
│ ├── rulebookmodel.h
│ ├── ruleitem.cpp
│ ├── ruleitem.h
│ ├── rulesmodel.cpp
│ ├── rulesmodel.h
│ └── ui
│ │ ├── FileDialogLoader.qml
│ │ ├── OptionsComboBox.qml
│ │ ├── RuleItemDelegate.qml
│ │ ├── RulesEditor.qml
│ │ ├── ValueEditor.qml
│ │ └── main.qml
├── screenedges
│ ├── CMakeLists.txt
│ ├── Messages.sh
│ ├── kcm_kwinscreenedges.json
│ ├── kcm_kwintouchscreen.json
│ ├── kwinscreenedge.cpp
│ ├── kwinscreenedge.h
│ ├── kwinscreenedgeconfigform.cpp
│ ├── kwinscreenedgeconfigform.h
│ ├── kwinscreenedgeeffectsettings.kcfg
│ ├── kwinscreenedgeeffectsettings.kcfgc
│ ├── kwinscreenedgescriptsettings.kcfg
│ ├── kwinscreenedgescriptsettings.kcfgc
│ ├── kwinscreenedgesettings.kcfg
│ ├── kwinscreenedgesettings.kcfgc
│ ├── kwintouchscreenedgeconfigform.cpp
│ ├── kwintouchscreenedgeconfigform.h
│ ├── kwintouchscreenedgeeffectsettings.kcfg
│ ├── kwintouchscreenedgeeffectsettings.kcfgc
│ ├── kwintouchscreenscriptsettings.kcfg
│ ├── kwintouchscreenscriptsettings.kcfgc
│ ├── kwintouchscreensettings.kcfg
│ ├── kwintouchscreensettings.kcfgc
│ ├── main.cpp
│ ├── main.h
│ ├── main.ui
│ ├── monitor.cpp
│ ├── monitor.h
│ ├── screenpreviewwidget.cpp
│ ├── screenpreviewwidget.h
│ ├── touch.cpp
│ ├── touch.h
│ └── touch.ui
├── scripts
│ ├── CMakeLists.txt
│ ├── Messages.sh
│ ├── kcm_kwin_scripts.json
│ ├── kwinscripts.knsrc
│ ├── kwinscriptsdata.cpp
│ ├── kwinscriptsdata.h
│ ├── main.cpp
│ ├── module.cpp
│ ├── module.h
│ └── ui
│ │ └── main.qml
└── tabbox
│ ├── CMakeLists.txt
│ ├── Messages.sh
│ ├── kcm_kwintabbox.json
│ ├── kwinpluginssettings.kcfg
│ ├── kwinpluginssettings.kcfgc
│ ├── kwinswitcheffectsettings.kcfg
│ ├── kwinswitcheffectsettings.kcfgc
│ ├── kwinswitcher.knsrc
│ ├── kwintabboxconfigform.cpp
│ ├── kwintabboxconfigform.h
│ ├── kwintabboxdata.cpp
│ ├── kwintabboxdata.h
│ ├── kwintabboxsettings.kcfg
│ ├── kwintabboxsettings.kcfgc
│ ├── layoutpreview.cpp
│ ├── layoutpreview.h
│ ├── main.cpp
│ ├── main.h
│ ├── main.ui
│ ├── shortcutsettings.cpp
│ ├── shortcutsettings.h
│ ├── thumbnailitem.cpp
│ ├── thumbnailitem.h
│ └── thumbnails
│ ├── desktop.png
│ ├── dolphin.png
│ ├── falkon.png
│ ├── kmail.png
│ └── systemsettings.png
├── main.h
├── main_wayland.cpp
├── main_x11.cpp
└── tooling
├── README.md
├── analysis
├── clang-format-config
├── clang-format.sh
└── coverity_scan_model.cpp
├── docs
└── commitlint.config.js
├── gitlab-ci.yml
└── release
├── stable-minor-prepare.sh
├── stable-patch-prepare.sh
└── versionrc.json
/.clang-format:
--------------------------------------------------------------------------------
1 | ---
2 | # SPDX-License-Identifier: MIT
3 | #
4 | # Copyright (C) 2019 Christoph Cullmann
5 | # Copyright (C) 2019 Gernot Gebhard
6 | # Copyright (C) 2020 Roman Gilg
7 | #
8 | # Permission is hereby granted, free of charge, to any person obtaining
9 | # a copy of this software and associated documentation files (the
10 | # "Software"), to deal in the Software without restriction, including
11 | # without limitation the rights to use, copy, modify, merge, publish,
12 | # distribute, sublicense, and/or sell copies of the Software, and to
13 | # permit persons to whom the Software is furnished to do so, subject to
14 | # the following conditions:
15 | #
16 | # The above copyright notice and this permission notice shall be included
17 | # in all copies or substantial portions of the Software.
18 | #
19 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22 | # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
23 | # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
24 | # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
25 | # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 |
27 |
28 | # Base is WebKit coding style: https://webkit.org/code-style-guidelines/,
29 | # below are only rules set that diverge from this style.
30 | BasedOnStyle: WebKit
31 |
32 | # Style for C++
33 | Language: Cpp
34 |
35 | # Language version 11 (TODO: what about 14 and 17?)
36 | Standard: Cpp11
37 |
38 | # 4 spaces indent
39 | TabWidth: 4
40 |
41 | ColumnLimit: 100
42 |
43 | # Sort includes inside line separated groups.
44 | SortIncludes: true
45 |
46 | # Break before braces on function, namespace and class definitions.
47 | BreakBeforeBraces: Linux
48 |
49 | # CrlInstruction *a;
50 | PointerAlignment: Left
51 |
52 | # Horizontally aligns arguments after an open bracket.
53 | AlignAfterOpenBracket: Align
54 |
55 | # Align trailing comments.
56 | AlignTrailingComments: true
57 |
58 | # Don't move all parameters to new line.
59 | AllowAllParametersOfDeclarationOnNextLine: false
60 |
61 | # No single line functions.
62 | AllowShortFunctionsOnASingleLine: false
63 |
64 | # Always break before you encounter multi line strings.
65 | AlwaysBreakBeforeMultilineStrings: true
66 |
67 | # Don't move arguments to own lines if they are not all on the same.
68 | BinPackArguments: false
69 |
70 | # Don't move parameters to own lines if they are not all on the same.
71 | BinPackParameters: false
72 |
73 | # Don't break binary ops.
74 | BreakBeforeBinaryOperators: All
75 |
76 | # Format C++11 braced lists like function calls.
77 | Cpp11BracedListStyle: true
78 |
79 | # No namespace indentation to keep indent level low.
80 | NamespaceIndentation: None
81 |
82 | # We use template< without space.
83 | SpaceAfterTemplateKeyword: false
84 |
85 | # Macros for which the opening brace stays attached.
86 | ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH, forever, Q_FOREVER, QBENCHMARK, QBENCHMARK_ONCE ]
87 |
88 | # C++11 uniform initialization.
89 | SpaceBeforeCpp11BracedList: false
90 |
91 | # Template break
92 | AlwaysBreakTemplateDeclarations: Yes
93 |
--------------------------------------------------------------------------------
/.github/actions/dep-artifact-generic/action.yml:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2024 Roman Gilg
2 | #
3 | # SPDX-License-Identifier: MIT
4 | name: Install Dependency via Artifact
5 | description: Uses tar package from other workflow to install on Arch
6 | inputs:
7 | repo:
8 | description: Path to repo where to download the dependency from
9 | required: true
10 | branch:
11 | description: Branch from which to download the artifact
12 | required: false
13 | default: master
14 | dep-name:
15 | description: Name of the dependency file
16 | required: true
17 | secret:
18 | description: Secret
19 | required: true
20 | runs:
21 | using: "composite"
22 | steps:
23 | - name: Download artifact
24 | uses: dawidd6/action-download-artifact@v3
25 | with:
26 | name: tar-package
27 | repo: ${{ inputs.repo }}
28 | branch: ${{ inputs.branch }}
29 | workflow_search: true
30 | github_token: ${{ inputs.secret }}
31 | - name: Untar
32 | run: tar -xf ${{ inputs.dep-name }}.tar.gz
33 | shell: bash
34 | - name: Install
35 | run: cp -r ${{ inputs.dep-name }}/* /usr
36 | shell: bash
37 |
--------------------------------------------------------------------------------
/.github/actions/dep-artifacts/action.yml:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2024 Roman Gilg
2 | # SPDX-License-Identifier: MIT
3 | name: Specialized Install Dependency via Artifact
4 | description: Calls into more generic dep-artifact-generic to install dependency
5 | inputs:
6 | secret:
7 | description: Secret
8 | required: true
9 | runs:
10 | using: "composite"
11 | steps:
12 | - name: Install Wrapland
13 | uses: ./.github/actions/dep-artifact-generic
14 | with:
15 | repo: winft/wrapland
16 | dep-name: wrapland
17 | secret: ${{ inputs.secret }}
18 | - name: Install The Compositor Modules
19 | uses: ./.github/actions/dep-artifact-generic
20 | with:
21 | repo: winft/como
22 | dep-name: como
23 | secret: ${{ inputs.secret }}
24 |
--------------------------------------------------------------------------------
/.github/workflows/build.yml:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2024 Roman Gilg
2 | #
3 | # SPDX-License-Identifier: MIT
4 | name: Build
5 | on:
6 | workflow_call:
7 | inputs:
8 | image:
9 | description: Image to build
10 | required: true
11 | type: string
12 | artifact-name:
13 | description: Artifact name of build dir
14 | required: false
15 | type: string
16 | default: 'build'
17 | is-sanitized:
18 | description: Should sanitizers be compiled into the build
19 | required: false
20 | type: boolean
21 | default: false
22 | ninja:
23 | description: Should Ninja be used as generator
24 | required: false
25 | type: boolean
26 | default: true
27 | cmake-args:
28 | description: Specify CMake arguments manually
29 | required: false
30 | type: string
31 | default: ''
32 | jobs:
33 | set-cmake-args:
34 | name: CMake Args
35 | runs-on: ubuntu-latest
36 | env:
37 | cmake-args: ''
38 | outputs:
39 | args: ${{ steps.set-output.outputs.result }}
40 | steps:
41 | - name: Set from manually specified CMake args
42 | if: ${{ inputs.cmake-args != '' }}
43 | run: echo \"cmake-args=${{ inputs.cmake-args }}\" >> $GITHUB_ENV;
44 | - name: Set default CMake args for sanitized build
45 | if: ${{ inputs.cmake-args == '' && inputs.is-sanitized }}
46 | run: echo "cmake-args=-DECM_ENABLE_SANITIZERS='address;leak;undefined'" >> $GITHUB_ENV"
47 | - name: Set default CMake args for coverage build
48 | if: ${{ inputs.cmake-args == '' && !inputs.is-sanitized }}
49 | run:
50 | "echo \"cmake-args=-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
51 | -DCMAKE_CXX_FLAGS=--coverage -DCMAKE_EXE_LINKER_FLAGS=--coverage\" >> $GITHUB_ENV"
52 | - name: Set clang as compiler
53 | if: ${{ inputs.cmake-args == '' }}
54 | run:
55 | "echo \"cmake-args=-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ \
56 | ${{ env.cmake-args }}\" >> $GITHUB_ENV"
57 | - name: Set generator
58 | if: ${{ inputs.cmake-args == '' && inputs.ninja }}
59 | run: echo "cmake-args=-G Ninja ${{ env.cmake-args }}" >> $GITHUB_ENV
60 | - id: set-output
61 | name: Set resulting variable
62 | run: echo "result=${{ env.cmake-args }}" >> "$GITHUB_OUTPUT"
63 | build:
64 | name: Build
65 | needs: set-cmake-args
66 | runs-on: ubuntu-latest
67 | container:
68 | image: ${{ inputs.image }}
69 | steps:
70 | - name: Checkout Repository
71 | uses: actions/checkout@v4
72 | - name: Install Dependencies
73 | uses: ./.github/actions/dep-artifacts
74 | with:
75 | secret: ${{ secrets.GITHUB_TOKEN }}
76 | - run: mkdir build
77 | - name: Configure
78 | run: cmake -S . -B build ${{ needs.set-cmake-args.outputs.args }}
79 | - name: Build
80 | run: cmake --build build
81 | - name: Tar artifact (keep permissions)
82 | run: tar -czf build-dir.tar build
83 | - name: Upload artifact
84 | uses: actions/upload-artifact@v4
85 | with:
86 | name: ${{ inputs.artifact-name }}
87 | path: build-dir.tar
88 | retention-days: 1
89 |
--------------------------------------------------------------------------------
/.github/workflows/change.yml:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2024 Roman Gilg
2 | #
3 | # SPDX-License-Identifier: MIT
4 | name: Main Checks
5 | on:
6 | - push
7 | - pull_request
8 | jobs:
9 | get:
10 | runs-on: ubuntu-latest
11 | outputs:
12 | image: ${{ steps.setvar.outputs.result }}
13 | env:
14 | prefix: registry.gitlab.com/kwinft/ci-images/archlinux/como-base
15 | result: ''
16 | branch: ''
17 | steps:
18 | - run: echo "branch=${{ github.head_ref || github.ref_name }}" >> $GITHUB_ENV
19 | - run: echo "result=${{ env.prefix }}-master" >> $GITHUB_ENV
20 | - if: startsWith(env.branch, '6.') || github.ref_type == 'tag'
21 | run: echo "result=${{ env.prefix }}-stable" >> $GITHUB_ENV
22 | - id: setvar
23 | run: echo "result=${{ env.result }}" >> $GITHUB_OUTPUT
24 |
25 | message-lint:
26 | if: endsWith(needs.get.outputs.image, '-master')
27 | uses: ./.github/workflows/commit-lint.yml
28 | needs: get
29 | with:
30 | upstream-repo: https://github.com/winft/theseus-ship.git
31 |
32 | reuse:
33 | runs-on: ubuntu-latest
34 | steps:
35 | - uses: actions/checkout@v4
36 | - name: REUSE Compliance
37 | uses: fsfe/reuse-action@v2
38 |
39 | clang-format:
40 | uses: ./.github/workflows/clang-format.yml
41 |
42 | build:
43 | uses: ./.github/workflows/build.yml
44 | needs: get
45 | with:
46 | image: ${{ needs.get.outputs.image }}
47 | secrets: inherit
48 |
49 | install:
50 | uses: ./.github/workflows/install.yml
51 | needs: [build, get]
52 | with:
53 | image: ${{ needs.get.outputs.image }}
54 |
55 | package:
56 | uses: ./.github/workflows/package.yml
57 | needs: [build, get]
58 | with:
59 | image: ${{ needs.get.outputs.image }}
60 | package-name: theseus-ship
61 |
--------------------------------------------------------------------------------
/.github/workflows/clang-format.yml:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2024 Roman Gilg
2 | #
3 | # SPDX-License-Identifier: MIT
4 | name: Clang-Format
5 | on: workflow_call
6 | jobs:
7 | clang-format:
8 | name: Clang-Format
9 | runs-on: ubuntu-latest
10 | container:
11 | image: archlinux
12 | steps:
13 | - name: Checkout Repository
14 | uses: actions/checkout@v4
15 | - run: pacman -Sy --needed --quiet --noconfirm clang python
16 | - run: bash tooling/analysis/clang-format.sh
17 |
--------------------------------------------------------------------------------
/.github/workflows/commit-lint.yml:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2024 Roman Gilg
2 | #
3 | # SPDX-License-Identifier: MIT
4 | name: Commit Message Lint
5 | on:
6 | workflow_call:
7 | inputs:
8 | upstream-repo:
9 | description: 'The repo with the target branch to compare against'
10 | required: true
11 | type: string
12 | upstream-branch:
13 | description: 'The target branch we compare against'
14 | required: false
15 | type: string
16 | default: 'master'
17 | jobs:
18 | message-lint:
19 | if: github.event_name != 'pull_request'
20 | name: On Push
21 | runs-on: ubuntu-latest
22 | steps:
23 | - name: Checkout Repository
24 | uses: actions/checkout@v4
25 |
26 | - name: Add Commitlint CLI
27 | run: yarn global add @commitlint/cli
28 | - name: Add Conventional Changelog module
29 | run: yarn add conventional-changelog-conventionalcommits
30 |
31 | # We must unshallow the checkout. On GitHub it's by default only 1 commit deep.
32 | - name: Unshallow
33 | run: git fetch --unshallow origin ${{ github.head_ref || github.ref_name }}
34 |
35 | - name: Add upstream remote
36 | run: git remote add _upstream ${{ inputs.upstream-repo }}
37 | - name: Fetch upstream
38 | run: git fetch --depth=1 -q _upstream ${{ inputs.upstream-branch }}
39 | - name: Commitlint
40 | run: >
41 | commitlint --verbose --config=tooling/docs/commitlint.config.js
42 | --from=_upstream/${{ inputs.upstream-branch }}
43 |
44 | message-lint-pr:
45 | if: github.event_name == 'pull_request'
46 | name: On Pull Request
47 | runs-on: ubuntu-latest
48 | steps:
49 | - name: Checkout Repository
50 | uses: actions/checkout@v4
51 | - uses: wagoid/commitlint-github-action@v5
52 | with:
53 | configFile: tooling/docs/commitlint.config.js
54 | helpURL: https://github.com/winft/theseus-ship/blob/master/CONTRIBUTING.md#commit-message-guideline
55 |
--------------------------------------------------------------------------------
/.github/workflows/install.yml:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2024 Roman Gilg
2 | #
3 | # SPDX-License-Identifier: MIT
4 | name: Build
5 | on:
6 | workflow_call:
7 | inputs:
8 | image:
9 | description: Image to build
10 | required: true
11 | type: string
12 | artifact-name:
13 | description: Artifact name of build dir
14 | required: false
15 | type: string
16 | default: 'build'
17 | jobs:
18 | install:
19 | name: Install
20 | runs-on: ubuntu-latest
21 | container:
22 | image: ${{ inputs.image }}
23 | steps:
24 | - name: Checkout Repository
25 | uses: actions/checkout@v4
26 | - name: Download artifact
27 | uses: actions/download-artifact@v4
28 | with:
29 | name: ${{ inputs.artifact-name }}
30 | - name: Untar artifact
31 | run: tar -xzf build-dir.tar
32 | - name: Try Install to System
33 | run: cmake --install build
34 |
--------------------------------------------------------------------------------
/.github/workflows/package.yml:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2024 Roman Gilg
2 | # SPDX-License-Identifier: MIT
3 | name: Package
4 | on:
5 | workflow_call:
6 | inputs:
7 | image:
8 | description: Image to package on
9 | required: true
10 | type: string
11 | artifact-name:
12 | description: Artifact name of build dir
13 | required: false
14 | type: string
15 | default: 'build'
16 | package-name:
17 | description: Name of the resulting packages
18 | required: true
19 | type: string
20 |
21 | jobs:
22 | deb:
23 | name: Create deb
24 | runs-on: ubuntu-latest
25 | container:
26 | image: ${{ inputs.image }}
27 | steps:
28 | - name: Install dpkg
29 | run: pacman -Sy --needed --quiet --noconfirm dpkg
30 | - name: Checkout Repository
31 | uses: actions/checkout@v4
32 | - name: Download artifact
33 | uses: actions/download-artifact@v4
34 | with:
35 | name: ${{ inputs.artifact-name }}
36 | - name: Untar artifact
37 | run: tar -xzf build-dir.tar
38 | - name: Run CPack
39 | run: cd build && cpack -G DEB -D CPACK_DEBIAN_FILE_NAME=${{ inputs.package-name }}.deb
40 | - name: Upload artifact
41 | uses: actions/upload-artifact@v4
42 | with:
43 | name: deb-package
44 | path: build/_CPack_Packages/Linux/DEB/${{ inputs.package-name }}.deb
45 | retention-days: 8
46 |
47 | tar:
48 | name: Create tar
49 | runs-on: ubuntu-latest
50 | container:
51 | image: ${{ inputs.image }}
52 | steps:
53 | - name: Checkout Repository
54 | uses: actions/checkout@v4
55 | - name: Download artifact
56 | uses: actions/download-artifact@v4
57 | with:
58 | name: ${{ inputs.artifact-name }}
59 | - name: Untar artifact
60 | run: tar -xzf build-dir.tar
61 | - name: Run CPack
62 | # Need to use CPACK_PACKAGE_FILE_NAME instead of CPACK_ARCHIVE_FILE_NAME
63 | # See: https://gitlab.kitware.com/cmake/cmake/-/issues/20419
64 | run: cd build && cpack -G TGZ -D CPACK_PACKAGE_FILE_NAME=${{ inputs.package-name }}
65 | - name: Upload artifact
66 | uses: actions/upload-artifact@v4
67 | with:
68 | name: tar-package
69 | path: build/_CPack_Packages/Linux/TGZ/${{ inputs.package-name }}.tar.gz
70 | retention-days: 8
71 |
--------------------------------------------------------------------------------
/.github/workflows/rebuild.yml:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2024 Roman Gilg
2 | # SPDX-License-Identifier: MIT
3 | name: Weekly Project Rebuild
4 | on:
5 | schedule:
6 | - cron: '0 5 * * 4'
7 | jobs:
8 | build:
9 | if: github.repository == 'winft/theseus-ship'
10 | uses: ./.github/workflows/build.yml
11 | with:
12 | image: registry.gitlab.com/kwinft/ci-images/archlinux/como-base-master
13 |
14 | package:
15 | uses: ./.github/workflows/package.yml
16 | needs: build
17 | with:
18 | image: registry.gitlab.com/kwinft/ci-images/archlinux/como-base-master
19 | package-name: theseus-ship
20 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2023 Roman Gilg
2 | #
3 | # SPDX-License-Identifier: GPL-2.0-or-later
4 |
5 | # Common build directories
6 | build/
7 | _build/
8 |
9 | # CI tooling
10 | node_modules/
11 | package.json
12 | yarn.lock
13 |
14 | # Note: Use a global .gitignore file for your local editor files. See [1] on how to create this.
15 | # [1] https://sebastiandedeyne.com/setting-up-a-global-gitignore-file/
16 |
--------------------------------------------------------------------------------
/.gitlab-ci.yml:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2023 Roman Gilg
2 | #
3 | # SPDX-License-Identifier: GPL-2.0-or-later
4 | stages:
5 | - Compliance
6 | - Build
7 |
8 | variables:
9 | IMAGE_BASE: ${CI_REGISTRY}/kwinft/ci-images/archlinux/kwinft-base
10 | IMAGE_VERSION: master
11 | IMAGE: ${IMAGE_BASE}-${IMAGE_VERSION}:latest
12 |
13 | workflow:
14 | rules:
15 | - when: always
16 |
17 | include:
18 | - project: kwinft/tooling
19 | ref: master
20 | file:
21 | - '/analysis/gitlab-ci/static.yml'
22 | - '/docs/gitlab-ci/commits.yml'
23 |
24 |
25 | # We use the following two job templates because we build with different images on master and
26 | # stable branches and GitLab CI does allow to set the image name only through variable expansion.
27 | .common-master: &common-master
28 | rules:
29 | - if: '$COVERITY_SCAN_RUN'
30 | when: never
31 | - if: '$IMAGE_VERSION != "master"'
32 | when: never
33 | - if: $CI_COMMIT_TAG
34 | when: never
35 | - when: on_success
36 |
37 | .common-stable: &common-stable
38 | rules:
39 | - if: '$COVERITY_SCAN_RUN'
40 | when: never
41 | - if: '$IMAGE_VERSION == "stable"'
42 | when: on_success
43 | - if: $CI_COMMIT_TAG
44 | variables:
45 | IMAGE_VERSION: stable
46 | when: on_success
47 | - when: never
48 |
49 |
50 | ####################################################################################################
51 | #
52 | # Compliance
53 | #
54 |
55 | Message Lint:
56 | extends: .message-lint
57 | stage: Compliance
58 |
59 | Clang-Format:
60 | extends: .clang-format
61 | stage: Compliance
62 | image: $IMAGE
63 |
64 | Reuse:
65 | stage: Compliance
66 | image: python
67 | before_script:
68 | pip install reuse
69 | script:
70 | reuse lint
71 |
72 |
73 | ####################################################################################################
74 | #
75 | # Build
76 | #
77 |
78 | Coverity Scan:
79 | extends: .coverity-scan
80 | stage: Build
81 | image: $IMAGE
82 |
83 | .common-build: &common-build
84 | stage: Build
85 | image: $IMAGE
86 | script:
87 | - mkdir build && cd build
88 | - cmake -DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON
89 | -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang
90 | -DCMAKE_CXX_FLAGS=--coverage -DCMAKE_EXE_LINKER_FLAGS=--coverage
91 | -DCMAKE_INSTALL_PREFIX:PATH=/usr ../
92 | - make -j$(nproc)
93 | - make install -j$(nproc)
94 | artifacts:
95 | paths:
96 | - build
97 | expire_in: 1 week
98 |
99 | Master Build:
100 | <<: *common-build
101 | <<: *common-master
102 |
103 | Stable Build:
104 | <<: *common-build
105 | <<: *common-stable
106 |
--------------------------------------------------------------------------------
/.reuse/dep5:
--------------------------------------------------------------------------------
1 | Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
2 | Upstream-Name: KWinFT
3 | Upstream-Contact: Roman Gilg
4 | Source: https://gitlab.com/kwinft/kwinft.git
5 |
6 | Files:
7 | .versionrc.json
8 | docs/*
9 | kcms/common/generic_scripted_config.json
10 | kcms/compositing/kwincompositing.json
11 | kcms/decoration/declarative-plugin/qmldir
12 | kcms/decoration/kcm_kwindecoration.json
13 | kcms/desktop/kcm_kwin_virtualdesktops.json
14 | kcms/effects/kcm_kwin_effects.json
15 | kcms/options/kcm_kwinoptions.json
16 | kcms/rules/kcm_kwinrules.json
17 | kcms/screenedges/kcm_kwinscreenedges.json
18 | kcms/screenedges/kcm_kwintouchscreen.json
19 | kcms/scripts/kcm_kwin_scripts.json
20 | kcms/tabbox/kcm_kwintabbox.json
21 | kcms/tabbox/thumbnails/*
22 | Copyright: 2023 Roman Gilg
23 | License: GPL-2.0-or-later
24 |
--------------------------------------------------------------------------------
/.versionrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "header": "\n# Changelog\nAll notable changes to Theseus' Ship will be documented in this file.",
3 | "types": [
4 | {"type": "feat", "section": "Features"},
5 | {"type": "fix", "section": "Bug Fixes"},
6 | {"type": "chore", "hidden": true},
7 | {"type": "docs", "hidden": true},
8 | {"type": "style", "hidden": true},
9 | {"type": "refactor", "section": "Refactors"},
10 | {"type": "perf", "hidden": true},
11 | {"type": "test", "hidden": true}
12 | ],
13 | "issuePrefixes": ["Closes #", "Fixes #"]
14 | }
15 |
--------------------------------------------------------------------------------
/LICENSES/GPL-2.0-only.txt:
--------------------------------------------------------------------------------
1 | ../LICENSE
--------------------------------------------------------------------------------
/LICENSES/MIT.txt:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c)
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is furnished
10 | to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
18 | OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
19 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
20 | OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 |
--------------------------------------------------------------------------------
/Messages.sh:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env bash
2 |
3 | # SPDX-FileCopyrightText: 2023 Roman Gilg
4 | #
5 | # SPDX-License-Identifier: GPL-2.0-or-later
6 |
7 | $EXTRACTRC `find . -not -path "./kcms/*" \( -name \*.kcfg -o -name \*.ui \)` >> rc.cpp || exit 11
8 | $XGETTEXT `find . -not -path "./kcms/*" \( -name \*.cpp -o -name \*.qml \)` -o $podir/kwin.pot
9 | rm -f rc.cpp
10 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
11 |
Theseus' Ship
12 |
13 |
14 | Theseus' Ship is a robust, fast and versatile,
15 | yet easy to use composited window manager for the
16 | [Wayland](https://wayland.freedesktop.org/) and
17 | [X11](https://en.wikipedia.org/wiki/X_Window_System)
18 | windowing systems on Linux.
19 |
20 |
21 |
22 |
25 |
26 |
27 |
28 | Theseus' Ship is intended to be used as part of a
29 | [KDE Plasma Desktop](https://kde.org/plasma-desktop/).
30 | Theseus' Ship is a reboot of KDE's
31 | [KWin](https://en.wikipedia.org/wiki/KWin).
32 | It differentates itself from KWin in that it uses [The Compositor Modules](https://github.com/winft/como).
33 |
34 | ## Installation
35 | Theseus' Ship can be compiled from source.
36 | If you do that manually you have to check for your specific distribution
37 | how to best get the required dependencies.
38 | You can also make use of the FDBuild tool to automate that process as described
39 | [here](CONTRIBUTING.md#compiling).
40 |
41 | ## Usage
42 | Theseus' Ship can be used as a drop-in replacement for KWin inside a KDE Plasma Desktop session.
43 | After installation and a system restart the Theseus' Ship binary will execute.
44 | All configuration, plugins and shell interaction transfer over.
45 |
46 | ## Development
47 | The [CONTRIBUTING.md](CONTRIBUTING.md) document contains all information
48 | on how to get started with:
49 | * providing useful debug information,
50 | * building Theseus' Ship
51 | * and doing your first code submission to the project.
52 |
--------------------------------------------------------------------------------
/cmake/modules/Packing.cmake:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2024 Roman Gilg
2 | # SPDX-License-Identifier: GPL-2.0-or-later
3 |
4 | set(CPACK_PACKAGE_NAME theseus-ship CACHE STRING "Deb package name")
5 | set(CPACK_PACKAGE_VENDOR "WinFT")
6 |
7 | set(CPACK_PACKAGE_CONTACT "subdiff@gmail.com")
8 | set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Roman Gilg")
9 |
10 | set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
11 | set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
12 | set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
13 |
14 | set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
15 | set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
16 |
17 | set(CPACK_VERBATIM_VARIABLES YES)
18 | set(CPACK_PACKAGE_INSTALL_DIRECTORY ${CPACK_PACKAGE_NAME})
19 | set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT)
20 |
21 | include(CPack)
22 |
--------------------------------------------------------------------------------
/config-theseus-ship.h.cmake:
--------------------------------------------------------------------------------
1 | /*
2 | SPDX-FileCopyrightText: 2024 Roman Gilg
3 |
4 | SPDX-License-Identifier: GPL-2.0-or-later
5 | */
6 |
7 | #cmakedefine01 HAVE_BREEZE_DECO
8 | #if HAVE_BREEZE_DECO
9 | #define BREEZE_KDECORATION_PLUGIN_ID "${BREEZE_KDECORATION_PLUGIN_ID}"
10 | #endif
11 |
--------------------------------------------------------------------------------
/docs/assets/desktop-screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/winft/theseus-ship/ad6c7ab08f08a5948aee5f2bd59953ee9b709690/docs/assets/desktop-screenshot.png
--------------------------------------------------------------------------------
/docs/assets/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/winft/theseus-ship/ad6c7ab08f08a5948aee5f2bd59953ee9b709690/docs/assets/logo.png
--------------------------------------------------------------------------------
/kcms/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2023 Roman Gilg
2 | #
3 | # SPDX-License-Identifier: GPL-2.0-or-later
4 |
5 | remove_definitions(-DQT_NO_CAST_FROM_ASCII -DQT_STRICT_ITERATORS -DQT_NO_CAST_FROM_BYTEARRAY -DQT_NO_KEYWORDS)
6 |
7 | add_subdirectory(common)
8 | add_subdirectory(compositing)
9 | add_subdirectory(options)
10 | add_subdirectory(decoration)
11 | add_subdirectory(rules)
12 | add_subdirectory(screenedges)
13 | add_subdirectory(scripts)
14 | add_subdirectory(desktop)
15 | add_subdirectory(effects)
16 |
17 | if (KWIN_BUILD_TABBOX)
18 | add_subdirectory(tabbox)
19 | endif()
20 |
--------------------------------------------------------------------------------
/kcms/common/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2023 Roman Gilg
2 | #
3 | # SPDX-License-Identifier: GPL-2.0-or-later
4 |
5 | # KI18N Translation Domain for this library
6 | add_definitions(-DTRANSLATION_DOMAIN=\"kcmkwincommon\")
7 |
8 | set(kcmkwincommon_SRC
9 | effectsmodel.cpp
10 | )
11 |
12 | qt_add_dbus_interface(kcmkwincommon_SRC
13 | ${KWIN_EFFECTS_INTERFACE} kwin_effects_interface
14 | )
15 |
16 | add_library(kcmkwincommon SHARED ${kcmkwincommon_SRC})
17 |
18 | target_link_libraries(kcmkwincommon
19 | como::base
20 | KF6::ConfigCore
21 | KF6::CoreAddons
22 | KF6::I18n
23 | KF6::KCMUtils
24 | KF6::Package
25 | Qt::Core
26 | Qt::DBus
27 | )
28 |
29 | set_target_properties(kcmkwincommon PROPERTIES
30 | VERSION ${CMAKE_PROJECT_VERSION}
31 | SOVERSION ${CMAKE_PROJECT_VERSION_MAJOR}
32 | )
33 |
34 | install(TARGETS kcmkwincommon LIBRARY NAMELINK_SKIP)
35 |
36 | set(kcm_kwin4_genericscripted_SRCS generic_scripted_config.cpp)
37 |
38 | qt_add_dbus_interface(kcm_kwin4_genericscripted_SRCS
39 | ${KWIN_EFFECTS_INTERFACE} kwin_effects_interface
40 | )
41 |
42 | add_library(kcm_kwin4_genericscripted MODULE ${kcm_kwin4_genericscripted_SRCS})
43 | target_link_libraries(kcm_kwin4_genericscripted
44 | KF6::I18n
45 | KF6::KCMUtils
46 | Qt::DBus
47 | Qt::UiTools
48 | como::render
49 | )
50 | install(TARGETS kcm_kwin4_genericscripted DESTINATION ${KDE_INSTALL_PLUGINDIR}/kwin/effects/configs)
51 |
--------------------------------------------------------------------------------
/kcms/common/Messages.sh:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env bash
2 |
3 | # SPDX-FileCopyrightText: 2023 Roman Gilg
4 | #
5 | # SPDX-License-Identifier: GPL-2.0-or-later
6 |
7 | $XGETTEXT `find . -name \*.cpp` -o $podir/kcmkwincommon.pot
8 |
--------------------------------------------------------------------------------
/kcms/common/generic_scripted_config.h:
--------------------------------------------------------------------------------
1 | /*
2 | SPDX-FileCopyrightText: 2013 Martin Gräßlin
3 |
4 | SPDX-License-Identifier: GPL-2.0-or-later
5 | */
6 | #pragma once
7 |
8 | #include
9 | #include
10 | #include
11 |
12 | class KLocalizedTranslator;
13 |
14 | namespace theseus_ship::scripting
15 | {
16 |
17 | class generic_scripted_config_factory : public KPluginFactory
18 | {
19 | Q_OBJECT
20 | Q_PLUGIN_METADATA(IID "org.kde.KPluginFactory" FILE "generic_scripted_config.json")
21 | Q_INTERFACES(KPluginFactory)
22 |
23 | protected:
24 | QObject* create(const char* iface,
25 | QWidget* parentWidget,
26 | QObject* parent,
27 | const QVariantList& args) override;
28 | };
29 |
30 | class generic_scripted_config : public KCModule
31 | {
32 | Q_OBJECT
33 |
34 | public:
35 | generic_scripted_config(const QString& keyword, QWidget* parent);
36 | ~generic_scripted_config() override;
37 |
38 | public Q_SLOTS:
39 | void save() override;
40 |
41 | protected:
42 | const QString& packageName() const;
43 | void createUi();
44 | virtual QString typeName() const = 0;
45 | virtual KConfigGroup configGroup() = 0;
46 | virtual void reload();
47 |
48 | private:
49 | QString m_packageName;
50 | KLocalizedTranslator* m_translator;
51 | };
52 |
53 | class scripted_effect_config : public generic_scripted_config
54 | {
55 | Q_OBJECT
56 | public:
57 | scripted_effect_config(const QString& keyword, QWidget* parent);
58 | ~scripted_effect_config() override;
59 |
60 | protected:
61 | QString typeName() const override;
62 | KConfigGroup configGroup() override;
63 | void reload() override;
64 | };
65 |
66 | class scripting_config : public generic_scripted_config
67 | {
68 | Q_OBJECT
69 | public:
70 | scripting_config(const QString& keyword, QWidget* parent);
71 | ~scripting_config() override;
72 |
73 | protected:
74 | QString typeName() const override;
75 | KConfigGroup configGroup() override;
76 | void reload() override;
77 | };
78 |
79 | inline const QString& generic_scripted_config::packageName() const
80 | {
81 | return m_packageName;
82 | }
83 |
84 | }
85 |
--------------------------------------------------------------------------------
/kcms/common/generic_scripted_config.json:
--------------------------------------------------------------------------------
1 | {
2 | "Type": "Service",
3 | "X-KDE-Library": "kcm_kwin4_genericscripted",
4 | "X-KDE-ServiceTypes": [
5 | "KCModule"
6 | ]
7 | }
8 |
--------------------------------------------------------------------------------
/kcms/compositing/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2023 Roman Gilg
2 | #
3 | # SPDX-License-Identifier: GPL-2.0-or-later
4 |
5 | #########################################################################
6 | # KI18N Translation Domain for this library
7 | add_definitions(-DTRANSLATION_DOMAIN=\"kcmkwincompositing\")
8 |
9 | ################# configure checks and create the configured files #################
10 |
11 | set(kwincompositing_SRC
12 | main.cpp
13 | kwincompositingdata.cpp
14 | )
15 |
16 | kconfig_add_kcfg_files(kwincompositing_SRC kwincompositing_setting.kcfgc GENERATE_MOC)
17 |
18 | qt_add_dbus_interface(kwincompositing_SRC
19 | ${KWIN_COMPOSITING_INTERFACE} kwin_compositing_interface
20 | )
21 |
22 | ki18n_wrap_ui(kwincompositing_SRC compositing.ui)
23 |
24 | kcoreaddons_add_plugin(kwincompositing SOURCES ${kwincompositing_SRC} INSTALL_NAMESPACE "plasma/kcms/systemsettings_qwidgets")
25 | kcmutils_generate_desktop_file(kwincompositing)
26 |
27 | target_link_libraries(kwincompositing
28 | KF6::ConfigCore
29 | KF6::CoreAddons
30 | KF6::I18n
31 | KF6::KCMUtils
32 | KF6::Service
33 | Qt::DBus
34 | Qt::Widgets
35 | como::render
36 | )
37 |
--------------------------------------------------------------------------------
/kcms/compositing/Messages.sh:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env bash
2 |
3 | # SPDX-FileCopyrightText: 2023 Roman Gilg
4 | #
5 | # SPDX-License-Identifier: GPL-2.0-or-later
6 |
7 | $EXTRACTRC `find . -name \*.ui` >> rc.cpp || exit 11
8 | $XGETTEXT *.cpp -o $podir/kcmkwincompositing.pot
9 |
--------------------------------------------------------------------------------
/kcms/compositing/kwincompositing_setting.kcfg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
13 |
14 |
15 |
16 |
17 | 1.0
18 |
19 |
20 |
21 |
22 |
23 |
24 | Shown
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 | 2
34 |
35 |
36 |
37 | true
38 |
39 |
40 |
41 | true
42 |
43 |
44 |
45 | OpenGL
46 |
47 |
48 |
49 |
50 |
51 |
52 | true
53 |
54 |
55 |
56 | static_cast<int>(como::render::animation_curve::linear)
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
--------------------------------------------------------------------------------
/kcms/compositing/kwincompositing_setting.kcfgc:
--------------------------------------------------------------------------------
1 | ; SPDX-FileCopyrightText: 2023 Roman Gilg
2 | ;
3 | ; SPDX-License-Identifier: GPL-2.0-or-later
4 |
5 | File=kwincompositing_setting.kcfg
6 | ClassName=KWinCompositingSetting
7 | Mutators=true
8 | DefaultValueGetters=true
9 | ParentInConstructor=true
10 | IncludeFiles=como/render/types.h
11 |
--------------------------------------------------------------------------------
/kcms/compositing/kwincompositingdata.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | SPDX-FileCopyrightText: 2020 Cyril Rossi
3 |
4 | SPDX-License-Identifier: GPL-2.0-or-later
5 | */
6 |
7 | #include "kwincompositingdata.h"
8 |
9 | #include "kwincompositing_setting.h"
10 |
11 | KWinCompositingData::KWinCompositingData(QObject* parent)
12 | : KCModuleData(parent)
13 | , m_settings(new KWinCompositingSetting(this))
14 |
15 | {
16 | }
17 |
18 | bool KWinCompositingData::isDefaults() const
19 | {
20 | bool defaults = true;
21 | auto const items = m_settings->items();
22 | for (const auto& item : items) {
23 | if (item->key() != QStringLiteral("OpenGLIsUnsafe")) {
24 | defaults &= item->isDefault();
25 | }
26 | }
27 | return defaults;
28 | }
29 |
--------------------------------------------------------------------------------
/kcms/compositing/kwincompositingdata.h:
--------------------------------------------------------------------------------
1 | /*
2 | SPDX-FileCopyrightText: 2020 Cyril Rossi
3 |
4 | SPDX-License-Identifier: GPL-2.0-or-later
5 | */
6 |
7 | #ifndef KWINCOMPOSITINGDATA_H
8 | #define KWINCOMPOSITINGDATA_H
9 |
10 | #include
11 |
12 | #include "kcmoduledata.h"
13 |
14 | class KWinCompositingSetting;
15 |
16 | class KWinCompositingData : public KCModuleData
17 | {
18 | Q_OBJECT
19 |
20 | public:
21 | explicit KWinCompositingData(QObject* parent);
22 |
23 | bool isDefaults() const override;
24 |
25 | private:
26 | KWinCompositingSetting* m_settings;
27 | };
28 |
29 | #endif // KWINCOMPOSITINGDATA_H
30 |
--------------------------------------------------------------------------------
/kcms/decoration/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2023 Roman Gilg
2 | #
3 | # SPDX-License-Identifier: GPL-2.0-or-later
4 |
5 | # KI18N Translation Domain for this library
6 | add_definitions(-DTRANSLATION_DOMAIN=\"kcm_kwindecoration\")
7 |
8 | add_subdirectory(declarative-plugin)
9 |
10 | set(kcmkwindecoration_SRCS
11 | declarative-plugin/buttonsmodel.cpp
12 | decorationmodel.cpp
13 | kcm.cpp
14 | utils.cpp
15 | )
16 |
17 | kcmutils_generate_module_data(
18 | kcmkwindecoration_SRCS
19 | MODULE_DATA_HEADER kwindecorationdata.h
20 | MODULE_DATA_CLASS_NAME KWinDecorationData
21 | SETTINGS_HEADERS kwindecorationsettings.h
22 | SETTINGS_CLASSES KWinDecorationSettings
23 | )
24 |
25 | kconfig_add_kcfg_files(kcmkwindecoration_SRCS kwindecorationsettings.kcfgc GENERATE_MOC)
26 |
27 | kcmutils_add_qml_kcm(kcm_kwindecoration SOURCES ${kcmkwindecoration_SRCS})
28 |
29 | target_link_libraries(kcm_kwindecoration
30 | KDecoration2::KDecoration
31 | KF6::I18n
32 | KF6::KCMUtils
33 | Qt::DBus
34 | Qt::Quick
35 | como::base
36 | )
37 |
38 | set(kwin-applywindowdecoration_SRCS
39 | kwin-applywindowdecoration.cpp
40 | decorationmodel.cpp
41 | utils.cpp
42 | )
43 |
44 | kconfig_add_kcfg_files(kwin-applywindowdecoration_SRCS kwindecorationsettings.kcfgc GENERATE_MOC)
45 | add_executable(kwin-applywindowdecoration ${kwin-applywindowdecoration_SRCS})
46 |
47 | target_link_libraries(kwin-applywindowdecoration
48 | KDecoration2::KDecoration
49 | KF6::I18n
50 | KF6::KCMUtils
51 | Qt::DBus
52 | como::base
53 | )
54 |
55 | configure_file(window-decorations.knsrc.cmake ${CMAKE_CURRENT_BINARY_DIR}/window-decorations.knsrc)
56 |
57 | install(FILES kwindecorationsettings.kcfg DESTINATION ${KDE_INSTALL_KCFGDIR})
58 | install(FILES ${CMAKE_CURRENT_BINARY_DIR}/window-decorations.knsrc DESTINATION ${KDE_INSTALL_KNSRCDIR})
59 | install(TARGETS kwin-applywindowdecoration DESTINATION ${KDE_INSTALL_LIBEXECDIR})
60 |
--------------------------------------------------------------------------------
/kcms/decoration/Messages.sh:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env bash
2 |
3 | # SPDX-FileCopyrightText: 2023 Roman Gilg
4 | #
5 | # SPDX-License-Identifier: GPL-2.0-or-later
6 |
7 | $XGETTEXT `find . -name "*.cpp" -o -name "*.qml"` -o $podir/kcm_kwindecoration.pot
8 |
--------------------------------------------------------------------------------
/kcms/decoration/declarative-plugin/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2023 Roman Gilg
2 | #
3 | # SPDX-License-Identifier: GPL-2.0-or-later
4 | ecm_add_qml_module(kdecorationprivatedeclarative URI org.kde.kwin.private.kdecoration DEPENDENCIES QtCore QtQuick GENERATE_PLUGIN_SOURCE)
5 |
6 | target_sources(kdecorationprivatedeclarative PRIVATE
7 | previewbutton.cpp
8 | previewbridge.cpp
9 | previewclient.cpp
10 | previewitem.cpp
11 | previewsettings.cpp
12 | buttonsmodel.cpp
13 | types.h
14 | )
15 |
16 | target_link_libraries(kdecorationprivatedeclarative PRIVATE
17 | como::win
18 | KDecoration2::KDecoration
19 | KDecoration2::KDecoration2Private
20 | KF6::CoreAddons
21 | KF6::I18n
22 | KF6::KCMUtils
23 | KF6::Service
24 | Qt::DBus
25 | Qt::Quick
26 | )
27 |
28 | ecm_finalize_qml_module(kdecorationprivatedeclarative)
29 |
--------------------------------------------------------------------------------
/kcms/decoration/declarative-plugin/buttonsmodel.h:
--------------------------------------------------------------------------------
1 | /*
2 | SPDX-FileCopyrightText: 2014 Martin Gräßlin
3 |
4 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
5 | */
6 | #ifndef KDECOARTIONS_PREVIEW_BUTTONS_MODEL_H
7 | #define KDECOARTIONS_PREVIEW_BUTTONS_MODEL_H
8 |
9 | #include
10 | #include
11 |
12 | #include
13 |
14 | namespace KDecoration2
15 | {
16 |
17 | namespace Preview
18 | {
19 | class PreviewBridge;
20 |
21 | class ButtonsModel : public QAbstractListModel
22 | {
23 | Q_OBJECT
24 | QML_ELEMENT
25 | public:
26 | explicit ButtonsModel(const QVector& buttons, QObject* parent = nullptr);
27 | explicit ButtonsModel(QObject* parent = nullptr);
28 | ~ButtonsModel() override;
29 | QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
30 | int rowCount(const QModelIndex& parent = QModelIndex()) const override;
31 | QHash roleNames() const override;
32 |
33 | QVector buttons() const
34 | {
35 | return m_buttons;
36 | }
37 |
38 | Q_INVOKABLE void clear();
39 | Q_INVOKABLE void remove(int index);
40 | Q_INVOKABLE void up(int index);
41 | Q_INVOKABLE void down(int index);
42 | Q_INVOKABLE void move(int sourceIndex, int targetIndex);
43 |
44 | void replace(const QVector& buttons);
45 | void add(DecorationButtonType type);
46 | Q_INVOKABLE void add(int index, int type);
47 |
48 | private:
49 | QVector m_buttons;
50 | };
51 |
52 | }
53 | }
54 |
55 | #endif
56 |
--------------------------------------------------------------------------------
/kcms/decoration/declarative-plugin/previewbutton.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | SPDX-FileCopyrightText: 2014 Martin Gräßlin
3 |
4 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
5 | */
6 | #include "previewbutton.h"
7 | #include "previewbridge.h"
8 | #include "previewclient.h"
9 | #include "previewsettings.h"
10 |
11 | #include
12 |
13 | #include
14 |
15 | namespace KDecoration2
16 | {
17 |
18 | namespace Preview
19 | {
20 |
21 | PreviewButtonItem::PreviewButtonItem(QQuickItem* parent)
22 | : QQuickPaintedItem(parent)
23 | {
24 | }
25 |
26 | PreviewButtonItem::~PreviewButtonItem() = default;
27 |
28 | void PreviewButtonItem::setType(int type)
29 | {
30 | setType(KDecoration2::DecorationButtonType(type));
31 | }
32 |
33 | void PreviewButtonItem::setType(KDecoration2::DecorationButtonType type)
34 | {
35 | if (m_type == type) {
36 | return;
37 | }
38 | m_type = type;
39 | Q_EMIT typeChanged();
40 | }
41 |
42 | KDecoration2::DecorationButtonType PreviewButtonItem::type() const
43 | {
44 | return m_type;
45 | }
46 |
47 | PreviewBridge* PreviewButtonItem::bridge() const
48 | {
49 | return m_bridge.data();
50 | }
51 |
52 | void PreviewButtonItem::setBridge(PreviewBridge* bridge)
53 | {
54 | if (m_bridge == bridge) {
55 | return;
56 | }
57 | m_bridge = bridge;
58 | Q_EMIT bridgeChanged();
59 | }
60 |
61 | Settings* PreviewButtonItem::settings() const
62 | {
63 | return m_settings.data();
64 | }
65 |
66 | void PreviewButtonItem::setSettings(Settings* settings)
67 | {
68 | if (m_settings == settings) {
69 | return;
70 | }
71 | m_settings = settings;
72 | Q_EMIT settingsChanged();
73 | }
74 |
75 | int PreviewButtonItem::typeAsInt() const
76 | {
77 | return int(m_type);
78 | }
79 |
80 | void PreviewButtonItem::componentComplete()
81 | {
82 | QQuickPaintedItem::componentComplete();
83 | createButton();
84 | }
85 |
86 | void PreviewButtonItem::createButton()
87 | {
88 | if (m_type == KDecoration2::DecorationButtonType::Custom || m_decoration || !m_settings
89 | || !m_bridge) {
90 | return;
91 | }
92 | m_decoration = m_bridge->createDecoration(this);
93 | if (!m_decoration) {
94 | return;
95 | }
96 | auto client = m_bridge->lastCreatedClient();
97 | client->setMinimizable(true);
98 | client->setMaximizable(true);
99 | client->setActive(false);
100 | client->setProvidesContextHelp(true);
101 | m_decoration->setSettings(m_settings->settings());
102 | m_decoration->init();
103 | m_button = m_bridge->createButton(m_decoration, m_type);
104 | connect(this, &PreviewButtonItem::widthChanged, this, &PreviewButtonItem::syncGeometry);
105 | connect(this, &PreviewButtonItem::heightChanged, this, &PreviewButtonItem::syncGeometry);
106 | syncGeometry();
107 | }
108 |
109 | void PreviewButtonItem::syncGeometry()
110 | {
111 | if (!m_button) {
112 | return;
113 | }
114 | m_button->setGeometry(QRect(0, 0, width(), height()));
115 | }
116 |
117 | void PreviewButtonItem::paint(QPainter* painter)
118 | {
119 | if (!m_button) {
120 | return;
121 | }
122 |
123 | const QRect rect(0, 0, width(), height());
124 | if (type() == KDecoration2::DecorationButtonType::Spacer) {
125 | static const QIcon icon = QIcon::fromTheme(QStringLiteral("distribute-horizontal"));
126 | icon.paint(painter, rect);
127 | } else {
128 | m_button->paint(painter, rect);
129 | }
130 |
131 | painter->setCompositionMode(QPainter::CompositionMode_SourceAtop);
132 | painter->fillRect(rect, m_color);
133 | }
134 |
135 | void PreviewButtonItem::setColor(const QColor& color)
136 | {
137 | m_color = color;
138 | m_color.setAlpha(127);
139 | update();
140 | }
141 |
142 | }
143 | }
144 |
145 | #include "moc_previewbutton.cpp"
146 |
--------------------------------------------------------------------------------
/kcms/decoration/declarative-plugin/previewbutton.h:
--------------------------------------------------------------------------------
1 | /*
2 | SPDX-FileCopyrightText: 2014 Martin Gräßlin
3 |
4 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
5 | */
6 | #ifndef KDECOARTIONS_PREVIEW_BUTTON_ITEM_H
7 | #define KDECOARTIONS_PREVIEW_BUTTON_ITEM_H
8 |
9 | #include
10 | #include
11 | #include
12 | #include
13 |
14 | namespace KDecoration2
15 | {
16 | class Decoration;
17 |
18 | namespace Preview
19 | {
20 | class PreviewBridge;
21 | class Settings;
22 |
23 | class PreviewButtonItem : public QQuickPaintedItem
24 | {
25 | Q_OBJECT
26 | QML_NAMED_ELEMENT(Button)
27 | Q_PROPERTY(KDecoration2::Preview::PreviewBridge* bridge READ bridge WRITE setBridge NOTIFY
28 | bridgeChanged)
29 | Q_PROPERTY(KDecoration2::Preview::Settings* settings READ settings WRITE setSettings NOTIFY
30 | settingsChanged)
31 | Q_PROPERTY(int type READ typeAsInt WRITE setType NOTIFY typeChanged)
32 | Q_PROPERTY(QColor color READ color WRITE setColor)
33 |
34 | public:
35 | explicit PreviewButtonItem(QQuickItem* parent = nullptr);
36 | ~PreviewButtonItem() override;
37 | void paint(QPainter* painter) override;
38 |
39 | PreviewBridge* bridge() const;
40 | void setBridge(PreviewBridge* bridge);
41 |
42 | Settings* settings() const;
43 | void setSettings(Settings* settings);
44 |
45 | KDecoration2::DecorationButtonType type() const;
46 | int typeAsInt() const;
47 | void setType(KDecoration2::DecorationButtonType type);
48 | void setType(int type);
49 |
50 | const QColor& color() const
51 | {
52 | return m_color;
53 | }
54 | void setColor(const QColor& color);
55 |
56 | Q_SIGNALS:
57 | void bridgeChanged();
58 | void typeChanged();
59 | void settingsChanged();
60 |
61 | protected:
62 | void componentComplete() override;
63 |
64 | private:
65 | void createButton();
66 | void syncGeometry();
67 | QColor m_color;
68 | QPointer m_bridge;
69 | QPointer m_settings;
70 | KDecoration2::Decoration* m_decoration = nullptr;
71 | KDecoration2::DecorationButton* m_button = nullptr;
72 | KDecoration2::DecorationButtonType m_type = KDecoration2::DecorationButtonType::Custom;
73 | };
74 |
75 | } // Preview
76 | } // KDecoration2
77 |
78 | #endif
79 |
--------------------------------------------------------------------------------
/kcms/decoration/declarative-plugin/previewitem.h:
--------------------------------------------------------------------------------
1 | /*
2 | SPDX-FileCopyrightText: 2014 Martin Gräßlin
3 |
4 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
5 | */
6 | #ifndef KDECOARTIONS_PREVIEW_ITEM_H
7 | #define KDECOARTIONS_PREVIEW_ITEM_H
8 |
9 | #include
10 | #include
11 |
12 | namespace KDecoration2
13 | {
14 | class Decoration;
15 | class DecorationShadow;
16 | class DecorationSettings;
17 |
18 | namespace Preview
19 | {
20 | class PreviewBridge;
21 | class PreviewClient;
22 | class Settings;
23 |
24 | class PreviewItem : public QQuickPaintedItem
25 | {
26 | Q_OBJECT
27 | Q_PROPERTY(KDecoration2::Decoration* decoration READ decoration NOTIFY decorationChanged)
28 | Q_PROPERTY(KDecoration2::Preview::PreviewBridge* bridge READ bridge WRITE setBridge NOTIFY
29 | bridgeChanged)
30 | Q_PROPERTY(KDecoration2::Preview::Settings* settings READ settings WRITE setSettings NOTIFY
31 | settingsChanged)
32 | Q_PROPERTY(KDecoration2::Preview::PreviewClient* client READ client)
33 | Q_PROPERTY(KDecoration2::DecorationShadow* shadow READ shadow NOTIFY shadowChanged)
34 | Q_PROPERTY(QColor windowColor READ windowColor WRITE setWindowColor NOTIFY windowColorChanged)
35 | Q_PROPERTY(bool drawBackground READ isDrawingBackground WRITE setDrawingBackground NOTIFY
36 | drawingBackgroundChanged)
37 | public:
38 | PreviewItem(QQuickItem* parent = nullptr);
39 | ~PreviewItem() override;
40 | void paint(QPainter* painter) override;
41 |
42 | KDecoration2::Decoration* decoration() const;
43 | void setDecoration(KDecoration2::Decoration* deco);
44 |
45 | QColor windowColor() const;
46 | void setWindowColor(const QColor& color);
47 |
48 | bool isDrawingBackground() const;
49 | void setDrawingBackground(bool set);
50 |
51 | PreviewBridge* bridge() const;
52 | void setBridge(PreviewBridge* bridge);
53 |
54 | Settings* settings() const;
55 | void setSettings(Settings* settings);
56 |
57 | PreviewClient* client();
58 | DecorationShadow* shadow() const;
59 |
60 | Q_SIGNALS:
61 | void decorationChanged(KDecoration2::Decoration* deco);
62 | void windowColorChanged(const QColor& color);
63 | void drawingBackgroundChanged(bool);
64 | void bridgeChanged();
65 | void settingsChanged();
66 | void shadowChanged();
67 |
68 | protected:
69 | void mouseDoubleClickEvent(QMouseEvent* event) override;
70 | void mouseMoveEvent(QMouseEvent* event) override;
71 | void mousePressEvent(QMouseEvent* event) override;
72 | void mouseReleaseEvent(QMouseEvent* event) override;
73 | void hoverEnterEvent(QHoverEvent* event) override;
74 | void hoverLeaveEvent(QHoverEvent* event) override;
75 | void hoverMoveEvent(QHoverEvent* event) override;
76 | void componentComplete() override;
77 |
78 | private:
79 | void paintShadow(QPainter* painter,
80 | int& paddingLeft,
81 | int& paddingRight,
82 | int& paddingTop,
83 | int& paddingBottom);
84 | template
85 | void proxyPassEvent(E* event) const;
86 | void syncSize();
87 | void createDecoration();
88 | Decoration* m_decoration;
89 | QColor m_windowColor;
90 | bool m_drawBackground = true;
91 | QPointer m_bridge;
92 | QPointer m_settings;
93 | QPointer m_client;
94 | };
95 |
96 | } // Preview
97 | } // KDecoration2
98 |
99 | #endif
100 |
--------------------------------------------------------------------------------
/kcms/decoration/declarative-plugin/types.h:
--------------------------------------------------------------------------------
1 | /*
2 | SPDX-FileCopyrightText: 2024 Nicolas Fella
3 |
4 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
5 | */
6 | #pragma once
7 |
8 | #include
9 |
10 | #include
11 | #include
12 |
13 | struct DecorationForeign {
14 | Q_GADGET
15 | QML_ANONYMOUS
16 | QML_FOREIGN(KDecoration2::Decoration)
17 | };
18 |
19 | struct DecorationShadowForeign {
20 | Q_GADGET
21 | QML_ANONYMOUS
22 | QML_FOREIGN(KDecoration2::DecorationShadow)
23 | };
24 |
--------------------------------------------------------------------------------
/kcms/decoration/decorationmodel.h:
--------------------------------------------------------------------------------
1 | /*
2 | SPDX-FileCopyrightText: 2014 Martin Gräßlin
3 |
4 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
5 | */
6 | #ifndef KDECORATION_DECORATION_MODEL_H
7 | #define KDECORATION_DECORATION_MODEL_H
8 |
9 | #include "utils.h"
10 |
11 | #include
12 | #include
13 |
14 | namespace KDecoration2
15 | {
16 |
17 | namespace Configuration
18 | {
19 |
20 | class DecorationsModel : public QAbstractListModel
21 | {
22 | Q_OBJECT
23 | public:
24 | enum DecorationRole {
25 | PluginNameRole = Qt::UserRole + 1,
26 | ThemeNameRole,
27 | ConfigurationRole,
28 | RecommendedBorderSizeRole,
29 | KcmoduleNameRole,
30 | };
31 |
32 | public:
33 | explicit DecorationsModel(QObject* parent = nullptr);
34 | ~DecorationsModel() override;
35 |
36 | QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
37 | int rowCount(const QModelIndex& parent = QModelIndex()) const override;
38 | QHash roleNames() const override;
39 |
40 | QModelIndex findDecoration(const QString& pluginName,
41 | const QString& themeName = QString()) const;
42 |
43 | QStringList knsProviders() const
44 | {
45 | return m_knsProviders;
46 | }
47 |
48 | public Q_SLOTS:
49 | void init();
50 |
51 | private:
52 | std::vector m_plugins;
53 | QStringList m_knsProviders;
54 | };
55 |
56 | }
57 | }
58 |
59 | #endif
60 |
--------------------------------------------------------------------------------
/kcms/decoration/kcm.h:
--------------------------------------------------------------------------------
1 | /*
2 | SPDX-FileCopyrightText: 2019 Valerio Pilo
3 | SPDX-FileCopyrightText: 2019 Cyril Rossi
4 |
5 | SPDX-License-Identifier: LGPL-2.0-only
6 | */
7 |
8 | #pragma once
9 |
10 | #include "utils.h"
11 |
12 | #include
13 | #include
14 | #include
15 |
16 | namespace KDecoration2
17 | {
18 | enum class BorderSize;
19 |
20 | namespace Preview
21 | {
22 | class ButtonsModel;
23 | }
24 | namespace Configuration
25 | {
26 | class DecorationsModel;
27 | }
28 | }
29 |
30 | class KWinDecorationSettings;
31 | class KWinDecorationData;
32 |
33 | class KCMKWinDecoration : public KQuickManagedConfigModule
34 | {
35 | Q_OBJECT
36 | Q_PROPERTY(KWinDecorationSettings* settings READ settings CONSTANT)
37 | Q_PROPERTY(QSortFilterProxyModel* themesModel READ themesModel CONSTANT)
38 | Q_PROPERTY(QStringList borderSizesModel READ borderSizesModel NOTIFY themeChanged)
39 | Q_PROPERTY(int borderIndex READ borderIndex WRITE setBorderIndex NOTIFY borderIndexChanged)
40 | Q_PROPERTY(int borderSize READ borderSize NOTIFY borderSizeChanged)
41 | Q_PROPERTY(int recommendedBorderSize READ recommendedBorderSize CONSTANT)
42 | Q_PROPERTY(int theme READ theme WRITE setTheme NOTIFY themeChanged)
43 | Q_PROPERTY(QAbstractListModel* leftButtonsModel READ leftButtonsModel NOTIFY buttonsChanged)
44 | Q_PROPERTY(QAbstractListModel* rightButtonsModel READ rightButtonsModel NOTIFY buttonsChanged)
45 | Q_PROPERTY(QAbstractListModel* availableButtonsModel READ availableButtonsModel CONSTANT)
46 |
47 | public:
48 | KCMKWinDecoration(QObject* parent, const KPluginMetaData& metaData);
49 |
50 | KWinDecorationSettings* settings() const;
51 | QSortFilterProxyModel* themesModel() const;
52 | QAbstractListModel* leftButtonsModel();
53 | QAbstractListModel* rightButtonsModel();
54 | QAbstractListModel* availableButtonsModel() const;
55 | QStringList borderSizesModel() const;
56 | int borderIndex() const;
57 | int borderSize() const;
58 | int recommendedBorderSize() const;
59 | int theme() const;
60 |
61 | void setBorderIndex(int index);
62 | void setBorderSize(int index);
63 | void setBorderSize(KDecoration2::BorderSize size);
64 | void setTheme(int index);
65 |
66 | Q_SIGNALS:
67 | void themeChanged();
68 | void borderIndexChanged();
69 | void borderSizeChanged();
70 |
71 | public Q_SLOTS:
72 | void load() override;
73 | void save() override;
74 | void defaults() override;
75 | void reloadKWinSettings();
76 |
77 | private Q_SLOTS:
78 | void onLeftButtonsChanged();
79 | void onRightButtonsChanged();
80 |
81 | private:
82 | bool isSaveNeeded() const override;
83 |
84 | int borderSizeIndexFromString(const QString& size) const;
85 | QString borderSizeIndexToString(int index) const;
86 |
87 | KDecoration2::Configuration::DecorationsModel* m_themesModel;
88 | QSortFilterProxyModel* m_proxyThemesModel;
89 |
90 | KDecoration2::Preview::ButtonsModel* m_leftButtonsModel;
91 | KDecoration2::Preview::ButtonsModel* m_rightButtonsModel;
92 | KDecoration2::Preview::ButtonsModel* m_availableButtonsModel;
93 |
94 | int m_borderSizeIndex = -1;
95 | KWinDecorationData* m_data;
96 | };
97 |
--------------------------------------------------------------------------------
/kcms/decoration/kwindecorationsettings.kcfg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
13 | config-theseus-ship.h
14 |
15 |
16 |
17 | Plugin name
18 | #if HAVE_BREEZE_DECO
19 | const QString s_defaultPlugin { QStringLiteral(BREEZE_KDECORATION_PLUGIN_ID) };
20 | #else
21 | const QString s_defaultPlugin { QStringLiteral("org.kde.kwin.aurorae") };
22 | #endif
23 |
24 | s_defaultPlugin
25 |
26 |
27 | Theme name
28 | #if HAVE_BREEZE_DECO
29 | const QString s_defaultTheme { QStringLiteral("Breeze") };
30 | #else
31 | const QString s_defaultTheme { QStringLiteral("kwin4_decoration_qml_plastik") };
32 | #endif
33 |
34 | s_defaultTheme
35 |
36 |
37 | Window border size
38 | Normal
39 |
40 |
41 | Use theme's default window border size
42 | true
43 |
44 |
45 | Close windows by double clicking the menu button
46 | false
47 |
48 |
49 | Show titlebar button tooltips
50 | true
51 |
52 |
53 | Titlebar left buttons
54 | MS
55 |
56 |
57 | Titlebar right buttons
58 | HIAX
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/kcms/decoration/kwindecorationsettings.kcfgc:
--------------------------------------------------------------------------------
1 | ; SPDX-FileCopyrightText: 2023 Roman Gilg
2 | ;
3 | ; SPDX-License-Identifier: GPL-2.0-or-later
4 |
5 | File=kwindecorationsettings.kcfg
6 | ClassName=KWinDecorationSettings
7 | Mutators=true
8 | DefaultValueGetters=true
9 | GenerateProperties=true
10 | ParentInConstructor=true
11 | Notifiers=buttonsOnLeft,buttonsOnRight,theme
12 |
--------------------------------------------------------------------------------
/kcms/decoration/ui/ButtonGroup.qml:
--------------------------------------------------------------------------------
1 | /*
2 | SPDX-FileCopyrightText: 2014 Martin Gräßlin
3 |
4 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
5 | */
6 | import QtQuick
7 |
8 | import org.kde.kirigami 2.20 as Kirigami
9 | import org.kde.kwin.private.kdecoration as KDecoration
10 |
11 | ListView {
12 | id: view
13 | property string key
14 | property bool dragActive: false
15 | property int iconSize: Kirigami.Units.iconSizes.small
16 | orientation: ListView.Horizontal
17 | interactive: false
18 | spacing: Kirigami.Units.smallSpacing
19 | implicitHeight: iconSize
20 | implicitWidth: count * (iconSize + Kirigami.Units.smallSpacing) - Math.min(1, count) * Kirigami.Units.smallSpacing
21 | delegate: Item {
22 | width: view.iconSize
23 | height: view.iconSize
24 | KDecoration.Button {
25 | id: button
26 | property int itemIndex: index
27 | property var buttonsModel: parent.ListView.view.model
28 | bridge: bridgeItem.bridge
29 | settings: settingsItem
30 | type: model["button"]
31 | width: view.iconSize
32 | height: view.iconSize
33 | anchors.fill: Drag.active ? undefined : parent
34 | Drag.keys: [ "decoButtonRemove", view.key ]
35 | Drag.active: dragArea.drag.active
36 | Drag.onActiveChanged: view.dragActive = Drag.active
37 | color: palette.windowText
38 | opacity: parent.enabled ? 1.0 : 0.3
39 | }
40 | MouseArea {
41 | id: dragArea
42 | cursorShape: drag.target.Drag.active ? Qt.ClosedHandCursor : Qt.OpenHandCursor
43 | anchors.fill: parent
44 | drag.target: button
45 | onReleased: {
46 | if (drag.target.Drag.target) {
47 | drag.target.Drag.drop();
48 | } else {
49 | drag.target.Drag.cancel();
50 | }
51 | }
52 | }
53 | }
54 | add: Transition {
55 | NumberAnimation { property: "opacity"; from: 0; to: 1.0; duration: Kirigami.Units.longDuration/2 }
56 | NumberAnimation { property: "scale"; from: 0; to: 1.0; duration: Kirigami.Units.longDuration/2 }
57 | }
58 | move: Transition {
59 | NumberAnimation { property: "opacity"; from: 0; to: 1.0; duration: Kirigami.Units.longDuration/2 }
60 | NumberAnimation { property: "scale"; from: 0; to: 1.0; duration: Kirigami.Units.longDuration/2 }
61 | }
62 | displaced: Transition {
63 | NumberAnimation { properties: "x,y"; duration: Kirigami.Units.longDuration; easing.type: Easing.OutBounce }
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/kcms/decoration/ui/ConfigureTitlebar.qml:
--------------------------------------------------------------------------------
1 | /*
2 | SPDX-FileCopyrightText: 2019 Valerio Pilo
3 | SPDX-FileCopyrightText: 2023 Joshua Goins
4 |
5 | SPDX-License-Identifier: LGPL-2.0-only
6 | */
7 |
8 | import QtQuick
9 | import QtQuick.Layouts
10 | import QtQuick.Controls as QQC2
11 |
12 | import org.kde.kcmutils as KCM
13 | import org.kde.kirigami 2.20 as Kirigami
14 |
15 | KCM.AbstractKCM {
16 | title: i18n("Titlebar Buttons")
17 |
18 | framedView: false
19 |
20 | Rectangle {
21 | anchors.fill: parent
22 | Kirigami.Theme.inherit: false
23 | Kirigami.Theme.colorSet: Kirigami.Theme.View
24 | color: Kirigami.Theme.backgroundColor
25 |
26 | Buttons {
27 | anchors.fill: parent
28 | anchors.margins: Kirigami.Units.largeSpacing
29 | }
30 | }
31 |
32 | footer: ColumnLayout {
33 | QQC2.CheckBox {
34 | id: closeOnDoubleClickOnMenuCheckBox
35 | text: i18nc("checkbox label", "Close windows by double clicking the menu button")
36 | checked: kcm.settings.closeOnDoubleClickOnMenu
37 | onToggled: {
38 | kcm.settings.closeOnDoubleClickOnMenu = checked;
39 | infoLabel.visible = checked;
40 | }
41 |
42 | KCM.SettingStateBinding {
43 | configObject: kcm.settings
44 | settingName: "closeOnDoubleClickOnMenu"
45 | }
46 | }
47 |
48 | Kirigami.InlineMessage {
49 | Layout.fillWidth: true
50 | id: infoLabel
51 | type: Kirigami.MessageType.Information
52 | text: i18nc("popup tip", "Click and hold on the menu button to show the menu.")
53 | showCloseButton: true
54 | visible: false
55 | }
56 |
57 | QQC2.CheckBox {
58 | id: showToolTipsCheckBox
59 | text: i18nc("checkbox label", "Show titlebar button tooltips")
60 | checked: kcm.settings.showToolTips
61 | onToggled: kcm.settings.showToolTips = checked
62 |
63 | KCM.SettingStateBinding {
64 | configObject: kcm.settings
65 | settingName: "showToolTips"
66 | }
67 | }
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/kcms/decoration/ui/main.qml:
--------------------------------------------------------------------------------
1 | /*
2 | SPDX-FileCopyrightText: 2019 Valerio Pilo
3 | SPDX-FileCopyrightText: 2023 Joshua Goins
4 |
5 | SPDX-License-Identifier: LGPL-2.0-only
6 | */
7 |
8 | import QtQuick
9 | import QtQuick.Layouts
10 | import QtQuick.Controls as QQC2
11 |
12 | import org.kde.kcmutils as KCM
13 | import org.kde.kirigami 2.20 as Kirigami
14 | import org.kde.newstuff as NewStuff
15 |
16 | KCM.AbstractKCM {
17 | id: root
18 |
19 | title: kcm.name
20 |
21 | framedView: false
22 |
23 | implicitWidth: Kirigami.Units.gridUnit * 48
24 | implicitHeight: Kirigami.Units.gridUnit * 33
25 |
26 | actions: [
27 | Kirigami.Action {
28 | id: borderSizeComboBox
29 | text: i18nc("Selector label", "Window border size:")
30 |
31 | displayComponent: RowLayout {
32 | QQC2.ComboBox {
33 | id: borderSizeComboBox
34 | currentIndex: kcm.borderIndex
35 | flat: true
36 | model: kcm.borderSizesModel
37 |
38 | onActivated: kcm.borderIndex = currentIndex
39 |
40 | KCM.SettingHighlighter {
41 | highlight: kcm.borderIndex !== 0
42 | }
43 | }
44 | }
45 | },
46 | Kirigami.Action {
47 | icon.name: "configure"
48 | text: i18nc("button text", "Configure Titlebar Buttons…")
49 |
50 | onTriggered: kcm.push("ConfigureTitlebar.qml")
51 | },
52 | NewStuff.Action {
53 | configFile: "window-decorations.knsrc"
54 | text: i18nc("@action:button as in, \"Get New Window Decorations\"", "Get New…")
55 |
56 | onEntryEvent: (entry, event) => {
57 | if (event === NewStuff.Engine.StatusChangedEvent) {
58 | kcm.reloadKWinSettings();
59 | } else if (event === NewStuff.Engine.EntryAdoptedEvent) {
60 | kcm.load();
61 | }
62 | }
63 | }
64 | ]
65 |
66 | Themes {
67 | id: themes
68 | anchors.fill: parent
69 |
70 | KCM.SettingStateBinding {
71 | configObject: kcm.settings
72 | settingName: "pluginName"
73 | target: themes
74 | }
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/kcms/decoration/utils.h:
--------------------------------------------------------------------------------
1 | /*
2 | SPDX-FileCopyrightText: 2019 Valerio Pilo
3 |
4 | SPDX-License-Identifier: LGPL-2.0-only
5 | */
6 |
7 | #pragma once
8 |
9 | #include
10 | #include
11 |
12 | #include
13 |
14 | using DecorationButtonsList = QVector;
15 |
16 | namespace Utils
17 | {
18 |
19 | QString buttonsToString(const DecorationButtonsList& buttons);
20 | DecorationButtonsList buttonsFromString(const QString& buttons);
21 | DecorationButtonsList readDecorationButtons(const KConfigGroup& config,
22 | const QString& key,
23 | const DecorationButtonsList& defaultValue);
24 |
25 | KDecoration2::BorderSize stringToBorderSize(const QString& name);
26 | QString borderSizeToString(KDecoration2::BorderSize size);
27 |
28 | const QMap& getBorderSizeNames();
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/kcms/decoration/window-decorations.knsrc.cmake:
--------------------------------------------------------------------------------
1 | ; SPDX-FileCopyrightText: 2023 Roman Gilg
2 | ;
3 | ; SPDX-License-Identifier: GPL-2.0-or-later
4 |
5 | [KNewStuff3]
6 | Name=Window Decorations
7 | Name[ar]=زخارف النوافذ
8 | Name[bg]=Декорации на прозорците
9 | Name[bs]=Dekoracije prozora
10 | Name[ca]=Decoració de les finestres
11 | Name[ca@valencia]=Decoració de les finestres
12 | Name[cs]=Dekorace oken
13 | Name[da]=Vinduesdekorationer
14 | Name[de]=Fensterdekoration
15 | Name[el]=Διακοσμήσεις παραθύρου
16 | Name[en_GB]=Window Decorations
17 | Name[es]=Decoración de ventanas
18 | Name[et]=Akna dekoratsioonid
19 | Name[eu]=Leiho-apaindurak
20 | Name[fi]=Ikkunakehykset
21 | Name[fr]=Décorations de fenêtres
22 | Name[ga]=Maisiúcháin Fhuinneog
23 | Name[gl]=Decoración da xanela
24 | Name[he]=מסגרת חלון
25 | Name[hi]=विंडो सजावट
26 | Name[hr]=Ukrasi prozora
27 | Name[hu]=Ablakdekorációk
28 | Name[ia]=Decorationes de fenestra
29 | Name[id]=Dekorasi Window
30 | Name[is]=Gluggaskreytingar
31 | Name[it]=Decorazioni delle finestre
32 | Name[ja]=ウィンドウの飾り
33 | Name[kk]=Терезенің безендірулері
34 | Name[km]=ការតុបតែងបង្អួច
35 | Name[kn]=ವಿಂಡೋ ಅಲಂಕಾರಗಳು
36 | Name[ko]=창 장식
37 | Name[lt]=Langų dekoracijos
38 | Name[lv]=Logu dekorācijas
39 | Name[mr]=चौकट सजावट
40 | Name[nb]=Vinduspynt
41 | Name[nds]=Finstern opfladusen
42 | Name[nl]=Vensterdecoraties
43 | Name[nn]=Vindaugspynt
44 | Name[pa]=ਵਿੰਡੋ ਸਜਾਵਟ
45 | Name[pl]=Wygląd okien
46 | Name[pt]=Decorações das Janelas
47 | Name[pt_BR]=Decorações da janela
48 | Name[ro]=Decorații fereastră
49 | Name[ru]=Оформление окон
50 | Name[si]=කවුළු සැරසිලි
51 | Name[sk]=Dekorácie okien
52 | Name[sl]=Okraski oken
53 | Name[sr]=Декорације прозора
54 | Name[sr@ijekavian]=Декорације прозора
55 | Name[sr@ijekavianlatin]=Dekoracije prozora
56 | Name[sr@latin]=Dekoracije prozora
57 | Name[sv]=Fönsterdekorationer
58 | Name[th]=ส่วนตกแต่งหน้าต่าง
59 | Name[tr]=Pencere Dekorasyonları
60 | Name[ug]=كۆزنەك بېزەكلىرى
61 | Name[uk]=Обрамлення вікон
62 | Name[wa]=Gåyotaedjes des fniesses
63 | Name[x-test]=xxWindow Decorationsxx
64 | Name[zh_CN]=窗口装饰
65 | Name[zh_TW]=視窗裝飾
66 |
67 | ProvidersUrl=https://autoconfig.kde.org/ocs/providers.xml
68 | ContentWarning=Executables
69 | Categories=Plasma 6 Window Decorations
70 | TargetDir=aurorae/themes
71 | Uncompress=archive
72 | AdoptionCommand=@KDE_INSTALL_FULL_LIBEXECDIR@/kwin-applywindowdecoration %f
73 |
--------------------------------------------------------------------------------
/kcms/desktop/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2023 Roman Gilg
2 | #
3 | # SPDX-License-Identifier: GPL-2.0-or-later
4 |
5 | # KI18N Translation Domain for this library.
6 | add_definitions(-DTRANSLATION_DOMAIN=\"kcm_kwin_virtualdesktops\")
7 |
8 | ########### next target ###############
9 |
10 | set(kcm_kwin_virtualdesktops_PART_SRCS
11 | animationsmodel.cpp
12 | desktopsmodel.cpp
13 | virtualdesktops.cpp
14 | virtualdesktopsdata.cpp
15 | )
16 |
17 | kconfig_add_kcfg_files(kcm_kwin_virtualdesktops_PART_SRCS virtualdesktopssettings.kcfgc GENERATE_MOC)
18 |
19 | kcmutils_add_qml_kcm(kcm_kwin_virtualdesktops SOURCES ${kcm_kwin_virtualdesktops_PART_SRCS})
20 |
21 | target_link_libraries(kcm_kwin_virtualdesktops
22 | kcmkwincommon
23 | como::win
24 | KF6::KCMUtils
25 | KF6::I18n
26 | KF6::XmlGui
27 | Qt::DBus
28 | )
29 |
30 | install(FILES virtualdesktopssettings.kcfg DESTINATION ${KDE_INSTALL_KCFGDIR})
31 |
--------------------------------------------------------------------------------
/kcms/desktop/Messages.sh:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env bash
2 |
3 | # SPDX-FileCopyrightText: 2023 Roman Gilg
4 | #
5 | # SPDX-License-Identifier: GPL-2.0-or-later
6 |
7 | $XGETTEXT `find . -name \*.cpp -o -name \*.qml` -o $podir/kcm_kwin_virtualdesktops.pot
8 |
--------------------------------------------------------------------------------
/kcms/desktop/animationsmodel.h:
--------------------------------------------------------------------------------
1 | /*
2 | SPDX-FileCopyrightText: 2018 Vlad Zahorodnii
3 |
4 | SPDX-License-Identifier: GPL-2.0-or-later
5 | */
6 |
7 | #pragma once
8 |
9 | #include "effectsmodel.h"
10 |
11 | namespace theseus_ship
12 | {
13 |
14 | class AnimationsModel : public EffectsModel
15 | {
16 | Q_OBJECT
17 | Q_PROPERTY(bool animationEnabled READ animationEnabled WRITE setAnimationEnabled NOTIFY
18 | animationEnabledChanged)
19 | Q_PROPERTY(
20 | int animationIndex READ animationIndex WRITE setAnimationIndex NOTIFY animationIndexChanged)
21 | Q_PROPERTY(bool currentConfigurable READ currentConfigurable NOTIFY currentConfigurableChanged)
22 | Q_PROPERTY(bool defaultAnimationEnabled READ defaultAnimationEnabled NOTIFY
23 | defaultAnimationEnabledChanged)
24 | Q_PROPERTY(
25 | int defaultAnimationIndex READ defaultAnimationIndex NOTIFY defaultAnimationIndexChanged)
26 |
27 | public:
28 | explicit AnimationsModel(QObject* parent = nullptr);
29 |
30 | bool animationEnabled() const;
31 | void setAnimationEnabled(bool enabled);
32 |
33 | int animationIndex() const;
34 | void setAnimationIndex(int index);
35 |
36 | bool currentConfigurable() const;
37 |
38 | bool defaultAnimationEnabled() const;
39 | int defaultAnimationIndex() const;
40 |
41 | void load();
42 | void save();
43 | void defaults();
44 | bool isDefaults() const;
45 | bool needsSave() const;
46 |
47 | Q_SIGNALS:
48 | void animationEnabledChanged();
49 | void animationIndexChanged();
50 | void currentConfigurableChanged();
51 | void defaultAnimationEnabledChanged();
52 | void defaultAnimationIndexChanged();
53 |
54 | protected:
55 | bool shouldStore(const EffectData& data) const override;
56 |
57 | private:
58 | Status status(int row) const;
59 | void loadDefaults();
60 | bool modelAnimationEnabled() const;
61 | int modelAnimationIndex() const;
62 |
63 | bool m_animationEnabled = false;
64 | bool m_defaultAnimationEnabled = false;
65 | int m_animationIndex = -1;
66 | int m_defaultAnimationIndex = -1;
67 | bool m_currentConfigurable = false;
68 |
69 | Q_DISABLE_COPY(AnimationsModel)
70 | };
71 |
72 | }
73 |
--------------------------------------------------------------------------------
/kcms/desktop/virtualdesktops.h:
--------------------------------------------------------------------------------
1 | /*
2 | SPDX-FileCopyrightText: 2018 Eike Hein
3 | SPDX-FileCopyrightText: 2018 Vlad Zahorodnii
4 |
5 | SPDX-License-Identifier: GPL-2.0-or-later
6 | */
7 |
8 | #ifndef VIRTUALDESKTOPS_H
9 | #define VIRTUALDESKTOPS_H
10 |
11 | #include
12 | #include
13 | #include
14 |
15 | class VirtualDesktopsSettings;
16 |
17 | namespace theseus_ship
18 | {
19 | class VirtualDesktopsData;
20 | class AnimationsModel;
21 | class DesktopsModel;
22 |
23 | class VirtualDesktops : public KQuickManagedConfigModule
24 | {
25 | Q_OBJECT
26 |
27 | Q_PROPERTY(QAbstractItemModel* desktopsModel READ desktopsModel CONSTANT)
28 | Q_PROPERTY(QAbstractItemModel* animationsModel READ animationsModel CONSTANT)
29 | Q_PROPERTY(
30 | VirtualDesktopsSettings* virtualDesktopsSettings READ virtualDesktopsSettings CONSTANT)
31 |
32 | public:
33 | explicit VirtualDesktops(QObject* parent, const KPluginMetaData& metaData);
34 | ~VirtualDesktops() override;
35 |
36 | QAbstractItemModel* desktopsModel() const;
37 |
38 | QAbstractItemModel* animationsModel() const;
39 |
40 | VirtualDesktopsSettings* virtualDesktopsSettings() const;
41 |
42 | bool isDefaults() const override;
43 | bool isSaveNeeded() const override;
44 |
45 | public Q_SLOTS:
46 | void load() override;
47 | void save() override;
48 | void defaults() override;
49 |
50 | void configureAnimation();
51 | void showAboutAnimation();
52 |
53 | private:
54 | VirtualDesktopsData* m_data;
55 | };
56 |
57 | }
58 |
59 | #endif
60 |
--------------------------------------------------------------------------------
/kcms/desktop/virtualdesktopsdata.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | SPDX-FileCopyrightText: 2021 Cyril Rossi
3 |
4 | SPDX-License-Identifier: GPL-2.0-or-later
5 | */
6 |
7 | #include "virtualdesktopsdata.h"
8 |
9 | #include "animationsmodel.h"
10 | #include "desktopsmodel.h"
11 | #include "virtualdesktopssettings.h"
12 |
13 | namespace theseus_ship
14 | {
15 |
16 | VirtualDesktopsData::VirtualDesktopsData(QObject* parent)
17 | : KCModuleData(parent)
18 | , m_settings(new VirtualDesktopsSettings(this))
19 | , m_desktopsModel(new DesktopsModel(this))
20 | , m_animationsModel(new AnimationsModel(this))
21 | {
22 | // Default behavior of KCModuleData is to emit loaded signal after being initialized.
23 | // To handle asynchronous load of EffectsModel we disable default behavior and
24 | // emit loaded signal when EffectsModel is actually loaded.
25 | disconnect(this, &KCModuleData::aboutToLoad, nullptr, nullptr);
26 | connect(m_animationsModel, &EffectsModel::loaded, this, &KCModuleData::loaded);
27 |
28 | m_desktopsModel->load();
29 | m_animationsModel->load();
30 | }
31 |
32 | bool VirtualDesktopsData::isDefaults() const
33 | {
34 | return m_animationsModel->isDefaults() && m_desktopsModel->isDefaults()
35 | && m_settings->isDefaults();
36 | }
37 |
38 | VirtualDesktopsSettings* VirtualDesktopsData::settings() const
39 | {
40 | return m_settings;
41 | }
42 |
43 | DesktopsModel* VirtualDesktopsData::desktopsModel() const
44 | {
45 | return m_desktopsModel;
46 | }
47 |
48 | AnimationsModel* VirtualDesktopsData::animationsModel() const
49 | {
50 | return m_animationsModel;
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/kcms/desktop/virtualdesktopsdata.h:
--------------------------------------------------------------------------------
1 | /*
2 | SPDX-FileCopyrightText: 2021 Cyril Rossi
3 |
4 | SPDX-License-Identifier: GPL-2.0-or-later
5 | */
6 |
7 | #pragma once
8 |
9 | #include
10 |
11 | #include
12 |
13 | class VirtualDesktopsSettings;
14 |
15 | namespace theseus_ship
16 | {
17 |
18 | class AnimationsModel;
19 | class DesktopsModel;
20 |
21 | class VirtualDesktopsData : public KCModuleData
22 | {
23 | Q_OBJECT
24 |
25 | public:
26 | explicit VirtualDesktopsData(QObject* parent);
27 |
28 | bool isDefaults() const override;
29 |
30 | VirtualDesktopsSettings* settings() const;
31 | DesktopsModel* desktopsModel() const;
32 | AnimationsModel* animationsModel() const;
33 |
34 | private:
35 | VirtualDesktopsSettings* m_settings;
36 | DesktopsModel* m_desktopsModel;
37 | AnimationsModel* m_animationsModel;
38 | };
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/kcms/desktop/virtualdesktopssettings.kcfg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
13 |
14 |
15 |
16 | Whether or not, we circle through the virtual desktop when moving from one to the next
17 | true
18 |
19 |
20 |
21 |
22 | Display in an OSD the virtual desktop name when switching between virtual desktops
23 | false
24 |
25 |
26 |
27 |
28 | Duraton of the OSD
29 | 1000
30 |
31 |
32 | Whether or not to display desktop layout in the OSD
33 | false
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/kcms/desktop/virtualdesktopssettings.kcfgc:
--------------------------------------------------------------------------------
1 | ; SPDX-FileCopyrightText: 2023 Roman Gilg
2 | ;
3 | ; SPDX-License-Identifier: GPL-2.0-or-later
4 |
5 | File=virtualdesktopssettings.kcfg
6 | ClassName=VirtualDesktopsSettings
7 | Mutators=true
8 | DefaultValueGetters=true
9 | GenerateProperties=true
10 | ParentInConstructor=true
11 |
--------------------------------------------------------------------------------
/kcms/effects/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2023 Roman Gilg
2 | #
3 | # SPDX-License-Identifier: GPL-2.0-or-later
4 |
5 | # KI18N Translation Domain for this library.
6 | add_definitions(-DTRANSLATION_DOMAIN=\"kcm_kwin_effects\")
7 |
8 | ########### next target ###############
9 |
10 | set(kcm_kwin_effects_PART_SRCS
11 | kcm.cpp
12 | effectsfilterproxymodel.cpp
13 | desktopeffectsdata.cpp
14 | )
15 |
16 | kcmutils_add_qml_kcm(kcm_kwin_effects SOURCES ${kcm_kwin_effects_PART_SRCS})
17 |
18 | target_link_libraries(kcm_kwin_effects
19 | kcmkwincommon
20 | KF6::I18n
21 | KF6::KCMUtils
22 | KF6::KCMUtilsQuick
23 | KF6::XmlGui
24 | Qt::DBus
25 | Qt::Quick
26 | )
27 |
28 | install(FILES kwineffect.knsrc DESTINATION ${KDE_INSTALL_KNSRCDIR})
29 |
--------------------------------------------------------------------------------
/kcms/effects/Messages.sh:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env bash
2 |
3 | # SPDX-FileCopyrightText: 2023 Roman Gilg
4 | #
5 | # SPDX-License-Identifier: GPL-2.0-or-later
6 |
7 | $XGETTEXT `find . -name \*.cpp -o -name \*.qml` -o $podir/kcm_kwin_effects.pot
8 |
--------------------------------------------------------------------------------
/kcms/effects/desktopeffectsdata.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | SPDX-FileCopyrightText: 2021 Cyril Rossi
3 |
4 | SPDX-License-Identifier: GPL-2.0-or-later
5 | */
6 |
7 | #include "desktopeffectsdata.h"
8 | #include "effectsmodel.h"
9 |
10 | namespace theseus_ship
11 | {
12 |
13 | DesktopEffectsData::DesktopEffectsData(QObject* parent)
14 | : KCModuleData(parent)
15 | , m_model(new EffectsModel(this))
16 |
17 | {
18 | disconnect(this, &KCModuleData::aboutToLoad, nullptr, nullptr);
19 | connect(m_model, &EffectsModel::loaded, this, &KCModuleData::loaded);
20 |
21 | m_model->load();
22 | }
23 |
24 | DesktopEffectsData::~DesktopEffectsData()
25 | {
26 | }
27 |
28 | bool DesktopEffectsData::isDefaults() const
29 | {
30 | return m_model->isDefaults();
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/kcms/effects/desktopeffectsdata.h:
--------------------------------------------------------------------------------
1 | /*
2 | SPDX-FileCopyrightText: 2021 Cyril Rossi
3 |
4 | SPDX-License-Identifier: GPL-2.0-or-later
5 | */
6 |
7 | #ifndef DESKTOPEFFECTSDATA_H
8 | #define DESKTOPEFFECTSDATA_H
9 |
10 | #include
11 |
12 | #include
13 |
14 | namespace theseus_ship
15 | {
16 | class EffectsModel;
17 |
18 | class DesktopEffectsData : public KCModuleData
19 | {
20 | Q_OBJECT
21 |
22 | public:
23 | explicit DesktopEffectsData(QObject* parent);
24 | ~DesktopEffectsData() override;
25 |
26 | bool isDefaults() const override;
27 |
28 | private:
29 | EffectsModel* m_model;
30 | };
31 |
32 | }
33 |
34 | #endif // DESKTOPEFFECTSDATA_H
35 |
--------------------------------------------------------------------------------
/kcms/effects/effectsfilterproxymodel.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | SPDX-FileCopyrightText: 2019 Vlad Zahorodnii
3 |
4 | SPDX-License-Identifier: GPL-2.0-or-later
5 | */
6 |
7 | #include "effectsfilterproxymodel.h"
8 |
9 | #include "effectsmodel.h"
10 |
11 | namespace theseus_ship
12 | {
13 |
14 | EffectsFilterProxyModel::EffectsFilterProxyModel(QObject* parent)
15 | : QSortFilterProxyModel(parent)
16 | {
17 | }
18 |
19 | EffectsFilterProxyModel::~EffectsFilterProxyModel()
20 | {
21 | }
22 |
23 | QString EffectsFilterProxyModel::query() const
24 | {
25 | return m_query;
26 | }
27 |
28 | void EffectsFilterProxyModel::setQuery(const QString& query)
29 | {
30 | if (m_query != query) {
31 | m_query = query;
32 | Q_EMIT queryChanged();
33 | invalidateFilter();
34 | }
35 | }
36 |
37 | bool EffectsFilterProxyModel::excludeUnsupported() const
38 | {
39 | return m_excludeUnsupported;
40 | }
41 |
42 | void EffectsFilterProxyModel::setExcludeUnsupported(bool exclude)
43 | {
44 | if (m_excludeUnsupported != exclude) {
45 | m_excludeUnsupported = exclude;
46 | Q_EMIT excludeUnsupportedChanged();
47 | invalidateFilter();
48 | }
49 | }
50 |
51 | bool EffectsFilterProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex& sourceParent) const
52 | {
53 | const QModelIndex idx = sourceModel()->index(sourceRow, 0, sourceParent);
54 |
55 | if (!m_query.isEmpty()) {
56 | const bool matches
57 | = idx.data(EffectsModel::NameRole).toString().contains(m_query, Qt::CaseInsensitive)
58 | || idx.data(EffectsModel::DescriptionRole)
59 | .toString()
60 | .contains(m_query, Qt::CaseInsensitive)
61 | || idx.data(EffectsModel::CategoryRole)
62 | .toString()
63 | .contains(m_query, Qt::CaseInsensitive);
64 | if (!matches) {
65 | return false;
66 | }
67 | }
68 |
69 | if (m_excludeUnsupported) {
70 | if (!idx.data(EffectsModel::SupportedRole).toBool()) {
71 | return false;
72 | }
73 | }
74 |
75 | return true;
76 | }
77 |
78 | }
79 |
--------------------------------------------------------------------------------
/kcms/effects/effectsfilterproxymodel.h:
--------------------------------------------------------------------------------
1 | /*
2 | SPDX-FileCopyrightText: 2019 Vlad Zahorodnii
3 |
4 | SPDX-License-Identifier: GPL-2.0-or-later
5 | */
6 |
7 | #pragma once
8 |
9 | #include
10 |
11 | namespace theseus_ship
12 | {
13 |
14 | class EffectsFilterProxyModel : public QSortFilterProxyModel
15 | {
16 | Q_OBJECT
17 | Q_PROPERTY(QAbstractItemModel* sourceModel READ sourceModel WRITE setSourceModel)
18 | Q_PROPERTY(QString query READ query WRITE setQuery NOTIFY queryChanged)
19 | Q_PROPERTY(bool excludeUnsupported READ excludeUnsupported WRITE setExcludeUnsupported NOTIFY
20 | excludeUnsupportedChanged)
21 |
22 | public:
23 | explicit EffectsFilterProxyModel(QObject* parent = nullptr);
24 | ~EffectsFilterProxyModel() override;
25 |
26 | QString query() const;
27 | void setQuery(const QString& query);
28 |
29 | bool excludeUnsupported() const;
30 | void setExcludeUnsupported(bool exclude);
31 |
32 | Q_SIGNALS:
33 | void queryChanged();
34 | void excludeUnsupportedChanged();
35 |
36 | protected:
37 | bool filterAcceptsRow(int sourceRow, const QModelIndex& sourceParent) const override;
38 |
39 | private:
40 | QString m_query;
41 | bool m_excludeUnsupported = true;
42 |
43 | Q_DISABLE_COPY(EffectsFilterProxyModel)
44 | };
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/kcms/effects/kcm.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | SPDX-FileCopyrightText: 2019 Vlad Zahorodnii
3 |
4 | SPDX-License-Identifier: GPL-2.0-or-later
5 | */
6 |
7 | #include "kcm.h"
8 | #include "desktopeffectsdata.h"
9 | #include "effectsfilterproxymodel.h"
10 | #include "effectsmodel.h"
11 |
12 | #include
13 | #include
14 |
15 | #include
16 | #include
17 |
18 | K_PLUGIN_FACTORY_WITH_JSON(DesktopEffectsKCMFactory,
19 | "kcm_kwin_effects.json",
20 | registerPlugin();
21 | registerPlugin();)
22 |
23 | namespace theseus_ship
24 | {
25 |
26 | DesktopEffectsKCM::DesktopEffectsKCM(QObject* parent, const KPluginMetaData& metaData)
27 | : KQuickConfigModule(parent, metaData)
28 | , m_model(new EffectsModel(this))
29 | {
30 | qmlRegisterType(
31 | "org.kde.private.kcms.kwin.effects", 1, 0, "EffectsFilterProxyModel");
32 |
33 | setButtons(Apply | Default | Help);
34 |
35 | connect(m_model, &EffectsModel::dataChanged, this, &DesktopEffectsKCM::updateNeedsSave);
36 | connect(m_model, &EffectsModel::loaded, this, &DesktopEffectsKCM::updateNeedsSave);
37 | }
38 |
39 | DesktopEffectsKCM::~DesktopEffectsKCM()
40 | {
41 | }
42 |
43 | QAbstractItemModel* DesktopEffectsKCM::effectsModel() const
44 | {
45 | return m_model;
46 | }
47 |
48 | void DesktopEffectsKCM::load()
49 | {
50 | m_model->load();
51 | setNeedsSave(false);
52 | }
53 |
54 | void DesktopEffectsKCM::save()
55 | {
56 | m_model->save();
57 | setNeedsSave(false);
58 | }
59 |
60 | void DesktopEffectsKCM::defaults()
61 | {
62 | m_model->defaults();
63 | updateNeedsSave();
64 | }
65 |
66 | void DesktopEffectsKCM::onGHNSEntriesChanged()
67 | {
68 | m_model->load(EffectsModel::LoadOptions::KeepDirty);
69 | }
70 |
71 | void DesktopEffectsKCM::configure(const QString& pluginId, QQuickItem* context)
72 | {
73 | const QModelIndex index = m_model->findByPluginId(pluginId);
74 |
75 | QWindow* transientParent = nullptr;
76 | if (context && context->window()) {
77 | transientParent = context->window();
78 | }
79 |
80 | m_model->requestConfigure(index, transientParent);
81 | }
82 |
83 | void DesktopEffectsKCM::updateNeedsSave()
84 | {
85 | setNeedsSave(m_model->needsSave());
86 | setRepresentsDefaults(m_model->isDefaults());
87 | }
88 |
89 | }
90 |
91 | #include "kcm.moc"
92 |
--------------------------------------------------------------------------------
/kcms/effects/kcm.h:
--------------------------------------------------------------------------------
1 | /*
2 | SPDX-FileCopyrightText: 2019 Vlad Zahorodnii
3 |
4 | SPDX-License-Identifier: GPL-2.0-or-later
5 | */
6 |
7 | #pragma once
8 |
9 | #include
10 |
11 | #include
12 | #include
13 |
14 | namespace theseus_ship
15 | {
16 |
17 | class EffectsModel;
18 |
19 | class DesktopEffectsKCM : public KQuickConfigModule
20 | {
21 | Q_OBJECT
22 | Q_PROPERTY(QAbstractItemModel* effectsModel READ effectsModel CONSTANT)
23 |
24 | public:
25 | explicit DesktopEffectsKCM(QObject* parent, const KPluginMetaData& metaData);
26 | ~DesktopEffectsKCM() override;
27 |
28 | QAbstractItemModel* effectsModel() const;
29 |
30 | public Q_SLOTS:
31 | void load() override;
32 | void save() override;
33 | void defaults() override;
34 |
35 | void onGHNSEntriesChanged();
36 | void configure(const QString& pluginId, QQuickItem* context);
37 |
38 | private Q_SLOTS:
39 | void updateNeedsSave();
40 |
41 | private:
42 | EffectsModel* m_model;
43 |
44 | Q_DISABLE_COPY(DesktopEffectsKCM)
45 | };
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/kcms/effects/kwineffect.knsrc:
--------------------------------------------------------------------------------
1 | ; SPDX-FileCopyrightText: 2023 Roman Gilg
2 | ;
3 | ; SPDX-License-Identifier: GPL-2.0-or-later
4 |
5 | [KNewStuff3]
6 | Name=Window Manager Effects
7 | Name[ca]=Efectes del gestor de finestres
8 | Name[ca@valencia]=Efectes del gestor de finestres
9 | Name[cs]=Efekty správce oken
10 | Name[da]=Vindueshåndteringseffekter
11 | Name[de]=Fensterverwaltungs-Effekte
12 | Name[el]=Εφέ διαχειριστή παραθύρων
13 | Name[en_GB]=Window Manager Effects
14 | Name[es]=Efectos del gestor de ventanas
15 | Name[et]=Aknahalduri efektid
16 | Name[eu]=Leiho kudeatzailearen efektua
17 | Name[fi]=Ikkunointiohjelman tehosteet
18 | Name[fr]=Effets du gestionnaire de fenêtres
19 | Name[gl]=Efectos do xestor de xanelas
20 | Name[he]=אפקטי מנהל חלונות
21 | Name[hu]=Ablakkezelő-effektusok
22 | Name[ia]=Gerente de effectos de fenestra
23 | Name[id]=Efek Pengelola Window
24 | Name[it]=Effetti del gestore delle finestre
25 | Name[ko]=창 관리자 효과
26 | Name[lt]=Langų tvarkytuvės efektai
27 | Name[nl]=Effecten van vensterbeheerder
28 | Name[nn]=Effektar for vindaugshandsamar
29 | Name[pa]=ਵਿੰਡੋ ਮੈਨੇਜਰ ਪਰਭਾਵ
30 | Name[pl]=Efekty zarządzania oknami
31 | Name[pt]=Efeitos do Gestor de Janelas
32 | Name[pt_BR]=Efeitos do gerenciador de janelas
33 | Name[ru]=Эффекты диспетчера окон KWin
34 | Name[sk]=Efekty správcu okien
35 | Name[sl]=Učinki upravljalnika oken
36 | Name[sr]=Ефекти менаџера прозора
37 | Name[sr@ijekavian]=Ефекти менаџера прозора
38 | Name[sr@ijekavianlatin]=Efekti menadžera prozora
39 | Name[sr@latin]=Efekti menadžera prozora
40 | Name[sv]=Fönsterhanteringseffekter
41 | Name[tr]=Pencere Yöneticisi Efektleri
42 | Name[uk]=Ефекти засобу керування вікнами
43 | Name[x-test]=xxWindow Manager Effectsxx
44 | Name[zh_CN]=窗口管理器效果
45 | Name[zh_TW]=視窗管理員效果
46 |
47 | ProvidersUrl=https://autoconfig.kde.org/ocs/providers.xml
48 | ContentWarning=Executables
49 | Categories=KWin Effects Plasma 6
50 | StandardResource=tmp
51 | Uncompress=kpackage
52 | KPackageStructure=KWin/Effect
53 |
--------------------------------------------------------------------------------
/kcms/effects/ui/Video.qml:
--------------------------------------------------------------------------------
1 | /*
2 | SPDX-FileCopyrightText: 2013 Antonis Tsiapaliokas
3 | SPDX-FileCopyrightText: 2014 Martin Gräßlin
4 | SPDX-FileCopyrightText: 2023 ivan tkachenko
5 |
6 | SPDX-License-Identifier: GPL-2.0-or-later
7 | */
8 |
9 | import QtQuick
10 | import QtQuick.Controls as QQC2
11 | import QtQuick.Layouts
12 | import QtMultimedia as Multimedia
13 |
14 | Multimedia.Video {
15 | id: videoItem
16 |
17 | source: model.VideoRole
18 | width: 400
19 | height: 400
20 |
21 | QQC2.BusyIndicator {
22 | anchors.centerIn: parent
23 | visible: videoItem.status === Multimedia.MediaPlayer.Loading
24 | running: true
25 | }
26 |
27 | QQC2.Button {
28 | id: replayButton
29 |
30 | visible: false
31 | anchors.centerIn: parent
32 | icon.name: "media-playback-start"
33 |
34 | onClicked: {
35 | replayButton.visible = false;
36 | videoItem.play();
37 | }
38 | }
39 |
40 | onStopped: {
41 | replayButton.visible = true
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/kcms/effects/ui/main.qml:
--------------------------------------------------------------------------------
1 | /*
2 | SPDX-FileCopyrightText: 2013 Antonis Tsiapaliokas
3 | SPDX-FileCopyrightText: 2019 Vlad Zahorodnii
4 | SPDX-FileCopyrightText: 2023 ivan tkachenko
5 |
6 | SPDX-License-Identifier: GPL-2.0-or-later
7 | */
8 |
9 | import QtQuick
10 | import QtQuick.Controls as QQC2
11 | import QtQuick.Layouts
12 |
13 | import org.kde.kcmutils
14 | import org.kde.config
15 | import org.kde.kirigami 2 as Kirigami
16 | import org.kde.newstuff as NewStuff
17 |
18 | import org.kde.private.kcms.kwin.effects as Private
19 |
20 | ScrollViewKCM {
21 | implicitHeight: Kirigami.Units.gridUnit * 30
22 | implicitWidth: Kirigami.Units.gridUnit * 40
23 |
24 | actions: NewStuff.Action {
25 | text: i18nc("@action:button get new KWin effects", "Get New…")
26 | visible: KAuthorized.authorize(KAuthorized.GHNS)
27 | configFile: "kwineffect.knsrc"
28 | onEntryEvent: (entry, event) => {
29 | if (event === NewStuff.Engine.StatusChangedEvent) {
30 | kcm.onGHNSEntriesChanged()
31 | }
32 | }
33 | }
34 |
35 | header: ColumnLayout {
36 | spacing: Kirigami.Units.smallSpacing
37 |
38 | QQC2.Label {
39 | Layout.fillWidth: true
40 | Layout.leftMargin: Kirigami.Units.smallSpacing
41 | Layout.rightMargin: Kirigami.Units.smallSpacing
42 |
43 | wrapMode: Text.WordWrap
44 | text: i18n("Hint: To find out or configure how to activate an effect, look at the effect's settings.")
45 | }
46 |
47 | RowLayout {
48 | spacing: Kirigami.Units.smallSpacing
49 |
50 | Kirigami.SearchField {
51 | id: searchField
52 |
53 | Layout.fillWidth: true
54 | }
55 |
56 | QQC2.ToolButton {
57 | id: filterButton
58 |
59 | icon.name: "view-filter"
60 |
61 | checkable: true
62 | checked: menu.opened
63 | onClicked: menu.popup(filterButton, filterButton.width - menu.width, filterButton.height)
64 |
65 | QQC2.ToolTip {
66 | text: i18n("Configure Filter")
67 | }
68 | }
69 |
70 | QQC2.Menu {
71 | id: menu
72 |
73 | modal: true
74 |
75 | QQC2.MenuItem {
76 | checkable: true
77 | checked: searchModel.excludeUnsupported
78 | text: i18n("Exclude unsupported effects")
79 |
80 | onToggled: searchModel.excludeUnsupported = checked
81 | }
82 | }
83 | }
84 | }
85 |
86 | view: ListView {
87 | id: effectsList
88 |
89 | // { string name: QQC2.ButtonGroup group }
90 | property var _buttonGroups: new Map()
91 |
92 | clip: true
93 |
94 | model: Private.EffectsFilterProxyModel {
95 | id: searchModel
96 |
97 | query: searchField.text
98 | sourceModel: kcm.effectsModel
99 | }
100 |
101 | delegate: Effect {
102 | width: ListView.view.width - ListView.view.leftMargin - ListView.view.rightMargin
103 | }
104 |
105 | section.property: "CategoryRole"
106 | section.delegate: Kirigami.ListSectionHeader {
107 | width: ListView.view.width - ListView.view.leftMargin - ListView.view.rightMargin
108 | text: section
109 | }
110 |
111 | Component {
112 | id: buttonGroupComponent
113 |
114 | QQC2.ButtonGroup {}
115 | }
116 |
117 | function findButtonGroup(name: string): QQC2.ButtonGroup {
118 | let group = _buttonGroups.get(name);
119 | if (group === undefined) {
120 | group = buttonGroupComponent.createObject(this);
121 | _buttonGroups.set(name, group);
122 | }
123 | return group;
124 | }
125 | }
126 | }
127 |
--------------------------------------------------------------------------------
/kcms/options/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2023 Roman Gilg
2 | #
3 | # SPDX-License-Identifier: GPL-2.0-or-later
4 |
5 | ########### next target ###############
6 | # KI18N Translation Domain for this library
7 | add_definitions(-DTRANSLATION_DOMAIN=\"kcmkwm\")
8 |
9 | set(kcm_kwinoptions_PART_SRCS
10 | main.cpp
11 | mouse.cpp
12 | windows.cpp
13 | )
14 |
15 | ki18n_wrap_ui(kcm_kwinoptions_PART_SRCS
16 | actions.ui
17 | advanced.ui
18 | focus.ui
19 | mouse.ui
20 | moving.ui
21 | )
22 |
23 | kcmutils_generate_module_data(
24 | kcm_kwinoptions_PART_SRCS
25 | MODULE_DATA_HEADER kwinoptionsdata.h
26 | MODULE_DATA_CLASS_NAME KWinOptionsData
27 | SETTINGS_HEADERS kwinoptions_settings.h kwinoptions_kdeglobals_settings.h
28 | SETTINGS_CLASSES KWinOptionsSettings KWinOptionsKDEGlobalsSettings
29 | )
30 |
31 | kconfig_add_kcfg_files(kcm_kwinoptions_PART_SRCS kwinoptions_settings.kcfgc GENERATE_MOC)
32 | kconfig_add_kcfg_files(kcm_kwinoptions_PART_SRCS kwinoptions_kdeglobals_settings.kcfgc GENERATE_MOC)
33 |
34 | qt_add_dbus_interface(kcm_kwinoptions_PART_SRCS
35 | ${KWIN_EFFECTS_INTERFACE} kwin_effects_interface
36 | )
37 |
38 | kcoreaddons_add_plugin(kcm_kwinoptions SOURCES ${kcm_kwinoptions_PART_SRCS} INSTALL_NAMESPACE "plasma/kcms/systemsettings_qwidgets")
39 | kcmutils_generate_desktop_file(kcm_kwinoptions)
40 | target_link_libraries(kcm_kwinoptions
41 | KF6::I18n
42 | KF6::KCMUtils
43 | KF6::WindowSystem
44 | Qt::DBus
45 | como::win
46 | )
47 |
--------------------------------------------------------------------------------
/kcms/options/Messages.sh:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env bash
2 |
3 | # SPDX-FileCopyrightText: 2023 Roman Gilg
4 | #
5 | # SPDX-License-Identifier: GPL-2.0-or-later
6 |
7 | $EXTRACTRC `find . -name \*.ui` >> rc.cpp || exit 11
8 | $XGETTEXT *.cpp -o $podir/kcmkwm.pot
9 |
--------------------------------------------------------------------------------
/kcms/options/kwinoptions_kdeglobals_settings.kcfg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
13 |
14 |
15 |
16 |
17 |
18 | true
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/kcms/options/kwinoptions_kdeglobals_settings.kcfgc:
--------------------------------------------------------------------------------
1 | ; SPDX-FileCopyrightText: 2023 Roman Gilg
2 | ;
3 | ; SPDX-License-Identifier: GPL-2.0-or-later
4 |
5 | File=kwinoptions_kdeglobals_settings.kcfg
6 | ClassName=KWinOptionsKDEGlobalsSettings
7 | Mutators=true
8 | DefaultValueGetters=true
9 | ParentInConstructor=true
10 |
--------------------------------------------------------------------------------
/kcms/options/kwinoptions_settings.kcfgc:
--------------------------------------------------------------------------------
1 | ; SPDX-FileCopyrightText: 2023 Roman Gilg
2 | ;
3 | ; SPDX-License-Identifier: GPL-2.0-or-later
4 |
5 | File=kwinoptions_settings.kcfg
6 | ClassName=KWinOptionsSettings
7 | Mutators=true
8 | DefaultValueGetters=true
9 | ParentInConstructor=true
10 |
--------------------------------------------------------------------------------
/kcms/options/main.h:
--------------------------------------------------------------------------------
1 | /*
2 | main.h
3 |
4 | SPDX-FileCopyrightText: 2001 Waldo Bastian
5 |
6 | Requires the Qt widget libraries, available at no cost at
7 | https://www.qt.io/
8 |
9 | SPDX-License-Identifier: GPL-2.0-or-later
10 | */
11 |
12 | #ifndef __MAIN_H__
13 | #define __MAIN_H__
14 |
15 | #include
16 | #include
17 |
18 | class KWinOptionsSettings;
19 | class KWinOptionsKDEGlobalsSettings;
20 | class KFocusConfig;
21 | class KTitleBarActionsConfig;
22 | class KWindowActionsConfig;
23 | class KAdvancedConfig;
24 | class KMovingConfig;
25 |
26 | class KWinOptions : public KCModule
27 | {
28 | Q_OBJECT
29 |
30 | public:
31 | explicit KWinOptions(QObject* parent, const KPluginMetaData& data);
32 |
33 | void load() override;
34 | void save() override;
35 | void defaults() override;
36 |
37 | protected Q_SLOTS:
38 | void updateUnmanagedState();
39 |
40 | private:
41 | QTabWidget* tab;
42 |
43 | KFocusConfig* mFocus;
44 | KTitleBarActionsConfig* mTitleBarActions;
45 | KWindowActionsConfig* mWindowActions;
46 | KMovingConfig* mMoving;
47 | KAdvancedConfig* mAdvanced;
48 |
49 | KWinOptionsSettings* mSettings;
50 | };
51 |
52 | class KActionsOptions : public KCModule
53 | {
54 | Q_OBJECT
55 |
56 | public:
57 | KActionsOptions(QObject* parent, const KPluginMetaData& data);
58 |
59 | void load() override;
60 | void save() override;
61 | void defaults() override;
62 |
63 | protected Q_SLOTS:
64 |
65 | void moduleChanged(bool state);
66 |
67 | private:
68 | QTabWidget* tab;
69 |
70 | KTitleBarActionsConfig* mTitleBarActions;
71 | KWindowActionsConfig* mWindowActions;
72 |
73 | KWinOptionsSettings* mSettings;
74 | };
75 |
76 | #endif
77 |
--------------------------------------------------------------------------------
/kcms/options/mouse.cpp:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | SPDX-FileCopyrightText: 1998 Matthias Ettrich
4 |
5 | SPDX-License-Identifier: GPL-2.0-or-later
6 | */
7 |
8 | #include "mouse.h"
9 |
10 | #include "kwinoptions_settings.h"
11 |
12 | #include
13 | #include
14 | #include
15 | #include
16 |
17 | KWinMouseConfigForm::KWinMouseConfigForm(QWidget* parent)
18 | : QWidget(parent)
19 | {
20 | setupUi(parent);
21 | }
22 |
23 | KWinActionsConfigForm::KWinActionsConfigForm(QWidget* parent)
24 | : QWidget(parent)
25 | {
26 | setupUi(parent);
27 | }
28 |
29 | KTitleBarActionsConfig::KTitleBarActionsConfig(bool _standAlone,
30 | KWinOptionsSettings* settings,
31 | QWidget* parent)
32 | : KCModule(parent, KPluginMetaData())
33 | , standAlone(_standAlone)
34 | , m_ui(new KWinMouseConfigForm(widget()))
35 | {
36 | if (settings) {
37 | initialize(settings);
38 | }
39 | }
40 |
41 | void KTitleBarActionsConfig::initialize(KWinOptionsSettings* settings)
42 | {
43 | m_settings = settings;
44 | addConfig(m_settings, widget());
45 | }
46 |
47 | void KTitleBarActionsConfig::save()
48 | {
49 | KCModule::save();
50 |
51 | if (standAlone) {
52 | // Send signal to all kwin instances
53 | QDBusMessage message = QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
54 | QDBusConnection::sessionBus().send(message);
55 | }
56 | }
57 |
58 | KWindowActionsConfig::KWindowActionsConfig(bool _standAlone,
59 | KWinOptionsSettings* settings,
60 | QWidget* parent)
61 | : KCModule(parent, KPluginMetaData())
62 | , standAlone(_standAlone)
63 | , m_ui(new KWinActionsConfigForm(widget()))
64 | {
65 | if (settings) {
66 | initialize(settings);
67 | }
68 | }
69 |
70 | void KWindowActionsConfig::initialize(KWinOptionsSettings* settings)
71 | {
72 | m_settings = settings;
73 | addConfig(m_settings, widget());
74 | }
75 |
76 | void KWindowActionsConfig::save()
77 | {
78 | KCModule::save();
79 |
80 | if (standAlone) {
81 | // Send signal to all kwin instances
82 | QDBusMessage message = QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
83 | QDBusConnection::sessionBus().send(message);
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/kcms/options/mouse.h:
--------------------------------------------------------------------------------
1 | /*
2 | mouse.h
3 |
4 | SPDX-FileCopyrightText: 1998 Matthias Ettrich
5 |
6 |
7 | SPDX-License-Identifier: GPL-2.0-or-later
8 | */
9 |
10 | #ifndef __KKWMMOUSECONFIG_H__
11 | #define __KKWMMOUSECONFIG_H__
12 |
13 | class KConfig;
14 |
15 | #include
16 | #include
17 |
18 | #include "ui_actions.h"
19 | #include "ui_mouse.h"
20 |
21 | class KWinOptionsSettings;
22 |
23 | class KWinMouseConfigForm : public QWidget, public Ui::KWinMouseConfigForm
24 | {
25 | Q_OBJECT
26 |
27 | public:
28 | explicit KWinMouseConfigForm(QWidget* parent);
29 | };
30 |
31 | class KWinActionsConfigForm : public QWidget, public Ui::KWinActionsConfigForm
32 | {
33 | Q_OBJECT
34 |
35 | public:
36 | explicit KWinActionsConfigForm(QWidget* parent);
37 | };
38 |
39 | class KTitleBarActionsConfig : public KCModule
40 | {
41 | Q_OBJECT
42 |
43 | public:
44 | KTitleBarActionsConfig(bool _standAlone, KWinOptionsSettings* settings, QWidget* parent);
45 |
46 | void save() override;
47 |
48 | protected:
49 | void initialize(KWinOptionsSettings* settings);
50 |
51 | private:
52 | bool standAlone;
53 |
54 | KWinMouseConfigForm* m_ui;
55 | KWinOptionsSettings* m_settings;
56 | };
57 |
58 | class KWindowActionsConfig : public KCModule
59 | {
60 | Q_OBJECT
61 |
62 | public:
63 | KWindowActionsConfig(bool _standAlone, KWinOptionsSettings* settings, QWidget* parent);
64 |
65 | void save() override;
66 |
67 | bool isDefaults() const;
68 | bool isSaveNeeded() const;
69 |
70 | protected:
71 | void initialize(KWinOptionsSettings* settings);
72 |
73 | private:
74 | bool standAlone;
75 |
76 | KWinActionsConfigForm* m_ui;
77 | KWinOptionsSettings* m_settings{nullptr};
78 | };
79 |
80 | #endif
81 |
--------------------------------------------------------------------------------
/kcms/options/windows.h:
--------------------------------------------------------------------------------
1 | /*
2 | windows.h
3 |
4 | SPDX-FileCopyrightText: 1997 Patrick Dowler dowler @morgul.fsh.uvic.ca
5 | SPDX-FileCopyrightText: 2001 Waldo Bastian bastian @kde.org
6 |
7 | SPDX-License-Identifier: GPL-2.0-or-later
8 | */
9 |
10 | #ifndef KKWMWINDOWS_H
11 | #define KKWMWINDOWS_H
12 |
13 | #include
14 | #include
15 |
16 | #include "ui_advanced.h"
17 | #include "ui_focus.h"
18 | #include "ui_moving.h"
19 |
20 | class QRadioButton;
21 | class QCheckBox;
22 | class QPushButton;
23 | class QGroupBox;
24 | class QLabel;
25 | class QSlider;
26 | class QGroupBox;
27 | class QSpinBox;
28 |
29 | class KColorButton;
30 |
31 | class KWinOptionsSettings;
32 | class KWinOptionsKDEGlobalsSettings;
33 |
34 | class KWinFocusConfigForm : public QWidget, public Ui::KWinFocusConfigForm
35 | {
36 | Q_OBJECT
37 |
38 | public:
39 | explicit KWinFocusConfigForm(QWidget* parent);
40 | };
41 |
42 | class KWinMovingConfigForm : public QWidget, public Ui::KWinMovingConfigForm
43 | {
44 | Q_OBJECT
45 |
46 | public:
47 | explicit KWinMovingConfigForm(QWidget* parent);
48 | };
49 |
50 | class KWinAdvancedConfigForm : public QWidget, public Ui::KWinAdvancedConfigForm
51 | {
52 | Q_OBJECT
53 |
54 | public:
55 | explicit KWinAdvancedConfigForm(QWidget* parent);
56 | };
57 |
58 | class KFocusConfig : public KCModule
59 | {
60 | Q_OBJECT
61 | public:
62 | KFocusConfig(bool _standAlone, KWinOptionsSettings* settings, QWidget* parent);
63 |
64 | void load() override;
65 | void save() override;
66 | void defaults() override;
67 |
68 | protected:
69 | void initialize(KWinOptionsSettings* settings);
70 |
71 | private Q_SLOTS:
72 | void focusPolicyChanged();
73 | void updateMultiScreen();
74 | void updateDefaultIndicator();
75 |
76 | private:
77 | bool standAlone;
78 |
79 | KWinFocusConfigForm* m_ui;
80 | KWinOptionsSettings* m_settings;
81 |
82 | void updateFocusPolicyExplanatoryText();
83 | };
84 |
85 | class KMovingConfig : public KCModule
86 | {
87 | Q_OBJECT
88 | public:
89 | KMovingConfig(bool _standAlone, KWinOptionsSettings* settings, QWidget* parent);
90 |
91 | void save() override;
92 |
93 | protected:
94 | void initialize(KWinOptionsSettings* settings);
95 |
96 | private:
97 | KWinOptionsSettings* m_settings;
98 | bool standAlone;
99 | KWinMovingConfigForm* m_ui;
100 | };
101 |
102 | class KAdvancedConfig : public KCModule
103 | {
104 | Q_OBJECT
105 | public:
106 | KAdvancedConfig(bool _standAlone,
107 | KWinOptionsSettings* settings,
108 | KWinOptionsKDEGlobalsSettings* globalSettings,
109 | QWidget* parent);
110 |
111 | void save() override;
112 |
113 | protected:
114 | void initialize(KWinOptionsSettings* settings, KWinOptionsKDEGlobalsSettings* globalSettings);
115 |
116 | private:
117 | bool standAlone;
118 | KWinAdvancedConfigForm* m_ui;
119 | KWinOptionsSettings* m_settings{nullptr};
120 | };
121 |
122 | #endif // KKWMWINDOWS_H
123 |
--------------------------------------------------------------------------------
/kcms/rules/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2023 Roman Gilg
2 | #
3 | # SPDX-License-Identifier: GPL-2.0-or-later
4 |
5 | # KI18N Translation Domain for this library
6 | add_definitions(-DTRANSLATION_DOMAIN=\"kcm_kwinrules\")
7 |
8 | set(kwinrules_SRCS
9 | optionsmodel.cpp
10 | ruleitem.cpp
11 | rulesmodel.cpp
12 | rulebookmodel.cpp
13 | )
14 |
15 | # kconfig_add_kcfg_files(kwinrules_SRCS ../../lib/win/rules/kconfig/rules_settings.kcfgc)
16 | # kconfig_add_kcfg_files(kwinrules_SRCS ../../lib/win/rules/kconfig/rules_book_settings_base.kcfgc)
17 |
18 | add_library(KWinRulesObjects STATIC ${kwinrules_SRCS})
19 | set_target_properties(KWinRulesObjects PROPERTIES
20 | POSITION_INDEPENDENT_CODE ON
21 | )
22 |
23 | set(kwin_kcm_rules_XCB_LIBS
24 | XCB::CURSOR
25 | XCB::XCB
26 | XCB::XFIXES
27 | )
28 |
29 | set(kcm_libs
30 | como::input
31 | como::win-x11
32 | KF6::KCMUtils
33 | KF6::WindowSystem
34 | )
35 |
36 | target_link_libraries(KWinRulesObjects ${kcm_libs} ${kwin_kcm_rules_XCB_LIBS})
37 |
38 | kcmutils_add_qml_kcm(kcm_kwinrules SOURCES kcmrules.cpp)
39 | target_link_libraries(kcm_kwinrules KWinRulesObjects)
40 |
--------------------------------------------------------------------------------
/kcms/rules/Messages.sh:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env bash
2 |
3 | # SPDX-FileCopyrightText: 2023 Roman Gilg
4 | #
5 | # SPDX-License-Identifier: GPL-2.0-or-later
6 |
7 | $XGETTEXT `find . -name \*.cpp -o -name \*.h -o -name \*.qml` -o $podir/kcm_kwinrules.pot
8 |
--------------------------------------------------------------------------------
/kcms/rules/kcmrules.h:
--------------------------------------------------------------------------------
1 | /*
2 | SPDX-FileCopyrightText: 2020 Ismael Asensio
3 |
4 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
5 | */
6 |
7 | #pragma once
8 |
9 | #include "rulebookmodel.h"
10 | #include "rulesmodel.h"
11 |
12 | #include
13 |
14 | namespace theseus_ship
15 | {
16 |
17 | namespace win::rules
18 | {
19 | class settings;
20 | }
21 |
22 | class KCMKWinRules : public KQuickConfigModule
23 | {
24 | Q_OBJECT
25 |
26 | Q_PROPERTY(RuleBookModel* ruleBookModel MEMBER m_ruleBookModel CONSTANT)
27 | Q_PROPERTY(RulesModel* rulesModel MEMBER m_rulesModel CONSTANT)
28 | Q_PROPERTY(int editIndex READ editIndex NOTIFY editIndexChanged)
29 |
30 | public:
31 | explicit KCMKWinRules(QObject* parent,
32 | const KPluginMetaData& metaData,
33 | const QVariantList& arguments);
34 |
35 | Q_INVOKABLE void setRuleDescription(int index, const QString& description);
36 | Q_INVOKABLE void editRule(int index);
37 |
38 | Q_INVOKABLE void createRule();
39 | Q_INVOKABLE void removeRule(int index);
40 | Q_INVOKABLE void moveRule(int sourceIndex, int destIndex);
41 | Q_INVOKABLE void duplicateRule(int index);
42 |
43 | Q_INVOKABLE void exportToFile(const QUrl& path, const QList& indexes);
44 | Q_INVOKABLE void importFromFile(const QUrl& path);
45 |
46 | public Q_SLOTS:
47 | void load() override;
48 | void save() override;
49 |
50 | Q_SIGNALS:
51 | void editIndexChanged();
52 |
53 | private Q_SLOTS:
54 | void updateNeedsSave();
55 |
56 | private:
57 | int editIndex() const;
58 | void parseArguments(const QStringList& args);
59 | void createRuleFromProperties();
60 |
61 | QModelIndex findRuleWithProperties(const QVariantMap& info, bool wholeApp) const;
62 | void fillSettingsFromProperties(como::win::rules::settings* settings,
63 | QVariantMap const& info,
64 | bool wholeApp) const;
65 |
66 | private:
67 | RuleBookModel* m_ruleBookModel;
68 | RulesModel* m_rulesModel;
69 |
70 | QPersistentModelIndex m_editIndex;
71 |
72 | bool m_alreadyLoaded = false;
73 | QVariantMap m_winProperties;
74 | bool m_wholeApp = false;
75 | };
76 |
77 | } // namespace
78 |
--------------------------------------------------------------------------------
/kcms/rules/optionsmodel.h:
--------------------------------------------------------------------------------
1 | /*
2 | SPDX-FileCopyrightText: 2020 Ismael Asensio
3 |
4 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
5 | */
6 |
7 | #ifndef KWIN_OPTIONS_MODEL_H
8 | #define KWIN_OPTIONS_MODEL_H
9 |
10 | #include
11 |
12 | #include
13 | #include
14 | #include
15 |
16 | namespace theseus_ship
17 | {
18 |
19 | class OptionsModel : public QAbstractListModel
20 | {
21 | Q_OBJECT
22 | Q_PROPERTY(int selectedIndex READ selectedIndex NOTIFY selectedIndexChanged)
23 | Q_PROPERTY(int allOptionsMask READ allOptionsMask NOTIFY modelUpdated)
24 | Q_PROPERTY(int useFlags READ useFlags CONSTANT)
25 |
26 | public:
27 | enum OptionsRole {
28 | ValueRole = Qt::UserRole,
29 | IconNameRole,
30 | OptionTypeRole, // The type of an option item, defaults to NormalOption
31 | BitMaskRole,
32 | };
33 | Q_ENUM(OptionsRole)
34 |
35 | enum OptionType {
36 | NormalOption = 0, /**< Normal option */
37 | ExclusiveOption, /**< An exclusive option, so all other option items are deselected when
38 | this one is selected */
39 | SelectAllOption, /**< All option items are selected when this option item is selected */
40 | };
41 | Q_ENUM(OptionType)
42 |
43 | struct Data {
44 | Data(const QVariant& value,
45 | const QString& text,
46 | const QIcon& icon = {},
47 | const QString& description = {},
48 | OptionType optionType = NormalOption)
49 | : value(value)
50 | , text(text)
51 | , icon(icon)
52 | , description(description)
53 | , optionType(optionType)
54 | {
55 | }
56 | Data(const QVariant& value, const QString& text, const QString& description)
57 | : value(value)
58 | , text(text)
59 | , description(description)
60 | {
61 | }
62 |
63 | QVariant value;
64 | QString text;
65 | QIcon icon;
66 | QString description;
67 | OptionType optionType = NormalOption;
68 | };
69 |
70 | public:
71 | OptionsModel(QList data = {}, bool useFlags = false)
72 | : QAbstractListModel()
73 | , m_data(data)
74 | , m_index(0)
75 | , m_useFlags(useFlags)
76 | {
77 | }
78 |
79 | int rowCount(const QModelIndex& parent = QModelIndex()) const override;
80 | QHash roleNames() const override;
81 | QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
82 |
83 | QVariant value() const;
84 | void setValue(QVariant value);
85 | void resetValue();
86 |
87 | bool useFlags() const;
88 | QVariant allValues() const;
89 | uint allOptionsMask() const;
90 |
91 | void updateModelData(const QList& data);
92 |
93 | Q_INVOKABLE int indexOf(QVariant value) const;
94 | Q_INVOKABLE QString textOfValue(QVariant value) const;
95 | int selectedIndex() const;
96 | uint bitMask(int index) const;
97 |
98 | Q_SIGNALS:
99 | void selectedIndexChanged(int index);
100 | void modelUpdated();
101 |
102 | public:
103 | QList m_data;
104 |
105 | protected:
106 | int m_index = 0;
107 | bool m_useFlags = false;
108 | };
109 |
110 | class RulePolicy : public OptionsModel
111 | {
112 | public:
113 | enum Type { NoPolicy, StringMatch, SetRule, ForceRule };
114 |
115 | public:
116 | RulePolicy(Type type)
117 | : OptionsModel(policyOptions(type))
118 | , m_type(type) {};
119 |
120 | Type type() const;
121 | int value() const;
122 | QString policyKey(const QString& key) const;
123 |
124 | private:
125 | static QList policyOptions(RulePolicy::Type type);
126 |
127 | private:
128 | Type m_type;
129 | };
130 |
131 | } // namespace
132 |
133 | #endif // KWIN_OPTIONS_MODEL_H
134 |
--------------------------------------------------------------------------------
/kcms/rules/rulebookmodel.h:
--------------------------------------------------------------------------------
1 | /*
2 | SPDX-FileCopyrightText: 2020 Ismael Asensio
3 |
4 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
5 | */
6 |
7 | #pragma once
8 |
9 | #include
10 | #include
11 |
12 | #include
13 |
14 | namespace theseus_ship
15 | {
16 |
17 | class RuleBookModel : public QAbstractListModel
18 | {
19 | Q_OBJECT
20 |
21 | public:
22 | enum {
23 | DescriptionRole = Qt::DisplayRole,
24 | };
25 |
26 | explicit RuleBookModel(QObject* parent = nullptr);
27 | ~RuleBookModel();
28 |
29 | QHash roleNames() const override;
30 | int rowCount(const QModelIndex& parent = QModelIndex()) const override;
31 | QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
32 | bool setData(const QModelIndex& index, const QVariant& value, int role) override;
33 |
34 | bool insertRows(int row, int count, const QModelIndex& parent = QModelIndex()) override;
35 | bool removeRows(int row, int count, const QModelIndex& parent = QModelIndex()) override;
36 | bool moveRows(const QModelIndex& sourceParent,
37 | int sourceRow,
38 | int count,
39 | const QModelIndex& destinationParent,
40 | int destinationChild) override;
41 |
42 | QString descriptionAt(int row) const;
43 | void setDescriptionAt(int row, const QString& description);
44 |
45 | como::win::rules::settings* ruleSettingsAt(int row) const;
46 | void setRuleSettingsAt(int row, como::win::rules::settings const& settings);
47 |
48 | void load();
49 | void save();
50 | bool isSaveNeeded();
51 |
52 | // Helper function to copy RuleSettings properties
53 | static void copySettingsTo(como::win::rules::settings* dest,
54 | como::win::rules::settings const& source);
55 |
56 | private:
57 | como::win::rules::book_settings* m_ruleBook;
58 | };
59 |
60 | } // namespace
61 |
--------------------------------------------------------------------------------
/kcms/rules/ruleitem.h:
--------------------------------------------------------------------------------
1 | /*
2 | SPDX-FileCopyrightText: 2020 Ismael Asensio
3 |
4 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
5 | */
6 |
7 | #ifndef KWIN_RULEITEM_H
8 | #define KWIN_RULEITEM_H
9 |
10 | #include "optionsmodel.h"
11 |
12 | #include
13 | #include
14 |
15 | namespace theseus_ship
16 | {
17 |
18 | class RuleItem : public QObject
19 | {
20 | Q_OBJECT
21 |
22 | public:
23 | enum Type {
24 | Undefined,
25 | Boolean,
26 | String,
27 | Integer,
28 | Option,
29 | NetTypes,
30 | Percentage,
31 | Point,
32 | Size,
33 | Shortcut,
34 | OptionList,
35 | };
36 | Q_ENUM(Type)
37 |
38 | enum Flags {
39 | NoFlags = 0,
40 | AlwaysEnabled = 1u << 0,
41 | StartEnabled = 1u << 1,
42 | AffectsWarning = 1u << 2,
43 | AffectsDescription = 1u << 3,
44 | SuggestionOnly = 1u << 4,
45 | AllFlags = 0b11111
46 | };
47 |
48 | public:
49 | RuleItem() {};
50 | RuleItem(const QString& key,
51 | const RulePolicy::Type policyType,
52 | const Type type,
53 | const QString& name,
54 | const QString& section,
55 | const QIcon& icon = QIcon::fromTheme("window"),
56 | const QString& description = QString(""));
57 |
58 | QString key() const;
59 | QString name() const;
60 | QString section() const;
61 | QIcon icon() const;
62 | QString iconName() const;
63 | QString description() const;
64 |
65 | bool isEnabled() const;
66 | void setEnabled(bool enabled);
67 |
68 | bool hasFlag(RuleItem::Flags flag) const;
69 | void setFlag(RuleItem::Flags flag, bool active = true);
70 |
71 | Type type() const;
72 | QVariant value() const;
73 | void setValue(QVariant value);
74 | QVariant suggestedValue() const;
75 | void setSuggestedValue(QVariant value);
76 |
77 | QVariant options() const;
78 | void setOptionsData(const QList& data);
79 |
80 | RulePolicy::Type policyType() const;
81 | int policy() const; // int belongs to anonymous enum in Rules::
82 | void setPolicy(int policy); // int belongs to anonymous enum in Rules::
83 | QVariant policyModel() const;
84 | QString policyKey() const;
85 |
86 | void reset();
87 |
88 | private:
89 | QVariant typedValue(const QVariant& value) const;
90 |
91 | private:
92 | QString m_key;
93 | RuleItem::Type m_type;
94 | QString m_name;
95 | QString m_section;
96 | QIcon m_icon;
97 | QString m_description;
98 | QFlags m_flags;
99 |
100 | bool m_enabled;
101 |
102 | QVariant m_value;
103 | QVariant m_suggestedValue;
104 |
105 | std::unique_ptr m_policy;
106 | std::unique_ptr m_options;
107 | };
108 |
109 | } // namespace
110 |
111 | #endif // KWIN_RULEITEM_H
112 |
--------------------------------------------------------------------------------
/kcms/rules/rulesmodel.h:
--------------------------------------------------------------------------------
1 | /*
2 | SPDX-FileCopyrightText: 2020 Ismael Asensio
3 |
4 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
5 | */
6 |
7 | #ifndef KWIN_RULES_MODEL_H
8 | #define KWIN_RULES_MODEL_H
9 |
10 | #include "ruleitem.h"
11 | #include
12 | #include
13 | #include
14 |
15 | #include
16 | #include
17 | #include
18 |
19 | namespace theseus_ship
20 | {
21 |
22 | class RulesModel : public QAbstractListModel
23 | {
24 | Q_OBJECT
25 |
26 | Q_PROPERTY(QString description READ description WRITE setDescription NOTIFY descriptionChanged)
27 | Q_PROPERTY(QStringList warningMessages READ warningMessages NOTIFY warningMessagesChanged)
28 |
29 | public:
30 | enum RulesRole {
31 | NameRole = Qt::DisplayRole,
32 | DescriptionRole = Qt::ToolTipRole,
33 | IconRole = Qt::DecorationRole,
34 | IconNameRole = Qt::UserRole + 1,
35 | KeyRole,
36 | SectionRole,
37 | EnabledRole,
38 | SelectableRole,
39 | ValueRole,
40 | TypeRole,
41 | PolicyRole,
42 | PolicyModelRole,
43 | OptionsModelRole,
44 | SuggestedValueRole
45 | };
46 | Q_ENUM(RulesRole)
47 |
48 | public:
49 | explicit RulesModel(QObject* parent = nullptr);
50 | ~RulesModel();
51 |
52 | int rowCount(const QModelIndex& parent = QModelIndex()) const override;
53 | QHash roleNames() const override;
54 | QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
55 | bool setData(const QModelIndex& index, const QVariant& value, int role) override;
56 |
57 | QModelIndex indexOf(const QString& key) const;
58 | bool hasRule(const QString& key) const;
59 | RuleItem* ruleItem(const QString& key) const;
60 |
61 | como::win::rules::settings* settings() const;
62 | void setSettings(como::win::rules::settings* settings);
63 |
64 | void setSuggestedProperties(const QVariantMap& info);
65 |
66 | QString description() const;
67 | void setDescription(const QString& description);
68 | QStringList warningMessages() const;
69 |
70 | Q_INVOKABLE void detectWindowProperties(int miliseconds);
71 |
72 | Q_SIGNALS:
73 | void descriptionChanged();
74 | void warningMessagesChanged();
75 |
76 | void showSuggestions();
77 | void showErrorMessage(const QString& title, const QString& message);
78 |
79 | void virtualDesktopsUpdated();
80 |
81 | private:
82 | void populateRuleList();
83 | RuleItem* addRule(RuleItem* rule);
84 | void writeToSettings(RuleItem* rule);
85 |
86 | QString defaultDescription() const;
87 | void processSuggestion(const QString& key, const QVariant& value);
88 |
89 | bool wmclassWarning() const;
90 | bool geometryWarning() const;
91 | bool opacityWarning() const;
92 |
93 | static const QHash x11PropertyHash();
94 | void updateVirtualDesktops();
95 |
96 | QList windowTypesModelData() const;
97 | QList virtualDesktopsModelData() const;
98 | QList placementModelData() const;
99 | QList focusModelData() const;
100 | QList colorSchemesModelData() const;
101 |
102 | private Q_SLOTS:
103 | void selectX11Window();
104 |
105 | private:
106 | QList m_ruleList;
107 | QHash m_rules;
108 | como::win::dbus::subspace_data_vector m_virtualDesktops;
109 | como::win::rules::settings* m_settings{nullptr};
110 | };
111 |
112 | }
113 |
114 | #endif
115 |
--------------------------------------------------------------------------------
/kcms/rules/ui/FileDialogLoader.qml:
--------------------------------------------------------------------------------
1 | /*
2 | SPDX-FileCopyrightText: 2020 Ismael Asensio
3 |
4 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
5 | */
6 |
7 | import QtCore
8 | import QtQuick
9 | import QtQuick.Dialogs as QtDialogs
10 |
11 | Loader {
12 | id: root
13 | active: false
14 |
15 | property string title : i18n("Select File");
16 | property string lastFolder : ""
17 | property bool isSaveDialog : false
18 |
19 | signal fileSelected(string path)
20 |
21 | sourceComponent: QtDialogs.FileDialog {
22 | id: fileDialog
23 |
24 | title: root.title
25 | fileMode: root.isSaveDialog ? QtDialogs.FileDialog.SaveFile : QtDialogs.FileDialog.OpenFile
26 | currentFolder: root.lastFolder || StandardPaths.standardLocations(StandardPaths.HomeLocation)[0]
27 | nameFilters: [ i18n("KWin Rules (*.kwinrule)") ]
28 | defaultSuffix: "*.kwinrule"
29 |
30 | Component.onCompleted: {
31 | open();
32 | }
33 |
34 | onAccepted: {
35 | root.lastFolder = currentFolder;
36 | if (selectedFile != "") {
37 | root.fileSelected(selectedFile);
38 | }
39 | root.active = false;
40 | }
41 |
42 | onRejected: {
43 | root.active = false;
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/kcms/rules/ui/OptionsComboBox.qml:
--------------------------------------------------------------------------------
1 | /*
2 | SPDX-FileCopyrightText: 2020 Ismael Asensio
3 |
4 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
5 | */
6 |
7 | import QtQuick
8 | import QtQuick.Layouts
9 | import QtQuick.Controls as QQC2
10 |
11 | import org.kde.kirigami 2.10 as Kirigami
12 | import org.kde.kcms.kwinrules
13 |
14 |
15 | QQC2.ComboBox {
16 | id: optionsCombo
17 |
18 | textRole: "display"
19 | valueRole: "value"
20 |
21 | property bool multipleChoice: false
22 | property int selectionMask: 0
23 | readonly property int allOptionsMask: model.allOptionsMask
24 |
25 | currentIndex: multipleChoice ? -1 : model.selectedIndex
26 |
27 | displayText: {
28 | if (!multipleChoice) {
29 | return currentText;
30 | }
31 | const selectionCount = selectionMask.toString(2).replace(/0/g, '').length;
32 | const optionsCount = allOptionsMask.toString(2).replace(/0/g, '').length;
33 | switch (selectionCount) {
34 | case 0:
35 | return i18n("None selected");
36 | case 1:
37 | const selectedBit = selectionMask.toString(2).length - 1;
38 | const selectedIndex = (model.useFlags) ? model.indexOf(selectionMask) : selectedBit
39 | return model.data(model.index(selectedIndex, 0), Qt.DisplayRole);
40 | case optionsCount:
41 | return i18n("All selected");
42 | }
43 | return i18np("%1 selected", "%1 selected", selectionCount);
44 | }
45 |
46 | delegate: QQC2.ItemDelegate {
47 | id: delegateItem
48 |
49 | highlighted: optionsCombo.highlightedIndex == index
50 | width: parent.width
51 |
52 | contentItem: RowLayout {
53 | QQC2.RadioButton {
54 | id: radioButton
55 | visible: multipleChoice && model.optionType === OptionsModel.ExclusiveOption
56 | checked: (selectionMask & bitMask) == bitMask
57 | enabled: false // We don't want to uncheck the exclusive option on toggle
58 | }
59 | QQC2.CheckBox {
60 | id: checkBox
61 | visible: multipleChoice && model.optionType !== OptionsModel.ExclusiveOption
62 | checked: (selectionMask & model.bitMask) == model.bitMask
63 | onToggled: {
64 | selectionMask = (checked) ? selectionMask | model.bitMask : selectionMask & ~model.bitMask;
65 | selectionMask &= allOptionsMask;
66 | activated(index);
67 | }
68 | }
69 | Kirigami.Icon {
70 | source: model.decoration
71 | Layout.preferredHeight: Kirigami.Units.iconSizes.small
72 | Layout.preferredWidth: Kirigami.Units.iconSizes.small
73 | }
74 | QQC2.Label {
75 | text: model.display
76 | color: highlighted ? Kirigami.Theme.highlightedTextColor : Kirigami.Theme.textColor
77 | Layout.fillWidth: true
78 | horizontalAlignment: Text.AlignLeft
79 | }
80 | }
81 |
82 | MouseArea {
83 | anchors.fill: contentItem
84 | enabled: multipleChoice
85 | onClicked: {
86 | if (checkBox.visible) {
87 | checkBox.toggle();
88 | checkBox.toggled();
89 | } else if (radioButton.visible) {
90 | selectionMask = model.bitMask; // Only check the exclusive option
91 | activated(index);
92 | }
93 | }
94 | }
95 |
96 | QQC2.ToolTip {
97 | text: model.tooltip
98 | visible: hovered && (model.tooltip.length > 0)
99 | }
100 |
101 | Component.onCompleted: {
102 | //FIXME: work around bug https://bugs.kde.org/show_bug.cgi?id=403153
103 | optionsCombo.popup.width = Math.max(implicitWidth, optionsCombo.width, optionsCombo.popup.width);
104 | }
105 |
106 | onActiveFocusChanged: {
107 | if (!activeFocus) {
108 | popup.close();
109 | }
110 | }
111 | }
112 | }
113 |
--------------------------------------------------------------------------------
/kcms/rules/ui/RuleItemDelegate.qml:
--------------------------------------------------------------------------------
1 | /*
2 | SPDX-FileCopyrightText: 2020 Ismael Asensio
3 |
4 | SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
5 | */
6 |
7 | import QtQuick
8 | import QtQuick.Layouts
9 | import QtQuick.Controls as QQC2
10 | import org.kde.kirigami as Kirigami
11 | import org.kde.kcmutils as KCM
12 |
13 | QQC2.ItemDelegate {
14 | id: ruleDelegate
15 |
16 | width: ListView.view.width
17 | highlighted: false
18 | hoverEnabled: false
19 | down: false
20 |
21 | contentItem: RowLayout {
22 |
23 | Kirigami.Icon {
24 | id: itemIcon
25 | source: model.icon
26 | Layout.preferredHeight: Kirigami.Units.iconSizes.smallMedium
27 | Layout.preferredWidth: Kirigami.Units.iconSizes.smallMedium
28 | Layout.rightMargin: Kirigami.Units.smallSpacing
29 | Layout.alignment: Qt.AlignVCenter
30 | }
31 |
32 | RowLayout {
33 | Layout.preferredWidth: 10 * Kirigami.Units.gridUnit
34 | Layout.preferredHeight: Kirigami.Units.iconSizes.medium
35 | spacing: Kirigami.Units.smallSpacing
36 |
37 | QQC2.Label {
38 | id: label
39 | text: model.name
40 | horizontalAlignment: Text.AlignLeft
41 | elide: Text.ElideRight
42 | Layout.fillWidth: true
43 | Layout.alignment: Qt.AlignVCenter
44 |
45 | HoverHandler {
46 | id: labelHover
47 | enabled: label.truncated
48 | }
49 |
50 | QQC2.ToolTip.text: model.name
51 | QQC2.ToolTip.visible: labelHover.hovered
52 | QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
53 | }
54 |
55 | Kirigami.ContextualHelpButton {
56 | Layout.alignment: Qt.AlignVCenter
57 | visible: model.description.length > 0
58 | toolTipText: model.description
59 | }
60 | }
61 |
62 | RowLayout {
63 | // This layout keeps the width constant between delegates, independent of items visibility
64 | Layout.fillWidth: true
65 | Layout.preferredWidth: 20 * Kirigami.Units.gridUnit
66 | Layout.minimumWidth: 13 * Kirigami.Units.gridUnit
67 |
68 | OptionsComboBox {
69 | id: policyCombo
70 | Layout.preferredWidth: 50 // 50%
71 | Layout.fillWidth: true
72 | Layout.alignment: Qt.AlignVCenter
73 |
74 | visible: count > 0
75 |
76 | model: policyModel
77 | onActivated: {
78 | policy = currentValue;
79 | }
80 | }
81 |
82 | ValueEditor {
83 | id: valueEditor
84 | Layout.preferredWidth: 50 // 50%
85 | Layout.fillWidth: true
86 | Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
87 |
88 | ruleValue: model.value
89 | ruleOptions: model.options
90 | controlType: model.type
91 |
92 | onValueEdited: (value) => {
93 | model.value = value;
94 | }
95 | }
96 |
97 | QQC2.ToolButton {
98 | id: itemEnabled
99 | icon.name: "edit-delete"
100 | visible: model.selectable
101 | Layout.alignment: Qt.AlignVCenter
102 | onClicked: {
103 | model.enabled = false;
104 | }
105 | }
106 | }
107 |
108 | QQC2.ToolTip {
109 | text: model.description
110 | visible: hovered && (text.length > 0)
111 | }
112 | }
113 | }
114 |
--------------------------------------------------------------------------------
/kcms/screenedges/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2023 Roman Gilg
2 | #
3 | # SPDX-License-Identifier: GPL-2.0-or-later
4 |
5 | # KI18N Translation Domain for this library
6 | add_definitions(-DTRANSLATION_DOMAIN=\"kcmkwinscreenedges\")
7 |
8 | set(kcm_screenedges_SRCS
9 | monitor.cpp
10 | screenpreviewwidget.cpp
11 | kwinscreenedge.cpp
12 | kwinscreenedgeconfigform.cpp
13 | )
14 | qt_add_dbus_interface(kcm_screenedges_SRCS
15 | ${KWIN_EFFECTS_INTERFACE} kwin_effects_interface
16 | )
17 |
18 | set(kcm_kwinscreenedges_PART_SRCS main.cpp ${kcm_screenedges_SRCS})
19 |
20 | kcmutils_generate_module_data(
21 | kcm_kwinscreenedges_PART_SRCS
22 | MODULE_DATA_HEADER kwinscreenedgedata.h
23 | MODULE_DATA_CLASS_NAME KWinScreenEdgeData
24 | SETTINGS_HEADERS kwinscreenedgesettings.h
25 | SETTINGS_CLASSES KWinScreenEdgeSettings
26 | NAMESPACE theseus_ship
27 | )
28 |
29 | ki18n_wrap_ui(kcm_kwinscreenedges_PART_SRCS main.ui)
30 | kconfig_add_kcfg_files(kcm_kwinscreenedges_PART_SRCS kwinscreenedgesettings.kcfgc kwinscreenedgescriptsettings.kcfgc kwinscreenedgeeffectsettings.kcfgc)
31 | kcoreaddons_add_plugin(kcm_kwinscreenedges SOURCES ${kcm_kwinscreenedges_PART_SRCS} INSTALL_NAMESPACE "plasma/kcms/systemsettings_qwidgets")
32 | set(kcm_screenedges_LIBS
33 | KF6::ConfigCore
34 | KF6::KCMUtils
35 | KF6::I18n
36 | KF6::Package
37 | KF6::Svg
38 | Qt::DBus
39 | como::win
40 | )
41 | target_link_libraries(kcm_kwinscreenedges ${X11_LIBRARIES} ${kcm_screenedges_LIBS})
42 |
43 | set(kcm_kwintouchscreenedges_PART_SRCS
44 | touch.cpp
45 | kwintouchscreenedgeconfigform.cpp
46 | ${kcm_screenedges_SRCS}
47 | )
48 |
49 | kcmutils_generate_module_data(
50 | kcm_kwintouchscreenedges_PART_SRCS
51 | MODULE_DATA_HEADER kwintouchscreendata.h
52 | MODULE_DATA_CLASS_NAME KWinTouchScreenData
53 | SETTINGS_HEADERS kwintouchscreensettings.h
54 | SETTINGS_CLASSES KWinTouchScreenSettings
55 | NAMESPACE theseus_ship
56 | )
57 |
58 | ki18n_wrap_ui(kcm_kwintouchscreenedges_PART_SRCS main.ui touch.ui)
59 | kconfig_add_kcfg_files(kcm_kwintouchscreenedges_PART_SRCS kwintouchscreensettings.kcfgc kwintouchscreenscriptsettings.kcfgc kwintouchscreenedgeeffectsettings.kcfgc)
60 | kcoreaddons_add_plugin(kcm_kwintouchscreen SOURCES ${kcm_kwintouchscreenedges_PART_SRCS} INSTALL_NAMESPACE "plasma/kcms/systemsettings_qwidgets")
61 | target_link_libraries(kcm_kwintouchscreen ${X11_LIBRARIES} ${kcm_screenedges_LIBS})
62 |
--------------------------------------------------------------------------------
/kcms/screenedges/Messages.sh:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env bash
2 |
3 | # SPDX-FileCopyrightText: 2023 Roman Gilg
4 | #
5 | # SPDX-License-Identifier: GPL-2.0-or-later
6 |
7 | $EXTRACTRC *.ui >> rc.cpp || exit 11
8 | $XGETTEXT *.cpp -o $podir/kcmkwinscreenedges.pot
9 | rm -f rc.cpp
10 |
--------------------------------------------------------------------------------
/kcms/screenedges/kwinscreenedge.h:
--------------------------------------------------------------------------------
1 | /*
2 | SPDX-FileCopyrightText: 2009 Lucas Murray
3 | SPDX-FileCopyrightText: 2020 Cyril Rossi
4 |
5 | SPDX-License-Identifier: GPL-2.0-or-later
6 | */
7 |
8 | #ifndef __KWINSCREENEDGE_H__
9 | #define __KWINSCREENEDGE_H__
10 |
11 | #include
12 |
13 | #include
14 |
15 | namespace theseus_ship
16 | {
17 |
18 | class Monitor;
19 |
20 | class KWinScreenEdge : public QWidget
21 | {
22 | Q_OBJECT
23 |
24 | public:
25 | explicit KWinScreenEdge(QWidget* parent = nullptr);
26 | ~KWinScreenEdge() override;
27 |
28 | void monitorHideEdge(como::win::electric_border border, bool hidden);
29 | void monitorEnableEdge(como::win::electric_border border, bool enabled);
30 |
31 | void monitorAddItem(const QString& item);
32 | void monitorItemSetEnabled(int index, bool enabled);
33 |
34 | QList monitorCheckEffectHasEdge(int index) const;
35 | QList monitorCheckEffectHasEdgeInt(int index) const;
36 | int selectedEdgeItem(como::win::electric_border border) const;
37 |
38 | void monitorChangeEdge(como::win::electric_border border, int index);
39 | void monitorChangeEdge(const QList& borderList, int index);
40 |
41 | void monitorChangeDefaultEdge(como::win::electric_border border, int index);
42 | void monitorChangeDefaultEdge(const QList& borderList, int index);
43 |
44 | // revert to reference settings and assess for saveNeeded and default changed
45 | virtual void reload();
46 | // reset to default settings and assess for saveNeeded and default changed
47 | virtual void setDefaults();
48 |
49 | public Q_SLOTS:
50 | void onChanged();
51 | void createConnection();
52 |
53 | Q_SIGNALS:
54 | void saveNeededChanged(bool isNeeded);
55 | void defaultChanged(bool isDefault);
56 |
57 | private:
58 | virtual Monitor* monitor() const = 0;
59 | virtual bool isSaveNeeded() const;
60 | virtual bool isDefault() const;
61 |
62 | // internal use, return Monitor::None if border equals ELECTRIC_COUNT or ElectricNone
63 | static int electricBorderToMonitorEdge(como::win::electric_border border);
64 |
65 | private:
66 | QHash m_reference; // reference settings
67 | QHash m_default; // default settings
68 | };
69 |
70 | } // namespace
71 |
72 | #endif
73 |
--------------------------------------------------------------------------------
/kcms/screenedges/kwinscreenedgeconfigform.h:
--------------------------------------------------------------------------------
1 | /*
2 | SPDX-FileCopyrightText: 2009 Lucas Murray
3 | SPDX-FileCopyrightText: 2020 Cyril Rossi
4 |
5 | SPDX-License-Identifier: GPL-2.0-or-later
6 | */
7 |
8 | #ifndef __KWINSCREENEDGECONFIGFORM_H__
9 | #define __KWINSCREENEDGECONFIGFORM_H__
10 |
11 | #include "kwinscreenedge.h"
12 |
13 | namespace Ui
14 | {
15 | class KWinScreenEdgesConfigUI;
16 | }
17 |
18 | namespace theseus_ship
19 | {
20 |
21 | class KWinScreenEdgesConfigForm : public KWinScreenEdge
22 | {
23 | Q_OBJECT
24 |
25 | public:
26 | KWinScreenEdgesConfigForm(QWidget* parent = nullptr);
27 | ~KWinScreenEdgesConfigForm() override;
28 |
29 | void setRemainActiveOnFullscreen(bool remainActive);
30 | bool remainActiveOnFullscreen() const;
31 |
32 | // value is between 0. and 1.
33 | void setElectricBorderCornerRatio(double value);
34 | void setDefaultElectricBorderCornerRatio(double value);
35 |
36 | // return value between 0. and 1.
37 | double electricBorderCornerRatio() const;
38 |
39 | void setElectricBorderCornerRatioEnabled(bool enable);
40 |
41 | void reload() override;
42 | void setDefaults() override;
43 |
44 | public Q_SLOTS:
45 | void setDefaultsIndicatorsVisible(bool visible);
46 |
47 | protected:
48 | Monitor* monitor() const override;
49 | bool isSaveNeeded() const override;
50 | bool isDefault() const override;
51 |
52 | private Q_SLOTS:
53 | void sanitizeCooldown();
54 | void groupChanged();
55 | void updateDefaultIndicators();
56 |
57 | private:
58 | bool m_remainActiveOnFullscreen = false;
59 |
60 | // electricBorderCornerRatio value between 0. and 1.
61 | double m_referenceCornerRatio = 0.;
62 | double m_defaultCornerRatio = 0.;
63 |
64 | bool m_defaultIndicatorVisible = false;
65 |
66 | Ui::KWinScreenEdgesConfigUI* ui;
67 | };
68 |
69 | } // namespace
70 |
71 | #endif
72 |
--------------------------------------------------------------------------------
/kcms/screenedges/kwinscreenedgeeffectsettings.kcfg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
13 |
14 |
15 |
16 |
17 |
18 | int(como::win::electric_border::none)
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/kcms/screenedges/kwinscreenedgeeffectsettings.kcfgc:
--------------------------------------------------------------------------------
1 | ; SPDX-FileCopyrightText: 2023 Roman Gilg
2 | ;
3 | ; SPDX-License-Identifier: GPL-2.0-or-later
4 |
5 | File=kwinscreenedgeeffectsettings.kcfg
6 | NameSpace=theseus_ship
7 | ClassName=KWinScreenEdgeEffectSettings
8 | IncludeFiles=como/win/types.h
9 | Mutators=true
10 | DefaultValueGetters=true
11 | ParentInConstructor=true
12 |
--------------------------------------------------------------------------------
/kcms/screenedges/kwinscreenedgescriptsettings.kcfg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
13 |
14 |
15 |
16 |
17 |
18 | int(como::win::electric_border::none)
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/kcms/screenedges/kwinscreenedgescriptsettings.kcfgc:
--------------------------------------------------------------------------------
1 | ; SPDX-FileCopyrightText: 2023 Roman Gilg
2 | ;
3 | ; SPDX-License-Identifier: GPL-2.0-or-later
4 |
5 | File=kwinscreenedgescriptsettings.kcfg
6 | NameSpace=theseus_ship
7 | ClassName=KWinScreenEdgeScriptSettings
8 | IncludeFiles=como/win/types.h
9 | Mutators=true
10 | DefaultValueGetters=true
11 | ParentInConstructor=true
12 |
--------------------------------------------------------------------------------
/kcms/screenedges/kwinscreenedgesettings.kcfg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
13 |
14 |
15 |
16 | 0
17 |
18 |
19 | 150
20 |
21 |
22 | 350
23 |
24 |
25 | true
26 |
27 |
28 | true
29 |
30 |
31 | 0.25
32 |
33 |
34 |
35 |
36 | None
37 |
38 |
39 | None
40 |
41 |
42 | None
43 |
44 |
45 | None
46 |
47 |
48 | None
49 |
50 |
51 | None
52 |
53 |
54 | None
55 |
56 |
57 | None
58 |
59 |
60 |
61 |
62 | int(como::win::electric_border::none)
63 |
64 |
65 | int(como::win::electric_border::none)
66 |
67 |
68 | int(como::win::electric_border::none)
69 |
70 |
71 |
72 |
73 | int(como::win::electric_border::none)
74 |
75 |
76 | int(como::win::electric_border::none)
77 |
78 |
79 | int(como::win::electric_border::none)
80 |
81 |
82 |
83 |
84 | int(como::win::electric_border::top_left)
85 |
86 |
87 | int(como::win::electric_border::none)
88 |
89 |
90 |
91 |
92 | int(como::win::electric_border::left)
93 |
94 |
95 | int(como::win::electric_border::none)
96 |
97 |
98 |
99 |
100 | false
101 |
102 |
103 |
104 |
--------------------------------------------------------------------------------
/kcms/screenedges/kwinscreenedgesettings.kcfgc:
--------------------------------------------------------------------------------
1 | ; SPDX-FileCopyrightText: 2023 Roman Gilg
2 | ;
3 | ; SPDX-License-Identifier: GPL-2.0-or-later
4 |
5 | File=kwinscreenedgesettings.kcfg
6 | NameSpace=theseus_ship
7 | ClassName=KWinScreenEdgeSettings
8 | IncludeFiles=como/win/types.h
9 | Mutators=true
10 | DefaultValueGetters=true
11 | ParentInConstructor=true
12 |
--------------------------------------------------------------------------------
/kcms/screenedges/kwintouchscreenedgeconfigform.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | SPDX-FileCopyrightText: 2009 Lucas Murray
3 | SPDX-FileCopyrightText: 2020 Cyril Rossi
4 |
5 | SPDX-License-Identifier: GPL-2.0-or-later
6 | */
7 |
8 | #include "kwintouchscreenedgeconfigform.h"
9 | #include "ui_touch.h"
10 |
11 | namespace theseus_ship
12 | {
13 |
14 | KWinTouchScreenEdgeConfigForm::KWinTouchScreenEdgeConfigForm(QWidget* parent)
15 | : KWinScreenEdge(parent)
16 | , ui(new Ui::KWinTouchScreenConfigUi)
17 | {
18 | ui->setupUi(this);
19 | }
20 |
21 | KWinTouchScreenEdgeConfigForm::~KWinTouchScreenEdgeConfigForm()
22 | {
23 | delete ui;
24 | }
25 |
26 | Monitor* KWinTouchScreenEdgeConfigForm::monitor() const
27 | {
28 | return ui->monitor;
29 | }
30 |
31 | } // namespace
32 |
--------------------------------------------------------------------------------
/kcms/screenedges/kwintouchscreenedgeconfigform.h:
--------------------------------------------------------------------------------
1 | /*
2 | SPDX-FileCopyrightText: 2009 Lucas Murray
3 | SPDX-FileCopyrightText: 2020 Cyril Rossi
4 |
5 | SPDX-License-Identifier: GPL-2.0-or-later
6 | */
7 |
8 | #ifndef __KWINTOUCHSCREENEDGECONFIGFORM_H__
9 | #define __KWINTOUCHSCREENEDGECONFIGFORM_H__
10 |
11 | #include "kwinscreenedge.h"
12 |
13 | namespace Ui
14 | {
15 | class KWinTouchScreenConfigUi;
16 | }
17 |
18 | namespace theseus_ship
19 | {
20 |
21 | class KWinTouchScreenEdgeConfigForm : public KWinScreenEdge
22 | {
23 | Q_OBJECT
24 |
25 | public:
26 | KWinTouchScreenEdgeConfigForm(QWidget* parent = nullptr);
27 | ~KWinTouchScreenEdgeConfigForm() override;
28 |
29 | protected:
30 | Monitor* monitor() const override;
31 |
32 | private:
33 | Ui::KWinTouchScreenConfigUi* ui;
34 | };
35 |
36 | } // namespace
37 |
38 | #endif
39 |
--------------------------------------------------------------------------------
/kcms/screenedges/kwintouchscreenedgeeffectsettings.kcfg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
13 |
14 |
15 |
16 |
17 |
18 | int(como::win::electric_border::none)
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/kcms/screenedges/kwintouchscreenedgeeffectsettings.kcfgc:
--------------------------------------------------------------------------------
1 | ; SPDX-FileCopyrightText: 2023 Roman Gilg
2 | ;
3 | ; SPDX-License-Identifier: GPL-2.0-or-later
4 |
5 | File=kwintouchscreenedgeeffectsettings.kcfg
6 | NameSpace=theseus_ship
7 | ClassName=KWinTouchScreenEdgeEffectSettings
8 | IncludeFiles=como/win/types.h
9 | Mutators=true
10 | DefaultValueGetters=true
11 | ParentInConstructor=true
12 |
--------------------------------------------------------------------------------
/kcms/screenedges/kwintouchscreenscriptsettings.kcfg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
13 |
14 |
15 |
16 |
17 |
18 | int(como::win::electric_border::none)
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/kcms/screenedges/kwintouchscreenscriptsettings.kcfgc:
--------------------------------------------------------------------------------
1 | ; SPDX-FileCopyrightText: 2023 Roman Gilg
2 | ;
3 | ; SPDX-License-Identifier: GPL-2.0-or-later
4 |
5 | File=kwintouchscreenscriptsettings.kcfg
6 | NameSpace=theseus_ship
7 | ClassName=KWinTouchScreenScriptSettings
8 | IncludeFiles=como/win/types.h
9 | Mutators=true
10 | DefaultValueGetters=true
11 | ParentInConstructor=true
12 |
--------------------------------------------------------------------------------
/kcms/screenedges/kwintouchscreensettings.kcfg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
13 |
14 |
15 |
16 | None
17 |
18 |
19 | None
20 |
21 |
22 | None
23 |
24 |
25 | None
26 |
27 |
28 |
29 |
30 | int(como::win::electric_border::none)
31 |
32 |
33 | int(como::win::electric_border::none)
34 |
35 |
36 | int(como::win::electric_border::none)
37 |
38 |
39 |
40 |
41 | int(como::win::electric_border::none)
42 |
43 |
44 | int(como::win::electric_border::none)
45 |
46 |
47 | int(como::win::electric_border::none)
48 |
49 |
50 |
51 |
52 | int(como::win::electric_border::none)
53 |
54 |
55 | int(como::win::electric_border::none)
56 |
57 |
58 |
59 |
60 | int(como::win::electric_border::none)
61 |
62 |
63 | int(como::win::electric_border::none)
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/kcms/screenedges/kwintouchscreensettings.kcfgc:
--------------------------------------------------------------------------------
1 | ; SPDX-FileCopyrightText: 2023 Roman Gilg
2 | ;
3 | ; SPDX-License-Identifier: GPL-2.0-or-later
4 |
5 | File=kwintouchscreensettings.kcfg
6 | NameSpace=theseus_ship
7 | ClassName=KWinTouchScreenSettings
8 | IncludeFiles=como/win/types.h
9 | Mutators=true
10 | DefaultValueGetters=true
11 | ParentInConstructor=true
12 |
--------------------------------------------------------------------------------
/kcms/screenedges/main.h:
--------------------------------------------------------------------------------
1 | /*
2 | SPDX-FileCopyrightText: 2009 Lucas Murray
3 | SPDX-FileCopyrightText: 2020 Cyril Rossi
4 |
5 | SPDX-License-Identifier: GPL-2.0-or-later
6 | */
7 |
8 | #ifndef __MAIN_H__
9 | #define __MAIN_H__
10 |
11 | #include
12 | #include
13 |
14 | #include
15 |
16 | namespace theseus_ship
17 | {
18 | class KWinScreenEdgeData;
19 | class KWinScreenEdgesConfigForm;
20 | class KWinScreenEdgeScriptSettings;
21 | class KWinScreenEdgeEffectSettings;
22 |
23 | class KWinScreenEdgesConfig : public KCModule
24 | {
25 | Q_OBJECT
26 |
27 | public:
28 | explicit KWinScreenEdgesConfig(QObject* parent, const KPluginMetaData& data);
29 | ~KWinScreenEdgesConfig() override;
30 |
31 | public Q_SLOTS:
32 | void save() override;
33 | void load() override;
34 | void defaults() override;
35 |
36 | private:
37 | KWinScreenEdgesConfigForm* m_form;
38 | KSharedConfigPtr m_config;
39 | QStringList m_effects; // list of effect IDs ordered in the list they are presented in the menu
40 | QStringList m_scripts; // list of script IDs ordered in the list they are presented in the menu
41 | QHash m_scriptSettings;
42 | QHash m_effectSettings;
43 | KWinScreenEdgeData* m_data;
44 |
45 | enum EffectActions {
46 | PresentWindowsAll = static_cast(
47 | como::win::electric_border_action::count), // Start at the end of built in actions
48 | PresentWindowsCurrent,
49 | PresentWindowsClass,
50 | Cube,
51 | Cylinder,
52 | Sphere,
53 | Overview,
54 | Grid,
55 | TabBox,
56 | TabBoxAlternative,
57 | EffectCount
58 | };
59 |
60 | void monitorInit();
61 | void monitorLoadSettings();
62 | void monitorLoadDefaultSettings();
63 | void monitorSaveSettings();
64 | void monitorShowEvent();
65 |
66 | static int electricBorderActionFromString(const QString& string);
67 | static QString electricBorderActionToString(int action);
68 | };
69 |
70 | } // namespace
71 |
72 | #endif
73 |
--------------------------------------------------------------------------------
/kcms/screenedges/monitor.h:
--------------------------------------------------------------------------------
1 | /*
2 | SPDX-FileCopyrightText: 2008 Lubos Lunak
3 | SPDX-FileCopyrightText: 2009 Lucas Murray
4 |
5 | SPDX-License-Identifier: GPL-2.0-or-later
6 | */
7 |
8 | #ifndef CCSM_MONITOR_H
9 | #define CCSM_MONITOR_H
10 |
11 | #include "screenpreviewwidget.h"
12 |
13 | #include
14 | #include
15 | #include
16 |
17 | class QAction;
18 | class QGraphicsView;
19 | class QGraphicsScene;
20 | class QMenu;
21 |
22 | namespace KSvg
23 | {
24 | class FrameSvg;
25 | }
26 |
27 | namespace theseus_ship
28 | {
29 |
30 | class Monitor : public ScreenPreviewWidget
31 | {
32 | Q_OBJECT
33 | public:
34 | explicit Monitor(QWidget* parent);
35 | void setEdge(int edge, bool set);
36 | bool edge(int edge) const;
37 | void setEdgeEnabled(int edge, bool enabled);
38 | void setEdgeHidden(int edge, bool set);
39 | bool edgeHidden(int edge) const;
40 | void clear();
41 | void addEdgeItem(int edge, const QString& item);
42 | void setEdgeItemEnabled(int edge, int index, bool enabled);
43 | bool edgeItemEnabled(int edge, int index) const;
44 | void selectEdgeItem(int edge, int index);
45 | int selectedEdgeItem(int edge) const;
46 |
47 | enum Edges { Left, Right, Top, Bottom, TopLeft, TopRight, BottomLeft, BottomRight, None };
48 | Q_SIGNALS:
49 | void changed();
50 | void edgeSelectionChanged(int edge, int index);
51 |
52 | protected:
53 | void resizeEvent(QResizeEvent* e) override;
54 | bool event(QEvent* event) override;
55 |
56 | private:
57 | class Corner;
58 | void popup(Corner* c, QPoint pos);
59 | void flip(Corner* c, QPoint pos);
60 | void checkSize();
61 | QGraphicsView* view;
62 | QGraphicsScene* scene;
63 | Corner* items[8];
64 | bool hidden[8];
65 | QMenu* popups[8];
66 | QVector popup_actions[8];
67 | QActionGroup* grp[8];
68 | };
69 |
70 | class Monitor::Corner : public QGraphicsRectItem
71 | {
72 | public:
73 | Corner(Monitor* m);
74 | ~Corner() override;
75 | void setActive(bool active);
76 | bool active() const;
77 |
78 | protected:
79 | void contextMenuEvent(QGraphicsSceneContextMenuEvent* e) override;
80 | void mousePressEvent(QGraphicsSceneMouseEvent* e) override;
81 | void hoverEnterEvent(QGraphicsSceneHoverEvent* e) override;
82 | void hoverLeaveEvent(QGraphicsSceneHoverEvent* e) override;
83 | void paint(QPainter* painter,
84 | const QStyleOptionGraphicsItem* option,
85 | QWidget* widget = nullptr) override;
86 |
87 | private:
88 | Monitor* monitor;
89 | KSvg::FrameSvg* button;
90 | bool m_active;
91 | bool m_hover;
92 | };
93 |
94 | } // namespace
95 |
96 | #endif
97 |
--------------------------------------------------------------------------------
/kcms/screenedges/screenpreviewwidget.h:
--------------------------------------------------------------------------------
1 | /* This file is part of the KDE libraries
2 |
3 | SPDX-FileCopyrightText: 2009 Marco Martin
4 |
5 | SPDX-License-Identifier: LGPL-2.0-or-later
6 | */
7 |
8 | #ifndef SCREENPREVIEWWIDGET_H
9 | #define SCREENPREVIEWWIDGET_H
10 |
11 | #include
12 |
13 | namespace KSvg
14 | {
15 | class ImageSet;
16 | }
17 |
18 | class ScreenPreviewWidgetPrivate;
19 |
20 | class ScreenPreviewWidget : public QWidget
21 | {
22 | Q_OBJECT
23 |
24 | public:
25 | ScreenPreviewWidget(QWidget* parent);
26 | ~ScreenPreviewWidget() override;
27 |
28 | void setPreview(const QPixmap& preview);
29 | const QPixmap preview() const;
30 |
31 | void setRatio(const qreal ratio);
32 | qreal ratio() const;
33 |
34 | void setMinimumContentWidth(qreal minw);
35 | qreal minimumContentWidth() const;
36 |
37 | QRect previewRect() const;
38 | KSvg::ImageSet* svgImageSet() const;
39 |
40 | protected:
41 | void resizeEvent(QResizeEvent* event) override;
42 | void paintEvent(QPaintEvent* event) override;
43 |
44 | private:
45 | ScreenPreviewWidgetPrivate* const d;
46 |
47 | Q_PRIVATE_SLOT(d, void updateRect(const QRectF& rect))
48 | };
49 |
50 | #endif
51 |
--------------------------------------------------------------------------------
/kcms/screenedges/touch.h:
--------------------------------------------------------------------------------
1 | /*
2 | SPDX-FileCopyrightText: 2009 Lucas Murray
3 | SPDX-FileCopyrightText: 2020 Cyril Rossi
4 |
5 | SPDX-License-Identifier: GPL-2.0-or-later
6 | */
7 |
8 | #ifndef __TOUCH_H__
9 | #define __TOUCH_H__
10 |
11 | #include
12 | #include
13 |
14 | #include
15 |
16 | class QShowEvent;
17 |
18 | namespace theseus_ship
19 | {
20 | class KWinTouchScreenData;
21 | class KWinTouchScreenEdgeConfigForm;
22 | class KWinTouchScreenScriptSettings;
23 | class KWinTouchScreenEdgeEffectSettings;
24 |
25 | class KWinScreenEdgesConfig : public KCModule
26 | {
27 | Q_OBJECT
28 |
29 | public:
30 | explicit KWinScreenEdgesConfig(QObject* parent, const KPluginMetaData& data);
31 | ~KWinScreenEdgesConfig() override;
32 |
33 | public Q_SLOTS:
34 | void save() override;
35 | void load() override;
36 | void defaults() override;
37 |
38 | private:
39 | KWinTouchScreenEdgeConfigForm* m_form;
40 | KSharedConfigPtr m_config;
41 | QStringList m_effects; // list of effect IDs ordered in the list they are presented in the menu
42 | QStringList m_scripts; // list of script IDs ordered in the list they are presented in the menu
43 | QHash m_scriptSettings;
44 | QHash m_effectSettings;
45 | KWinTouchScreenData* m_data;
46 |
47 | enum EffectActions {
48 | PresentWindowsAll = static_cast(
49 | como::win::electric_border_action::count), // Start at the end of built in actions
50 | PresentWindowsCurrent,
51 | PresentWindowsClass,
52 | Cube,
53 | Cylinder,
54 | Sphere,
55 | Overview,
56 | Grid,
57 | TabBox,
58 | TabBoxAlternative,
59 | EffectCount
60 | };
61 |
62 | void monitorInit();
63 | void monitorLoadSettings();
64 | void monitorLoadDefaultSettings();
65 | void monitorSaveSettings();
66 | void monitorShowEvent();
67 |
68 | static int electricBorderActionFromString(const QString& string);
69 | static QString electricBorderActionToString(int action);
70 | };
71 |
72 | } // namespace
73 |
74 | #endif
75 |
--------------------------------------------------------------------------------
/kcms/screenedges/touch.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
10 | KWinTouchScreenConfigUi
11 |
12 |
13 |
14 | 0
15 | 0
16 | 500
17 | 500
18 |
19 |
20 |
21 | -
22 |
23 |
24 | You can trigger an action by swiping from the screen edge towards the center of the screen.
25 |
26 |
27 | true
28 |
29 |
30 |
31 | -
32 |
33 |
34 | Qt::Vertical
35 |
36 |
37 | QSizePolicy::Minimum
38 |
39 |
40 |
41 | 20
42 | 20
43 |
44 |
45 |
46 |
47 | -
48 |
49 |
50 |
51 | 200
52 | 200
53 |
54 |
55 |
56 | Qt::StrongFocus
57 |
58 |
59 |
60 | -
61 |
62 |
63 | Qt::Vertical
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 | theseus_ship::Monitor
72 | QWidget
73 |
74 | 1
75 |
76 |
77 |
78 |
79 |
80 |
--------------------------------------------------------------------------------
/kcms/scripts/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: 2023 Roman Gilg
2 | #
3 | # SPDX-License-Identifier: GPL-2.0-or-later
4 |
5 | # KI18N Translation Domain for this library
6 | add_definitions(-DTRANSLATION_DOMAIN=\"kcm_kwin_scripts\")
7 |
8 | kcmutils_add_qml_kcm(kcm_kwin_scripts INSTALL_NAMESPACE plasma/kcms/systemsettings)
9 |
10 | target_sources(kcm_kwin_scripts PRIVATE
11 | module.cpp
12 | kwinscriptsdata.cpp
13 | )
14 |
15 | target_link_libraries(kcm_kwin_scripts
16 | KF6::I18n
17 | KF6::KCMUtils
18 | KF6::KCMUtilsCore
19 | KF6::Package
20 | Qt::DBus
21 | como::base
22 | )
23 |
24 | install(FILES kwinscripts.knsrc DESTINATION ${KDE_INSTALL_KNSRCDIR})
25 |
--------------------------------------------------------------------------------
/kcms/scripts/Messages.sh:
--------------------------------------------------------------------------------
1 | #!bin/sh
2 |
3 | # SPDX-FileCopyrightText: 2023 Roman Gilg
4 | #
5 | # SPDX-License-Identifier: GPL-2.0-or-later
6 |
7 | $EXTRACTRC `find . -name \*.rc -o -name \*.ui -o -name \*.kcfg` >> rc.cpp
8 | $XGETTEXT `find . -name \*.cc -o -name \*.cpp -o -name \*.h -o -name \*.qml` -o $podir/kcm_kwin_scripts.pot
9 | rm -f rc.cpp
10 |
--------------------------------------------------------------------------------
/kcms/scripts/kwinscripts.knsrc:
--------------------------------------------------------------------------------
1 | ; SPDX-FileCopyrightText: 2023 Roman Gilg
2 | ;
3 | ; SPDX-License-Identifier: GPL-2.0-or-later
4 |
5 | [KNewStuff3]
6 | Name=Window Manager Scripts
7 | Name[ca]=Scripts del gestor de finestres
8 | Name[ca@valencia]=Scripts del gestor de finestres
9 | Name[cs]=Skripty správce oken
10 | Name[da]=Vindueshåndteringsscripts
11 | Name[de]=Fensterverwaltungs-Skripte
12 | Name[el]=Σενάρια διαχειριστή παραθύρων
13 | Name[en_GB]=Window Manager Scripts
14 | Name[es]=Guiones del gestor de ventanas
15 | Name[et]=Aknahalduri skriptid
16 | Name[eu]=Leiho kudeatzailearen scriptak
17 | Name[fi]=Ikkunointiohjelman skriptit
18 | Name[fr]=Scripts du gestionnaire de fenêtres
19 | Name[gl]=Scripts do xestor de xanelas
20 | Name[hu]=Ablakkezelő szkriptek
21 | Name[ia]=Gerente de scripts de fenestra
22 | Name[id]=Skrip Pengelola Window
23 | Name[it]=Script del gestore delle finestre
24 | Name[ko]=창 관리자 스크립트
25 | Name[lt]=Langų tvarkytuvės scenarijai
26 | Name[nl]=Scripts van vensterbeheerder
27 | Name[nn]=Skript for vindaugshandsamar
28 | Name[pa]=ਵਿੰਡੋ ਮੈਨੇਜਰ ਸਕ੍ਰਿਪਟਾਂ
29 | Name[pl]=Skrypty zarządzania oknami
30 | Name[pt]=Programas do Gestor de Janelas
31 | Name[pt_BR]=Scripts do gerenciador de janelas
32 | Name[ru]=Сценарии для диспетчера окон KWin
33 | Name[sk]=Skripty správcu okien
34 | Name[sl]=Skripti upravljalnika oken
35 | Name[sr]=Скрипте менаџера прозора
36 | Name[sr@ijekavian]=Скрипте менаџера прозора
37 | Name[sr@ijekavianlatin]=Skripte menadžera prozora
38 | Name[sr@latin]=Skripte menadžera prozora
39 | Name[sv]=Fönsterhanteringsskript
40 | Name[tr]=Pencere Yöneticisi Betikleri
41 | Name[uk]=Скрипти засобу керування вікнами
42 | Name[x-test]=xxWindow Manager Scriptsxx
43 | Name[zh_CN]=窗口管理器脚本
44 | Name[zh_TW]=視窗管理員指令稿
45 |
46 | ProvidersUrl=https://autoconfig.kde.org/ocs/providers.xml
47 | ContentWarning=Executables
48 | Categories=Kwin Scripts Plasma 6
49 | StandardResource=tmp
50 | Uncompress=kpackage
51 | KPackageStructure=KWin/Script
52 |
--------------------------------------------------------------------------------
/kcms/scripts/kwinscriptsdata.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | SPDX-FileCopyrightText: 2020 Cyril Rossi
3 |
4 | SPDX-License-Identifier: GPL-2.0-or-later
5 | */
6 |
7 | #include "kwinscriptsdata.h"
8 |
9 | #include
10 | #include
11 | #include
12 | #include
13 | #include
14 |
15 | KWinScriptsData::KWinScriptsData(QObject* parent)
16 | : KCModuleData(parent)
17 | , m_kwinConfig(KSharedConfig::openConfig("kwinrc"))
18 | {
19 | }
20 |
21 | QVector KWinScriptsData::pluginMetaDataList() const
22 | {
23 | const QString scriptFolder = QStringLiteral("kwin/scripts/");
24 | return KPackage::PackageLoader::self()->findPackages(QStringLiteral("KWin/Script"),
25 | scriptFolder);
26 | }
27 |
28 | bool KWinScriptsData::isDefaults() const
29 | {
30 | auto plugins = pluginMetaDataList();
31 | KConfigGroup cfgGroup(m_kwinConfig, QStringLiteral("Plugins"));
32 | for (auto& plugin : plugins) {
33 | if (cfgGroup.readEntry(plugin.pluginId() + QLatin1String("Enabled"),
34 | plugin.isEnabledByDefault())
35 | != plugin.isEnabledByDefault()) {
36 | return false;
37 | }
38 | }
39 |
40 | return true;
41 | }
42 |
--------------------------------------------------------------------------------
/kcms/scripts/kwinscriptsdata.h:
--------------------------------------------------------------------------------
1 | /*
2 | SPDX-FileCopyrightText: 2020 Cyril Rossi
3 |
4 | SPDX-License-Identifier: GPL-2.0-or-later
5 | */
6 |
7 | #ifndef KWINSCRIPTSDATA_H
8 | #define KWINSCRIPTSDATA_H
9 |
10 | #include
11 | #include
12 |
13 | #include
14 | #include
15 | #include
16 |
17 | class KWinScriptsData : public KCModuleData
18 | {
19 | Q_OBJECT
20 |
21 | public:
22 | KWinScriptsData(QObject* parent);
23 |
24 | bool isDefaults() const override;
25 |
26 | QVector pluginMetaDataList() const;
27 |
28 | private:
29 | KSharedConfigPtr m_kwinConfig;
30 | };
31 |
32 | #endif // KWINSCRIPTSDATA_H
33 |
--------------------------------------------------------------------------------
/kcms/scripts/main.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | SPDX-FileCopyrightText: 2011 Tamas Krutki
3 |
4 | SPDX-License-Identifier: GPL-2.0-or-later
5 | */
6 |
7 | #include
8 |
9 | #include "kwinscriptsdata.h"
10 | #include "module.h"
11 |
12 | K_PLUGIN_FACTORY(KcmKWinScriptsFactory, registerPlugin();
13 | registerPlugin();)
14 |
15 | #include "main.moc"
16 |
--------------------------------------------------------------------------------
/kcms/scripts/module.h:
--------------------------------------------------------------------------------
1 | /*
2 | SPDX-FileCopyrightText: 2011 Tamas Krutki
3 |
4 | SPDX-License-Identifier: GPL-2.0-or-later
5 | */
6 |
7 | #ifndef MODULE_H
8 | #define MODULE_H
9 |
10 | #include
11 | #include
12 | #include
13 | #include
14 | #include
15 | #include
16 |
17 | class KJob;
18 | class KWinScriptsData;
19 |
20 | class Module : public KQuickConfigModule
21 | {
22 | Q_OBJECT
23 |
24 | Q_PROPERTY(QAbstractItemModel* model READ model CONSTANT)
25 | Q_PROPERTY(QList pendingDeletions READ pendingDeletions NOTIFY
26 | pendingDeletionsChanged)
27 | Q_PROPERTY(QString errorMessage READ errorMessage NOTIFY messageChanged)
28 | Q_PROPERTY(QString infoMessage READ infoMessage NOTIFY messageChanged)
29 | public:
30 | explicit Module(QObject* parent, const KPluginMetaData& data);
31 |
32 | void load() override;
33 | void save() override;
34 | void defaults() override;
35 |
36 | QAbstractItemModel* model() const
37 | {
38 | return m_model;
39 | }
40 |
41 | Q_INVOKABLE void togglePendingDeletion(const KPluginMetaData& data);
42 | Q_INVOKABLE bool canDeleteEntry(const KPluginMetaData& data)
43 | {
44 | return QFileInfo(data.fileName()).isWritable();
45 | }
46 |
47 | QList pendingDeletions()
48 | {
49 | return m_pendingDeletions;
50 | }
51 |
52 | QString errorMessage() const
53 | {
54 | return m_errorMessage;
55 | }
56 | QString infoMessage() const
57 | {
58 | return m_infoMessage;
59 | }
60 | void setErrorMessage(const QString& message)
61 | {
62 | m_infoMessage.clear();
63 | m_errorMessage = message;
64 | Q_EMIT messageChanged();
65 | }
66 |
67 | /**
68 | * Called when the import script button is clicked.
69 | */
70 | Q_INVOKABLE void importScript();
71 | Q_INVOKABLE void onGHNSEntriesChanged();
72 |
73 | Q_INVOKABLE void configure(const KPluginMetaData& data);
74 |
75 | Q_SIGNALS:
76 | void messageChanged();
77 | void pendingDeletionsChanged();
78 |
79 | private:
80 | KWinScriptsData* m_kwinScriptsData;
81 | QList