├── .build.yml ├── .github ├── FUNDING.yml └── issue_template.md ├── .travis.yml ├── .tx ├── config └── config_20221029000826.bak ├── AUTHORS ├── COPYING ├── ChangeLog ├── Makefile.am ├── NEWS ├── README ├── SensorsApplet.xml ├── autogen.sh ├── configure.ac ├── git.mk ├── help ├── C │ ├── figures │ │ └── applet_in_panel.png │ ├── index.docbook │ └── legal.xml ├── ChangeLog ├── Makefile.am ├── af │ └── af.po ├── am │ └── am.po ├── an │ └── an.po ├── ar │ └── ar.po ├── as │ └── as.po ├── ast │ └── ast.po ├── az │ └── az.po ├── be │ └── be.po ├── bg │ └── bg.po ├── bn │ └── bn.po ├── bn_IN │ └── bn_IN.po ├── br │ └── br.po ├── bs │ └── bs.po ├── ca │ └── ca.po ├── ca@valencia │ └── ca@valencia.po ├── cmn │ └── cmn.po ├── crh │ └── crh.po ├── cs │ └── cs.po ├── cy │ └── cy.po ├── da │ └── da.po ├── de │ └── de.po ├── dz │ └── dz.po ├── el │ └── el.po ├── en_AU │ └── en_AU.po ├── en_CA │ └── en_CA.po ├── en_GB │ └── en_GB.po ├── eo │ └── eo.po ├── es │ └── es.po ├── es_AR │ └── es_AR.po ├── es_CL │ └── es_CL.po ├── es_CO │ └── es_CO.po ├── es_ES │ └── es_ES.po ├── es_MX │ └── es_MX.po ├── es_PR │ └── es_PR.po ├── et │ └── et.po ├── eu │ └── eu.po ├── fa │ └── fa.po ├── fi │ └── fi.po ├── fr │ └── fr.po ├── frp │ └── frp.po ├── fur │ └── fur.po ├── fy │ └── fy.po ├── ga │ └── ga.po ├── gl │ └── gl.po ├── gu │ └── gu.po ├── ha │ └── ha.po ├── he │ └── he.po ├── hi │ └── hi.po ├── hr │ └── hr.po ├── hu │ └── hu.po ├── hy │ └── hy.po ├── ia │ └── ia.po ├── id │ └── id.po ├── ie │ └── ie.po ├── ig │ └── ig.po ├── is │ └── is.po ├── it │ └── it.po ├── ja │ └── ja.po ├── jv │ └── jv.po ├── ka │ └── ka.po ├── kab │ └── kab.po ├── kk │ └── kk.po ├── km │ └── km.po ├── kn │ └── kn.po ├── ko │ └── ko.po ├── ku │ └── ku.po ├── ku_IQ │ └── ku_IQ.po ├── ky │ └── ky.po ├── la │ └── la.po ├── lt │ └── lt.po ├── lv │ └── lv.po ├── mai │ └── mai.po ├── mate-sensors-applet.pot ├── mg │ └── mg.po ├── mi │ └── mi.po ├── mk │ └── mk.po ├── ml │ └── ml.po ├── mn │ └── mn.po ├── mr │ └── mr.po ├── ms │ └── ms.po ├── nb │ └── nb.po ├── nds │ └── nds.po ├── ne │ └── ne.po ├── nl │ └── nl.po ├── nn │ └── nn.po ├── nso │ └── nso.po ├── oc │ └── oc.po ├── or │ └── or.po ├── pa │ └── pa.po ├── pl │ └── pl.po ├── ps │ └── ps.po ├── pt │ └── pt.po ├── pt_BR │ └── pt_BR.po ├── ro │ └── ro.po ├── ru │ └── ru.po ├── sensors-applet.omf.in ├── si │ └── si.po ├── sk │ └── sk.po ├── sl │ └── sl.po ├── sq │ └── sq.po ├── sr │ └── sr.po ├── sr@latin │ └── sr@latin.po ├── sv │ └── sv.po ├── ta │ └── ta.po ├── te │ └── te.po ├── th │ └── th.po ├── tk │ └── tk.po ├── tr │ └── tr.po ├── ug │ └── ug.po ├── uk │ └── uk.po ├── ur │ └── ur.po ├── uz │ └── uz.po ├── vi │ └── vi.po ├── wa │ └── wa.po ├── xh │ └── xh.po ├── yo │ └── yo.po ├── zh_CN │ └── zh_CN.po ├── zh_HK │ └── zh_HK.po ├── zh_TW │ └── zh_TW.po └── zu │ └── zu.po ├── lib ├── Makefile.am └── sensors-applet-plugin.c ├── makepot ├── mate-sensors-applet.pot ├── org.mate.applets.SensorsApplet.mate-panel-applet.desktop.in.in ├── org.mate.panel.applet.SensorsAppletFactory.service.in ├── org.mate.sensors-applet.gschema.xml.in ├── org.mate.sensors-applet.sensor.gschema.xml.in ├── pixmaps ├── Makefile.am ├── high-temp-icon.png ├── low-temp-icon.png ├── mate-sensors-applet-battery.png ├── mate-sensors-applet-case.png ├── mate-sensors-applet-chip.png ├── mate-sensors-applet-cpu.png ├── mate-sensors-applet-drive-harddisk.png ├── mate-sensors-applet-fan.png ├── mate-sensors-applet-gpu.png ├── mate-sensors-applet-memory.png ├── mate-sensors-applet.png ├── normal-temp-icon.png ├── very-high-temp-icon.png └── very-low-temp-icon.png ├── plugins ├── Makefile.am ├── acpi │ ├── Makefile.am │ ├── acpi-plugin.c │ └── acpi-plugin.h ├── dummy │ ├── Makefile.am │ ├── dummy-plugin.c │ └── dummy-plugin.h ├── hddtemp │ ├── Makefile.am │ ├── hddtemp-plugin.c │ └── hddtemp-plugin.h ├── i2c-proc │ ├── Makefile.am │ ├── i2c-proc-plugin.c │ └── i2c-proc-plugin.h ├── i2c-sys │ ├── Makefile.am │ ├── i2c-sys-plugin.c │ └── i2c-sys-plugin.h ├── i8k │ ├── Makefile.am │ ├── i8k-plugin.c │ └── i8k-plugin.h ├── ibm-acpi │ ├── Makefile.am │ ├── ibm-acpi-plugin.c │ └── ibm-acpi-plugin.h ├── libsensors │ ├── Makefile.am │ ├── libsensors-plugin.c │ └── libsensors-plugin.h ├── mbmon │ ├── Makefile.am │ ├── mbmon-plugin.c │ └── mbmon-plugin.h ├── netbsd │ ├── Makefile.am │ ├── netbsd-plugin.c │ └── netbsd-plugin.h ├── nvidia │ ├── Makefile.am │ ├── nvidia-plugin.c │ └── nvidia-plugin.h ├── omnibook │ ├── Makefile.am │ ├── omnibook-plugin.c │ └── omnibook-plugin.h ├── pmu-sys │ ├── Makefile.am │ ├── pmu-sys-plugin.c │ └── pmu-sys-plugin.h ├── smu-sys │ ├── Makefile.am │ ├── smu-sys-plugin.c │ └── smu-sys-plugin.h ├── sonypi │ ├── Makefile.am │ ├── sonypi-plugin.c │ └── sonypi-plugin.h └── udisks2 │ ├── Makefile.am │ ├── udisks2-plugin.c │ └── udisks2-plugin.h ├── po ├── ChangeLog ├── LINGUAS ├── Makevars ├── POTFILES.in ├── POTFILES.skip ├── af.po ├── am.po ├── an.po ├── ar.po ├── as.po ├── ast.po ├── az.po ├── be.po ├── bg.po ├── bn.po ├── bn_IN.po ├── br.po ├── bs.po ├── ca.po ├── ca@valencia.po ├── cmn.po ├── crh.po ├── cs.po ├── csb.po ├── cy.po ├── da.po ├── de.po ├── dz.po ├── el.po ├── en_AU.po ├── en_CA.po ├── en_GB.po ├── eo.po ├── es.po ├── es_AR.po ├── es_CL.po ├── es_CO.po ├── es_CR.po ├── es_DO.po ├── es_EC.po ├── es_ES.po ├── es_MX.po ├── es_NI.po ├── es_PA.po ├── es_PE.po ├── es_PR.po ├── es_SV.po ├── es_UY.po ├── es_VE.po ├── et.po ├── eu.po ├── fa.po ├── fi.po ├── fr.po ├── fr_CA.po ├── frp.po ├── fur.po ├── fy.po ├── ga.po ├── gl.po ├── gu.po ├── ha.po ├── he.po ├── hi.po ├── hr.po ├── hu.po ├── hy.po ├── ia.po ├── id.po ├── ie.po ├── ig.po ├── is.po ├── it.po ├── ja.po ├── jv.po ├── ka.po ├── kab.po ├── kk.po ├── km.po ├── kn.po ├── ko.po ├── ks.po ├── ku.po ├── ku_IQ.po ├── ky.po ├── lb.po ├── li.po ├── lt.po ├── lv.po ├── mai.po ├── mg.po ├── mi.po ├── mk.po ├── ml.po ├── mn.po ├── mr.po ├── ms.po ├── nah.po ├── nb.po ├── nds.po ├── ne.po ├── nl.po ├── nn.po ├── nqo.po ├── nso.po ├── oc.po ├── or.po ├── pa.po ├── pl.po ├── pms.po ├── ps.po ├── pt.po ├── pt_BR.po ├── ro.po ├── ru.po ├── rw.po ├── sc.po ├── si.po ├── sk.po ├── sl.po ├── sq.po ├── sr.po ├── sr@latin.po ├── sv.po ├── sw.po ├── ta.po ├── te.po ├── th.po ├── tk.po ├── tr.po ├── tt.po ├── ug.po ├── uk.po ├── ur.po ├── ur_PK.po ├── uz.po ├── vi.po ├── wa.po ├── xh.po ├── yi.po ├── yo.po ├── zh_CN.po ├── zh_HK.po ├── zh_TW.po └── zu.po └── sensors-applet ├── Makefile.am ├── about-dialog.c ├── about-dialog.h ├── active-sensor-libnotify.c ├── active-sensor-libnotify.h ├── active-sensor.c ├── active-sensor.h ├── main.c ├── prefs-dialog.c ├── prefs-dialog.h ├── sensor-config-dialog.c ├── sensor-config-dialog.h ├── sensors-applet-plugin.h ├── sensors-applet-plugins.c ├── sensors-applet-plugins.h ├── sensors-applet-sensor.h ├── sensors-applet-settings.c ├── sensors-applet-settings.h ├── sensors-applet.c └── sensors-applet.h /.build.yml: -------------------------------------------------------------------------------- 1 | ########################################################## 2 | # THE FOLLOWING LINES IS USED BY docker-build 3 | ########################################################## 4 | requires: 5 | archlinux: 6 | # Useful URL: https://git.archlinux.org/svntogit/community.git/tree/mate-sensors-applet 7 | - autoconf-archive 8 | - clang 9 | - gcc 10 | - git 11 | - gtk3 12 | - libnotify 13 | - libxnvctrl 14 | - lm_sensors 15 | - make 16 | - mate-common 17 | - mate-panel 18 | - which 19 | - yelp-tools 20 | 21 | debian: 22 | # Useful URL: https://github.com/mate-desktop/debian-packages 23 | # Useful URL: https://salsa.debian.org/debian-mate-team/mate-sensors-applet 24 | - autoconf-archive 25 | - autopoint 26 | - clang 27 | - clang-tools 28 | - cppcheck 29 | - gcc 30 | - git 31 | - libcairo2-dev 32 | - libglib2.0-dev 33 | - libgtk-3-dev 34 | - libmate-panel-applet-dev 35 | - libnotify-dev 36 | - libsensors-dev 37 | - libtool 38 | - libxml-parser-perl 39 | - libxnvctrl-dev 40 | - make 41 | - mate-common 42 | - yelp-tools 43 | 44 | fedora: 45 | # Useful URL: https://src.fedoraproject.org/cgit/rpms/mate-sensors-applet.git 46 | - autoconf-archive 47 | - clang 48 | - clang-analyzer 49 | - cppcheck-htmlreport 50 | - gcc 51 | - git 52 | - gtk3-devel 53 | - libnotify-devel 54 | - libXNVCtrl-devel 55 | - lm_sensors-devel 56 | - make 57 | - mate-common 58 | - mate-panel-devel 59 | - redhat-rpm-config 60 | 61 | ubuntu: 62 | - autoconf-archive 63 | - autopoint 64 | - clang 65 | - clang-tools 66 | - git 67 | - libcairo2-dev 68 | - libglib2.0-dev 69 | - libgtk-3-dev 70 | - libmate-panel-applet-dev 71 | - libnotify-dev 72 | - libsensors4-dev 73 | - libtool 74 | - libxml-parser-perl 75 | - libxnvctrl-dev 76 | - make 77 | - mate-common 78 | - yelp-tools 79 | 80 | variables: 81 | - 'CHECKERS=" 82 | -enable-checker deadcode.DeadStores 83 | -enable-checker alpha.deadcode.UnreachableCode 84 | -enable-checker alpha.core.CastSize 85 | -enable-checker alpha.core.CastToStruct 86 | -enable-checker alpha.core.IdenticalExpr 87 | -enable-checker alpha.core.SizeofPtr 88 | -enable-checker alpha.security.ArrayBoundV2 89 | -enable-checker alpha.security.MallocOverflow 90 | -enable-checker alpha.security.ReturnPtrRange 91 | -enable-checker alpha.unix.SimpleStream 92 | -enable-checker alpha.unix.cstring.BufferOverlap 93 | -enable-checker alpha.unix.cstring.NotNullTerminated 94 | -enable-checker alpha.unix.cstring.OutOfBounds 95 | -enable-checker alpha.core.FixedAddr 96 | -enable-checker security.insecureAPI.strcpy"' 97 | 98 | before_scripts: 99 | 100 | build_scripts: 101 | - if [ ${DISTRO_NAME} == "debian" ];then 102 | - export CFLAGS+=" -Wsign-compare" 103 | - cppcheck --enable=warning,style,performance,portability,information,missingInclude . 104 | - fi 105 | 106 | - NOCONFIGURE=1 ./autogen.sh 107 | - scan-build $CHECKERS ./configure --enable-compile-warnings=maximum 108 | - if [ $CPU_COUNT -gt 1 ]; then 109 | - if [ ${DISTRO_NAME} == "debian" ];then 110 | - scan-build $CHECKERS --keep-cc --use-cc=clang --use-c++=clang++ -o html-report make -j $CPU_COUNT 111 | - make clean 112 | - fi 113 | - scan-build $CHECKERS --keep-cc -o html-report make -j $CPU_COUNT 114 | - else 115 | - if [ ${DISTRO_NAME} == "debian" ];then 116 | - scan-build $CHECKERS --keep-cc --use-cc=clang --use-c++=clang++ -o html-report make 117 | - make clean 118 | - fi 119 | - scan-build $CHECKERS --keep-cc -o html-report make 120 | - fi 121 | 122 | after_scripts: 123 | - if [ ${DISTRO_NAME} == "fedora" ];then 124 | - cppcheck --xml --output-file=cppcheck.xml --enable=warning,style,performance,portability,information,missingInclude . 125 | - cppcheck-htmlreport --title=${REPO_NAME} --file=cppcheck.xml --report-dir=cppcheck-htmlreport 126 | - ./gen-index -l 20 127 | - fi 128 | - make distcheck 129 | 130 | releases: 131 | draft: false 132 | prerelease: false 133 | checksum: true 134 | file_glob: true 135 | files: mate-sensors-applet-*.tar.xz 136 | github_release: 137 | tags: true 138 | overwrite: true 139 | base_version: 1.20.0 140 | notify_servers: 141 | - https://release.mate-desktop.org/release 142 | 143 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | custom: https://mate-desktop.org/donate/ 10 | -------------------------------------------------------------------------------- /.github/issue_template.md: -------------------------------------------------------------------------------- 1 | #### Expected behaviour 2 | 3 | 4 | #### Actual behaviour 5 | 6 | 7 | #### Steps to reproduce the behaviour 8 | 9 | 10 | #### MATE general version 11 | 12 | 13 | #### Package version 14 | 15 | 16 | #### Linux Distribution 17 | 18 | 19 | #### Link to bugreport of your Distribution (requirement) 20 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # vim: set ts=2 sts=2 sw=2 expandtab : 2 | dist: jammy 3 | language: shell 4 | os: linux 5 | services: 6 | - docker 7 | addons: 8 | apt: 9 | packages: 10 | - python3-pip 11 | - python3-setuptools 12 | 13 | branches: 14 | except: 15 | - gh-pages 16 | 17 | before_install: 18 | - curl -Ls -o docker-build https://github.com/mate-desktop/mate-dev-scripts/raw/master/travis/docker-build 19 | - curl -Ls -o gen-index https://github.com/mate-desktop/mate-dev-scripts/raw/master/travis/gen-index.sh 20 | - chmod +x docker-build gen-index 21 | 22 | install: 23 | - pip3 install PyGithub 24 | - ./docker-build --name ${DISTRO} --config .build.yml --install 25 | 26 | script: 27 | - ./docker-build --name ${DISTRO} --verbose --config .build.yml --build scripts 28 | 29 | notifications: 30 | irc: 31 | if: (tag OR branch = master) AND 32 | repo = "mate-desktop/mate-sensors-applet" 33 | channels: 34 | - "irc.libera.chat#mate-dev" 35 | template: 36 | - "[%{repository_name}] %{author}: %{commit_subject}" 37 | - "[%{branch}] %{commit} %{message} %{build_url}" 38 | on_success: never 39 | on_failure: always 40 | 41 | deploy: 42 | - provider: pages 43 | edge: true 44 | token: $GITHUB_TOKEN 45 | keep_history: false 46 | committer_from_gh: true 47 | target_branch: gh-pages 48 | local_dir: html-report 49 | strategy: git 50 | on: 51 | all_branches: true 52 | condition: ${DISTRO} =~ ^fedora.*$ 53 | - provider: script 54 | edge: true 55 | script: ./docker-build --verbose --config .build.yml --release github 56 | on: 57 | tags: true 58 | condition: "${TRAVIS_TAG} =~ ^v.*$ && ${DISTRO} =~ ^fedora.*$" 59 | 60 | after_success: 61 | - 'if [[ "$TRAVIS_SECURE_ENV_VARS" == "true" && "$TRAVIS_PULL_REQUEST" != "false" && ${DISTRO} =~ ^fedora.*$ ]]; then 62 | REPO_SLUG_ARRAY=(${TRAVIS_REPO_SLUG//\// }); 63 | REPO_NAME=${REPO_SLUG_ARRAY[1]}; 64 | URL="https://${REPO_NAME}.mate-desktop.dev"; 65 | COMMENT="Code analysis completed"; 66 | curl -H "Authorization: token $GITHUB_TOKEN" -X POST 67 | -d "{\"state\": \"success\", \"description\": \"$COMMENT\", \"context\":\"scan-build\", \"target_url\": \"$URL\"}" 68 | https://api.github.com/repos/${TRAVIS_REPO_SLUG}/statuses/${TRAVIS_PULL_REQUEST_SHA}; 69 | fi' 70 | 71 | env: 72 | # - DISTRO="archlinux:latest" 73 | - DISTRO="debian:testing" 74 | - DISTRO="fedora:latest" 75 | # - DISTRO="ubuntu:rolling" 76 | -------------------------------------------------------------------------------- /.tx/config: -------------------------------------------------------------------------------- 1 | [main] 2 | host = https://www.transifex.com 3 | 4 | [o:mate:p:MATE:r:master--mate-sensors-applet] 5 | file_filter = po/.po 6 | source_file = mate-sensors-applet.pot 7 | source_lang = en 8 | type = PO 9 | minimum_perc = 2 10 | 11 | [o:mate:p:MATE:r:master--mate-sensors-applet-user-guide] 12 | file_filter = help//.po 13 | source_file = help/mate-sensors-applet.pot 14 | source_lang = en 15 | type = PO 16 | minimum_perc = 2 17 | 18 | -------------------------------------------------------------------------------- /.tx/config_20221029000826.bak: -------------------------------------------------------------------------------- 1 | [main] 2 | host = https://www.transifex.com 3 | 4 | [MATE.master--mate-sensors-applet] 5 | file_filter = po/.po 6 | source_file = mate-sensors-applet.pot 7 | source_lang = en 8 | type = PO 9 | minimum_perc = 2 10 | 11 | [MATE.master--mate-sensors-applet-user-guide] 12 | file_filter = help//.po 13 | source_file = help/mate-sensors-applet.pot 14 | source_lang = en 15 | type = PO 16 | minimum_perc = 2 17 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | MATE: 2 | Perberos 3 | Steve Zesch 4 | Stefano Karapetsas 5 | 6 | GNOME: 7 | Alex Murray 8 | Nathan Hand 9 | Sam Morris 10 | Alastair Poole 11 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- 1 | The ChangeLog is auto-generated when releasing. If you are seeing this, use 2 | 'git log' for a detailed list of changes. 3 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = sensors-applet lib plugins pixmaps po help 2 | 3 | ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} 4 | 5 | if ENABLE_IN_PROCESS 6 | APPLET_LOCATION = $(libdir)/mate-sensors-applet/libmate-sensors-applet.so 7 | else 8 | APPLET_LOCATION = $(libexecdir)/mate-sensors-applet 9 | 10 | servicedir = $(datadir)/dbus-1/services 11 | service_in_files = org.mate.panel.applet.SensorsAppletFactory.service.in 12 | service_DATA = $(service_in_files:.service.in=.service) 13 | 14 | org.mate.panel.applet.SensorsAppletFactory.service: $(service_in_files) 15 | $(AM_V_GEN)sed \ 16 | -e "s|\@LIBEXECDIR\@|$(libexecdir)|" \ 17 | $< > $@ 18 | 19 | endif 20 | 21 | appletdir = $(datadir)/mate-panel/applets 22 | applet_in_files = org.mate.applets.SensorsApplet.mate-panel-applet.desktop.in 23 | applet_DATA = $(applet_in_files:.mate-panel-applet.desktop.in=.mate-panel-applet) 24 | 25 | $(applet_in_files): $(applet_in_files).in Makefile 26 | $(AM_V_GEN)sed \ 27 | -e "s|\@APPLET_LOCATION\@|$(APPLET_LOCATION)|" \ 28 | -e "s|\@APPLET_IN_PROCESS\@|$(APPLET_IN_PROCESS)|" \ 29 | -e "s|\@VERSION\@|$(PACKAGE_VERSION)|" \ 30 | $< > $@ 31 | 32 | $(applet_DATA): $(applet_in_files) Makefile 33 | $(AM_V_GEN) $(MSGFMT) --desktop --keyword=Name --keyword=Description --template $< -d $(top_srcdir)/po -o $@ 34 | 35 | uidir = $(datadir)/mate-sensors-applet/ui 36 | ui_DATA = SensorsApplet.xml 37 | 38 | gsettingsschema_in_files = \ 39 | org.mate.sensors-applet.gschema.xml.in \ 40 | org.mate.sensors-applet.sensor.gschema.xml.in 41 | 42 | gsettings_SCHEMAS = $(gsettingsschema_in_files:.xml.in=.xml) 43 | @GSETTINGS_RULES@ 44 | 45 | CLEANFILES = $(applet_DATA) \ 46 | $(applet_in_files) \ 47 | $(service_DATA) \ 48 | $(gsettings_SCHEMAS) \ 49 | *.gschema.valid 50 | 51 | DISTCHECK_CONFIGURE_FLAGS = \ 52 | --enable-compile-warnings=no \ 53 | CFLAGS='-Wno-deprecated-declarations' 54 | 55 | EXTRA_DIST = $(ui_DATA) \ 56 | $(applet_in_files).in \ 57 | $(service_in_files) \ 58 | $(gsettingsschema_in_files) \ 59 | autogen.sh 60 | 61 | DISTCLEANFILES = 62 | 63 | MSACLEANFILES = aclocal.m4 \ 64 | compile \ 65 | config.* \ 66 | configure \ 67 | depcomp \ 68 | install-sh \ 69 | ltmain.sh \ 70 | missing \ 71 | omf.make \ 72 | xmldocs.make \ 73 | INSTALL \ 74 | $(top_srcdir)/sensors-applet/config.h* 75 | 76 | msa-clean: maintainer-clean 77 | -test -z "$(MSACLEANFILES)" || rm -f $(MSACLEANFILES) 78 | -rm -rf m4; 79 | find . -name "Makefile.in" -exec rm \{\} \; 80 | 81 | .PHONY: msa-clean 82 | 83 | # Build ChangeLog from GIT history 84 | ChangeLog: 85 | $(AM_V_GEN) if test -d $(top_srcdir)/.git; then \ 86 | GIT_DIR="$(top_srcdir)/.git" git log --stat > $@; \ 87 | fi 88 | 89 | dist: ChangeLog 90 | 91 | .PHONY: ChangeLog 92 | 93 | -include $(top_srcdir)/git.mk 94 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- 1 | ### mate-sensors-applet 1.28.0 2 | 3 | * Translations update 4 | 5 | ### mate-sensors-applet 1.27.0 6 | 7 | * Translations update 8 | * tx: update resource 9 | * tx: migrate config file 10 | * ci: drop -Wunused-parameter compiler cflag from debian build 11 | * Use a blank line at most 12 | * tx: update resource 13 | * user-guide: fix typo reported by translators 14 | 15 | ### mate-sensors-applet 1.26.0 16 | 17 | * Translations update 18 | * travis-Ci: use libera.chat as notification server 19 | * update copyright to 2021 20 | * travis: disable travis builds for ubuntu 21 | * warning: declaration of ‘content_area’ shadows a previous local 22 | * build: Use PACKAGE_URL variable 23 | * Update copyright to 2021 24 | * Drop aticonfig plugin (#119) 25 | * sensors-applet: Remove unused function 26 | * Remove cppcheck warnings about the variable scope can be reduced 27 | * Remove USE_MATE2_MACROS from autogen.sh (legacy) 28 | * hddtemp & mbmon plugins: 'GTimeVal' is deprecated 29 | * Travis CI: enable irc notifications with tagged commits 30 | * libsensors-plugin: function declaration isn't a prototype 31 | 32 | ### mate-sensors-applet 1.25.0 33 | 34 | * Translations update 35 | * docbook: change id value in about section 36 | * help: fix DE name and link to GPL 37 | * add git.mk to generate .gitignore 38 | * build: prevents two consecutive slashes in plugin file path 39 | * build: Fix G_LOG_DOMAIN for sensors applet 40 | * sonypi-plugin.c: Make sonypi plugin portable to GNU/Hurd 41 | * libsensors-plugin: Port to GRegex 42 | * Replace g_malloc0 with g_new0 and g_strdup 43 | * build: silent build warnings for distcheck 44 | * Remove unused-variable warning 45 | * build: show configure summary 46 | * build: Use WARN_CFLAGS variable 47 | * build: do not override the default value for MATE_COMPILE_WARNINGS 48 | 49 | ### mate-sensors-applet 1.24.0 50 | 51 | * Translations update 52 | 53 | ### mate-sensors-applet 1.23.0 54 | 55 | * Translations update 56 | * Remove trailing whitespaces 57 | * Change url project's website 58 | * [ci] Add cppcheck html report 59 | * [ci] Enable Clang Static Analyzer 60 | * help: update copyright 61 | * Help: Use XInclude instead of ENTITY for legal.xml 62 | 63 | ### mate-sensors-applet 1.22.0 64 | 65 | * Translations update 66 | * Initialize Travis CI support 67 | * Make translatable the copyright in about dialog 68 | 69 | ### mate-sensors-applet 1.21.1 70 | 71 | * Translations update 72 | * disable deprecation warnings for distcheck 73 | * Add NetBSD support. 74 | * Use make functions for HELP_LINGUAS 75 | * add help to transifex config 76 | 77 | ### mate-sensors-applet 1.21.0 78 | 79 | * Translations update 80 | * Fix copyright for plugin files 81 | * Add dummy plugin 82 | * UDisks2 plugin cleanup 83 | 84 | ### mate-sensors-applet 1.20.1 85 | 86 | * Translations update 87 | * fix save order of sensors v2 88 | * prefs-dialog: drop unneeded space in general tab 89 | * prefs-dialog: set a min_width for enable_column 90 | * prefs-dialog: use hscrollbar-policy GTK_POLICY_NEVER 91 | 92 | ### mate-sensors-applet 1.20.0 93 | 94 | * require GTK+ 3.22 and GLib 2.50 95 | * build: enable udisk2 plugin again 96 | * Translations update 97 | * Remove deprecated udisks plugin 98 | * udisks plugin: fix memory management for GValue variables 99 | * Remove deprecated eee plugin 100 | * Fix popup shower on removed HDD 101 | * ibm-acpi.c: Fix build warning: 102 | * eee-plugin.c: Fix build warning: 103 | * active-sensor.c: Fix build warning: 104 | * sensors-applet.c: Fix build warning: 105 | * update copyright year to 2018 106 | * Fix indents 107 | * Fix project cleanup 108 | 109 | ### mate-sensors-applet 1.19.1 110 | 111 | * Translations update 112 | * Stop jumping applet as numbers change 113 | * fix save order of sensors 114 | * updated hide temperature units 115 | * remove code duplication 116 | 117 | ### mate-sensors-applet 1.19.0 118 | 119 | * Translations update 120 | * sensor-applet.c: replace deprecated GtkMisc 121 | * sensor-applet.c: avoid deprecated GTK_STOCK_MISSING_IMAGE 122 | * sensor-config-dialog: avoid deprecated GtkAlignment 123 | * sensor-config-dialog: don't use deprecated GtkColorButton 124 | * prefs-dialog: add style class frame to scrolledwindow 125 | * prefs-dialog: avoid deprecated GtkAlignment 126 | * prefs-dialog: avoid deprecated GTK_VBUTTON_BOX, GTK_TYPE_{H,V}BOX 127 | * use GTK_ALIGN_CENTER for the sensor_applet grid 128 | 129 | ### mate-sensors-applet 1.18.0 130 | 131 | * NEWS: use consistent, project wide, markdown-like formatting 132 | to make generating release announcements easier 133 | * Build: require mate-panel >= 1.17 134 | * Move to GTK+3 (require GTK+ >= 3.14), drop GTK+2 code and 135 | --with-gtk build option 136 | * Fix some GTK+ deprecations 137 | * Some more fixes and cleanups 138 | * Translations update 139 | 140 | ### mate-sensors-applet 1.16.1 141 | 142 | * Update tooltip only when mouse is over the applet (fixes some 143 | OpenGL issues in fullscreen apps) 144 | 145 | ### mate-sensors-applet 1.16.0 146 | 147 | * Make distcheck use currently selected GTK+ version 148 | * Translations update 149 | 150 | ### mate-sensors-applet 1.14.0 151 | 152 | * Some cleanups 153 | * Translations update 154 | * Fix Changelog generation 155 | 156 | ### mate-sensors-applet 1.12.1 157 | 158 | * Fix wrong size of GPU icon 159 | 160 | ### mate-sensors-applet 1.12.0 161 | 162 | * Add support for nvidia thermal and cooler sensors (requires 163 | libxnvctrl >= 256.25) 164 | * Add mbmon plugin 165 | * Make udisks plugin poll for new value 166 | * Retrieve strings directly from gschema (requires intltool 0.50.1) 167 | * Some GTK+3 fixes 168 | * Some more fixes and cleanups 169 | 170 | ### mate-sensors-applet 1.10.4 171 | 172 | * Fix regression that caused segfault 173 | 174 | ### mate-sensors-applet 1.10.3 175 | 176 | * Set icons for prefs and about dialogs 177 | * Several small cleanups and bugfixes 178 | * Several help fixes 179 | 180 | ### mate-sensors-applet 1.10.2 181 | 182 | * Reintroduce missing help 183 | 184 | ### mate-sensors-applet 1.10.1 185 | 186 | * Fix sensor config dialog (was non-responsive) 187 | * Fix display of sensors in GTK+3 build 188 | * Updated translations 189 | 190 | ### mate-sensors-applet 1.10.0 191 | 192 | * Add GTK3 support 193 | 194 | ### mate-sensors-applet 1.8.0 195 | 196 | * Use yelp-tools instead of mate-doc-utils 197 | 198 | ### mate-sensors-applet 1.5.0: 199 | 200 | * migrate to GSettings and remove MateConf usage 201 | * migrate to DBUS and remove MateComponent usage 202 | * remove libmate usage and use glib instead 203 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | MATE Sensors Applet 2 | 3 | Authors: Alex Murray , 4 | Stefano Karapetsas 5 | 6 | MATE Sensors Applet is an applet for the MATE Panel to display 7 | readings from hardware sensors, including CPU temperature, fan speeds 8 | and voltage readings under Linux. 9 | 10 | Supported interfaces: 11 | 12 | * ACPI thermal zones, via the Linux kernel ACPI modules 13 | * Linux kernel i2c[1] modules (for kernel 2.6). 14 | * lm_sensors[1] and i2c[1] packages (for kernel 2.4) 15 | * libsensors[1] (provided by lm_sensors package) 16 | * Linux kernel i8k[2] module (for Dell Inspiron Laptops). 17 | * Linux kernel ibm-acpi[3] module 18 | * Linux kernel PowerPC modules therm_adt746x and therm_windtunnel. 19 | * Linux kernel iMac G5 Windfarm module. 20 | * hddtemp[4] daemon for reading temperatures from S.M.A.R.T. equipped disks. 21 | * Linux kernel Omnibook[5] module. 22 | * NVIDIA graphics cards via libNVCtrl (supplied with nvidia-settings[6]) 23 | * Linux kernel sonypi[7] module (for Sony Vaio laptops) 24 | 25 | Includes a simple, yet highly customizable display and intuitive 26 | user-interface. 27 | 28 | Alarms can be set for each sensor to notify the user once a certain 29 | high or low value has been reached, and can be configured to execute a 30 | given command at given repeated intervals. 31 | 32 | MATE HIG v2.0 compliant 33 | 34 | libnotify[8] support for alarm conditions 35 | 36 | The icons bundled as part of MATE Sensors Applet were created by 37 | epicbard[9], and are released under the Creative Commons Attribution 38 | Share-Alike license 3.0[10]. 39 | 40 | ---------------------------------------------------------------------------- 41 | 42 | Requirements 43 | 44 | * MATE desktop environment, with GTK >=2.4.0 and libmatepanelapplet 45 | * For ACPI support: 46 | o Linux kernel 2.6 with ACPI modules loaded (CONFIG_ACPI & 47 | CONFIG_ACPI_THERMAL) 48 | * For i2c support: 49 | o Linux kernel 2.6 with appropriate i2c modules loaded OR 50 | o Linux kernel 2.4 with lm_sensors and i2c packages installed 51 | o libsensors support is available for either of the above (will 52 | utilise settings in /etc/sensors.conf 53 | * For i8k support: 54 | o Linux kernel 2.6 with i8k module enabled ("Support for 55 | Dell laptops" (CONFIG_I8K)) 56 | * For ibm-acpi support: 57 | o Linux kernel >=2.6.10 with ibm-acpi module enabled 58 | (CONFIG_IBM_ACPI) 59 | * For PowerPC support: 60 | o Linux kernel 2.6 with the therm_adt746x ("Support for 61 | thermal management on laptops with ADT 746x chipset" 62 | (THERM_ADT746X)) or therm_windtunnel ("Support for thermal 63 | management on Windtunnel G4s" (THERM_WINDTUNNEL)) module 64 | enabled 65 | * For iMac G5 and other G5s support: 66 | o Linux kernel 2.6 with the Windfarm ("Support for thermal 67 | management on iMac G5" (WINDFARM_PM81)) module enabled 68 | * For hddtemp support: 69 | o hddtemp running in daemon mode 70 | * For Omnibook support: 71 | o Linux kernel 2.6 with the Omnibook module 72 | * For NVIDIA graphics cards support: 73 | o NVIDIA binary driver with libNVCtrl installed (provided 74 | with the nvidia-settings utility) (to enable support MATE 75 | Sensors Applet needs to be configured with the --with-nvidia 76 | flag) 77 | * For sonypi support: 78 | o Linux kernel 2.6 with sonypi module enabled ("Sony Vaio 79 | Programmable I/O Control Device support" (CONFIG_SONYPI)) 80 | 81 | ---------------------------------------------------------------------------- 82 | 83 | Debian, Fedora, Ubuntu and most standard distro users will need to do a 84 | 85 | ./autogen.sh --prefix=/usr 86 | 87 | to ensure proper installation within the correct path. 88 | 89 | 90 | To enable support for NVIDIA GPUs MATE Sensors Applet requires the 91 | standard X11 headers as well as libNVCtrl (supplied by nvidia-settings), 92 | and needs to be compiled with support for NVIDIA GPUs as: 93 | 94 | ./autogen.sh --with-nvidia 95 | 96 | If your X11 headers are in a non-standard location, these can also be 97 | specified as: 98 | 99 | ./autogen.sh --with-nvidia --with-x11=PATH_TO_X11_LIBRARIES 100 | 101 | where PATH_TO_X11_LIBRARIES is the path to your X11 libraries 102 | (such as /usr/include/X11), although in most cases this should not 103 | be needed. 104 | 105 | 106 | [1] http://www.lm-sensors.org/ 107 | [2] http://people.debian.org/~dz/i8k/00-README 108 | [3] http://ibm-acpi.sourceforge.net/ 109 | [4] http://www.guzu.net/linux/hddtemp.php 110 | [5] http://sourceforge.net/projects/omke 111 | [6] ftp://download.nvidia.com/XFree86/nvidia-settings/ 112 | [7] http://www.linux.it/~malattia/wiki/index.php/Sony_drivers 113 | [8] http://www.galago-project.org/ 114 | [9] http://www.uoguelph.ca/~fanguelo/ 115 | [10] http://creativecommons.org/licenses/by-sa/3.0/ 116 | -------------------------------------------------------------------------------- /SensorsApplet.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Run this to generate all the initial makefiles, etc. 3 | 4 | srcdir=`dirname $0` 5 | test -z "$srcdir" && srcdir=. 6 | 7 | PKG_NAME="mate-sensors-applet" 8 | 9 | (test -f $srcdir/configure.ac) || { 10 | echo -n "**Error**: Directory "\`$srcdir\'" does not look like the" 11 | echo " top-level $PKG_NAME directory" 12 | exit 1 13 | } 14 | 15 | which mate-autogen || { 16 | echo "You need to install mate-common" 17 | exit 1 18 | } 19 | 20 | which yelp-build || { 21 | echo "You need to install yelp-tools" 22 | exit 1 23 | } 24 | 25 | REQUIRED_AUTOMAKE_VERSION=1.9 26 | USE_COMMON_DOC_BUILD=yes 27 | 28 | . mate-autogen 29 | -------------------------------------------------------------------------------- /help/C/figures/applet_in_panel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mate-desktop/mate-sensors-applet/9b74dc16d852a40d37f7ce6c236406959fd013e5/help/C/figures/applet_in_panel.png -------------------------------------------------------------------------------- /help/C/legal.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Permission is granted to copy, distribute and/or modify this 4 | document under the terms of the GNU Free Documentation 5 | License (GFDL), Version 1.1 or any later version published 6 | by the Free Software Foundation with no Invariant Sections, 7 | no Front-Cover Texts, and no Back-Cover Texts. You can find 8 | a copy of the GFDL at this link or in the file COPYING-DOCS 10 | distributed with this manual. 11 | 12 | This manual is part of a collection of MATE manuals 13 | distributed under the GFDL. If you want to distribute this 14 | manual separately from the collection, you can do so by 15 | adding a copy of the license to the manual, as described in 16 | section 6 of the license. 17 | 18 | 19 | 20 | Many of the names used by companies to distinguish their 21 | products and services are claimed as trademarks. Where those 22 | names appear in any MATE documentation, and the members of 23 | the MATE Documentation Project are made aware of those 24 | trademarks, then the names are in capital letters or initial 25 | capital letters. 26 | 27 | 28 | 29 | DOCUMENT AND MODIFIED VERSIONS OF THE DOCUMENT ARE PROVIDED 30 | UNDER THE TERMS OF THE GNU FREE DOCUMENTATION LICENSE 31 | WITH THE FURTHER UNDERSTANDING THAT: 32 | 33 | 34 | 35 | DOCUMENT IS PROVIDED ON AN "AS IS" BASIS, 36 | WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR 37 | IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES 38 | THAT THE DOCUMENT OR MODIFIED VERSION OF THE 39 | DOCUMENT IS FREE OF DEFECTS MERCHANTABLE, FIT FOR 40 | A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE 41 | RISK AS TO THE QUALITY, ACCURACY, AND PERFORMANCE 42 | OF THE DOCUMENT OR MODIFIED VERSION OF THE 43 | DOCUMENT IS WITH YOU. SHOULD ANY DOCUMENT OR 44 | MODIFIED VERSION PROVE DEFECTIVE IN ANY RESPECT, 45 | YOU (NOT THE INITIAL WRITER, AUTHOR OR ANY 46 | CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY 47 | SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER 48 | OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS 49 | LICENSE. NO USE OF ANY DOCUMENT OR MODIFIED 50 | VERSION OF THE DOCUMENT IS AUTHORIZED HEREUNDER 51 | EXCEPT UNDER THIS DISCLAIMER; AND 52 | 53 | 54 | 55 | UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL 56 | THEORY, WHETHER IN TORT (INCLUDING NEGLIGENCE), 57 | CONTRACT, OR OTHERWISE, SHALL THE AUTHOR, 58 | INITIAL WRITER, ANY CONTRIBUTOR, OR ANY 59 | DISTRIBUTOR OF THE DOCUMENT OR MODIFIED VERSION 60 | OF THE DOCUMENT, OR ANY SUPPLIER OF ANY OF SUCH 61 | PARTIES, BE LIABLE TO ANY PERSON FOR ANY 62 | DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR 63 | CONSEQUENTIAL DAMAGES OF ANY CHARACTER 64 | INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS 65 | OF GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR 66 | MALFUNCTION, OR ANY AND ALL OTHER DAMAGES OR 67 | LOSSES ARISING OUT OF OR RELATING TO USE OF THE 68 | DOCUMENT AND MODIFIED VERSIONS OF THE DOCUMENT, 69 | EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF 70 | THE POSSIBILITY OF SUCH DAMAGES. 71 | 72 | 73 | 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /help/ChangeLog: -------------------------------------------------------------------------------- 1 | 2005-11-08 Alex Murray 2 | 3 | * Switched to mate-doc-utils 4 | 5 | -------------------------------------------------------------------------------- /help/Makefile.am: -------------------------------------------------------------------------------- 1 | @YELP_HELP_RULES@ 2 | 3 | HELP_ID = mate-sensors-applet 4 | HELP_FILES = index.docbook legal.xml 5 | HELP_MEDIA = figures/applet_in_panel.png 6 | 7 | # Add linguas to be ignored, e.g. IGNORE_HELP_LINGUAS = ca de es fr 8 | IGNORE_HELP_LINGUAS = 9 | HELP_LINGUAS = $(if $(IGNORE_HELP_LINGUAS), \ 10 | $(filter-out $(IGNORE_HELP_LINGUAS),$(subst /,,$(dir $(wildcard */*.po)))), \ 11 | $(subst /,,$(dir $(wildcard */*.po))) ) 12 | 13 | -include $(top_srcdir)/git.mk 14 | -------------------------------------------------------------------------------- /help/sensors-applet.omf.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | manual 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /lib/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Process this file with automake to produce Makefile.in 2 | AM_CPPFLAGS = -DMATELOCALEDIR=\""$(datadir)/locale/"\" \ 3 | -DG_LOG_DOMAIN=\""sensors-applet"\" \ 4 | -DPIXMAPS_DIR=\""$(datadir)/pixmaps/$(PACKAGE)/"\" \ 5 | -DDATADIR=\""$(datadir)"\" \ 6 | -DLIBDIR=\""$(libdir)"\" \ 7 | -DSYSCONFDIR=\""$(sysconfdir)"\" \ 8 | -DPREFIX=\""$(prefix)"\" \ 9 | -I$(top_srcdir) \ 10 | $(GLIB_CFLAGS) \ 11 | $(WARN_CFLAGS) 12 | 13 | LIBS = $(GLIB_LIBS) 14 | 15 | # also build the libsensorsplugin library 16 | lib_LTLIBRARIES = libmate-sensors-applet-plugin.la 17 | 18 | libmate_sensors_applet_plugin_la_SOURCES = sensors-applet-plugin.c 19 | libmate_sensors_applet_plugin_la_LDFLAGS = -export-dynamic 20 | 21 | -include $(top_srcdir)/git.mk 22 | -------------------------------------------------------------------------------- /lib/sensors-applet-plugin.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2005-2009 Alex Murray 3 | * Copyright (C) 2012-2021 MATE Developers 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #include 21 | 22 | #ifdef HAVE_CONFIG_H 23 | #include "config.h" 24 | #endif /* HAVE_CONFIG_H */ 25 | 26 | #ifdef HAVE_UNISTD_H 27 | #include 28 | #endif /* HAVE_UNISTD_H */ 29 | 30 | extern const gchar *plugin_name; 31 | 32 | /* recursive function to find sensors in a given path */ 33 | void sensors_applet_plugin_find_sensors(GList **sensors, 34 | const gchar *path, 35 | SensorsAppletPluginTestSensorFunc test_sensor) { 36 | if (g_file_test(path, G_FILE_TEST_IS_REGULAR)) { 37 | /* also test can actually open file for reading */ 38 | if (access(path, R_OK) == 0) { 39 | test_sensor(sensors, path); 40 | } 41 | } 42 | 43 | /* if is a directory (but not a symlinked dir as this 44 | will lead us in circular loops) descend into it and look 45 | for a sensor dir 46 | */ 47 | if (g_file_test(path, G_FILE_TEST_IS_DIR) && !g_file_test(path, G_FILE_TEST_IS_SYMLINK)) { 48 | GDir *dir; 49 | 50 | if ((dir = g_dir_open(path, 0, NULL)) != NULL) { 51 | const gchar *new_file; 52 | 53 | while(NULL != (new_file = g_dir_read_name(dir))) { 54 | gchar *new_path; 55 | 56 | new_path = g_build_filename(path, new_file, NULL); 57 | sensors_applet_plugin_find_sensors(sensors, new_path, test_sensor); 58 | g_free(new_path); 59 | } 60 | g_dir_close(dir); 61 | } 62 | } 63 | } 64 | 65 | /* for error handling */ 66 | GQuark sensors_applet_plugin_error_quark(void) { 67 | static GQuark quark = 0; 68 | 69 | if (quark == 0) { 70 | gchar *string; 71 | 72 | string = g_strdup_printf("%s-plugin-error", plugin_name); 73 | quark = g_quark_from_string(string); 74 | g_free(string); 75 | } 76 | 77 | return quark; 78 | } 79 | 80 | void sensors_applet_plugin_default_sensor_limits(SensorType type, 81 | gdouble *low_value, 82 | gdouble *high_value) { 83 | 84 | switch (type) { 85 | case TEMP_SENSOR: 86 | *low_value = 20.0; 87 | *high_value = 60.0; 88 | break; 89 | case FAN_SENSOR: 90 | *low_value = 600.0; 91 | *high_value = 3000.0; 92 | break; 93 | default: 94 | *low_value = 0.0; 95 | *high_value = 0.0; 96 | } 97 | } 98 | 99 | void sensors_applet_plugin_add_sensor(GList **sensors, 100 | const gchar *path, 101 | const gchar *id, 102 | const gchar *label, 103 | SensorType type, 104 | gboolean enable, 105 | IconType icon, 106 | const gchar *graph_color) { 107 | 108 | gdouble low_value; 109 | gdouble high_value; 110 | sensors_applet_plugin_default_sensor_limits(type, &low_value, &high_value); 111 | 112 | sensors_applet_plugin_add_sensor_with_limits(sensors, 113 | path, 114 | id, 115 | label, 116 | type, 117 | enable, 118 | low_value, 119 | high_value, 120 | icon, 121 | graph_color); 122 | 123 | } 124 | 125 | void sensors_applet_plugin_add_sensor_with_limits(GList **sensors, 126 | const gchar *path, 127 | const gchar *id, 128 | const gchar *label, 129 | SensorType type, 130 | gboolean enable, 131 | gdouble low_value, 132 | gdouble high_value, 133 | IconType icon, 134 | const gchar *graph_color) { 135 | 136 | SensorsAppletSensorInfo *info; 137 | 138 | info = g_new0 (SensorsAppletSensorInfo, 1); 139 | 140 | info->path = g_strdup(path); 141 | info->id = g_strdup(id); 142 | info->label = g_strdup(label); 143 | info->type = type; 144 | info->enable = enable; 145 | info->low_value = low_value; 146 | info->high_value = high_value; 147 | info->multiplier = 1.0; 148 | info->offset = 0.0; 149 | info->icon = icon; 150 | info->graph_color = g_strdup(graph_color); 151 | 152 | *sensors = g_list_append(*sensors, info); 153 | } 154 | 155 | -------------------------------------------------------------------------------- /makepot: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | PACKAGE=mate-sensors-applet; 4 | 5 | # normal translations 6 | make -C po $PACKAGE.pot && mv po/$PACKAGE.pot . 7 | sed -i "/#, fuzzy/d" $PACKAGE.pot 8 | 9 | # translations for user-quide 10 | rm -f help/$PACKAGE.pot && 11 | make -C help $PACKAGE.pot 12 | -------------------------------------------------------------------------------- /org.mate.applets.SensorsApplet.mate-panel-applet.desktop.in.in: -------------------------------------------------------------------------------- 1 | [Applet Factory] 2 | Id=SensorsAppletFactory 3 | Location=@APPLET_LOCATION@ 4 | InProcess=@APPLET_IN_PROCESS@ 5 | Name=Sensors Applet Factory 6 | Description=Sensors Applet Factory 7 | 8 | [SensorsApplet] 9 | Name=Hardware Sensors Monitor 10 | Description=Displays temperature, fan speed and voltage sensor readings 11 | # Translators: Do NOT translate or transliterate this text (this is an icon file name)! 12 | Icon=mate-sensors-applet 13 | -------------------------------------------------------------------------------- /org.mate.panel.applet.SensorsAppletFactory.service.in: -------------------------------------------------------------------------------- 1 | [D-BUS Service] 2 | Name=org.mate.panel.applet.SensorsAppletFactory 3 | Exec=@LIBEXECDIR@/mate-sensors-applet 4 | -------------------------------------------------------------------------------- /org.mate.sensors-applet.gschema.xml.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 0 5 | Font size in points 6 | 7 | 8 | false 9 | Specify if show or hide sensor units 10 | 11 | 12 | 1 13 | Set if display icons or text labels 14 | 15 | 16 | 0 17 | Set value beside or below label 18 | 19 | 20 | 1 21 | Show temperature in Kelvin, Celsius or Fahrenheit 22 | 23 | 24 | true 25 | Whether to display notifications 26 | 27 | 28 | 2000 29 | Delay (in ms) between refreshes 30 | 31 | 32 | 42 33 | The size of the graph in pixels (width if horizontal, height if vertical) 34 | 35 | 36 | [] 37 | List of sensors 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /org.mate.sensors-applet.sensor.gschema.xml.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | '' 5 | Path to filename 6 | 7 | 8 | '' 9 | Sensor device ids 10 | 11 | 12 | '' 13 | The sensor device interface 14 | 15 | 16 | '' 17 | User defined label 18 | 19 | 20 | true 21 | Whether a sensor is enabled or not 22 | 23 | 24 | 0 25 | Low value 26 | 27 | 28 | 0 29 | High value 30 | 31 | 32 | false 33 | Whether the sensor has its alarm enabled 34 | 35 | 36 | '' 37 | Command to execute when the alarm is activated 38 | 39 | 40 | '' 41 | Command to execute when the alarm is activated 42 | 43 | 44 | 0 45 | How often each alarm should be sounded (in seconds) 46 | 47 | 48 | 0 49 | Used to identify a sensor in a list 50 | 51 | 52 | 1 53 | Multiplier 54 | 55 | 56 | 0 57 | Offset 58 | 59 | 60 | 0 61 | Icon type 62 | 63 | 64 | '#ff0000' 65 | Color of the graph for the sensor 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /pixmaps/Makefile.am: -------------------------------------------------------------------------------- 1 | pixmapsdir = $(datadir)/pixmaps/mate-sensors-applet 2 | pixmaps_DATA = \ 3 | very-low-temp-icon.png \ 4 | low-temp-icon.png \ 5 | normal-temp-icon.png \ 6 | high-temp-icon.png \ 7 | very-high-temp-icon.png 8 | 9 | deviceiconsdir = $(datadir)/icons/hicolor/22x22/devices 10 | deviceicons_DATA = \ 11 | mate-sensors-applet-battery.png \ 12 | mate-sensors-applet-case.png \ 13 | mate-sensors-applet-chip.png \ 14 | mate-sensors-applet-cpu.png \ 15 | mate-sensors-applet-gpu.png \ 16 | mate-sensors-applet-fan.png \ 17 | mate-sensors-applet-drive-harddisk.png \ 18 | mate-sensors-applet-memory.png 19 | 20 | appicondir = $(datadir)/icons/hicolor/48x48/apps 21 | appicon_DATA = mate-sensors-applet.png 22 | 23 | gtk_update_icon_cache = gtk-update-icon-cache -f -t $(datadir)/icons/hicolor 24 | 25 | install-data-hook: update_icon_cache 26 | uninstall-hook: update_icon_cache 27 | update_icon_cache: 28 | @-if test -z "$(DESTDIR)"; then \ 29 | echo "Updating Gtk icon cache."; \ 30 | $(gtk_update_icon_cache); \ 31 | else \ 32 | echo "*** Icon cache not updated. After (un)install, run this:"; \ 33 | echo "*** $(gtk_update_icon_cache)"; \ 34 | fi 35 | 36 | EXTRA_DIST = \ 37 | $(pixmaps_DATA) \ 38 | $(deviceicons_DATA) \ 39 | $(appicon_DATA) 40 | 41 | -include $(top_srcdir)/git.mk 42 | -------------------------------------------------------------------------------- /pixmaps/high-temp-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mate-desktop/mate-sensors-applet/9b74dc16d852a40d37f7ce6c236406959fd013e5/pixmaps/high-temp-icon.png -------------------------------------------------------------------------------- /pixmaps/low-temp-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mate-desktop/mate-sensors-applet/9b74dc16d852a40d37f7ce6c236406959fd013e5/pixmaps/low-temp-icon.png -------------------------------------------------------------------------------- /pixmaps/mate-sensors-applet-battery.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mate-desktop/mate-sensors-applet/9b74dc16d852a40d37f7ce6c236406959fd013e5/pixmaps/mate-sensors-applet-battery.png -------------------------------------------------------------------------------- /pixmaps/mate-sensors-applet-case.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mate-desktop/mate-sensors-applet/9b74dc16d852a40d37f7ce6c236406959fd013e5/pixmaps/mate-sensors-applet-case.png -------------------------------------------------------------------------------- /pixmaps/mate-sensors-applet-chip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mate-desktop/mate-sensors-applet/9b74dc16d852a40d37f7ce6c236406959fd013e5/pixmaps/mate-sensors-applet-chip.png -------------------------------------------------------------------------------- /pixmaps/mate-sensors-applet-cpu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mate-desktop/mate-sensors-applet/9b74dc16d852a40d37f7ce6c236406959fd013e5/pixmaps/mate-sensors-applet-cpu.png -------------------------------------------------------------------------------- /pixmaps/mate-sensors-applet-drive-harddisk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mate-desktop/mate-sensors-applet/9b74dc16d852a40d37f7ce6c236406959fd013e5/pixmaps/mate-sensors-applet-drive-harddisk.png -------------------------------------------------------------------------------- /pixmaps/mate-sensors-applet-fan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mate-desktop/mate-sensors-applet/9b74dc16d852a40d37f7ce6c236406959fd013e5/pixmaps/mate-sensors-applet-fan.png -------------------------------------------------------------------------------- /pixmaps/mate-sensors-applet-gpu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mate-desktop/mate-sensors-applet/9b74dc16d852a40d37f7ce6c236406959fd013e5/pixmaps/mate-sensors-applet-gpu.png -------------------------------------------------------------------------------- /pixmaps/mate-sensors-applet-memory.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mate-desktop/mate-sensors-applet/9b74dc16d852a40d37f7ce6c236406959fd013e5/pixmaps/mate-sensors-applet-memory.png -------------------------------------------------------------------------------- /pixmaps/mate-sensors-applet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mate-desktop/mate-sensors-applet/9b74dc16d852a40d37f7ce6c236406959fd013e5/pixmaps/mate-sensors-applet.png -------------------------------------------------------------------------------- /pixmaps/normal-temp-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mate-desktop/mate-sensors-applet/9b74dc16d852a40d37f7ce6c236406959fd013e5/pixmaps/normal-temp-icon.png -------------------------------------------------------------------------------- /pixmaps/very-high-temp-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mate-desktop/mate-sensors-applet/9b74dc16d852a40d37f7ce6c236406959fd013e5/pixmaps/very-high-temp-icon.png -------------------------------------------------------------------------------- /pixmaps/very-low-temp-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mate-desktop/mate-sensors-applet/9b74dc16d852a40d37f7ce6c236406959fd013e5/pixmaps/very-low-temp-icon.png -------------------------------------------------------------------------------- /plugins/Makefile.am: -------------------------------------------------------------------------------- 1 | NULL= 2 | 3 | DIST_SUBDIRS = \ 4 | acpi \ 5 | dummy \ 6 | udisks2 \ 7 | hddtemp \ 8 | i2c-proc \ 9 | i2c-sys \ 10 | i8k \ 11 | ibm-acpi \ 12 | libsensors \ 13 | mbmon \ 14 | netbsd \ 15 | nvidia \ 16 | omnibook \ 17 | pmu-sys \ 18 | smu-sys \ 19 | sonypi \ 20 | $(NULL) 21 | 22 | SUBDIRS = \ 23 | acpi \ 24 | hddtemp \ 25 | i8k \ 26 | ibm-acpi \ 27 | mbmon \ 28 | omnibook \ 29 | pmu-sys \ 30 | smu-sys \ 31 | sonypi 32 | 33 | if DUMMYPLUGIN 34 | SUBDIRS += dummy 35 | endif 36 | 37 | if UDISKS2 38 | SUBDIRS += udisks2 39 | endif 40 | 41 | if LIBSENSORS 42 | SUBDIRS += libsensors 43 | else 44 | SUBDIRS += i2c-proc i2c-sys 45 | endif 46 | 47 | if NETBSD 48 | SUBDIRS += netbsd 49 | endif 50 | 51 | if NVIDIA 52 | SUBDIRS += nvidia 53 | endif 54 | 55 | -include $(top_srcdir)/git.mk 56 | -------------------------------------------------------------------------------- /plugins/acpi/Makefile.am: -------------------------------------------------------------------------------- 1 | # ACPI plugin 2 | plugindir = $(libdir)/mate-sensors-applet/plugins 3 | 4 | AM_CPPFLAGS = -DMATELOCALEDIR=\""$(datadir)/locale/"\" \ 5 | -DG_LOG_DOMAIN=\""sensors-applet"\" \ 6 | -DPIXMAPS_DIR=\""$(datadir)/pixmaps/$(PACKAGE)/"\" \ 7 | -DDATADIR=\""$(datadir)"\" \ 8 | -DLIBDIR=\""$(libdir)"\" \ 9 | -DSYSCONFDIR=\""$(sysconfdir)"\" \ 10 | -DPREFIX=\""$(prefix)"\" \ 11 | -I$(top_srcdir) \ 12 | $(GLIB_CFLAGS) \ 13 | $(WARN_CFLAGS) 14 | 15 | plugin_LTLIBRARIES = libacpi.la 16 | 17 | libacpi_la_SOURCES = \ 18 | acpi-plugin.h \ 19 | acpi-plugin.c 20 | 21 | libacpi_la_LDFLAGS = $(PLUGIN_LIBTOOL_FLAGS) $(GLIB_LIBS) 22 | libacpi_la_LIBADD = $(top_builddir)/lib/libmate-sensors-applet-plugin.la 23 | 24 | -include $(top_srcdir)/git.mk 25 | -------------------------------------------------------------------------------- /plugins/acpi/acpi-plugin.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2005-2009 Alex Murray 3 | * Copyright (C) 2012-2021 MATE Developers 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifdef HAVE_CONFIG_H 21 | #include 22 | #endif /* HAVE_CONFIG_H */ 23 | 24 | #include 25 | #include 26 | #include 27 | #include "acpi-plugin.h" 28 | 29 | const gchar *plugin_name = "acpi"; 30 | 31 | #define ACPI_THERMAL_ZONE_BASE_DIR "/proc/acpi/thermal_zone" 32 | #define ACPI_THERMAL_BASE_DIR "/proc/acpi/thermal" 33 | 34 | enum { 35 | ACPI_DEVICE_FILE_OPEN_ERROR, 36 | ACPI_DEVICE_FILE_READ_ERROR 37 | }; 38 | 39 | static void acpi_plugin_add_sensor(GList **sensors, const gchar *path) { 40 | gchar *dirname; 41 | gchar *id; 42 | 43 | dirname = g_path_get_dirname(path); 44 | id = g_path_get_basename(dirname); 45 | g_free(dirname); 46 | 47 | sensors_applet_plugin_add_sensor(sensors, 48 | path, 49 | id, 50 | _("CPU"), 51 | TEMP_SENSOR, 52 | TRUE, 53 | CPU_ICON, 54 | DEFAULT_GRAPH_COLOR); 55 | g_free(id); 56 | } 57 | 58 | static void acpi_plugin_test_sensor(GList **sensors, const gchar *path) { 59 | gchar *filename; 60 | filename = g_path_get_basename(path); 61 | 62 | if (g_ascii_strcasecmp(filename, "temperature") == 0 || 63 | g_ascii_strcasecmp(filename, "status") == 0) { 64 | acpi_plugin_add_sensor(sensors, path); 65 | } 66 | g_free(filename); 67 | } 68 | 69 | /* to be called to setup for acpi sensors and returns the list of found sensors */ 70 | static GList *acpi_plugin_init(void) { 71 | GList *sensors = NULL; 72 | 73 | /* call function to recursively look for sensors 74 | starting at the defined base directory */ 75 | sensors_applet_plugin_find_sensors(&sensors, ACPI_THERMAL_ZONE_BASE_DIR, acpi_plugin_test_sensor); 76 | sensors_applet_plugin_find_sensors(&sensors, ACPI_THERMAL_BASE_DIR, acpi_plugin_test_sensor); 77 | return sensors; 78 | } 79 | 80 | static gdouble acpi_plugin_get_sensor_value(const gchar *path, 81 | const gchar *id, 82 | SensorType type, 83 | GError **error) { 84 | 85 | /* to open and access the value of each sensor */ 86 | FILE *fp; 87 | gfloat sensor_value = -1.0f; 88 | gchar units[32]; 89 | 90 | if (NULL == (fp = fopen(path, "r"))) { 91 | g_set_error(error, SENSORS_APPLET_PLUGIN_ERROR, ACPI_DEVICE_FILE_OPEN_ERROR, "Error opening sensor device file %s", path); 92 | return sensor_value; 93 | } 94 | 95 | if (fscanf(fp, "temperature: %f %31s", &sensor_value, units) < 1) { 96 | g_set_error(error, SENSORS_APPLET_PLUGIN_ERROR, ACPI_DEVICE_FILE_READ_ERROR, "Error reading from sensor device file %s", path); 97 | fclose(fp); 98 | return sensor_value; 99 | } 100 | fclose(fp); 101 | 102 | /* need to convert if units are deciKelvin */ 103 | if (g_ascii_strcasecmp(units, "dK") == 0) { 104 | sensor_value = (sensor_value / 10.0) - 273.0; 105 | } 106 | 107 | return (gdouble)sensor_value; 108 | } 109 | 110 | const gchar *sensors_applet_plugin_name(void) 111 | { 112 | return plugin_name; 113 | } 114 | 115 | GList *sensors_applet_plugin_init(void) 116 | { 117 | return acpi_plugin_init(); 118 | } 119 | 120 | gdouble sensors_applet_plugin_get_sensor_value(const gchar *path, 121 | const gchar *id, 122 | SensorType type, 123 | GError **error) { 124 | 125 | return acpi_plugin_get_sensor_value(path, id, type, error); 126 | } 127 | -------------------------------------------------------------------------------- /plugins/acpi/acpi-plugin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2005-2009 Alex Murray 3 | * Copyright (C) 2012-2021 MATE Developers 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifndef ACPI_PLUGIN_H 21 | #define ACPI_PLUGIN_H 22 | 23 | #include 24 | 25 | #endif /* ACPI_PLUGIN_H*/ 26 | -------------------------------------------------------------------------------- /plugins/dummy/Makefile.am: -------------------------------------------------------------------------------- 1 | # Dummy plugin 2 | plugindir = $(libdir)/mate-sensors-applet/plugins 3 | 4 | AM_CPPFLAGS = -DMATELOCALEDIR=\""$(datadir)/locale/"\" \ 5 | -DG_LOG_DOMAIN=\""sensors-applet"\" \ 6 | -DPIXMAPS_DIR=\""$(datadir)/pixmaps/$(PACKAGE)/"\" \ 7 | -DDATADIR=\""$(datadir)"\" \ 8 | -DLIBDIR=\""$(libdir)"\" \ 9 | -DSYSCONFDIR=\""$(sysconfdir)"\" \ 10 | -DPREFIX=\""$(prefix)"\" \ 11 | -I$(top_srcdir) \ 12 | $(GLIB_CFLAGS) \ 13 | $(WARN_CFLAGS) 14 | 15 | 16 | plugin_LTLIBRARIES = libdummy.la 17 | 18 | libdummy_la_SOURCES = \ 19 | dummy-plugin.h \ 20 | dummy-plugin.c 21 | 22 | libdummy_la_LDFLAGS = $(PLUGIN_LIBTOOL_FLAGS) $(GLIB_LIBS) 23 | 24 | libdummy_la_LIBADD = $(top_builddir)/lib/libmate-sensors-applet-plugin.la 25 | 26 | -include $(top_srcdir)/git.mk 27 | -------------------------------------------------------------------------------- /plugins/dummy/dummy-plugin.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 info-cppsp 3 | * Copyright (C) 2005-2009 Alex Murray 4 | * Copyright (C) 2012-2021 MATE Developers 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | /* Dummy plugin to be able to test msa in a VM */ 22 | 23 | #ifdef HAVE_CONFIG_H 24 | #include "config.h" 25 | #endif /* HAVE_CONFIG_H */ 26 | 27 | #include 28 | #include 29 | #include "dummy-plugin.h" 30 | 31 | // remove // from next line for syslog debug 32 | //#define DPDBG 1 33 | 34 | #ifdef DPDBG 35 | #include 36 | #endif 37 | 38 | const gchar *plugin_name = "dummy"; 39 | 40 | static void dummy_plugin_get_sensors(GList **sensors) { 41 | 42 | /* dummy HDD temp sensor */ 43 | sensors_applet_plugin_add_sensor(sensors, 44 | "/sys/devices/platform/it87.656/hwmon/hwmon1/temp2_input", 45 | "temp2", 46 | "CPU", 47 | TEMP_SENSOR, 48 | TRUE, 49 | CPU_ICON, 50 | DEFAULT_GRAPH_COLOR); 51 | 52 | /* dummy HDD temp sensor */ 53 | sensors_applet_plugin_add_sensor(sensors, 54 | "/sys/devices/platform/it87.656/hwmon/hwmon1/fan1_input", 55 | "fan1", 56 | "fan1", 57 | FAN_SENSOR, 58 | TRUE, 59 | FAN_ICON, 60 | DEFAULT_GRAPH_COLOR); 61 | 62 | /* dummy HDD temp sensor */ 63 | sensors_applet_plugin_add_sensor(sensors, 64 | "HDD 2154884654-5648HG-546821", 65 | "Disk Temperature", 66 | "HDD 2154884654", 67 | TEMP_SENSOR, 68 | TRUE, 69 | HDD_ICON, 70 | DEFAULT_GRAPH_COLOR); 71 | 72 | } 73 | 74 | /* this is the function called every refresh cycle */ 75 | static gdouble dummy_plugin_get_sensor_value(const gchar *path, 76 | const gchar *id, 77 | SensorType type, 78 | GError **error) { 79 | 80 | switch (type) { 81 | case TEMP_SENSOR: 82 | return (gdouble) (rand() % 40 + 20); 83 | break; 84 | 85 | case FAN_SENSOR: 86 | return (gdouble) (rand() % 3000); 87 | break; 88 | 89 | default: 90 | g_assert_not_reached(); 91 | } 92 | 93 | } 94 | 95 | /* API functions */ 96 | const gchar *sensors_applet_plugin_name(void) { 97 | return plugin_name; 98 | } 99 | 100 | static GList *dummy_plugin_init(void) { 101 | GList *sensors = NULL; 102 | 103 | /* init random number generation */ 104 | srand(time(NULL)); 105 | 106 | dummy_plugin_get_sensors(&sensors); 107 | 108 | return sensors; 109 | } 110 | 111 | GList *sensors_applet_plugin_init(void) { 112 | return dummy_plugin_init(); 113 | } 114 | 115 | gdouble sensors_applet_plugin_get_sensor_value(const gchar *path, 116 | const gchar *id, 117 | SensorType type, 118 | GError **error) { 119 | 120 | return dummy_plugin_get_sensor_value(path, id, type, error); 121 | } 122 | -------------------------------------------------------------------------------- /plugins/dummy/dummy-plugin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 info-cppsp 3 | * Copyright (C) 2005-2009 Alex Murray 4 | * Copyright (C) 2012-2021 MATE Developers 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef DUMMY_PLUGIN_H 22 | #define DUMMY_PLUGIN_H 23 | 24 | #include 25 | 26 | #endif /* DUMMY_PLUGIN_H */ 27 | -------------------------------------------------------------------------------- /plugins/hddtemp/Makefile.am: -------------------------------------------------------------------------------- 1 | # HDDTEMP plugin 2 | plugindir = $(libdir)/mate-sensors-applet/plugins 3 | 4 | AM_CPPFLAGS = -DMATELOCALEDIR=\""$(datadir)/locale/"\" \ 5 | -DG_LOG_DOMAIN=\""sensors-applet"\" \ 6 | -DPIXMAPS_DIR=\""$(datadir)/pixmaps/$(PACKAGE)/"\" \ 7 | -DDATADIR=\""$(datadir)"\" \ 8 | -DLIBDIR=\""$(libdir)"\" \ 9 | -DSYSCONFDIR=\""$(sysconfdir)"\" \ 10 | -DPREFIX=\""$(prefix)"\" \ 11 | -I$(top_srcdir) \ 12 | $(GLIB_CFLAGS) \ 13 | $(WARN_CFLAGS) 14 | 15 | plugin_LTLIBRARIES = libhddtemp.la 16 | 17 | libhddtemp_la_SOURCES = \ 18 | hddtemp-plugin.h \ 19 | hddtemp-plugin.c 20 | 21 | libhddtemp_la_LDFLAGS = $(PLUGIN_LIBTOOL_FLAGS) $(GLIB_LIBS) 22 | libhddtemp_la_LIBADD = $(top_builddir)/lib/libmate-sensors-applet-plugin.la 23 | 24 | -include $(top_srcdir)/git.mk 25 | -------------------------------------------------------------------------------- /plugins/hddtemp/hddtemp-plugin.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2005-2009 Alex Murray 3 | * Copyright (C) 2012-2021 MATE Developers 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifdef HAVE_CONFIG_H 21 | #include "config.h" 22 | #endif /* HAVE_CONFIG_H */ 23 | 24 | #ifdef HAVE_SYS_TYPES_H 25 | #include 26 | #endif 27 | 28 | #ifdef HAVE_SYS_SOCKET_H 29 | #include 30 | #endif 31 | 32 | #ifdef HAVE_NETINET_IN_H 33 | #include 34 | #endif 35 | 36 | #ifdef HAVE_ARPA_INET_H 37 | #include 38 | #endif 39 | 40 | #ifdef HAVE_STRING_H 41 | #include 42 | #endif 43 | 44 | #include 45 | #include 46 | #include "hddtemp-plugin.h" 47 | 48 | const gchar *plugin_name = "hddtemp"; 49 | 50 | #define HDDTEMP_SERVER_IP_ADDRESS "127.0.0.1" 51 | #define HDDTEMP_PORT_NUMBER 7634 52 | #define HDDTEMP_OUTPUT_BUFFER_LENGTH 1024 53 | 54 | enum { 55 | HDDTEMP_SOCKET_OPEN_ERROR, 56 | HDDTEMP_SOCKET_CONNECT_ERROR, 57 | HDDTEMP_GIOCHANNEL_ERROR, 58 | HDDTEMP_GIOCHANNEL_READ_ERROR 59 | }; 60 | 61 | static gchar buffer[HDDTEMP_OUTPUT_BUFFER_LENGTH]; 62 | 63 | static const gchar *hddtemp_plugin_query_hddtemp_daemon(GError **error) { 64 | guint output_length = 0; 65 | static gboolean first_run = TRUE; 66 | 67 | struct sockaddr_in address; 68 | static gint64 previous_query_time; 69 | gint64 current_query_time; 70 | 71 | if (first_run) { 72 | // initialise previous time 73 | previous_query_time = g_get_monotonic_time (); 74 | } 75 | current_query_time = g_get_monotonic_time (); 76 | 77 | /* only actually query if more than 60 seconds has elapsed as 78 | hddtemp daemon will only actually send a new value if is > 60 79 | seconds */ 80 | if (first_run || current_query_time - previous_query_time > G_TIME_SPAN_MINUTE) { 81 | int sockfd; 82 | ssize_t n; 83 | gchar *pc; 84 | 85 | previous_query_time = current_query_time; 86 | 87 | if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1) { 88 | // couldn't open socket 89 | g_set_error(error, SENSORS_APPLET_PLUGIN_ERROR, HDDTEMP_SOCKET_OPEN_ERROR, "Error opening socket for hddtemp"); 90 | return NULL; 91 | } 92 | 93 | address.sin_family = AF_INET; 94 | address.sin_addr.s_addr = inet_addr(HDDTEMP_SERVER_IP_ADDRESS); 95 | address.sin_port = htons(HDDTEMP_PORT_NUMBER); 96 | 97 | if (connect(sockfd, (struct sockaddr *)&address, (socklen_t)sizeof(address)) == -1) { 98 | g_set_error(error, SENSORS_APPLET_PLUGIN_ERROR, HDDTEMP_SOCKET_CONNECT_ERROR, "Error connecting to hddtemp daemon on port %i on %s", htons(HDDTEMP_PORT_NUMBER), HDDTEMP_SERVER_IP_ADDRESS); 99 | close(sockfd); 100 | return NULL; 101 | } 102 | memset(buffer, 0, sizeof(buffer)); 103 | pc = buffer; 104 | while ((n = read(sockfd, pc, sizeof(buffer) - output_length)) > 0) { 105 | output_length += n; 106 | pc += n; 107 | } 108 | /* always null terminate the end of the buffer */ 109 | buffer[MIN(output_length, sizeof(buffer) - 1)] = '\0'; 110 | close(sockfd); 111 | first_run = FALSE; 112 | } 113 | 114 | return buffer; 115 | } 116 | 117 | static void hddtemp_plugin_get_sensors(GList **sensors) { 118 | GError *error = NULL; 119 | const gchar *hddtemp_output; 120 | gchar **output_vector = NULL, **pv; 121 | 122 | hddtemp_output = hddtemp_plugin_query_hddtemp_daemon(&error); 123 | 124 | if (error) { 125 | g_error_free(error); 126 | return; 127 | } 128 | 129 | if (hddtemp_output[0] != '|') { 130 | g_debug("Error in format of string returned from hddtemp daemon: char at [0] should be \"|\", instead whole output is: \"%s\"", hddtemp_output); 131 | return; 132 | } 133 | 134 | /* for each sensor the output will contain four strings ie 135 | |/dev/hda|WDC WD800JB-00ETA0|32|C||/dev/hdb|???|ERR|*| 136 | note the repetition -----^ */ 137 | 138 | /* 139 | pv[0 + 5*n] empty 140 | pv[1 + 5*n] device name 141 | pv[2 + 5*n] disk label 142 | pv[3 + 5*n] temperature 143 | pv[4 + 5*n] unit 144 | pv[5 + 5*n] empty 145 | */ 146 | 147 | pv = output_vector = g_strsplit(hddtemp_output, "|", -1); 148 | 149 | while(pv[1] != NULL) { 150 | if (g_strcmp0(pv[2], "") != 0 && 151 | g_strcmp0(pv[3], "") != 0 && 152 | g_strcmp0(pv[4], "") != 0 && 153 | (!(g_ascii_strcasecmp(pv[2], "???") == 0 || 154 | g_ascii_strcasecmp(pv[3], "ERR") == 0 || 155 | g_ascii_strcasecmp(pv[4], "*") == 0))) { 156 | 157 | sensors_applet_plugin_add_sensor(sensors, 158 | pv[1], // must be dynamically allocated 159 | pv[1], // must be dynamically allocated 160 | pv[2], // must be dynamically allocated 161 | TEMP_SENSOR, 162 | FALSE, 163 | HDD_ICON, 164 | DEFAULT_GRAPH_COLOR); 165 | } 166 | pv += 5; 167 | } 168 | g_strfreev(output_vector); 169 | } 170 | 171 | /* to be called to setup for hddtemp sensors */ 172 | static GList *hddtemp_plugin_init(void) { 173 | GList *sensors = NULL; 174 | hddtemp_plugin_get_sensors(&sensors); 175 | return sensors; 176 | } 177 | 178 | /* returns the value of the sensor_list at the given iter, or if an 179 | error occurs, instatiates error with an error message */ 180 | static gdouble hddtemp_plugin_get_sensor_value(const gchar *path, 181 | const gchar *id, 182 | SensorType type, 183 | GError **error) { 184 | 185 | const gchar *hddtemp_output; 186 | gchar **output_vector = NULL, **pv; 187 | 188 | gfloat sensor_value = -1.0f; 189 | 190 | hddtemp_output = hddtemp_plugin_query_hddtemp_daemon(error); 191 | 192 | if (*error) { 193 | return sensor_value; 194 | } 195 | 196 | if (hddtemp_output[0] != '|') { 197 | g_debug("Error in format of string returned from hddtemp daemon: char at [0] should be \"|\", instead whole output is: \"%s\"", hddtemp_output); 198 | return sensor_value; 199 | } 200 | 201 | /* for each sensor the output will contain four strings ie 202 | |/dev/hda|WDC WD800JB-00ETA0|32|C||/dev/hdb|???|ERR|*| 203 | note the repetition -----^ 204 | 205 | pv[0 + 5*n] empty 206 | pv[1 + 5*n] device name 207 | pv[2 + 5*n] disk label 208 | pv[3 + 5*n] temperature 209 | pv[4 + 5*n] unit 210 | pv[5 + 5*n] empty 211 | */ 212 | 213 | pv = output_vector = g_strsplit(hddtemp_output, "|", -1); 214 | 215 | while(pv[1] != NULL) { 216 | if (g_ascii_strcasecmp(pv[1], path) == 0) { 217 | sensor_value = (gfloat)(g_ascii_strtod(pv[3], NULL)); 218 | 219 | /* always return sensor values in celsius */ 220 | if (pv[4][0] == 'F') { 221 | sensor_value = (sensor_value - 32.0) * 5.0 / 9.0; 222 | } 223 | break; 224 | } 225 | pv += 5; 226 | } 227 | g_strfreev(output_vector); 228 | 229 | return (gdouble)sensor_value; 230 | } 231 | 232 | const gchar *sensors_applet_plugin_name(void) 233 | { 234 | return plugin_name; 235 | } 236 | 237 | GList *sensors_applet_plugin_init(void) 238 | { 239 | return hddtemp_plugin_init(); 240 | } 241 | 242 | gdouble sensors_applet_plugin_get_sensor_value(const gchar *path, 243 | const gchar *id, 244 | SensorType type, 245 | GError **error) { 246 | return hddtemp_plugin_get_sensor_value(path, id, type, error); 247 | } 248 | -------------------------------------------------------------------------------- /plugins/hddtemp/hddtemp-plugin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2005-2009 Alex Murray 3 | * Copyright (C) 2012-2021 MATE Developers 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifndef HDDTEMP_PLUGIN_H 21 | #define HDDTEMP_PLUGIN_H 22 | 23 | #include 24 | 25 | #endif /* HDDTEMP_PLUGIN_H */ 26 | -------------------------------------------------------------------------------- /plugins/i2c-proc/Makefile.am: -------------------------------------------------------------------------------- 1 | # I2C-PROC plugin 2 | plugindir = $(libdir)/mate-sensors-applet/plugins 3 | 4 | AM_CPPFLAGS = -DMATELOCALEDIR=\""$(datadir)/locale/"\" \ 5 | -DG_LOG_DOMAIN=\""sensors-applet"\" \ 6 | -DPIXMAPS_DIR=\""$(datadir)/pixmaps/$(PACKAGE)/"\" \ 7 | -DDATADIR=\""$(datadir)"\" \ 8 | -DLIBDIR=\""$(libdir)"\" \ 9 | -DSYSCONFDIR=\""$(sysconfdir)"\" \ 10 | -DPREFIX=\""$(prefix)"\" \ 11 | -I$(top_srcdir) \ 12 | $(GLIB_CFLAGS) \ 13 | $(WARN_CFLAGS) 14 | 15 | plugin_LTLIBRARIES = libi2c-proc.la 16 | 17 | libi2c_proc_la_SOURCES = \ 18 | i2c-proc-plugin.h \ 19 | i2c-proc-plugin.c 20 | 21 | libi2c_proc_la_LDFLAGS = $(PLUGIN_LIBTOOL_FLAGS) $(GLIB_LIBS) 22 | libi2c_proc_la_LIBADD = $(top_builddir)/lib/libmate-sensors-applet-plugin.la 23 | 24 | -include $(top_srcdir)/git.mk 25 | -------------------------------------------------------------------------------- /plugins/i2c-proc/i2c-proc-plugin.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2005-2009 Alex Murray 3 | * Copyright (C) 2012-2021 MATE Developers 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifdef HAVE_CONFIG_H 21 | #include 22 | #endif /* HAVE_CONFIG_H */ 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include "i2c-proc-plugin.h" 29 | 30 | const gchar *plugin_name = "i2c-proc"; 31 | 32 | #define I2C_PROC_BASE_DIR "/proc/sys/dev/sensors" 33 | 34 | enum { 35 | I2C_PROC_DEVICE_FILE_OPEN_ERROR, 36 | I2C_PROC_DEVICE_FILE_READ_ERROR 37 | }; 38 | 39 | static void i2c_proc_plugin_add_sensor(GList **sensors, const gchar *path) { 40 | gchar *filename; 41 | gchar *label; 42 | gboolean enable; 43 | SensorType sensor_type; 44 | IconType icon_type = GENERIC_ICON; 45 | 46 | filename = g_path_get_basename(path); 47 | 48 | /* setup temp2 as CPU sensor and enable it */ 49 | if (g_ascii_strcasecmp(filename, "temp2") == 0) { 50 | sensor_type = TEMP_SENSOR; 51 | label = g_strdup(_("CPU")); 52 | enable = TRUE; 53 | icon_type = CPU_ICON; 54 | } else { 55 | label = g_strdup(filename); 56 | 57 | switch(filename[0]) { 58 | case 'c': /* currents are "curr?" */ 59 | sensor_type = CURRENT_SENSOR; 60 | break; 61 | case 'f': /* fans are "fan?" */ 62 | sensor_type = FAN_SENSOR; 63 | icon_type = FAN_ICON; 64 | break; 65 | case 'i': /* voltages are "in?" */ 66 | sensor_type = VOLTAGE_SENSOR; 67 | break; 68 | case 't': /* temps are "temp?" */ 69 | sensor_type = TEMP_SENSOR; 70 | break; 71 | case 'v': /* vids are just vid */ 72 | sensor_type = VOLTAGE_SENSOR; 73 | break; 74 | default: 75 | /* SHOULDN'T BE ABLE TO GET HERE!! */ 76 | g_debug("error in i2c-proc sensor detection code - unhandled sensor filename %s", filename); 77 | g_free(filename); 78 | g_free(label); 79 | return; 80 | } 81 | /* disable all other sensors */ 82 | enable = FALSE; 83 | } 84 | 85 | sensors_applet_plugin_add_sensor(sensors, 86 | path, 87 | filename, 88 | label, 89 | sensor_type, 90 | enable, 91 | icon_type, 92 | DEFAULT_GRAPH_COLOR); 93 | 94 | g_free(filename); 95 | g_free(label); 96 | } 97 | 98 | static void i2c_proc_plugin_test_sensor(GList **sensors, const gchar *path) { 99 | gchar *filename; 100 | 101 | filename = g_path_get_basename(path); 102 | /* see if filename starts with any of the sensor prefixes */ 103 | if (g_str_has_prefix(filename, "curr") || 104 | (g_str_has_prefix(filename, "fan") && 105 | !g_str_has_prefix(filename, "fan_div")) || 106 | g_str_has_prefix(filename, "in") || 107 | g_str_has_prefix(filename, "temp") || 108 | g_str_has_prefix(filename, "vid")) { 109 | 110 | i2c_proc_plugin_add_sensor(sensors, path); 111 | } 112 | g_free(filename); 113 | 114 | } 115 | 116 | /* to be called to setup for proc sensors */ 117 | static GList *i2c_proc_plugin_init(void) { 118 | GList *sensors = NULL; 119 | 120 | /* call function to recursively look for sensors 121 | starting at the defined base directory */ 122 | sensors_applet_plugin_find_sensors(&sensors, I2C_PROC_BASE_DIR, i2c_proc_plugin_test_sensor); 123 | return sensors; 124 | } 125 | 126 | static gdouble i2c_proc_plugin_get_sensor_value(const gchar *path, 127 | const gchar *id, 128 | SensorType type, 129 | GError **error) { 130 | 131 | /* to open and access the value of each sensor */ 132 | FILE *fp; 133 | gfloat float1, float2, float3; 134 | gint int1, int2; 135 | 136 | gfloat sensor_value = -1.0; 137 | 138 | gchar *old_locale = NULL; 139 | 140 | /* always use C locale */ 141 | if (NULL == (old_locale = setlocale(LC_NUMERIC, "C"))) { 142 | g_warning("Could not change locale to C locale for reading i2c-proc device files.. will try regardless"); 143 | } 144 | 145 | if (NULL == (fp = fopen(path, "r"))) { 146 | g_set_error(error, SENSORS_APPLET_PLUGIN_ERROR, I2C_PROC_DEVICE_FILE_OPEN_ERROR, "Error opening sensor device file %s", path); 147 | } else { 148 | switch (type) { 149 | case CURRENT_SENSOR: 150 | if (fscanf(fp, "%f %f %f", &float1, &float2, &float3) != 3) { 151 | g_set_error(error, SENSORS_APPLET_PLUGIN_ERROR, I2C_PROC_DEVICE_FILE_READ_ERROR, "Error reading from sensor device file %s", path); 152 | } else { 153 | sensor_value = float3; 154 | } 155 | break; 156 | 157 | case FAN_SENSOR: 158 | if (fscanf(fp, "%d %d", &int1, &int2) != 2) { 159 | g_set_error(error, SENSORS_APPLET_PLUGIN_ERROR, I2C_PROC_DEVICE_FILE_READ_ERROR, "Error reading from sensor device file %s", path); 160 | } else { 161 | sensor_value = (gfloat)int2; 162 | } 163 | break; 164 | 165 | case VOLTAGE_SENSOR: 166 | /* is it CPU_VID or IN */ 167 | switch(id[0]) { 168 | case 'i': 169 | if (fscanf(fp, "%f %f %f", &float1, &float2, &float3) != 3) { 170 | g_set_error(error, SENSORS_APPLET_PLUGIN_ERROR, I2C_PROC_DEVICE_FILE_READ_ERROR, "Error reading from sensor device file %s", path); 171 | } else { 172 | sensor_value = float3; 173 | } 174 | break; 175 | 176 | case 'v': 177 | /* want first value in file as float */ 178 | if (fscanf(fp, "%f", &float1) != 1) { 179 | g_set_error(error, SENSORS_APPLET_PLUGIN_ERROR, I2C_PROC_DEVICE_FILE_READ_ERROR, "Error reading from sensor device file %s", path); 180 | } else { 181 | sensor_value = float1; 182 | } 183 | break; 184 | default: 185 | g_debug("error in i2c-proc sensor read value function code - unhandled sensor id %s", id); 186 | g_set_error(error, SENSORS_APPLET_PLUGIN_ERROR, I2C_PROC_DEVICE_FILE_READ_ERROR, "Error reading from sensor device file %s", path); 187 | } 188 | break; 189 | 190 | case TEMP_SENSOR: 191 | if (fscanf(fp, "%f %f %f", &float1, &float2, &float3) != 3) { 192 | g_set_error(error, SENSORS_APPLET_PLUGIN_ERROR, I2C_PROC_DEVICE_FILE_READ_ERROR, "Error reading from sensor device file %s", path); 193 | } else { 194 | sensor_value = float3; 195 | } 196 | break; 197 | } /* end switch */ 198 | fclose(fp); 199 | } 200 | 201 | if (NULL != old_locale) { 202 | setlocale(LC_NUMERIC, old_locale); 203 | } 204 | 205 | return (gdouble)sensor_value; 206 | } 207 | 208 | const gchar *sensors_applet_plugin_name(void) 209 | { 210 | return plugin_name; 211 | } 212 | 213 | GList *sensors_applet_plugin_init(void) 214 | { 215 | return i2c_proc_plugin_init(); 216 | } 217 | 218 | gdouble sensors_applet_plugin_get_sensor_value(const gchar *path, 219 | const gchar *id, 220 | SensorType type, 221 | GError **error) { 222 | 223 | return i2c_proc_plugin_get_sensor_value(path, id, type, error); 224 | } 225 | -------------------------------------------------------------------------------- /plugins/i2c-proc/i2c-proc-plugin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2005-2009 Alex Murray 3 | * Copyright (C) 2012-2021 MATE Developers 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifndef SENSORS_LIST_I2C_PROC_H 21 | #define SENSORS_LIST_I2C_PROC_H 22 | 23 | #include 24 | 25 | #endif /* SENSORS_LIST_I2C_PROC_H */ 26 | -------------------------------------------------------------------------------- /plugins/i2c-sys/Makefile.am: -------------------------------------------------------------------------------- 1 | # I2C-SYS plugin 2 | plugindir = $(libdir)/mate-sensors-applet/plugins 3 | 4 | AM_CPPFLAGS = -DMATELOCALEDIR=\""$(datadir)/locale/"\" \ 5 | -DG_LOG_DOMAIN=\""sensors-applet"\" \ 6 | -DPIXMAPS_DIR=\""$(datadir)/pixmaps/$(PACKAGE)/"\" \ 7 | -DDATADIR=\""$(datadir)"\" \ 8 | -DLIBDIR=\""$(libdir)"\" \ 9 | -DSYSCONFDIR=\""$(sysconfdir)"\" \ 10 | -DPREFIX=\""$(prefix)"\" \ 11 | -I$(top_srcdir) \ 12 | $(GLIB_CFLAGS) \ 13 | $(WARN_CFLAGS) 14 | 15 | plugin_LTLIBRARIES = libi2c-sys.la 16 | 17 | libi2c_sys_la_SOURCES = \ 18 | i2c-sys-plugin.h \ 19 | i2c-sys-plugin.c 20 | 21 | libi2c_sys_la_LDFLAGS = $(PLUGIN_LIBTOOL_FLAGS) $(GLIB_LIBS) 22 | libi2c_sys_la_LIBADD = $(top_builddir)/lib/libmate-sensors-applet-plugin.la 23 | 24 | -include $(top_srcdir)/git.mk 25 | -------------------------------------------------------------------------------- /plugins/i2c-sys/i2c-sys-plugin.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2005-2009 Alex Murray 3 | * Copyright (C) 2012-2021 MATE Developers 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifdef HAVE_CONFIG_H 21 | #include 22 | #endif /* HAVE_CONFIG_H */ 23 | 24 | #include 25 | #include 26 | #include 27 | #include "i2c-sys-plugin.h" 28 | 29 | const gchar *plugin_name = "i2c-sys"; 30 | 31 | #define I2C_SYS_BASE_DIR "/sys" 32 | 33 | enum { 34 | I2C_SYS_DEVICE_FILE_OPEN_ERROR, 35 | I2C_SYS_DEVICE_FILE_READ_ERROR 36 | }; 37 | 38 | static void i2c_sys_plugin_add_sensor(GList **sensors, const gchar *path) { 39 | gchar *filename; 40 | gchar *id; 41 | gchar *label; 42 | gboolean enable; 43 | guint sensor_type; 44 | IconType icon_type = GENERIC_ICON; 45 | 46 | filename = g_path_get_basename(path); 47 | 48 | /* setup temp2 as CPU sensor and enable it */ 49 | if (g_ascii_strcasecmp(filename, "temp2_input") == 0) { 50 | id = g_strndup(filename, 5); 51 | label = g_strdup(_("CPU")); 52 | sensor_type = TEMP_SENSOR; 53 | enable = TRUE; 54 | icon_type = CPU_ICON; 55 | } else { 56 | switch(filename[0]) { 57 | case 'c': /* either current or cpu?_vid sensor */ 58 | if (filename[1] == 'u') { /* currents are curr?_input */ 59 | id = g_strndup(filename, 5); 60 | label = g_strndup(filename, 5); 61 | sensor_type = CURRENT_SENSOR; 62 | } else { /* cpu_vid is cpu?_vid */ 63 | id = g_strdup(filename); 64 | label = g_strdup(filename); 65 | sensor_type = VOLTAGE_SENSOR; 66 | } 67 | break; 68 | 69 | case 'f': /* fans are "fan?_input" */ 70 | id = g_strndup(filename, 4); 71 | label = g_strndup(filename, 4); 72 | sensor_type = FAN_SENSOR; 73 | icon_type = FAN_ICON; 74 | break; 75 | 76 | case 't': /* temps are "temp?_input" */ 77 | id = g_strndup(filename, 5); 78 | label = g_strndup(filename, 5); 79 | sensor_type = TEMP_SENSOR; 80 | break; 81 | 82 | case 'i': /* voltages are "in?_input" */ 83 | id = g_strndup(filename, 3); 84 | label = g_strndup(filename, 3); 85 | sensor_type = VOLTAGE_SENSOR; 86 | break; 87 | 88 | default: 89 | /* SHOULDN'T BE ABLE * TO GET HERE!! */ 90 | g_warning("filename:\"%s\" begins with a charater that is not covered by this switch statement... not adding sensor", filename); 91 | g_free(filename); 92 | 93 | return; 94 | } 95 | 96 | /* disable all other sensors */ 97 | enable = FALSE; 98 | } 99 | 100 | sensors_applet_plugin_add_sensor(sensors, 101 | path, 102 | id, 103 | label, 104 | sensor_type, 105 | enable, 106 | icon_type, 107 | DEFAULT_GRAPH_COLOR); 108 | 109 | g_free(filename); 110 | g_free(id); 111 | g_free(label); 112 | } 113 | 114 | static void i2c_sys_plugin_test_sensor(GList **sensors, const gchar *path) { 115 | gchar *filename; 116 | 117 | filename = g_path_get_basename(path); 118 | 119 | if ((g_str_has_suffix(filename, "_input") && 120 | (g_str_has_prefix(filename, "temp") || 121 | g_str_has_prefix(filename, "fan") || 122 | g_str_has_prefix(filename, "curr") || 123 | g_str_has_prefix(filename, "in"))) || 124 | (g_str_has_prefix(filename, "cpu") && 125 | (g_str_has_suffix(filename, "_vid")))) { 126 | 127 | i2c_sys_plugin_add_sensor(sensors, path); 128 | } 129 | 130 | g_free(filename); 131 | } 132 | 133 | /* to be called to setup for sys sensors */ 134 | static GList *i2c_sys_plugin_init(void) { 135 | GList *sensors = NULL; 136 | 137 | /* call function to recursively look for sensors 138 | starting at the defined base directory */ 139 | sensors_applet_plugin_find_sensors(&sensors, 140 | I2C_SYS_BASE_DIR, 141 | i2c_sys_plugin_test_sensor); 142 | return sensors; 143 | } 144 | 145 | static gdouble i2c_sys_plugin_get_sensor_value(const gchar *path, 146 | const gchar *id, 147 | SensorType type, 148 | GError **error) { 149 | 150 | /* to open and access the value of each sensor */ 151 | FILE *fp; 152 | gfloat sensor_value; 153 | 154 | if (NULL == (fp = fopen(path, "r"))) { 155 | g_set_error(error, SENSORS_APPLET_PLUGIN_ERROR, I2C_SYS_DEVICE_FILE_OPEN_ERROR, "Error opening sensor device file %s", path); 156 | return -1.0; 157 | } 158 | 159 | if (fscanf(fp, "%f", &sensor_value) != 1) { 160 | g_set_error(error, SENSORS_APPLET_PLUGIN_ERROR, I2C_SYS_DEVICE_FILE_READ_ERROR, "Error reading from sensor device file %s", path); 161 | fclose(fp); 162 | return -1.0; 163 | } 164 | fclose(fp); 165 | 166 | if (type != FAN_SENSOR) { 167 | sensor_value /= 1000.0; 168 | } 169 | 170 | return (gdouble)sensor_value; 171 | } 172 | 173 | const gchar *sensors_applet_plugin_name(void) 174 | { 175 | return plugin_name; 176 | } 177 | 178 | GList *sensors_applet_plugin_init(void) 179 | { 180 | return i2c_sys_plugin_init(); 181 | } 182 | 183 | gdouble sensors_applet_plugin_get_sensor_value(const gchar *path, 184 | const gchar *id, 185 | SensorType type, 186 | GError **error) { 187 | 188 | return i2c_sys_plugin_get_sensor_value(path, id, type, error); 189 | } 190 | -------------------------------------------------------------------------------- /plugins/i2c-sys/i2c-sys-plugin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2005-2009 Alex Murray 3 | * Copyright (C) 2012-2021 MATE Developers 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifndef I2C_SYS_PLUGIN_H 21 | #define I2C_SYS_PLUGIN_H 22 | 23 | #include 24 | 25 | #endif /* I2C_SYS_PLUGIN_H*/ 26 | -------------------------------------------------------------------------------- /plugins/i8k/Makefile.am: -------------------------------------------------------------------------------- 1 | # I8K plugin 2 | plugindir = $(libdir)/mate-sensors-applet/plugins 3 | 4 | AM_CPPFLAGS = -DMATELOCALEDIR=\""$(datadir)/locale/"\" \ 5 | -DG_LOG_DOMAIN=\""sensors-applet"\" \ 6 | -DPIXMAPS_DIR=\""$(datadir)/pixmaps/$(PACKAGE)/"\" \ 7 | -DDATADIR=\""$(datadir)"\" \ 8 | -DLIBDIR=\""$(libdir)"\" \ 9 | -DSYSCONFDIR=\""$(sysconfdir)"\" \ 10 | -DPREFIX=\""$(prefix)"\" \ 11 | -I$(top_srcdir) \ 12 | $(GLIB_CFLAGS) \ 13 | $(WARN_CFLAGS) 14 | 15 | plugin_LTLIBRARIES = libi8k.la 16 | 17 | libi8k_la_SOURCES = \ 18 | i8k-plugin.h \ 19 | i8k-plugin.c 20 | 21 | libi8k_la_LDFLAGS = $(PLUGIN_LIBTOOL_FLAGS) $(GLIB_LIBS) 22 | libi8k_la_LIBADD = $(top_builddir)/lib/libmate-sensors-applet-plugin.la 23 | 24 | -include $(top_srcdir)/git.mk 25 | -------------------------------------------------------------------------------- /plugins/i8k/i8k-plugin.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2005-2009 Alex Murray 3 | * Copyright (C) 2012-2021 MATE Developers 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifdef HAVE_CONFIG_H 21 | #include 22 | #endif /* HAVE_CONFIG_H */ 23 | 24 | #include 25 | #include 26 | #include 27 | #include "i8k-plugin.h" 28 | 29 | const gchar *plugin_name = "i8k"; 30 | 31 | #define I8K_DEVICE_PATH "/proc/i8k" 32 | #define I8K_DEVICE_FILE "i8k" 33 | 34 | enum { 35 | I8K_DEVICE_FILE_OPEN_ERROR, 36 | I8K_DEVICE_FILE_READ_ERROR 37 | }; 38 | 39 | static void i8k_plugin_setup_manually(GList **sensors) { 40 | if (g_file_test(I8K_DEVICE_PATH, G_FILE_TEST_EXISTS)) { 41 | /* with i8k have only 3 fixed sensors, all accessed 42 | from the I8K_DEVICE_PATH */ 43 | sensors_applet_plugin_add_sensor(sensors, 44 | I8K_DEVICE_PATH, 45 | "temp1", 46 | _("CPU"), 47 | TEMP_SENSOR, 48 | TRUE, 49 | CPU_ICON, 50 | DEFAULT_GRAPH_COLOR); 51 | 52 | sensors_applet_plugin_add_sensor(sensors, 53 | I8K_DEVICE_PATH, 54 | "fan1", 55 | _("FAN1"), 56 | FAN_SENSOR, 57 | FALSE, 58 | FAN_ICON, 59 | DEFAULT_GRAPH_COLOR); 60 | 61 | sensors_applet_plugin_add_sensor(sensors, 62 | I8K_DEVICE_PATH, 63 | "fan2", 64 | _("FAN2"), 65 | FAN_SENSOR, 66 | FALSE, 67 | FAN_ICON, 68 | DEFAULT_GRAPH_COLOR); 69 | } 70 | } 71 | 72 | /* to be called externally to setup for i8k sensors */ 73 | static GList *i8k_plugin_init(void) { 74 | GList *sensors = NULL; 75 | 76 | i8k_plugin_setup_manually(&sensors); 77 | 78 | return sensors; 79 | } 80 | 81 | static 82 | gdouble i8k_plugin_get_sensor_value(const gchar *path, 83 | const gchar *id, 84 | SensorType type, 85 | GError **error) { 86 | 87 | /* to open and access the value of each sensor */ 88 | FILE *fp; 89 | gint cpu_temp, fan1_status, fan2_status, fan1_rpm, fan2_rpm; 90 | gint sensor_value; 91 | gint space_count, file_length; 92 | 93 | if (NULL == (fp = fopen(path, "r"))) { 94 | g_set_error(error, SENSORS_APPLET_PLUGIN_ERROR, I8K_DEVICE_FILE_OPEN_ERROR, "Error opening sensor device file %s", path); 95 | return -1.0; 96 | } 97 | 98 | space_count = 0; 99 | file_length = 0; 100 | 101 | /* count spaces but stop if have counted 100 characters and 102 | still not found a space (to avoid infinite loop if file 103 | format error) */ 104 | while (file_length < 100 && space_count < 3) { 105 | if (fgetc(fp) == ' ') { 106 | space_count++; 107 | } 108 | file_length++; 109 | } 110 | 111 | if (fscanf(fp, "%d %d %d %d %d", &cpu_temp, &fan1_status, &fan2_status, &fan1_rpm, &fan2_rpm) != 5) { 112 | g_set_error(error, SENSORS_APPLET_PLUGIN_ERROR, I8K_DEVICE_FILE_READ_ERROR, "Error reading from sensor device file %s", path); 113 | fclose(fp); 114 | return -1.0; 115 | } 116 | fclose(fp); 117 | 118 | switch (type) { 119 | case TEMP_SENSOR: 120 | sensor_value = cpu_temp; 121 | break; 122 | 123 | case FAN_SENSOR: 124 | switch (id[3]) { 125 | case '1': 126 | sensor_value = fan1_rpm; 127 | break; 128 | 129 | case '2': 130 | sensor_value = fan2_rpm; 131 | break; 132 | 133 | default: 134 | g_error("Error in i8k sensor get value function code for id %s", id); 135 | g_set_error(error, SENSORS_APPLET_PLUGIN_ERROR, I8K_DEVICE_FILE_READ_ERROR, "Error reading from sensor device file %s", path); 136 | return -1.0; 137 | } 138 | break; 139 | 140 | default: 141 | g_error("Unknown sensor type passed as parameter to i8k sensor interface, cannot get value for this sensor"); 142 | g_set_error(error, SENSORS_APPLET_PLUGIN_ERROR, I8K_DEVICE_FILE_READ_ERROR, "Error reading from sensor device file %s", path); 143 | return -1.0; 144 | } // end switch (sensor_type) 145 | 146 | return (gdouble)sensor_value; 147 | 148 | } 149 | 150 | const gchar *sensors_applet_plugin_name(void) 151 | { 152 | return plugin_name; 153 | } 154 | 155 | GList *sensors_applet_plugin_init(void) 156 | { 157 | return i8k_plugin_init(); 158 | } 159 | 160 | gdouble sensors_applet_plugin_get_sensor_value(const gchar *path, 161 | const gchar *id, 162 | SensorType type, 163 | GError **error) { 164 | 165 | return i8k_plugin_get_sensor_value(path, id, type, error); 166 | } 167 | -------------------------------------------------------------------------------- /plugins/i8k/i8k-plugin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2005-2009 Alex Murray 3 | * Copyright (C) 2012-2021 MATE Developers 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifndef I8K_PLUGIN_H 21 | #define I8K_PLUGIN_H 22 | 23 | #include 24 | 25 | #endif /* I8K_PLUGIN_H */ 26 | -------------------------------------------------------------------------------- /plugins/ibm-acpi/Makefile.am: -------------------------------------------------------------------------------- 1 | # IBM-ACPI plugin 2 | plugindir = $(libdir)/mate-sensors-applet/plugins 3 | 4 | AM_CPPFLAGS = -DMATELOCALEDIR=\""$(datadir)/locale/"\" \ 5 | -DG_LOG_DOMAIN=\""sensors-applet"\" \ 6 | -DPIXMAPS_DIR=\""$(datadir)/pixmaps/$(PACKAGE)/"\" \ 7 | -DDATADIR=\""$(datadir)"\" \ 8 | -DLIBDIR=\""$(libdir)"\" \ 9 | -DSYSCONFDIR=\""$(sysconfdir)"\" \ 10 | -DPREFIX=\""$(prefix)"\" \ 11 | -I$(top_srcdir) \ 12 | $(GLIB_CFLAGS) \ 13 | $(WARN_CFLAGS) 14 | 15 | plugin_LTLIBRARIES = libibm-acpi.la 16 | 17 | libibm_acpi_la_SOURCES = \ 18 | ibm-acpi-plugin.h \ 19 | ibm-acpi-plugin.c 20 | 21 | libibm_acpi_la_LDFLAGS = $(PLUGIN_LIBTOOL_FLAGS) $(GLIB_LIBS) 22 | libibm_acpi_la_LIBADD = $(top_builddir)/lib/libmate-sensors-applet-plugin.la 23 | 24 | -include $(top_srcdir)/git.mk 25 | -------------------------------------------------------------------------------- /plugins/ibm-acpi/ibm-acpi-plugin.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2005-2009 Alex Murray 3 | * Copyright (C) 2012-2021 MATE Developers 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifdef HAVE_CONFIG_H 21 | #include "config.h" 22 | #endif /* HAVE_CONFIG_H */ 23 | 24 | #include 25 | #include 26 | #include 27 | #include "ibm-acpi-plugin.h" 28 | 29 | const gchar *plugin_name = "ibm-acpi"; 30 | 31 | #define IBM_ACPI_TEMPERATURE_FILE "/proc/acpi/ibm/thermal" 32 | #define IBM_ACPI_FAN_FILE "/proc/acpi/ibm/fan" 33 | 34 | /* sensor id's */ 35 | #define CPU "CPU" 36 | #define MPCI "mPCI" 37 | #define HDD "HDD" 38 | #define GPU "GPU" 39 | #define BAT0 "BAT0" 40 | #define BAT1 "BAT1" 41 | #define FAN "FAN" 42 | 43 | enum { 44 | IBM_ACPI_FILE_OPEN_ERROR, 45 | IBM_ACPI_FILE_READ_ERROR 46 | }; 47 | 48 | static void ibm_acpi_plugin_setup_manually(GList **sensors) { 49 | if (g_file_test(IBM_ACPI_TEMPERATURE_FILE, G_FILE_TEST_EXISTS)) { 50 | gchar *label; 51 | 52 | /* with Ibm_Acpi have 8 fixed sensors, all accessed 53 | from the IBM_ACPI_TEMPERATURE_FILE */ 54 | sensors_applet_plugin_add_sensor(sensors, 55 | IBM_ACPI_TEMPERATURE_FILE, 56 | CPU, 57 | _(CPU), 58 | TEMP_SENSOR, 59 | TRUE, 60 | CPU_ICON, 61 | DEFAULT_GRAPH_COLOR); 62 | 63 | sensors_applet_plugin_add_sensor(sensors, 64 | IBM_ACPI_TEMPERATURE_FILE, 65 | MPCI, 66 | _("MiniPCI"), 67 | TEMP_SENSOR, 68 | FALSE, 69 | GENERIC_ICON, 70 | DEFAULT_GRAPH_COLOR); 71 | 72 | sensors_applet_plugin_add_sensor(sensors, 73 | IBM_ACPI_TEMPERATURE_FILE, 74 | HDD, 75 | _(HDD), 76 | TEMP_SENSOR, 77 | FALSE, 78 | HDD_ICON, 79 | DEFAULT_GRAPH_COLOR); 80 | 81 | sensors_applet_plugin_add_sensor(sensors, 82 | IBM_ACPI_TEMPERATURE_FILE, 83 | GPU, 84 | _(GPU), 85 | TEMP_SENSOR, 86 | FALSE, 87 | GPU_ICON, 88 | DEFAULT_GRAPH_COLOR); 89 | 90 | label = g_strdup_printf("%s %d", _("Battery"), 0); 91 | sensors_applet_plugin_add_sensor(sensors, 92 | IBM_ACPI_TEMPERATURE_FILE, 93 | BAT0, 94 | label, 95 | TEMP_SENSOR, 96 | FALSE, 97 | BATTERY_ICON, 98 | DEFAULT_GRAPH_COLOR); 99 | 100 | g_free(label); 101 | 102 | label = g_strdup_printf("%s %d", _("Battery"), 0); 103 | sensors_applet_plugin_add_sensor(sensors, 104 | IBM_ACPI_TEMPERATURE_FILE, 105 | BAT1, 106 | label, 107 | TEMP_SENSOR, 108 | FALSE, 109 | BATTERY_ICON, 110 | DEFAULT_GRAPH_COLOR); 111 | 112 | g_free(label); 113 | } 114 | 115 | if (g_file_test(IBM_ACPI_FAN_FILE, G_FILE_TEST_EXISTS)) { 116 | sensors_applet_plugin_add_sensor(sensors, 117 | IBM_ACPI_FAN_FILE, 118 | FAN, 119 | _("Fan"), 120 | FAN_SENSOR, 121 | FALSE, 122 | FAN_ICON, 123 | DEFAULT_GRAPH_COLOR); 124 | 125 | } 126 | } 127 | 128 | /* to be called externally to setup for ibm_acpi sensors */ 129 | static 130 | GList *ibm_acpi_plugin_init(void) { 131 | GList *sensors = NULL; 132 | 133 | ibm_acpi_plugin_setup_manually(&sensors); 134 | 135 | return sensors; 136 | } 137 | 138 | static 139 | gdouble ibm_acpi_plugin_get_sensor_value(const gchar *path, 140 | const gchar *id, 141 | SensorType type, 142 | GError **error) { 143 | 144 | /* to open and access the value of each sensor */ 145 | FILE *fp; 146 | gint sensor_value = 0; 147 | gint cpu_temp, minipci_temp, hdd_temp, gpu_temp, bat0_temp, bat1_temp, unknown0, unknown1; 148 | gint fan_speed; 149 | 150 | if (NULL == (fp = fopen(path, "r"))) { 151 | g_set_error(error, SENSORS_APPLET_PLUGIN_ERROR, IBM_ACPI_FILE_OPEN_ERROR, "Error opening sensor device file %s", path); 152 | return -1.0; 153 | } 154 | 155 | switch (type) { 156 | case TEMP_SENSOR: 157 | if (fscanf(fp, "temperatures: %d %d %d %d %d %d %d %d", &cpu_temp, &minipci_temp, &hdd_temp, &gpu_temp, &bat0_temp, &unknown0, &bat1_temp, &unknown1) != 8) { 158 | g_set_error(error, SENSORS_APPLET_PLUGIN_ERROR, IBM_ACPI_FILE_READ_ERROR, "Error reading from sensor device file %s", path); 159 | fclose(fp); 160 | return -1.0; 161 | } 162 | 163 | if (g_ascii_strcasecmp(id, CPU) == 0) { 164 | sensor_value = cpu_temp; 165 | } else if (g_ascii_strcasecmp(id, MPCI) == 0) { 166 | sensor_value = minipci_temp; 167 | } else if (g_ascii_strcasecmp(id, HDD) == 0) { 168 | sensor_value = hdd_temp; 169 | } else if (g_ascii_strcasecmp(id, GPU) == 0) { 170 | sensor_value = gpu_temp; 171 | } else if (g_ascii_strcasecmp(id, BAT0) == 0) { 172 | sensor_value = bat0_temp; 173 | } else if (g_ascii_strcasecmp(id, BAT1) == 0) { 174 | sensor_value = bat1_temp; 175 | } 176 | break; 177 | 178 | case FAN_SENSOR: 179 | /*fscanf(fp, "%*[^\n]");*/ /* Skip to the End of the Line */ 180 | /*fscanf(fp, "%*1[\n]");*/ /* Skip One Newline */ 181 | if (fscanf(fp, "%*[^\n]%*1[\n]speed: %d", &fan_speed) != 1) { 182 | g_set_error(error, SENSORS_APPLET_PLUGIN_ERROR, IBM_ACPI_FILE_READ_ERROR, "Error reading from sensor device file %s", path); 183 | fclose(fp); 184 | return -1.0; 185 | } 186 | 187 | if (g_ascii_strcasecmp(id, "FAN") == 0) { 188 | sensor_value = fan_speed; 189 | } 190 | break; 191 | 192 | default: 193 | g_error("Unknown sensor type passed as parameter to ibm-acpi sensor interface, cannot get value for this sensor"); 194 | g_set_error(error, SENSORS_APPLET_PLUGIN_ERROR, IBM_ACPI_FILE_READ_ERROR, "Error reading from sensor device file %s", path); 195 | fclose(fp); 196 | return -1.0; 197 | } 198 | 199 | fclose(fp); 200 | 201 | return (gdouble)sensor_value; 202 | 203 | } 204 | 205 | const gchar *sensors_applet_plugin_name(void) 206 | { 207 | return plugin_name; 208 | } 209 | 210 | GList *sensors_applet_plugin_init(void) 211 | { 212 | return ibm_acpi_plugin_init(); 213 | } 214 | 215 | gdouble sensors_applet_plugin_get_sensor_value(const gchar *path, 216 | const gchar *id, 217 | SensorType type, 218 | GError **error) { 219 | 220 | return ibm_acpi_plugin_get_sensor_value(path, id, type, error); 221 | } 222 | -------------------------------------------------------------------------------- /plugins/ibm-acpi/ibm-acpi-plugin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2005-2009 Alex Murray 3 | * Copyright (C) 2012-2021 MATE Developers 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifndef IBM_ACPI_PLUGIN_H 21 | #define IBM_ACPI_PLUGIN_H 22 | 23 | #include 24 | 25 | #endif /* IBM_ACPI_PLUGIN_H */ 26 | 27 | -------------------------------------------------------------------------------- /plugins/libsensors/Makefile.am: -------------------------------------------------------------------------------- 1 | plugindir = $(libdir)/mate-sensors-applet/plugins 2 | 3 | # libsensors plugin 4 | AM_CPPFLAGS = -DMATELOCALEDIR=\""$(datadir)/locale/"\" \ 5 | -DG_LOG_DOMAIN=\""sensors-applet"\" \ 6 | -DPIXMAPS_DIR=\""$(datadir)/pixmaps/$(PACKAGE)/"\" \ 7 | -DDATADIR=\""$(datadir)"\" \ 8 | -DLIBDIR=\""$(libdir)"\" \ 9 | -DSYSCONFDIR=\""$(sysconfdir)"\" \ 10 | -DPREFIX=\""$(prefix)"\" \ 11 | -I$(top_srcdir) \ 12 | $(GLIB_CFLAGS) \ 13 | $(LIBSENSORS_CFLAGS) \ 14 | $(WARN_CFLAGS) 15 | 16 | plugin_LTLIBRARIES = liblibsensors.la 17 | 18 | liblibsensors_la_SOURCES = \ 19 | libsensors-plugin.h \ 20 | libsensors-plugin.c 21 | 22 | liblibsensors_la_LDFLAGS = $(PLUGIN_LIBTOOL_FLAGS) $(GLIB_LIBS) $(LIBSENSORS_LIBS) 23 | liblibsensors_la_LIBADD = $(top_builddir)/lib/libmate-sensors-applet-plugin.la 24 | 25 | -include $(top_srcdir)/git.mk 26 | -------------------------------------------------------------------------------- /plugins/libsensors/libsensors-plugin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2005-2009 Alex Murray 3 | * Copyright (C) 2012-2021 MATE Developers 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifndef LIBSENSORS_SENSORS_INTERFACE_H 21 | #define LIBSENSORS_SENSORS_INTERFACE_H 22 | 23 | #include 24 | 25 | #endif /* LIBSENSORS_SENSORS_INTERFACE_H*/ 26 | -------------------------------------------------------------------------------- /plugins/mbmon/Makefile.am: -------------------------------------------------------------------------------- 1 | # MBMON plugin 2 | plugindir = $(libdir)/mate-sensors-applet/plugins 3 | 4 | AM_CPPFLAGS = -DMATELOCALEDIR=\""$(datadir)/locale/"\" \ 5 | -DG_LOG_DOMAIN=\""sensors-applet"\" \ 6 | -DPIXMAPS_DIR=\""$(datadir)/pixmaps/$(PACKAGE)/"\" \ 7 | -DDATADIR=\""$(datadir)"\" \ 8 | -DLIBDIR=\""$(libdir)"\" \ 9 | -DSYSCONFDIR=\""$(sysconfdir)"\" \ 10 | -DPREFIX=\""$(prefix)"\" \ 11 | -I$(top_srcdir) \ 12 | $(GLIB_CFLAGS) \ 13 | $(WARN_CFLAGS) 14 | 15 | plugin_LTLIBRARIES = libmbmon.la 16 | 17 | libmbmon_la_SOURCES = \ 18 | mbmon-plugin.h \ 19 | mbmon-plugin.c 20 | 21 | libmbmon_la_LDFLAGS = $(PLUGIN_LIBTOOL_FLAGS) $(GLIB_LIBS) 22 | libmbmon_la_LIBADD = $(top_builddir)/lib/libmate-sensors-applet-plugin.la 23 | 24 | -include $(top_srcdir)/git.mk 25 | -------------------------------------------------------------------------------- /plugins/mbmon/mbmon-plugin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 Daniele Napolitano 3 | * Copyright (C) 2005-2009 Alex Murray 4 | * Copyright (C) 2012-2021 MATE Developers 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | */ 20 | 21 | #ifndef MBMON_PLUGIN_H 22 | #define MBMON_PLUGIN_H 23 | 24 | #include 25 | 26 | #endif /* MBMON_PLUGIN_H */ 27 | -------------------------------------------------------------------------------- /plugins/netbsd/Makefile.am: -------------------------------------------------------------------------------- 1 | # NetBSD plugin 2 | plugindir = $(libdir)/mate-sensors-applet/plugins 3 | 4 | AM_CPPFLAGS = -DMATELOCALEDIR=\""$(datadir)/locale/"\" \ 5 | -DG_LOG_DOMAIN=\""sensors-applet"\" \ 6 | -DPIXMAPS_DIR=\""$(datadir)/pixmaps/$(PACKAGE)/"\" \ 7 | -DDATADIR=\""$(datadir)"\" \ 8 | -DLIBDIR=\""$(libdir)"\" \ 9 | -DSYSCONFDIR=\""$(sysconfdir)"\" \ 10 | -DPREFIX=\""$(prefix)"\" \ 11 | -I$(top_srcdir) \ 12 | $(GLIB_CFLAGS) \ 13 | $(WARN_CFLAGS) 14 | 15 | 16 | plugin_LTLIBRARIES = libnetbsd.la 17 | 18 | libnetbsd_la_SOURCES = \ 19 | netbsd-plugin.h \ 20 | netbsd-plugin.c 21 | 22 | libnetbsd_la_LDFLAGS = $(PLUGIN_LIBTOOL_FLAGS) $(GLIB_LIBS) -lprop 23 | 24 | libnetbsd_la_LIBADD = $(top_builddir)/lib/libmate-sensors-applet-plugin.la 25 | 26 | -include $(top_srcdir)/git.mk 27 | -------------------------------------------------------------------------------- /plugins/netbsd/netbsd-plugin.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jared McNeill 3 | * Copyright (C) 2012-2021 MATE Developers 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifdef HAVE_CONFIG_H 21 | #include "config.h" 22 | #endif /* HAVE_CONFIG_H */ 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | #include "netbsd-plugin.h" 30 | 31 | static int sysmon_fd = -1; 32 | 33 | static gdouble netbsd_plugin_get_sensor_value(const gchar *path, 34 | const gchar *id, 35 | SensorType type, 36 | GError **error) { 37 | 38 | prop_dictionary_t dict; 39 | prop_array_t array; 40 | prop_object_iterator_t iter, siter; 41 | prop_object_t obj, sobj; 42 | const gchar *desc = NULL, *state = NULL; 43 | gdouble sensor_val = -1.0f; 44 | int64_t val; 45 | 46 | if (prop_dictionary_recv_ioctl(sysmon_fd, ENVSYS_GETDICTIONARY, &dict) == -1) 47 | return sensor_val; 48 | 49 | iter = prop_dictionary_iterator(dict); 50 | while ((obj = prop_object_iterator_next(iter)) != NULL) { 51 | if (strcmp(path, prop_dictionary_keysym_cstring_nocopy(obj)) != 0) 52 | continue; 53 | 54 | array = prop_dictionary_get_keysym(dict, obj); 55 | siter = prop_array_iterator(array); 56 | while ((sobj = prop_object_iterator_next(siter)) != NULL) { 57 | if (prop_dictionary_get_cstring_nocopy(sobj, "description", &desc) == false) 58 | continue; 59 | if (strcmp(id, desc) != 0) 60 | continue; 61 | 62 | prop_dictionary_get_cstring_nocopy(sobj, "state", &state); 63 | prop_dictionary_get_int64(sobj, "cur-value", &val); 64 | 65 | if (strcmp(state, "valid") == 0) { 66 | switch (type) { 67 | case TEMP_SENSOR: 68 | /* K to C */ 69 | sensor_val = ((val - 273150000) / 1000000.0); 70 | break; 71 | case FAN_SENSOR: 72 | /* RPM */ 73 | sensor_val = (gdouble)val; 74 | break; 75 | case VOLTAGE_SENSOR: 76 | /* uV to V */ 77 | sensor_val = val / 1000000.0; 78 | break; 79 | default: 80 | break; 81 | } 82 | } 83 | break; 84 | } 85 | prop_object_iterator_release(siter); 86 | break; 87 | } 88 | prop_object_iterator_release(iter); 89 | 90 | prop_object_release(dict); 91 | 92 | return sensor_val; 93 | } 94 | 95 | static IconType netbsd_plugin_get_sensor_icon(const gchar *desc) { 96 | IconType icontype = GENERIC_ICON; 97 | 98 | if (strcasestr(desc, "cpu") != NULL) 99 | icontype = CPU_ICON; 100 | else if (strcasestr(desc, "gpu") != NULL) 101 | icontype = GPU_ICON; 102 | else if (strcasestr(desc, "batt") != NULL) 103 | icontype = BATTERY_ICON; 104 | else if (strcasestr(desc, "mem") != NULL) 105 | icontype = MEMORY_ICON; 106 | else if (strcasestr(desc, "disk") != NULL || strcasestr(desc, "hdd") != NULL) 107 | icontype = HDD_ICON; 108 | 109 | return icontype; 110 | } 111 | 112 | static void netbsd_plugin_get_sensors(GList **sensors) { 113 | prop_dictionary_t dict; 114 | prop_array_t array; 115 | prop_object_iterator_t iter, siter; 116 | prop_object_t obj, sobj; 117 | 118 | sysmon_fd = open("/dev/sysmon", O_RDONLY); 119 | if (sysmon_fd == -1) 120 | return; 121 | 122 | if (prop_dictionary_recv_ioctl(sysmon_fd, ENVSYS_GETDICTIONARY, &dict) == -1) { 123 | close(sysmon_fd); 124 | return; 125 | } 126 | 127 | iter = prop_dictionary_iterator(dict); 128 | while ((obj = prop_object_iterator_next(iter)) != NULL) { 129 | const gchar *path = prop_dictionary_keysym_cstring_nocopy(obj); 130 | array = prop_dictionary_get_keysym(dict, obj); 131 | siter = prop_array_iterator(array); 132 | while ((sobj = prop_object_iterator_next(siter)) != NULL) { 133 | const gchar *type = NULL, *desc = NULL; 134 | if (prop_dictionary_get_cstring_nocopy(sobj, "type", &type) == false) 135 | continue; 136 | if (prop_dictionary_get_cstring_nocopy(sobj, "description", &desc) == false) 137 | continue; 138 | 139 | SensorType sensortype; 140 | if (strcmp(type, "Fan") == 0) 141 | sensortype = FAN_SENSOR; 142 | else if (strcmp(type, "Temperature") == 0) 143 | sensortype = TEMP_SENSOR; 144 | else if (strcmp(type, "Voltage AC") == 0 || strcmp(type, "Voltage DC") == 0) 145 | sensortype = VOLTAGE_SENSOR; 146 | else 147 | continue; 148 | 149 | IconType icontype = netbsd_plugin_get_sensor_icon(desc); 150 | 151 | sensors_applet_plugin_add_sensor(sensors, 152 | g_strdup(path), 153 | g_strdup(desc), 154 | g_strdup(desc), 155 | sensortype, 156 | TRUE, 157 | icontype, 158 | DEFAULT_GRAPH_COLOR); 159 | } 160 | prop_object_iterator_release(siter); 161 | } 162 | prop_object_iterator_release(iter); 163 | 164 | prop_object_release(dict); 165 | } 166 | 167 | static GList *netbsd_plugin_init(void) { 168 | GList *sensors = NULL; 169 | 170 | netbsd_plugin_get_sensors(&sensors); 171 | 172 | return sensors; 173 | } 174 | 175 | /* API functions */ 176 | const gchar *sensors_applet_plugin_name(void) { 177 | return "netbsd"; 178 | } 179 | 180 | GList *sensors_applet_plugin_init(void) { 181 | return netbsd_plugin_init(); 182 | } 183 | 184 | gdouble sensors_applet_plugin_get_sensor_value(const gchar *path, 185 | const gchar *id, 186 | SensorType type, 187 | GError **error) { 188 | 189 | return netbsd_plugin_get_sensor_value(path, id, type, error); 190 | } 191 | -------------------------------------------------------------------------------- /plugins/netbsd/netbsd-plugin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jared McNeill 3 | * Copyright (C) 2012-2021 MATE Developers 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifndef NETBSD_PLUGIN_H 21 | #define NETBSD_PLUGIN_H 22 | 23 | #include 24 | 25 | #endif /* NETBSD_PLUGIN_H */ 26 | -------------------------------------------------------------------------------- /plugins/nvidia/Makefile.am: -------------------------------------------------------------------------------- 1 | # NVIDIA plugin 2 | plugindir = $(libdir)/mate-sensors-applet/plugins 3 | 4 | AM_CPPFLAGS = -DMATELOCALEDIR=\""$(datadir)/locale/"\" \ 5 | -DG_LOG_DOMAIN=\""sensors-applet"\" \ 6 | -DPIXMAPS_DIR=\""$(datadir)/pixmaps/$(PACKAGE)/"\" \ 7 | -DDATADIR=\""$(datadir)"\" \ 8 | -DLIBDIR=\""$(libdir)"\" \ 9 | -DSYSCONFDIR=\""$(sysconfdir)"\" \ 10 | -DPREFIX=\""$(prefix)"\" \ 11 | -I$(top_srcdir) \ 12 | $(GLIB_CFLAGS) \ 13 | $(NVIDIA_CFLAGS) \ 14 | $(WARN_CFLAGS) 15 | 16 | plugin_LTLIBRARIES = libnvidia.la 17 | 18 | libnvidia_la_SOURCES = \ 19 | nvidia-plugin.h \ 20 | nvidia-plugin.c 21 | 22 | libnvidia_la_LDFLAGS = $(PLUGIN_LIBTOOL_FLAGS) $(GLIB_LIBS) $(NVIDIA_LIBS) 23 | libnvidia_la_LIBADD = $(top_builddir)/lib/libmate-sensors-applet-plugin.la 24 | 25 | -include $(top_srcdir)/git.mk 26 | -------------------------------------------------------------------------------- /plugins/nvidia/nvidia-plugin.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2006 Sven Peter 3 | * Copyright (C) 2006 Alex Murray 4 | * Copyright (C) 2012-2021 MATE Developers 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifdef HAVE_CONFIG_H 22 | #include "config.h" 23 | #endif /* HAVE_CONFIG_H */ 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | #include 30 | #include 31 | #include "nvidia-plugin.h" 32 | 33 | const gchar *plugin_name = "nvidia"; 34 | 35 | #define THERMAL_SENSOR_TEMP "SensorTemp" 36 | #define THERMAL_COOLER_LEVEL "CoolerLevel" 37 | #define GPU_CORE_TEMP "CoreTemp" 38 | #define AMBIENT_TEMP "AmbientTemp" 39 | 40 | /* global variables */ 41 | Display *nvidia_sensors_dpy; /* the connection to the X server */ 42 | 43 | /* returns the value of the sensor */ 44 | static gdouble nvidia_plugin_get_sensor_value(const gchar *path, 45 | const gchar *id, 46 | SensorType type, 47 | GError **error) { 48 | 49 | Bool res; 50 | int temp; 51 | int i; 52 | 53 | i = g_ascii_strtoll(id + strlen("GPU"), NULL, 10); 54 | if (g_ascii_strcasecmp(path, THERMAL_SENSOR_TEMP) == 0) { 55 | res = XNVCTRLQueryTargetAttribute(nvidia_sensors_dpy, 56 | NV_CTRL_TARGET_TYPE_THERMAL_SENSOR, 57 | i, 58 | 0, 59 | NV_CTRL_THERMAL_SENSOR_READING, 60 | &temp); 61 | 62 | } else if (g_ascii_strcasecmp(path, THERMAL_COOLER_LEVEL) == 0) { 63 | res = XNVCTRLQueryTargetAttribute(nvidia_sensors_dpy, 64 | NV_CTRL_TARGET_TYPE_COOLER, 65 | i, 66 | 0, 67 | NV_CTRL_THERMAL_COOLER_LEVEL, 68 | &temp); 69 | 70 | } else if (g_ascii_strcasecmp(path, GPU_CORE_TEMP) == 0) { 71 | res = XNVCTRLQueryTargetAttribute(nvidia_sensors_dpy, 72 | NV_CTRL_TARGET_TYPE_GPU, 73 | i, 74 | 0, 75 | NV_CTRL_GPU_CORE_TEMPERATURE, 76 | &temp); 77 | 78 | } else if (g_ascii_strcasecmp(path, AMBIENT_TEMP) == 0) { 79 | res = XNVCTRLQueryTargetAttribute(nvidia_sensors_dpy, 80 | NV_CTRL_TARGET_TYPE_GPU, 81 | i, 82 | 0, 83 | NV_CTRL_AMBIENT_TEMPERATURE, 84 | &temp); 85 | 86 | } else { 87 | g_set_error(error, SENSORS_APPLET_PLUGIN_ERROR, 0, "Invalid path string passed to nvidia_plugin_get_sensor_value"); 88 | return 0; 89 | } 90 | 91 | if (res != True) { 92 | /* when res isn't true something went wrong */ 93 | g_set_error(error, SENSORS_APPLET_PLUGIN_ERROR, 0, "XNVCTRLQueryAttribute returned false"); 94 | return 0; 95 | } 96 | 97 | /* convert the int to gdouble and return it */ 98 | return (gdouble)temp; 99 | } 100 | 101 | /* creates the connection to the X server and checks whether the 102 | * NV-CONTROL extension is loaded */ 103 | static GList *nvidia_plugin_init(void) { 104 | int dummy; 105 | int event_base, error_base; 106 | GList *sensors = NULL; 107 | 108 | /* create the connection to the X server */ 109 | if (!(nvidia_sensors_dpy = XOpenDisplay(NULL))) { 110 | /* no connection to the X server avaible */ 111 | return sensors; 112 | } 113 | 114 | /* check if the NV-CONTROL extension is available on this X 115 | * server - if so add the two sensors if they exist */ 116 | if (XNVCTRLQueryExtension(nvidia_sensors_dpy, &event_base, &error_base)) { 117 | int i, cnt; 118 | 119 | if (XNVCTRLQueryTargetCount(nvidia_sensors_dpy, 120 | NV_CTRL_TARGET_TYPE_THERMAL_SENSOR, 121 | &cnt)) { 122 | 123 | for (i = 0; i < cnt; i++) { 124 | gchar *id = g_strdup_printf("GPU%d%s", i, THERMAL_SENSOR_TEMP); 125 | 126 | sensors_applet_plugin_add_sensor(&sensors, 127 | THERMAL_SENSOR_TEMP, 128 | id, 129 | _("GPU"), 130 | TEMP_SENSOR, 131 | TRUE, 132 | GPU_ICON, 133 | DEFAULT_GRAPH_COLOR); 134 | 135 | g_free(id); 136 | } 137 | } 138 | 139 | if (XNVCTRLQueryTargetCount(nvidia_sensors_dpy, 140 | NV_CTRL_TARGET_TYPE_COOLER, 141 | &cnt)) { 142 | 143 | for (i = 0; i < cnt; i++) { 144 | gchar *id = g_strdup_printf("GPU%d%s", i, THERMAL_COOLER_LEVEL); 145 | 146 | sensors_applet_plugin_add_sensor(&sensors, 147 | THERMAL_COOLER_LEVEL, 148 | id, 149 | _("GPU"), 150 | FAN_SENSOR, 151 | TRUE, 152 | FAN_ICON, 153 | DEFAULT_GRAPH_COLOR); 154 | 155 | g_free(id); 156 | } 157 | } 158 | 159 | if (XNVCTRLQueryTargetCount(nvidia_sensors_dpy, 160 | NV_CTRL_TARGET_TYPE_GPU, 161 | &cnt)) { 162 | 163 | for (i = 0; i < cnt; i++) { 164 | if (XNVCTRLQueryTargetAttribute(nvidia_sensors_dpy, 165 | NV_CTRL_TARGET_TYPE_GPU, 166 | i, 167 | 0, NV_CTRL_GPU_CORE_TEMPERATURE, &dummy)) { 168 | 169 | gchar *id = g_strdup_printf("GPU%d%s", i, GPU_CORE_TEMP); 170 | 171 | sensors_applet_plugin_add_sensor(&sensors, 172 | GPU_CORE_TEMP, 173 | id, 174 | _("GPU"), 175 | TEMP_SENSOR, 176 | TRUE, 177 | GPU_ICON, 178 | DEFAULT_GRAPH_COLOR); 179 | g_free(id); 180 | } 181 | 182 | if (XNVCTRLQueryTargetAttribute(nvidia_sensors_dpy, 183 | NV_CTRL_TARGET_TYPE_GPU, 184 | i, 185 | 0, NV_CTRL_AMBIENT_TEMPERATURE, &dummy)) { 186 | gchar *id = g_strdup_printf("GPU%d%s", i, AMBIENT_TEMP); 187 | 188 | sensors_applet_plugin_add_sensor(&sensors, 189 | AMBIENT_TEMP, 190 | id, 191 | _("Ambient"), 192 | TEMP_SENSOR, 193 | FALSE, 194 | GENERIC_ICON, 195 | DEFAULT_GRAPH_COLOR); 196 | g_free(id); 197 | } 198 | } 199 | } 200 | 201 | } 202 | return sensors; 203 | } 204 | 205 | const gchar *sensors_applet_plugin_name(void) 206 | { 207 | return plugin_name; 208 | } 209 | 210 | GList *sensors_applet_plugin_init(void) 211 | { 212 | return nvidia_plugin_init(); 213 | } 214 | 215 | gdouble sensors_applet_plugin_get_sensor_value(const gchar *path, 216 | const gchar *id, 217 | SensorType type, 218 | GError **error) { 219 | 220 | return nvidia_plugin_get_sensor_value(path, id, type, error); 221 | } 222 | 223 | -------------------------------------------------------------------------------- /plugins/nvidia/nvidia-plugin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2006 Sven Peter 3 | * Copyright (C) 2005-2009 Alex Murray 4 | * Copyright (C) 2012-2021 MATE Developers 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef NVIDIA_PLUGIN_H 22 | #define NVIDIA_PLUGIN_H 23 | 24 | #include 25 | 26 | #endif /* NVIDIA_PLUGIN_H*/ 27 | -------------------------------------------------------------------------------- /plugins/omnibook/Makefile.am: -------------------------------------------------------------------------------- 1 | # OMNIBOOK plugin 2 | plugindir = $(libdir)/mate-sensors-applet/plugins 3 | 4 | AM_CPPFLAGS = -DMATELOCALEDIR=\""$(datadir)/locale/"\" \ 5 | -DG_LOG_DOMAIN=\""sensors-applet"\" \ 6 | -DPIXMAPS_DIR=\""$(datadir)/pixmaps/$(PACKAGE)/"\" \ 7 | -DDATADIR=\""$(datadir)"\" \ 8 | -DLIBDIR=\""$(libdir)"\" \ 9 | -DSYSCONFDIR=\""$(sysconfdir)"\" \ 10 | -DPREFIX=\""$(prefix)"\" \ 11 | -I$(top_srcdir) \ 12 | $(GLIB_CFLAGS) \ 13 | $(WARN_CFLAGS) 14 | 15 | plugin_LTLIBRARIES = libomnibook.la 16 | 17 | libomnibook_la_SOURCES = \ 18 | omnibook-plugin.h \ 19 | omnibook-plugin.c 20 | 21 | libomnibook_la_LDFLAGS = $(PLUGIN_LIBTOOL_FLAGS) $(GLIB_LIBS) 22 | libomnibook_la_LIBADD = $(top_builddir)/lib/libmate-sensors-applet-plugin.la 23 | 24 | -include $(top_srcdir)/git.mk 25 | -------------------------------------------------------------------------------- /plugins/omnibook/omnibook-plugin.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2005-2009 Alex Murray 3 | * Copyright (C) 2012-2021 MATE Developers 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifdef HAVE_CONFIG_H 21 | #include "config.h" 22 | #endif /* HAVE_CONFIG_H */ 23 | 24 | #include 25 | #include 26 | #include 27 | #include "omnibook-plugin.h" 28 | 29 | const gchar *plugin_name = "omnibook"; 30 | 31 | #define OMNIBOOK_DEVICE_FILE "/proc/omnibook/temperature" 32 | 33 | enum { 34 | OMNIBOOK_DEVICE_FILE_OPEN_ERROR, 35 | OMNIBOOK_DEVICE_FILE_READ_ERROR 36 | }; 37 | 38 | static void omnibook_plugin_setup_manually(GList **sensors) { 39 | /* omnibook only has the one device file with one temp in it */ 40 | if (g_file_test(OMNIBOOK_DEVICE_FILE, G_FILE_TEST_EXISTS)) { 41 | 42 | sensors_applet_plugin_add_sensor(sensors, 43 | OMNIBOOK_DEVICE_FILE, 44 | _("temperature"), 45 | _("CPU"), 46 | TEMP_SENSOR, 47 | TRUE, 48 | CPU_ICON, 49 | DEFAULT_GRAPH_COLOR); 50 | } 51 | } 52 | 53 | /* to be called to setup for sys sensors */ 54 | static GList *omnibook_plugin_init(void) { 55 | GList *sensors = NULL; 56 | /* call function to recursively look for sensors starting at the defined base directory */ 57 | omnibook_plugin_setup_manually(&sensors); 58 | 59 | return sensors; 60 | } 61 | 62 | static gdouble omnibook_plugin_get_sensor_value(const gchar *path, 63 | const gchar *id, 64 | SensorType type, 65 | GError **error) { 66 | 67 | /* to open and access the value of each sensor */ 68 | FILE *fp; 69 | gfloat sensor_value; 70 | 71 | if (NULL == (fp = fopen(path, "r"))) { 72 | g_set_error(error, SENSORS_APPLET_PLUGIN_ERROR, OMNIBOOK_DEVICE_FILE_OPEN_ERROR, "Error opening sensor device file %s", path); 73 | return -1.0; 74 | } 75 | 76 | if (fscanf(fp, "CPU temperature: %f", &sensor_value) != 1) { 77 | g_set_error(error, SENSORS_APPLET_PLUGIN_ERROR, OMNIBOOK_DEVICE_FILE_READ_ERROR, "Error reading from sensor device file %s", path); 78 | fclose(fp); 79 | return -1.0; 80 | } 81 | 82 | fclose(fp); 83 | 84 | return (gdouble)sensor_value; 85 | } 86 | 87 | const gchar *sensors_applet_plugin_name(void) 88 | { 89 | return plugin_name; 90 | } 91 | 92 | GList *sensors_applet_plugin_init(void) 93 | { 94 | return omnibook_plugin_init(); 95 | } 96 | 97 | gdouble sensors_applet_plugin_get_sensor_value(const gchar *path, 98 | const gchar *id, 99 | SensorType type, 100 | GError **error) { 101 | 102 | return omnibook_plugin_get_sensor_value(path, id, type, error); 103 | } 104 | -------------------------------------------------------------------------------- /plugins/omnibook/omnibook-plugin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2005-2009 Alex Murray 3 | * Copyright (C) 2012-2021 MATE Developers 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifndef OMNIBOOK_PLUGIN_H 21 | #define OMNIBOOK_PLUGIN_H 22 | 23 | #include 24 | 25 | #endif /* OMNIBOOK_PLUGIN_H*/ 26 | -------------------------------------------------------------------------------- /plugins/pmu-sys/Makefile.am: -------------------------------------------------------------------------------- 1 | # PMU-SYS plugin 2 | plugindir = $(libdir)/mate-sensors-applet/plugins 3 | 4 | AM_CPPFLAGS = -DMATELOCALEDIR=\""$(datadir)/locale/"\" \ 5 | -DG_LOG_DOMAIN=\""sensors-applet"\" \ 6 | -DPIXMAPS_DIR=\""$(datadir)/pixmaps/$(PACKAGE)/"\" \ 7 | -DDATADIR=\""$(datadir)"\" \ 8 | -DLIBDIR=\""$(libdir)"\" \ 9 | -DSYSCONFDIR=\""$(sysconfdir)"\" \ 10 | -DPREFIX=\""$(prefix)"\" \ 11 | -I$(top_srcdir) \ 12 | $(GLIB_CFLAGS) \ 13 | $(WARN_CFLAGS) 14 | 15 | plugin_LTLIBRARIES = libpmu-sys.la 16 | 17 | libpmu_sys_la_SOURCES = \ 18 | pmu-sys-plugin.h \ 19 | pmu-sys-plugin.c 20 | 21 | libpmu_sys_la_LDFLAGS = $(PLUGIN_LIBTOOL_FLAGS) $(GLIB_LIBS) 22 | libpmu_sys_la_LIBADD = $(top_builddir)/lib/libmate-sensors-applet-plugin.la 23 | 24 | -include $(top_srcdir)/git.mk 25 | -------------------------------------------------------------------------------- /plugins/pmu-sys/pmu-sys-plugin.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2005-2009 Alex Murray 3 | * Copyright (C) 2012-2021 MATE Developers 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifdef HAVE_CONFIG_H 21 | #include "config.h" 22 | #endif /* HAVE_CONFIG_H */ 23 | 24 | #include 25 | #include 26 | #include 27 | #include "pmu-sys-plugin.h" 28 | 29 | const gchar *plugin_name = "pmu-sys"; 30 | 31 | #define PMU_SYS_BASE_DIR "/sys/devices/temperatures/" 32 | #define PMU_WT_SYS_BASE_DIR "/sys/devices/temperature/" 33 | 34 | #define SENSOR1 "sensor1" 35 | #define CPU "cpu" 36 | #define SENSOR2 "sensor2" 37 | #define GPU "gpu" 38 | #define CASE "case" 39 | #define TEMPERATURE "_temperature" 40 | #define FAN_SPEED "_fan_speed" 41 | 42 | enum { 43 | PMU_SYS_DEVICE_FILE_OPEN_ERROR, 44 | PMU_SYS_DEVICE_FILE_READ_ERROR 45 | }; 46 | 47 | static void pmu_sys_plugin_add_sensor(GList **sensors, const gchar *path) { 48 | gchar *filename; 49 | gchar *label = NULL; 50 | gboolean enable; 51 | SensorType sensor_type; 52 | IconType icon_type = GENERIC_ICON; 53 | 54 | filename = g_path_get_basename(path); 55 | 56 | if (g_ascii_strcasecmp(filename, SENSOR1 TEMPERATURE) == 0 || g_ascii_strcasecmp(filename, CPU TEMPERATURE) == 0) { 57 | label = g_strdup(_("CPU")); 58 | sensor_type = TEMP_SENSOR; 59 | enable = TRUE; 60 | icon_type = CPU_ICON; 61 | } else if (g_ascii_strcasecmp(filename, SENSOR2 TEMPERATURE) == 0 || g_ascii_strcasecmp(filename, GPU TEMPERATURE) == 0) { 62 | label = g_strdup(_("GPU")); 63 | sensor_type = TEMP_SENSOR; 64 | enable = TRUE; 65 | icon_type = GPU_ICON; 66 | } else if (g_ascii_strcasecmp(filename, CASE TEMPERATURE) == 0) { 67 | label = g_strdup(_("CASE")); 68 | sensor_type = TEMP_SENSOR; 69 | enable = TRUE; 70 | icon_type = CASE_ICON; 71 | } else if (g_ascii_strcasecmp(filename, SENSOR1 FAN_SPEED) == 0|| g_ascii_strcasecmp(filename, CPU FAN_SPEED) == 0) { 72 | label = g_strdup(_("FAN")); 73 | sensor_type = FAN_SENSOR; 74 | enable = TRUE; 75 | icon_type = FAN_ICON; 76 | } else { 77 | /* disable all other sensors */ 78 | enable = FALSE; 79 | } 80 | 81 | /* only add these 3 sensors */ 82 | if (enable) { 83 | sensors_applet_plugin_add_sensor(sensors, 84 | path, 85 | filename, 86 | label, 87 | sensor_type, 88 | enable, 89 | icon_type, 90 | DEFAULT_GRAPH_COLOR); 91 | 92 | } 93 | 94 | g_free(filename); 95 | g_free(label); 96 | } 97 | 98 | static void pmu_sys_plugin_test_sensor(GList **sensors, const gchar *path) { 99 | gchar *filename; 100 | filename = g_path_get_basename(path); 101 | if (g_ascii_strcasecmp(filename, SENSOR1 TEMPERATURE) == 0 || 102 | g_ascii_strcasecmp(filename, SENSOR2 TEMPERATURE) == 0 || 103 | g_ascii_strcasecmp(filename, SENSOR1 FAN_SPEED) == 0 || 104 | g_ascii_strcasecmp(filename, CPU TEMPERATURE) == 0 || 105 | g_ascii_strcasecmp(filename, GPU TEMPERATURE) == 0 || 106 | g_ascii_strcasecmp(filename, CASE TEMPERATURE) == 0 || 107 | g_ascii_strcasecmp(filename, CPU FAN_SPEED) == 0) { 108 | 109 | pmu_sys_plugin_add_sensor(sensors, path); 110 | } 111 | 112 | g_free(filename); 113 | } 114 | 115 | /* to be called to setup for sys sensors */ 116 | static 117 | GList *pmu_sys_plugin_init(void) { 118 | GList *sensors = NULL; 119 | /* call function to recursively look for sensors 120 | starting at the defined base directory */ 121 | sensors_applet_plugin_find_sensors(&sensors, PMU_SYS_BASE_DIR, pmu_sys_plugin_test_sensor); 122 | sensors_applet_plugin_find_sensors(&sensors, PMU_WT_SYS_BASE_DIR, pmu_sys_plugin_test_sensor); 123 | return sensors; 124 | } 125 | 126 | /* returns the value of the sensor_list at the given iter, or if an 127 | error occurs, instatiates error with an error message */ 128 | static 129 | gdouble pmu_sys_plugin_get_sensor_value(const gchar *path, 130 | const gchar *id, 131 | SensorType type, 132 | GError **error) { 133 | 134 | /* to open and access the value of each sensor */ 135 | FILE *fp; 136 | gfloat sensor_value, dummy; 137 | 138 | if (NULL == (fp = fopen(path, "r"))) { 139 | g_set_error(error, SENSORS_APPLET_PLUGIN_ERROR, PMU_SYS_DEVICE_FILE_OPEN_ERROR, "Error opening sensor device file %s", path); 140 | return -1.0; 141 | } 142 | switch(type) { 143 | case FAN_SENSOR: 144 | if (fscanf(fp, "%f (%f rpm)", &dummy, &sensor_value) != 2) { 145 | g_set_error(error, SENSORS_APPLET_PLUGIN_ERROR, PMU_SYS_DEVICE_FILE_READ_ERROR, "Error reading from sensor device file %s", path); 146 | fclose(fp); 147 | return -1.0; 148 | } 149 | break; 150 | 151 | case TEMP_SENSOR: 152 | if (fscanf(fp, "%f", &sensor_value) != 1) { 153 | g_set_error(error, SENSORS_APPLET_PLUGIN_ERROR, PMU_SYS_DEVICE_FILE_READ_ERROR, "Error reading from sensor device file %s", path); 154 | fclose(fp); 155 | return -1.0; 156 | } 157 | break; 158 | 159 | default: 160 | /* should only have added temp or fan sensors */ 161 | g_error("Unknown sensor type passed as parameter to pmu-sys sensor interface, cannot get value for this sensor"); 162 | g_set_error(error, SENSORS_APPLET_PLUGIN_ERROR, PMU_SYS_DEVICE_FILE_READ_ERROR, "Error reading from sensor device file %s", path); 163 | fclose(fp); 164 | return -1.0; 165 | 166 | } 167 | fclose(fp); 168 | 169 | return (gdouble)sensor_value; 170 | } 171 | 172 | const gchar *sensors_applet_plugin_name(void) 173 | { 174 | return plugin_name; 175 | } 176 | 177 | GList *sensors_applet_plugin_init(void) 178 | { 179 | return pmu_sys_plugin_init(); 180 | } 181 | 182 | gdouble sensors_applet_plugin_get_sensor_value(const gchar *path, 183 | const gchar *id, 184 | SensorType type, 185 | GError **error) { 186 | 187 | return pmu_sys_plugin_get_sensor_value(path, id, type, error); 188 | } 189 | -------------------------------------------------------------------------------- /plugins/pmu-sys/pmu-sys-plugin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2005-2009 Alex Murray 3 | * Copyright (C) 2012-2021 MATE Developers 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifndef PMU_SYS_PLUGIN_H 21 | #define PMU_SYS_PLUGIN_H 22 | 23 | #include 24 | 25 | #endif /* PMU_SYS_PLUGIN_H*/ 26 | -------------------------------------------------------------------------------- /plugins/smu-sys/Makefile.am: -------------------------------------------------------------------------------- 1 | # SMU-SYS plugin 2 | plugindir = $(libdir)/mate-sensors-applet/plugins 3 | 4 | AM_CPPFLAGS = -DMATELOCALEDIR=\""$(datadir)/locale/"\" \ 5 | -DG_LOG_DOMAIN=\""sensors-applet"\" \ 6 | -DPIXMAPS_DIR=\""$(datadir)/pixmaps/$(PACKAGE)/"\" \ 7 | -DDATADIR=\""$(datadir)"\" \ 8 | -DLIBDIR=\""$(libdir)"\" \ 9 | -DSYSCONFDIR=\""$(sysconfdir)"\" \ 10 | -DPREFIX=\""$(prefix)"\" \ 11 | -I$(top_srcdir) \ 12 | $(GLIB_CFLAGS) \ 13 | $(WARN_CFLAGS) 14 | 15 | plugin_LTLIBRARIES = libsmu-sys.la 16 | 17 | libsmu_sys_la_SOURCES = \ 18 | smu-sys-plugin.h \ 19 | smu-sys-plugin.c 20 | 21 | libsmu_sys_la_LDFLAGS = $(PLUGIN_LIBTOOL_FLAGS) $(GLIB_LIBS) 22 | libsmu_sys_la_LIBADD = $(top_builddir)/lib/libmate-sensors-applet-plugin.la 23 | 24 | -include $(top_srcdir)/git.mk 25 | -------------------------------------------------------------------------------- /plugins/smu-sys/smu-sys-plugin.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2005-2009 Alex Murray 3 | * Copyright (C) 2012-2021 MATE Developers 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifdef HAVE_CONFIG_H 21 | #include "config.h" 22 | #endif /* HAVE_CONFIG_H */ 23 | 24 | #include 25 | #include 26 | #include 27 | #include "smu-sys-plugin.h" 28 | 29 | const gchar *plugin_name = "smu-sys"; 30 | 31 | #define SMU_SYS_BASE_DIR "/sys/devices/platform/windfarm.0" 32 | 33 | #define SENSOR1 "sensor1" 34 | #define CPU "cpu" 35 | #define SENSOR2 "sensor2" 36 | #define GPU "gpu" 37 | #define TEMPERATURE "-temp" 38 | #define FAN_SPEED "-fan" 39 | 40 | enum { 41 | SMU_SYS_DEVICE_FILE_OPEN_ERROR, 42 | SMU_SYS_DEVICE_FILE_READ_ERROR 43 | }; 44 | 45 | static void smu_sys_plugin_add_sensor(GList **sensors, const gchar *path) { 46 | gchar *filename; 47 | gchar *label = NULL; 48 | gboolean enable; 49 | SensorType sensor_type; 50 | IconType icon_type = GENERIC_ICON; 51 | 52 | filename = g_path_get_basename(path); 53 | 54 | if (g_ascii_strcasecmp(filename, SENSOR1 TEMPERATURE) == 0 || g_ascii_strcasecmp(filename, CPU TEMPERATURE) == 0) { 55 | label = g_strdup(_("CPU")); 56 | sensor_type = TEMP_SENSOR; 57 | enable = TRUE; 58 | icon_type = CPU_ICON; 59 | } else if (g_ascii_strcasecmp(filename, SENSOR2 TEMPERATURE) == 0 || g_ascii_strcasecmp(filename, GPU TEMPERATURE) == 0) { 60 | label = g_strdup(_("GPU")); 61 | sensor_type = TEMP_SENSOR; 62 | enable = TRUE; 63 | icon_type = GPU_ICON; 64 | } else if (g_ascii_strcasecmp(filename, SENSOR1 FAN_SPEED) == 0|| g_ascii_strcasecmp(filename, CPU FAN_SPEED) == 0) { 65 | label = g_strdup(_("FAN")); 66 | sensor_type = FAN_SENSOR; 67 | enable = TRUE; 68 | icon_type = FAN_ICON; 69 | } else { 70 | /* disable all other sensors */ 71 | enable = FALSE; 72 | } 73 | 74 | /* only add these 3 sensors */ 75 | if (enable) { 76 | sensors_applet_plugin_add_sensor(sensors, 77 | path, 78 | filename, 79 | label, 80 | sensor_type, 81 | enable, 82 | icon_type, 83 | DEFAULT_GRAPH_COLOR); 84 | 85 | } 86 | 87 | g_free(filename); 88 | g_free(label); 89 | } 90 | 91 | static void smu_sys_plugin_test_sensor(GList **sensors, const gchar *path) { 92 | gchar *filename; 93 | 94 | filename = g_path_get_basename(path); 95 | if (g_ascii_strcasecmp(filename, SENSOR1 TEMPERATURE) == 0 || 96 | g_ascii_strcasecmp(filename, SENSOR2 TEMPERATURE) == 0 || 97 | g_ascii_strcasecmp(filename, SENSOR1 FAN_SPEED) == 0 || 98 | g_ascii_strcasecmp(filename, CPU TEMPERATURE) == 0 || 99 | g_ascii_strcasecmp(filename, GPU TEMPERATURE) == 0 || 100 | g_ascii_strcasecmp(filename, CPU FAN_SPEED) == 0) { 101 | 102 | smu_sys_plugin_add_sensor(sensors, path); 103 | } 104 | g_free(filename); 105 | } 106 | 107 | /* to be called to setup for sys sensors */ 108 | static GList *smu_sys_plugin_init(void) { 109 | GList *sensors = NULL; 110 | 111 | /* call function to recursively look for sensors 112 | starting at the defined base directory */ 113 | sensors_applet_plugin_find_sensors(&sensors, SMU_SYS_BASE_DIR, smu_sys_plugin_test_sensor); 114 | 115 | return sensors; 116 | } 117 | 118 | /* returns the value of the sensor_list at the given iter, or if an 119 | error occurs, instatiates error with an error message */ 120 | static 121 | gdouble smu_sys_plugin_get_sensor_value(const gchar *path, 122 | const gchar *id, 123 | SensorType type, 124 | GError **error) { 125 | 126 | /* to open and access the value of each sensor */ 127 | FILE *fp; 128 | gfloat sensor_value = -1.0; 129 | 130 | if (NULL == (fp = fopen(path, "r"))) { 131 | g_set_error(error, SENSORS_APPLET_PLUGIN_ERROR, SMU_SYS_DEVICE_FILE_OPEN_ERROR, "Error opening sensor device file %s", path); 132 | return -1.0; 133 | } 134 | switch(type) { 135 | case FAN_SENSOR: 136 | if (fscanf(fp, "%f", &sensor_value) != 1) { 137 | g_set_error(error, SENSORS_APPLET_PLUGIN_ERROR, SMU_SYS_DEVICE_FILE_READ_ERROR, "Error reading from sensor device file %s", path); 138 | fclose(fp); 139 | return -1.0; 140 | } 141 | break; 142 | 143 | case TEMP_SENSOR: 144 | if (fscanf(fp, "%f", &sensor_value) != 1) { 145 | g_set_error(error, SENSORS_APPLET_PLUGIN_ERROR, SMU_SYS_DEVICE_FILE_READ_ERROR, "Error reading from sensor device file %s", path); 146 | fclose(fp); 147 | return -1.0; 148 | } 149 | break; 150 | 151 | default: 152 | /* should only have added temp or fan sensors */ 153 | g_error("Unknown sensor type passed as parameter to smu-sys sensor interface, cannot get value for this sensor"); 154 | g_set_error(error, SENSORS_APPLET_PLUGIN_ERROR, SMU_SYS_DEVICE_FILE_READ_ERROR, "Error reading from sensor device file %s", path); 155 | } 156 | fclose(fp); 157 | 158 | return (gdouble)sensor_value; 159 | } 160 | 161 | const gchar *sensors_applet_plugin_name(void) 162 | { 163 | return plugin_name; 164 | } 165 | 166 | GList *sensors_applet_plugin_init(void) 167 | { 168 | return smu_sys_plugin_init(); 169 | } 170 | 171 | gdouble sensors_applet_plugin_get_sensor_value(const gchar *path, 172 | const gchar *id, 173 | SensorType type, 174 | GError **error) { 175 | 176 | return smu_sys_plugin_get_sensor_value(path, id, type, error); 177 | } 178 | -------------------------------------------------------------------------------- /plugins/smu-sys/smu-sys-plugin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2005-2009 Alex Murray 3 | * Copyright (C) 2012-2021 MATE Developers 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifndef SMU_SYS_PLUGIN_H 21 | #define SMU_SYS_PLUGIN_H 22 | 23 | #include 24 | 25 | #endif /* SMU_SYS_PLUGIN_H */ 26 | -------------------------------------------------------------------------------- /plugins/sonypi/Makefile.am: -------------------------------------------------------------------------------- 1 | # SONYPI plugin 2 | plugindir = $(libdir)/mate-sensors-applet/plugins 3 | 4 | AM_CPPFLAGS = -DMATELOCALEDIR=\""$(datadir)/locale/"\" \ 5 | -DG_LOG_DOMAIN=\""sensors-applet"\" \ 6 | -DPIXMAPS_DIR=\""$(datadir)/pixmaps/$(PACKAGE)/"\" \ 7 | -DDATADIR=\""$(datadir)"\" \ 8 | -DLIBDIR=\""$(libdir)"\" \ 9 | -DSYSCONFDIR=\""$(sysconfdir)"\" \ 10 | -DPREFIX=\""$(prefix)"\" \ 11 | -I$(top_srcdir) \ 12 | $(GLIB_CFLAGS) \ 13 | $(WARN_CFLAGS) 14 | 15 | plugin_LTLIBRARIES = libsonypi.la 16 | 17 | libsonypi_la_SOURCES = \ 18 | sonypi-plugin.h \ 19 | sonypi-plugin.c 20 | 21 | libsonypi_la_LDFLAGS = $(PLUGIN_LIBTOOL_FLAGS) $(GLIB_LIBS) 22 | libsonypi_la_LIBADD = $(top_builddir)/lib/libmate-sensors-applet-plugin.la 23 | 24 | -include $(top_srcdir)/git.mk 25 | -------------------------------------------------------------------------------- /plugins/sonypi/sonypi-plugin.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2006-2008 Alex Murray 3 | * Copyright (C) 2012-2021 MATE Developers 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifdef HAVE_CONFIG_H 21 | #include "config.h" 22 | #endif /* HAVE_CONFIG_H */ 23 | 24 | #ifdef HAVE_FCNTL_H 25 | #include 26 | #endif /* HAVE_FCNTL_H */ 27 | 28 | #ifdef HAVE_SYS_IOCTL_H 29 | #include 30 | #endif /* HAVE_SYS_IOCTL_H */ 31 | 32 | #ifdef HAVE_UNISTD_H 33 | #include 34 | #endif /* HAVE_UNISTD_H */ 35 | 36 | #include 37 | #include 38 | #include "sonypi-plugin.h" 39 | 40 | #include 41 | 42 | const gchar *plugin_name = "sonypi"; 43 | 44 | /* These values are taken from spicctrl by Stelian Pop */ 45 | #define SONYPI_DEV "/dev/sonypi" 46 | #define SONYPI_IOCGFAN _IOR('v', 10, uint8_t) 47 | #define SONYPI_IOCGTEMP _IOR('v', 12, uint8_t) 48 | #define SONYPI_TEMP "sonypi_temp" 49 | 50 | enum { 51 | SONYPI_DEVICE_FILE_OPEN_ERROR, 52 | SONYPI_DEVICE_FILE_READ_ERROR 53 | }; 54 | 55 | static 56 | GList *sonypi_plugin_init(void) { 57 | int fd; 58 | GList *sensors = NULL; 59 | 60 | if ( (fd = open(SONYPI_DEV, O_RDONLY)) != -1 ) { 61 | if ( close(fd) != -1 ) { 62 | sensors_applet_plugin_add_sensor(&sensors, 63 | SONYPI_DEV, 64 | SONYPI_TEMP, 65 | _("CPU TEMP"), 66 | TEMP_SENSOR, 67 | TRUE, 68 | CPU_ICON, 69 | DEFAULT_GRAPH_COLOR); 70 | } 71 | } 72 | return sensors; 73 | } 74 | 75 | static 76 | gdouble sonypi_plugin_get_sensor_value(const gchar *path, 77 | const gchar *id, 78 | SensorType type, 79 | GError **error) { 80 | 81 | int fd; 82 | guint8 value8; 83 | 84 | gdouble sensor_value = -1.0; 85 | 86 | if ((fd = open(path, O_RDONLY)) != -1) { 87 | /* only use temp sensor */ 88 | if (g_ascii_strcasecmp(id, SONYPI_TEMP) == 0) { 89 | if (ioctl(fd, SONYPI_IOCGTEMP, &value8) != -1) { 90 | sensor_value = (gdouble)value8; 91 | } else { 92 | g_set_error(error, SENSORS_APPLET_PLUGIN_ERROR, SONYPI_DEVICE_FILE_READ_ERROR, "Error reading from sensor device file %s", path); 93 | } 94 | } 95 | close(fd); 96 | } else { 97 | g_set_error(error, SENSORS_APPLET_PLUGIN_ERROR, SONYPI_DEVICE_FILE_OPEN_ERROR, "Error opening from sensor device file %s", path); 98 | } 99 | 100 | return sensor_value; 101 | } 102 | 103 | const gchar *sensors_applet_plugin_name(void) 104 | { 105 | return plugin_name; 106 | } 107 | 108 | GList *sensors_applet_plugin_init(void) 109 | { 110 | return sonypi_plugin_init(); 111 | } 112 | 113 | gdouble sensors_applet_plugin_get_sensor_value(const gchar *path, 114 | const gchar *id, 115 | SensorType type, 116 | GError **error) { 117 | 118 | return sonypi_plugin_get_sensor_value(path, id, type, error); 119 | } 120 | -------------------------------------------------------------------------------- /plugins/sonypi/sonypi-plugin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2006 Thanate Dhirasakdanon 3 | * Copyright (C) 2005-2009 Alex Murray 4 | * Copyright (C) 2012-2021 MATE Developers 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef SONYPI_PLUGIN_H 22 | #define SONYPI_PLUGIN_H 23 | 24 | #include 25 | 26 | #endif /* SONYPI_PLUGIN_H*/ 27 | -------------------------------------------------------------------------------- /plugins/udisks2/Makefile.am: -------------------------------------------------------------------------------- 1 | # UDisks2 plugin 2 | plugindir = $(libdir)/mate-sensors-applet/plugins 3 | 4 | AM_CPPFLAGS = -DMATELOCALEDIR=\""$(datadir)/locale/"\" \ 5 | -DG_LOG_DOMAIN=\""sensors-applet"\" \ 6 | -DPIXMAPS_DIR=\""$(datadir)/pixmaps/$(PACKAGE)/"\" \ 7 | -DDATADIR=\""$(datadir)"\" \ 8 | -DLIBDIR=\""$(libdir)"\" \ 9 | -DSYSCONFDIR=\""$(sysconfdir)"\" \ 10 | -DPREFIX=\""$(prefix)"\" \ 11 | -I$(top_srcdir) \ 12 | $(GLIB_CFLAGS) \ 13 | $(WARN_CFLAGS) 14 | 15 | plugin_LTLIBRARIES = libudisks2.la 16 | 17 | libudisks2_la_SOURCES = \ 18 | udisks2-plugin.h \ 19 | udisks2-plugin.c 20 | 21 | libudisks2_la_LDFLAGS = $(PLUGIN_LIBTOOL_FLAGS) $(GLIB_LIBS) 22 | 23 | libudisks2_la_LIBADD = $(top_builddir)/lib/libmate-sensors-applet-plugin.la 24 | 25 | -include $(top_srcdir)/git.mk 26 | -------------------------------------------------------------------------------- /plugins/udisks2/udisks2-plugin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 info-cppsp 3 | * Copyright (C) 2005-2009 Alex Murray 4 | * Copyright (C) 2012-2021 MATE Developers 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef UDISKS2_PLUGIN_H 22 | #define UDISKS2_PLUGIN_H 23 | 24 | #include 25 | 26 | #endif /* UDISKS2_PLUGIN_H */ 27 | -------------------------------------------------------------------------------- /po/ChangeLog: -------------------------------------------------------------------------------- 1 | 2008-03-09 Alex Murray 2 | 3 | * pt_BR.po: Added Brazilian Portuguese translation (thanks to 4 | Amadeu A. Barbosa Júnior) 5 | 6 | 2007-12-23 Alex Murray 7 | 8 | * Merged all translations with updated plugin layout 9 | 10 | 2007-05-04 Alex Murray 11 | 12 | * po.pl: 13 | Updated Polish translation 14 | 15 | 2006-11-27 Alex Murray 16 | 17 | * hu.po: 18 | Added Hungarian translation 19 | 20 | * cs.po: 21 | Updated Czech translation 22 | 23 | * fr.po: 24 | Updated French translation 25 | 26 | 2006-11-11 Alex Murray 27 | 28 | * cs.po: 29 | Added Czech translation 30 | 31 | 2006-09-06 Alex Murray 32 | 33 | * sv.po: 34 | Updated Swedish translation 35 | 36 | 2006-08-25 Alex Murray 37 | 38 | * de.po: 39 | Updated German translation 40 | 41 | 2006-08-22 Alex Murray 42 | 43 | * de.po: 44 | Updated German translation 45 | 46 | 2006-07-02 Alex Murray 47 | 48 | * fr.po: 49 | Updated French translation 50 | 51 | 2006-04-27 Alex Murray 52 | 53 | * sv.po: 54 | Added Swedish translation 55 | 56 | 2006-01-21 Alex Murray 57 | 58 | * es.po: 59 | Added Spanish translation 60 | 61 | 2006-01-11 Alex Murray 62 | 63 | * fi.po, POTFILES.skip, POTFILES.in: 64 | Added Finnish translation 65 | Added POTFILES.skip 66 | Added src/sensors-applet-mateconf.c to POTFILES.in 67 | 68 | 2006-01-08 Alex Murray 69 | 70 | * POTFILES.in 71 | Updated to include all interfaces and new refactored code. 72 | 73 | 2006-01-06 Alex Murray 74 | 75 | * fr.po: 76 | Updated french translation (thanks to Davy Defaud). 77 | 78 | 2005-01-16 Alex Murray 79 | 80 | * Initial setup 81 | -------------------------------------------------------------------------------- /po/LINGUAS: -------------------------------------------------------------------------------- 1 | # 2 | af 3 | am 4 | an 5 | ar 6 | as 7 | ast 8 | az 9 | be 10 | bg 11 | bn 12 | bn_IN 13 | br 14 | bs 15 | ca 16 | ca@valencia 17 | cmn 18 | crh 19 | cs 20 | csb 21 | cy 22 | da 23 | de 24 | dz 25 | el 26 | en_AU 27 | en_CA 28 | en_GB 29 | eo 30 | es 31 | es_AR 32 | es_CL 33 | es_CO 34 | es_CR 35 | es_DO 36 | es_EC 37 | es_ES 38 | es_MX 39 | es_NI 40 | es_PA 41 | es_PE 42 | es_PR 43 | es_SV 44 | es_UY 45 | es_VE 46 | et 47 | eu 48 | fa 49 | fi 50 | fr 51 | fr_CA 52 | frp 53 | fur 54 | fy 55 | ga 56 | gl 57 | gu 58 | ha 59 | he 60 | hi 61 | hr 62 | hu 63 | hy 64 | ia 65 | id 66 | ie 67 | ig 68 | is 69 | it 70 | ja 71 | jv 72 | ka 73 | kab 74 | kk 75 | km 76 | kn 77 | ko 78 | ks 79 | ku 80 | ku_IQ 81 | ky 82 | lb 83 | li 84 | lt 85 | lv 86 | mai 87 | mg 88 | mi 89 | mk 90 | ml 91 | mn 92 | mr 93 | ms 94 | nah 95 | nb 96 | nds 97 | ne 98 | nl 99 | nn 100 | nqo 101 | nso 102 | oc 103 | or 104 | pa 105 | pl 106 | # please keep this list sorted alphabetically 107 | pms 108 | ps 109 | pt 110 | pt_BR 111 | ro 112 | ru 113 | rw 114 | sc 115 | si 116 | sk 117 | sl 118 | sq 119 | sr 120 | sr@latin 121 | sv 122 | sw 123 | ta 124 | te 125 | th 126 | tk 127 | tr 128 | tt 129 | ug 130 | uk 131 | ur 132 | ur_PK 133 | uz 134 | vi 135 | wa 136 | xh 137 | yi 138 | yo 139 | zh_CN 140 | zh_HK 141 | zh_TW 142 | zu 143 | -------------------------------------------------------------------------------- /po/Makevars: -------------------------------------------------------------------------------- 1 | # Makefile variables for PO directory in any package using GNU gettext. 2 | 3 | # Usually the message domain is the same as the package name. 4 | DOMAIN = $(PACKAGE) 5 | 6 | # These two variables depend on the location of this directory. 7 | subdir = po 8 | top_builddir = .. 9 | 10 | # These options get passed to xgettext. 11 | XGETTEXT_OPTIONS = --from-code=UTF-8 --keyword=_ --keyword=N_ --keyword=C_:1c,2 --keyword=NC_:1c,2 --keyword=g_dngettext:2,3 --add-comments=Translators: 12 | 13 | # This is the copyright holder that gets inserted into the header of the 14 | # $(DOMAIN).pot file. Set this to the copyright holder of the surrounding 15 | # package. (Note that the msgstr strings, extracted from the package's 16 | # sources, belong to the copyright holder of the package.) Translators are 17 | # expected to transfer the copyright for their translations to this person 18 | # or entity, or to disclaim their copyright. The empty string stands for 19 | # the public domain; in this case the translators are expected to disclaim 20 | # their copyright. 21 | COPYRIGHT_HOLDER = MATE Desktop Environment team 22 | 23 | # This tells whether or not to prepend "GNU " prefix to the package 24 | # name that gets inserted into the header of the $(DOMAIN).pot file. 25 | # Possible values are "yes", "no", or empty. If it is empty, try to 26 | # detect it automatically by scanning the files in $(top_srcdir) for 27 | # "GNU packagename" string. 28 | PACKAGE_GNU = 29 | 30 | # This is the email address or URL to which the translators shall report 31 | # bugs in the untranslated strings: 32 | # - Strings which are not entire sentences, see the maintainer guidelines 33 | # in the GNU gettext documentation, section 'Preparing Strings'. 34 | # - Strings which use unclear terms or require additional context to be 35 | # understood. 36 | # - Strings which make invalid assumptions about notation of date, time or 37 | # money. 38 | # - Pluralisation problems. 39 | # - Incorrect English spelling. 40 | # - Incorrect formatting. 41 | # It can be your email address, or a mailing list address where translators 42 | # can write to without being subscribed, or the URL of a web page through 43 | # which the translators can contact you. 44 | MSGID_BUGS_ADDRESS = 45 | 46 | # This is the list of locale categories, beyond LC_MESSAGES, for which the 47 | # message catalogs shall be used. It is usually empty. 48 | EXTRA_LOCALE_CATEGORIES = 49 | 50 | # This tells whether the $(DOMAIN).pot file contains messages with an 'msgctxt' 51 | # context. Possible values are "yes" and "no". Set this to yes if the 52 | # package uses functions taking also a message context, like pgettext(), or 53 | # if in $(XGETTEXT_OPTIONS) you define keywords with a context argument. 54 | USE_MSGCTXT = no 55 | 56 | # These options get passed to msgmerge. 57 | # Useful options are in particular: 58 | # --previous to keep previous msgids of translated messages, 59 | # --quiet to reduce the verbosity. 60 | MSGMERGE_OPTIONS = 61 | 62 | # These options get passed to msginit. 63 | # If you want to disable line wrapping when writing PO files, add 64 | # --no-wrap to MSGMERGE_OPTIONS, XGETTEXT_OPTIONS, and 65 | # MSGINIT_OPTIONS. 66 | MSGINIT_OPTIONS = 67 | 68 | # This tells whether or not to regenerate a PO file when $(DOMAIN).pot 69 | # has changed. Possible values are "yes" and "no". Set this to no if 70 | # the POT file is checked in the repository and the version control 71 | # program ignores timestamps. 72 | PO_DEPENDS_ON_POT = yes 73 | 74 | # This tells whether or not to forcibly update $(DOMAIN).pot and 75 | # regenerate PO files on "make dist". Possible values are "yes" and 76 | # "no". Set this to no if the POT file and PO files are maintained 77 | # externally. 78 | DIST_DEPENDS_ON_UPDATE_PO = yes 79 | -------------------------------------------------------------------------------- /po/POTFILES.in: -------------------------------------------------------------------------------- 1 | org.mate.applets.SensorsApplet.mate-panel-applet.desktop.in.in 2 | org.mate.sensors-applet.gschema.xml.in 3 | org.mate.sensors-applet.sensor.gschema.xml.in 4 | plugins/pmu-sys/pmu-sys-plugin.c 5 | plugins/i2c-sys/i2c-sys-plugin.c 6 | plugins/i8k/i8k-plugin.c 7 | plugins/ibm-acpi/ibm-acpi-plugin.c 8 | plugins/sonypi/sonypi-plugin.c 9 | plugins/omnibook/omnibook-plugin.c 10 | plugins/nvidia/nvidia-plugin.c 11 | plugins/i2c-proc/i2c-proc-plugin.c 12 | plugins/acpi/acpi-plugin.c 13 | plugins/smu-sys/smu-sys-plugin.c 14 | sensors-applet/prefs-dialog.c 15 | sensors-applet/sensors-applet.h 16 | sensors-applet/active-sensor.c 17 | sensors-applet/about-dialog.c 18 | sensors-applet/sensor-config-dialog.c 19 | sensors-applet/sensors-applet.c 20 | sensors-applet/sensors-applet-settings.c 21 | -------------------------------------------------------------------------------- /po/POTFILES.skip: -------------------------------------------------------------------------------- 1 | SensorsApplet.server.in 2 | -------------------------------------------------------------------------------- /sensors-applet/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Process this file with automake to produce Makefile.in 2 | 3 | uidir = $(datadir)/mate-sensors-applet/ui 4 | 5 | AM_CPPFLAGS = -DMATELOCALEDIR=\""$(datadir)/locale/"\" \ 6 | -DG_LOG_DOMAIN=\""sensors-applet"\" \ 7 | -DPIXMAPS_DIR=\""$(datadir)/pixmaps/$(PACKAGE)/"\" \ 8 | -DDATADIR=\""$(datadir)"\" \ 9 | -DLIBDIR=\""$(libdir)"\" \ 10 | -DUIDIR=\""$(pkgdatadir)/ui"\" \ 11 | -DSENSORS_APPLET_PLUGIN_DIR=\""$(libdir)/$(PACKAGE)/plugins"\" \ 12 | -DSYSCONFDIR=\""$(sysconfdir)"\" \ 13 | -DPREFIX=\""$(prefix)"\" \ 14 | -I$(top_srcdir) \ 15 | $(GLIB_CFLAGS) \ 16 | $(GTK_CFLAGS) \ 17 | $(MATE_CFLAGS) \ 18 | $(CAIRO_CFLAGS) \ 19 | $(LIBNOTIFY_CFLAGS) \ 20 | $(WARN_CFLAGS) 21 | 22 | mate_sensors_applet_libdir= $(pkglibdir) 23 | 24 | LIBS = $(GLIB_LIBS) $(GTK_LIBS) $(MATE_LIBS) $(CAIRO_LIBS) $(LIBNOTIFY_LIBS) 25 | 26 | if LIBNOTIFY 27 | libnotify_SRC = active-sensor-libnotify.c \ 28 | active-sensor-libnotify.h 29 | else 30 | libnotify_SRC = 31 | endif 32 | 33 | if ENABLE_IN_PROCESS 34 | mate_sensors_applet_lib_LTLIBRARIES=libmate-sensors-applet.la 35 | libmate_sensors_applet_la_CFLAGS = \ 36 | $(MATE_APPLETS4_CFLAGS) \ 37 | $(WARN_CFLAGS) \ 38 | $(AM_CFLAGS) \ 39 | $(NULL) 40 | 41 | libmate_sensors_applet_la_LDFLAGS = \ 42 | -module -avoid-version \ 43 | $(WARN_LDFLAGS) \ 44 | $(AM_LDFLAGS) \ 45 | $(NULL) 46 | 47 | libmate_sensors_applet_la_LIBADD = \ 48 | $(MATE_APPLETS4_LIBS) \ 49 | $(NULL) 50 | 51 | libmate_sensors_applet_la_SOURCES = main.c \ 52 | about-dialog.c \ 53 | about-dialog.h \ 54 | active-sensor.c \ 55 | active-sensor.h \ 56 | prefs-dialog.c \ 57 | prefs-dialog.h \ 58 | sensor-config-dialog.c \ 59 | sensor-config-dialog.h \ 60 | sensors-applet.c \ 61 | sensors-applet.h \ 62 | sensors-applet-sensor.h \ 63 | sensors-applet-plugins.c \ 64 | sensors-applet-plugins.h \ 65 | sensors-applet-settings.c \ 66 | sensors-applet-settings.h \ 67 | $(libnotify_SRC) 68 | else 69 | libexec_PROGRAMS = mate-sensors-applet 70 | mate_sensors_applet_SOURCES = main.c \ 71 | about-dialog.c \ 72 | about-dialog.h \ 73 | active-sensor.c \ 74 | active-sensor.h \ 75 | prefs-dialog.c \ 76 | prefs-dialog.h \ 77 | sensor-config-dialog.c \ 78 | sensor-config-dialog.h \ 79 | sensors-applet.c \ 80 | sensors-applet.h \ 81 | sensors-applet-sensor.h \ 82 | sensors-applet-plugins.c \ 83 | sensors-applet-plugins.h \ 84 | sensors-applet-settings.c \ 85 | sensors-applet-settings.h \ 86 | $(libnotify_SRC) 87 | endif 88 | 89 | # install headers for plugins to use 90 | INST_H_FILES = sensors-applet-plugin.h sensors-applet-sensor.h 91 | 92 | headerdir = $(prefix)/include/mate-sensors-applet 93 | 94 | header_DATA = $(INST_H_FILES) 95 | 96 | # since it is separate 97 | EXTRA_DIST = sensors-applet-plugin.h 98 | 99 | -include $(top_srcdir)/git.mk 100 | -------------------------------------------------------------------------------- /sensors-applet/about-dialog.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2005-2009 Alex Murray 3 | * Copyright (C) 2012-2021 MATE Developers 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifdef HAVE_CONFIG_H 21 | #include "config.h" 22 | #endif /* HAVE_CONFIG_H */ 23 | 24 | #include 25 | #include 26 | #include 27 | #include "about-dialog.h" 28 | 29 | void about_dialog_open(SensorsApplet *sensors_applet) { 30 | const gchar *authors[] = { 31 | "Alex Murray ", 32 | "Stefano Karapetsas ", 33 | NULL 34 | }; 35 | 36 | /* Construct the about dialog */ 37 | gtk_show_about_dialog(NULL, 38 | "icon-name", "mate-sensors-applet", 39 | "program-name", PACKAGE_NAME, 40 | "version", PACKAGE_VERSION, 41 | "copyright", _("Copyright \xc2\xa9 2005-2009 Alex Murray\n" 42 | "Copyright \xc2\xa9 2011 Stefano Karapetsas\n" 43 | "Copyright \xc2\xa9 2012-2021 MATE developers"), 44 | "authors", authors, 45 | "documenters", authors, 46 | /* To translator: Put your name here to show up in the About dialog as the translator */ 47 | "translator-credits", _("translator-credits"), 48 | "logo-icon-name", SENSORS_APPLET_ICON, 49 | "website", PACKAGE_URL, 50 | NULL); 51 | 52 | } 53 | -------------------------------------------------------------------------------- /sensors-applet/about-dialog.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2005-2009 Alex Murray 3 | * Copyright (C) 2012-2021 MATE Developers 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifndef ABOUT_DIALOG_H 21 | #define ABOUT_DIALOG_H 22 | 23 | #include "sensors-applet.h" 24 | 25 | /* function prototypes */ 26 | void about_dialog_open(SensorsApplet *sensors_applet); 27 | 28 | #endif /* ABOUT_DIALOG_H */ 29 | -------------------------------------------------------------------------------- /sensors-applet/active-sensor-libnotify.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2005-2009 Alex Murray 3 | * Copyright (C) 2012-2021 MATE Developers 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifdef HAVE_CONFIG_H 21 | #include "config.h" 22 | #endif /* HAVE_CONFIG_H */ 23 | 24 | #ifdef HAVE_LIBNOTIFY 25 | #include 26 | #endif 27 | 28 | #include "active-sensor-libnotify.h" 29 | 30 | static void notif_closed_cb(NotifyNotification *notification, 31 | ActiveSensor *active_sensor) { 32 | 33 | g_assert(notification != NULL && active_sensor != NULL); 34 | 35 | int i; 36 | 37 | g_debug("Notification was closed.. setting reference to NULL so we can show again if needed."); 38 | 39 | // set notif reference to NULL 40 | for (i = 0; i < NUM_NOTIFS; i++) { 41 | if (active_sensor->notification[i] == notification) { 42 | active_sensor->notification[i] = NULL; 43 | break; 44 | } 45 | } 46 | } 47 | 48 | void active_sensor_libnotify_notify_end(ActiveSensor *active_sensor, 49 | NotifType notif_type) { 50 | 51 | GError *error = NULL; 52 | if (active_sensor->notification[notif_type]) { 53 | g_debug("Closing notification"); 54 | if(!notify_notification_close(active_sensor->notification[notif_type], &error)) { 55 | g_warning("Error closing notification: %s", error->message); 56 | g_error_free(error); 57 | } 58 | g_object_unref(active_sensor->notification[notif_type]); 59 | active_sensor->notification[notif_type] = NULL; 60 | } 61 | } 62 | 63 | void active_sensor_libnotify_notify(ActiveSensor *active_sensor, 64 | NotifType notif_type, 65 | const gchar *summary, 66 | const gchar *message, 67 | const gchar *icon_filename, 68 | gint timeout_msecs) { 69 | 70 | GError *error = NULL; 71 | 72 | if (!notify_is_initted()) { 73 | if (!notify_init(PACKAGE)) { 74 | return; 75 | } 76 | } 77 | g_debug("Doing notification %s: %s: %s", (notif_type == SENSOR_INTERFACE_ERROR ? "interface-error" : "other") ,summary, message); 78 | 79 | /* leave any existing notification since most likely hasn't changed */ 80 | if (active_sensor->notification[notif_type] != NULL) { 81 | return; 82 | /* active_sensor_libnotify_notify_end(active_sensor, notif_type); */ 83 | } 84 | 85 | /* now create a new one */ 86 | g_debug("Creating new notification"); 87 | active_sensor->notification[notif_type] = notify_notification_new(summary, message, icon_filename); 88 | g_signal_connect(active_sensor->notification[notif_type], "closed", 89 | G_CALLBACK(notif_closed_cb), 90 | active_sensor); 91 | 92 | notify_notification_set_urgency(active_sensor->notification[notif_type], NOTIFY_URGENCY_CRITICAL); 93 | 94 | /* timeout may have changed so update it */ 95 | notify_notification_set_timeout(active_sensor->notification[notif_type], timeout_msecs); 96 | 97 | g_debug("showing notification"); 98 | if (!notify_notification_show(active_sensor->notification[notif_type], &error)) { 99 | g_debug("Error showing notification: %s", error->message); 100 | g_error_free(error); 101 | } 102 | 103 | } 104 | 105 | -------------------------------------------------------------------------------- /sensors-applet/active-sensor-libnotify.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2005-2009 Alex Murray 3 | * Copyright (C) 2012-2021 MATE Developers 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifndef ACTIVE_SENSOR_LIBNOTIFY_H 21 | #define ACTIVE_SENSOR_LIBNOTIFY_H 22 | 23 | #include "sensors-applet.h" 24 | #include "active-sensor.h" 25 | 26 | void active_sensor_libnotify_notify(ActiveSensor *active_sensor, 27 | NotifType notif_type, 28 | const gchar *summary, 29 | const gchar *message, 30 | const gchar *icon_filename, 31 | gint timeout_msecs); 32 | 33 | void active_sensor_libnotify_notify_end(ActiveSensor *active_sensor, 34 | NotifType notif_type); 35 | 36 | #endif /* SENSORS_APPLET_LIBNOTIFY_H */ 37 | -------------------------------------------------------------------------------- /sensors-applet/active-sensor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2005-2009 Alex Murray 3 | * Copyright (C) 2012-2021 MATE Developers 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifndef ACTIVE_SENSOR_H 21 | #define ACTIVE_SENSOR_H 22 | 23 | #ifdef HAVE_LIBNOTIFY 24 | #include 25 | #include 26 | #include "active-sensor-libnotify.h" 27 | #endif 28 | 29 | #include "sensors-applet.h" 30 | 31 | struct _ActiveSensor { 32 | SensorsApplet *sensors_applet; 33 | 34 | /* widgets to render to display the sensor */ 35 | GtkWidget *label; 36 | GtkWidget *icon; 37 | GtkWidget *value; 38 | GtkWidget *graph; 39 | GtkWidget *graph_frame; 40 | 41 | GdkRGBA graph_color; 42 | 43 | GtkTreeRowReference *sensor_row; 44 | 45 | #ifdef HAVE_LIBNOTIFY 46 | NotifyNotification *notification[NUM_NOTIFS]; 47 | /* error timestamp - save the time of the last SENSOR_INTERFACE_ERROR */ 48 | time_t ierror_ts; 49 | #endif 50 | 51 | gboolean updated; 52 | 53 | /* alarm related stuff */ 54 | gint alarm_timeout_id[NUM_ALARMS]; 55 | gchar *alarm_command[NUM_ALARMS]; 56 | gint alarm_timeout; 57 | 58 | /* buffer of sensor values */ 59 | gdouble *sensor_values; 60 | 61 | /* length of sensor_values buffer */ 62 | gint num_samples; 63 | 64 | gdouble sensor_low_value; 65 | gdouble sensor_high_value; 66 | }; 67 | 68 | ActiveSensor *active_sensor_new(SensorsApplet *sensors_applet, GtkTreeRowReference *sensor_row); 69 | void active_sensor_destroy(ActiveSensor *active_sensor); 70 | gint active_sensor_compare(ActiveSensor *a, ActiveSensor *b); 71 | void active_sensor_update(ActiveSensor *sensor, SensorsApplet *sensors_applet); 72 | void active_sensor_icon_changed(ActiveSensor *sensor, SensorsApplet *sensors_applet); 73 | void active_sensor_update_graph_dimensions(ActiveSensor *as, gint dimensions[2]); 74 | void active_sensor_alarm_off(ActiveSensor *active_sensor, NotifType notif_type); 75 | 76 | #endif /* ACTIVE_SENSOR_H */ 77 | -------------------------------------------------------------------------------- /sensors-applet/main.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2005-2009 Alex Murray 3 | * Copyright (C) 2012-2021 MATE Developers 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifdef HAVE_CONFIG_H 21 | #include "config.h" 22 | #endif /* HAVE_CONFIG_H */ 23 | 24 | #include 25 | #include 26 | #include "sensors-applet.h" 27 | 28 | static gboolean sensors_applet_fill(MatePanelApplet *applet, 29 | const gchar *iid, 30 | gpointer data) { 31 | 32 | gboolean retval = FALSE; 33 | 34 | if (strcmp(iid, "SensorsApplet") == 0) { 35 | SensorsApplet *sensors_applet; 36 | 37 | sensors_applet = g_new0(SensorsApplet, 1); 38 | sensors_applet->applet = applet; 39 | sensors_applet_init(sensors_applet); 40 | retval = TRUE; 41 | } 42 | return retval; 43 | } 44 | 45 | PANEL_APPLET_FACTORY ("SensorsAppletFactory", 46 | PANEL_TYPE_APPLET, 47 | "SensorsApplet", 48 | sensors_applet_fill, 49 | NULL); 50 | -------------------------------------------------------------------------------- /sensors-applet/prefs-dialog.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2005-2009 Alex Murray 3 | * Copyright (C) 2012-2021 MATE Developers 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifndef PREFS_DIALOG_H 21 | #define PREFS_DIALOG_H 22 | 23 | #ifdef HAVE_CONFIG_H 24 | #include "config.h" 25 | #endif 26 | 27 | #include "sensors-applet.h" 28 | 29 | typedef struct { 30 | SensorsApplet *sensors_applet; 31 | GtkDialog *dialog; 32 | GtkNotebook *notebook; 33 | 34 | /* widgets for global prefs */ 35 | GtkSpinButton *timeout_spinbutton, *graph_size_spinbutton; 36 | GtkGrid *globals_grid; 37 | GtkHSeparator *globals_separator; 38 | GtkComboBoxText *display_mode_combo_box, *layout_mode_combo_box, *temperature_scale_combo_box; 39 | GtkLabel *timeout_label, *display_mode_label, *layout_mode_label, *temperature_scale_label, *graph_size_label, *update_header, *display_header; 40 | GtkAdjustment *timeout_adjust, *graph_size_adjust; 41 | GtkWidget *show_units; 42 | 43 | #ifdef HAVE_LIBNOTIFY 44 | GtkCheckButton *display_notifications; 45 | GtkLabel *notifications_header; 46 | #endif 47 | 48 | /* widgets for sensors tree */ 49 | GtkTreeView *view; 50 | GtkTreeViewColumn *id_column, *label_column, *enable_column, *icon_column; 51 | GtkCellRenderer *id_renderer, *label_renderer, *enable_renderer, *icon_renderer; 52 | GtkScrolledWindow *scrolled_window; 53 | 54 | GtkButtonBox *buttons_box; /* holds sensor reorder buttons */ 55 | GtkBox *sensors_hbox; /* holds scrolled window and buttons_vbox */ 56 | GtkBox *sensors_vbox; /* holds sensors_hbox and sensor_config_hbox */ 57 | GtkBox *sensor_config_hbox; /* holds config button */ 58 | GtkSizeGroup *size_group; /* so comboboxes all request the same size */ 59 | 60 | GtkButton *sensor_up_button; 61 | GtkButton *sensor_down_button; 62 | GtkButton *sensor_config_button; 63 | } PrefsDialog; 64 | 65 | /* function prototypes */ 66 | void prefs_dialog_open(SensorsApplet *sensors_applet); 67 | void prefs_dialog_close(SensorsApplet *sensors_applet); 68 | 69 | #endif /* PREFS_DIALOG_H */ 70 | -------------------------------------------------------------------------------- /sensors-applet/sensor-config-dialog.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2005-2009 Alex Murray 3 | * Copyright (C) 2012-2021 MATE Developers 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifndef SENSOR_CONFIG_DIALOG_H 21 | #define SENSOR_CONFIG_DIALOG_H 22 | 23 | #include "sensors-applet.h" 24 | 25 | /* function definition */ 26 | 27 | void sensor_config_dialog_create(SensorsApplet *sensors_applet); 28 | 29 | #endif /* SENSOR_CONFIG_DIALOG_H */ 30 | -------------------------------------------------------------------------------- /sensors-applet/sensors-applet-plugin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2005-2009 Alex Murray 3 | * Copyright (C) 2012-2021 MATE Developers 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifndef SENSORS_APPLET_PLUGIN_H 21 | #define SENSORS_APPLET_PLUGIN_H 22 | 23 | #include 24 | 25 | GQuark sensors_applet_plugin_error_quark(void); 26 | 27 | /* for error handling */ 28 | #define SENSORS_APPLET_PLUGIN_ERROR (sensors_applet_plugin_error_quark()) 29 | 30 | /** 31 | * Initialises the plugin, and returns the list of SensorsAppletSensorInfo 32 | * structs to create the sensors for this plugin from 33 | */ 34 | GList *sensors_applet_plugin_init(void); 35 | gdouble sensors_applet_plugin_get_sensor_value(const gchar *path, 36 | const gchar *id, 37 | SensorType type, 38 | GError **error); 39 | 40 | const gchar *sensors_applet_plugin_name(void); 41 | 42 | typedef void SensorsAppletPluginTestSensorFunc(GList **sensors, 43 | const gchar *path); 44 | void sensors_applet_plugin_find_sensors(GList **sensors, 45 | const gchar *path, 46 | SensorsAppletPluginTestSensorFunc); 47 | 48 | void sensors_applet_plugin_default_sensor_limits(SensorType type, 49 | gdouble *low_value, 50 | gdouble *high_value); 51 | 52 | void sensors_applet_plugin_add_sensor(GList **sensors, 53 | const gchar *path, 54 | const gchar *id, 55 | const gchar *label, 56 | SensorType type, 57 | gboolean enable, 58 | IconType icon, 59 | const gchar *graph_color); 60 | 61 | void sensors_applet_plugin_add_sensor_with_limits(GList **sensors, 62 | const gchar *path, 63 | const gchar *id, 64 | const gchar *label, 65 | SensorType type, 66 | gboolean enable, 67 | gdouble low_value, 68 | gdouble high_value, 69 | IconType icon, 70 | const gchar *graph_color); 71 | 72 | #endif // SENSORS_APPLET_PLUGIN_H 73 | -------------------------------------------------------------------------------- /sensors-applet/sensors-applet-plugins.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2005-2009 Alex Murray 3 | * Copyright (C) 2012-2021 MATE Developers 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifdef HAVE_CONFIG_H 21 | #include "config.h" 22 | #endif /* HAVE_CONFIG_H */ 23 | 24 | #ifdef HAVE_DLFCN_H 25 | #include 26 | #endif /* HAVE_DLFCN_H */ 27 | 28 | #include "sensors-applet-plugins.h" 29 | #include "sensors-applet-sensor.h" 30 | 31 | #define SENSORS_APPLET_USER_PLUGIN_DIR ".mate2/sensors-applet/plugins" 32 | 33 | static void load_all_plugins(SensorsApplet *sensors_applet, const gchar *path) { 34 | 35 | if (g_file_test(path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)) { 36 | GDir *dir; 37 | if ((dir = g_dir_open(path, 0, NULL)) != NULL) { 38 | const gchar *file; 39 | while ((file = g_dir_read_name(dir)) != NULL) { 40 | /* try and open plugin */ 41 | gchar *plugin_file; 42 | void *handle; 43 | SensorsAppletPluginInit init_fn; 44 | 45 | plugin_file = g_strdup_printf("%s/%s", path, file); 46 | g_debug("found %s in plugin directory", plugin_file); 47 | if ((handle = dlopen(plugin_file, RTLD_NOW)) != NULL) { 48 | SensorsAppletPluginName name_fn; 49 | SensorsAppletPluginGetSensorValue get_value_fn; 50 | 51 | if ((name_fn = dlsym(handle, "sensors_applet_plugin_name")) != NULL && 52 | (init_fn = dlsym(handle, "sensors_applet_plugin_init")) != NULL && 53 | (get_value_fn = dlsym(handle, "sensors_applet_plugin_get_sensor_value")) != NULL) { 54 | 55 | GList *sensors; 56 | g_debug("calling init function for plugin file %s", plugin_file); 57 | 58 | if ((sensors = init_fn()) != NULL) { 59 | GList *sensor; 60 | 61 | g_debug("registering plugin %s", name_fn()); 62 | g_hash_table_insert(sensors_applet->plugins, g_strdup(name_fn()), get_value_fn); 63 | 64 | for (sensor = g_list_first(sensors); sensor != NULL; sensor = g_list_next(sensor)) { 65 | 66 | SensorsAppletSensorInfo *sensor_info = (SensorsAppletSensorInfo *)sensor->data; 67 | sensors_applet_add_sensor(sensors_applet, 68 | sensor_info->path, 69 | sensor_info->id, 70 | sensor_info->label, 71 | name_fn(), 72 | sensor_info->type, 73 | sensor_info->enable, 74 | sensor_info->low_value, 75 | sensor_info->high_value, 76 | FALSE, /* ALARM OFF */ 77 | "", /* no alarm commands */ 78 | "", /* no alarm commands */ 79 | 0, /* alarm_timeout */ 80 | sensor_info->multiplier, 81 | sensor_info->offset, 82 | sensor_info->icon, 83 | sensor_info->graph_color); 84 | 85 | // sensors_applet_add_sensor() doesn't free strings, so free them here 86 | g_free(sensor_info->path); 87 | g_free(sensor_info->id); 88 | g_free(sensor_info->label); 89 | g_free(sensor_info->graph_color); 90 | g_free(sensor_info); 91 | } 92 | g_list_free(sensors); 93 | } else { 94 | g_debug("plugin could not find any sensors"); 95 | if (g_hash_table_lookup(sensors_applet->required_plugins, name_fn())) { 96 | g_debug("plugin is required - registering even though no sensors detected"); 97 | g_debug("registering plugin %s", name_fn()); 98 | g_hash_table_insert(sensors_applet->plugins, g_strdup(name_fn()), get_value_fn); 99 | } else { 100 | g_debug("unloading plugin"); 101 | } 102 | } 103 | 104 | } else { 105 | g_debug("plugin file %s does not contain the required interface", plugin_file); 106 | if (dlclose(handle) != 0) { 107 | g_debug("error closing plugin file %s", plugin_file); 108 | } 109 | } 110 | } else { 111 | g_debug("Could not dlopen: %s: %s", plugin_file, dlerror()); 112 | } 113 | g_free(plugin_file); 114 | } 115 | g_dir_close(dir); 116 | } else { 117 | g_debug("error opening plugin dir %s", path); 118 | } 119 | } else { 120 | g_debug("path %s is not a valid directory", path); 121 | } 122 | } 123 | 124 | void sensors_applet_plugins_load_all(SensorsApplet *sensors_applet) { 125 | const gchar *home; 126 | 127 | if ((home = g_get_home_dir()) != NULL) { 128 | gchar *path; 129 | path = g_build_filename(home, SENSORS_APPLET_USER_PLUGIN_DIR, NULL); 130 | load_all_plugins(sensors_applet, path); 131 | g_free(path); 132 | } else { 133 | g_warning("could not get home dir of user"); 134 | } 135 | 136 | load_all_plugins(sensors_applet, SENSORS_APPLET_PLUGIN_DIR); 137 | } 138 | 139 | SensorsAppletPluginGetSensorValue sensors_applet_plugins_get_sensor_value_func(SensorsApplet *sensors_applet, const gchar *plugin) { 140 | return g_hash_table_lookup(sensors_applet->plugins, plugin); 141 | } 142 | 143 | -------------------------------------------------------------------------------- /sensors-applet/sensors-applet-plugins.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2005-2009 Alex Murray 3 | * Copyright (C) 2012-2021 MATE Developers 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifndef SENSORS_APPLET_PLUGINS_H 21 | #define SENSORS_APPLET_PLUGINS_H 22 | 23 | #include "sensors-applet.h" 24 | 25 | typedef const gchar *(*SensorsAppletPluginName)(void); 26 | typedef GList *(*SensorsAppletPluginInit)(void); 27 | typedef gdouble (*SensorsAppletPluginGetSensorValue)(const gchar *path, 28 | const gchar *id, 29 | SensorType type, 30 | GError **error); 31 | 32 | void sensors_applet_plugins_load_all(SensorsApplet *sensors_applet); 33 | void sensors_applet_plugins_unload_all(SensorsApplet *sensors_applet); 34 | SensorsAppletPluginGetSensorValue sensors_applet_plugins_get_sensor_value_func(SensorsApplet *sensors_applet, 35 | const gchar *plugin); 36 | 37 | #endif // SENSORS_APPLET_PLUGINS_H 38 | -------------------------------------------------------------------------------- /sensors-applet/sensors-applet-sensor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2005-2009 Alex Murray 3 | * Copyright (C) 2012-2021 MATE Developers 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifndef SENSORS_APPLET_SENSOR_H 21 | #define SENSORS_APPLET_SENSOR_H 22 | 23 | #include 24 | 25 | /* forward declare for plugins to use */ 26 | typedef struct _SensorsApplet SensorsApplet; 27 | 28 | #define DEFAULT_GRAPH_COLOR "#ff0000" 29 | 30 | /* device icons */ 31 | typedef enum { 32 | CPU_ICON = 0, 33 | HDD_ICON, 34 | BATTERY_ICON, 35 | MEMORY_ICON, 36 | GPU_ICON, 37 | GENERIC_ICON, 38 | FAN_ICON, 39 | CASE_ICON, 40 | NUM_ICONS, 41 | } IconType; 42 | 43 | typedef enum { 44 | CURRENT_SENSOR = 0, 45 | FAN_SENSOR, 46 | TEMP_SENSOR, 47 | VOLTAGE_SENSOR 48 | } SensorType; 49 | 50 | typedef struct _SensorsAppletSensorInfo { 51 | gchar *path; /* must be dynamically allocated */ 52 | gchar *id; /* must be dynamically allocated */ 53 | gchar *label; /* must be dynamically allocated */ 54 | SensorType type; 55 | gboolean enable; 56 | gdouble low_value; 57 | gdouble high_value; 58 | gdouble multiplier; 59 | gdouble offset; 60 | IconType icon; 61 | gchar *graph_color; /* must be dynamically allocated */ 62 | } SensorsAppletSensorInfo; 63 | 64 | #endif // SENSORS_APPLET_SENSOR_H 65 | -------------------------------------------------------------------------------- /sensors-applet/sensors-applet-settings.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2005-2009 Alex Murray 3 | * 2013 Stefano Karapetsas 4 | * Copyright (C) 2012-2021 MATE Developers 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef SENSORS_APPLET_SETTINGS_H 22 | #define SENSORS_APPLET_SETTINGS_H 23 | 24 | #include "sensors-applet.h" 25 | #include 26 | #include 27 | 28 | #define FONT_SIZE "font-size" 29 | #define HIDE_UNITS "hide-units" 30 | #define DISPLAY_MODE "display-mode" 31 | #define LAYOUT_MODE "layout-mode" 32 | #define TEMPERATURE_SCALE "temperature-scale" 33 | #define DISPLAY_NOTIFICATIONS "display-notifications" 34 | #define TIMEOUT "timeout-delay" 35 | #define GRAPH_SIZE "graph-size" 36 | #define SENSORS_LIST "sensors-list" 37 | 38 | #define PATH "path" 39 | #define ID "id" 40 | #define INTERFACE "interface" 41 | #define LABEL "label" 42 | #define ENABLED "enabled" 43 | #define LOW_VALUE "low-value" 44 | #define HIGH_VALUE "high-value" 45 | #define ALARM_ENABLED "alarm-enabled" 46 | #define LOW_ALARM_COMMAND "low-alarm-command" 47 | #define HIGH_ALARM_COMMAND "high-alarm-command" 48 | #define ALARM_TIMEOUT "alarm-timeout" 49 | #define SENSOR_TYPE "sensor-type" 50 | #define MULTIPLIER "multiplier" 51 | #define OFFSET "offset" 52 | #define ICON_TYPE "icon-type" 53 | #define GRAPH_COLOR "graph-color" 54 | 55 | gchar* sensors_applet_settings_get_unique_id (const gchar *interface, const gchar *id, const gchar *path); 56 | gboolean sensors_applet_settings_load_sensors (SensorsApplet *sensors_applet); 57 | gboolean sensors_applet_settings_sort_sensors (SensorsApplet *sensors_applet); 58 | gboolean sensors_applet_settings_save_sensors (SensorsApplet *sensors_applet); 59 | 60 | #endif /* SENSORS_APPLET_SETTINGS_H*/ 61 | -------------------------------------------------------------------------------- /sensors-applet/sensors-applet.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2005-2009 Alex Murray 3 | * Copyright (C) 2012-2021 MATE Developers 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifndef SENSORS_APPLET_H 21 | #define SENSORS_APPLET_H 22 | 23 | #include 24 | #include 25 | #include "sensors-applet-sensor.h" 26 | 27 | #ifdef HAVE_CONFIG_H 28 | #include "config.h" 29 | #endif /* HAVE_CONFIG_H */ 30 | 31 | #ifdef HAVE_LIBNOTIFY 32 | #include 33 | #endif 34 | 35 | typedef struct _ActiveSensor ActiveSensor; 36 | 37 | #include "prefs-dialog.h" 38 | 39 | #define GRAPH_FRAME_EXTRA_WIDTH 6 40 | #define SENSORS_APPLET_ICON "mate-sensors-applet" 41 | 42 | static const gchar * const stock_icons[NUM_ICONS] = { 43 | "mate-sensors-applet-cpu", 44 | "mate-sensors-applet-drive-harddisk", 45 | "mate-sensors-applet-battery", 46 | "mate-sensors-applet-memory", 47 | "mate-sensors-applet-gpu", 48 | "mate-sensors-applet-chip", 49 | "mate-sensors-applet-fan", 50 | "mate-sensors-applet-case" 51 | }; 52 | 53 | #define DEFAULT_ICON_SIZE 22 54 | 55 | #define UNITS_CELSIUS "\302\260C" 56 | #define UNITS_FAHRENHEIT "\302\260F" 57 | #define UNITS_KELVIN "" 58 | #define UNITS_RPM _("RPM") 59 | #define UNITS_VOLTAGE _("V") 60 | #define UNITS_CURRENT _("A") 61 | 62 | /* enumeration used to identify columns in the GtkTreeStore data structure */ 63 | enum { 64 | PATH_COLUMN = 0, 65 | ID_COLUMN, 66 | LABEL_COLUMN, 67 | INTERFACE_COLUMN, 68 | SENSOR_TYPE_COLUMN, 69 | ENABLE_COLUMN, 70 | VISIBLE_COLUMN, 71 | LOW_VALUE_COLUMN, 72 | HIGH_VALUE_COLUMN, 73 | ALARM_ENABLE_COLUMN, 74 | LOW_ALARM_COMMAND_COLUMN, 75 | HIGH_ALARM_COMMAND_COLUMN, 76 | ALARM_TIMEOUT_COLUMN, 77 | MULTIPLIER_COLUMN, 78 | OFFSET_COLUMN, 79 | ICON_TYPE_COLUMN, 80 | ICON_PIXBUF_COLUMN, 81 | GRAPH_COLOR_COLUMN, 82 | N_COLUMNS 83 | }; 84 | 85 | /* for display mode */ 86 | typedef enum { 87 | DISPLAY_LABEL_WITH_VALUE = 0, 88 | DISPLAY_ICON_WITH_VALUE, 89 | DISPLAY_VALUE, 90 | DISPLAY_ICON, 91 | DISPLAY_GRAPH 92 | } DisplayMode; 93 | 94 | typedef enum { 95 | VALUE_BESIDE_LABEL = 0, 96 | VALUE_BELOW_LABEL 97 | } LayoutMode; 98 | 99 | typedef enum { 100 | KELVIN = 0, 101 | CELSIUS, 102 | FAHRENHEIT 103 | } TemperatureScale; 104 | 105 | /* types of Notifs - low and high alarm warnings and error conditions */ 106 | typedef enum { 107 | LOW_ALARM = 0, 108 | HIGH_ALARM, 109 | SENSOR_INTERFACE_ERROR, 110 | NUM_NOTIFS 111 | } NotifType; 112 | 113 | /* only always two type of alarms - may have more notif types */ 114 | #define NUM_ALARMS 2 115 | 116 | struct _SensorsApplet { 117 | /* the actual applet for this instance */ 118 | MatePanelApplet* applet; 119 | gint size; 120 | 121 | GtkTreeStore *sensors; 122 | gchar **sensors_hash_array; 123 | GtkTreeSelection *selection; 124 | 125 | GHashTable *required_plugins; 126 | GHashTable *plugins; 127 | 128 | guint timeout_id; 129 | /* preferences and about windows (if Gtk < 2.6) */ 130 | PrefsDialog *prefs_dialog; 131 | 132 | /* primary grid to contain the panel dispay - we pack the 133 | * list of labels and sensor values into this container */ 134 | GtkWidget *grid; 135 | GList *active_sensors; 136 | 137 | GSettings *settings; 138 | 139 | #ifdef HAVE_LIBNOTIFY 140 | NotifyNotification *notification; 141 | #endif // HAVE_LIBNOTIFY 142 | 143 | gboolean show_tooltip; 144 | }; 145 | 146 | /* non-static function prototypes */ 147 | void sensors_applet_init(SensorsApplet *sensors_applet); 148 | void sensors_applet_sensor_enabled(SensorsApplet *sensors_applet, GtkTreePath *path); 149 | void sensors_applet_sensor_disabled(SensorsApplet *sensors_applet, GtkTreePath *path); 150 | gboolean sensors_applet_update_active_sensors(SensorsApplet *sensors_applet); 151 | /** 152 | * to be called by things like prefs dialog to turn off a sensor alarm 153 | */ 154 | void sensors_applet_alarm_off(SensorsApplet *sensors_applet, 155 | GtkTreePath *path, 156 | NotifType notif_type); 157 | void sensors_applet_all_alarms_off(SensorsApplet *sensors_applet, GtkTreePath *path); 158 | void sensors_applet_icon_changed(SensorsApplet *sensors_applet, GtkTreePath *path); 159 | void sensors_applet_update_sensor(SensorsApplet *sensors_applet, GtkTreePath *path); 160 | 161 | void sensors_applet_display_layout_changed(SensorsApplet *sensors_applet); 162 | void sensors_applet_reorder_sensors(SensorsApplet *sensors_applet); 163 | gdouble sensors_applet_convert_temperature(gdouble value, 164 | TemperatureScale old, 165 | TemperatureScale new); 166 | 167 | void sensors_applet_notify_end(ActiveSensor *active_sensor, NotifType notif_type); 168 | void sensors_applet_notify_end_all(SensorsApplet *sensors_applet); 169 | void sensors_applet_notify_active_sensor(ActiveSensor *active_sensor, NotifType notif_type); 170 | GdkPixbuf *sensors_applet_load_icon(IconType icon_type); 171 | void sensors_applet_graph_size_changed(SensorsApplet *sensors_applet); 172 | 173 | typedef void SensorsInterfaceTestSensorFunc(SensorsApplet *sensors_applet, const gchar *path); 174 | void sensors_applet_find_sensors(SensorsApplet *sensors_applet, 175 | const gchar *path, 176 | SensorsInterfaceTestSensorFunc test_sensor); 177 | 178 | gboolean sensors_applet_add_sensor(SensorsApplet *sensors_applet, 179 | const gchar *path, 180 | const gchar *id, 181 | const gchar *label, 182 | const gchar *interface, 183 | SensorType type, 184 | gboolean enable, 185 | gdouble low_value, 186 | gdouble high_value, 187 | gboolean alarm_enable, 188 | const gchar *low_alarm_command, 189 | const gchar *high_alarm_command, 190 | gint alarm_timeout, 191 | gdouble multiplier, 192 | gdouble offset, 193 | IconType icon_type, 194 | const gchar *graph_color); 195 | 196 | #endif /* SENSORS_APPLET_H */ 197 | --------------------------------------------------------------------------------