├── .github └── workflows │ ├── backup-to-gitlab.yml │ ├── call-auto-tag.yml │ ├── call-build-distribution.yml │ ├── call-chatOps.yml │ ├── call-clacheck.yml │ ├── call-commitlint.yml │ └── call-license-check.yml ├── .gitignore ├── .gitlab-ci.yml ├── .mailmap ├── .obs └── workflows.yml ├── .packit.yaml ├── .reuse └── dep5 ├── .tx ├── config └── deepin.conf ├── CHANGELOG.md ├── LICENSE ├── LICENSES ├── CC-BY-4.0.txt ├── CC0-1.0.txt └── GPL-3.0-or-later.txt ├── Makefile ├── README.md ├── README.zh_CN.md ├── adjust-grub-theme ├── adjust_grub_theme_test.go ├── main.go ├── testdata │ ├── deepin-fallback │ │ └── theme.txt.tpl │ ├── deepin │ │ ├── background.origin.jpg │ │ ├── terminal_box_c.png │ │ ├── theme.txt │ │ └── theme.txt.tpl │ ├── grub │ ├── locale │ ├── os-version │ ├── resources │ │ └── os-logos │ │ │ ├── arch.svg │ │ │ ├── debian.svg │ │ │ ├── deepin.svg │ │ │ └── fedora.svg │ ├── test1.svg │ └── test2.svg ├── util.go └── version.go ├── archlinux ├── PKGBUILD ├── deepin-api.install └── deepin-api.sysusers ├── blurimage ├── blurimage.go ├── blurimage_test.go └── testdata │ ├── test1.jpg │ └── test2.jpg ├── cursor-helper ├── cursor_helper_test.go ├── exported_methods_auto.go └── main.go ├── dde-open └── main.go ├── debian ├── abi.json ├── changelog ├── control ├── copyright ├── dde-api-dev.install ├── dde-api.install ├── dde-api.lintian-overrides ├── dde-api.postinst ├── dde-api.postrm ├── docs ├── rules ├── source │ └── format └── triggers ├── deepin-shutdown-sound └── main.go ├── device ├── device.go ├── exported_methods_auto.go └── main.go ├── drandr ├── crtc.go ├── crtc_test.go ├── drandr.go ├── drandr_test.go ├── mode.go ├── mode_test.go ├── output.go └── output_test.go ├── dxinput ├── common │ ├── common.go │ └── common_test.go ├── keyboard.go ├── kwayland │ └── inputdevice.go ├── libinput.go ├── mouse.go ├── touchpad.go ├── touchscreen.go ├── utils.go ├── utils │ ├── button_map.c │ ├── button_map.go │ ├── button_map.h │ ├── byte_op.go │ ├── keyboard.c │ ├── keyboard.h │ ├── list.c │ ├── list.h │ ├── property.c │ ├── property.h │ ├── type.c │ ├── type.h │ └── wrapper.go └── wacom.go ├── gen.go ├── gen_test_report.sh ├── go.mod ├── go.sum ├── graphic ├── exported_methods_auto.go ├── graphic.go ├── graphic_test.go ├── main.go └── testdata │ ├── origin_1920x1080.jpg │ ├── origin_icon_1_48x48.png │ ├── origin_icon_2_48x48.png │ ├── origin_not_image │ └── origin_small_200x200.png ├── grub_theme ├── font │ ├── font.go │ ├── font_test.go │ └── testdata │ │ └── unifont-regular-16.pf2 └── themetxt │ ├── grub_theme.peg │ ├── grub_theme.peg.go │ ├── testdata │ └── theme.txt.tpl │ ├── theme.go │ └── theme_test.go ├── gtk-thumbnailer ├── main.go └── thumbnail.c ├── hans2pinyin ├── README.md ├── exported_methods_auto.go ├── main.go └── main_test.go ├── huangli-generator ├── .gitignore ├── Makefile ├── README.org ├── huangli.db ├── huangliBase.db ├── main.go └── request.go ├── huangli ├── db.go └── db_test.go ├── i18n_dependent ├── i18n_dependent.go ├── i18n_dependent_test.go ├── parse_file.go ├── sourcehansans.go └── testdata │ ├── i18n_dependent.json │ └── language_info.json ├── image-blur-helper └── main.go ├── image-blur └── main.go ├── inhibit_hint ├── exported_methods_auto.go ├── inhibit_hint.go └── t1_test.go ├── lang_info ├── lang_info.go ├── lang_info_test.go └── testdata │ ├── SUPPORTED │ └── language_info.json ├── language_support ├── lang_support.go ├── lang_support_test.go └── testdata │ └── pkg_depends ├── locale-helper ├── exported_methods_auto.go ├── ifc.go ├── locale_test.go ├── main.go ├── parser.go └── testdata │ └── locale.gen ├── lunar-calendar ├── .gitignore ├── calendar.go ├── exported_methods_auto.go ├── huangli.go ├── lunar_calendar_test.go ├── main.go └── manager.go ├── misc ├── conf │ ├── org.deepin.dde.Device1.conf │ ├── org.deepin.dde.LocaleHelper1.conf │ └── org.deepin.dde.SoundThemePlayer1.conf ├── data │ ├── grub-themes │ │ ├── deepin-fallback │ │ │ ├── deepin_background.jpg │ │ │ ├── deepin_background_in_theme.jpg │ │ │ ├── selected_item_c.png │ │ │ ├── selected_item_e.png │ │ │ ├── selected_item_n.png │ │ │ ├── selected_item_ne.png │ │ │ ├── selected_item_nw.png │ │ │ ├── selected_item_s.png │ │ │ ├── selected_item_se.png │ │ │ ├── selected_item_sw.png │ │ │ ├── selected_item_w.png │ │ │ ├── terminal_box_c.png │ │ │ ├── terminal_box_e.png │ │ │ ├── terminal_box_n.png │ │ │ ├── terminal_box_ne.png │ │ │ ├── terminal_box_nw.png │ │ │ ├── terminal_box_s.png │ │ │ ├── terminal_box_se.png │ │ │ ├── terminal_box_sw.png │ │ │ ├── terminal_box_w.png │ │ │ ├── theme.txt.tpl │ │ │ ├── unifont-regular-16.pf2 │ │ │ ├── uos_background.jpg │ │ │ └── uos_background_in_theme.jpg │ │ └── deepin │ │ │ ├── background.origin.jpg │ │ │ ├── resources │ │ │ └── os-logos │ │ │ │ ├── antergos.svg │ │ │ │ ├── arch.svg │ │ │ │ ├── chakra.svg │ │ │ │ ├── debian.svg │ │ │ │ ├── deepin.svg │ │ │ │ ├── elementary.svg │ │ │ │ ├── fedora.svg │ │ │ │ ├── gentoo.svg │ │ │ │ ├── korora.svg │ │ │ │ ├── kubuntu.svg │ │ │ │ ├── lfs.svg │ │ │ │ ├── linux-mint.svg │ │ │ │ ├── lubuntu.svg │ │ │ │ ├── mageia.svg │ │ │ │ ├── manjaro.svg │ │ │ │ ├── opensuse.svg │ │ │ │ ├── os.svg │ │ │ │ ├── ubuntu.svg │ │ │ │ ├── windows.svg │ │ │ │ └── xubuntu.svg │ │ │ ├── terminal_box_c.png │ │ │ └── theme.txt.tpl │ ├── huangli.db │ ├── huangli.version │ └── pkg_depends ├── icons │ ├── 128x128 │ │ └── actions │ │ │ ├── media-autorun-nop.png │ │ │ └── media-autorun-open-folder.png │ ├── 48x48 │ │ └── actions │ │ │ ├── media-autorun-nop.png │ │ │ └── media-autorun-open-folder.png │ ├── 64x64 │ │ └── actions │ │ │ ├── media-autorun-nop.png │ │ │ └── media-autorun-open-folder.png │ ├── 96x96 │ │ └── actions │ │ │ ├── media-autorun-nop.png │ │ │ └── media-autorun-open-folder.png │ └── scalable │ │ └── actions │ │ ├── media-autorun-nop.svg │ │ └── media-autorun-open-folder.svg ├── polkit-action │ ├── org.deepin.dde.device.unblock-bluetooth-devices.policy.in │ └── org.deepin.dde.locale-helper.policy.in ├── polkit-localauthority │ └── org.deepin.dde.device.pkla ├── scripts │ └── deepin-boot-sound.sh ├── services │ ├── org.deepin.dde.CursorHelper1.service │ ├── org.deepin.dde.Graphic1.service │ ├── org.deepin.dde.LunarCalendar1.service │ └── org.deepin.dde.Pinyin1.service ├── system-services │ ├── org.deepin.dde.Device1.service │ ├── org.deepin.dde.LocaleHelper1.service │ └── org.deepin.dde.SoundThemePlayer1.service ├── systemd │ └── system │ │ ├── deepin-api-device.service │ │ ├── deepin-locale-helper.service │ │ ├── deepin-login-sound.service │ │ ├── deepin-shutdown-sound.service │ │ └── deepin-sound-theme-player.service └── ts │ ├── org.deepin.dde.device.unblock-bluetooth-devices.policy │ ├── policy.ts │ ├── policy_am_ET.ts │ ├── policy_ar.ts │ ├── policy_ast.ts │ ├── policy_bg.ts │ ├── policy_bn.ts │ ├── policy_ca.ts │ ├── policy_cs.ts │ ├── policy_da.ts │ ├── policy_de.ts │ ├── policy_el.ts │ ├── policy_es.ts │ ├── policy_es_419.ts │ ├── policy_fa.ts │ ├── policy_fi.ts │ ├── policy_fr.ts │ ├── policy_gl_ES.ts │ ├── policy_hi_IN.ts │ ├── policy_hr.ts │ ├── policy_hu.ts │ ├── policy_id.ts │ ├── policy_it.ts │ ├── policy_ja.ts │ ├── policy_ko.ts │ ├── policy_ku.ts │ ├── policy_ku_IQ.ts │ ├── policy_lt.ts │ ├── policy_lv.ts │ ├── policy_mn.ts │ ├── policy_ms.ts │ ├── policy_nb.ts │ ├── policy_ne.ts │ ├── policy_nl.ts │ ├── policy_pa.ts │ ├── policy_pl.ts │ ├── policy_pt.ts │ ├── policy_pt_BR.ts │ ├── policy_ro.ts │ ├── policy_ru.ts │ ├── policy_sk.ts │ ├── policy_sr.ts │ ├── policy_sv.ts │ ├── policy_sw.ts │ ├── policy_tr.ts │ ├── policy_uk.ts │ ├── policy_vi.ts │ ├── policy_zh_CN.ts │ └── policy_zh_TW.ts │ └── org.deepin.dde.locale-helper.policy │ ├── policy.ts │ ├── policy_am_ET.ts │ ├── policy_ar.ts │ ├── policy_ast.ts │ ├── policy_az.ts │ ├── policy_bg.ts │ ├── policy_bn.ts │ ├── policy_ca.ts │ ├── policy_cs.ts │ ├── policy_da.ts │ ├── policy_de.ts │ ├── policy_el.ts │ ├── policy_en_GB.ts │ ├── policy_eo.ts │ ├── policy_es.ts │ ├── policy_es_419.ts │ ├── policy_fa.ts │ ├── policy_fi.ts │ ├── policy_fr.ts │ ├── policy_gl_ES.ts │ ├── policy_hi_IN.ts │ ├── policy_hr.ts │ ├── policy_hu.ts │ ├── policy_id.ts │ ├── policy_it.ts │ ├── policy_ja.ts │ ├── policy_kn_IN.ts │ ├── policy_ko.ts │ ├── policy_ku.ts │ ├── policy_ku_IQ.ts │ ├── policy_lt.ts │ ├── policy_lv.ts │ ├── policy_mn.ts │ ├── policy_ms.ts │ ├── policy_nb.ts │ ├── policy_ne.ts │ ├── policy_nl.ts │ ├── policy_pl.ts │ ├── policy_pt.ts │ ├── policy_pt_BR.ts │ ├── policy_ro.ts │ ├── policy_ru.ts │ ├── policy_sk.ts │ ├── policy_sl.ts │ ├── policy_sr.ts │ ├── policy_sv.ts │ ├── policy_sw.ts │ ├── policy_tr.ts │ ├── policy_ug.ts │ ├── policy_uk.ts │ ├── policy_vi.ts │ ├── policy_zh_CN.ts │ └── policy_zh_TW.ts ├── polkit └── polkit.go ├── powersupply ├── battery │ ├── battery.go │ ├── battery_test.go │ └── status.go ├── powersupply.go └── powersupply_test.go ├── rpm └── dde-api.spec ├── session └── session_register.go ├── sound-theme-player ├── config.go ├── config_test.go ├── exported_methods_auto.go ├── main.go └── utils.go ├── soundutils ├── shutdown.go └── soundplayer.go ├── theme_thumb ├── common │ └── common.go ├── cursor │ ├── cursor.go │ └── load.go ├── gtk │ └── gtk.go ├── icon │ └── icon.go └── thumb.go ├── themes ├── cursor.c ├── cursor.go ├── cursor.h ├── gtk2.go ├── gtk2_test.go ├── gtk3.go ├── gtk3_test.go ├── qt_cursor.c ├── scanner │ ├── scanner.go │ ├── scanner_test.go │ └── testdata │ │ ├── Icons │ │ ├── Icon1 │ │ │ ├── cursors │ │ │ │ └── left_ptr │ │ │ └── index.theme │ │ └── Icon2 │ │ │ ├── cursors │ │ │ └── left_ptr │ │ │ └── index.theme │ │ ├── Themes │ │ ├── Gtk1 │ │ │ ├── cursors │ │ │ │ └── left_ptr │ │ │ ├── gtk-2.0 │ │ │ │ └── gtkrc │ │ │ ├── gtk-3.0 │ │ │ │ └── settings.ini │ │ │ ├── index.theme │ │ │ └── metacity-1 │ │ │ │ └── metacity-theme-3.xml │ │ └── Gtk2 │ │ │ ├── cursors │ │ │ └── left_ptr │ │ │ ├── gtk-2.0 │ │ │ └── gtkrc │ │ │ ├── gtk-3.0 │ │ │ └── settings.ini │ │ │ ├── index.theme │ │ │ └── metacity-1 │ │ │ └── metacity-theme-3.xml │ │ ├── gtk_paper.theme │ │ ├── gtk_paper_hidden.theme │ │ ├── icon_deepin.theme │ │ └── icon_deepin_hidden.theme ├── settings.go ├── testdata │ ├── gtkrc-2.0 │ └── settings.ini ├── theme.go └── theme_test.go ├── thumbnailer └── main.go ├── thumbnails ├── cursor │ ├── cursor.go │ ├── thumbnail.go │ └── xcur2png.go ├── font │ ├── font.go │ ├── thumbnail.c │ ├── thumbnail.h │ └── wrapper.go ├── gtk │ └── gtk.go ├── icon │ ├── icon.c │ ├── icon.go │ ├── icon.h │ ├── thumbnail.go │ └── wrapper.go ├── images │ ├── convert.c │ ├── convert.h │ ├── images.go │ └── wrapper.go ├── loader │ └── loader.go ├── pdf │ ├── pdf.go │ ├── thumbnail.c │ ├── thumbnail.h │ └── wrapper.go ├── text │ ├── text.c │ ├── text.go │ ├── text.h │ └── wrapper.go ├── thumbnails.go └── thumbnails_test.go ├── userenv ├── testdata │ └── t1.txt ├── userenv.go └── userenv_test.go └── validator ├── consts.go ├── exported_methods_auto.go ├── main.go ├── validate_hostname.go ├── validate_username.go ├── validator.go └── validator_test.go /.github/workflows/backup-to-gitlab.yml: -------------------------------------------------------------------------------- 1 | name: backup to gitlab 2 | on: [push] 3 | 4 | concurrency: 5 | group: ${{ github.workflow }} 6 | cancel-in-progress: true 7 | 8 | jobs: 9 | backup-to-gitlabwh: 10 | uses: linuxdeepin/.github/.github/workflows/backup-to-gitlabwh.yml@master 11 | secrets: inherit 12 | 13 | backup-to-gitee: 14 | uses: linuxdeepin/.github/.github/workflows/backup-to-gitee.yml@master 15 | secrets: inherit 16 | -------------------------------------------------------------------------------- /.github/workflows/call-auto-tag.yml: -------------------------------------------------------------------------------- 1 | name: auto tag 2 | 3 | on: 4 | pull_request_target: 5 | types: [opened, synchronize, closed] 6 | paths: 7 | - "debian/changelog" 8 | 9 | concurrency: 10 | group: ${{ github.workflow }}-pull/${{ github.event.number }} 11 | cancel-in-progress: true 12 | 13 | jobs: 14 | auto_tag: 15 | uses: linuxdeepin/.github/.github/workflows/auto-tag.yml@master 16 | secrets: inherit 17 | -------------------------------------------------------------------------------- /.github/workflows/call-build-distribution.yml: -------------------------------------------------------------------------------- 1 | name: Call build-distribution 2 | on: 3 | push: 4 | paths-ignore: 5 | - ".github/workflows/**" 6 | pull_request_target: 7 | paths-ignore: 8 | - ".github/workflows/**" 9 | 10 | jobs: 11 | check_job: 12 | uses: linuxdeepin/.github/.github/workflows/build-distribution.yml@master 13 | secrets: inherit 14 | -------------------------------------------------------------------------------- /.github/workflows/call-chatOps.yml: -------------------------------------------------------------------------------- 1 | name: chatOps 2 | on: 3 | issue_comment: 4 | types: [created] 5 | 6 | jobs: 7 | chatopt: 8 | uses: linuxdeepin/.github/.github/workflows/chatOps.yml@master 9 | secrets: inherit 10 | -------------------------------------------------------------------------------- /.github/workflows/call-clacheck.yml: -------------------------------------------------------------------------------- 1 | name: Call CLA check 2 | on: 3 | issue_comment: 4 | types: [created] 5 | pull_request_target: 6 | types: [opened, closed, synchronize] 7 | 8 | concurrency: 9 | group: ${{ github.workflow }}-pull/${{ github.event.number }} 10 | cancel-in-progress: true 11 | 12 | jobs: 13 | clacheck: 14 | uses: linuxdeepin/.github/.github/workflows/cla-check.yml@master 15 | secrets: inherit 16 | -------------------------------------------------------------------------------- /.github/workflows/call-commitlint.yml: -------------------------------------------------------------------------------- 1 | name: Call commitlint 2 | on: 3 | pull_request_target: 4 | 5 | concurrency: 6 | group: ${{ github.workflow }}-pull/${{ github.event.number }} 7 | cancel-in-progress: true 8 | 9 | jobs: 10 | check_job: 11 | uses: linuxdeepin/.github/.github/workflows/commitlint.yml@master 12 | -------------------------------------------------------------------------------- /.github/workflows/call-license-check.yml: -------------------------------------------------------------------------------- 1 | name: Call License and README Check 2 | on: 3 | pull_request_target: 4 | types: [opened, synchronize, reopened] 5 | 6 | permissions: 7 | pull-requests: write 8 | contents: read 9 | 10 | concurrency: 11 | group: ${{ github.workflow }}-pull/${{ github.event.number }} 12 | cancel-in-progress: true 13 | 14 | jobs: 15 | license-check: 16 | uses: linuxdeepin/.github/.github/workflows/license-check.yml@master 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.*.swp 2 | Test 3 | test-* 4 | test_* 5 | *.*~ 6 | */*.test 7 | _* 8 | sound/dev_test.go 9 | graphic/testdata/test_* 10 | misc/polkit-action/*.policy 11 | coverage.csv 12 | /target 13 | -------------------------------------------------------------------------------- /.gitlab-ci.yml: -------------------------------------------------------------------------------- 1 | include: 2 | - remote: 'https://gitlab.deepin.io/dev-tools/letmeci/raw/master/gitlab-ci/dde.yml' 3 | 4 | variables: 5 | CPPCHECK_DISABLED: "true" 6 | -------------------------------------------------------------------------------- /.mailmap: -------------------------------------------------------------------------------- 1 | Xu Fasheng 2 | -------------------------------------------------------------------------------- /.obs/workflows.yml: -------------------------------------------------------------------------------- 1 | test_build: 2 | steps: 3 | - link_package: 4 | source_project: deepin:Develop:dde 5 | source_package: %{SCM_REPOSITORY_NAME} 6 | target_project: deepin:CI 7 | 8 | - configure_repositories: 9 | project: deepin:CI 10 | repositories: 11 | - name: deepin_develop 12 | paths: 13 | - target_project: deepin:CI 14 | target_repository: deepin_develop 15 | architectures: 16 | - x86_64 17 | - aarch64 18 | 19 | - name: debian 20 | paths: 21 | - target_project: deepin:CI 22 | target_repository: debian_sid 23 | architectures: 24 | - x86_64 25 | 26 | - name: archlinux 27 | paths: 28 | - target_project: deepin:CI 29 | target_repository: archlinux 30 | architectures: 31 | - x86_64 32 | 33 | filters: 34 | event: pull_request 35 | 36 | tag_build: 37 | steps: 38 | - trigger_services: 39 | project: deepin:Unstable:dde 40 | package: %{SCM_REPOSITORY_NAME} 41 | filters: 42 | event: tag_push 43 | 44 | commit_build: 45 | steps: 46 | - trigger_services: 47 | project: deepin:Develop:dde 48 | package: %{SCM_REPOSITORY_NAME} 49 | filters: 50 | event: push 51 | -------------------------------------------------------------------------------- /.packit.yaml: -------------------------------------------------------------------------------- 1 | # See the documentation for more information: 2 | # https://packit.dev/docs/configuration/ 3 | 4 | specfile_path: rpm/deepin-api.spec 5 | 6 | # add or remove files that should be synced 7 | synced_files: 8 | - rpm/deepin-api.spec 9 | - .packit.yaml 10 | 11 | upstream_package_name: dde-api 12 | # downstream (Fedora) RPM package name 13 | downstream_package_name: deepin-api 14 | 15 | actions: 16 | fix-spec-file: | 17 | bash -c "sed -i -r \"s/Version:(\s*)\S*/Version:\1${PACKIT_PROJECT_VERSION}/\" rpm/deepin-api.spec" 18 | -------------------------------------------------------------------------------- /.tx/config: -------------------------------------------------------------------------------- 1 | [main] 2 | host = https://www.transifex.com 3 | 4 | [o:linuxdeepin:p:deepin-desktop-environment:r:dde-api-locale-helper-policyts] 5 | file_filter = misc/ts/org.deepin.dde.locale-helper.policy/policy_.ts 6 | source_file = misc/ts/org.deepin.dde.locale-helper.policy/policy.ts 7 | source_lang = en 8 | type = QT 9 | 10 | [o:linuxdeepin:p:deepin-desktop-environment:r:dde-api-device-unblock-bt-devices-policyts] 11 | file_filter = misc/ts/org.deepin.dde.device.unblock-bluetooth-devices.policy/policy_.ts 12 | source_file = misc/ts/org.deepin.dde.device.unblock-bluetooth-devices.policy/policy.ts 13 | source_lang = en 14 | type = QT 15 | 16 | -------------------------------------------------------------------------------- /.tx/deepin.conf: -------------------------------------------------------------------------------- 1 | [transifex] 2 | branch = m23 3 | -------------------------------------------------------------------------------- /README.zh_CN.md: -------------------------------------------------------------------------------- 1 | ## DDE API 2 | 3 | DDE API项目提供了一些 dbus 接口,用于屏幕区域检测、缩略图生成、声音播放等。 4 | 5 | ## 依赖 6 | 7 | ### 编译依赖 8 | 9 | * [go-lib](https://github.com/linuxdeepin/go-lib) 10 | * [dbus-factory](https://github.com/linuxdeepin/dbus-factory) 11 | * gtk+-3.0 12 | * librsvg-2.0 13 | * libcanberra 14 | * poppler-glib 15 | * libsqlite3 16 | 17 | ### 运行依赖 18 | 19 | * xcur2png 20 | * deepin-desktop-base 21 | * libsqlite3 22 | 23 | ## 安装 24 | 25 | dde-api需要预安装以下包 26 | 27 | ```shell 28 | $ go get gopkg.in/alecthomas/kingpin.v2 29 | $ go get github.com/disintegration/imaging 30 | $ go get github.com/linuxdeepin/go-x11-client 31 | $ go get -u -v github.com/mattn/go-sqlite3 32 | ``` 33 | 34 | 构建: 35 | ``` 36 | $ make GOPATH=/usr/share/gocode 37 | ``` 38 | 39 | 通过gccgo构建 40 | ``` 41 | $ make GOPATH=/usr/share/gocode USE_GCCGO=1 42 | ``` 43 | 44 | 安装: 45 | ``` 46 | sudo make install 47 | ``` 48 | 49 | ## 获得帮助 50 | 51 | 如果您遇到任何其他问题,您可能还会发现这些渠道很有用: 52 | 53 | * [Gitter](https://gitter.im/orgs/linuxdeepin/rooms) 54 | * [IRC channel](https://webchat.freenode.net/?channels=deepin) 55 | * [Forum](https://bbs.deepin.org/) 56 | * [WiKi](https://wiki.deepin.org/) 57 | 58 | ## 贡献指南 59 | 60 | 我们鼓励您报告问题并做出更改。 61 | 62 | * [Contribution guide for developers](https://github.com/linuxdeepin/developer-center/wiki/Contribution-Guidelines-for-Developers-en). (English) 63 | * [开发者代码贡献指南](https://github.com/linuxdeepin/developer-center/wiki/Contribution-Guidelines-for-Developers) (中文) 64 | 65 | ## 开源协议 66 | 67 | dde-api项目在 [GPL-3.0-or-later](LICENSE)下发布。 68 | -------------------------------------------------------------------------------- /adjust-grub-theme/testdata/deepin/background.origin.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/dde-api/9cffdd813b2ae3810f841ae3fdecc5920462c7a7/adjust-grub-theme/testdata/deepin/background.origin.jpg -------------------------------------------------------------------------------- /adjust-grub-theme/testdata/deepin/terminal_box_c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/dde-api/9cffdd813b2ae3810f841ae3fdecc5920462c7a7/adjust-grub-theme/testdata/deepin/terminal_box_c.png -------------------------------------------------------------------------------- /adjust-grub-theme/testdata/deepin/theme.txt: -------------------------------------------------------------------------------- 1 | #version:17 2 | #lang:zh_CN.UTF-8 3 | #themeInputDir:/usr/share/dde-api/data/grub-themes/deepin 4 | #screenWidth:1024 5 | #screenHeight:768 6 | #head end 7 | title-text: "" 8 | desktop-image: "background.jpg" 9 | desktop-color: "#000000" 10 | terminal-font: "Unifont Regular 14" 11 | terminal-box: "terminal_box_*.png" 12 | terminal-left: "0" 13 | terminal-top: "0" 14 | terminal-width: "100%" 15 | terminal-height: "100%" 16 | terminal-border: "0" 17 | + boot_menu { 18 | left = 21% 19 | top = 27% 20 | width = 597 21 | height = 351 22 | item_font = "Noto Sans CJK SC Regular 12" 23 | item_color = "#dddddd" 24 | selected_item_color = "#ffffff" 25 | item_height = 36 26 | item_spacing = 8 27 | item_padding = 8 28 | icon_width = 26 29 | icon_height = 18 30 | item_icon_space = 15 31 | item_pixmap_style = "item_*.png" 32 | selected_item_pixmap_style = "selected_item_*.png" 33 | menu_pixmap_style = "menu_*.png" 34 | scrollbar_thumb = "scrollbar_thumb_*.png" 35 | scrollbar_width = 6 36 | } 37 | + label { 38 | left = 0 39 | top = 97% 40 | width = 100% 41 | align = "center" 42 | id = "__timeout__" 43 | color = "#99E53E" 44 | font = "Noto Sans CJK SC Regular 12" 45 | text = "在 %d 秒内启动" 46 | } 47 | + label { 48 | left = 0 49 | top = 94% 50 | width = 100% 51 | align = "center" 52 | color = "#99E53E" 53 | font = "Noto Sans CJK SC Regular 12" 54 | text = "使用 ↑ 和 ↓ 键移动选择条,Enter 键确认,E 键编辑启动命令,C 键进入命令行" 55 | } 56 | -------------------------------------------------------------------------------- /adjust-grub-theme/testdata/grub: -------------------------------------------------------------------------------- 1 | # Written by org.deepin.daemon.Grub2 2 | DEEPIN_GFXMODE_DETECT=2 3 | GRUB_BACKGROUND=/boot/grub/themes/deepin-fallback/background.jpg 4 | GRUB_CMDLINE_LINUX="" 5 | GRUB_CMDLINE_LINUX_DEFAULT="splash quiet" 6 | GRUB_DEFAULT=0 7 | GRUB_DISTRIBUTOR="`/usr/bin/lsb_release -d -s 2>/dev/null || echo UOS 20`" 8 | GRUB_GFXMODE=1024x768 9 | GRUB_THEME=/boot/grub/themes/deepin-fallback/theme.txt 10 | GRUB_TIMEOUT=5 11 | -------------------------------------------------------------------------------- /adjust-grub-theme/testdata/locale: -------------------------------------------------------------------------------- 1 | LANG=zh_CN.UTF-8 2 | LANGUAGE=zh_CN 3 | -------------------------------------------------------------------------------- /adjust-grub-theme/testdata/os-version: -------------------------------------------------------------------------------- 1 | [Version] 2 | SystemName=Deepin 3 | SystemName[zh_CN]=深度操作系统 4 | ProductType=Desktop 5 | ProductType[zh_CN]=桌面 6 | EditionName=Community 7 | EditionName[en_US]=Community 8 | EditionName[zh_CN]=社区版 9 | MajorVersion=23 10 | MinorVersion=23 -------------------------------------------------------------------------------- /adjust-grub-theme/testdata/resources/os-logos/arch.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /adjust-grub-theme/testdata/test1.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /adjust-grub-theme/version.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | package main 6 | 7 | const VERSION int = 18 8 | -------------------------------------------------------------------------------- /archlinux/deepin-api.install: -------------------------------------------------------------------------------- 1 | post_install() { 2 | # We need to know uid and gid to create /var/lib/deepin-sound-player with proper 3 | # permissions. So keep systemd-sysusers invocation here despite having 4 | # pacman hooks. 5 | systemd-sysusers deepin-sound-player.conf 6 | mkdir -p var/lib/deepin-sound-player 7 | chown -R deepin-sound-player:deepin-sound-player var/lib/deepin-sound-player 8 | } 9 | 10 | post_upgrade() { 11 | if (( $(vercmp $2 5.2.0.1-2) < 0)); then 12 | usermod -d /var/lib/deepin-sound-player deepin-sound-player 13 | mkdir -p var/lib/deepin-sound-player 14 | chown -R deepin-sound-player:deepin-sound-player var/lib/deepin-sound-player 15 | fi 16 | } 17 | -------------------------------------------------------------------------------- /archlinux/deepin-api.sysusers: -------------------------------------------------------------------------------- 1 | u deepin-sound-player - "Deepin Sound Player" /var/lib/deepin-sound-player 2 | -------------------------------------------------------------------------------- /blurimage/blurimage.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | package blurimage 6 | 7 | import ( 8 | "image" 9 | "image/color" 10 | "os" 11 | "path" 12 | "runtime/debug" 13 | 14 | "github.com/disintegration/imaging" 15 | ) 16 | 17 | func BlurImage(file string, sigma float64, dest string) error { 18 | img, err := imaging.Open(file) 19 | if err != nil { 20 | return err 21 | } 22 | err = os.MkdirAll(path.Dir(dest), 0755) 23 | if err != nil { 24 | return err 25 | } 26 | 27 | defer debug.FreeOSMemory() 28 | 29 | blurredNRGB := imaging.Blur(img, sigma) 30 | 31 | var finalNRGB image.Image = blurredNRGB 32 | // need to darken the image if it's too bright 33 | if isTooBright(blurredNRGB) { 34 | finalNRGB = imaging.AdjustBrightness(blurredNRGB, -20) 35 | } 36 | 37 | return imaging.Save(finalNRGB, dest) 38 | } 39 | 40 | func isTooBright(img image.Image) bool { 41 | var pixCount float64 = 0 42 | var totalBrightness float64 = 0 43 | 44 | imaging.AdjustFunc(img, func(c color.NRGBA) color.NRGBA { 45 | brightness := 0.2126*float64(c.R) + 0.7152*float64(c.G) + 0.0722*float64(c.B) 46 | totalBrightness += brightness 47 | pixCount++ 48 | 49 | return c 50 | }) 51 | 52 | averBrightness := totalBrightness / pixCount 53 | 54 | // assume that average brightness higher than 100 is too bright. 55 | return averBrightness > 100 56 | } 57 | -------------------------------------------------------------------------------- /blurimage/blurimage_test.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | package blurimage 6 | 7 | import ( 8 | "os" 9 | "testing" 10 | 11 | "github.com/disintegration/imaging" 12 | "github.com/stretchr/testify/assert" 13 | ) 14 | 15 | func BenchmarkIsTooBright(b *testing.B) { 16 | b.ReportAllocs() 17 | 18 | img, err := imaging.Open("testdata/test1.jpg") 19 | if err != nil { 20 | return 21 | } 22 | 23 | for i := 0; i < b.N; i++ { 24 | isTooBright(img) 25 | } 26 | } 27 | 28 | func TestIsTooBright(t *testing.T) { 29 | t.Skip("always skip") 30 | tests := []struct { 31 | Input string 32 | Expect bool 33 | }{ 34 | { 35 | "testdata/test1.jpg", 36 | false, 37 | }, 38 | { 39 | "testdata/test2.jpg", 40 | true, 41 | }, 42 | } 43 | for _, data := range tests { 44 | img, err := imaging.Open(data.Input) 45 | if err != nil { 46 | t.Error(err) 47 | } 48 | if !assert.Equal(t, data.Expect, isTooBright(img)) { 49 | t.Errorf("Judge for %s is not correct.", data.Input) 50 | } 51 | } 52 | } 53 | 54 | func TestBlurImage(t *testing.T) { 55 | tests := []struct { 56 | file string 57 | sigma float64 58 | dest string 59 | }{ 60 | { 61 | "testdata/test1.jpg", 62 | 20, 63 | "testdata/test1_blur.png", 64 | }, 65 | { 66 | "testdata/test2.jpg", 67 | 30, 68 | "testdata/test2_blur.png", 69 | }, 70 | } 71 | for _, data := range tests { 72 | err := BlurImage(data.file, data.sigma, data.dest) 73 | assert.NoError(t, err) 74 | assert.FileExists(t, data.dest) 75 | _ = os.Remove(data.dest) 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /blurimage/testdata/test1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/dde-api/9cffdd813b2ae3810f841ae3fdecc5920462c7a7/blurimage/testdata/test1.jpg -------------------------------------------------------------------------------- /blurimage/testdata/test2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/dde-api/9cffdd813b2ae3810f841ae3fdecc5920462c7a7/blurimage/testdata/test2.jpg -------------------------------------------------------------------------------- /cursor-helper/cursor_helper_test.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | package main 6 | 7 | import ( 8 | "fmt" 9 | "strconv" 10 | "testing" 11 | 12 | "github.com/stretchr/testify/assert" 13 | "github.com/linuxdeepin/dde-api/themes" 14 | ) 15 | 16 | func Test_setTheme(t *testing.T) { 17 | cursorTheme := themes.GetCursorTheme() 18 | tests := []struct { 19 | Input string 20 | Expected error 21 | }{ 22 | { 23 | cursorTheme, 24 | nil, 25 | }, 26 | { 27 | "fake1Theme", 28 | fmt.Errorf("invalid theme '%s'", "fake1Theme"), 29 | }, 30 | { 31 | "fake2Theme", 32 | fmt.Errorf("invalid theme '%s'", "fake2Theme"), 33 | }, 34 | } 35 | for i, test := range tests { 36 | t.Run("Test_setTheme"+strconv.Itoa(i), func(t *testing.T) { 37 | assert.Equal(t, test.Expected, setTheme(test.Input)) 38 | }) 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /cursor-helper/exported_methods_auto.go: -------------------------------------------------------------------------------- 1 | // Code generated by "dbusutil-gen em -type Manager"; DO NOT EDIT. 2 | 3 | package main 4 | 5 | import ( 6 | "github.com/linuxdeepin/go-lib/dbusutil" 7 | ) 8 | 9 | func (v *Manager) GetExportedMethods() dbusutil.ExportedMethods { 10 | return dbusutil.ExportedMethods{ 11 | { 12 | Name: "Set", 13 | Fn: v.Set, 14 | InArgs: []string{"name"}, 15 | }, 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /debian/copyright: -------------------------------------------------------------------------------- 1 | Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ 2 | Upstream-Name: dde-api 3 | 4 | Files: * 5 | Copyright: 2017 Deepin Technology Co., Ltd. 6 | License: GPL-3+ 7 | This package is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 3 of the License, or 10 | (at your option) any later version. 11 | . 12 | This package is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | . 17 | You should have received a copy of the GNU General Public License 18 | along with this program. If not, see 19 | . 20 | On Debian systems, the complete text of the GNU General 21 | Public License version 3 can be found in "/usr/share/common-licenses/GPL-3". 22 | -------------------------------------------------------------------------------- /debian/dde-api-dev.install: -------------------------------------------------------------------------------- 1 | /usr/share/gocode/ 2 | -------------------------------------------------------------------------------- /debian/dde-api.install: -------------------------------------------------------------------------------- 1 | /lib 2 | /usr/bin 3 | /usr/lib 4 | /usr/share/dbus-1 5 | /usr/share/dde-api 6 | /usr/share/icons/hicolor 7 | /usr/share/polkit-1 8 | /var/lib/polkit-1 9 | -------------------------------------------------------------------------------- /debian/dde-api.lintian-overrides: -------------------------------------------------------------------------------- 1 | dde-api: statically-linked-binary usr/lib/deepin-api/image-blur -------------------------------------------------------------------------------- /debian/dde-api.postrm: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # postrm script for dde-api 3 | 4 | set -e 5 | sound_player_user=deepin-sound-player 6 | 7 | if [ "$1" = "purge" ]; then 8 | deluser --quiet --system $sound_player_user >/dev/null || true 9 | delgroup --quiet --system $sound_player_user >/dev/null || true 10 | rm -rf /var/lib/$sound_player_user 2>/dev/null || true 11 | fi 12 | 13 | #DEBHELPER# 14 | exit 0 15 | -------------------------------------------------------------------------------- /debian/docs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | export GOCACHE = /tmp/gocache 3 | export GOPATH := /usr/share/gocode 4 | export GO111MODULE=off 5 | ifeq ($(DEB_BUILD_ARCH),sw_64) 6 | export GOFLAGS = -vet=off 7 | endif 8 | 9 | ifneq ($(DEB_BUILD_ARCH), mips64el) 10 | export GOBUILD_OPTIONS=-ldflags '-linkmode=external -extldflags "-pie"' 11 | endif 12 | 13 | %: 14 | dh $@ --buildsystem=makefile 15 | 16 | override_dh_auto_install: 17 | dh_auto_install 18 | 19 | override_dh_strip: 20 | dh_strip --dbgsym-migration=dde-api-dbg 21 | 22 | override_dh_installsystemd: 23 | dh_installsystemd --no-start 24 | -------------------------------------------------------------------------------- /debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (native) 2 | -------------------------------------------------------------------------------- /debian/triggers: -------------------------------------------------------------------------------- 1 | #interest /usr/share/wallpapers/deepin 2 | #interest /usr/share/backgrounds 3 | -------------------------------------------------------------------------------- /device/exported_methods_auto.go: -------------------------------------------------------------------------------- 1 | // Code generated by "dbusutil-gen em -type Device"; DO NOT EDIT. 2 | 3 | package main 4 | 5 | import ( 6 | "github.com/linuxdeepin/go-lib/dbusutil" 7 | ) 8 | 9 | func (v *Device) GetExportedMethods() dbusutil.ExportedMethods { 10 | return dbusutil.ExportedMethods{ 11 | { 12 | Name: "HasBluetoothDeviceBlocked", 13 | Fn: v.HasBluetoothDeviceBlocked, 14 | OutArgs: []string{"has"}, 15 | }, 16 | { 17 | Name: "UnblockBluetoothDevices", 18 | Fn: v.UnblockBluetoothDevices, 19 | }, 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /device/main.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | package main 6 | 7 | import ( 8 | "time" 9 | 10 | "github.com/linuxdeepin/go-lib/dbusutil" 11 | "github.com/linuxdeepin/go-lib/log" 12 | ) 13 | 14 | var logger = log.NewLogger(dbusServiceName) 15 | 16 | func main() { 17 | service, err := dbusutil.NewSystemService() 18 | if err != nil { 19 | logger.Fatal("failed to new system service:", err) 20 | } 21 | 22 | hasOwner, err := service.NameHasOwner(dbusServiceName) 23 | if err != nil { 24 | logger.Fatal(err) 25 | } 26 | if hasOwner { 27 | logger.Fatalf("name %q already has the owner", dbusServiceName) 28 | } 29 | 30 | d := &Device{ 31 | service: service, 32 | } 33 | err = service.Export(dbusPath, d) 34 | if err != nil { 35 | logger.Fatal("failed to export:", err) 36 | } 37 | 38 | err = service.RequestName(dbusServiceName) 39 | if err != nil { 40 | logger.Fatal("failed to request name:", err) 41 | } 42 | 43 | service.SetAutoQuitHandler(10*time.Second, d.canQuit) 44 | service.Wait() 45 | } 46 | -------------------------------------------------------------------------------- /drandr/drandr_test.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | package drandr 6 | 7 | import ( 8 | "testing" 9 | 10 | x "github.com/linuxdeepin/go-x11-client" 11 | "github.com/stretchr/testify/assert" 12 | ) 13 | 14 | func Test_GetScreenInfo(t *testing.T) { 15 | xConn, err := x.NewConn() 16 | if err != nil { 17 | t.Skip(err) 18 | } 19 | 20 | t.Run("Test_GetScreenInfo", func(t *testing.T) { 21 | _, err := GetScreenInfo(xConn) 22 | assert.NoError(t, err) 23 | }) 24 | } 25 | 26 | func Test_GetPrimary(t *testing.T) { 27 | xConn, err := x.NewConn() 28 | if err != nil { 29 | t.Skip(err) 30 | } 31 | screenInfo, err := GetScreenInfo(xConn) 32 | if err != nil { 33 | t.Skip(err) 34 | } 35 | 36 | _, err = screenInfo.GetPrimary() 37 | assert.NoError(t, err) 38 | } 39 | -------------------------------------------------------------------------------- /dxinput/common/common.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | package common 6 | 7 | const ( 8 | DevTypeUnknown int32 = iota 9 | DevTypeKeyboard 10 | DevTypeMouse 11 | DevTypeTouchpad 12 | DevTypeWacom 13 | DevTypeTouchscreen 14 | ) 15 | 16 | type DeviceInfo struct { 17 | Id int32 18 | Type int32 19 | Name string 20 | Enabled bool 21 | } 22 | type DeviceInfos []*DeviceInfo 23 | 24 | func (infos DeviceInfos) Get(id int32) *DeviceInfo { 25 | for _, info := range infos { 26 | if info.Id == id { 27 | return info 28 | } 29 | } 30 | return nil 31 | } 32 | -------------------------------------------------------------------------------- /dxinput/common/common_test.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | package common 6 | 7 | import ( 8 | "testing" 9 | 10 | "github.com/stretchr/testify/assert" 11 | ) 12 | 13 | func Test_Get(t *testing.T) { 14 | info := DeviceInfo{ 15 | Id: 111, 16 | Type: 1, 17 | Name: "test", 18 | Enabled: true, 19 | } 20 | 21 | infos := DeviceInfos{ 22 | &info, 23 | } 24 | 25 | assert.Equal(t, infos.Get(111).Id, info.Id) 26 | } 27 | -------------------------------------------------------------------------------- /dxinput/keyboard.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | package dxinput 6 | 7 | import ( 8 | "errors" 9 | "fmt" 10 | 11 | . "github.com/linuxdeepin/dde-api/dxinput/common" 12 | "github.com/linuxdeepin/dde-api/dxinput/kwayland" 13 | "github.com/linuxdeepin/dde-api/dxinput/utils" 14 | ) 15 | 16 | func SetKeyboardRepeat(enabled bool, delay, interval uint32) error { 17 | return utils.SetKeyboardRepeat(enabled, delay, interval) 18 | } 19 | 20 | type Keyboard struct { 21 | Id int32 22 | Name string 23 | } 24 | 25 | func NewKeyboard(id int32) (*Keyboard, error) { 26 | infos := utils.ListDevice() 27 | if infos == nil { 28 | return nil, errors.New("no device") 29 | } 30 | 31 | info := infos.Get(id) 32 | 33 | if info == nil { 34 | return nil, fmt.Errorf("invalid device id: %v", id) 35 | } 36 | return NewKeyboardDevInfo(info) 37 | } 38 | 39 | func NewKeyboardDevInfo(dev *DeviceInfo) (*Keyboard, error) { 40 | if dev == nil || dev.Type != DevTypeKeyboard { 41 | return nil, fmt.Errorf("not a keyboard device(%d - %s)", dev.Id, dev.Name) 42 | } 43 | 44 | return &Keyboard{ 45 | Id: dev.Id, 46 | Name: dev.Name, 47 | }, nil 48 | } 49 | 50 | func (m *Keyboard) Enable(enabled bool) error { 51 | if globalWayland { 52 | return kwayland.Enable(fmt.Sprintf("%s%d", kwayland.SysNamePrefix, m.Id), enabled) 53 | } 54 | 55 | return enableDevice(m.Id, enabled) 56 | } 57 | 58 | func (m *Keyboard) IsEnabled() bool { 59 | if globalWayland { 60 | return kwayland.CanEnabled(fmt.Sprintf("%s%d", kwayland.SysNamePrefix, m.Id)) 61 | } 62 | 63 | return isDeviceEnabled(m.Id) 64 | } 65 | -------------------------------------------------------------------------------- /dxinput/utils/button_map.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | #ifndef __BUTTON_MAP_H__ 6 | #define __BUTTON_MAP_H__ 7 | 8 | unsigned char* get_button_map(unsigned long xid, const char* name, int* nbuttons); 9 | int set_button_map(unsigned long xid, const char* name, 10 | unsigned char* map, int nbuttons); 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /dxinput/utils/keyboard.c: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | /** 6 | * Set keyboard repeat 7 | **/ 8 | 9 | #include 10 | #include 11 | 12 | #include 13 | #include 14 | #include "type.h" 15 | 16 | static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; 17 | 18 | int 19 | set_keyboard_repeat(int repeated, unsigned int delay, unsigned int interval) 20 | { 21 | pthread_mutex_lock(&mutex); 22 | setErrorHandler(); 23 | 24 | Display *disp = XOpenDisplay(0); 25 | if (!disp) { 26 | fprintf(stderr, "Open display failed\n"); 27 | pthread_mutex_unlock(&mutex); 28 | return -1; 29 | } 30 | 31 | int ret = 0; 32 | if (repeated) { 33 | XAutoRepeatOn(disp); 34 | 35 | // Use XKB in preference 36 | int rate_set = XkbSetAutoRepeatRate(disp, XkbUseCoreKbd, 37 | delay, interval); 38 | if (!rate_set) { 39 | ret = -1; 40 | fprintf(stderr, "Neither XKeyboard not Xfree86's\ 41 | keyboard extensions are available,\ 42 | \n no way to support keyboard\ 43 | autorepeat rate settings\n"); 44 | } 45 | } else { 46 | XAutoRepeatOff(disp); 47 | } 48 | 49 | XSync(disp, False); 50 | XCloseDisplay(disp); 51 | 52 | pthread_mutex_unlock(&mutex); 53 | 54 | return ret; 55 | } 56 | -------------------------------------------------------------------------------- /dxinput/utils/keyboard.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | #ifndef __KEYBOARD_H__ 6 | #define __KEYBOARD_H__ 7 | 8 | int set_keyboard_repeat(int repeated, unsigned int delay, unsigned int interval); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /dxinput/utils/list.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | #ifndef LIST_H 6 | #define LIST_H 7 | 8 | typedef struct _DeviceInfo { 9 | char *name; 10 | int id; 11 | int enabled; 12 | int ty; // type 13 | } DeviceInfo; 14 | 15 | DeviceInfo* list_device(int* num); 16 | void free_device_list(DeviceInfo* devs, int num); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /dxinput/utils/property.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | #ifndef UTILS_H 6 | #define UTILS_H 7 | 8 | #include 9 | 10 | unsigned char* get_prop(int id, const char* prop, int* nitems); 11 | int set_prop_int(int id, const char* prop, unsigned char* data, int nitems, int bit); 12 | int set_prop_float(int id, const char* prop, unsigned char* data, int nitems); 13 | int set_prop(int id, const char* prop, unsigned char* data, int nitems, 14 | Atom type, Atom format); 15 | int enable_left_handed(int id, const char* prop, int enabled); 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /dxinput/utils/type.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | #ifndef TYPE_H 6 | #define TYPE_H 7 | 8 | enum DEVICE_TYPE { 9 | TYPE_UNKNOWN, 10 | TYPE_KEYBOARD, 11 | TYPE_MOUSE, 12 | TYPE_TOUCHPAD, 13 | TYPE_WACOM, 14 | TYPE_TOUCHSCREEN, 15 | }; 16 | 17 | void setErrorHandler(); 18 | int listener_error_handler(Display * display, XErrorEvent * event); 19 | int listener_ioerror_handler(Display * display); 20 | 21 | int query_device_type(int deviceid); 22 | int is_property_exist(int deviceid, const char* prop); 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /gen.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | package api 6 | 7 | //go:generate go build -o target/ github.com/linuxdeepin/dde-api/device 8 | //go:generate go build -o target/ github.com/linuxdeepin/dde-api/graphic 9 | //go:generate go build -o target/ github.com/linuxdeepin/dde-api/locale-helper 10 | //go:generate go build -o target/ github.com/linuxdeepin/dde-api/thumbnailer 11 | //go:generate go build -o target/ github.com/linuxdeepin/dde-api/hans2pinyin 12 | //go:generate go build -o target/ github.com/linuxdeepin/dde-api/cursor-helper 13 | //go:generate go build -o target/ github.com/linuxdeepin/dde-api/gtk-thumbnailer 14 | //go:generate go build -o target/ github.com/linuxdeepin/dde-api/sound-theme-player 15 | //go:generate go build -o target/ github.com/linuxdeepin/dde-api/deepin-shutdown-sound 16 | //go:generate go build -o target/ github.com/linuxdeepin/dde-api/dde-open 17 | //go:generate go build -o target/ github.com/linuxdeepin/dde-api/adjust-grub-theme 18 | //go:generate go build -o target/ github.com/linuxdeepin/dde-api/image-blur 19 | //go:generate go build -o target/ github.com/linuxdeepin/dde-api/image-blur-helper 20 | -------------------------------------------------------------------------------- /graphic/main.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | package main 6 | 7 | import ( 8 | "time" 9 | 10 | "github.com/linuxdeepin/go-lib/dbusutil" 11 | "github.com/linuxdeepin/go-lib/log" 12 | ) 13 | 14 | var logger = log.NewLogger(dbusServiceName) 15 | 16 | func main() { 17 | logger.BeginTracing() 18 | defer logger.EndTracing() 19 | 20 | service, err := dbusutil.NewSessionService() 21 | if err != nil { 22 | logger.Fatal("failed to new session service:", err) 23 | } 24 | 25 | hasOwner, err := service.NameHasOwner(dbusServiceName) 26 | if err != nil { 27 | logger.Fatal(err) 28 | } 29 | if hasOwner { 30 | logger.Fatalf("name %q already has the owner", dbusServiceName) 31 | } 32 | 33 | graphic := &Graphic{ 34 | service: service, 35 | } 36 | err = service.Export(dbusPath, graphic) 37 | if err != nil { 38 | logger.Fatal("failed to export:", err) 39 | } 40 | 41 | err = service.RequestName(dbusServiceName) 42 | if err != nil { 43 | logger.Fatal("failed to request name:", err) 44 | } 45 | 46 | service.SetAutoQuitHandler(30*time.Second, nil) 47 | service.Wait() 48 | } 49 | -------------------------------------------------------------------------------- /graphic/testdata/origin_1920x1080.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/dde-api/9cffdd813b2ae3810f841ae3fdecc5920462c7a7/graphic/testdata/origin_1920x1080.jpg -------------------------------------------------------------------------------- /graphic/testdata/origin_icon_1_48x48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/dde-api/9cffdd813b2ae3810f841ae3fdecc5920462c7a7/graphic/testdata/origin_icon_1_48x48.png -------------------------------------------------------------------------------- /graphic/testdata/origin_icon_2_48x48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/dde-api/9cffdd813b2ae3810f841ae3fdecc5920462c7a7/graphic/testdata/origin_icon_2_48x48.png -------------------------------------------------------------------------------- /graphic/testdata/origin_not_image: -------------------------------------------------------------------------------- 1 | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 2 | -------------------------------------------------------------------------------- /graphic/testdata/origin_small_200x200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/dde-api/9cffdd813b2ae3810f841ae3fdecc5920462c7a7/graphic/testdata/origin_small_200x200.png -------------------------------------------------------------------------------- /grub_theme/font/font_test.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | package font 6 | 7 | import ( 8 | "testing" 9 | 10 | "github.com/stretchr/testify/assert" 11 | "github.com/stretchr/testify/require" 12 | ) 13 | 14 | func Test_LoadFont(t *testing.T) { 15 | font, err := LoadFont("testdata/unifont-regular-16.pf2") 16 | assert.NoError(t, err) 17 | assert.NotNil(t, font) 18 | } 19 | 20 | func Test_getString(t *testing.T) { 21 | s := §ion{ 22 | name: "section1", 23 | data: []byte("457"), 24 | } 25 | str := s.getString() 26 | assert.Equal(t, "457", str) 27 | } 28 | 29 | func Test_getUint16BE(t *testing.T) { 30 | s := §ion{ 31 | name: "section1", 32 | data: []byte("457"), 33 | } 34 | assert.Equal(t, 13365, int(s.getUint16BE())) 35 | } 36 | 37 | func Test_Close(t *testing.T) { 38 | font, err := LoadFont("testdata/unifont-regular-16.pf2") 39 | require.NoError(t, err) 40 | assert.NotNil(t, font) 41 | assert.Nil(t, font.Close()) 42 | } 43 | 44 | func Test_Height(t *testing.T) { 45 | font, err := LoadFont("testdata/unifont-regular-16.pf2") 46 | require.NoError(t, err) 47 | assert.NotNil(t, font) 48 | assert.Equal(t, 16, font.Height()) 49 | } 50 | -------------------------------------------------------------------------------- /grub_theme/font/testdata/unifont-regular-16.pf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/dde-api/9cffdd813b2ae3810f841ae3fdecc5920462c7a7/grub_theme/font/testdata/unifont-regular-16.pf2 -------------------------------------------------------------------------------- /hans2pinyin/README.md: -------------------------------------------------------------------------------- 1 | # Hans2Pinyin 2 | 3 | Query pinyin for the special hans. 4 | 5 | ## Usage 6 | 7 | hans2pinyin 8 | 9 | Example: 10 | 11 | ```shell 12 | $ hans2pinyin 重 13 | $ [chong zhong] 14 | ``` 15 | -------------------------------------------------------------------------------- /hans2pinyin/exported_methods_auto.go: -------------------------------------------------------------------------------- 1 | // Code generated by "dbusutil-gen em -type Manager"; DO NOT EDIT. 2 | 3 | package main 4 | 5 | import ( 6 | "github.com/linuxdeepin/go-lib/dbusutil" 7 | ) 8 | 9 | func (v *Manager) GetExportedMethods() dbusutil.ExportedMethods { 10 | return dbusutil.ExportedMethods{ 11 | { 12 | Name: "Query", 13 | Fn: v.Query, 14 | InArgs: []string{"hans"}, 15 | OutArgs: []string{"pinyin"}, 16 | }, 17 | { 18 | Name: "QueryList", 19 | Fn: v.QueryList, 20 | InArgs: []string{"hansList"}, 21 | OutArgs: []string{"jsonStr"}, 22 | }, 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /hans2pinyin/main_test.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | package main 6 | 7 | import ( 8 | "fmt" 9 | "testing" 10 | 11 | "github.com/linuxdeepin/go-lib/dbusutil" 12 | "github.com/stretchr/testify/suite" 13 | ) 14 | 15 | type UnitTestSuite struct { 16 | suite.Suite 17 | m *Manager 18 | } 19 | 20 | func (s *UnitTestSuite) SetupSuite() { 21 | var err error 22 | s.m = &Manager{} 23 | s.m.service, err = dbusutil.NewSessionService() 24 | if err != nil { 25 | s.T().Skip(fmt.Sprintf("failed to get service: %v", err)) 26 | } 27 | } 28 | 29 | func (s *UnitTestSuite) Test_Query() { 30 | pinyin, err := s.m.Query("Hanz") 31 | s.Require().Nil(err) 32 | s.Assert().ElementsMatch(pinyin, []string{"Hanz"}) 33 | } 34 | 35 | func (s *UnitTestSuite) Test_QueryQueryList() { 36 | hansList := []string{"Hanz"} 37 | jsonStr, err := s.m.QueryList(hansList) 38 | testStr := `{"Hanz":["Hanz"]}` 39 | s.Require().Nil(err) 40 | s.Equal(jsonStr, testStr) 41 | } 42 | 43 | func (s *UnitTestSuite) Test_GetInterfaceName() { 44 | s.Equal(s.m.GetInterfaceName(), dbusServiceName) 45 | } 46 | 47 | func (s *UnitTestSuite) Test_usage() { 48 | usage() 49 | } 50 | 51 | func (s *UnitTestSuite) Test_queryPinyin() { 52 | pinyin := queryPinyin("Hanz") 53 | s.Assert().ElementsMatch(pinyin, []string{"Hanz"}) 54 | } 55 | 56 | func TestUnitTestSuite(t *testing.T) { 57 | suite.Run(t, new(UnitTestSuite)) 58 | } 59 | -------------------------------------------------------------------------------- /huangli-generator/.gitignore: -------------------------------------------------------------------------------- 1 | huangli_generator 2 | huangli-generator 3 | -------------------------------------------------------------------------------- /huangli-generator/Makefile: -------------------------------------------------------------------------------- 1 | PROG=huangli_generator 2 | 3 | build: 4 | go build -o ${PROG} 5 | 6 | clean: 7 | rm -f ${PROG} 8 | 9 | rebuild: clean build 10 | -------------------------------------------------------------------------------- /huangli-generator/README.org: -------------------------------------------------------------------------------- 1 | #+OPTIONS: toc:nil num:nil timestamp:nil ^:{} <:{} 2 | #+TITLE: 生成黄历数据 3 | 4 | ** Description 5 | 6 | 程序用来生成黄历数据到数据库中,数据爬自百度。 7 | 8 | 经过测试百度中目前(2019)可获取到 =2008.1 ~ 2020.12= 的数据。 9 | 10 | ** Prepare 11 | 12 | 设置 =GOPATH= ,如 =mkdir ~/go && export GOPATH=~/go= 13 | 14 | ** Dependencies 15 | 16 | *** Build Dependencies 17 | 18 | + =go= 19 | 20 | =sudo apt-get install golang-src golang-go= 21 | 22 | + =github.com/mattn/go-sqlite3= 23 | 24 | =go get -u -v github.com/mattn/go-sqlite3= 25 | 26 | + =libsqlite3-dev= 27 | 28 | =sudo apt-get install libsqlite3-dev= 29 | 30 | *** Run Dependencies 31 | 32 | + =sqlite3= 33 | 34 | =sudo apt-get install sqlite3= 35 | 36 | ** Build 37 | 38 | =make build= 39 | 40 | 41 | ** Run 42 | 43 | 使用方法请执行: 44 | 45 | =./huangli_generator -h= 46 | 47 | 查看 48 | 49 | ** Version 50 | 51 | 当前版本为 =v1.0= ,生成的是 =2008.1 ~ 2020.12= 之间的数据,生成的命令如下: 52 | 53 | #+BEGIN_SRC shell 54 | ./huangli_generator -s 2008 -e 2020 -f ../misc/data/huangli.db 55 | echo "v1.0" > ../misc/data/huangli.version 56 | #+END_SRC 57 | 58 | *之后更新完数据,必须同时更新 =version= ,否则依然使用的是旧数据* 59 | -------------------------------------------------------------------------------- /huangli-generator/huangli.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/dde-api/9cffdd813b2ae3810f841ae3fdecc5920462c7a7/huangli-generator/huangli.db -------------------------------------------------------------------------------- /huangli-generator/huangliBase.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/dde-api/9cffdd813b2ae3810f841ae3fdecc5920462c7a7/huangli-generator/huangliBase.db -------------------------------------------------------------------------------- /huangli/db_test.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | package huangli 6 | 7 | import ( 8 | "github.com/stretchr/testify/assert" 9 | "testing" 10 | ) 11 | 12 | func TestContain(t *testing.T) { 13 | holidayList := HolidayList([]*Holiday{ 14 | { 15 | Date: "2020-12-1", 16 | Status: 0, 17 | }, 18 | { 19 | Date: "2020-12-2", 20 | Status: 0, 21 | }, 22 | { 23 | Date: "2020-11-1", 24 | Status: 0, 25 | }, 26 | }) 27 | tests := []struct { 28 | InputYear int 29 | InputMouth int 30 | Expect bool 31 | }{ 32 | { 33 | InputYear: 2020, 34 | InputMouth: 11, 35 | Expect: true, 36 | }, 37 | { 38 | InputYear: 2020, 39 | InputMouth: 12, 40 | Expect: true, 41 | }, 42 | { 43 | InputYear: 2020, 44 | InputMouth: 9, 45 | Expect: false, 46 | }, 47 | { 48 | InputYear: 2019, 49 | InputMouth: 12, 50 | Expect: false, 51 | }, 52 | } 53 | for _, data := range tests { 54 | assert.Equal(t, data.Expect, holidayList.Contain(data.InputYear, data.InputMouth)) 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /i18n_dependent/i18n_dependent_test.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | package i18n_dependent 6 | 7 | import ( 8 | "testing" 9 | 10 | "github.com/stretchr/testify/suite" 11 | ) 12 | 13 | type UnitTestSuite struct { 14 | suite.Suite 15 | testCategories jsonDependentCategories 16 | testDependentInfos jsonDependentInfos 17 | } 18 | 19 | func (s *UnitTestSuite) SetupSuite() { 20 | var err error 21 | s.testCategories, err = getDependentCategories("testdata/i18n_dependent.json") 22 | s.Require().Nil(err) 23 | s.testDependentInfos = s.testCategories[0].Infos 24 | } 25 | 26 | func (s *UnitTestSuite) Test_GetAllDependentInfos() { 27 | testDependents := s.testCategories.GetAllDependentInfos("zh_HK.UTF-8") 28 | s.Assert().NotNil(testDependents) 29 | } 30 | 31 | func (s *UnitTestSuite) Test_GetDependentInfos() { 32 | testDependents := s.testCategories.GetDependentInfos("tr", "zh_HK.UTF-8") 33 | s.Assert().NotNil(testDependents) 34 | } 35 | 36 | func (s *UnitTestSuite) Test_GetInfos() { 37 | testDependents := s.testCategories.GetInfos("tr") 38 | s.Assert().NotNil(testDependents) 39 | } 40 | 41 | func (s *UnitTestSuite) Test_GetDependentInfosByLocale() { 42 | s.testDependentInfos.GetDependentInfos("zh_HK.UTF-8") 43 | } 44 | 45 | func TestUnitTestSuite(t *testing.T) { 46 | suite.Run(t, new(UnitTestSuite)) 47 | } 48 | -------------------------------------------------------------------------------- /i18n_dependent/sourcehansans.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | package i18n_dependent 6 | 7 | var ( 8 | conflictPkgMap = map[string][]string{ 9 | "fonts-adobe-source-han-sans-cn": []string{ 10 | "fonts-adobe-source-han-sans-tw", 11 | "fonts-adobe-source-han-sans-jp", 12 | "fonts-adobe-source-han-sans-kr", 13 | }, 14 | "fonts-adobe-source-han-sans-tw": []string{ 15 | "fonts-adobe-source-han-sans-cn", 16 | "fonts-adobe-source-han-sans-jp", 17 | "fonts-adobe-source-han-sans-kr", 18 | }, 19 | "fonts-adobe-source-han-sans-jp": []string{ 20 | "fonts-adobe-source-han-sans-cn", 21 | "fonts-adobe-source-han-sans-tw", 22 | "fonts-adobe-source-han-sans-kr", 23 | }, 24 | "fonts-adobe-source-han-sans-kr": []string{ 25 | "fonts-adobe-source-han-sans-cn", 26 | "fonts-adobe-source-han-sans-tw", 27 | "fonts-adobe-source-han-sans-jp", 28 | }, 29 | } 30 | ) 31 | -------------------------------------------------------------------------------- /image-blur/main.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | package main 6 | 7 | import ( 8 | "flag" 9 | "log" 10 | 11 | "github.com/linuxdeepin/dde-api/blurimage" 12 | ) 13 | 14 | var sigma = flag.Float64("sigma", 20.0, "control the strength of the blurring effect") 15 | 16 | func main() { 17 | flag.Parse() 18 | args := flag.Args() 19 | input := args[0] 20 | output := args[1] 21 | 22 | err := blurimage.BlurImage(input, *sigma, output) 23 | if err != nil { 24 | log.Fatal(err) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /inhibit_hint/exported_methods_auto.go: -------------------------------------------------------------------------------- 1 | // Code generated by "dbusutil-gen em -type Object"; DO NOT EDIT. 2 | 3 | package inhibit_hint 4 | 5 | import ( 6 | "github.com/linuxdeepin/go-lib/dbusutil" 7 | ) 8 | 9 | func (v *Object) GetExportedMethods() dbusutil.ExportedMethods { 10 | return dbusutil.ExportedMethods{ 11 | { 12 | Name: "Get", 13 | Fn: v.Get, 14 | InArgs: []string{"locale", "why"}, 15 | OutArgs: []string{"hint"}, 16 | }, 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /inhibit_hint/t1_test.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | package inhibit_hint 6 | 7 | import ( 8 | "testing" 9 | 10 | "github.com/stretchr/testify/assert" 11 | ) 12 | 13 | func TestGetSetName(t *testing.T) { 14 | o := New("domain") 15 | o.SetName("name1") 16 | assert.Equal(t, "name1", o.getName("why1")) 17 | assert.Equal(t, "name1", o.getName("why2")) 18 | 19 | fn := func(why string) string { 20 | switch why { 21 | case "why1": 22 | return "name1" 23 | case "why2": 24 | return "name2" 25 | } 26 | return "" 27 | } 28 | o.SetNameFunc(fn) 29 | assert.Equal(t, "name1", o.getName("why1")) 30 | assert.Equal(t, "name2", o.getName("why2")) 31 | } 32 | 33 | func TestGetSetIcon(t *testing.T) { 34 | o := New("domain") 35 | o.SetIcon("icon1") 36 | assert.Equal(t, "icon1", o.getIcon("why1")) 37 | assert.Equal(t, "icon1", o.getIcon("why2")) 38 | 39 | fn := func(why string) string { 40 | switch why { 41 | case "why1": 42 | return "icon1" 43 | case "why2": 44 | return "icon2" 45 | } 46 | return "" 47 | } 48 | o.SetIconFunc(fn) 49 | assert.Equal(t, "icon1", o.getIcon("why1")) 50 | assert.Equal(t, "icon2", o.getIcon("why2")) 51 | } 52 | -------------------------------------------------------------------------------- /locale-helper/exported_methods_auto.go: -------------------------------------------------------------------------------- 1 | // Code generated by "dbusutil-gen em -type Helper"; DO NOT EDIT. 2 | 3 | package main 4 | 5 | import ( 6 | "github.com/linuxdeepin/go-lib/dbusutil" 7 | ) 8 | 9 | func (v *Helper) GetExportedMethods() dbusutil.ExportedMethods { 10 | return dbusutil.ExportedMethods{ 11 | { 12 | Name: "GenerateLocale", 13 | Fn: v.GenerateLocale, 14 | InArgs: []string{"locale"}, 15 | }, 16 | { 17 | Name: "SetLocale", 18 | Fn: v.SetLocale, 19 | InArgs: []string{"locale"}, 20 | }, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /locale-helper/locale_test.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | package main 6 | 7 | import ( 8 | "testing" 9 | 10 | "github.com/stretchr/testify/assert" 11 | ) 12 | 13 | func Test_LocaleFile(t *testing.T) { 14 | finfo, err := NewLocaleFileInfo("testdata/locale.gen") 15 | assert.Nil(t, err) 16 | assert.Equal(t, len(finfo.Infos), 471) 17 | assert.Equal(t, len(finfo.GetEnabledLocales()), 5) 18 | 19 | // test locale valid 20 | assert.Equal(t, finfo.IsLocaleValid("zh_CN.UTF-8"), true) 21 | assert.Equal(t, finfo.IsLocaleValid("zh_CNN"), false) 22 | 23 | // enable 24 | finfo.EnableLocale("zh_CN.UTF-8") 25 | assert.Equal(t, len(finfo.GetEnabledLocales()), 5) 26 | finfo.EnableLocale("zh_TW.UTF-8") 27 | assert.Equal(t, len(finfo.GetEnabledLocales()), 6) 28 | var tmp = "/tmp/test_locale" 29 | err = finfo.Save(tmp) 30 | assert.Nil(t, err) 31 | 32 | finfo, err = NewLocaleFileInfo(tmp) 33 | assert.Nil(t, err) 34 | assert.Equal(t, len(finfo.Infos), 471) 35 | assert.Equal(t, len(finfo.GetEnabledLocales()), 6) 36 | 37 | // disable 38 | finfo.DisableLocale("zh_HK.UTF-8") 39 | assert.Equal(t, len(finfo.GetEnabledLocales()), 6) 40 | finfo.DisableLocale("zh_CN.UTF-8") 41 | assert.Equal(t, len(finfo.GetEnabledLocales()), 5) 42 | var tmp2 = "/tmp/test_locale2" 43 | err = finfo.Save(tmp2) 44 | assert.Nil(t, err) 45 | 46 | finfo, err = NewLocaleFileInfo(tmp2) 47 | assert.Nil(t, err) 48 | assert.Equal(t, len(finfo.Infos), 471) 49 | assert.Equal(t, len(finfo.GetEnabledLocales()), 5) 50 | } 51 | -------------------------------------------------------------------------------- /lunar-calendar/.gitignore: -------------------------------------------------------------------------------- 1 | lunar-calendar 2 | -------------------------------------------------------------------------------- /lunar-calendar/exported_methods_auto.go: -------------------------------------------------------------------------------- 1 | // Code generated by "dbusutil-gen em -type Manager"; DO NOT EDIT. 2 | 3 | package main 4 | 5 | import ( 6 | "github.com/linuxdeepin/go-lib/dbusutil" 7 | ) 8 | 9 | func (v *Manager) GetExportedMethods() dbusutil.ExportedMethods { 10 | return dbusutil.ExportedMethods{ 11 | { 12 | Name: "GetFestivalMonth", 13 | Fn: v.GetFestivalMonth, 14 | InArgs: []string{"year", "month"}, 15 | OutArgs: []string{"jsonStr"}, 16 | }, 17 | { 18 | Name: "GetFestivalsInRange", 19 | Fn: v.GetFestivalsInRange, 20 | InArgs: []string{"start", "end"}, 21 | OutArgs: []string{"result"}, 22 | }, 23 | { 24 | Name: "GetHuangLiDay", 25 | Fn: v.GetHuangLiDay, 26 | InArgs: []string{"year", "month", "day"}, 27 | OutArgs: []string{"jsonStr"}, 28 | }, 29 | { 30 | Name: "GetHuangLiMonth", 31 | Fn: v.GetHuangLiMonth, 32 | InArgs: []string{"year", "month", "fill"}, 33 | OutArgs: []string{"jsonStr"}, 34 | }, 35 | { 36 | Name: "GetLunarInfoBySolar", 37 | Fn: v.GetLunarInfoBySolar, 38 | InArgs: []string{"year", "month", "day"}, 39 | OutArgs: []string{"lunarDay", "ok"}, 40 | }, 41 | { 42 | Name: "GetLunarMonthCalendar", 43 | Fn: v.GetLunarMonthCalendar, 44 | InArgs: []string{"year", "month", "fill"}, 45 | OutArgs: []string{"lunarMonth", "ok"}, 46 | }, 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /lunar-calendar/lunar_calendar_test.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | package main 6 | 7 | import ( 8 | "fmt" 9 | "testing" 10 | 11 | "github.com/linuxdeepin/go-lib/dbusutil" 12 | "github.com/stretchr/testify/suite" 13 | ) 14 | 15 | type UnitTestSuite struct { 16 | suite.Suite 17 | m *Manager 18 | } 19 | 20 | func (s *UnitTestSuite) SetupSuite() { 21 | var err error 22 | s.m = &Manager{} 23 | s.m.service, err = dbusutil.NewSessionService() 24 | if err != nil { 25 | s.T().Skip(fmt.Sprintf("failed to get service: %v", err)) 26 | } 27 | } 28 | 29 | func (s *UnitTestSuite) Test_GetInterfaceName() { 30 | s.m.GetInterfaceName() 31 | } 32 | 33 | func (s *UnitTestSuite) Test_GetLunarInfoBySolar() { 34 | _, _, err := s.m.GetLunarInfoBySolar(2021, 10, 1) 35 | s.Require().Nil(err) 36 | } 37 | 38 | func (s *UnitTestSuite) Test_GetFestivalsInRange() { 39 | _, err := s.m.GetFestivalsInRange("2021-01-02", "2021-10-01") 40 | s.Require().Nil(err) 41 | } 42 | 43 | func (s *UnitTestSuite) Test_GetLunarMonthCalendar() { 44 | _, _, err := s.m.GetLunarMonthCalendar(2021, 10, true) 45 | s.Require().Nil(err) 46 | } 47 | 48 | func (s *UnitTestSuite) Test_GetHuangLiDay() { 49 | _, err := s.m.GetHuangLiDay(2021, 10, 1) 50 | s.Require().Nil(err) 51 | } 52 | 53 | func (s *UnitTestSuite) Test_GetHuangLiMonth() { 54 | _, err := s.m.GetHuangLiMonth(2021, 10, true) 55 | s.Require().Nil(err) 56 | } 57 | 58 | func TestUnitTestSuite(t *testing.T) { 59 | suite.Run(t, new(UnitTestSuite)) 60 | } 61 | -------------------------------------------------------------------------------- /lunar-calendar/main.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | package main 6 | 7 | import ( 8 | "time" 9 | 10 | "github.com/linuxdeepin/go-lib/dbusutil" 11 | "github.com/linuxdeepin/go-lib/log" 12 | ) 13 | 14 | var ( 15 | logger = log.NewLogger("api/LunarCalendar") 16 | ) 17 | 18 | func main() { 19 | logger.SetRestartCommand("/usr/lib/deepin-api/lunar-calendar") 20 | 21 | service, err := dbusutil.NewSessionService() 22 | if err != nil { 23 | logger.Fatal("failed to new session service:", err) 24 | } 25 | 26 | hasOwner, err := service.NameHasOwner(dbusServiceName) 27 | if err != nil { 28 | logger.Fatal(err) 29 | } 30 | if hasOwner { 31 | logger.Fatalf("name %q already has the owner", dbusServiceName) 32 | } 33 | 34 | initHuangLi() 35 | defer finalizeHuangLi() 36 | 37 | m := NewManager(service) 38 | err = service.Export(dbusPath, m) 39 | if err != nil { 40 | logger.Fatal("failed to export:", err) 41 | } 42 | 43 | err = service.RequestName(dbusServiceName) 44 | if err != nil { 45 | logger.Fatal("failed to request name:", err) 46 | } 47 | 48 | service.SetAutoQuitHandler(time.Second*100, nil) 49 | service.Wait() 50 | } 51 | -------------------------------------------------------------------------------- /misc/conf/org.deepin.dde.Device1.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 19 | 21 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /misc/conf/org.deepin.dde.LocaleHelper1.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 19 | 21 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /misc/conf/org.deepin.dde.SoundThemePlayer1.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /misc/data/grub-themes/deepin-fallback/deepin_background.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/dde-api/9cffdd813b2ae3810f841ae3fdecc5920462c7a7/misc/data/grub-themes/deepin-fallback/deepin_background.jpg -------------------------------------------------------------------------------- /misc/data/grub-themes/deepin-fallback/deepin_background_in_theme.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/dde-api/9cffdd813b2ae3810f841ae3fdecc5920462c7a7/misc/data/grub-themes/deepin-fallback/deepin_background_in_theme.jpg -------------------------------------------------------------------------------- /misc/data/grub-themes/deepin-fallback/selected_item_c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/dde-api/9cffdd813b2ae3810f841ae3fdecc5920462c7a7/misc/data/grub-themes/deepin-fallback/selected_item_c.png -------------------------------------------------------------------------------- /misc/data/grub-themes/deepin-fallback/selected_item_e.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/dde-api/9cffdd813b2ae3810f841ae3fdecc5920462c7a7/misc/data/grub-themes/deepin-fallback/selected_item_e.png -------------------------------------------------------------------------------- /misc/data/grub-themes/deepin-fallback/selected_item_n.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/dde-api/9cffdd813b2ae3810f841ae3fdecc5920462c7a7/misc/data/grub-themes/deepin-fallback/selected_item_n.png -------------------------------------------------------------------------------- /misc/data/grub-themes/deepin-fallback/selected_item_ne.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/dde-api/9cffdd813b2ae3810f841ae3fdecc5920462c7a7/misc/data/grub-themes/deepin-fallback/selected_item_ne.png -------------------------------------------------------------------------------- /misc/data/grub-themes/deepin-fallback/selected_item_nw.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/dde-api/9cffdd813b2ae3810f841ae3fdecc5920462c7a7/misc/data/grub-themes/deepin-fallback/selected_item_nw.png -------------------------------------------------------------------------------- /misc/data/grub-themes/deepin-fallback/selected_item_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/dde-api/9cffdd813b2ae3810f841ae3fdecc5920462c7a7/misc/data/grub-themes/deepin-fallback/selected_item_s.png -------------------------------------------------------------------------------- /misc/data/grub-themes/deepin-fallback/selected_item_se.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/dde-api/9cffdd813b2ae3810f841ae3fdecc5920462c7a7/misc/data/grub-themes/deepin-fallback/selected_item_se.png -------------------------------------------------------------------------------- /misc/data/grub-themes/deepin-fallback/selected_item_sw.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/dde-api/9cffdd813b2ae3810f841ae3fdecc5920462c7a7/misc/data/grub-themes/deepin-fallback/selected_item_sw.png -------------------------------------------------------------------------------- /misc/data/grub-themes/deepin-fallback/selected_item_w.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/dde-api/9cffdd813b2ae3810f841ae3fdecc5920462c7a7/misc/data/grub-themes/deepin-fallback/selected_item_w.png -------------------------------------------------------------------------------- /misc/data/grub-themes/deepin-fallback/terminal_box_c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/dde-api/9cffdd813b2ae3810f841ae3fdecc5920462c7a7/misc/data/grub-themes/deepin-fallback/terminal_box_c.png -------------------------------------------------------------------------------- /misc/data/grub-themes/deepin-fallback/terminal_box_e.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/dde-api/9cffdd813b2ae3810f841ae3fdecc5920462c7a7/misc/data/grub-themes/deepin-fallback/terminal_box_e.png -------------------------------------------------------------------------------- /misc/data/grub-themes/deepin-fallback/terminal_box_n.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/dde-api/9cffdd813b2ae3810f841ae3fdecc5920462c7a7/misc/data/grub-themes/deepin-fallback/terminal_box_n.png -------------------------------------------------------------------------------- /misc/data/grub-themes/deepin-fallback/terminal_box_ne.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/dde-api/9cffdd813b2ae3810f841ae3fdecc5920462c7a7/misc/data/grub-themes/deepin-fallback/terminal_box_ne.png -------------------------------------------------------------------------------- /misc/data/grub-themes/deepin-fallback/terminal_box_nw.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/dde-api/9cffdd813b2ae3810f841ae3fdecc5920462c7a7/misc/data/grub-themes/deepin-fallback/terminal_box_nw.png -------------------------------------------------------------------------------- /misc/data/grub-themes/deepin-fallback/terminal_box_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/dde-api/9cffdd813b2ae3810f841ae3fdecc5920462c7a7/misc/data/grub-themes/deepin-fallback/terminal_box_s.png -------------------------------------------------------------------------------- /misc/data/grub-themes/deepin-fallback/terminal_box_se.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/dde-api/9cffdd813b2ae3810f841ae3fdecc5920462c7a7/misc/data/grub-themes/deepin-fallback/terminal_box_se.png -------------------------------------------------------------------------------- /misc/data/grub-themes/deepin-fallback/terminal_box_sw.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/dde-api/9cffdd813b2ae3810f841ae3fdecc5920462c7a7/misc/data/grub-themes/deepin-fallback/terminal_box_sw.png -------------------------------------------------------------------------------- /misc/data/grub-themes/deepin-fallback/terminal_box_w.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/dde-api/9cffdd813b2ae3810f841ae3fdecc5920462c7a7/misc/data/grub-themes/deepin-fallback/terminal_box_w.png -------------------------------------------------------------------------------- /misc/data/grub-themes/deepin-fallback/unifont-regular-16.pf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/dde-api/9cffdd813b2ae3810f841ae3fdecc5920462c7a7/misc/data/grub-themes/deepin-fallback/unifont-regular-16.pf2 -------------------------------------------------------------------------------- /misc/data/grub-themes/deepin-fallback/uos_background.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/dde-api/9cffdd813b2ae3810f841ae3fdecc5920462c7a7/misc/data/grub-themes/deepin-fallback/uos_background.jpg -------------------------------------------------------------------------------- /misc/data/grub-themes/deepin-fallback/uos_background_in_theme.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/dde-api/9cffdd813b2ae3810f841ae3fdecc5920462c7a7/misc/data/grub-themes/deepin-fallback/uos_background_in_theme.jpg -------------------------------------------------------------------------------- /misc/data/grub-themes/deepin/background.origin.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/dde-api/9cffdd813b2ae3810f841ae3fdecc5920462c7a7/misc/data/grub-themes/deepin/background.origin.jpg -------------------------------------------------------------------------------- /misc/data/grub-themes/deepin/resources/os-logos/antergos.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /misc/data/grub-themes/deepin/resources/os-logos/arch.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /misc/data/grub-themes/deepin/resources/os-logos/chakra.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /misc/data/grub-themes/deepin/resources/os-logos/gentoo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /misc/data/grub-themes/deepin/resources/os-logos/korora.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /misc/data/grub-themes/deepin/resources/os-logos/lfs.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /misc/data/grub-themes/deepin/resources/os-logos/linux-mint.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /misc/data/grub-themes/deepin/resources/os-logos/manjaro.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /misc/data/grub-themes/deepin/resources/os-logos/windows.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /misc/data/grub-themes/deepin/terminal_box_c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/dde-api/9cffdd813b2ae3810f841ae3fdecc5920462c7a7/misc/data/grub-themes/deepin/terminal_box_c.png -------------------------------------------------------------------------------- /misc/data/huangli.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/dde-api/9cffdd813b2ae3810f841ae3fdecc5920462c7a7/misc/data/huangli.db -------------------------------------------------------------------------------- /misc/data/huangli.version: -------------------------------------------------------------------------------- 1 | v4.0 2 | -------------------------------------------------------------------------------- /misc/icons/128x128/actions/media-autorun-nop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/dde-api/9cffdd813b2ae3810f841ae3fdecc5920462c7a7/misc/icons/128x128/actions/media-autorun-nop.png -------------------------------------------------------------------------------- /misc/icons/128x128/actions/media-autorun-open-folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/dde-api/9cffdd813b2ae3810f841ae3fdecc5920462c7a7/misc/icons/128x128/actions/media-autorun-open-folder.png -------------------------------------------------------------------------------- /misc/icons/48x48/actions/media-autorun-nop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/dde-api/9cffdd813b2ae3810f841ae3fdecc5920462c7a7/misc/icons/48x48/actions/media-autorun-nop.png -------------------------------------------------------------------------------- /misc/icons/48x48/actions/media-autorun-open-folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/dde-api/9cffdd813b2ae3810f841ae3fdecc5920462c7a7/misc/icons/48x48/actions/media-autorun-open-folder.png -------------------------------------------------------------------------------- /misc/icons/64x64/actions/media-autorun-nop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/dde-api/9cffdd813b2ae3810f841ae3fdecc5920462c7a7/misc/icons/64x64/actions/media-autorun-nop.png -------------------------------------------------------------------------------- /misc/icons/64x64/actions/media-autorun-open-folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/dde-api/9cffdd813b2ae3810f841ae3fdecc5920462c7a7/misc/icons/64x64/actions/media-autorun-open-folder.png -------------------------------------------------------------------------------- /misc/icons/96x96/actions/media-autorun-nop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/dde-api/9cffdd813b2ae3810f841ae3fdecc5920462c7a7/misc/icons/96x96/actions/media-autorun-nop.png -------------------------------------------------------------------------------- /misc/icons/96x96/actions/media-autorun-open-folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/dde-api/9cffdd813b2ae3810f841ae3fdecc5920462c7a7/misc/icons/96x96/actions/media-autorun-open-folder.png -------------------------------------------------------------------------------- /misc/polkit-action/org.deepin.dde.device.unblock-bluetooth-devices.policy.in: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | Unblock bluetooth devices 11 | Authentication is required to unblock bluetooth devices 12 | 13 | no 14 | no 15 | auth_admin_keep 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /misc/polkit-action/org.deepin.dde.locale-helper.policy.in: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | Manage your system locale 11 | Authentication is required to switch language 12 | 13 | no 14 | no 15 | yes 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /misc/polkit-localauthority/org.deepin.dde.device.pkla: -------------------------------------------------------------------------------- 1 | [Unblock bluetooth devices] 2 | Identity=unix-group:sudo 3 | Action=org.deepin.dde.device.unblock-bluetooth-devices 4 | ResultAny=no 5 | ResultInactive=no 6 | ResultActive=yes 7 | -------------------------------------------------------------------------------- /misc/scripts/deepin-boot-sound.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | /usr/bin/dbus-send --system --print-reply --dest=com.deepin.api.SoundThemePlayer /com/deepin/api/SoundThemePlayer com.deepin.api.SoundThemePlayer.PlaySoundDesktopLogin& 4 | -------------------------------------------------------------------------------- /misc/services/org.deepin.dde.CursorHelper1.service: -------------------------------------------------------------------------------- 1 | [D-BUS Service] 2 | Name=org.deepin.dde.CursorHelper1 3 | Exec=/usr/lib/deepin-api/cursor-helper 4 | -------------------------------------------------------------------------------- /misc/services/org.deepin.dde.Graphic1.service: -------------------------------------------------------------------------------- 1 | [D-BUS Service] 2 | Name=org.deepin.dde.Graphic1 3 | Exec=/usr/lib/deepin-api/graphic 4 | -------------------------------------------------------------------------------- /misc/services/org.deepin.dde.LunarCalendar1.service: -------------------------------------------------------------------------------- 1 | [D-BUS Service] 2 | Name=org.deepin.dde.LunarCalendar1 3 | #Exec=/usr/lib/deepin-api/lunar-calendar 4 | -------------------------------------------------------------------------------- /misc/services/org.deepin.dde.Pinyin1.service: -------------------------------------------------------------------------------- 1 | [D-BUS Service] 2 | Name=org.deepin.dde.Pinyin1 3 | Exec=/usr/lib/deepin-api/hans2pinyin -------------------------------------------------------------------------------- /misc/system-services/org.deepin.dde.Device1.service: -------------------------------------------------------------------------------- 1 | [D-BUS Service] 2 | Name=org.deepin.dde.Device1 3 | Exec=/usr/lib/deepin-api/device 4 | User=deepin-daemon 5 | SystemdService=dbus-org.deepin.dde.Device1.service 6 | -------------------------------------------------------------------------------- /misc/system-services/org.deepin.dde.LocaleHelper1.service: -------------------------------------------------------------------------------- 1 | [D-BUS Service] 2 | Name=org.deepin.dde.LocaleHelper1 3 | Exec=/usr/lib/deepin-api/locale-helper 4 | User=root 5 | SystemdService=dbus-org.deepin.dde.LocaleHelper1.service 6 | -------------------------------------------------------------------------------- /misc/system-services/org.deepin.dde.SoundThemePlayer1.service: -------------------------------------------------------------------------------- 1 | [D-BUS Service] 2 | Name=org.deepin.dde.SoundThemePlayer1 3 | Exec=/usr/lib/deepin-api/sound-theme-player 4 | User=deepin-sound-player 5 | SystemdService=dbus-org.deepin.dde.SoundThemePlayer1.service 6 | -------------------------------------------------------------------------------- /misc/systemd/system/deepin-api-device.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Deepin Device Api Service 3 | 4 | Requisite=sound.target 5 | After=sound.target 6 | 7 | # Ask for the dbus socket. 8 | Wants=dbus.socket 9 | After=dbus.socket 10 | 11 | [Service] 12 | Type=dbus 13 | User=deepin-daemon 14 | BusName=org.deepin.dde.Device1 15 | ExecStart=/usr/lib/deepin-api/device 16 | 17 | DeviceAllow=/dev/rfkill rw 18 | DevicePolicy=closed 19 | 20 | ProtectSystem=full 21 | ProtectHome=yes 22 | PrivateTmp=yes 23 | #PrivateDevices=yes 24 | PrivateNetwork=yes 25 | ProtectHostname=yes 26 | ProtectClock=yes 27 | ProtectKernelTunables=yes 28 | ProtectKernelModules=yes 29 | ProtectKernelLogs=yes 30 | ProtectControlGroups=yes 31 | RestrictAddressFamilies=AF_UNIX 32 | RestrictNamespaces=yes 33 | LockPersonality=yes 34 | RestrictRealtime=yes 35 | RestrictSUIDSGID=yes 36 | RemoveIPC=yes 37 | 38 | [Install] 39 | Alias=dbus-org.deepin.dde.Device1.service 40 | -------------------------------------------------------------------------------- /misc/systemd/system/deepin-locale-helper.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Deepin Locale Helper 3 | 4 | # Ask for the dbus socket. 5 | Wants=dbus.socket 6 | After=dbus.socket 7 | 8 | [Service] 9 | Type=dbus 10 | BusName=org.deepin.dde.LocaleHelper1 11 | ExecStart=/usr/lib/deepin-api/locale-helper 12 | 13 | ReadWritePaths=/etc/default/locale 14 | ReadWritePaths=/etc/locale.gen 15 | ReadWritePaths=/usr/lib/locale/ 16 | ExecPaths=/usr/sbin/locale-gen 17 | 18 | DevicePolicy=closed 19 | 20 | ProtectSystem=full 21 | ProtectHome=yes 22 | PrivateTmp=yes 23 | PrivateDevices=yes 24 | PrivateNetwork=yes 25 | ProtectHostname=yes 26 | ProtectClock=yes 27 | ProtectKernelTunables=yes 28 | ProtectKernelModules=yes 29 | ProtectKernelLogs=yes 30 | ProtectControlGroups=yes 31 | RestrictAddressFamilies=AF_UNIX 32 | RestrictNamespaces=yes 33 | LockPersonality=yes 34 | RestrictRealtime=yes 35 | RestrictSUIDSGID=yes 36 | RemoveIPC=yes 37 | 38 | [Install] 39 | Alias=dbus-org.deepin.dde.LocaleHelper1.service 40 | -------------------------------------------------------------------------------- /misc/systemd/system/deepin-login-sound.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Deepin login sound 3 | Requires=sound.target 4 | After=dbus.service lightdm.service 5 | 6 | [Service] 7 | Type=oneshot 8 | User=deepin-sound-player 9 | ExecStart=/usr/bin/dbus-send --system --print-reply --dest=org.deepin.dde.SoundThemePlayer1 /org/deepin/dde/SoundThemePlayer1 org.deepin.dde.SoundThemePlayer1.PlaySoundDesktopLogin 10 | RemainAfterExit=yes 11 | 12 | DevicePolicy=closed 13 | 14 | ProtectSystem=full 15 | ProtectHome=yes 16 | PrivateTmp=yes 17 | PrivateDevices=yes 18 | PrivateNetwork=yes 19 | ProtectHostname=yes 20 | ProtectClock=yes 21 | ProtectKernelTunables=yes 22 | ProtectKernelModules=yes 23 | ProtectKernelLogs=yes 24 | ProtectControlGroups=yes 25 | RestrictAddressFamilies=AF_UNIX 26 | RestrictNamespaces=yes 27 | LockPersonality=yes 28 | RestrictRealtime=yes 29 | RestrictSUIDSGID=yes 30 | RemoveIPC=yes 31 | 32 | [Install] 33 | WantedBy=multi-user.target 34 | -------------------------------------------------------------------------------- /misc/systemd/system/deepin-shutdown-sound.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Deepin shutdown sound 3 | Requisite=sound.target local-fs.target 4 | After=sound.target local-fs.target 5 | Conflicts=shutdown.target 6 | Before=shutdown.target 7 | 8 | [Service] 9 | Type=simple 10 | User=deepin-sound-player 11 | ExecStart=/usr/bin/true 12 | ExecStop=/usr/lib/deepin-api/deepin-shutdown-sound 13 | RemainAfterExit=yes 14 | TimeoutStopSec=7s 15 | 16 | ReadOnlyPaths=/var/lib/deepin-sound-player 17 | BindReadOnlyPaths=-/tmp/deepin-shutdown-sound.json 18 | 19 | DeviceAllow=char-alsa rw 20 | DevicePolicy=closed 21 | 22 | ProtectSystem=full 23 | ProtectHome=yes 24 | PrivateTmp=yes 25 | #PrivateDevices=yes 26 | PrivateNetwork=yes 27 | ProtectHostname=yes 28 | ProtectClock=yes 29 | ProtectKernelTunables=yes 30 | ProtectKernelModules=yes 31 | ProtectKernelLogs=yes 32 | ProtectControlGroups=yes 33 | RestrictAddressFamilies=AF_UNIX 34 | RestrictNamespaces=yes 35 | LockPersonality=yes 36 | RestrictRealtime=yes 37 | RestrictSUIDSGID=yes 38 | RemoveIPC=yes 39 | 40 | [Install] 41 | WantedBy=graphical.target 42 | -------------------------------------------------------------------------------- /misc/systemd/system/deepin-sound-theme-player.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Deepin Sound Theme Player 3 | 4 | Requisite=sound.target 5 | After=sound.target 6 | 7 | # Ask for the dbus socket. 8 | Wants=dbus.socket 9 | After=dbus.socket 10 | 11 | [Service] 12 | Type=dbus 13 | BusName=org.deepin.dde.SoundThemePlayer1 14 | User=deepin-sound-player 15 | ExecStart=/usr/lib/deepin-api/sound-theme-player 16 | 17 | StateDirectory=deepin-sound-player 18 | 19 | DeviceAllow=char-alsa rw 20 | DevicePolicy=closed 21 | 22 | ProtectSystem=full 23 | ProtectHome=yes 24 | #PrivateTmp=yes 25 | #PrivateDevices=yes 26 | PrivateNetwork=yes 27 | ProtectHostname=yes 28 | ProtectClock=yes 29 | ProtectKernelTunables=yes 30 | ProtectKernelModules=yes 31 | ProtectKernelLogs=yes 32 | ProtectControlGroups=yes 33 | RestrictAddressFamilies=AF_UNIX 34 | RestrictNamespaces=yes 35 | LockPersonality=yes 36 | RestrictRealtime=yes 37 | RestrictSUIDSGID=yes 38 | RemoveIPC=yes 39 | 40 | [Install] 41 | Alias=dbus-org.deepin.dde.SoundThemePlayer1.service 42 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.device.unblock-bluetooth-devices.policy/policy.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to unblock bluetooth devices 7 | Authentication is required to unblock bluetooth devices 8 | 9 | 10 | 11 | Unblock bluetooth devices 12 | Unblock bluetooth devices 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.device.unblock-bluetooth-devices.policy/policy_am_ET.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to unblock bluetooth devices 7 | ማረጋገጫ ያስፈልጋል የ ብሉቱዝ አካል ለ መክፈት 8 | 9 | 10 | 11 | Unblock bluetooth devices 12 | የ ብሉቱዝ አካል መክፈቻ 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.device.unblock-bluetooth-devices.policy/policy_ar.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to unblock bluetooth devices 7 | المصادقة مطلوبة لتفعيل أجهزة البلوتوث 8 | 9 | 10 | 11 | Unblock bluetooth devices 12 | تفعيل أجهزة البلوتوث 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.device.unblock-bluetooth-devices.policy/policy_ast.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to unblock bluetooth devices 7 | Ríquese l'autenticación pa desbloquiar preseos Bluetooth 8 | 9 | 10 | 11 | Unblock bluetooth devices 12 | Desbloquéu de preseos Bluetooth 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.device.unblock-bluetooth-devices.policy/policy_bg.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to unblock bluetooth devices 7 | Необходима е идентификация за разблокиране на bluetooth устройствата 8 | 9 | 10 | 11 | Unblock bluetooth devices 12 | Разблокиране на bluetooth устройства 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.device.unblock-bluetooth-devices.policy/policy_bn.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to unblock bluetooth devices 7 | ব্লুটুথ ডিভাইস সমূহ অবরোধ মুক্ত করতে প্রমাণীকরণের প্রয়োজন 8 | 9 | 10 | 11 | Unblock bluetooth devices 12 | ব্লুটুথ ডিভাইস সমূহ অবরোধ মুক্ত করুন 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.device.unblock-bluetooth-devices.policy/policy_ca.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to unblock bluetooth devices 7 | Cal autenticació per desbloquejar els dispositius bluetooth 8 | 9 | 10 | 11 | Unblock bluetooth devices 12 | Desbloqueja els dispositius bluetooth 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.device.unblock-bluetooth-devices.policy/policy_cs.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to unblock bluetooth devices 7 | Pro odblokování zařízení bluetooth je vyžadováno ověření 8 | 9 | 10 | 11 | Unblock bluetooth devices 12 | Odblokovat zařízení Bluetooth 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.device.unblock-bluetooth-devices.policy/policy_da.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to unblock bluetooth devices 7 | Der kræves autentifikation for at afblokere bluetooth-enheder 8 | 9 | 10 | 11 | Unblock bluetooth devices 12 | Afbloker bluetooth-enheder 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.device.unblock-bluetooth-devices.policy/policy_de.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to unblock bluetooth devices 7 | Zum Freigeben von Bluetooth-Geräten ist eine Authentifizierung erforderlich 8 | 9 | 10 | 11 | Unblock bluetooth devices 12 | Bluetooth-Geräte freigeben 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.device.unblock-bluetooth-devices.policy/policy_el.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to unblock bluetooth devices 7 | Απαιτείται πιστοποίηση για το ξεμπλοκάρισμα των συσκευών bluetooth 8 | 9 | 10 | 11 | Unblock bluetooth devices 12 | Ξεμπλοκάρισμα συσκευών bluetooth 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.device.unblock-bluetooth-devices.policy/policy_es.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to unblock bluetooth devices 7 | Autenticación es requerida para desbloquear dispositivos bluetooth 8 | 9 | 10 | 11 | Unblock bluetooth devices 12 | Desbloquear dispositivos bluetooth 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.device.unblock-bluetooth-devices.policy/policy_es_419.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to unblock bluetooth devices 7 | Autenticación es requerida para desbloquear dispositivos bluetooth 8 | 9 | 10 | 11 | Unblock bluetooth devices 12 | Desbloquear dispositivos bluetooth 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.device.unblock-bluetooth-devices.policy/policy_fa.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to unblock bluetooth devices 7 | احراز هویت برای فعال سازی بلوتوث لازم است 8 | 9 | 10 | 11 | Unblock bluetooth devices 12 | فعال سازی دستگاه های بلوتوث 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.device.unblock-bluetooth-devices.policy/policy_fi.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to unblock bluetooth devices 7 | Bluetooth-laitteiden lukituksen poistamiseen tarvitaan todennus 8 | 9 | 10 | 11 | Unblock bluetooth devices 12 | Käynnistä bluetooth laitteet 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.device.unblock-bluetooth-devices.policy/policy_fr.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to unblock bluetooth devices 7 | Authentification requise pour déverrouiller des périphériques bluetooth 8 | 9 | 10 | 11 | Unblock bluetooth devices 12 | Déverrouiller des périphériques bluetooth 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.device.unblock-bluetooth-devices.policy/policy_gl_ES.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to unblock bluetooth devices 7 | Requírese autenticación para desbloquear os dispositivos bluetooth 8 | 9 | 10 | 11 | Unblock bluetooth devices 12 | Desbloquear os dispositivos bluetooth 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.device.unblock-bluetooth-devices.policy/policy_hi_IN.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to unblock bluetooth devices 7 | ब्लूटूथ डिवाइस को अनवरोधित करने हेतु प्रमाणीकरण आवश्यक है 8 | 9 | 10 | 11 | Unblock bluetooth devices 12 | ब्लूटूथ डिवाइस अनवरोधित करें 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.device.unblock-bluetooth-devices.policy/policy_hr.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to unblock bluetooth devices 7 | Potrebna je autentifikacija za odblokiranje bluetooth uređaja 8 | 9 | 10 | 11 | Unblock bluetooth devices 12 | Odblokiraj bluetooth uređaje 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.device.unblock-bluetooth-devices.policy/policy_hu.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to unblock bluetooth devices 7 | Hitelesítés szükséges a Bluetooth eszközök feloldásához 8 | 9 | 10 | 11 | Unblock bluetooth devices 12 | Bluetooth eszközök feloldása 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.device.unblock-bluetooth-devices.policy/policy_id.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to unblock bluetooth devices 7 | Dibutuhkan otentikasi untuk buka blokir perangkat bluetooth 8 | 9 | 10 | 11 | Unblock bluetooth devices 12 | Buka blokir perangkat bluetooth 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.device.unblock-bluetooth-devices.policy/policy_it.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to unblock bluetooth devices 7 | Autenticazione richiesta per sbloccare i dispositivi bluetooth 8 | 9 | 10 | 11 | Unblock bluetooth devices 12 | Sblocca i dispositivi bluetooth 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.device.unblock-bluetooth-devices.policy/policy_ja.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to unblock bluetooth devices 7 | Bluetooth デバイスのブロックを解除するには認証が必要です 8 | 9 | 10 | 11 | Unblock bluetooth devices 12 | Bluetooth デバイスのブロックを解除 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.device.unblock-bluetooth-devices.policy/policy_ko.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to unblock bluetooth devices 7 | 블루투스 장치를 차단 해제하려면 인증을 해야 합니다 8 | 9 | 10 | 11 | Unblock bluetooth devices 12 | 블루투스 장치 차단 해제 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.device.unblock-bluetooth-devices.policy/policy_ku.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to unblock bluetooth devices 7 | Ji bo rakirina astengiyê ya amûrên bluetoothê rastandina nasnameyê pêwîst e 8 | 9 | 10 | 11 | Unblock bluetooth devices 12 | Astengiya amûrên bluetoothê rake 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.device.unblock-bluetooth-devices.policy/policy_ku_IQ.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to unblock bluetooth devices 7 | Ji bo rakirina astengiya navgînên bluetoothê divê pişrastkirina nasnameyê bê kirin 8 | 9 | 10 | 11 | Unblock bluetooth devices 12 | Astengiya navgînên bluetoothê rake 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.device.unblock-bluetooth-devices.policy/policy_lt.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to unblock bluetooth devices 7 | Norint atblokuoti bluetooth įrenginius, reikalingas tapatybės nustatymas 8 | 9 | 10 | 11 | Unblock bluetooth devices 12 | Atblokuoti bluetooth įrenginius 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.device.unblock-bluetooth-devices.policy/policy_lv.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to unblock bluetooth devices 7 | Nepieciešams autentificēties, lai atbloķētu bluetooth ierīces 8 | 9 | 10 | 11 | Unblock bluetooth devices 12 | Atbloķēt bluetooth ierīces 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.device.unblock-bluetooth-devices.policy/policy_mn.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to unblock bluetooth devices 7 | Блютүүт төхөөрөмжийн блокыг гаргахад зөвшөөрөл шаардлагатай 8 | 9 | 10 | 11 | Unblock bluetooth devices 12 | Блютүүт төхөөрөмжийн блокыг гаргах 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.device.unblock-bluetooth-devices.policy/policy_ms.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to unblock bluetooth devices 7 | Pengesahihan diperlukan untuk menyahsekat peranti bluetooth 8 | 9 | 10 | 11 | Unblock bluetooth devices 12 | Nyahsekat peranti bluetooth 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.device.unblock-bluetooth-devices.policy/policy_nb.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to unblock bluetooth devices 7 | Autentisering kreves for av avblokkere blåtanneneheter 8 | 9 | 10 | 11 | Unblock bluetooth devices 12 | Avblokker blåtannenheter 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.device.unblock-bluetooth-devices.policy/policy_ne.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to unblock bluetooth devices 7 | ब्लुटुथ उपकरणहरू अनब्लक गर्न प्रमाणीकरण आवश्यक छ 8 | 9 | 10 | 11 | Unblock bluetooth devices 12 | ब्लुटुथ उपकरणहरू अनब्लक गर्नुहोस् 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.device.unblock-bluetooth-devices.policy/policy_nl.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to unblock bluetooth devices 7 | Authenticatie is vereist om bluetooth toestellen te deblokkeren 8 | 9 | 10 | 11 | Unblock bluetooth devices 12 | Bluetooth toestellen deblokkeren 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.device.unblock-bluetooth-devices.policy/policy_pa.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to unblock bluetooth devices 7 | ਬਲੂਟੁੱਥ ਡਿਵਾਈਸ ਤੋਂ ਪਾਬੰਦੀ ਹਟਾਉਣ ਲਈ ਪਰਮਾਣਕਿਤਾ ਦੀ ਲੋੜ ਹੈ 8 | 9 | 10 | 11 | Unblock bluetooth devices 12 | ਬਲੂਟੁੱਥ ਡਿਵਾਈਸ ਉੱਤੇ ਪਾਬੰਦੀ ਹਟਾਓ 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.device.unblock-bluetooth-devices.policy/policy_pl.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to unblock bluetooth devices 7 | Wymagane jest uwierzytelnienie, aby odblokować urządzenia bluetooth 8 | 9 | 10 | 11 | Unblock bluetooth devices 12 | Odblokuj urządzenia bluetooth 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.device.unblock-bluetooth-devices.policy/policy_pt.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to unblock bluetooth devices 7 | A autenticação é necessária para desbloquear dispositivos bluetooth 8 | 9 | 10 | 11 | Unblock bluetooth devices 12 | Desbloquear dispositivos bluetooth 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.device.unblock-bluetooth-devices.policy/policy_pt_BR.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to unblock bluetooth devices 7 | A autenticação é necessária para desbloquear dispositivos bluetooth 8 | 9 | 10 | 11 | Unblock bluetooth devices 12 | Desbloquear dispositivos bluetooth 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.device.unblock-bluetooth-devices.policy/policy_ro.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to unblock bluetooth devices 7 | Autentificarea este necesară pentru a debloca dispozitivele bluetooth 8 | 9 | 10 | 11 | Unblock bluetooth devices 12 | Deblocați dispozitivele bluetooth 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.device.unblock-bluetooth-devices.policy/policy_ru.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to unblock bluetooth devices 7 | Для разблокировки устройств bluetooth требуется аутентификация 8 | 9 | 10 | 11 | Unblock bluetooth devices 12 | Разблокировать устройства bluetooth 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.device.unblock-bluetooth-devices.policy/policy_sk.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to unblock bluetooth devices 7 | Na odblokovanie zariadení Bluetooth je potrebné overenie totožnosti 8 | 9 | 10 | 11 | Unblock bluetooth devices 12 | Odblokovať zariadenia Bluetooth 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.device.unblock-bluetooth-devices.policy/policy_sr.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to unblock bluetooth devices 7 | Аутентификација је неопходна да се одблокирају Блутут уређаји 8 | 9 | 10 | 11 | Unblock bluetooth devices 12 | Одблокирај Блутут уређаје 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.device.unblock-bluetooth-devices.policy/policy_sv.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to unblock bluetooth devices 7 | Autentisering krävs för att avblockera bluetooth 8 | 9 | 10 | 11 | Unblock bluetooth devices 12 | Avblockera bluetooth enheter 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.device.unblock-bluetooth-devices.policy/policy_sw.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to unblock bluetooth devices 7 | Uhalisishaji inahitaji kufungua kifaa za bluetooth 8 | 9 | 10 | 11 | Unblock bluetooth devices 12 | Fungua kifaa za bluetooth 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.device.unblock-bluetooth-devices.policy/policy_tr.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to unblock bluetooth devices 7 | Bluetooth aygıtlarının engellemesinin kaldırılması için kimlik doğrulaması gereklidir 8 | 9 | 10 | 11 | Unblock bluetooth devices 12 | Bluetooth aygıtlarının engellemesini kaldır 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.device.unblock-bluetooth-devices.policy/policy_uk.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to unblock bluetooth devices 7 | Для розблоковування пристроїв Bluetooth слід пройти розпізнавання 8 | 9 | 10 | 11 | Unblock bluetooth devices 12 | Розблоковування пристроїв Bluetooth 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.device.unblock-bluetooth-devices.policy/policy_vi.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to unblock bluetooth devices 7 | Cần xác thực để mở khóa các thiết bị bluetooth 8 | 9 | 10 | 11 | Unblock bluetooth devices 12 | Mở khóa các thiết bị bluetooth 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.device.unblock-bluetooth-devices.policy/policy_zh_CN.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to unblock bluetooth devices 7 | 解锁蓝牙设备需要认证 8 | 9 | 10 | 11 | Unblock bluetooth devices 12 | 解锁蓝牙设备 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.device.unblock-bluetooth-devices.policy/policy_zh_TW.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to unblock bluetooth devices 7 | 解鎖藍牙裝置需要授權 8 | 9 | 10 | 11 | Unblock bluetooth devices 12 | 解鎖藍牙裝置 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.locale-helper.policy/policy.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to switch language 7 | Authentication is required to switch language 8 | 9 | 10 | 11 | Manage your system locale 12 | Manage your system locale 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.locale-helper.policy/policy_am_ET.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to switch language 7 | ቋንቋ ለ መቀየር ማረጋገጫ ያስፈልጋል 8 | 9 | 10 | 11 | Manage your system locale 12 | የ እርስዎን ስርአት ቋንቋ ያስተዳድሩ 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.locale-helper.policy/policy_ar.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to switch language 7 | المصادقة مطلوبة لتبديل اللغة 8 | 9 | 10 | 11 | Manage your system locale 12 | إدارة لغة النظام الخاص بك 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.locale-helper.policy/policy_ast.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to switch language 7 | Ríquese l'autenticación pa cambiar de llingua 8 | 9 | 10 | 11 | Manage your system locale 12 | Xestión de la locale del sistema 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.locale-helper.policy/policy_az.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to switch language 7 | Dil dəyişmək üçün autentifikasiya tələb olunur 8 | 9 | 10 | 11 | Manage your system locale 12 | Sistem yerini idarə edin 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.locale-helper.policy/policy_bg.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to switch language 7 | Необходима е идентификация за промяна на езика 8 | 9 | 10 | 11 | Manage your system locale 12 | Управлявайте локализацията на вашата система 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.locale-helper.policy/policy_bn.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to switch language 7 | ভাষা পরিবর্তন করতে প্রমাণীকরণের প্রয়োজন 8 | 9 | 10 | 11 | Manage your system locale 12 | আপনার সিস্টেম লোকেল পরিচালনা করুন 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.locale-helper.policy/policy_ca.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to switch language 7 | Cal autenticació per canviar la llengua. 8 | 9 | 10 | 11 | Manage your system locale 12 | Gestioneu la llengua del sistema. 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.locale-helper.policy/policy_cs.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to switch language 7 | Pro přepnutí jazyka je požadováno ověření pravosti 8 | 9 | 10 | 11 | Manage your system locale 12 | Spravovat jazyk systému 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.locale-helper.policy/policy_da.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to switch language 7 | Der kræves autentifikation for at skifte sprog 8 | 9 | 10 | 11 | Manage your system locale 12 | Håndter dit systems lokalitet 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.locale-helper.policy/policy_de.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to switch language 7 | Authentifizierung ist erforderlich, um die Sprache zu wechseln 8 | 9 | 10 | 11 | Manage your system locale 12 | Verwalten Sie Ihr Gebietsschema 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.locale-helper.policy/policy_el.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to switch language 7 | Απαιτείται πιστοποίηση για εναλλαγή γλώσσας 8 | 9 | 10 | 11 | Manage your system locale 12 | Διαχειριστείτε το τοπικό σύστημα 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.locale-helper.policy/policy_en_GB.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to switch language 7 | Authentication is required to switch languages! 8 | 9 | 10 | 11 | Manage your system locale 12 | Manage your system locale 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.locale-helper.policy/policy_eo.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to switch language 7 | Aŭtentigo estas nepra por ŝanĝi lingvon 8 | 9 | 10 | 11 | Manage your system locale 12 | Mastrumu vian sisteman lingvon 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.locale-helper.policy/policy_es.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to switch language 7 | Se requiere autenticación para cambiar el idioma 8 | 9 | 10 | 11 | Manage your system locale 12 | Administre la configuración regional de su sistema 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.locale-helper.policy/policy_es_419.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to switch language 7 | Se requiere autenticación para cambiar el idioma 8 | 9 | 10 | 11 | Manage your system locale 12 | Administra el idioma del sistema 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.locale-helper.policy/policy_fa.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to switch language 7 | احراز هویت برای تغییر زبان لازم است 8 | 9 | 10 | 11 | Manage your system locale 12 | سیستم محلی خود را مدیریت کنید 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.locale-helper.policy/policy_fi.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to switch language 7 | Kielen vaihtaminen vaatii tunnistautumisen 8 | 9 | 10 | 11 | Manage your system locale 12 | Hallitse järjestelmän kieliasetuksia 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.locale-helper.policy/policy_fr.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to switch language 7 | L'authentification est requise pour changer la langue 8 | 9 | 10 | 11 | Manage your system locale 12 | Gérez les paramètres régionaux 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.locale-helper.policy/policy_gl_ES.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to switch language 7 | Requírese autenticación para cambiar a linguaxe 8 | 9 | 10 | 11 | Manage your system locale 12 | Xestionar o seu sistema local 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.locale-helper.policy/policy_hi_IN.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to switch language 7 | भाषा बदलने हेतु प्रमाणीकरण आवश्यक है 8 | 9 | 10 | 11 | Manage your system locale 12 | सिस्टम स्थानिकी का प्रबंधन करें 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.locale-helper.policy/policy_hr.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to switch language 7 | Potrebna je ovjera za promjenu jezika 8 | 9 | 10 | 11 | Manage your system locale 12 | Upravljajte vašim jezikom sustava 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.locale-helper.policy/policy_hu.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to switch language 7 | Hitelesítés szükség a nyelvi beállítások módosításához 8 | 9 | 10 | 11 | Manage your system locale 12 | A rendszer területi beállításainak kezelése 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.locale-helper.policy/policy_id.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to switch language 7 | Autentikasi dibutuhkan untuk ganti bahasa 8 | 9 | 10 | 11 | Manage your system locale 12 | Kelola lokasi sistem anda 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.locale-helper.policy/policy_it.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to switch language 7 | Il cambio lingua richiede l'autenticazione 8 | 9 | 10 | 11 | Manage your system locale 12 | Gestisci il tuo Sistema Locale 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.locale-helper.policy/policy_ja.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to switch language 7 | 言語を変更するには認証が必要です 8 | 9 | 10 | 11 | Manage your system locale 12 | システム地域を管理 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.locale-helper.policy/policy_kn_IN.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to switch language 7 | ಭಾಷೆ ಬದಲಾಯಿಸಲು ದೃಢೀಕರಣದ ಅವಶ್ಯಕತೆಯಿದೆ 8 | 9 | 10 | 11 | Manage your system locale 12 | ನಿಮ್ಮ ಗಣಕದ ಲೊಕೇಲ್ ನಿರ್ವಹಿಸಿ 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.locale-helper.policy/policy_ko.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to switch language 7 | 언어를 전환하려면 인증이 필요합니다. 8 | 9 | 10 | 11 | Manage your system locale 12 | 시스템 로케일 관리 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.locale-helper.policy/policy_ku.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to switch language 7 | Ji bo guherandina zimanê rastandina nasnameyê pêwîst e 8 | 9 | 10 | 11 | Manage your system locale 12 | Pergala xwe ya cîgehî bi rê ve bibin 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.locale-helper.policy/policy_ku_IQ.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to switch language 7 | Ji bo guherandina zimanê divê piştrastkirina nasnameyê bê kirin. 8 | 9 | 10 | 11 | Manage your system locale 12 | Mîhenga xwecihî ya pergalê bi rê ve bibin 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.locale-helper.policy/policy_lt.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to switch language 7 | Norint perjungti kalbą, reikalingas tapatybės nustatymas 8 | 9 | 10 | 11 | Manage your system locale 12 | Tvarkyti savo sistemos lokales 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.locale-helper.policy/policy_lv.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to switch language 7 | Nepieciešams autentificēties, lai pārslēgtu valodu 8 | 9 | 10 | 11 | Manage your system locale 12 | Pārvaldīt sistēmas tulkojumu 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.locale-helper.policy/policy_mn.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to switch language 7 | Хэл солиход зөвшөөрөл шаардлагатай. 8 | 9 | 10 | 11 | Manage your system locale 12 | Системийн нутагшуулалтыг зохицуулах 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.locale-helper.policy/policy_ms.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to switch language 7 | Pengesahihan diperlukan untuk mengubah bahasa 8 | 9 | 10 | 11 | Manage your system locale 12 | Urus lokal sistem anda 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.locale-helper.policy/policy_nb.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to switch language 7 | Autentisering er påkrevd for å bytte språk 8 | 9 | 10 | 11 | Manage your system locale 12 | Behandle systemets språkinnstilling 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.locale-helper.policy/policy_ne.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to switch language 7 | भाषा स्विच गर्न आवश्यक प्रमाणीकरण 8 | 9 | 10 | 11 | Manage your system locale 12 | तपाईंको प्रणाली स्थानीय व्यवस्थापन गर्नुहोस् 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.locale-helper.policy/policy_nl.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to switch language 7 | Authenticatie is vereist om taal te wijzigen 8 | 9 | 10 | 11 | Manage your system locale 12 | Beheer uw systeem locale 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.locale-helper.policy/policy_pl.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to switch language 7 | Wymagane jest uwierzytelnienie, aby móc przełączyć język 8 | 9 | 10 | 11 | Manage your system locale 12 | Zarządzaj ustawieniami lokalizacji swojego systemu 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.locale-helper.policy/policy_pt.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to switch language 7 | A autenticação é necessária para alterar o idioma 8 | 9 | 10 | 11 | Manage your system locale 12 | Gerir a localização do seu sistema 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.locale-helper.policy/policy_pt_BR.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to switch language 7 | A autenticação é necessária para mudar o idioma 8 | 9 | 10 | 11 | Manage your system locale 12 | Gerencie o local do sistema 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.locale-helper.policy/policy_ro.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to switch language 7 | Autentificarea este necesară pentru a schimba limba 8 | 9 | 10 | 11 | Manage your system locale 12 | Administrați limba și setările regionale ale sistemului 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.locale-helper.policy/policy_ru.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to switch language 7 | Для изменения языка системы требуется аутентификация 8 | 9 | 10 | 11 | Manage your system locale 12 | Управление системной локалью 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.locale-helper.policy/policy_sk.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to switch language 7 | Na prepínanie jazyka je potrebné overenie 8 | 9 | 10 | 11 | Manage your system locale 12 | Správa lokalizácie systému 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.locale-helper.policy/policy_sl.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to switch language 7 | Za zamenjavo jezika je potrebna avtentikacija 8 | 9 | 10 | 11 | Manage your system locale 12 | Upravljajte svoje območne nastavitve sistema 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.locale-helper.policy/policy_sr.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to switch language 7 | Аутентификација је неопходна за промену језика 8 | 9 | 10 | 11 | Manage your system locale 12 | Управљајте системским језицима 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.locale-helper.policy/policy_sv.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to switch language 7 | Autentisering krävs för att byta språk 8 | 9 | 10 | 11 | Manage your system locale 12 | Hantera systemets språk 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.locale-helper.policy/policy_sw.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to switch language 7 | Uhalalishaji inahitaji kubadili lugha 8 | 9 | 10 | 11 | Manage your system locale 12 | Twala mandhari ya mfumo yako 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.locale-helper.policy/policy_tr.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to switch language 7 | Dili değiştirmek için kimlik doğrulaması gereklidir 8 | 9 | 10 | 11 | Manage your system locale 12 | Sistem yerel ayarınızı yönetin 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.locale-helper.policy/policy_ug.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to switch language 7 | سىستېما تىلىنى ئۆزگەرتىش ئاۋۋال سالاھىيەت دەلىللەشنى تەلەپ قىلىدۇ 8 | 9 | 10 | 11 | Manage your system locale 12 | سىستېما ئورۇن باشقۇرۇش 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.locale-helper.policy/policy_uk.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to switch language 7 | Аутентифікація потрібна для перемикання мови 8 | 9 | 10 | 11 | Manage your system locale 12 | Керування мовою вашої системи 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.locale-helper.policy/policy_vi.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to switch language 7 | Chứng thực được đòi hỏi để đổi ngôn ngữ 8 | 9 | 10 | 11 | Manage your system locale 12 | Quản lý địa phương hệ thống của bạn 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.locale-helper.policy/policy_zh_CN.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to switch language 7 | 切换语言需要认证 8 | 9 | 10 | 11 | Manage your system locale 12 | 设置您的系统语言 13 | 14 | 15 | -------------------------------------------------------------------------------- /misc/ts/org.deepin.dde.locale-helper.policy/policy_zh_TW.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | policy 4 | 5 | 6 | Authentication is required to switch language 7 | 切換語言需要授權 8 | 9 | 10 | 11 | Manage your system locale 12 | 管理系統語言設定 13 | 14 | 15 | -------------------------------------------------------------------------------- /polkit/polkit.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | package polkit 6 | 7 | import ( 8 | "errors" 9 | "strconv" 10 | 11 | "github.com/godbus/dbus/v5" 12 | polkit "github.com/linuxdeepin/go-dbus-factory/system/org.freedesktop.policykit1" 13 | ) 14 | 15 | var errAuthFailed = errors.New("authentication failed") 16 | 17 | func NewPolKitAuthDetails(authFlags int) map[string]string { 18 | var details = make(map[string]string) 19 | details["exAuth"] = "true" 20 | details["exAuthFlags"] = strconv.Itoa(authFlags) 21 | return details 22 | } 23 | 24 | func CheckAuth(actionId string, busName string, details map[string]string) error { 25 | systemBus, err := dbus.SystemBus() 26 | if err != nil { 27 | return err 28 | } 29 | authority := polkit.NewAuthority(systemBus) 30 | subject := polkit.MakeSubject(polkit.SubjectKindSystemBusName) 31 | subject.SetDetail("name", busName) 32 | 33 | ret, err := authority.CheckAuthorization(0, subject, 34 | actionId, details, 35 | polkit.CheckAuthorizationFlagsAllowUserInteraction, "") 36 | if err != nil { 37 | return err 38 | } 39 | 40 | if ret.IsAuthorized { 41 | return nil 42 | } 43 | return errAuthFailed 44 | } 45 | -------------------------------------------------------------------------------- /powersupply/battery/battery_test.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | package battery 6 | 7 | import ( 8 | "testing" 9 | 10 | "github.com/stretchr/testify/assert" 11 | ) 12 | 13 | func Test_parseStatus(t *testing.T) { 14 | assert.Equal(t, parseStatus("Unknown"), StatusUnknown) 15 | assert.Equal(t, parseStatus("Charging"), StatusCharging) 16 | assert.Equal(t, parseStatus("Discharging"), StatusDischarging) 17 | assert.Equal(t, parseStatus("Not charging"), StatusNotCharging) 18 | assert.Equal(t, parseStatus("Full"), StatusFull) 19 | assert.Equal(t, parseStatus("Other"), StatusUnknown) 20 | } 21 | 22 | func Test_GetDisplayStatus(t *testing.T) { 23 | // one 24 | one := []Status{StatusDischarging} 25 | assert.Equal(t, GetDisplayStatus(one), StatusDischarging) 26 | one[0] = StatusNotCharging 27 | assert.Equal(t, GetDisplayStatus(one), StatusNotCharging) 28 | 29 | // two 30 | two := []Status{StatusFull, StatusFull} 31 | assert.Equal(t, GetDisplayStatus(two), StatusFull) 32 | two[0] = StatusDischarging 33 | two[1] = StatusFull 34 | assert.Equal(t, GetDisplayStatus(two), StatusDischarging) 35 | 36 | two[0] = StatusCharging 37 | two[1] = StatusFull 38 | assert.Equal(t, GetDisplayStatus(two), StatusCharging) 39 | 40 | two[0] = StatusCharging 41 | two[1] = StatusDischarging 42 | assert.Equal(t, GetDisplayStatus(two), StatusDischarging) 43 | } 44 | -------------------------------------------------------------------------------- /powersupply/powersupply_test.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | package powersupply 6 | 7 | import ( 8 | "testing" 9 | ) 10 | 11 | func TestACOnline(t *testing.T) { 12 | acExist, acOnline, err := ACOnline() 13 | t.Logf("acExist %v, acOnline %v, err %v", acExist, acOnline, err) 14 | } 15 | 16 | func TestGetSystemBatteryInfos(t *testing.T) { 17 | batInfos, err := GetSystemBatteryInfos() 18 | if err != nil { 19 | t.Log("err", err) 20 | return 21 | } 22 | for _, batInfo := range batInfos { 23 | t.Logf("%+v", batInfo) 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /session/session_register.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | package session 6 | 7 | import ( 8 | "fmt" 9 | "os" 10 | 11 | "github.com/godbus/dbus/v5" 12 | sessionmanager "github.com/linuxdeepin/go-dbus-factory/session/org.deepin.dde.sessionmanager1" 13 | "github.com/linuxdeepin/go-lib/utils" 14 | ) 15 | 16 | // Register will register to session manager if program is started from startdde. 17 | func Register() { 18 | cookie := os.ExpandEnv("$DDE_SESSION_PROCESS_COOKIE_ID") 19 | err := utils.UnsetEnv("DDE_SESSION_PROCESS_COOKIE_ID") 20 | 21 | if cookie == "" { 22 | fmt.Println("get DDE_SESSION_PROCESS_COOKIE_ID failed") 23 | return 24 | } 25 | 26 | if err != nil { 27 | fmt.Println("unsetenv DDE_SESSION_PROCESS_COOKIE_ID failed") 28 | } 29 | 30 | go func() { 31 | sessionBus, err := dbus.SessionBus() 32 | if err != nil { 33 | fmt.Println("failed to get session bus:", err) 34 | return 35 | } 36 | manager := sessionmanager.NewSessionManager(sessionBus) 37 | _, err = manager.Register(dbus.FlagNoAutoStart, cookie) 38 | if err != nil { 39 | fmt.Println("failed to register:", err) 40 | } 41 | }() 42 | } 43 | -------------------------------------------------------------------------------- /sound-theme-player/exported_methods_auto.go: -------------------------------------------------------------------------------- 1 | // Code generated by "dbusutil-gen em -type Manager"; DO NOT EDIT. 2 | 3 | package main 4 | 5 | import ( 6 | "github.com/linuxdeepin/go-lib/dbusutil" 7 | ) 8 | 9 | func (v *Manager) GetExportedMethods() dbusutil.ExportedMethods { 10 | return dbusutil.ExportedMethods{ 11 | { 12 | Name: "EnableSound", 13 | Fn: v.EnableSound, 14 | InArgs: []string{"name", "enabled"}, 15 | }, 16 | { 17 | Name: "EnableSoundDesktopLogin", 18 | Fn: v.EnableSoundDesktopLogin, 19 | InArgs: []string{"enabled"}, 20 | }, 21 | { 22 | Name: "Play", 23 | Fn: v.Play, 24 | InArgs: []string{"theme", "event", "device"}, 25 | }, 26 | { 27 | Name: "PlaySoundDesktopLogin", 28 | Fn: v.PlaySoundDesktopLogin, 29 | }, 30 | { 31 | Name: "PrepareShutdownSound", 32 | Fn: v.PrepareShutdownSound, 33 | InArgs: []string{"uid"}, 34 | }, 35 | { 36 | Name: "SaveAudioState", 37 | Fn: v.SaveAudioState, 38 | InArgs: []string{"activePlayback"}, 39 | }, 40 | { 41 | Name: "SetSoundTheme", 42 | Fn: v.SetSoundTheme, 43 | InArgs: []string{"theme"}, 44 | }, 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /soundutils/shutdown.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | package soundutils 6 | 7 | import ( 8 | "encoding/json" 9 | "io/ioutil" 10 | "os" 11 | ) 12 | 13 | const ( 14 | shutdownSoundFile = "/tmp/deepin-shutdown-sound.json" 15 | ) 16 | 17 | type ShutdownSoundConfig struct { 18 | CanPlay bool 19 | Theme string 20 | Event string 21 | Device string 22 | Volume float32 23 | } 24 | 25 | func GetShutdownSoundConfig() (*ShutdownSoundConfig, error) { 26 | data, err := ioutil.ReadFile(shutdownSoundFile) 27 | if err != nil { 28 | return nil, err 29 | } 30 | var v ShutdownSoundConfig 31 | err = json.Unmarshal(data, &v) 32 | if err != nil { 33 | return nil, err 34 | } 35 | return &v, nil 36 | } 37 | 38 | func SetShutdownSoundConfig(v *ShutdownSoundConfig) (err error) { 39 | if !v.CanPlay { 40 | // 当不需要播放关机音效时,删除配置文件。 41 | err = os.Remove(shutdownSoundFile) 42 | if err != nil && os.IsNotExist(err) { 43 | err = nil 44 | } 45 | return 46 | } 47 | data, err := json.Marshal(v) 48 | if err != nil { 49 | return 50 | } 51 | 52 | err = ioutil.WriteFile(shutdownSoundFile, data, 0644) 53 | return 54 | } 55 | -------------------------------------------------------------------------------- /theme_thumb/common/common.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | package common 6 | 7 | import ( 8 | "image" 9 | "image/draw" 10 | "image/png" 11 | "os" 12 | ) 13 | 14 | func CompositeIcons(images []image.Image, width, height, iconSize, padding int) image.Image { 15 | iconNum := len(images) 16 | destImg := image.NewRGBA(image.Rect(0, 0, width, height)) 17 | if iconNum == 0 { 18 | return destImg 19 | } 20 | 21 | y := (height - iconSize) / 2 22 | spaceW := width - iconSize*iconNum 23 | x := (spaceW - (iconNum-1)*padding) / 2 24 | 25 | for _, srcImg := range images { 26 | draw.Draw(destImg, image.Rect(x, y, x+iconSize, y+iconSize), srcImg, image.Pt(0, 0), draw.Src) 27 | x += iconSize + padding 28 | } 29 | 30 | return destImg 31 | } 32 | 33 | func SavePngFile(m image.Image, filename string) error { 34 | f, err := os.Create(filename) 35 | if err != nil { 36 | return err 37 | } 38 | defer func() { 39 | _ = f.Close() 40 | }() 41 | return png.Encode(f, m) 42 | } 43 | -------------------------------------------------------------------------------- /theme_thumb/cursor/cursor.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | package cursor 6 | 7 | import ( 8 | "image" 9 | "path/filepath" 10 | 11 | "github.com/linuxdeepin/dde-api/theme_thumb/common" 12 | ) 13 | 14 | const ( 15 | Version = 1 16 | basePadding = 12 17 | baseIconSize = 24 18 | ) 19 | 20 | func Gen(descFile string, width, height int, scaleFactor float64, out string) error { 21 | dir := filepath.Join(filepath.Dir(descFile), "cursors") 22 | 23 | iconSize := int(baseIconSize * scaleFactor) 24 | padding := int(basePadding * scaleFactor) 25 | width = int(float64(width) * scaleFactor) 26 | height = int(float64(height) * scaleFactor) 27 | 28 | images := getCursorIcons(dir, iconSize) 29 | ret := common.CompositeIcons(images, width, height, iconSize, padding) 30 | return common.SavePngFile(ret, out) 31 | } 32 | 33 | var presentCursors = [][]string{ 34 | {"left_ptr"}, 35 | {"left_ptr_watch"}, 36 | {"x-cursor", "X_cursor"}, 37 | {"hand2", "hand1"}, 38 | {"grab", "grabbing", "closedhand"}, 39 | {"fleur", "move"}, 40 | {"sb_v_double_arrow"}, 41 | {"sb_h_double_arrow"}, 42 | {"watch", "wait"}, 43 | } 44 | 45 | func getCursorIcons(dir string, size int) (images []image.Image) { 46 | for _, cursors := range presentCursors { 47 | for _, cursor := range cursors { 48 | img, err := loadXCursor(filepath.Join(dir, cursor), size) 49 | if err == nil { 50 | images = append(images, img) 51 | break 52 | } 53 | } 54 | } 55 | return 56 | } 57 | -------------------------------------------------------------------------------- /theme_thumb/gtk/gtk.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | package gtk 6 | 7 | import ( 8 | "os/exec" 9 | "strconv" 10 | ) 11 | 12 | const Version = 0 13 | const cmd = "/usr/lib/deepin-api/gtk-thumbnailer" 14 | 15 | func Gen(name string, width, height int, scaleFactor float64, dest string) error { 16 | var gdkWinScalingFactor float64 = 1.0 17 | if scaleFactor > 1.7 { 18 | // 根据 startdde 的逻辑,此种条件下 gtk 窗口放大为 2 倍 19 | gdkWinScalingFactor = 2.0 20 | } 21 | 22 | width = int(float64(width) * scaleFactor / gdkWinScalingFactor) 23 | height = int(float64(height) * scaleFactor / gdkWinScalingFactor) 24 | 25 | var args = []string{ 26 | "-theme", name, 27 | "-dest", dest, 28 | "-width", strconv.Itoa(width), 29 | "-height", strconv.Itoa(height), 30 | "-force", 31 | } 32 | _, err := exec.Command(cmd, args...).CombinedOutput() 33 | return err 34 | } 35 | -------------------------------------------------------------------------------- /themes/cursor.c: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | #include 6 | #include 7 | 8 | #include "cursor.h" 9 | 10 | int 11 | init_gtk() 12 | { 13 | static gboolean xcb_init = FALSE; 14 | 15 | if (!xcb_init) { 16 | XInitThreads(); 17 | 18 | if (!gtk_init_check(NULL, NULL)) { 19 | return -1; 20 | } 21 | } 22 | xcb_init = TRUE; 23 | return 0; 24 | } 25 | 26 | void 27 | set_gtk_cursor(char* name) 28 | { 29 | GtkSettings* s = gtk_settings_get_default(); 30 | g_object_set(G_OBJECT(s), "gtk-cursor-theme-name", name, NULL); 31 | } 32 | -------------------------------------------------------------------------------- /themes/cursor.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | package themes 6 | 7 | // #cgo pkg-config: x11 xcursor xfixes gtk+-3.0 8 | // #cgo CFLAGS: -W -Wall -fPIC -fstack-protector-all 9 | // #include 10 | // #include "cursor.h" 11 | import "C" 12 | import ( 13 | "unsafe" 14 | ) 15 | 16 | func setGtkCursor(name string) { 17 | C.init_gtk() 18 | cName := C.CString(name) 19 | defer C.free(unsafe.Pointer(cName)) 20 | C.set_gtk_cursor(cName) 21 | } 22 | 23 | func setQtCursor(name string) { 24 | cName := C.CString(name) 25 | defer C.free(unsafe.Pointer(cName)) 26 | C.set_qt_cursor(cName) 27 | } 28 | -------------------------------------------------------------------------------- /themes/cursor.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | #ifndef __CURSOR_H__ 6 | #define __CURSOR_H__ 7 | 8 | int init_gtk(); 9 | void set_gtk_cursor(char* name); 10 | int set_qt_cursor(const char* name); 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /themes/gtk2_test.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | package themes 6 | 7 | import ( 8 | "os" 9 | "testing" 10 | 11 | "github.com/stretchr/testify/assert" 12 | ) 13 | 14 | func TestGtk2Infos(t *testing.T) { 15 | infos := gtk2FileReader("testdata/gtkrc-2.0") 16 | assert.Equal(t, len(infos), 16) 17 | 18 | info := infos.Get("gtk-theme-name") 19 | assert.Equal(t, info.value, "\"Paper\"") 20 | 21 | info.value = "\"Deepin\"" 22 | assert.Equal(t, info.value, "\"Deepin\"") 23 | 24 | infos = infos.Add("gtk2-test", "test") 25 | assert.Equal(t, len(infos), 17) 26 | 27 | infos = gtk2FileReader("testdata/xxx") 28 | infos = infos.Add("gtk2-test", "test") 29 | assert.Equal(t, len(infos), 1) 30 | info = infos.Get("gtk2-test") 31 | assert.Equal(t, info.value, "test") 32 | 33 | err := gtk2FileWriter(infos, "testdata/tmp-gtk2rc") 34 | defer os.Remove("testdata/tmp-gtk2rc") 35 | assert.Nil(t, err) 36 | } 37 | -------------------------------------------------------------------------------- /themes/gtk3_test.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | package themes 6 | 7 | import ( 8 | "os" 9 | "testing" 10 | 11 | "github.com/stretchr/testify/assert" 12 | dutils "github.com/linuxdeepin/go-lib/utils" 13 | ) 14 | 15 | func TestGtk3Prop(t *testing.T) { 16 | kfile, err := dutils.NewKeyFileFromFile("testdata/settings.ini") 17 | assert.Nil(t, err) 18 | defer kfile.Free() 19 | 20 | assert.Equal(t, isGtk3PropEqual(gtk3KeyTheme, "Paper", 21 | kfile), true) 22 | assert.Equal(t, isGtk3PropEqual("gtk-menu-images", "1", 23 | kfile), true) 24 | assert.Equal(t, isGtk3PropEqual("gtk-modules", "gail:atk-bridge", 25 | kfile), true) 26 | assert.Equal(t, isGtk3PropEqual("test-list", "1;2;3;", 27 | kfile), true) 28 | 29 | err = setGtk3Prop("test-gtk3", "test", "testdata/tmp-gtk3") 30 | defer os.Remove("testdata/tmp-gtk3") 31 | assert.Nil(t, err) 32 | } 33 | -------------------------------------------------------------------------------- /themes/scanner/scanner_test.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | package scanner 6 | 7 | import ( 8 | "sort" 9 | "testing" 10 | 11 | "github.com/stretchr/testify/assert" 12 | ) 13 | 14 | func TestListGtkTheme(t *testing.T) { 15 | list, err := ListGtkTheme("testdata/Themes") 16 | sort.Strings(list) 17 | assert.ElementsMatch(t, list, []string{ 18 | "testdata/Themes/Gtk1", 19 | "testdata/Themes/Gtk2"}) 20 | assert.Nil(t, err) 21 | } 22 | 23 | func TestListIconTheme(t *testing.T) { 24 | list, err := ListIconTheme("testdata/Icons") 25 | sort.Strings(list) 26 | assert.ElementsMatch(t, list, []string{ 27 | "testdata/Icons/Icon1", 28 | "testdata/Icons/Icon2"}) 29 | assert.Nil(t, err) 30 | } 31 | 32 | func TestListCursorTheme(t *testing.T) { 33 | list, err := ListCursorTheme("testdata/Icons") 34 | sort.Strings(list) 35 | assert.ElementsMatch(t, list, []string{ 36 | "testdata/Icons/Icon1", 37 | "testdata/Icons/Icon2"}) 38 | assert.Nil(t, err) 39 | } 40 | 41 | func TestThemeHidden(t *testing.T) { 42 | assert.Equal(t, isHidden("testdata/gtk_paper.theme", ThemeTypeGtk), false) 43 | assert.Equal(t, isHidden("testdata/gtk_paper_hidden.theme", ThemeTypeGtk), true) 44 | 45 | assert.Equal(t, isHidden("testdata/icon_deepin.theme", ThemeTypeIcon), false) 46 | assert.Equal(t, isHidden("testdata/icon_deepin_hidden.theme", ThemeTypeIcon), true) 47 | } 48 | -------------------------------------------------------------------------------- /themes/scanner/testdata/Icons/Icon1/cursors/left_ptr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/dde-api/9cffdd813b2ae3810f841ae3fdecc5920462c7a7/themes/scanner/testdata/Icons/Icon1/cursors/left_ptr -------------------------------------------------------------------------------- /themes/scanner/testdata/Icons/Icon1/index.theme: -------------------------------------------------------------------------------- 1 | [Icon Theme] 2 | Name=Deepin 3 | Directories=apps/24,apps/32,apps/48 4 | -------------------------------------------------------------------------------- /themes/scanner/testdata/Icons/Icon2/cursors/left_ptr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/dde-api/9cffdd813b2ae3810f841ae3fdecc5920462c7a7/themes/scanner/testdata/Icons/Icon2/cursors/left_ptr -------------------------------------------------------------------------------- /themes/scanner/testdata/Icons/Icon2/index.theme: -------------------------------------------------------------------------------- 1 | [Icon Theme] 2 | Name=Deepin 3 | Directories=apps/24,apps/32,apps/48 4 | -------------------------------------------------------------------------------- /themes/scanner/testdata/Themes/Gtk1/cursors/left_ptr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/dde-api/9cffdd813b2ae3810f841ae3fdecc5920462c7a7/themes/scanner/testdata/Themes/Gtk1/cursors/left_ptr -------------------------------------------------------------------------------- /themes/scanner/testdata/Themes/Gtk1/gtk-3.0/settings.ini: -------------------------------------------------------------------------------- 1 | [Settings] 2 | gtk-auto-mnemonics = 1 3 | gtk-visible-focus = automatic 4 | -------------------------------------------------------------------------------- /themes/scanner/testdata/Themes/Gtk1/index.theme: -------------------------------------------------------------------------------- 1 | [Icon Theme] 2 | Name=Deepin 3 | Directories=apps/24,apps/32,apps/48 4 | -------------------------------------------------------------------------------- /themes/scanner/testdata/Themes/Gtk2/cursors/left_ptr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxdeepin/dde-api/9cffdd813b2ae3810f841ae3fdecc5920462c7a7/themes/scanner/testdata/Themes/Gtk2/cursors/left_ptr -------------------------------------------------------------------------------- /themes/scanner/testdata/Themes/Gtk2/gtk-3.0/settings.ini: -------------------------------------------------------------------------------- 1 | [Settings] 2 | gtk-auto-mnemonics = 1 3 | gtk-visible-focus = automatic 4 | -------------------------------------------------------------------------------- /themes/scanner/testdata/Themes/Gtk2/index.theme: -------------------------------------------------------------------------------- 1 | [Icon Theme] 2 | Name=Deepin 3 | Directories=apps/24,apps/32,apps/48 4 | -------------------------------------------------------------------------------- /themes/scanner/testdata/gtk_paper.theme: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Type=X-GNOME-Metatheme 3 | Name=Paper 4 | Comment=The one and only. 5 | Encoding=UTF-8 6 | 7 | [X-GNOME-Metatheme] 8 | GtkTheme=Paper 9 | MetacityTheme=Paper 10 | IconTheme=Paper 11 | -------------------------------------------------------------------------------- /themes/scanner/testdata/gtk_paper_hidden.theme: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Type=X-GNOME-Metatheme 3 | Name=Paper 4 | Comment=The one and only. 5 | Encoding=UTF-8 6 | Hidden=true 7 | 8 | [X-GNOME-Metatheme] 9 | GtkTheme=Paper 10 | MetacityTheme=Paper 11 | IconTheme=Paper 12 | -------------------------------------------------------------------------------- /themes/scanner/testdata/icon_deepin.theme: -------------------------------------------------------------------------------- 1 | [Icon Theme] 2 | Name=Deepin 3 | Directories=apps/24,apps/32,apps/48 4 | -------------------------------------------------------------------------------- /themes/scanner/testdata/icon_deepin_hidden.theme: -------------------------------------------------------------------------------- 1 | [Icon Theme] 2 | Name=Deepin 3 | Directories=apps/24,apps/32,apps/48 4 | Hidden=true 5 | -------------------------------------------------------------------------------- /themes/testdata/gtkrc-2.0: -------------------------------------------------------------------------------- 1 | gtk-theme-name="Paper" 2 | gtk-icon-theme-name="Faenza" 3 | gtk-font-name="sans-serif 9" 4 | gtk-cursor-theme-name="Adwaita" 5 | gtk-cursor-theme-size=0 6 | gtk-toolbar-style=GTK_TOOLBAR_BOTH 7 | gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR 8 | gtk-button-images=1 9 | gtk-menu-images=1 10 | gtk-enable-event-sounds=1 11 | gtk-enable-input-feedback-sounds=1 12 | gtk-xft-antialias=1 13 | gtk-xft-hinting=1 14 | gtk-xft-hintstyle="hintfull" 15 | gtk-xft-rgba="rgb" 16 | gtk-modules="gail:atk-bridge" 17 | -------------------------------------------------------------------------------- /themes/testdata/settings.ini: -------------------------------------------------------------------------------- 1 | [Settings] 2 | gtk-font-name=sans-serif 9 3 | gtk-theme-name=Paper 4 | gtk-icon-theme-name=Faenza 5 | gtk-fallback-icon-theme=gnome 6 | gtk-toolbar-style=GTK_TOOLBAR_BOTH 7 | gtk-menu-images=1 8 | gtk-button-images=1 9 | gtk-cursor-theme-name=Adwaita 10 | gtk-cursor-theme-size=0 11 | gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR 12 | gtk-enable-event-sounds=1 13 | gtk-enable-input-feedback-sounds=1 14 | gtk-xft-antialias=1 15 | gtk-xft-hinting=1 16 | gtk-xft-hintstyle=hintfull 17 | gtk-xft-rgba=rgb 18 | gtk-modules=gail:atk-bridge 19 | test-list=1;2;3; 20 | -------------------------------------------------------------------------------- /themes/theme_test.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | package themes 6 | 7 | import ( 8 | "os" 9 | "testing" 10 | 11 | "github.com/stretchr/testify/assert" 12 | ) 13 | 14 | func TestMergeThemeList(t *testing.T) { 15 | src := []string{"Deepin", "Adwaita", "Zukitwo"} 16 | target := []string{"Deepin", "Evolve"} 17 | ret := []string{"Deepin", "Adwaita", "Zukitwo", "Evolve"} 18 | 19 | assert.ElementsMatch(t, mergeThemeList(src, target), ret) 20 | } 21 | 22 | func TestSetQt4Theme(t *testing.T) { 23 | config := "/tmp/Trolltech.conf" 24 | assert.Equal(t, setQt4Theme(config), true) 25 | os.Remove(config) 26 | } 27 | -------------------------------------------------------------------------------- /thumbnailer/main.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | package main 6 | 7 | import ( 8 | "fmt" 9 | 10 | "github.com/linuxdeepin/dde-api/thumbnails" 11 | kingpin "gopkg.in/alecthomas/kingpin.v2" 12 | ) 13 | 14 | const ( 15 | SizeTypeNormal int = 128 16 | SizeTypeLarge int = 256 17 | ) 18 | 19 | func main() { 20 | var ( 21 | src = kingpin.Flag("src", "Source file").String() 22 | size = kingpin.Flag("size", "Thumbnail size").Int() 23 | ) 24 | kingpin.Parse() 25 | 26 | if len(*src) == 0 { 27 | fmt.Println("Please input source file") 28 | return 29 | } 30 | 31 | if *size < 0 { 32 | fmt.Println("Invalid size:", *size) 33 | return 34 | } 35 | 36 | if *size == 0 { 37 | dest, err := thumbnails.GenThumbnail(*src, SizeTypeNormal) 38 | if err != nil { 39 | fmt.Printf("Gen '%s' thumbnail in size '%v' failed: %v\n", *src, SizeTypeNormal, err) 40 | return 41 | } 42 | fmt.Printf("Thumbnail[%v]: %v\n", SizeTypeNormal, dest) 43 | 44 | dest, err = thumbnails.GenThumbnail(*src, SizeTypeLarge) 45 | if err != nil { 46 | fmt.Printf("Gen '%s' thumbnail in size '%v' failed: %v\n", *src, SizeTypeLarge, err) 47 | return 48 | } 49 | fmt.Printf("Thumbnail[%v]: %v\n", SizeTypeLarge, dest) 50 | return 51 | } 52 | 53 | dest, err := thumbnails.GenThumbnail(*src, *size) 54 | if err != nil { 55 | fmt.Printf("Gen '%s' thumbnail in size '%v' failed: %v\n", *src, *size, err) 56 | return 57 | } 58 | fmt.Printf("Thumbnail[%v]: %v\n", *size, dest) 59 | } 60 | -------------------------------------------------------------------------------- /thumbnails/font/font.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | package font 6 | 7 | import ( 8 | "fmt" 9 | 10 | . "github.com/linuxdeepin/dde-api/thumbnails/loader" 11 | "github.com/linuxdeepin/go-lib/mime" 12 | dutils "github.com/linuxdeepin/go-lib/utils" 13 | ) 14 | 15 | const ( 16 | FontTypeTTF = "application/x-font-ttf" 17 | FontTypeOTF = "application/vnd.ms-opentype" 18 | ) 19 | 20 | func init() { 21 | for _, ty := range SupportedTypes() { 22 | Register(ty, genFontThumbnail) 23 | } 24 | } 25 | 26 | func SupportedTypes() []string { 27 | return []string{ 28 | FontTypeOTF, 29 | FontTypeTTF, 30 | } 31 | } 32 | 33 | func GenThumbnail(src string, width, height int, force bool) (string, error) { 34 | if width <= 0 || height <= 0 { 35 | return "", fmt.Errorf("Invalid width or height") 36 | } 37 | 38 | ty, err := mime.Query(src) 39 | if err != nil { 40 | return "", err 41 | } 42 | 43 | if !IsStrInList(ty, SupportedTypes()) { 44 | return "", fmt.Errorf("Not supported type: %v", ty) 45 | } 46 | 47 | return genFontThumbnail(src, "", width, height, force) 48 | } 49 | 50 | func genFontThumbnail(src, bg string, width, height int, force bool) (string, error) { 51 | dest, err := GetThumbnailDest(src, width, height) 52 | if err != nil { 53 | return "", err 54 | } 55 | if !force && dutils.IsFileExist(dest) { 56 | return dest, nil 57 | } 58 | 59 | return doGenThumbnail(dutils.DecodeURI(src), dest, width, height) 60 | } 61 | -------------------------------------------------------------------------------- /thumbnails/font/thumbnail.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | #ifndef __THUMBNAIL_H__ 6 | #define __THUMBNAIL_H__ 7 | 8 | int font_thumbnail(char* file, char* dest, int size); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /thumbnails/font/wrapper.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | package font 6 | 7 | // #cgo pkg-config: cairo-ft glib-2.0 8 | // #cgo CFLAGS: -W -Wall -fPIC -fstack-protector-all 9 | // #cgo LDFLAGS: -lm 10 | // #include 11 | // #include "thumbnail.h" 12 | import "C" 13 | 14 | import ( 15 | "fmt" 16 | "os" 17 | "unsafe" 18 | 19 | . "github.com/linuxdeepin/dde-api/thumbnails/loader" 20 | ) 21 | 22 | func doGenThumbnail(file, dest string, width, height int) (string, error) { 23 | cFile := C.CString(file) 24 | defer C.free(unsafe.Pointer(cFile)) 25 | tmp := GetTmpImage() 26 | cTmp := C.CString(tmp) 27 | defer C.free(unsafe.Pointer(cTmp)) 28 | ret := C.font_thumbnail(cFile, cTmp, C.int(getThumbSize(width, height))) 29 | if ret == -1 { 30 | return "", fmt.Errorf("Gen thumbnail for '%s' failed", file) 31 | } 32 | 33 | defer os.Remove(tmp) 34 | err := ThumbnailImage(tmp, dest, width, height) 35 | if err != nil { 36 | return "", err 37 | } 38 | 39 | return dest, nil 40 | } 41 | 42 | func getThumbSize(width, height int) int { 43 | if width > height { 44 | return width 45 | } 46 | return height 47 | } 48 | -------------------------------------------------------------------------------- /thumbnails/icon/icon.c: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | #include 6 | #include "icon.h" 7 | 8 | char *choose_icon(char *theme, const char **names, int size) 9 | { 10 | if (!gtk_init_check(NULL, NULL)) { 11 | g_warning("Init gtk environment failed"); 12 | return NULL; 13 | } 14 | 15 | GtkIconTheme *icon_theme = gtk_icon_theme_new(); 16 | gtk_icon_theme_set_custom_theme(icon_theme, theme); 17 | GtkIconInfo *info = gtk_icon_theme_choose_icon(icon_theme, 18 | names, size, 0); 19 | g_object_unref(G_OBJECT(icon_theme)); 20 | if (!info) { 21 | return NULL; 22 | } 23 | 24 | char *file = g_strdup(gtk_icon_info_get_filename(info)); 25 | g_object_unref(G_OBJECT(info)); 26 | 27 | return file; 28 | } 29 | -------------------------------------------------------------------------------- /thumbnails/icon/icon.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | #ifndef __LOOKUP_H__ 6 | #define __LOOKUP_H__ 7 | 8 | char* choose_icon(char* theme, const char** names, int size); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /thumbnails/icon/wrapper.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | package icon 6 | 7 | // #cgo pkg-config: gtk+-3.0 8 | // #include 9 | // #include "icon.h" 10 | import "C" 11 | 12 | import ( 13 | "unsafe" 14 | ) 15 | 16 | func ChooseIcon(theme string, names []string) string { 17 | cTheme := C.CString(theme) 18 | defer C.free(unsafe.Pointer(cTheme)) 19 | 20 | cArr := StrvInC(names) 21 | cNames := (**C.char)(unsafe.Pointer(&cArr[0])) 22 | cFile := C.choose_icon(cTheme, cNames, C.int(defaultIconSize)) 23 | 24 | // free cArr 25 | for i := range cArr { 26 | C.free(unsafe.Pointer(cArr[i])) 27 | } 28 | defer C.free(unsafe.Pointer(cFile)) 29 | 30 | return C.GoString(cFile) 31 | } 32 | 33 | // return NUL-Terminated slice of C String 34 | func StrvInC(strv []string) []*C.char { 35 | cArr := make([]*C.char, len(strv)+1) 36 | for i, str := range strv { 37 | cArr[i] = C.CString(str) 38 | } 39 | return cArr 40 | } 41 | -------------------------------------------------------------------------------- /thumbnails/images/convert.c: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | #include 6 | #include 7 | 8 | #include "convert.h" 9 | 10 | int 11 | svg_to_png(const char* file, const char* dest) 12 | { 13 | if (!gdk_init_check(NULL, NULL)) { 14 | g_warning("Init gdk environment failed"); 15 | return -1; 16 | } 17 | 18 | GError* error = NULL; 19 | RsvgHandle* handler = rsvg_handle_new_from_file(file, &error); 20 | if (error) { 21 | g_warning("New RsvgHandle failed: %s", error->message); 22 | g_error_free(error); 23 | return -1; 24 | } 25 | 26 | GdkPixbuf* pbuf = rsvg_handle_get_pixbuf(handler); 27 | g_object_unref(G_OBJECT(handler)); 28 | 29 | error = NULL; 30 | gdk_pixbuf_save(pbuf, dest, "png", &error, NULL); 31 | g_object_unref(G_OBJECT(pbuf)); 32 | if (error) { 33 | g_warning("Save to png file failed: %s", error->message); 34 | g_error_free(error); 35 | return -1; 36 | } 37 | 38 | return 0; 39 | } 40 | -------------------------------------------------------------------------------- /thumbnails/images/convert.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | #ifndef __CONVERT_H__ 6 | #define __CONVERT_H__ 7 | 8 | int svg_to_png(const char* file, const char* dest); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /thumbnails/images/wrapper.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | package images 6 | 7 | // #cgo pkg-config: gdk-3.0 librsvg-2.0 8 | // #cgo CFLAGS: -W -Wall -fPIC -fstack-protector-all 9 | // #include 10 | // #include "convert.h" 11 | import "C" 12 | 13 | import ( 14 | "fmt" 15 | "unsafe" 16 | ) 17 | 18 | func svgToPng(src, dest string) error { 19 | cSrc := C.CString(src) 20 | defer C.free(unsafe.Pointer(cSrc)) 21 | cDest := C.CString(dest) 22 | defer C.free(unsafe.Pointer(cDest)) 23 | 24 | ret := C.svg_to_png(cSrc, cDest) 25 | if ret != 0 { 26 | return fmt.Errorf("Convert svg to png failed") 27 | } 28 | return nil 29 | } 30 | -------------------------------------------------------------------------------- /thumbnails/pdf/pdf.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | // PDF thumbnail generator 6 | package pdf 7 | 8 | import ( 9 | "fmt" 10 | 11 | . "github.com/linuxdeepin/dde-api/thumbnails/loader" 12 | "github.com/linuxdeepin/go-lib/mime" 13 | dutils "github.com/linuxdeepin/go-lib/utils" 14 | ) 15 | 16 | const ( 17 | PDFTypePDF = "application/pdf" 18 | ) 19 | 20 | func init() { 21 | for _, ty := range SupportedTypes() { 22 | Register(ty, genPDFThumbnail) 23 | } 24 | } 25 | 26 | func SupportedTypes() []string { 27 | return []string{ 28 | PDFTypePDF, 29 | } 30 | } 31 | 32 | func GenThumbnail(uri string, width, height int, force bool) (string, error) { 33 | if width <= 0 || height <= 0 { 34 | return "", fmt.Errorf("Invalid width or height") 35 | } 36 | 37 | ty, err := mime.Query(uri) 38 | if err != nil { 39 | return "", err 40 | } 41 | 42 | if !IsStrInList(ty, SupportedTypes()) { 43 | return "", fmt.Errorf("Not supported type: %s", ty) 44 | } 45 | 46 | return genPDFThumbnail(uri, "", width, height, force) 47 | } 48 | 49 | func genPDFThumbnail(uri, bg string, width, height int, force bool) (string, error) { 50 | dest, err := GetThumbnailDest(uri, width, height) 51 | if err != nil { 52 | return "", err 53 | } 54 | 55 | if !force && dutils.IsFileExist(dest) { 56 | return dest, nil 57 | } 58 | 59 | return doGenThumbnail(dutils.EncodeURI(uri, dutils.SCHEME_FILE), 60 | dest, width, height) 61 | } 62 | -------------------------------------------------------------------------------- /thumbnails/pdf/thumbnail.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | #ifndef __THUMBNAIL_H__ 6 | #define __THUMBNAIL_H__ 7 | 8 | int pdf_thumbnail(char* uri, char* dest); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /thumbnails/pdf/wrapper.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | package pdf 6 | 7 | // #cgo pkg-config: poppler-glib cairo 8 | // #cgo CFLAGS: -W -Wall -fPIC -fstack-protector-all 9 | // #include 10 | // #include "thumbnail.h" 11 | import "C" 12 | 13 | import ( 14 | "fmt" 15 | "os" 16 | "unsafe" 17 | 18 | . "github.com/linuxdeepin/dde-api/thumbnails/loader" 19 | ) 20 | 21 | func doGenThumbnail(uri, dest string, width, height int) (string, error) { 22 | tmp := GetTmpImage() 23 | cTmp := C.CString(tmp) 24 | defer C.free(unsafe.Pointer(cTmp)) 25 | cUri := C.CString(uri) 26 | defer C.free(unsafe.Pointer(cUri)) 27 | ret := C.pdf_thumbnail(cUri, cTmp) 28 | if ret == -1 { 29 | return "", fmt.Errorf("Gen thumbnail failed") 30 | } 31 | 32 | defer os.Remove(tmp) 33 | err := ThumbnailImage(tmp, dest, width, height) 34 | if err != nil { 35 | return "", err 36 | } 37 | 38 | return dest, nil 39 | } 40 | -------------------------------------------------------------------------------- /thumbnails/text/text.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | // Text thumbnail generator 6 | package text 7 | 8 | import ( 9 | "fmt" 10 | 11 | . "github.com/linuxdeepin/dde-api/thumbnails/loader" 12 | "github.com/linuxdeepin/go-lib/mime" 13 | dutils "github.com/linuxdeepin/go-lib/utils" 14 | ) 15 | 16 | const ( 17 | TextTypeText = "text/plain" 18 | TextTypeC = "text/x-c" 19 | TextTypeCpp = "text/x-cpp" 20 | TextTypeGo = "text/x-go" 21 | ) 22 | 23 | func init() { 24 | for _, ty := range SupportedTypes() { 25 | Register(ty, genTextThumbnail) 26 | } 27 | } 28 | 29 | func SupportedTypes() []string { 30 | return []string{ 31 | TextTypeText, 32 | TextTypeC, 33 | TextTypeCpp, 34 | TextTypeGo, 35 | } 36 | } 37 | 38 | func GenThumbnail(src string, width, height int, force bool) (string, error) { 39 | if width <= 0 || height <= 0 { 40 | return "", fmt.Errorf("Invalid width or height") 41 | } 42 | 43 | ty, err := mime.Query(src) 44 | if err != nil { 45 | return "", err 46 | } 47 | 48 | if !IsStrInList(ty, SupportedTypes()) { 49 | return "", fmt.Errorf("Not supported type: %v", ty) 50 | } 51 | 52 | return genTextThumbnail(src, "", width, height, force) 53 | } 54 | 55 | func genTextThumbnail(src, bg string, width, height int, force bool) (string, error) { 56 | dest, err := GetThumbnailDest(src, width, height) 57 | if err != nil { 58 | return "", err 59 | } 60 | if !force && dutils.IsFileExist(dest) { 61 | return dest, nil 62 | } 63 | 64 | return doGenThumbnail(dutils.DecodeURI(src), dest, width, height) 65 | } 66 | -------------------------------------------------------------------------------- /thumbnails/text/text.h: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | #ifndef __TEXT_H__ 6 | #define __TEXT_H__ 7 | 8 | typedef struct _THUMB_INFO 9 | { 10 | int width; 11 | int height; 12 | int xborder; 13 | int yborder; 14 | int canvasWidth; 15 | int canvasHeight; 16 | int fontSize; 17 | } ThumbInfo; 18 | 19 | int text_thumbnail(char** text, char* dest, ThumbInfo* info); 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /thumbnails/thumbnails.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | package thumbnails 6 | 7 | import ( 8 | "fmt" 9 | 10 | _ "github.com/linuxdeepin/dde-api/thumbnails/cursor" 11 | _ "github.com/linuxdeepin/dde-api/thumbnails/font" 12 | _ "github.com/linuxdeepin/dde-api/thumbnails/gtk" 13 | _ "github.com/linuxdeepin/dde-api/thumbnails/icon" 14 | _ "github.com/linuxdeepin/dde-api/thumbnails/images" 15 | "github.com/linuxdeepin/dde-api/thumbnails/loader" 16 | _ "github.com/linuxdeepin/dde-api/thumbnails/pdf" 17 | _ "github.com/linuxdeepin/dde-api/thumbnails/text" 18 | "github.com/linuxdeepin/go-lib/mime" 19 | ) 20 | 21 | func GenThumbnail(uri string, size int) (string, error) { 22 | if size < 0 { 23 | return "", fmt.Errorf("Invalid size: '%v'", size) 24 | } 25 | 26 | ty, err := mime.Query(uri) 27 | if err != nil { 28 | return "", err 29 | } 30 | 31 | size = correctSize(size) 32 | return GenThumbnailWithMime(uri, ty, size) 33 | } 34 | 35 | func GenThumbnailWithMime(uri, ty string, size int) (string, error) { 36 | if size < 0 { 37 | return "", fmt.Errorf("Invalid size: '%v'", size) 38 | } 39 | 40 | handler, err := loader.GetHandler(ty) 41 | if err != nil { 42 | return "", err 43 | } 44 | 45 | size = correctSize(size) 46 | return handler(uri, "", size, size, false) 47 | } 48 | 49 | func correctSize(size int) int { 50 | if size < loader.SizeFlagNormal { 51 | return loader.SizeFlagSmall 52 | } else if size >= loader.SizeFlagLarge { 53 | return loader.SizeFlagLarge 54 | } else { 55 | return loader.SizeFlagNormal 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /thumbnails/thumbnails_test.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | package thumbnails 6 | 7 | import ( 8 | "testing" 9 | 10 | "github.com/stretchr/testify/assert" 11 | "github.com/linuxdeepin/dde-api/thumbnails/loader" 12 | ) 13 | 14 | func TestCorrectSize(t *testing.T) { 15 | assert.Equal(t, correctSize(64), loader.SizeFlagSmall) 16 | assert.Equal(t, correctSize(128), loader.SizeFlagNormal) 17 | assert.Equal(t, correctSize(176), loader.SizeFlagNormal) 18 | assert.Equal(t, correctSize(256), loader.SizeFlagLarge) 19 | } 20 | -------------------------------------------------------------------------------- /userenv/testdata/t1.txt: -------------------------------------------------------------------------------- 1 | export ENV1="abc"; 2 | export ENV2="abc def"; 3 | export ENV3="abc\`def"; 4 | export ENV4="\$abc"; 5 | export ENV5="\"abc"; 6 | export ENV6="\\abc"; 7 | export ENV7="'abc"; 8 | -------------------------------------------------------------------------------- /validator/consts.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | package main 6 | 7 | const ( 8 | DBusName = "org.deepin.dde.Validator1" 9 | DBusPath = "/org/deepin/dde/Validator1" 10 | DBusInterface = "org.deepin.dde.Validator1" 11 | ) 12 | -------------------------------------------------------------------------------- /validator/exported_methods_auto.go: -------------------------------------------------------------------------------- 1 | // Code generated by "dbusutil-gen em -type Validator"; DO NOT EDIT. 2 | 3 | package main 4 | 5 | import ( 6 | "github.com/linuxdeepin/go-lib/dbusutil" 7 | ) 8 | 9 | func (v *Validator) GetExportedMethods() dbusutil.ExportedMethods { 10 | return dbusutil.ExportedMethods{ 11 | { 12 | Name: "ValidateHostname", 13 | Fn: v.ValidateHostname, 14 | InArgs: []string{"hostname"}, 15 | OutArgs: []string{"result"}, 16 | }, 17 | { 18 | Name: "ValidateHostnameTemp", 19 | Fn: v.ValidateHostnameTemp, 20 | InArgs: []string{"hostname"}, 21 | OutArgs: []string{"result"}, 22 | }, 23 | { 24 | Name: "ValidateUsername", 25 | Fn: v.ValidateUsername, 26 | InArgs: []string{"username"}, 27 | OutArgs: []string{"code", "result"}, 28 | }, 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /validator/main.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | package main 6 | 7 | import ( 8 | "os" 9 | "time" 10 | 11 | "github.com/godbus/dbus/v5" 12 | "github.com/linuxdeepin/go-lib" 13 | "github.com/linuxdeepin/go-lib/dbusutil" 14 | "github.com/linuxdeepin/go-lib/log" 15 | ) 16 | 17 | var logger = log.NewLogger(DBusName) 18 | 19 | // 此执行程序目前没有被使用和编译 20 | func main() { 21 | logger.BeginTracing() 22 | defer logger.EndTracing() 23 | 24 | if !lib.UniqueOnSession(DBusName) { 25 | logger.Warning("Validator daemon is already running.") 26 | return 27 | } 28 | 29 | bus, err := dbus.SessionBus() 30 | if err != nil { 31 | logger.Error("failed to get session bus:", err) 32 | os.Exit(1) 33 | } 34 | 35 | service := dbusutil.NewService(bus) 36 | validator := &Validator{ 37 | service: service, 38 | } 39 | 40 | err = service.Export(DBusPath, validator) 41 | if err != nil { 42 | logger.Error("failed to export dbus service:", err) 43 | os.Exit(1) 44 | } 45 | 46 | service.SetAutoQuitHandler(30*time.Second, nil) 47 | service.Wait() 48 | } 49 | -------------------------------------------------------------------------------- /validator/validator.go: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd. 2 | // 3 | // SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | package main 6 | 7 | import ( 8 | "github.com/linuxdeepin/go-lib/dbusutil" 9 | ) 10 | 11 | //go:generate dbusutil-gen em -type Validator 12 | 13 | type Validator struct { 14 | service *dbusutil.Service 15 | } 16 | 17 | func (v *Validator) GetInterfaceName() string { 18 | return DBusInterface 19 | } 20 | --------------------------------------------------------------------------------