├── .github ├── FUNDING.yml └── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── AUTHORS ├── LICENSE ├── PULL_REQUEST_TEMPLATE.md ├── README.md ├── Resource_Monitor@Ory0n ├── extension.js ├── icons │ ├── cpu-symbolic.svg │ ├── disk-space-symbolic.svg │ ├── disk-stats-symbolic.svg │ ├── eth-symbolic.svg │ ├── gpu-symbolic.svg │ ├── ram-symbolic.svg │ ├── swap-symbolic.svg │ └── wlan-symbolic.svg ├── metadata.json ├── prefs.css ├── prefs.js ├── prefs.ui └── schemas │ ├── com.github.Ory0n.Resource_Monitor.gschema.xml │ └── gschemas.compiled └── images ├── cpu.png ├── disk.png ├── global.png ├── gpu.png ├── main.png ├── net.png ├── ram.png ├── swap.png ├── thermal.png └── top.png /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | custom: ['https://www.paypal.com/paypalme/0ry0n'] 2 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - Version [e.g. 22] 29 | 30 | **Additional context** 31 | Add any other context about the problem here. 32 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Giuseppe Silvestro 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | Thank you for your contribution to the Resource_Monitor repo. 2 | 3 | ## Motivation 4 | 5 | ## Description 6 | 7 | ## Checklist 8 | 9 | - [ ] Your code builds clean without any errors or warnings. 10 | - [ ] You are using approved terminology. 11 | 12 | ## Please, submit your changes to the develop branch. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [ego]: https://extensions.gnome.org/extension/1634/resource-monitor/ 2 | 3 | # Resource_Monitor GNOME Shell Extension [Get it on GNOME Extensions][ego] 4 | [![License: GPL-3.0](https://img.shields.io/badge/License-GPL--3.0-blue.svg)](https://opensource.org/licenses/GPL-3.0) 5 | 6 | Resource_Monitor is a GNOME Shell extension that provides real-time monitoring of key system resources directly in the GNOME Shell top bar. It tracks CPU usage, load average, and temperature; RAM and swap usage; disk stats and space; GPU usage, memory, and temperature; and network activity for both WLAN and Ethernet connections. 7 | 8 | | Main View | 9 | | ------------------- | 10 | | ![Main View](/images/main.png) | 11 | 12 | ## GNOME Shell versions supported 13 | **45, 46, 47** 14 | - For older GNOME versions see the [gnome-3.28-3.38](../../tree/gnome-3.28-3.38) or [gnome-40-44](../../tree/gnome-40-44) branch. 15 | 16 | ## How-To Install 17 | 18 | ### From GNOME Extensions 19 | 20 | - Visit [GNOME Extensions](https://extensions.gnome.org/extension/1634/resource-monitor/) and install from there. 21 | 22 | ### Using the Latest Release 23 | 24 | 1. Download the latest [Release](../../releases/latest) from GitHub. 25 | 2. Unzip `Resource_Monitor@Ory0n.zip`. 26 | 3. Move the `Resource_Monitor@Ory0n` folder to `~/.local/share/gnome-shell/extensions/`. 27 | 4. Activate the extension using GNOME Extensions. 28 | 29 | ## Preferences 30 | 31 | | Global Preferences | CPU Preferences | RAM Preferences | 32 | | ------------------- | --------------- | --------------- | 33 | | ![Global Preferences](/images/global.png) | ![CPU Preferences](/images/cpu.png) | ![RAM Preferences](/images/ram.png) | 34 | 35 | | SWAP Preferences | DISK Preferences | NET Preferences | 36 | | ------------------- | ------------------- | ------------------- | 37 | | ![SWAP Preferences](/images/swap.png) | ![DISK Preferences](/images/disk.png) | ![NET Preferences](/images/net.png) | 38 | 39 | | THERMAL Preferences | GPU Preferences | 40 | | ------------------- | ------------------- | 41 | | ![THERMAL Preferences](/images/thermal.png) | ![GPU Preferences](/images/gpu.png) | 42 | 43 | ## About Units 44 | 45 | The units displayed in Resource_Monitor are in K, M, ... (powers of 1024), or KB, MB, ... (powers of 1000). 46 | 47 | ## Bug Reporting 48 | 49 | To report issues or request features, please use the [GitHub Issues](../../issues) tracker. Include relevant details to help us understand and address the problem efficiently. 50 | 51 | ## Change Log 52 | 53 | **Version 25 (nov 5, 2024)** 54 | - Cleanup code. 55 | - Other bug fixes. 56 | 57 | **Version 24 (Oct 28, 2024)** 58 | - Removed deprecated TreeView component. 59 | - Added custom peripheral name support. 60 | - Adjusted width with scale factor for better sizing. 61 | - Enhanced UI for improved user experience. 62 | - Other bug fixes. 63 | 64 | **Version 23 (Oct 18, 2024)** 65 | - Added support for GNOME 47. 66 | - Introduced memory alerts for RAM and SWAP usage to enhance monitoring capabilities. 67 | - Improved CPU frequency monitoring by reading all CPU core frequencies and displaying the highest value. 68 | - Added color coding for all items to enhance visual clarity and differentiation. 69 | - Integrated Zenpower thermal sensors; thanks to @mclvren for the contribution. 70 | - Fixed issues with CPU temperature reading. 71 | - Other bug fixes. 72 | 73 | **Version 22 (Jun 3, 2024)** 74 | - Added support for GNOME 46: thanks to @DanielusG. 75 | 76 | **Version 21 (Jan 2, 2024)** 77 | - Added support for GNOME 45. 78 | - Fixed left-click custom-program functionality. 79 | - Other bug fixes. 80 | 81 | ## Authors 82 | 83 | - **Giuseppe Silvestro** - *Initial work* - [0ry0n](https://github.com/0ry0n) 84 | 85 | ## License 86 | 87 | This project is licensed under the GNU GPL-3.0 License - see the [LICENSE.md](/LICENSE) file for details. 88 | -------------------------------------------------------------------------------- /Resource_Monitor@Ory0n/icons/cpu-symbolic.svg: -------------------------------------------------------------------------------- 1 | 2 | 14 | 16 | 34 | 37 | 42 | 48 | 54 | 60 | 66 | 72 | 78 | 84 | 90 | 96 | 102 | 108 | 114 | 115 | 116 | -------------------------------------------------------------------------------- /Resource_Monitor@Ory0n/icons/disk-space-symbolic.svg: -------------------------------------------------------------------------------- 1 | 2 | 14 | 16 | 27 | 28 | 46 | 49 | 53 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /Resource_Monitor@Ory0n/icons/disk-stats-symbolic.svg: -------------------------------------------------------------------------------- 1 | 2 | 14 | 16 | 34 | 36 | 40 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /Resource_Monitor@Ory0n/icons/eth-symbolic.svg: -------------------------------------------------------------------------------- 1 | 2 | 14 | 16 | 34 | 37 | 42 | 48 | 54 | 60 | 66 | 71 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /Resource_Monitor@Ory0n/icons/gpu-symbolic.svg: -------------------------------------------------------------------------------- 1 | 2 | 14 | 16 | 37 | 40 | 45 | 49 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /Resource_Monitor@Ory0n/icons/ram-symbolic.svg: -------------------------------------------------------------------------------- 1 | 2 | 14 | 16 | 34 | 37 | 43 | 49 | 55 | 61 | 67 | 73 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /Resource_Monitor@Ory0n/icons/swap-symbolic.svg: -------------------------------------------------------------------------------- 1 | 2 | 14 | 16 | 18 | 21 | 22 | 24 | 27 | 31 | 32 | 33 | 39 | 44 | 45 | 47 | 50 | 51 | 53 | 56 | 60 | 61 | 62 | 68 | 73 | 74 | 76 | 79 | 80 | 82 | 85 | 89 | 90 | 91 | 97 | 102 | 103 | 105 | 108 | 109 | 111 | 114 | 118 | 119 | 120 | 126 | 131 | 132 | 134 | 137 | 138 | 140 | 143 | 147 | 148 | 149 | 155 | 160 | 161 | 163 | 166 | 167 | 169 | 172 | 176 | 177 | 178 | 184 | 189 | 190 | 192 | 195 | 196 | 198 | 201 | 205 | 206 | 207 | 213 | 218 | 219 | 221 | 224 | 225 | 227 | 230 | 234 | 235 | 236 | 242 | 247 | 248 | 250 | 253 | 254 | 256 | 259 | 263 | 264 | 265 | 271 | 276 | 277 | 279 | 282 | 283 | 285 | 288 | 292 | 293 | 294 | 300 | 305 | 306 | 308 | 311 | 312 | 314 | 317 | 321 | 322 | 323 | 329 | 334 | 335 | 337 | 340 | 341 | 343 | 346 | 350 | 351 | 352 | 358 | 363 | 364 | 366 | 369 | 370 | 372 | 375 | 379 | 380 | 381 | 387 | 392 | 393 | 394 | 412 | 415 | 420 | 426 | 432 | 438 | 444 | 450 | 456 | 457 | 462 | 467 | 472 | 476 | 477 | 482 | 487 | 488 | 493 | 498 | 499 | 504 | 509 | 510 | 515 | 520 | 521 | 526 | 531 | 532 | 537 | 542 | 543 | 548 | 552 | 553 | 558 | 562 | 563 | 568 | 572 | 573 | 578 | 582 | 583 | 588 | 592 | 593 | 598 | 602 | 603 | 604 | -------------------------------------------------------------------------------- /Resource_Monitor@Ory0n/icons/wlan-symbolic.svg: -------------------------------------------------------------------------------- 1 | 2 | 14 | 16 | 34 | 37 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /Resource_Monitor@Ory0n/metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Resource Monitor", 3 | "uuid": "Resource_Monitor@Ory0n", 4 | "description": "Resource Monitor is a GNOME Shell extension that provides real-time monitoring of key system resources directly in the GNOME Shell top bar. It tracks CPU usage, load average, and temperature; RAM and swap usage; disk stats and space; GPU usage, memory, and temperature; and network activity for both WLAN and Ethernet connections.", 5 | "shell-version": ["45", "46", "47"], 6 | "url": "https://github.com/0ry0n/Resource_Monitor/", 7 | "donations": { 8 | "paypal": "0ry0n" 9 | }, 10 | "gettext-domain": "com-github-Ory0n-Resource_Monitor", 11 | "settings-schema": "com.github.Ory0n.Resource_Monitor" 12 | } 13 | -------------------------------------------------------------------------------- /Resource_Monitor@Ory0n/prefs.css: -------------------------------------------------------------------------------- 1 | .main-label { 2 | font-weight: bold; 3 | } 4 | -------------------------------------------------------------------------------- /Resource_Monitor@Ory0n/prefs.js: -------------------------------------------------------------------------------- 1 | /* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */ 2 | 3 | /* 4 | * Resource_Monitor is Copyright © 2018-2024 Giuseppe Silvestro 5 | * 6 | * This file is part of Resource_Monitor. 7 | * 8 | * Resource_Monitor is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * any later version. 12 | * 13 | * Resource_Monitor is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with Resource_Monitor. If not, see . 20 | */ 21 | 22 | import Gio from "gi://Gio"; 23 | import GObject from "gi://GObject"; 24 | import Gtk from "gi://Gtk"; 25 | import Gdk from "gi://Gdk"; 26 | 27 | import { 28 | ExtensionPreferences, 29 | gettext as _, 30 | } from "resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js"; 31 | 32 | // Settings 33 | const REFRESH_TIME = "refreshtime"; 34 | const EXTENSION_POSITION = "extensionposition"; 35 | const DECIMALS_STATUS = "decimalsstatus"; 36 | const LEFT_CLICK_STATUS = "leftclickstatus"; 37 | const RIGHT_CLICK_STATUS = "rightclickstatus"; 38 | const CUSTOM_LEFT_CLICK_STATUS = "customleftclickstatus"; 39 | 40 | const ICONS_STATUS = "iconsstatus"; 41 | const ICONS_POSITION = "iconsposition"; 42 | 43 | const ITEMS_POSITION = "itemsposition"; 44 | 45 | const COLOR_LIST_SEPARATOR = " "; 46 | 47 | const CPU_STATUS = "cpustatus"; 48 | const CPU_WIDTH = "cpuwidth"; 49 | const CPU_COLORS = "cpucolors"; 50 | const CPU_FREQUENCY_STATUS = "cpufrequencystatus"; 51 | const CPU_FREQUENCY_WIDTH = "cpufrequencywidth"; 52 | const CPU_FREQUENCY_COLORS = "cpufrequencycolors"; 53 | const CPU_FREQUENCY_UNIT_MEASURE = "cpufrequencyunitmeasure"; 54 | const CPU_LOADAVERAGE_STATUS = "cpuloadaveragestatus"; 55 | const CPU_LOADAVERAGE_WIDTH = "cpuloadaveragewidth"; 56 | const CPU_LOADAVERAGE_COLORS = "cpuloadaveragecolors"; 57 | 58 | const RAM_STATUS = "ramstatus"; 59 | const RAM_WIDTH = "ramwidth"; 60 | const RAM_COLORS = "ramcolors"; 61 | const RAM_UNIT = "ramunit"; 62 | const RAM_UNIT_MEASURE = "ramunitmeasure"; 63 | const RAM_MONITOR = "rammonitor"; 64 | const RAM_ALERT = "ramalert"; 65 | const RAM_ALERT_THRESHOLD = "ramalertthreshold"; 66 | 67 | const SWAP_STATUS = "swapstatus"; 68 | const SWAP_WIDTH = "swapwidth"; 69 | const SWAP_COLORS = "swapcolors"; 70 | const SWAP_UNIT = "swapunit"; 71 | const SWAP_UNIT_MEASURE = "swapunitmeasure"; 72 | const SWAP_MONITOR = "swapmonitor"; 73 | const SWAP_ALERT = "swapalert"; 74 | const SWAP_ALERT_THRESHOLD = "swapalertthreshold"; 75 | 76 | const DISK_STATS_STATUS = "diskstatsstatus"; 77 | const DISK_STATS_WIDTH = "diskstatswidth"; 78 | const DISK_STATS_COLORS = "diskstatscolors"; 79 | const DISK_STATS_MODE = "diskstatsmode"; 80 | const DISK_STATS_UNIT_MEASURE = "diskstatsunitmeasure"; 81 | const DISK_SPACE_STATUS = "diskspacestatus"; 82 | const DISK_SPACE_WIDTH = "diskspacewidth"; 83 | const DISK_SPACE_COLORS = "diskspacecolors"; 84 | const DISK_SPACE_UNIT = "diskspaceunit"; 85 | const DISK_SPACE_UNIT_MEASURE = "diskspaceunitmeasure"; 86 | const DISK_SPACE_MONITOR = "diskspacemonitor"; 87 | const DISK_DEVICES_DISPLAY_ALL = "diskdevicesdisplayall"; 88 | const DISK_DEVICES_LIST = "diskdeviceslist"; 89 | const DISK_DEVICES_LIST_SEPARATOR = " "; 90 | 91 | const NET_AUTO_HIDE_STATUS = "netautohidestatus"; 92 | const NET_UNIT = "netunit"; 93 | const NET_UNIT_MEASURE = "netunitmeasure"; 94 | const NET_ETH_STATUS = "netethstatus"; 95 | const NET_ETH_WIDTH = "netethwidth"; 96 | const NET_ETH_COLORS = "netethcolors"; 97 | const NET_WLAN_STATUS = "netwlanstatus"; 98 | const NET_WLAN_WIDTH = "netwlanwidth"; 99 | const NET_WLAN_COLORS = "netwlancolors"; 100 | 101 | const THERMAL_TEMPERATURE_UNIT = "thermaltemperatureunit"; 102 | const THERMAL_CPU_TEMPERATURE_STATUS = "thermalcputemperaturestatus"; 103 | const THERMAL_CPU_TEMPERATURE_WIDTH = "thermalcputemperaturewidth"; 104 | const THERMAL_CPU_COLORS = "thermalcpucolors"; 105 | const THERMAL_CPU_TEMPERATURE_DEVICES_LIST = "thermalcputemperaturedeviceslist"; 106 | const THERMAL_GPU_TEMPERATURE_STATUS = "thermalgputemperaturestatus"; 107 | const THERMAL_GPU_TEMPERATURE_WIDTH = "thermalgputemperaturewidth"; 108 | const THERMAL_GPU_COLORS = "thermalgpucolors"; 109 | const THERMAL_GPU_TEMPERATURE_DEVICES_LIST = "thermalgputemperaturedeviceslist"; 110 | const THERMAL_CPU_TEMPERATURE_DEVICES_LIST_SEPARATOR = "-"; 111 | 112 | const GPU_STATUS = "gpustatus"; 113 | const GPU_WIDTH = "gpuwidth"; 114 | const GPU_COLORS = "gpucolors"; 115 | const GPU_MEMORY_COLORS = "gpumemorycolors"; 116 | const GPU_MEMORY_UNIT = "gpumemoryunit"; 117 | const GPU_MEMORY_UNIT_MEASURE = "gpumemoryunitmeasure"; 118 | const GPU_MEMORY_MONITOR = "gpumemorymonitor"; 119 | const GPU_DISPLAY_DEVICE_NAME = "gpudisplaydevicename"; 120 | const GPU_DEVICES_LIST = "gpudeviceslist"; 121 | const GPU_DEVICES_LIST_SEPARATOR = ":"; 122 | 123 | const ResourceMonitorBuilderScope = GObject.registerClass( 124 | { 125 | Implements: [Gtk.BuilderScope], 126 | }, 127 | class ResourceMonitorBuilderScope extends GObject.Object { 128 | vfunc_create_closure(builder, handlerName, flags, connectObject) { 129 | if (flags & Gtk.BuilderClosureFlags.SWAPPED) 130 | throw new Error('Unsupported template signal flag "swapped"'); 131 | 132 | if (typeof this[handlerName] === "undefined") 133 | throw new Error(`${handlerName} is undefined`); 134 | 135 | return this[handlerName].bind(connectObject || this); 136 | } 137 | } 138 | ); 139 | 140 | const ResourceMonitorPrefsWidget = GObject.registerClass( 141 | class ResourceMonitorPrefsWidget extends GObject.Object { 142 | _connectSpinButton(settings, settingsName, element) { 143 | settings.bind( 144 | settingsName, 145 | element, 146 | "value", 147 | Gio.SettingsBindFlags.DEFAULT 148 | ); 149 | } 150 | 151 | _connectComboBox(settings, settingsName, element) { 152 | settings.bind( 153 | settingsName, 154 | element, 155 | "active-id", 156 | Gio.SettingsBindFlags.DEFAULT 157 | ); 158 | } 159 | 160 | _connectSwitchButton(settings, settingsName, element) { 161 | settings.bind( 162 | settingsName, 163 | element, 164 | "active", 165 | Gio.SettingsBindFlags.DEFAULT 166 | ); 167 | } 168 | 169 | _makeColorRow( 170 | settings, 171 | settingsName, 172 | listbox, 173 | text = "0.0", 174 | red = 224 / 255, 175 | green = 27 / 255, 176 | blue = 36 / 255, 177 | alpha = 1.0 178 | ) { 179 | const row = new Gtk.ListBoxRow(); 180 | const box = new Gtk.Box({ orientation: Gtk.Orientation.HORIZONTAL }); 181 | 182 | // Label for the row 183 | box.append( 184 | new Gtk.Label({ 185 | label: "Lower than", 186 | hexpand: true, 187 | halign: Gtk.Align.START, 188 | }) 189 | ); 190 | 191 | // Entry field for threshold value 192 | const entry = new Gtk.Entry({ 193 | input_purpose: Gtk.InputPurpose.NUMBER, 194 | text: text, 195 | margin_end: 8, 196 | }); 197 | entry.connect("changed", (widget) => { 198 | const index = row.get_index(); 199 | let colorsArray = settings.get_strv(settingsName); 200 | 201 | if (index >= 0 && index < colorsArray.length) { 202 | const [_, oldRed, oldGreen, oldBlue] = 203 | colorsArray[index].split(COLOR_LIST_SEPARATOR); 204 | colorsArray[ 205 | index 206 | ] = `${widget.text}${COLOR_LIST_SEPARATOR}${oldRed}${COLOR_LIST_SEPARATOR}${oldGreen}${COLOR_LIST_SEPARATOR}${oldBlue}`; 207 | settings.set_strv(settingsName, colorsArray); 208 | } 209 | }); 210 | box.append(entry); 211 | 212 | // Color button for selecting color 213 | const colorButton = new Gtk.ColorButton({ 214 | rgba: new Gdk.RGBA({ red, green, blue, alpha }), 215 | margin_end: 8, 216 | }); 217 | colorButton.connect("color-set", (widget) => { 218 | const index = row.get_index(); 219 | let colorsArray = settings.get_strv(settingsName); 220 | 221 | if (index >= 0 && index < colorsArray.length) { 222 | const rgba = widget.get_rgba(); 223 | const [threshold] = colorsArray[index].split(COLOR_LIST_SEPARATOR); 224 | colorsArray[ 225 | index 226 | ] = `${threshold}${COLOR_LIST_SEPARATOR}${rgba.red}${COLOR_LIST_SEPARATOR}${rgba.green}${COLOR_LIST_SEPARATOR}${rgba.blue}`; 227 | settings.set_strv(settingsName, colorsArray); 228 | } 229 | }); 230 | box.append(colorButton); 231 | 232 | // Delete button to remove row 233 | const deleteButton = new Gtk.Button({ icon_name: "edit-delete" }); 234 | deleteButton.connect("clicked", () => { 235 | const index = row.get_index(); 236 | let colorsArray = settings.get_strv(settingsName); 237 | 238 | if (index >= 0 && index < colorsArray.length) { 239 | listbox.remove(row); 240 | colorsArray.splice(index, 1); 241 | settings.set_strv(settingsName, colorsArray); 242 | } 243 | }); 244 | box.append(deleteButton); 245 | 246 | row.child = box; 247 | listbox.append(row); 248 | 249 | // Return the formatted color string for the settings array 250 | return `${text}${COLOR_LIST_SEPARATOR}${red}${COLOR_LIST_SEPARATOR}${green}${COLOR_LIST_SEPARATOR}${blue}`; 251 | } 252 | 253 | _makeColors(settings, settingsName, listBox, addButton) { 254 | const colorsArray = settings.get_strv(settingsName); 255 | 256 | for (const element of colorsArray) { 257 | const entry = element.split(COLOR_LIST_SEPARATOR); 258 | 259 | // Destructure and parse RGB values 260 | const [threshold, red, green, blue] = entry; 261 | const redValue = parseFloat(red); 262 | const greenValue = parseFloat(green); 263 | const blueValue = parseFloat(blue); 264 | 265 | // Create a color row with the parsed values 266 | this._makeColorRow( 267 | settings, 268 | settingsName, 269 | listBox, 270 | threshold, 271 | redValue, 272 | greenValue, 273 | blueValue 274 | ); 275 | } 276 | 277 | addButton.connect("clicked", (button) => { 278 | let colorsArray = settings.get_strv(settingsName); 279 | colorsArray.push(this._makeColorRow(settings, settingsName, listBox)); 280 | settings.set_strv(settingsName, colorsArray); 281 | }); 282 | } 283 | 284 | // Function to create a reusable label factory 285 | _createLabelFactory(getTextCallback) { 286 | const factory = new Gtk.SignalListItemFactory(); 287 | 288 | factory.connect("setup", (factory, listItem) => { 289 | const label = new Gtk.Label({ halign: Gtk.Align.START }); 290 | listItem.set_child(label); 291 | }); 292 | 293 | factory.connect("bind", (factory, listItem) => { 294 | const item = listItem.get_item(); 295 | const label = listItem.get_child(); 296 | label.set_text(getTextCallback(item)); 297 | }); 298 | 299 | return factory; 300 | } 301 | 302 | _makeThermalColumnView(view, type) { 303 | const model = new Gio.ListStore({ item_type: type }); 304 | const selection = new Gtk.NoSelection({ model: model }); 305 | view.set_model(selection); 306 | 307 | // Device Column 308 | const deviceFactory = this._createLabelFactory((item) => item.device); 309 | const deviceCol = new Gtk.ColumnViewColumn({ 310 | title: "Device", 311 | factory: deviceFactory, 312 | resizable: true, 313 | }); 314 | view.append_column(deviceCol); 315 | 316 | // Name Column 317 | const nameFactory = this._createLabelFactory((item) => item.name); 318 | const nameCol = new Gtk.ColumnViewColumn({ 319 | title: "Name", 320 | factory: nameFactory, 321 | resizable: true, 322 | }); 323 | view.append_column(nameCol); 324 | 325 | // Monitor Column 326 | const monitorFactory = new Gtk.SignalListItemFactory(); 327 | monitorFactory.connect("setup", (factory, listItem) => { 328 | const toggle = new Gtk.CheckButton({ halign: Gtk.Align.CENTER }); 329 | listItem.set_child(toggle); 330 | }); 331 | 332 | monitorFactory.connect("bind", (factory, listItem) => { 333 | const item = listItem.get_item(); 334 | const toggle = listItem.get_child(); 335 | 336 | // Set the initial state of the toggle button 337 | toggle.set_active(item.monitor); 338 | 339 | // Connect the toggled signal with the handler 340 | toggle.connect("toggled", (toggle) => { 341 | const [found, index] = model.find(item); 342 | if (found) { 343 | item.monitor = toggle.active; 344 | model.splice(index, 1, [item]); // Update model with new item state 345 | } 346 | }); 347 | }); 348 | 349 | const monitorCol = new Gtk.ColumnViewColumn({ 350 | title: "Monitor", 351 | factory: monitorFactory, 352 | resizable: true, 353 | }); 354 | view.append_column(monitorCol); 355 | 356 | return model; 357 | } 358 | 359 | _saveArrayToSettings(model, settings, key) { 360 | const array = []; 361 | for (let iter = 0; iter < model.get_n_items(); iter++) { 362 | const element = model.get_item(iter); 363 | array.push(element.getFormattedString()); 364 | } 365 | settings.set_strv(key, array); 366 | } 367 | 368 | _init({ settings, dir, metadata }) { 369 | this._settings = settings; 370 | this._dir = dir; 371 | this._metadata = metadata; 372 | 373 | // Gtk Css Provider 374 | this._provider = new Gtk.CssProvider(); 375 | this._provider.load_from_path(this._dir.get_path() + "/prefs.css"); 376 | Gtk.StyleContext.add_provider_for_display( 377 | Gdk.Display.get_default(), 378 | this._provider, 379 | Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION 380 | ); 381 | 382 | // Gtk Builder 383 | this._builder = new Gtk.Builder(); 384 | this._builder.set_scope(new ResourceMonitorBuilderScope()); 385 | this._builder.set_translation_domain(this._metadata["gettext-domain"]); 386 | this._builder.add_from_file(this._dir.get_path() + "/prefs.ui"); 387 | 388 | // PREFS 389 | this.notebook = this._builder.get_object("main_notebook"); 390 | 391 | // GLOBAL FRAME 392 | this._buildGlobal(); 393 | 394 | // CPU FRAME 395 | this._buildCpu(); 396 | 397 | // RAM FRAME 398 | this._buildRam(); 399 | 400 | // SWAP FRAME 401 | this._buildSwap(); 402 | 403 | // DISK FRAME 404 | this._buildDisk(); 405 | 406 | // NET FRAME 407 | this._buildNet(); 408 | 409 | // THERMAL FRAME 410 | this._buildThermal(); 411 | 412 | // GPU FRAME 413 | this._buildGpu(); 414 | } 415 | 416 | _buildGlobal() { 417 | this._secondsSpinbutton = this._builder.get_object("seconds_spinbutton"); 418 | this._extensionPositionCombobox = this._builder.get_object( 419 | "extension_position_combobox" 420 | ); 421 | this._extensionLeftClickRadioButtonSM = this._builder.get_object( 422 | "extension_left_click_radiobutton_sm" 423 | ); 424 | this._extensionLeftClickRadioButtonU = this._builder.get_object( 425 | "extension_left_click_radiobutton_u" 426 | ); 427 | this._extensionLeftClickRadioButtonCustom = this._builder.get_object( 428 | "extension_left_click_radiobutton_custom" 429 | ); 430 | this._extensionLeftClickEntryCustom = this._builder.get_object( 431 | "extension_left_click_entry_custom" 432 | ); 433 | this._extensionRightClickPrefs = this._builder.get_object( 434 | "extension_right_click_prefs" 435 | ); 436 | this._decimalsDisplay = this._builder.get_object("decimals_display"); 437 | this._iconsDisplay = this._builder.get_object("icons_display"); 438 | this._iconsPositionCombobox = this._builder.get_object( 439 | "icons_position_combobox" 440 | ); 441 | this._itemsPositionListbox = this._builder.get_object( 442 | "items_position_listbox" 443 | ); 444 | 445 | this._connectSpinButton( 446 | this._settings, 447 | REFRESH_TIME, 448 | this._secondsSpinbutton 449 | ); 450 | this._connectComboBox( 451 | this._settings, 452 | EXTENSION_POSITION, 453 | this._extensionPositionCombobox 454 | ); 455 | this._connectSwitchButton( 456 | this._settings, 457 | RIGHT_CLICK_STATUS, 458 | this._extensionRightClickPrefs 459 | ); 460 | this._connectSwitchButton( 461 | this._settings, 462 | DECIMALS_STATUS, 463 | this._decimalsDisplay 464 | ); 465 | this._connectSwitchButton( 466 | this._settings, 467 | ICONS_STATUS, 468 | this._iconsDisplay 469 | ); 470 | this._connectComboBox( 471 | this._settings, 472 | ICONS_POSITION, 473 | this._iconsPositionCombobox 474 | ); 475 | 476 | this._iconsDisplay.connect("state-set", (button) => { 477 | this._iconsPositionCombobox.sensitive = button.active; 478 | }); 479 | this._iconsPositionCombobox.sensitive = this._iconsDisplay.active; 480 | 481 | // LEFT-CLICK 482 | const active = this._settings.get_string(LEFT_CLICK_STATUS); 483 | const textBufferCustom = this._settings.get_string( 484 | CUSTOM_LEFT_CLICK_STATUS 485 | ); 486 | 487 | this._extensionLeftClickRadioButtonSM.connect("toggled", (button) => { 488 | if (button.active) { 489 | this._settings.set_string(LEFT_CLICK_STATUS, "gnome-system-monitor"); 490 | } 491 | }); 492 | this._extensionLeftClickRadioButtonSM.active = 493 | "gnome-system-monitor" === active; 494 | 495 | this._extensionLeftClickRadioButtonU.connect("toggled", (button) => { 496 | if (button.active) { 497 | this._settings.set_string(LEFT_CLICK_STATUS, "gnome-usage"); 498 | } 499 | }); 500 | this._extensionLeftClickRadioButtonU.active = "gnome-usage" === active; 501 | 502 | this._extensionLeftClickRadioButtonCustom.connect("toggled", (button) => { 503 | if (button.active) { 504 | const text = this._settings.get_string(CUSTOM_LEFT_CLICK_STATUS); 505 | this._settings.set_string(LEFT_CLICK_STATUS, text); 506 | } 507 | this._extensionLeftClickEntryCustom.sensitive = button.active; 508 | }); 509 | this._extensionLeftClickRadioButtonCustom.active = 510 | textBufferCustom === active; 511 | this._extensionLeftClickEntryCustom.sensitive = 512 | this._extensionLeftClickRadioButtonCustom.active; 513 | this._extensionLeftClickEntryCustom.text = textBufferCustom; 514 | 515 | this._extensionLeftClickEntryCustom.connect("changed", (tBuffer) => { 516 | this._settings.set_string(LEFT_CLICK_STATUS, tBuffer.text); 517 | this._settings.set_string(CUSTOM_LEFT_CLICK_STATUS, tBuffer.text); 518 | }); 519 | 520 | // ListBox 521 | let itemsPositionArray = this._settings.get_strv(ITEMS_POSITION); 522 | 523 | for (let i = 0; i < itemsPositionArray.length; i++) { 524 | const element = itemsPositionArray[i]; 525 | 526 | const row = new Gtk.ListBoxRow(); 527 | const box = new Gtk.Box({ orientation: Gtk.Orientation.HORIZONTAL }); 528 | 529 | const up = new Gtk.Button({ icon_name: "go-up" }); 530 | up.connect("clicked", (button) => { 531 | const index = row.get_index(); 532 | if (index > 0) { 533 | [itemsPositionArray[index], itemsPositionArray[index - 1]] = [ 534 | itemsPositionArray[index - 1], 535 | itemsPositionArray[index], 536 | ]; 537 | this._itemsPositionListbox.remove(row); 538 | this._itemsPositionListbox.insert(row, index - 1); 539 | 540 | this._settings.set_strv(ITEMS_POSITION, itemsPositionArray); 541 | } 542 | }); 543 | const down = new Gtk.Button({ icon_name: "go-down" }); 544 | down.connect("clicked", (button) => { 545 | const index = row.get_index(); 546 | if (index < itemsPositionArray.length) { 547 | [itemsPositionArray[index], itemsPositionArray[index + 1]] = [ 548 | itemsPositionArray[index + 1], 549 | itemsPositionArray[index], 550 | ]; 551 | this._itemsPositionListbox.remove(row); 552 | this._itemsPositionListbox.insert(row, index + 1); 553 | 554 | this._settings.set_strv(ITEMS_POSITION, itemsPositionArray); 555 | } 556 | }); 557 | 558 | box.append( 559 | new Gtk.Label({ 560 | label: element, 561 | hexpand: true, 562 | halign: Gtk.Align.START, 563 | }) 564 | ); 565 | box.append(up); 566 | box.append(down); 567 | 568 | row.child = box; 569 | 570 | this._itemsPositionListbox.insert(row, i); 571 | } 572 | } 573 | 574 | _buildCpu() { 575 | this._cpuDisplay = this._builder.get_object("cpu_display"); 576 | this._cpuWidthSpinbutton = this._builder.get_object( 577 | "cpu_width_spinbutton" 578 | ); 579 | this._cpuColorsAddButton = this._builder.get_object( 580 | "cpu_colors_add_button" 581 | ); 582 | this._cpuColorsListbox = this._builder.get_object("cpu_colors_listbox"); 583 | this._cpuFrequencyDisplay = this._builder.get_object( 584 | "cpu_frequency_display" 585 | ); 586 | this._cpuFrequencyWidthSpinbutton = this._builder.get_object( 587 | "cpu_frequency_width_spinbutton" 588 | ); 589 | this._cpuFrequencyColorsAddButton = this._builder.get_object( 590 | "cpu_frequency_colors_add_button" 591 | ); 592 | this._cpuFrequencyColorsListbox = this._builder.get_object( 593 | "cpu_frequency_colors_listbox" 594 | ); 595 | this._cpuFrequencyUnitMeasureCombobox = this._builder.get_object( 596 | "cpu_frequency_unit_measure_combobox" 597 | ); 598 | this._cpuLoadAverageDisplay = this._builder.get_object( 599 | "cpu_loadaverage_display" 600 | ); 601 | this._cpuLoadAverageWidthSpinbutton = this._builder.get_object( 602 | "cpu_loadaverage_width_spinbutton" 603 | ); 604 | this._cpuLoadAverageColorsAddButton = this._builder.get_object( 605 | "cpu_load_average_colors_add_button" 606 | ); 607 | this._cpuLoadAverageColorsListbox = this._builder.get_object( 608 | "cpu_load_average_colors_listbox" 609 | ); 610 | 611 | this._connectSwitchButton(this._settings, CPU_STATUS, this._cpuDisplay); 612 | this._connectSpinButton( 613 | this._settings, 614 | CPU_WIDTH, 615 | this._cpuWidthSpinbutton 616 | ); 617 | this._connectSwitchButton( 618 | this._settings, 619 | CPU_FREQUENCY_STATUS, 620 | this._cpuFrequencyDisplay 621 | ); 622 | this._connectSpinButton( 623 | this._settings, 624 | CPU_FREQUENCY_WIDTH, 625 | this._cpuFrequencyWidthSpinbutton 626 | ); 627 | this._connectComboBox( 628 | this._settings, 629 | CPU_FREQUENCY_UNIT_MEASURE, 630 | this._cpuFrequencyUnitMeasureCombobox 631 | ); 632 | this._connectSwitchButton( 633 | this._settings, 634 | CPU_LOADAVERAGE_STATUS, 635 | this._cpuLoadAverageDisplay 636 | ); 637 | this._connectSpinButton( 638 | this._settings, 639 | CPU_LOADAVERAGE_WIDTH, 640 | this._cpuLoadAverageWidthSpinbutton 641 | ); 642 | 643 | this._cpuDisplay.connect("state-set", (button) => { 644 | this._cpuWidthSpinbutton.sensitive = button.active; 645 | }); 646 | this._cpuWidthSpinbutton.sensitive = this._cpuDisplay.active; 647 | 648 | this._cpuFrequencyDisplay.connect("state-set", (button) => { 649 | this._cpuFrequencyWidthSpinbutton.sensitive = button.active; 650 | this._cpuFrequencyUnitMeasureCombobox.sensitive = button.active; 651 | }); 652 | this._cpuFrequencyWidthSpinbutton.sensitive = 653 | this._cpuFrequencyDisplay.active; 654 | this._cpuFrequencyUnitMeasureCombobox.sensitive = 655 | this._cpuFrequencyDisplay.active; 656 | 657 | this._cpuLoadAverageDisplay.connect("state-set", (button) => { 658 | this._cpuLoadAverageWidthSpinbutton.sensitive = button.active; 659 | }); 660 | this._cpuLoadAverageWidthSpinbutton.sensitive = 661 | this._cpuLoadAverageDisplay.active; 662 | 663 | // Cpu Colors 664 | this._makeColors( 665 | this._settings, 666 | CPU_COLORS, 667 | this._cpuColorsListbox, 668 | this._cpuColorsAddButton 669 | ); 670 | 671 | // Frequency Colors 672 | this._makeColors( 673 | this._settings, 674 | CPU_FREQUENCY_COLORS, 675 | this._cpuFrequencyColorsListbox, 676 | this._cpuFrequencyColorsAddButton 677 | ); 678 | 679 | // Load Average Colors 680 | this._makeColors( 681 | this._settings, 682 | CPU_LOADAVERAGE_COLORS, 683 | this._cpuLoadAverageColorsListbox, 684 | this._cpuLoadAverageColorsAddButton 685 | ); 686 | } 687 | 688 | _buildRam() { 689 | this._ramDisplay = this._builder.get_object("ram_display"); 690 | this._ramWidthSpinbutton = this._builder.get_object( 691 | "ram_width_spinbutton" 692 | ); 693 | this._ramColorsAddButton = this._builder.get_object( 694 | "ram_colors_add_button" 695 | ); 696 | this._ramColorsListbox = this._builder.get_object("ram_colors_listbox"); 697 | this._ramUnitCombobox = this._builder.get_object("ram_unit_combobox"); 698 | this._ramUnitMeasureCombobox = this._builder.get_object( 699 | "ram_unit_measure_combobox" 700 | ); 701 | this._ramMonitorCombobox = this._builder.get_object( 702 | "ram_monitor_combobox" 703 | ); 704 | this._ramAlert = this._builder.get_object("ram_alert"); 705 | this._ramAlertThresholdSpinbutton = this._builder.get_object( 706 | "ram_alert_threshold_spinbutton" 707 | ); 708 | 709 | this._connectSwitchButton(this._settings, RAM_STATUS, this._ramDisplay); 710 | this._connectSpinButton( 711 | this._settings, 712 | RAM_WIDTH, 713 | this._ramWidthSpinbutton 714 | ); 715 | this._connectComboBox(this._settings, RAM_UNIT, this._ramUnitCombobox); 716 | this._connectComboBox( 717 | this._settings, 718 | RAM_UNIT_MEASURE, 719 | this._ramUnitMeasureCombobox 720 | ); 721 | this._connectComboBox( 722 | this._settings, 723 | RAM_MONITOR, 724 | this._ramMonitorCombobox 725 | ); 726 | this._connectSwitchButton(this._settings, RAM_ALERT, this._ramAlert); 727 | this._connectSpinButton( 728 | this._settings, 729 | RAM_ALERT_THRESHOLD, 730 | this._ramAlertThresholdSpinbutton 731 | ); 732 | 733 | this._ramDisplay.connect("state-set", (button) => { 734 | this._ramWidthSpinbutton.sensitive = button.active; 735 | this._ramUnitCombobox.sensitive = button.active; 736 | this._ramUnitMeasureCombobox.sensitive = button.active; 737 | this._ramMonitorCombobox.sensitive = button.active; 738 | this._ramAlert.sensitive = button.active; 739 | this._ramAlertThresholdSpinbutton.sensitive = button.active; 740 | }); 741 | this._ramWidthSpinbutton.sensitive = this._ramDisplay.active; 742 | this._ramUnitCombobox.sensitive = this._ramDisplay.active; 743 | this._ramUnitMeasureCombobox.sensitive = this._ramDisplay.active; 744 | this._ramMonitorCombobox.sensitive = this._ramDisplay.active; 745 | this._ramAlert.sensitive = this._ramDisplay.active; 746 | this._ramAlertThresholdSpinbutton.sensitive = this._ramAlert.active; 747 | 748 | this._ramAlert.connect("state-set", (button) => { 749 | this._ramAlertThresholdSpinbutton.sensitive = button.active; 750 | }); 751 | this._ramAlertThresholdSpinbutton.sensitive = this._ramAlert.active; 752 | 753 | // Colors 754 | this._makeColors( 755 | this._settings, 756 | RAM_COLORS, 757 | this._ramColorsListbox, 758 | this._ramColorsAddButton 759 | ); 760 | } 761 | 762 | _buildSwap() { 763 | this._swapDisplay = this._builder.get_object("swap_display"); 764 | this._swapWidthSpinbutton = this._builder.get_object( 765 | "swap_width_spinbutton" 766 | ); 767 | this._swapColorsAddButton = this._builder.get_object( 768 | "swap_colors_add_button" 769 | ); 770 | this._swapColorsListbox = this._builder.get_object("swap_colors_listbox"); 771 | this._swapUnitCombobox = this._builder.get_object("swap_unit_combobox"); 772 | this._swapUnitMeasureCombobox = this._builder.get_object( 773 | "swap_unit_measure_combobox" 774 | ); 775 | this._swapMonitorCombobox = this._builder.get_object( 776 | "swap_monitor_combobox" 777 | ); 778 | this._swapAlert = this._builder.get_object("swap_alert"); 779 | this._swapAlertThresholdSpinbutton = this._builder.get_object( 780 | "swap_alert_threshold_spinbutton" 781 | ); 782 | 783 | this._connectSwitchButton(this._settings, SWAP_STATUS, this._swapDisplay); 784 | this._connectSpinButton( 785 | this._settings, 786 | SWAP_WIDTH, 787 | this._swapWidthSpinbutton 788 | ); 789 | this._connectComboBox(this._settings, SWAP_UNIT, this._swapUnitCombobox); 790 | this._connectComboBox( 791 | this._settings, 792 | SWAP_UNIT_MEASURE, 793 | this._swapUnitMeasureCombobox 794 | ); 795 | this._connectComboBox( 796 | this._settings, 797 | SWAP_MONITOR, 798 | this._swapMonitorCombobox 799 | ); 800 | this._connectSwitchButton(this._settings, SWAP_ALERT, this._swapAlert); 801 | this._connectSpinButton( 802 | this._settings, 803 | SWAP_ALERT_THRESHOLD, 804 | this._swapAlertThresholdSpinbutton 805 | ); 806 | 807 | this._swapDisplay.connect("state-set", (button) => { 808 | this._swapWidthSpinbutton.sensitive = button.active; 809 | this._swapUnitCombobox.sensitive = button.active; 810 | this._swapUnitMeasureCombobox.sensitive = button.active; 811 | this._swapMonitorCombobox.sensitive = button.active; 812 | this._swapAlert.sensitive = button.active; 813 | this._swapAlertThresholdSpinbutton.sensitive = button.active; 814 | }); 815 | this._swapWidthSpinbutton.sensitive = this._swapDisplay.active; 816 | this._swapUnitCombobox.sensitive = this._swapDisplay.active; 817 | this._swapUnitMeasureCombobox.sensitive = this._swapDisplay.active; 818 | this._swapMonitorCombobox.sensitive = this._swapDisplay.active; 819 | this._swapAlert.sensitive = this._swapDisplay.active; 820 | this._swapAlertThresholdSpinbutton.sensitive = this._swapAlert.active; 821 | 822 | this._swapAlert.connect("state-set", (button) => { 823 | this._swapAlertThresholdSpinbutton.sensitive = button.active; 824 | }); 825 | this._swapAlertThresholdSpinbutton.sensitive = this._swapAlert.active; 826 | 827 | // Colors 828 | this._makeColors( 829 | this._settings, 830 | SWAP_COLORS, 831 | this._swapColorsListbox, 832 | this._swapColorsAddButton 833 | ); 834 | } 835 | 836 | _buildDisk() { 837 | this._diskStatsDisplay = this._builder.get_object("disk_stats_display"); 838 | this._diskStatsWidthSpinbutton = this._builder.get_object( 839 | "disk_stats_width_spinbutton" 840 | ); 841 | this._diskStatsColorsAddButton = this._builder.get_object( 842 | "disk_stats_colors_add_button" 843 | ); 844 | this._diskStatsColorsListbox = this._builder.get_object( 845 | "disk_stats_colors_listbox" 846 | ); 847 | this._diskStatsModeCombobox = this._builder.get_object( 848 | "disk_stats_mode_combobox" 849 | ); 850 | this._diskStatsUnitMeasureCombobox = this._builder.get_object( 851 | "disk_stats_unit_measure_combobox" 852 | ); 853 | this._diskSpaceDisplay = this._builder.get_object("disk_space_display"); 854 | this._diskSpaceWidthSpinbutton = this._builder.get_object( 855 | "disk_space_width_spinbutton" 856 | ); 857 | this._diskSpaceColorsAddButton = this._builder.get_object( 858 | "disk_space_colors_add_button" 859 | ); 860 | this._diskSpaceColorsListbox = this._builder.get_object( 861 | "disk_space_colors_listbox" 862 | ); 863 | this._diskSpaceUnitCombobox = this._builder.get_object( 864 | "disk_space_unit_combobox" 865 | ); 866 | this._diskSpaceUnitMeasureCombobox = this._builder.get_object( 867 | "disk_space_unit_measure_combobox" 868 | ); 869 | this._diskSpaceMonitorCombobox = this._builder.get_object( 870 | "disk_space_monitor_combobox" 871 | ); 872 | this._diskDevicesDisplayAll = this._builder.get_object( 873 | "disk_devices_display_all" 874 | ); 875 | this._diskDevicesColumnView = this._builder.get_object( 876 | "disk_devices_columnview" 877 | ); 878 | 879 | this._connectSwitchButton( 880 | this._settings, 881 | DISK_STATS_STATUS, 882 | this._diskStatsDisplay 883 | ); 884 | this._connectSpinButton( 885 | this._settings, 886 | DISK_STATS_WIDTH, 887 | this._diskStatsWidthSpinbutton 888 | ); 889 | this._connectComboBox( 890 | this._settings, 891 | DISK_STATS_MODE, 892 | this._diskStatsModeCombobox 893 | ); 894 | this._connectComboBox( 895 | this._settings, 896 | DISK_STATS_UNIT_MEASURE, 897 | this._diskStatsUnitMeasureCombobox 898 | ); 899 | this._connectSwitchButton( 900 | this._settings, 901 | DISK_SPACE_STATUS, 902 | this._diskSpaceDisplay 903 | ); 904 | this._connectSpinButton( 905 | this._settings, 906 | DISK_SPACE_WIDTH, 907 | this._diskSpaceWidthSpinbutton 908 | ); 909 | this._connectComboBox( 910 | this._settings, 911 | DISK_SPACE_UNIT, 912 | this._diskSpaceUnitCombobox 913 | ); 914 | this._connectComboBox( 915 | this._settings, 916 | DISK_SPACE_UNIT_MEASURE, 917 | this._diskSpaceUnitMeasureCombobox 918 | ); 919 | this._connectComboBox( 920 | this._settings, 921 | DISK_SPACE_MONITOR, 922 | this._diskSpaceMonitorCombobox 923 | ); 924 | this._connectSwitchButton( 925 | this._settings, 926 | DISK_DEVICES_DISPLAY_ALL, 927 | this._diskDevicesDisplayAll 928 | ); 929 | 930 | this._diskStatsDisplay.connect("state-set", (button) => { 931 | this._diskStatsWidthSpinbutton.sensitive = button.active; 932 | this._diskStatsModeCombobox.sensitive = button.active; 933 | this._diskStatsUnitMeasureCombobox.sensitive = button.active; 934 | }); 935 | this._diskStatsWidthSpinbutton.sensitive = this._diskStatsDisplay.active; 936 | this._diskStatsModeCombobox.sensitive = this._diskStatsDisplay.active; 937 | this._diskStatsUnitMeasureCombobox.sensitive = 938 | this._diskStatsDisplay.active; 939 | 940 | this._diskSpaceDisplay.connect("state-set", (button) => { 941 | this._diskSpaceWidthSpinbutton.sensitive = button.active; 942 | this._diskSpaceUnitCombobox.sensitive = button.active; 943 | this._diskSpaceMonitorCombobox.sensitive = button.active; 944 | this._diskSpaceUnitMeasureCombobox.sensitive = button.active; 945 | }); 946 | this._diskSpaceWidthSpinbutton.sensitive = this._diskSpaceDisplay.active; 947 | this._diskSpaceUnitCombobox.sensitive = this._diskSpaceDisplay.active; 948 | this._diskSpaceMonitorCombobox.sensitive = this._diskSpaceDisplay.active; 949 | this._diskSpaceUnitMeasureCombobox.sensitive = 950 | this._diskSpaceDisplay.active; 951 | 952 | // ColumnView 953 | this._diskDevicesModel = new Gio.ListStore({ 954 | item_type: DiskElement, 955 | }); 956 | const selection = new Gtk.NoSelection({ 957 | model: this._diskDevicesModel, 958 | }); 959 | this._diskDevicesColumnView.set_model(selection); 960 | 961 | // Display Name Column 962 | const displayNameFactory = new Gtk.SignalListItemFactory(); 963 | displayNameFactory.connect("setup", (factory, listItem) => { 964 | const label = new Gtk.Entry(); 965 | listItem.set_child(label); 966 | }); 967 | displayNameFactory.connect("bind", (factory, listItem) => { 968 | const item = listItem.get_item(); 969 | const label = listItem.get_child(); 970 | label.set_text(item.displayName); 971 | label.connect("changed", (tBuffer) => { 972 | const [found, index] = this._diskDevicesModel.find(item); 973 | 974 | if (found) { 975 | item.setDisplayName(tBuffer.text); 976 | 977 | // Update if empty 978 | if (item.displayName !== tBuffer.text) { 979 | tBuffer.text = item.displayName; 980 | } 981 | 982 | this._diskDevicesModel.splice(index, 1, [item]); 983 | } 984 | }); 985 | }); 986 | 987 | const displayNameCol = new Gtk.ColumnViewColumn({ 988 | title: "Display Name", 989 | factory: displayNameFactory, 990 | resizable: true, 991 | }); 992 | this._diskDevicesColumnView.append_column(displayNameCol); 993 | 994 | // Device Column 995 | const deviceFactory = this._createLabelFactory((item) => item.device); 996 | 997 | const deviceCol = new Gtk.ColumnViewColumn({ 998 | title: "Device", 999 | factory: deviceFactory, 1000 | resizable: true, 1001 | }); 1002 | this._diskDevicesColumnView.append_column(deviceCol); 1003 | 1004 | // Mount Point Column 1005 | const mountPointFactory = this._createLabelFactory( 1006 | (item) => item.mountPoint 1007 | ); 1008 | 1009 | const mountPointCol = new Gtk.ColumnViewColumn({ 1010 | title: "Mount Point", 1011 | factory: mountPointFactory, 1012 | resizable: true, 1013 | }); 1014 | this._diskDevicesColumnView.append_column(mountPointCol); 1015 | 1016 | // Stats Column 1017 | const statsFactory = new Gtk.SignalListItemFactory(); 1018 | statsFactory.connect("setup", (factory, listItem) => { 1019 | const toggle = new Gtk.CheckButton({ halign: Gtk.Align.CENTER }); 1020 | listItem.set_child(toggle); 1021 | }); 1022 | statsFactory.connect("bind", (factory, listItem) => { 1023 | const item = listItem.get_item(); 1024 | const toggle = listItem.get_child(); 1025 | 1026 | // Set the initial state of the toggle button 1027 | toggle.set_active(item.stats); 1028 | 1029 | // Connect the toggled signal with the handler 1030 | toggle.connect("toggled", (toggle) => { 1031 | const [found, index] = this._diskDevicesModel.find(item); 1032 | if (found) { 1033 | item.stats = toggle.active; 1034 | this._diskDevicesModel.splice(index, 1, [item]); // Update model with new item state 1035 | } 1036 | }); 1037 | }); 1038 | 1039 | const statsCol = new Gtk.ColumnViewColumn({ 1040 | title: "Stats", 1041 | factory: statsFactory, 1042 | resizable: true, 1043 | }); 1044 | this._diskDevicesColumnView.append_column(statsCol); 1045 | 1046 | // Space Column 1047 | const spaceFactory = new Gtk.SignalListItemFactory(); 1048 | spaceFactory.connect("setup", (factory, listItem) => { 1049 | const toggle = new Gtk.CheckButton({ halign: Gtk.Align.CENTER }); 1050 | listItem.set_child(toggle); 1051 | }); 1052 | spaceFactory.connect("bind", (factory, listItem) => { 1053 | const item = listItem.get_item(); 1054 | const toggle = listItem.get_child(); 1055 | 1056 | // Set the initial state of the toggle button 1057 | toggle.set_active(item.space); 1058 | if (item.mountPoint === "") { 1059 | toggle.sensitive = false; 1060 | } 1061 | 1062 | // Connect the toggled signal with the handler 1063 | toggle.connect("toggled", (toggle) => { 1064 | const [found, index] = this._diskDevicesModel.find(item); 1065 | if (found) { 1066 | item.space = toggle.active; 1067 | this._diskDevicesModel.splice(index, 1, [item]); // Update model with new item state 1068 | } 1069 | }); 1070 | }); 1071 | 1072 | const spaceCol = new Gtk.ColumnViewColumn({ 1073 | title: "Space", 1074 | factory: spaceFactory, 1075 | resizable: true, 1076 | }); 1077 | this._diskDevicesColumnView.append_column(spaceCol); 1078 | 1079 | // Display All 1080 | this._diskDevicesDisplayAll.connect("state-set", (button) => { 1081 | // Refresh 1082 | this._readDiskDevices( 1083 | this._settings, 1084 | this._diskDevicesModel, 1085 | button.active 1086 | ); 1087 | }); 1088 | this._readDiskDevices( 1089 | this._settings, 1090 | this._diskDevicesModel, 1091 | this._diskDevicesDisplayAll.active 1092 | ); 1093 | 1094 | // Update 1095 | this._diskDevicesModel.connect( 1096 | "items-changed", 1097 | (_list, position, removed, added) => { 1098 | const diskElement = _list.get_item(position); 1099 | // This is necessary because model.remove_all() is used 1100 | if (diskElement) { 1101 | let disksArray = this._settings.get_strv(DISK_DEVICES_LIST); 1102 | 1103 | disksArray[position] = diskElement.getFormattedString(); 1104 | 1105 | this._settings.set_strv(DISK_DEVICES_LIST, disksArray); 1106 | } 1107 | } 1108 | ); 1109 | 1110 | // Stats Colors 1111 | this._makeColors( 1112 | this._settings, 1113 | DISK_STATS_COLORS, 1114 | this._diskStatsColorsListbox, 1115 | this._diskStatsColorsAddButton 1116 | ); 1117 | 1118 | // Space Colors 1119 | this._makeColors( 1120 | this._settings, 1121 | DISK_SPACE_COLORS, 1122 | this._diskSpaceColorsListbox, 1123 | this._diskSpaceColorsAddButton 1124 | ); 1125 | } 1126 | 1127 | _readDiskDevices(settings, model, loadAll) { 1128 | // Array format 1129 | // filesystem mount_point stats space display_name 1130 | 1131 | model.remove_all(); 1132 | 1133 | // Retrieve the disk device settings 1134 | let disksArray = settings.get_strv(DISK_DEVICES_LIST); 1135 | 1136 | // Execute 'df' command and parse the output 1137 | this._executeCommand(["df", "-x", "squashfs", "-x", "tmpfs"]) 1138 | .then((output) => { 1139 | const lines = output.split("\n"); 1140 | 1141 | // Parse each line of the command output, skipping the header line 1142 | for (let i = 1; i < lines.length - 1; i++) { 1143 | const entry = lines[i].trim().split(/\s+/); 1144 | const filesystem = entry[0]; 1145 | const mountPoint = entry[5]; 1146 | 1147 | // Initialize button states and display name 1148 | let statsButton = false; 1149 | let spaceButton = false; 1150 | let displayName = filesystem; 1151 | 1152 | // Check if the device is in the settings array 1153 | for (const diskConfig of disksArray) { 1154 | const [fs, mount, stBtn, spBtn, name] = diskConfig.split( 1155 | DISK_DEVICES_LIST_SEPARATOR 1156 | ); 1157 | if (filesystem === fs && mountPoint === mount) { 1158 | statsButton = stBtn === "true"; 1159 | spaceButton = spBtn === "true"; 1160 | displayName = name; 1161 | break; 1162 | } 1163 | } 1164 | 1165 | // Append disk entry to the model 1166 | model.append( 1167 | new DiskElement( 1168 | displayName, 1169 | filesystem, 1170 | mountPoint, 1171 | statsButton, 1172 | spaceButton 1173 | ) 1174 | ); 1175 | } 1176 | 1177 | if (loadAll) { 1178 | // Load additional devices from /proc/diskstats if needed 1179 | this._loadFile("/proc/diskstats") 1180 | .then((contents) => { 1181 | const lines = new TextDecoder().decode(contents).split("\n"); 1182 | 1183 | for (const line of lines) { 1184 | if (!line.trim()) continue; 1185 | 1186 | const entry = line.trim().split(/\s+/); 1187 | const devicePath = `/dev/${entry[2]}`; 1188 | 1189 | // Skip loop devices 1190 | if (entry[2].match(/loop*/)) continue; 1191 | 1192 | // Check if device is already listed 1193 | let isListed = false; 1194 | for (let iter = 0; iter < model.get_n_items(); iter++) { 1195 | if (devicePath === model.get_item(iter).device) { 1196 | isListed = true; 1197 | break; // Stop the for 1198 | } 1199 | } 1200 | 1201 | if (!isListed) { 1202 | // Initialize button states and display name 1203 | let statsButton = false; 1204 | let spaceButton = false; 1205 | let displayName = devicePath; 1206 | 1207 | // Check if the device is in the settings array 1208 | for (const diskConfig of disksArray) { 1209 | const [fs, mount, stBtn, spBtn, name] = diskConfig.split( 1210 | DISK_DEVICES_LIST_SEPARATOR 1211 | ); 1212 | if (devicePath === fs && "" === mount) { 1213 | statsButton = stBtn === "true"; 1214 | spaceButton = spBtn === "true"; 1215 | displayName = name; 1216 | break; 1217 | } 1218 | } 1219 | 1220 | model.append( 1221 | new DiskElement( 1222 | displayName, 1223 | devicePath, 1224 | "", 1225 | statsButton, 1226 | spaceButton 1227 | ) 1228 | ); 1229 | } 1230 | } 1231 | 1232 | // Save updated disksArray to settings 1233 | this._saveArrayToSettings(model, settings, DISK_DEVICES_LIST); 1234 | }) 1235 | .catch((err) => 1236 | console.error( 1237 | "[Resource_Monitor] Error loading /proc/diskstats:", 1238 | err 1239 | ) 1240 | ); 1241 | } else { 1242 | // Save updated disksArray to settings 1243 | this._saveArrayToSettings(model, settings, DISK_DEVICES_LIST); 1244 | } 1245 | }) 1246 | .catch((err) => 1247 | console.error("[Resource_Monitor] Error executing df command:", err) 1248 | ); 1249 | } 1250 | 1251 | _buildNet() { 1252 | this._netAutoHide = this._builder.get_object("net_auto_hide"); 1253 | this._netUnitCombobox = this._builder.get_object("net_unit_combobox"); 1254 | this._netUnitMeasureCombobox = this._builder.get_object( 1255 | "net_unit_measure_combobox" 1256 | ); 1257 | this._netEthDisplay = this._builder.get_object("net_eth_display"); 1258 | this._netEthWidthSpinbutton = this._builder.get_object( 1259 | "net_eth_width_spinbutton" 1260 | ); 1261 | this._netEthColorsAddButton = this._builder.get_object( 1262 | "net_eth_colors_add_button" 1263 | ); 1264 | this._netEthColorsListbox = this._builder.get_object( 1265 | "net_eth_colors_listbox" 1266 | ); 1267 | this._netWlanDisplay = this._builder.get_object("net_wlan_display"); 1268 | this._netWlanWidthSpinbutton = this._builder.get_object( 1269 | "net_wlan_width_spinbutton" 1270 | ); 1271 | this._netWlanColorsAddButton = this._builder.get_object( 1272 | "net_wlan_colors_add_button" 1273 | ); 1274 | this._netWlanColorsListbox = this._builder.get_object( 1275 | "net_wlan_colors_listbox" 1276 | ); 1277 | 1278 | this._connectSwitchButton( 1279 | this._settings, 1280 | NET_AUTO_HIDE_STATUS, 1281 | this._netAutoHide 1282 | ); 1283 | this._connectComboBox(this._settings, NET_UNIT, this._netUnitCombobox); 1284 | this._connectComboBox( 1285 | this._settings, 1286 | NET_UNIT_MEASURE, 1287 | this._netUnitMeasureCombobox 1288 | ); 1289 | this._connectSwitchButton( 1290 | this._settings, 1291 | NET_ETH_STATUS, 1292 | this._netEthDisplay 1293 | ); 1294 | this._connectSpinButton( 1295 | this._settings, 1296 | NET_ETH_WIDTH, 1297 | this._netEthWidthSpinbutton 1298 | ); 1299 | this._connectSwitchButton( 1300 | this._settings, 1301 | NET_WLAN_STATUS, 1302 | this._netWlanDisplay 1303 | ); 1304 | this._connectSpinButton( 1305 | this._settings, 1306 | NET_WLAN_WIDTH, 1307 | this._netWlanWidthSpinbutton 1308 | ); 1309 | 1310 | this._netEthDisplay.connect("state-set", (button) => { 1311 | this._netEthWidthSpinbutton.sensitive = button.active; 1312 | }); 1313 | this._netEthWidthSpinbutton.sensitive = this._netEthDisplay.active; 1314 | 1315 | this._netWlanDisplay.connect("state-set", (button) => { 1316 | this._netWlanWidthSpinbutton.sensitive = button.active; 1317 | }); 1318 | this._netWlanWidthSpinbutton.sensitive = this._netWlanDisplay.active; 1319 | 1320 | // Eth Colors 1321 | this._makeColors( 1322 | this._settings, 1323 | NET_ETH_COLORS, 1324 | this._netEthColorsListbox, 1325 | this._netEthColorsAddButton 1326 | ); 1327 | 1328 | // Wlan Colors 1329 | this._makeColors( 1330 | this._settings, 1331 | NET_WLAN_COLORS, 1332 | this._netWlanColorsListbox, 1333 | this._netWlanColorsAddButton 1334 | ); 1335 | } 1336 | 1337 | _buildThermal() { 1338 | this._thermalUnitCombobox = this._builder.get_object( 1339 | "thermal_unit_combobox" 1340 | ); 1341 | this._thermalCpuDisplay = this._builder.get_object("thermal_cpu_display"); 1342 | this._thermalCpuWidthSpinbutton = this._builder.get_object( 1343 | "thermal_cpu_width_spinbutton" 1344 | ); 1345 | this._thermalCpuColorsAddButton = this._builder.get_object( 1346 | "thermal_cpu_colors_add_button" 1347 | ); 1348 | this._thermalCpuColorsListbox = this._builder.get_object( 1349 | "thermal_cpu_colors_listbox" 1350 | ); 1351 | this._thermalCpuDevicesColumnView = this._builder.get_object( 1352 | "thermal_cpu_devices_columnview" 1353 | ); 1354 | this._thermalGpuDisplay = this._builder.get_object("thermal_gpu_display"); 1355 | this._thermalGpuWidthSpinbutton = this._builder.get_object( 1356 | "thermal_gpu_width_spinbutton" 1357 | ); 1358 | this._thermalGpuColorsAddButton = this._builder.get_object( 1359 | "thermal_gpu_colors_add_button" 1360 | ); 1361 | this._thermalGpuColorsListbox = this._builder.get_object( 1362 | "thermal_gpu_colors_listbox" 1363 | ); 1364 | this._thermalGpuDevicesColumnView = this._builder.get_object( 1365 | "thermal_gpu_devices_columnview" 1366 | ); 1367 | 1368 | this._connectComboBox( 1369 | this._settings, 1370 | THERMAL_TEMPERATURE_UNIT, 1371 | this._thermalUnitCombobox 1372 | ); 1373 | this._connectSwitchButton( 1374 | this._settings, 1375 | THERMAL_CPU_TEMPERATURE_STATUS, 1376 | this._thermalCpuDisplay 1377 | ); 1378 | this._connectSpinButton( 1379 | this._settings, 1380 | THERMAL_CPU_TEMPERATURE_WIDTH, 1381 | this._thermalCpuWidthSpinbutton 1382 | ); 1383 | this._connectSwitchButton( 1384 | this._settings, 1385 | THERMAL_GPU_TEMPERATURE_STATUS, 1386 | this._thermalGpuDisplay 1387 | ); 1388 | this._connectSpinButton( 1389 | this._settings, 1390 | THERMAL_GPU_TEMPERATURE_WIDTH, 1391 | this._thermalGpuWidthSpinbutton 1392 | ); 1393 | 1394 | this._thermalCpuDisplay.connect("state-set", (button) => { 1395 | this._thermalCpuWidthSpinbutton.sensitive = button.active; 1396 | }); 1397 | this._thermalCpuWidthSpinbutton.sensitive = 1398 | this._thermalCpuDisplay.active; 1399 | 1400 | this._thermalGpuDisplay.connect("state-set", (button) => { 1401 | this._thermalGpuWidthSpinbutton.sensitive = button.active; 1402 | }); 1403 | this._thermalGpuWidthSpinbutton.sensitive = 1404 | this._thermalGpuDisplay.active; 1405 | 1406 | // CPU 1407 | // ColumnView 1408 | this._thermalCpuDevicesModel = this._makeThermalColumnView( 1409 | this._thermalCpuDevicesColumnView, 1410 | ThermalCpuElement 1411 | ); 1412 | 1413 | // Array format 1414 | // name-status-path 1415 | let cpuTempsArray = this._settings.get_strv( 1416 | THERMAL_CPU_TEMPERATURE_DEVICES_LIST 1417 | ); 1418 | 1419 | // Detect sensors 1420 | // let command = 'for i in /sys/class/hwmon/hwmon*/temp*_input; do echo "$(<$(dirname $i)/name): $(cat ${i%_*}_label 2>/dev/null || echo $(basename ${i%_*})) $(readlink -f $i)"; done'; 1421 | this._executeCommand([ 1422 | "bash", 1423 | "-c", 1424 | 'if ls /sys/class/hwmon/hwmon*/temp*_input 1>/dev/null 2>&1; then echo "EXIST"; fi', 1425 | ]) 1426 | .then((output) => { 1427 | const result = output.trim().split("\n")[0]; 1428 | 1429 | if (result === "EXIST") { 1430 | // Execute command to detect relevant temperature sensors 1431 | this._executeCommand([ 1432 | "bash", 1433 | "-c", 1434 | 'for i in /sys/class/hwmon/hwmon*/temp*_input; do NAME="$(<$(dirname $i)/name)"; if [[ "$NAME" == "coretemp" ]] || [[ "$NAME" == "k10temp" ]] || [[ "$NAME" == "zenpower" ]]; then echo "$NAME: $(cat ${i%_*}_label 2>/dev/null || echo $(basename ${i%_*}))-$i"; fi done', 1435 | ]) 1436 | .then((inner_output) => { 1437 | const lines = inner_output.trim().split("\n"); 1438 | 1439 | for (const line of lines) { 1440 | if (!line) continue; 1441 | 1442 | const [device, path] = line.trim().split(/-/); 1443 | let statusButton = false; 1444 | 1445 | // Check if this device is in the saved temperature settings 1446 | for (const tempConfig of cpuTempsArray) { 1447 | const [savedDevice, buttonStatus, savedPath] = 1448 | tempConfig.split( 1449 | THERMAL_CPU_TEMPERATURE_DEVICES_LIST_SEPARATOR 1450 | ); 1451 | if (device === savedDevice) { 1452 | statusButton = buttonStatus === "true"; 1453 | break; 1454 | } 1455 | } 1456 | 1457 | // Append the CPU temperature data to the model 1458 | this._thermalCpuDevicesModel.append( 1459 | new ThermalCpuElement(path, device, statusButton) 1460 | ); 1461 | } 1462 | 1463 | // Save updated CPU temperature array to settings 1464 | this._saveArrayToSettings( 1465 | this._thermalCpuDevicesModel, 1466 | this._settings, 1467 | THERMAL_CPU_TEMPERATURE_DEVICES_LIST 1468 | ); 1469 | }) 1470 | .catch((error) => 1471 | console.error( 1472 | "[Resource_Monitor] Error fetching sensor details:", 1473 | error 1474 | ) 1475 | ); 1476 | } 1477 | }) 1478 | .catch((error) => 1479 | console.error( 1480 | "[Resource_Monitor] Error checking for sensor existence:", 1481 | error 1482 | ) 1483 | ); 1484 | 1485 | // Update 1486 | this._thermalCpuDevicesModel.connect( 1487 | "items-changed", 1488 | (_list, position, removed, added) => { 1489 | const cpuTempElement = _list.get_item(position); 1490 | let cpuTempsArray = this._settings.get_strv( 1491 | THERMAL_CPU_TEMPERATURE_DEVICES_LIST 1492 | ); 1493 | 1494 | cpuTempsArray[position] = cpuTempElement.getFormattedString(); 1495 | 1496 | this._settings.set_strv( 1497 | THERMAL_CPU_TEMPERATURE_DEVICES_LIST, 1498 | cpuTempsArray 1499 | ); 1500 | } 1501 | ); 1502 | 1503 | // Colors 1504 | this._makeColors( 1505 | this._settings, 1506 | THERMAL_CPU_COLORS, 1507 | this._thermalCpuColorsListbox, 1508 | this._thermalCpuColorsAddButton 1509 | ); 1510 | 1511 | // GPU 1512 | // ColumnView 1513 | this._thermalGpuDevicesModel = this._makeThermalColumnView( 1514 | this._thermalGpuDevicesColumnView, 1515 | ThermalGpuElement 1516 | ); 1517 | 1518 | // Array format 1519 | // uuid:name:status 1520 | let gpuTempsArray = this._settings.get_strv( 1521 | THERMAL_GPU_TEMPERATURE_DEVICES_LIST 1522 | ); 1523 | 1524 | // NVIDIA GPU detection 1525 | this._executeCommand(["nvidia-smi", "-L"]) 1526 | .then((output) => { 1527 | const lines = output.trim().split("\n"); 1528 | 1529 | for (const line of lines) { 1530 | if (!line) continue; 1531 | 1532 | const entry = line.trim().split(":"); 1533 | const device = entry[0].trim(); 1534 | const name = entry[1]?.trim().slice(0, -6); // Remove trailing "(UUID)" 1535 | const uuid = entry[2]?.trim().slice(0, -1); // Remove trailing ")" 1536 | 1537 | let statusButton = false; 1538 | 1539 | // Check if the UUID is in the saved GPU temperature settings 1540 | for (const gpuConfig of gpuTempsArray) { 1541 | const [savedUuid, name, statusBtn] = gpuConfig.split( 1542 | GPU_DEVICES_LIST_SEPARATOR 1543 | ); 1544 | 1545 | if (uuid === savedUuid) { 1546 | statusButton = statusBtn === "true"; 1547 | break; 1548 | } 1549 | } 1550 | 1551 | // Append the GPU data to the thermal model 1552 | this._thermalGpuDevicesModel.append( 1553 | new ThermalGpuElement(uuid, name, statusButton) 1554 | ); 1555 | } 1556 | 1557 | // Save updated GPU temperatures to settings 1558 | this._saveArrayToSettings( 1559 | this._thermalGpuDevicesModel, 1560 | this._settings, 1561 | THERMAL_GPU_TEMPERATURE_DEVICES_LIST 1562 | ); 1563 | }) 1564 | .catch((error) => 1565 | console.error( 1566 | "[Resource_Monitor] Error executing nvidia-smi command:", 1567 | error 1568 | ) 1569 | ); 1570 | 1571 | // Update 1572 | this._thermalGpuDevicesModel.connect( 1573 | "items-changed", 1574 | (_list, position, removed, added) => { 1575 | const gpuTempElement = _list.get_item(position); 1576 | let gpuTempsArray = this._settings.get_strv( 1577 | THERMAL_GPU_TEMPERATURE_DEVICES_LIST 1578 | ); 1579 | 1580 | gpuTempsArray[position] = gpuTempElement.getFormattedString(); 1581 | 1582 | this._settings.set_strv( 1583 | THERMAL_GPU_TEMPERATURE_DEVICES_LIST, 1584 | gpuTempsArray 1585 | ); 1586 | } 1587 | ); 1588 | 1589 | // Colors 1590 | this._makeColors( 1591 | this._settings, 1592 | THERMAL_GPU_COLORS, 1593 | this._thermalGpuColorsListbox, 1594 | this._thermalGpuColorsAddButton 1595 | ); 1596 | } 1597 | 1598 | _buildGpu() { 1599 | this._gpuDisplay = this._builder.get_object("gpu_display"); 1600 | this._gpuWidthSpinbutton = this._builder.get_object( 1601 | "gpu_width_spinbutton" 1602 | ); 1603 | this._gpuColorsAddButton = this._builder.get_object( 1604 | "gpu_colors_add_button" 1605 | ); 1606 | this._gpuColorsListbox = this._builder.get_object("gpu_colors_listbox"); 1607 | this._gpuMemoryColorsAddButton = this._builder.get_object( 1608 | "gpu_memory_colors_add_button" 1609 | ); 1610 | this._gpuMemoryColorsListbox = this._builder.get_object( 1611 | "gpu_memory_colors_listbox" 1612 | ); 1613 | this._gpuMemoryUnitCombobox = this._builder.get_object( 1614 | "gpu_memory_unit_combobox" 1615 | ); 1616 | this._gpuMemoryUnitMeasureCombobox = this._builder.get_object( 1617 | "gpu_memory_unit_measure_combobox" 1618 | ); 1619 | this._gpuMemoryMonitorCombobox = this._builder.get_object( 1620 | "gpu_memory_monitor_combobox" 1621 | ); 1622 | this._gpuDisplayDeviceName = this._builder.get_object( 1623 | "gpu_display_device_name" 1624 | ); 1625 | this._gpuDevicesColumnView = this._builder.get_object( 1626 | "gpu_devices_columnview" 1627 | ); 1628 | 1629 | this._connectSwitchButton(this._settings, GPU_STATUS, this._gpuDisplay); 1630 | this._connectSpinButton( 1631 | this._settings, 1632 | GPU_WIDTH, 1633 | this._gpuWidthSpinbutton 1634 | ); 1635 | this._connectComboBox( 1636 | this._settings, 1637 | GPU_MEMORY_UNIT, 1638 | this._gpuMemoryUnitCombobox 1639 | ); 1640 | this._connectComboBox( 1641 | this._settings, 1642 | GPU_MEMORY_UNIT_MEASURE, 1643 | this._gpuMemoryUnitMeasureCombobox 1644 | ); 1645 | this._connectComboBox( 1646 | this._settings, 1647 | GPU_MEMORY_MONITOR, 1648 | this._gpuMemoryMonitorCombobox 1649 | ); 1650 | this._connectSwitchButton( 1651 | this._settings, 1652 | GPU_DISPLAY_DEVICE_NAME, 1653 | this._gpuDisplayDeviceName 1654 | ); 1655 | 1656 | this._gpuDisplay.connect("state-set", (button) => { 1657 | this._gpuWidthSpinbutton.sensitive = button.active; 1658 | this._gpuMemoryUnitCombobox.sensitive = button.active; 1659 | this._gpuMemoryUnitMeasureCombobox.sensitive = button.active; 1660 | this._gpuMemoryMonitorCombobox.sensitive = button.active; 1661 | this._gpuDisplayDeviceName.sensitive = button.active; 1662 | }); 1663 | this._gpuWidthSpinbutton.sensitive = this._gpuDisplay.active; 1664 | this._gpuMemoryUnitCombobox.sensitive = this._gpuDisplay.active; 1665 | this._gpuMemoryUnitMeasureCombobox.sensitive = this._gpuDisplay.active; 1666 | this._gpuMemoryMonitorCombobox.sensitive = this._gpuDisplay.active; 1667 | this._gpuDisplayDeviceName.sensitive = this._gpuDisplay.active; 1668 | 1669 | // ColumnView 1670 | this._gpuDevicesModel = new Gio.ListStore({ 1671 | item_type: GpuElement, 1672 | }); 1673 | const selection = new Gtk.NoSelection({ 1674 | model: this._gpuDevicesModel, 1675 | }); 1676 | this._gpuDevicesColumnView.set_model(selection); 1677 | 1678 | // Display Name Column 1679 | const displayNameFactory = new Gtk.SignalListItemFactory(); 1680 | displayNameFactory.connect("setup", (factory, listItem) => { 1681 | const label = new Gtk.Entry(); 1682 | listItem.set_child(label); 1683 | }); 1684 | displayNameFactory.connect("bind", (factory, listItem) => { 1685 | const item = listItem.get_item(); 1686 | const label = listItem.get_child(); 1687 | label.set_text(item.displayName); 1688 | label.connect("changed", (tBuffer) => { 1689 | const [found, index] = this._gpuDevicesModel.find(item); 1690 | 1691 | if (found) { 1692 | item.setDisplayName(tBuffer.text); 1693 | 1694 | // Update if empty 1695 | if (item.displayName !== tBuffer.text) { 1696 | tBuffer.text = item.displayName; 1697 | } 1698 | 1699 | this._gpuDevicesModel.splice(index, 1, [item]); 1700 | } 1701 | }); 1702 | }); 1703 | 1704 | const displayNameCol = new Gtk.ColumnViewColumn({ 1705 | title: "Display Name", 1706 | factory: displayNameFactory, 1707 | resizable: true, 1708 | }); 1709 | this._gpuDevicesColumnView.append_column(displayNameCol); 1710 | 1711 | // Device Column 1712 | const deviceFactory = this._createLabelFactory((item) => item.device); 1713 | 1714 | const deviceCol = new Gtk.ColumnViewColumn({ 1715 | title: "Device", 1716 | factory: deviceFactory, 1717 | resizable: true, 1718 | }); 1719 | this._gpuDevicesColumnView.append_column(deviceCol); 1720 | 1721 | // Name Column 1722 | const nameFactory = this._createLabelFactory((item) => item.name); 1723 | 1724 | const nameCol = new Gtk.ColumnViewColumn({ 1725 | title: "Name", 1726 | factory: nameFactory, 1727 | resizable: true, 1728 | }); 1729 | this._gpuDevicesColumnView.append_column(nameCol); 1730 | 1731 | // Usage Column 1732 | const usageFactory = new Gtk.SignalListItemFactory(); 1733 | usageFactory.connect("setup", (factory, listItem) => { 1734 | const toggle = new Gtk.CheckButton({ halign: Gtk.Align.CENTER }); 1735 | listItem.set_child(toggle); 1736 | }); 1737 | usageFactory.connect("bind", (factory, listItem) => { 1738 | const item = listItem.get_item(); 1739 | const toggle = listItem.get_child(); 1740 | 1741 | // Set the initial state of the toggle button 1742 | toggle.set_active(item.usage); 1743 | 1744 | // Connect the toggled signal with the handler 1745 | toggle.connect("toggled", (toggle) => { 1746 | const [found, index] = this._gpuDevicesModel.find(item); 1747 | if (found) { 1748 | item.usage = toggle.active; 1749 | this._gpuDevicesModel.splice(index, 1, [item]); // Update model with new item state 1750 | } 1751 | }); 1752 | }); 1753 | 1754 | const usageCol = new Gtk.ColumnViewColumn({ 1755 | title: "Usage Monitor", 1756 | factory: usageFactory, 1757 | resizable: true, 1758 | }); 1759 | this._gpuDevicesColumnView.append_column(usageCol); 1760 | 1761 | // Memory Column 1762 | const memoryFactory = new Gtk.SignalListItemFactory(); 1763 | memoryFactory.connect("setup", (factory, listItem) => { 1764 | const toggle = new Gtk.CheckButton({ halign: Gtk.Align.CENTER }); 1765 | listItem.set_child(toggle); 1766 | }); 1767 | memoryFactory.connect("bind", (factory, listItem) => { 1768 | const item = listItem.get_item(); 1769 | const toggle = listItem.get_child(); 1770 | 1771 | // Set the initial state of the toggle button 1772 | toggle.set_active(item.memory); 1773 | 1774 | // Connect the toggled signal with the handler 1775 | toggle.connect("toggled", (toggle) => { 1776 | const [found, index] = this._gpuDevicesModel.find(item); 1777 | if (found) { 1778 | item.memory = toggle.active; 1779 | this._gpuDevicesModel.splice(index, 1, [item]); // Update model with new item state 1780 | } 1781 | }); 1782 | }); 1783 | 1784 | const memoryCol = new Gtk.ColumnViewColumn({ 1785 | title: "Memory Monitor", 1786 | factory: memoryFactory, 1787 | resizable: true, 1788 | }); 1789 | this._gpuDevicesColumnView.append_column(memoryCol); 1790 | 1791 | // Array format 1792 | // uuid:name:usage:memory:displayName 1793 | let gpuDevicesArray = this._settings.get_strv(GPU_DEVICES_LIST); 1794 | 1795 | // NVIDIA GPU detection 1796 | this._executeCommand(["nvidia-smi", "-L"]) 1797 | .then((output) => { 1798 | const lines = output.trim().split("\n"); 1799 | 1800 | for (const line of lines) { 1801 | if (!line) continue; 1802 | 1803 | const entry = line.trim().split(":"); 1804 | const device = entry[0].trim(); 1805 | const name = entry[1]?.trim().slice(0, -6); // Remove trailing "(UUID)" 1806 | const uuid = entry[2]?.trim().slice(0, -1); // Remove trailing ")" 1807 | 1808 | let usageButton = false; 1809 | let memoryButton = false; 1810 | let displayName = name; 1811 | 1812 | // Check if the UUID is in the saved GPU settings 1813 | for (const gpuConfig of gpuDevicesArray) { 1814 | const [ 1815 | savedUuid, 1816 | savedName, 1817 | usageStatus, 1818 | memoryStatus, 1819 | savedDisplayName, 1820 | ] = gpuConfig.split(GPU_DEVICES_LIST_SEPARATOR); 1821 | 1822 | if (uuid === savedUuid) { 1823 | usageButton = usageStatus === "true"; 1824 | memoryButton = memoryStatus === "true"; 1825 | displayName = savedDisplayName; 1826 | break; 1827 | } 1828 | } 1829 | 1830 | // Append the GPU data to the model 1831 | this._gpuDevicesModel.append( 1832 | new GpuElement(displayName, uuid, name, usageButton, memoryButton) 1833 | ); 1834 | } 1835 | 1836 | // Save updated GPU array to settings 1837 | this._saveArrayToSettings( 1838 | this._gpuDevicesModel, 1839 | this._settings, 1840 | GPU_DEVICES_LIST 1841 | ); 1842 | }) 1843 | .catch((error) => 1844 | console.error( 1845 | "[Resource_Monitor] Error executing nvidia-smi command:", 1846 | error 1847 | ) 1848 | ); 1849 | 1850 | // Update 1851 | this._gpuDevicesModel.connect( 1852 | "items-changed", 1853 | (_list, position, removed, added) => { 1854 | const gpuElement = _list.get_item(position); 1855 | let gpuDevicesArray = this._settings.get_strv(GPU_DEVICES_LIST); 1856 | 1857 | gpuDevicesArray[position] = gpuElement.getFormattedString(); 1858 | 1859 | this._settings.set_strv(GPU_DEVICES_LIST, gpuDevicesArray); 1860 | } 1861 | ); 1862 | 1863 | // Gpu Colors 1864 | this._makeColors( 1865 | this._settings, 1866 | GPU_COLORS, 1867 | this._gpuColorsListbox, 1868 | this._gpuColorsAddButton 1869 | ); 1870 | 1871 | // Memory Colors 1872 | this._makeColors( 1873 | this._settings, 1874 | GPU_MEMORY_COLORS, 1875 | this._gpuMemoryColorsListbox, 1876 | this._gpuMemoryColorsAddButton 1877 | ); 1878 | } 1879 | 1880 | _loadContents(file, cancellable = null) { 1881 | return new Promise((resolve, reject) => { 1882 | file.load_contents_async(cancellable, (source_object, res) => { 1883 | try { 1884 | const [ok, contents, etag_out] = 1885 | source_object.load_contents_finish(res); 1886 | if (ok) { 1887 | resolve(contents); 1888 | } else { 1889 | reject(new Error("Failed to load contents")); 1890 | } 1891 | } catch (error) { 1892 | reject( 1893 | new Error(`Error in load_contents_finish: ${error.message}`) 1894 | ); 1895 | } 1896 | }); 1897 | }); 1898 | } 1899 | 1900 | async _loadFile(path, cancellable = null) { 1901 | try { 1902 | const file = Gio.File.new_for_path(path); 1903 | const contents = await this._loadContents(file, cancellable); 1904 | return contents; 1905 | } catch (error) { 1906 | console.error(`[Resource_Monitor] Load File Error: ${error.message}`); 1907 | } 1908 | } 1909 | 1910 | _readOutput(proc, cancellable = null) { 1911 | return new Promise((resolve, reject) => { 1912 | proc.communicate_utf8_async(null, cancellable, (source_object, res) => { 1913 | try { 1914 | const [ok, stdout, stderr] = 1915 | source_object.communicate_utf8_finish(res); 1916 | if (ok) { 1917 | resolve(stdout); 1918 | } else { 1919 | reject(new Error(`Process failed with error: ${stderr}`)); 1920 | } 1921 | } catch (error) { 1922 | reject( 1923 | new Error(`Error in communicate_utf8_finish: ${error.message}`) 1924 | ); 1925 | } 1926 | }); 1927 | }); 1928 | } 1929 | 1930 | async _executeCommand(command, cancellable = null) { 1931 | try { 1932 | const proc = Gio.Subprocess.new( 1933 | command, 1934 | Gio.SubprocessFlags.STDOUT_PIPE | Gio.SubprocessFlags.STDERR_PIPE 1935 | ); 1936 | const output = await this._readOutput(proc, cancellable); 1937 | return output; 1938 | } catch (error) { 1939 | console.error( 1940 | `[Resource_Monitor] Execute Command Error: ${error.message}` 1941 | ); 1942 | } 1943 | } 1944 | } 1945 | ); 1946 | 1947 | const DiskElement = GObject.registerClass( 1948 | class DiskElement extends GObject.Object { 1949 | _init(displayName, device, mountPoint, stats, space) { 1950 | super._init(); 1951 | this.device = device; 1952 | this.mountPoint = mountPoint; 1953 | this.stats = stats; 1954 | this.space = space; 1955 | 1956 | this.setDisplayName(displayName); 1957 | } 1958 | 1959 | setDisplayName(displayName) { 1960 | if (displayName) { 1961 | this.displayName = displayName; 1962 | } else { 1963 | if (this.device.match(/(\/\w+)+/)) { 1964 | this.displayName = this.device.split("/").pop(); 1965 | } else { 1966 | this.displayName = this.device; 1967 | } 1968 | } 1969 | } 1970 | 1971 | getFormattedString() { 1972 | return `${this.device}${DISK_DEVICES_LIST_SEPARATOR}${this.mountPoint}${DISK_DEVICES_LIST_SEPARATOR}${this.stats}${DISK_DEVICES_LIST_SEPARATOR}${this.space}${DISK_DEVICES_LIST_SEPARATOR}${this.displayName}`; 1973 | } 1974 | } 1975 | ); 1976 | 1977 | const ThermalElement = GObject.registerClass( 1978 | class ThermalElement extends GObject.Object { 1979 | _init(device, name, monitor) { 1980 | super._init(); 1981 | this.device = device; 1982 | this.name = name; 1983 | this.monitor = monitor; 1984 | } 1985 | 1986 | getFormattedString() { 1987 | return ""; 1988 | } 1989 | } 1990 | ); 1991 | 1992 | const ThermalCpuElement = GObject.registerClass( 1993 | class ThermalCpuElement extends ThermalElement { 1994 | getFormattedString() { 1995 | return `${this.name}${THERMAL_CPU_TEMPERATURE_DEVICES_LIST_SEPARATOR}${this.monitor}${THERMAL_CPU_TEMPERATURE_DEVICES_LIST_SEPARATOR}${this.device}`; 1996 | } 1997 | } 1998 | ); 1999 | 2000 | const ThermalGpuElement = GObject.registerClass( 2001 | class ThermalGpuElement extends ThermalElement { 2002 | getFormattedString() { 2003 | return `${this.device}${GPU_DEVICES_LIST_SEPARATOR}${this.name}${GPU_DEVICES_LIST_SEPARATOR}${this.monitor}`; 2004 | } 2005 | } 2006 | ); 2007 | 2008 | const GpuElement = GObject.registerClass( 2009 | class GpuElement extends GObject.Object { 2010 | _init(displayName, device, name, usage, memory) { 2011 | super._init(); 2012 | this.device = device; 2013 | this.name = name; 2014 | this.usage = usage; 2015 | this.memory = memory; 2016 | 2017 | this.setDisplayName(displayName); 2018 | } 2019 | 2020 | setDisplayName(displayName) { 2021 | this.displayName = displayName || this.name; 2022 | } 2023 | 2024 | getFormattedString() { 2025 | return `${this.device}${GPU_DEVICES_LIST_SEPARATOR}${this.name}${GPU_DEVICES_LIST_SEPARATOR}${this.usage}${GPU_DEVICES_LIST_SEPARATOR}${this.memory}${GPU_DEVICES_LIST_SEPARATOR}${this.displayName}`; 2026 | } 2027 | } 2028 | ); 2029 | 2030 | export default class ResourceMonitorExtensionPreferences extends ExtensionPreferences { 2031 | getPreferencesWidget() { 2032 | const widget = new ResourceMonitorPrefsWidget({ 2033 | settings: this.getSettings(), 2034 | dir: this.dir, 2035 | metadata: this.metadata, 2036 | }); 2037 | 2038 | return widget.notebook; 2039 | } 2040 | } 2041 | -------------------------------------------------------------------------------- /Resource_Monitor@Ory0n/schemas/com.github.Ory0n.Resource_Monitor.gschema.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 2 6 | 7 | 8 | 9 | 10 | "right" 11 | 12 | 13 | 14 | 15 | true 16 | 17 | 18 | 19 | 20 | "gnome-system-monitor" 21 | 22 | 23 | 24 | 25 | "custom-program" 26 | 27 | 28 | 29 | 30 | true 31 | 32 | 33 | 34 | 35 | true 36 | 37 | 38 | 39 | 40 | "right" 41 | 42 | 43 | 44 | 45 | ["cpu", "ram", "swap", "stats", "space", "eth", "wlan", "gpu"] 46 | 47 | 48 | 49 | 50 | true 51 | 52 | 53 | 54 | 55 | 0 56 | 57 | 58 | 59 | 60 | [] 61 | 62 | 63 | 64 | 65 | false 66 | 67 | 68 | 69 | 70 | 0 71 | 72 | 73 | 74 | 75 | [] 76 | 77 | 78 | 79 | 80 | "auto" 81 | 82 | 83 | 84 | 85 | false 86 | 87 | 88 | 89 | 90 | 0 91 | 92 | 93 | 94 | 95 | [] 96 | 97 | 98 | 99 | 100 | true 101 | 102 | 103 | 104 | 105 | 0 106 | 107 | 108 | 109 | 110 | [] 111 | 112 | 113 | 114 | 115 | "numeric" 116 | 117 | 118 | 119 | 120 | "auto" 121 | 122 | 123 | 124 | 125 | "used" 126 | 127 | 128 | 129 | 130 | false 131 | 132 | 133 | 134 | 135 | 10 136 | 137 | 138 | 139 | 140 | false 141 | 142 | 143 | 144 | 145 | 0 146 | 147 | 148 | 149 | 150 | [] 151 | 152 | 153 | 154 | 155 | "numeric" 156 | 157 | 158 | 159 | 160 | "auto" 161 | 162 | 163 | 164 | 165 | "used" 166 | 167 | 168 | 169 | 170 | false 171 | 172 | 173 | 174 | 175 | 10 176 | 177 | 178 | 179 | 180 | true 181 | 182 | 183 | 184 | 185 | 0 186 | 187 | 188 | 189 | 190 | [] 191 | 192 | 193 | 194 | 195 | "multiple" 196 | 197 | 198 | 199 | 200 | "auto" 201 | 202 | 203 | 204 | 205 | true 206 | 207 | 208 | 209 | 210 | 0 211 | 212 | 213 | 214 | 215 | [] 216 | 217 | 218 | 219 | 220 | "numeric" 221 | 222 | 223 | 224 | 225 | "auto" 226 | 227 | 228 | 229 | 230 | "used" 231 | 232 | 233 | 234 | 235 | false 236 | 237 | 238 | 239 | 240 | [] 241 | 242 | 243 | 244 | 245 | false 246 | 247 | 248 | 249 | 250 | "bytes" 251 | 252 | 253 | 254 | 255 | "auto" 256 | 257 | 258 | 259 | 260 | true 261 | 262 | 263 | 264 | 265 | 0 266 | 267 | 268 | 269 | 270 | [] 271 | 272 | 273 | 274 | 275 | true 276 | 277 | 278 | 279 | 280 | 0 281 | 282 | 283 | 284 | 285 | [] 286 | 287 | 288 | 289 | 290 | "c" 291 | 292 | 293 | 294 | 295 | false 296 | 297 | 298 | 299 | 300 | 0 301 | 302 | 303 | 304 | 305 | [] 306 | 307 | 308 | 309 | 310 | [] 311 | 312 | 313 | 314 | 315 | false 316 | 317 | 318 | 319 | 320 | 0 321 | 322 | 323 | 324 | 325 | [] 326 | 327 | 328 | 329 | 330 | [] 331 | 332 | 333 | 334 | 335 | false 336 | 337 | 338 | 339 | 340 | 0 341 | 342 | 343 | 344 | 345 | [] 346 | 347 | 348 | 349 | 350 | [] 351 | 352 | 353 | 354 | 355 | "numeric" 356 | 357 | 358 | 359 | 360 | "auto" 361 | 362 | 363 | 364 | 365 | "used" 366 | 367 | 368 | 369 | 370 | true 371 | 372 | 373 | 374 | 375 | [] 376 | 377 | 378 | 379 | 380 | 381 | -------------------------------------------------------------------------------- /Resource_Monitor@Ory0n/schemas/gschemas.compiled: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0ry0n/Resource_Monitor/038db967fb1cf25d37583e3e712082dc9e3d6cb0/Resource_Monitor@Ory0n/schemas/gschemas.compiled -------------------------------------------------------------------------------- /images/cpu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0ry0n/Resource_Monitor/038db967fb1cf25d37583e3e712082dc9e3d6cb0/images/cpu.png -------------------------------------------------------------------------------- /images/disk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0ry0n/Resource_Monitor/038db967fb1cf25d37583e3e712082dc9e3d6cb0/images/disk.png -------------------------------------------------------------------------------- /images/global.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0ry0n/Resource_Monitor/038db967fb1cf25d37583e3e712082dc9e3d6cb0/images/global.png -------------------------------------------------------------------------------- /images/gpu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0ry0n/Resource_Monitor/038db967fb1cf25d37583e3e712082dc9e3d6cb0/images/gpu.png -------------------------------------------------------------------------------- /images/main.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0ry0n/Resource_Monitor/038db967fb1cf25d37583e3e712082dc9e3d6cb0/images/main.png -------------------------------------------------------------------------------- /images/net.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0ry0n/Resource_Monitor/038db967fb1cf25d37583e3e712082dc9e3d6cb0/images/net.png -------------------------------------------------------------------------------- /images/ram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0ry0n/Resource_Monitor/038db967fb1cf25d37583e3e712082dc9e3d6cb0/images/ram.png -------------------------------------------------------------------------------- /images/swap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0ry0n/Resource_Monitor/038db967fb1cf25d37583e3e712082dc9e3d6cb0/images/swap.png -------------------------------------------------------------------------------- /images/thermal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0ry0n/Resource_Monitor/038db967fb1cf25d37583e3e712082dc9e3d6cb0/images/thermal.png -------------------------------------------------------------------------------- /images/top.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0ry0n/Resource_Monitor/038db967fb1cf25d37583e3e712082dc9e3d6cb0/images/top.png --------------------------------------------------------------------------------