├── .exrc ├── .flake8 ├── .gitignore ├── .gitmodules ├── .travis.yml ├── COPYING ├── Makefile ├── README.md ├── assets ├── revolt-logo.png ├── revolt-screenshot.png └── revolt-statusicon-screenshot.png ├── bin └── revolt ├── configure ├── gtk ├── custom.css ├── menus.ui └── preferences.ui ├── icons ├── 16x16 │ └── apps │ │ └── revolt.png ├── 16x16@2x │ └── apps ├── 24x24 │ └── apps │ │ └── revolt.png ├── 24x24@2x │ └── apps │ │ └── revolt.png ├── 32x32 │ └── apps │ │ └── revolt.png ├── 64x64 │ └── apps │ │ └── revolt.png ├── hicolor ├── revolt-about.svg └── scalable │ ├── apps │ ├── org.perezdecastro.Revolt-symbolic.svg │ ├── revolt-symbolic.svg │ └── revolt.svg │ └── status │ ├── org.perezdecastro.Revolt-status-blink-symbolic.svg │ ├── org.perezdecastro.Revolt-status-online-symbolic.svg │ ├── revolt-status-blink-symbolic.svg │ └── revolt-status-online-symbolic.svg ├── install-functions.sh ├── install.sh ├── make-flatpak.sh ├── org.perezdecastro.Revolt.appdata.xml ├── org.perezdecastro.Revolt.desktop ├── org.perezdecastro.Revolt.gresources.xml ├── org.perezdecastro.Revolt.gschema.xml ├── org.perezdecastro.Revolt.json ├── revolt.flatpakref ├── revolt ├── __init__.py ├── accelerators.py ├── app.py ├── statusicon.py ├── util.py └── window.py └── syncrepo.sh /.exrc: -------------------------------------------------------------------------------- 1 | set makeprg=flake8 2 | -------------------------------------------------------------------------------- /.flake8: -------------------------------------------------------------------------------- 1 | ; vim: set ft=cfg: 2 | [flake8] 3 | filename = *.py 4 | hang-closing = False 5 | max-line-length = 110 6 | inline-quotes = double 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | gschemas.compiled 2 | org.perezdecastro.Revolt.gresource 3 | config.mk 4 | __pycache__ 5 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "ostree-releng-scripts"] 2 | path = ostree-releng-scripts 3 | url = https://github.com/ostreedev/ostree-releng-scripts 4 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: python 3 | python: 4 | - 3.5 5 | install: 6 | - pip install flake8 flake8-quotes 7 | script: 8 | - ln -s revolt revolt.py 9 | - flake8 . 10 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | 2 | APP_ID ?= org.perezdecastro.Revolt 3 | 4 | all: $(APP_ID).gresource 5 | 6 | config.mk: configure 7 | @echo '==== Running "configure" script...' 8 | @./configure 9 | @echo '==== Run "configure --help" for more options' 10 | 11 | -include config.mk 12 | 13 | RESOURCE_FILES := $(wildcard gtk/*.ui gtk/*.css icon/*.svg) 14 | $(APP_ID).gresource: $(APP_ID).gresources.xml $(RESOURCE_FILES) 15 | glib-compile-resources --target=$@ $< 16 | 17 | gschemas.compiled: $(APP_ID).gschema.xml 18 | glib-compile-schemas . 19 | 20 | run: $(APP_ID).gresource gschemas.compiled 21 | XDG_DATA_DIRS="$${XDG_DATA_DIRS}:$(CURDIR)" GSETTINGS_SCHEMA_DIR='$(CURDIR)' __REVOLT_DEVELOPMENT=1 '$(CURDIR)/bin/revolt' 22 | 23 | install: 24 | SKIP_ICON_CACHE_UPDATE=1 ./install.sh --prefix='$(PREFIX)' $(if $(DESTDIR),--destdir='$(DESTDIR)') 25 | python3 -m compileall $(if $(DESTDIR),-d '$(DESTDIR)') $(DESTDIR)$(PREFIX)/share/revolt/py/revolt/*.py 26 | 27 | .PHONY: install run 28 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![Logo](https://github.com/aperezdc/revolt/blob/master/assets/revolt-logo.png) 2 | 3 | Revolt 4 | ====== 5 | 6 | Revolt is a small application which wraps [Element](https://element.io) to 7 | provide better integration with desktop environments in general, and 8 | [GNOME](http://www.gnome.org) in particular: 9 | 10 | * Having Element as a “standalone” application with its own window, 11 | launcher, icon, etc. instead of it living in a browser tab. 12 | * Persistent notifications (for desktop environments supporting them, i.e. 13 | GNOME). Notifications are automatically prevented when the Revolt window is 14 | focused. 15 | * Status icon for desktop environment which have a tray bar applet (XFCE, 16 | Budgie, likely many others). 17 | 18 | ![Status icon in Budgie](https://github.com/aperezdc/revolt/blob/master/assets/revolt-statusicon-screenshot.png) 19 | ![Application Window](https://github.com/aperezdc/revolt/blob/master/assets/revolt-screenshot.png) 20 | 21 | 22 | Installation 23 | ------------ 24 | 25 | The recommended installation method is to use [Flatpak](http://flatpak.org). 26 | Starting with version `0.6.13` using a single command is enough (if you want to 27 | intall in you user directory, add `--user` to the command): 28 | 29 | ```sh 30 | flatpak install --from https://flatpak.perezdecastro.org/revolt.flatpakref 31 | ``` 32 | 33 | If your Flatpak version is older than 0.6.13, use the following commands 34 | instead: 35 | 36 | ```sh 37 | wget https://flatpak.perezdecastro.org/revolt.flatpakref 38 | flatpak install --from revolt.flatpakref 39 | rm revolt.flatpakref 40 | ``` 41 | 42 | Once installed, updates will be installed automatically when using `flatpak update`. 43 | 44 | You can also download [the .flatpakref 45 | file](https://flatpak.perezdecastro.org/revolt.flatpakref) and double-click on 46 | it to have GNOME Software install the application. GNOME Software will also 47 | notify you of updates and give you the option to install them. 48 | 49 | ### Portal Helpers 50 | 51 | **IMPORTANT**: Many distributions *do not* install the XDG helper programs for 52 | the sandboxed applications, which are needed for some features to work. Please 53 | install them using your distribution's package manager: 54 | 55 | * Debian: [xdg-desktop-portal-gtk](https://packages.debian.org/search?keywords=xdg-desktop-portal-gtk). 56 | * Arch Linux: [xdg-desktop-portal-gtk](https://www.archlinux.org/packages/extra/x86_64/xdg-desktop-portal-gtk/). 57 | * Fedora: [xdg-desktop-portal-gtk](https://admin.fedoraproject.org/pkgdb/package/rpms/xdg-desktop-portal-gtk/). 58 | 59 | Some features, remarkably the desktop notifications, _will not work without the 60 | portal helpers_. 61 | 62 | ### GNOME Runtime 63 | 64 | Revolt uses the GNOME Flatpak runtime. Depending on the version of Flatpak 65 | installed on your system, you may need to install it manually. You can check 66 | whether the runtime is missing by trying to run Revolt in a terminal: 67 | 68 | ``` 69 | % flatpak run org.perezdecastro.Revolt 70 | error: runtime/org.gnome.Platform/x86_64/3.22 not installed 71 | % 72 | ``` 73 | 74 | If you need to install the runtime manually, you can do so by issuing the 75 | following command: 76 | 77 | ``` 78 | flatpak [--user] remote-add --from gnome https://sdk.gnome.org/gnome.flatpakrepo 79 | ``` 80 | 81 | If your Flatpak version is older than 0.6.13, use the following commands 82 | instead: 83 | 84 | ```sh 85 | wget https://sdk.gnome.org/keys/gnome-sdk.gpg 86 | flatpak [--user] remote-add --gpg-import=gnome-sdk.gpg gnome https://sdk.gnome.org/repo/ 87 | flatpak [--user] install gnome org.gnome.Platform 3.22 88 | ``` 89 | 90 | Manual Installation 91 | ------------------- 92 | 93 | Install the files to their locations: 94 | 95 | ```sh 96 | sudo ./install.sh --prefix=/usr --log-file=install.log 97 | ``` 98 | 99 | (Specifying a log file is optional, but if you plan on [upgrading](#upgrading) 100 | later on using the `install.sh` script, it is recommended to use it.) 101 | 102 | Install the dependencies: 103 | 104 | ```sh 105 | sudo apt-get install python-gobject python3-gi libwebkit2gtk-4.0 106 | ``` 107 | 108 | Now you should be able to launch Revolt from the GNOME Shell. 109 | 110 | ### Upgrading 111 | 112 | The `install.sh` script can be used to upgrade an existing installation as 113 | well. The recommended way is to save a log of installed files, so the upgrade 114 | process can remove stray files from the old version. In general, the preferred 115 | way of invoking the installation script is as follows: 116 | 117 | ```sh 118 | sudo ./install.sh --upgrade --prefix=/usr --log-file=/etc/revolt.files 119 | ``` 120 | 121 | This way a log of the installed files is recorded the first time that the 122 | installation is done, and further upgrades will use it to remove stray files 123 | from old versions. Also, the log file will be updated with every upgrade. 124 | 125 | 126 | Development 127 | ----------- 128 | 129 | Using `make run` executes Revolt in “development” mode: the needed resources 130 | are loaded from the source directory, instead of using the system-wide 131 | directories. 132 | 133 | 134 | Flatpak 135 | ------- 136 | 137 | A bundle can be created using the included [make-flatpak.sh](make-flatpak.sh) 138 | script. The script arranges calling `flatpak-builder` to build and create a 139 | repository into `.flatpak-repo`. You can create a bundle from the repository 140 | using: 141 | 142 | ```sh 143 | flatpak build-bundle .flatpak-repo/ Revolt.flatpak org.perezdecastro.Revolt 144 | ``` 145 | 146 | Once the bundle is created, you can install and run it with: 147 | 148 | ```sh 149 | flatpak install --user --bundle Revolt.flatpak 150 | flatpak run org.perezdecastro.Revolt 151 | ``` 152 | 153 | -------------------------------------------------------------------------------- /assets/revolt-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aperezdc/revolt/1b35b0269f3d03e56377eb86ffdc55753524f234/assets/revolt-logo.png -------------------------------------------------------------------------------- /assets/revolt-screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aperezdc/revolt/1b35b0269f3d03e56377eb86ffdc55753524f234/assets/revolt-screenshot.png -------------------------------------------------------------------------------- /assets/revolt-statusicon-screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aperezdc/revolt/1b35b0269f3d03e56377eb86ffdc55753524f234/assets/revolt-statusicon-screenshot.png -------------------------------------------------------------------------------- /bin/revolt: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # vim:fenc=utf-8 4 | # 5 | # Copyright © 2016 Adrian Perez 6 | # 7 | # Distributed under terms of the GPLv3 license. 8 | 9 | def adjust_import_path(): 10 | from os import environ, path as P 11 | import sys 12 | devel = environ.get("__REVOLT_DEVELOPMENT") 13 | if devel and devel.strip(): 14 | # Prepend source directory path. 15 | sys.path.insert(0, P.dirname(P.dirname(__file__))) 16 | else: 17 | sys.path.insert(0, P.join(P.dirname(P.dirname(__file__)), 18 | "share", "revolt", "py")) 19 | 20 | 21 | if __name__ == "__main__": 22 | adjust_import_path() 23 | from revolt import main 24 | main(__file__) 25 | -------------------------------------------------------------------------------- /configure: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | ### See http://people.gnome.org/~walters/docs/build-api.txt 4 | # buildapi-variable-no-builddir 5 | 6 | opt_cflags=${CFLAGS} 7 | opt_cxxflags=${CXXFLAGS} 8 | opt_prefix='/usr/local' 9 | opt_libdir='' 10 | 11 | for var in "$@" ; do 12 | case ${var} in 13 | CFLAGS=*) opt_cflags=`echo "${var}" | sed 's/^CFLAGS=//'` ;; 14 | CXXFLAGS=*) opt_cxxflags=`echo "${var}" | sed 's/^CXXFLAGS=//'` ;; 15 | --prefix=*) opt_prefix=`echo "${var}" | sed 's/^--prefix=//'` ;; 16 | --libdir=*) opt_libdir=`echo "${var}" | sed 's/^--libdir=//'` ;; 17 | --help) 18 | cat <<-EOF 19 | usage: $0 [--options] 20 | Available options: 21 | 22 | --help This help message. 23 | --prefix=PATH Installation path prefix [default: /usr/local] 24 | --libdir=PATH Library installation path [default: \$prefix/lib] 25 | 26 | Also, the following relevant environment variables can be set: 27 | 28 | CFLAGS Additional command line flags to be passed to the C compiler 29 | CXXFLAGS Additional command line flags to be passed to the C++ compiler 30 | 31 | NOTE: This script tries to mimic the typical usage for configure scripts 32 | generated by autotools, hence it will silently ignore unrecognized 33 | command line options. 34 | EOF 35 | exit 36 | ;; 37 | *) true ;; 38 | esac 39 | done 40 | 41 | if test -z "${opt_libdir}" ; then 42 | opt_libdir="${opt_prefix}/lib" 43 | fi 44 | 45 | tee config.mk < 2 | 3 | 4 |
5 |
6 |
7 | 8 | _Preferences 9 | app.preferences 10 | e]]> 11 | 12 | 13 | _Element Settings 14 | app.element-settings 15 | 16 |
17 |
18 | 19 | _About 20 | app.about 21 | 22 | 23 | _Quit 24 | app.quit 25 | q]]> 26 | 27 |
28 |
29 |
30 | -------------------------------------------------------------------------------- /gtk/preferences.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 0.75 7 | 2 8 | 1 9 | 0.14999999999999999 10 | 0.25 11 | 0.25 12 | 13 | 14 | False 15 | settings 16 | False 17 | True 18 | dialog 19 | False 20 | 21 | 22 | True 23 | False 24 | 12 25 | 12 26 | 12 27 | 18 28 | vertical 29 | 12 30 | 31 | 32 | True 33 | False 34 | vertical 35 | 12 36 | 37 | 38 | True 39 | False 40 | start 41 | Service 42 | 43 | 44 | 45 | 46 | 47 | False 48 | True 49 | 0 50 | 51 | 52 | 53 | 54 | True 55 | False 56 | 6 57 | 6 58 | 0 59 | 60 | 61 | True 62 | False 63 | 64 | 65 | True 66 | True 67 | False 68 | 69 | 70 | True 71 | False 72 | 12 73 | 12 74 | 75 | 76 | True 77 | False 78 | Element _URL 79 | True 80 | element-url-entry 81 | False 82 | 83 | 84 | False 85 | True 86 | 0 87 | 88 | 89 | 90 | 91 | 250 92 | True 93 | True 94 | URL 95 | url 96 | 97 | 98 | False 99 | False 100 | end 101 | 1 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | False 113 | True 114 | 1 115 | 116 | 117 | 118 | 119 | True 120 | False 121 | start 122 | User Interface 123 | 124 | 125 | 126 | 127 | 128 | False 129 | True 130 | 2 131 | 132 | 133 | 134 | 135 | True 136 | False 137 | 6 138 | 6 139 | 0 140 | 141 | 142 | True 143 | False 144 | 145 | 146 | True 147 | True 148 | False 149 | 150 | 151 | True 152 | False 153 | 12 154 | 12 155 | 156 | 157 | True 158 | False 159 | _Zoom 160 | True 161 | zoom-factor-scale 162 | 163 | 164 | False 165 | True 166 | 0 167 | 168 | 169 | 170 | 171 | True 172 | True 173 | zoom-factor 174 | 2 175 | 2 176 | False 177 | right 178 | 179 | 180 | False 181 | False 182 | end 183 | 1 184 | 185 | 186 | 187 | 188 | True 189 | True 190 | True 191 | Reset zoom 192 | none 193 | 194 | 195 | True 196 | False 197 | center 198 | center 199 | zoom-original-symbolic 200 | 201 | 202 | 203 | 204 | False 205 | False 206 | end 207 | 2 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | False 219 | True 220 | 3 221 | 222 | 223 | 224 | 225 | True 226 | False 227 | start 228 | Advanced 229 | 230 | 231 | 232 | 233 | 234 | False 235 | True 236 | 4 237 | 238 | 239 | 240 | 241 | True 242 | False 243 | 6 244 | 6 245 | 0 246 | 247 | 248 | True 249 | False 250 | 251 | 252 | True 253 | True 254 | False 255 | 256 | 257 | True 258 | False 259 | 12 260 | 12 261 | 262 | 263 | True 264 | False 265 | vertical 266 | 267 | 268 | True 269 | False 270 | start 271 | Developer _Tools 272 | True 273 | dev-tools-toggle 274 | 275 | 276 | False 277 | True 278 | 0 279 | 280 | 281 | 282 | 283 | subtitle 284 | True 285 | False 286 | start 287 | <small>Allow usage of the web inspector and JavaScript console</small> 288 | True 289 | 292 | 293 | 294 | False 295 | True 296 | 1 297 | 298 | 299 | 300 | 301 | False 302 | True 303 | 0 304 | 305 | 306 | 307 | 308 | True 309 | True 310 | 311 | 312 | False 313 | True 314 | end 315 | 1 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | False 327 | True 328 | 5 329 | 330 | 331 | 332 | 333 | False 334 | True 335 | 0 336 | 337 | 338 | 339 | 340 | 341 | 342 | True 343 | False 344 | Settings 345 | False 346 | True 347 | :close 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | -------------------------------------------------------------------------------- /icons/16x16/apps/revolt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aperezdc/revolt/1b35b0269f3d03e56377eb86ffdc55753524f234/icons/16x16/apps/revolt.png -------------------------------------------------------------------------------- /icons/16x16@2x/apps: -------------------------------------------------------------------------------- 1 | ../32x32/apps/ -------------------------------------------------------------------------------- /icons/24x24/apps/revolt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aperezdc/revolt/1b35b0269f3d03e56377eb86ffdc55753524f234/icons/24x24/apps/revolt.png -------------------------------------------------------------------------------- /icons/24x24@2x/apps/revolt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aperezdc/revolt/1b35b0269f3d03e56377eb86ffdc55753524f234/icons/24x24@2x/apps/revolt.png -------------------------------------------------------------------------------- /icons/32x32/apps/revolt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aperezdc/revolt/1b35b0269f3d03e56377eb86ffdc55753524f234/icons/32x32/apps/revolt.png -------------------------------------------------------------------------------- /icons/64x64/apps/revolt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aperezdc/revolt/1b35b0269f3d03e56377eb86ffdc55753524f234/icons/64x64/apps/revolt.png -------------------------------------------------------------------------------- /icons/hicolor: -------------------------------------------------------------------------------- 1 | . -------------------------------------------------------------------------------- /icons/revolt-about.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | 24 | 48 | 53 | 54 | 56 | 57 | 59 | image/svg+xml 60 | 62 | 63 | 64 | 65 | 66 | 72 | 75 | 83 | 86 | 92 | 98 | 104 | 107 | 113 | 119 | 123 | 128 | 133 | 134 | 135 | 138 | 144 | 150 | 154 | 159 | 164 | 165 | 166 | 169 | 175 | 181 | 185 | 190 | 195 | 196 | 197 | 200 | 206 | 212 | 216 | 221 | 226 | 227 | 228 | 231 | 237 | 243 | 247 | 252 | 257 | 258 | 259 | 262 | 268 | 274 | 278 | 283 | 288 | 289 | 290 | 293 | 299 | 305 | 309 | 314 | 319 | 320 | 321 | 324 | 330 | 336 | 340 | 345 | 350 | 351 | 352 | 355 | 361 | 367 | 371 | 376 | 381 | 382 | 383 | 386 | 392 | 398 | 402 | 407 | 412 | 413 | 414 | 420 | 423 | 429 | 435 | 439 | 444 | 449 | 450 | 451 | 454 | 460 | 466 | 470 | 475 | 480 | 481 | 482 | 488 | 491 | 497 | 503 | 504 | 505 | 513 | 519 | 525 | 530 | 535 | 540 | 546 | 552 | 558 | 563 | 564 | 565 | 566 | -------------------------------------------------------------------------------- /icons/scalable/apps/org.perezdecastro.Revolt-symbolic.svg: -------------------------------------------------------------------------------- 1 | revolt-symbolic.svg -------------------------------------------------------------------------------- /icons/scalable/apps/revolt-symbolic.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | 24 | 44 | 47 | 48 | 50 | 51 | 53 | image/svg+xml 54 | 56 | 57 | 58 | 59 | 60 | 66 | 71 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /icons/scalable/apps/revolt.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | 24 | 44 | 47 | 48 | 50 | 51 | 53 | image/svg+xml 54 | 56 | 57 | 58 | 59 | 60 | 66 | 72 | 78 | 84 | 87 | 93 | 99 | 6 111 | 112 | 115 | 121 | 127 | 5 139 | 140 | 143 | 149 | 155 | 4 167 | 168 | 171 | 177 | 183 | 3 195 | 196 | 199 | 205 | 211 | 2 223 | 224 | 227 | 233 | 239 | 1 251 | 252 | 255 | 261 | 267 | * 279 | 280 | 283 | 289 | 295 | # 307 | 308 | 311 | 317 | 323 | 0 335 | 336 | 339 | 345 | 351 | 9 363 | 364 | 370 | 373 | 379 | 385 | 8 397 | 398 | 401 | 407 | 413 | 7 425 | 426 | 432 | 435 | 441 | 447 | 448 | 456 | 457 | 458 | -------------------------------------------------------------------------------- /icons/scalable/status/org.perezdecastro.Revolt-status-blink-symbolic.svg: -------------------------------------------------------------------------------- 1 | revolt-status-blink-symbolic.svg -------------------------------------------------------------------------------- /icons/scalable/status/org.perezdecastro.Revolt-status-online-symbolic.svg: -------------------------------------------------------------------------------- 1 | revolt-status-online-symbolic.svg -------------------------------------------------------------------------------- /icons/scalable/status/revolt-status-blink-symbolic.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | 24 | 44 | 47 | 48 | 50 | 51 | 53 | image/svg+xml 54 | 56 | 57 | 58 | 59 | 60 | 66 | 71 | 78 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /icons/scalable/status/revolt-status-online-symbolic.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | 24 | 44 | 47 | 48 | 50 | 51 | 53 | image/svg+xml 54 | 56 | 57 | 58 | 59 | 60 | 66 | 71 | 78 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /install-functions.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | # 3 | # install.sh 4 | # Copyright (C) 2016-2017 Adrian Perez 5 | # 6 | # Distributed under terms of the GPLv3 license. 7 | # 8 | 9 | install_log_file='' 10 | install_destdir='' 11 | install_prefix='/usr/local' 12 | install_pretend=false 13 | install_mode='install' 14 | install_help='Usage: %s [--install | --uninstall | --update] [options...] 15 | Operation modes: 16 | 17 | --install, -I Run in installation mode. 18 | --uninstall, -D Run in uninstallation mode. 19 | --update, -U Run in update mode. 20 | 21 | Options: 22 | 23 | --pretend, -n Do not perform actions, only print them. The output is 24 | suitable to be passed back to the shell as a script. 25 | --log-file=PATH Log installed files to a text file at PATH. When running 26 | in uninstall or update mode, the list of files previously 27 | installed is taken from the log file, and then it is 28 | updated with the new list of installed files. 29 | --prefix=PATH Installation prefix (default: /usr/local). 30 | --destdir=PATH Installation destination directory, useful for creating 31 | distribution packages (default: none). 32 | --help, -h Show this help message. 33 | 34 | ' 35 | 36 | set -e 37 | 38 | # install-setup "$0" "$@" 39 | install-setup () { 40 | local arg0=$1 41 | shift 42 | for option in "$@" ; do 43 | case "${option}" in 44 | --uninstall | -D) 45 | install_mode=uninstall 46 | ;; 47 | --install | -I) 48 | install_mode=install 49 | ;; 50 | --update | -U) 51 | install_mode=update 52 | ;; 53 | --pretend | -n) 54 | install_pretend=true 55 | ;; 56 | --log-file=*) 57 | install_log_file=${option#*=} 58 | ;; 59 | --destdir=*) 60 | install_destdir=${option#*=} 61 | ;; 62 | --prefix=*) 63 | install_prefix=${option#*=} 64 | ;; 65 | --help | -h) 66 | printf "${install_help}" "${arg0}" 67 | exit 0 68 | ;; 69 | esac 70 | done 71 | 72 | if [[ -n ${install_log_file} ]] ; then 73 | if [[ ${install_mode} != install ]] ; then 74 | # Remove contents listed in the log file 75 | if [[ -r ${install_log_file} ]] ; then 76 | local path 77 | while read -r path ; do 78 | if ${install_pretend} ; then 79 | echo "rm -f '${path}'" 80 | else 81 | install-show REMOVE "${path}" 82 | rm -f "${install_destdir}${path}" 83 | fi 84 | done < "${install_log_file}" 85 | fi 86 | if [[ ${install_mode} = uninstall ]] ; then 87 | exit 0 88 | else 89 | # Make sure the rest of the script runs in installation mode. 90 | install_mode=install 91 | fi 92 | fi 93 | 94 | # Truncate the log file 95 | ${install_pretend} || : > "${install_log_file}" 96 | fi 97 | } 98 | 99 | # install-show 100 | install-show () { 101 | local prepend="[$1] " 102 | if [[ -n ${install_destdir} && ( $1 = INSTALL || $1 = REMOVE ) ]] ; then 103 | prepend="[$1] ${install_destdir}" 104 | fi 105 | echo "${prepend}$2" 106 | } 107 | 108 | # install-exec [install-options...] 109 | install-exec () { 110 | local src=$1 111 | local dst=$2 112 | shift 2 113 | case ${INSTALL_EXEC_MODE:-${install_mode}} in 114 | install) 115 | if ${install_pretend} ; then 116 | echo "install -D $* '${src}' '${install_destdir}${dst}'" 117 | else 118 | if [[ -n ${install_log_file} ]] ; then 119 | echo "${dst}" >> "${install_log_file}" 120 | fi 121 | install-show INSTALL "${dst}" 122 | install -D "$@" "${src}" "${install_destdir}${dst}" 123 | fi 124 | ;; 125 | uninstall) 126 | if ${install_pretend} ; then 127 | echo "rm -f '${dst}'" 128 | else 129 | install-show REMOVE "${dst}" 130 | rm -f "${install_destdir}${dst}" 131 | fi 132 | ;; 133 | update) 134 | INSTALL_EXEC_MODE=uninstall install-exec "${src}" "${dst}" "$@" 135 | INSTALL_EXEC_MODE=install install-exec "${src}" "${dst}" "$@" 136 | ;; 137 | esac 138 | } 139 | 140 | # install-prefixed [install-options...] 141 | install-prefixed () { 142 | local relpath=$1 143 | local filename=$2 144 | shift 2 145 | install-exec "${filename}" "${install_prefix}/${relpath}/$(basename "${filename}")" "$@" 146 | } 147 | 148 | # install-icon [theme] 149 | # TODO: Make this use install-prefixed, and change that to allow passing 150 | # destination file names. 151 | declare -a install_icon_update_themes=( ) 152 | install-icon () { 153 | local name=${1} 154 | local size=${2} 155 | local ext=${4#*.} 156 | local theme=${5:-hicolor} 157 | 158 | if [[ ${size} = symbolic ]] ; then 159 | name="${name}-symbolic" 160 | fi 161 | 162 | install-exec "$4" "${install_prefix}/share/icons/${theme}/${size}/$3/${name}.${ext}" -m644 163 | 164 | local t 165 | for t in "${install_icon_update_themes[@]}" ; do 166 | if [[ ${t} = "${theme}" ]] ; then 167 | return 168 | fi 169 | done 170 | install_icon_update_themes=( "${install_icon_update_themes[@]}" "${theme}" ) 171 | } 172 | 173 | install-update-gtk-icon-theme-caches () { 174 | if [[ -n ${SKIP_ICON_CACHE_UPDATE} && ${SKIP_ICON_CACHE_UPDATE} -ne 0 ]] ; then 175 | install-show SKIPPED "gtk-update-icon-cache (SKIP_ICON_CACHE_UPDATE)" 176 | return 177 | fi 178 | if [[ -n ${install_destdir} ]] ; then 179 | install-show SKIPPED "gtk-update-icon-cache (--destdir is in use)" 180 | return 181 | fi 182 | local updater 183 | updater=$(type -P gtk-update-icon-cache) 184 | if [[ -z ${updater} ]] ; then 185 | install-show SKIPPED "gtk-update-icon-cache (program not found)" 186 | return 187 | fi 188 | local theme 189 | for theme in "${install_icon_update_themes[@]}" ; do 190 | if ${install_pretend} ; then 191 | echo "'${updater}' -q '${install_prefix}/share/icons/${theme}'" 192 | else 193 | install-show EXEC "gtk-update-icon-cache: ${theme}" 194 | "${updater}" -q "${install_prefix}/share/icons/${theme}" 195 | fi 196 | done 197 | } 198 | 199 | # install-glib-gschema [install-options...] 200 | declare install_glib_gschema_called=false 201 | install-glib-gschema () { 202 | install-prefixed share/glib-2.0/schemas "$@" -m644 203 | install_glib_gschema_called=true 204 | } 205 | 206 | install-update-glib-gschemas () { 207 | if ! ${install_glib_gschema_called} ; then 208 | return 209 | fi 210 | if [[ -n ${SKIP_GSCHEMA_UPDATE} && ${SKIP_GSCHEMA_UPDATE} -ne 0 ]] ; then 211 | install-show SKIPPED "glib-compile-schemas (SKIP_GSCHEMA_UPDATE)" 212 | return 213 | fi 214 | if [[ -n ${install_destdir} ]] ; then 215 | install-show SKIPPED "glib-compile-schemas (--destdir is in use)" 216 | return 217 | fi 218 | local compiler 219 | compiler=$(type -P glib-compile-schemas) 220 | if [[ -z ${compiler} ]] ; then 221 | install-show SKIPPED "glib-compile-schemas (program not found)" 222 | return 223 | fi 224 | if ${install_pretend} ; then 225 | echo "'${compiler}' '${install_prefix}/share/glib-2.0/schemas/'" 226 | else 227 | install-show EXEC "glib-compile-schemas: ${install_prefix}/share/glib-2.0/schemas/" 228 | "${compiler}" "${install_prefix}/share/glib-2.0/schemas/" 229 | fi 230 | } 231 | 232 | # install-bin [install-options...] 233 | # install-desktop-file [install-options...] 234 | install-bin () { install-prefixed bin "$@" -m755 ; } 235 | install-desktop-file () { install-prefixed share/applications "$@" -m644 ; } 236 | 237 | install-finish () { 238 | install-update-gtk-icon-theme-caches 239 | install-update-glib-gschemas 240 | } 241 | -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | # 3 | # install.sh 4 | # Copyright (C) 2016-2017 Adrian Perez 5 | # 6 | # Distributed under terms of the GPLv3 license. 7 | # 8 | set -e 9 | shopt -s nullglob 10 | 11 | declare -r APP_ID='org.perezdecastro.Revolt' 12 | 13 | source "$(dirname "$0")/install-functions.sh" 14 | install-setup "$0" "$@" 15 | 16 | install-bin bin/revolt 17 | install-desktop-file "${APP_ID}.desktop" 18 | install-prefixed share/revolt "${APP_ID}.gresource" -m644 19 | install-prefixed share/appdata "${APP_ID}.appdata.xml" -m644 20 | 21 | install-glib-gschema "${APP_ID}.gschema.xml" 22 | for file in ./[0-9][0-9]_${APP_ID}.gschema.override ; do 23 | install-glib-gschema "${file}" 24 | done 25 | 26 | for file in revolt/*.py ; do 27 | install-prefixed share/revolt/py/revolt "${file}" -m644 28 | done 29 | 30 | for size in 16x16 16x16@2x 24x24 24x24@2x 32x32 64x64 ; do 31 | install-icon "${APP_ID}" "${size}" apps "icons/${size}/apps/revolt.png" 32 | done 33 | install-icon "${APP_ID}" scalable apps icons/scalable/apps/revolt.svg 34 | install-icon "${APP_ID}" symbolic apps icons/scalable/apps/revolt-symbolic.svg 35 | install-icon "${APP_ID}-status-blink-symbolic" scalable status icons/scalable/status/revolt-status-blink-symbolic.svg 36 | install-icon "${APP_ID}-status-online-symbolic" scalable status icons/scalable/status/revolt-status-online-symbolic.svg 37 | 38 | install-finish 39 | -------------------------------------------------------------------------------- /make-flatpak.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | set -e 3 | 4 | readonly BUILDDIR="$(dirname "$0")/.flatpak-build" 5 | readonly REPODIR="$(dirname "$0")/.flatpak-repo" 6 | 7 | cleanup () { 8 | rm -rf "${BUILDDIR}" 9 | } 10 | trap cleanup EXIT 11 | 12 | declare -a buildargs=( 13 | --sandbox 14 | --force-clean 15 | --require-changes 16 | --repo="${REPODIR}" 17 | --subject="Revolt $(date +%Y%m%d).$(git describe --always --tags)" 18 | ) 19 | 20 | declare -a updaterepoargs=( 21 | --title=Revolt 22 | --default-branch=master 23 | --prune 24 | ) 25 | 26 | if [[ -n ${EMAIL} ]] ; then 27 | buildargs+=( --gpg-sign="${EMAIL}" ) 28 | updaterepoargs+=( --gpg-sign="${EMAIL}" ) 29 | fi 30 | 31 | set -x 32 | flatpak-builder "${buildargs[@]}" "${BUILDDIR}" "$@" org.perezdecastro.Revolt.json 33 | flatpak build-update-repo "${updaterepoargs[@]}" "${REPODIR}" 34 | -------------------------------------------------------------------------------- /org.perezdecastro.Revolt.appdata.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.perezdecastro.Revolt.desktop 4 | CC-BY-SA-3.0 5 | GPL-3.0 6 | Revolt 7 | Better integration of Element, a Matrix client, with desktop environments 8 | 9 |

10 | Revolt is a small application which wraps Element to provide better integration 11 | with desktop environments in general, and GNOME in particular: 12 |

13 |
    14 |
  • Having Element as a “standalone” application instead of it living in a browser tab
  • 15 |
  • Persistent notifications (for desktop environments supporting them, i.e. GNOME)
  • 16 |
  • Notifications are automatically prevented when the Revolt window is focused
  • 17 |
  • Status icon for desktop environment which have a tray bar applet (XFCE, Budgie, likely many others)
  • 18 |
19 |
20 | 21 | 22 | https://github.com/aperezdc/revolt/raw/master/assets/revolt-screenshot.png 23 | Revolt running on GNOME 24 | 25 | 26 | https://github.com/aperezdc/revolt 27 |
28 | -------------------------------------------------------------------------------- /org.perezdecastro.Revolt.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Hidden=false 3 | Name=Revolt 4 | Exec=revolt 5 | TryExec=revolt 6 | Icon=org.perezdecastro.Revolt 7 | Comment=Connect to the Matrix chat network 8 | Type=Application 9 | NoDisplay=false 10 | StartupNotify=true 11 | Categories=GNOME;GTK;Network 12 | Terminal=false 13 | X-GNOME-UsesNotifications=true 14 | -------------------------------------------------------------------------------- /org.perezdecastro.Revolt.gresources.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | gtk/custom.css 5 | gtk/menus.ui 6 | gtk/preferences.ui 7 | icons/revolt-about.svg 8 | icons/scalable/apps/revolt.svg 9 | icons/scalable/apps/revolt-symbolic.svg 10 | icons/scalable/status/revolt-status-blink-symbolic.svg 11 | icons/scalable/status/revolt-status-online-symbolic.svg 12 | 13 | 14 | -------------------------------------------------------------------------------- /org.perezdecastro.Revolt.gschema.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Base URL of the Element installation wrapped by Revolt 6 | "https://app.element.io" 7 | 8 | 9 | Zoom factor applied to to application 10 | 11 | 1.0 12 | 13 | 14 | Allow usage of the web inspector and JavaScript console 15 | false 16 | 17 | 18 | Whether to use a header bar. Disabling uses the decorations provided by the window manager. 19 | true 20 | 21 | 22 | Hide the window instead of closing it when the window close button (X) is activated. 23 | false 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | Width of the window 36 | 900 37 | 38 | 39 | Height of the window 40 | 650 41 | 42 | 43 | Whether the window is maximized 44 | false 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /org.perezdecastro.Revolt.json: -------------------------------------------------------------------------------- 1 | { 2 | "app-id": "org.perezdecastro.Revolt", 3 | "runtime": "org.gnome.Platform", 4 | "runtime-version": "43", 5 | "sdk": "org.gnome.Sdk", 6 | "command": "revolt", 7 | "finish-args": [ 8 | "--device=dri", 9 | "--share=network", 10 | "--share=ipc", 11 | "--socket=x11", 12 | "--socket=wayland", 13 | "--socket=pulseaudio", 14 | "--socket=session-bus", 15 | 16 | "--filesystem=xdg-documents", 17 | "--filesystem=xdg-pictures", 18 | 19 | "--own-name=org.perezdecastro.Revolt", 20 | 21 | "--talk-name=org.freedesktop.Notifications", 22 | "--talk-name=org.gtk.Notifications", 23 | 24 | "--env=GSETTINGS_SCHEMA_DIR=/app/share/glib-2.0/schemas", 25 | 26 | "--filesystem=xdg-run/dconf", 27 | "--filesystem=~/.config/dconf:ro", 28 | "--talk-name=ca.desrt.dconf", 29 | "--env=DCONF_USER_CONFIG_DIR=.config/dconf" 30 | ], 31 | "build-options": { 32 | "strip": false 33 | }, 34 | "cleanup": [ 35 | "/bin/intltool-*", 36 | "/bin/intltoolize", 37 | "/include", 38 | "/lib/*.la", 39 | "/lib/pkgconfig", 40 | "/libexec", 41 | "/share/aclocal", 42 | "/share/doc", 43 | "/share/gtk-doc", 44 | "/share/intltool", 45 | "/share/man" 46 | ], 47 | "modules": [ 48 | { 49 | "name": "intltool", 50 | "sources": [ 51 | { 52 | "type": "archive", 53 | "url": "https://launchpad.net/intltool/trunk/0.51.0/+download/intltool-0.51.0.tar.gz", 54 | "sha256": "67c74d94196b153b774ab9f89b2fa6c6ba79352407037c8c14d5aeb334e959cd" 55 | } 56 | ] 57 | }, 58 | { 59 | "name": "libdbusmenu", 60 | "build-options": { 61 | "env": { 62 | "HAVE_VALGRIND_TRUE": "#", 63 | "HAVE_VALGRIND_FALSE": "", 64 | "CFLAGS": "-Wno-error" 65 | } 66 | }, 67 | "config-opts": [ 68 | "--with-gtk=3", 69 | "--disable-nls", 70 | "--disable-dumper", 71 | "--disable-static", 72 | "--disable-tests", 73 | "--disable-vala", 74 | "--enable-introspection=yes" 75 | ], 76 | "sources": [ 77 | { 78 | "type": "archive", 79 | "url": "https://launchpad.net/libdbusmenu/16.04/16.04.0/+download/libdbusmenu-16.04.0.tar.gz", 80 | "sha256": "b9cc4a2acd74509435892823607d966d424bd9ad5d0b00938f27240a1bfa878a" 81 | } 82 | ] 83 | }, 84 | { 85 | "name": "statusnotifier", 86 | "config-opts": [ 87 | "--disable-static", 88 | "--enable-dbusmenu", 89 | "--enable-introspection" 90 | ], 91 | "sources": [ 92 | { 93 | "type": "archive", 94 | "url": "https://github.com/jjk-jacky/statusnotifier/archive/1.0.0.tar.gz", 95 | "sha256": "a307f04bc3ae749fd2bd368c3752dec2f1dbd180da89c737f1dda63a698d441b" 96 | } 97 | ] 98 | }, 99 | { 100 | "name": "revolt", 101 | "sources": [ 102 | { 103 | "type": "git", 104 | "url": "https://github.com/aperezdc/revolt.git" 105 | } 106 | ] 107 | } 108 | ] 109 | } 110 | -------------------------------------------------------------------------------- /revolt.flatpakref: -------------------------------------------------------------------------------- 1 | [Flatpak Ref] 2 | Title=Revolt 3 | Name=org.perezdecastro.Revolt 4 | Branch=master 5 | Url=https://flatpak.perezdecastro.org/revolt 6 | I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qJUDwCrhWKLTHPlrwEyT2JkdrIAUHDvKa1YxtHeU+fR/mUyzNInVPy1nFQEm8nH+Mslm+I/oB6Aqtuu99CQ5D2HiWhANzfZxJYhiS4RWgu1YvJiVMPuyM+LEHZU2llzpN34SoZAsp6pnLbVDR+xBt7iHIQgnJdIYaQdXNRaSjEMKXQil00cD3Uu377odIGde79HAO6j4FGowAJuK5lfdgm49EzDe5+lm+ZY5/mtBaHKZXBUx0jYVF4+cWD/QxiwJ8ncQAw17uSdzrrxO33Fpo7XGo/qbS5wDp3dEOtS/oUyBBsZKzt5am2hqqEcBZd4gipVXndOn8hJpgJMLffLoEiKnY/MHQXD2jBfhshqVHhVciw4AKHUsvmaAsMjiNB2CgrtUohXznkZ3rtUF3FWhVngKSuunb5z6b37IAf4/QaeKUQ8klUS++BOiZxCSHmVCY7fOIf7R6UgfCISQQYEQIACQUCSEP+BQIbDAAKCRCRxVnb5MkSO1u4AJ9Jpp731YtMnHTTnXfPudiPBbtHrwCfSSDXvwBrgLUO9MdUFxKyJVcQlBg= 8 | Homepage=https://github.com/aperezdc/revolt 9 | RuntimeRepo=https://dl.flathub.org/repo/flathub.flatpakrepo 10 | -------------------------------------------------------------------------------- /revolt/__init__.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # vim:fenc=utf-8 4 | # 5 | # Copyright © 2016 Adrian Perez 6 | # 7 | # Distributed under terms of the GPLv3 license. 8 | 9 | import gi 10 | gi.require_versions(dict(WebKit2="4.0", 11 | Gtk="3.0", 12 | GLib="2.0")) 13 | 14 | 15 | def main(program_path): 16 | # Honor CTRL+C http://stackoverflow.com/q/16410852 17 | import signal 18 | import sys 19 | from .app import RevoltApp 20 | signal.signal(signal.SIGINT, signal.SIG_DFL) 21 | sys.exit(RevoltApp(program_path).run(sys.argv[1:])) 22 | -------------------------------------------------------------------------------- /revolt/accelerators.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # vim:fenc=utf-8 4 | # 5 | # Copyright © 2017 Adrian Perez 6 | # 7 | # Distributed under terms of the GPLv3 license. 8 | 9 | from gi.repository import Gtk, Gdk, GLib 10 | 11 | 12 | def __window_close(accel_group, window, key, modifiers): 13 | assert isinstance(window, Gtk.Window) 14 | window.close() 15 | 16 | 17 | window_close_on_escape = Gtk.AccelGroup() 18 | window_close_on_escape.connect(Gdk.KEY_Escape, 0, 0, __window_close) 19 | 20 | 21 | def __window_modify_zoom(accel_group, window, key, modifiers): 22 | if key == Gdk.KEY_0: 23 | window.application.settings.reset("zoom-factor") 24 | else: 25 | zoom = window.application.settings.get_double("zoom-factor") 26 | if key == Gdk.KEY_plus: 27 | zoom += 0.1 28 | elif key == Gdk.KEY_minus: 29 | zoom -= 0.1 30 | else: 31 | assert False, "Unreachable" 32 | schema = window.application.settings.get_property("settings-schema") 33 | value = GLib.Variant.new_double(zoom) 34 | if schema.get_key("zoom-factor").range_check(value): 35 | window.application.settings.set_value("zoom-factor", value) 36 | 37 | 38 | def __window_webview_reload(accel_group, window, key, modifiers): 39 | window.reload_element(bypass_cache=True) 40 | 41 | 42 | window_keys = Gtk.AccelGroup() 43 | window_keys.connect(Gdk.KEY_r, Gdk.ModifierType.CONTROL_MASK | Gdk.ModifierType.SHIFT_MASK, 0, 44 | __window_webview_reload) 45 | for key in (Gdk.KEY_plus, Gdk.KEY_minus, Gdk.KEY_0): 46 | window_keys.connect(key, Gdk.ModifierType.CONTROL_MASK, 0, __window_modify_zoom) 47 | -------------------------------------------------------------------------------- /revolt/app.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # vim:fenc=utf-8 4 | # 5 | # Copyright © 2016-2017 Adrian Perez 6 | # 7 | # Distributed under terms of the GPLv3 license. 8 | 9 | from os import environ 10 | from gi.repository import Gtk, Gio, Gdk 11 | from .statusicon import StatusIcon 12 | from .window import MainWindow 13 | from . import accelerators 14 | 15 | DEFAULT_APP_ID = "org.perezdecastro.Revolt" 16 | APP_ID = environ.get("REVOLT_OVERRIDE_APPLICATION_ID", DEFAULT_APP_ID).strip() 17 | 18 | APP_COMMENTS = u"Desktop application for Element.io" 19 | APP_WEBSITE = u"https://github.com/aperezdc/revolt" 20 | APP_AUTHORS = (u"Adrián Pérez de Castro ", 21 | u"Jacobo Aragunde Pérez ", 22 | u"Carlos López Pérez ") 23 | 24 | 25 | def _find_resources_path(program_path): 26 | from os import path as P 27 | devel = environ.get("__REVOLT_DEVELOPMENT") 28 | if devel and devel.strip(): 29 | # Use the directory where the executable is located, most likely 30 | # a checkout of the Git repository. 31 | path = P.dirname(P.dirname(program_path)) 32 | else: 33 | # Use an installed location: binary is in /bin/revolt, 34 | # and resources in /share/revolt/* 35 | path = P.join(P.dirname(P.dirname(program_path)), "share", "revolt") 36 | return P.abspath(P.join(path, DEFAULT_APP_ID + ".gresource")) 37 | 38 | 39 | class RevoltApp(Gtk.Application): 40 | def __init__(self, program_path): 41 | Gio.Resource.load(_find_resources_path(program_path))._register() 42 | Gtk.Application.__init__(self, application_id=APP_ID, 43 | resource_base_path="/" + DEFAULT_APP_ID.replace(".", "/"), 44 | flags=Gio.ApplicationFlags.FLAGS_NONE) 45 | self.settings = Gio.Settings(schema_id=DEFAULT_APP_ID, 46 | path="/" + APP_ID.replace(".", "/") + "/") 47 | self.element_url = self.settings.get_string("riot-url") 48 | self.window = None 49 | self._last_window_geometry = None 50 | self.statusicon = None 51 | self.connect("shutdown", self.__on_shutdown) 52 | self.connect("activate", self.__on_activate) 53 | self.connect("startup", self.__on_startup) 54 | 55 | def __action(self, name, callback): 56 | action = Gio.SimpleAction.new(name) 57 | action.connect("activate", callback) 58 | self.add_action(action) 59 | 60 | def __on_startup(self, app): 61 | gtk_settings = Gtk.Settings.get_default() 62 | gtk_settings.set_property("gtk-dialogs-use-header", 63 | self.settings.get_boolean("use-header-bar")) 64 | css_provider = Gtk.CssProvider() 65 | css_provider.load_from_resource(self.get_resource_base_path() + "/gtk/custom.css") 66 | Gtk.StyleContext.add_provider_for_screen(Gdk.Screen.get_default(), css_provider, 67 | Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION) 68 | self.statusicon = StatusIcon(self) 69 | self.__action("quit", lambda *arg: self.quit()) 70 | self.__action("about", self.__on_app_about) 71 | self.__action("preferences", self.on_app_preferences) 72 | self.__action("element-settings", self.on_element_settings) 73 | 74 | def __on_shutdown(self, app): 75 | if self.window is not None: 76 | self.window.finish() 77 | 78 | def __on_activate(self, app): 79 | if self.window is None: 80 | saved_state_path = self.settings.get_property("path") 81 | saved_state_path += "saved-state/main-window/" 82 | saved_state = Gio.Settings(schema_id=DEFAULT_APP_ID + ".WindowState", 83 | path=saved_state_path) 84 | self.window = MainWindow(self, saved_state).load_element() 85 | self.show() 86 | 87 | def __on_app_about(self, action, param): 88 | dialog = Gtk.AboutDialog(transient_for=self.window, 89 | program_name=u"Revolt", 90 | authors=APP_AUTHORS, 91 | logo_icon_name="revolt-about", 92 | license_type=Gtk.License.GPL_3_0, 93 | comments=APP_COMMENTS, 94 | website=APP_WEBSITE) 95 | dialog.connect("response", lambda d, r: d.destroy()) 96 | dialog.present() 97 | 98 | def _build(self, resource, *names): 99 | builder = Gtk.Builder.new_from_resource(self.get_resource_base_path() + "/" + resource) 100 | return (builder.get_object(name) for name in names) 101 | 102 | def on_app_preferences(self, action, param): 103 | window, url_entry, zoom_factor, zoom_factor_reset, devtools_toggle = \ 104 | self._build("gtk/preferences.ui", 105 | "settings-window", 106 | "element-url-entry", 107 | "zoom-factor", 108 | "zoom-factor-reset", 109 | "dev-tools-toggle") 110 | self.settings.bind("zoom-factor", zoom_factor, "value", 111 | Gio.SettingsBindFlags.DEFAULT) 112 | self.settings.bind("enable-developer-tools", devtools_toggle, "active", 113 | Gio.SettingsBindFlags.DEFAULT) 114 | zoom_factor_reset.connect("clicked", lambda button: 115 | self.settings.set_double("zoom-factor", 1.0)) 116 | url_entry.set_text(self.element_url) 117 | 118 | def on_hide(window): 119 | new_url = url_entry.get_text() 120 | if new_url != self.element_url: 121 | self.settings.set_string("riot-url", new_url) 122 | self.element_url = new_url 123 | self.window.load_element() 124 | window.connect("hide", on_hide) 125 | window.add_accel_group(accelerators.window_close_on_escape) 126 | window.set_transient_for(self.window) 127 | window.present() 128 | 129 | def on_element_settings(self, action, param): 130 | self.show() 131 | self.window.load_settings_page() 132 | 133 | def __save_window_geometry(self): 134 | window_size = self.window.get_size() 135 | window_position = self.window.get_position() 136 | self._last_window_geometry = {"width": window_size.width, 137 | "height": window_size.height, 138 | "root_x": window_position.root_x, 139 | "root_y": window_position.root_y} 140 | 141 | def __restore_window_geometry(self): 142 | if not self._last_window_geometry: 143 | return 144 | self.window.resize(self._last_window_geometry["width"], 145 | self._last_window_geometry["height"]) 146 | self.window.move(self._last_window_geometry["root_x"], 147 | self._last_window_geometry["root_y"]) 148 | # invalidate _last_window_geometry after restoring to ensure to 149 | # not restore again if the users clicks on the status icon when 150 | # the window is not hidden (like when minimized, or not focused) 151 | # self.hide() will take care of setting a new saved geometry. 152 | self._last_window_geometry = None 153 | 154 | def show(self): 155 | self.__restore_window_geometry() 156 | self.window.show() 157 | self.window.present() 158 | 159 | def hide(self): 160 | self.__save_window_geometry() 161 | self.window.hide() 162 | 163 | def is_visible_and_focused(self): 164 | return self.window.props.visible and self.window.props.has_toplevel_focus 165 | -------------------------------------------------------------------------------- /revolt/statusicon.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # vim:fenc=utf-8 4 | # 5 | # Copyright © 2016-2017 Adrian Perez 6 | # 7 | # Distributed under terms of the GPLv3 license. 8 | 9 | from gi.repository import Gtk, GLib 10 | from .util import cachedproperty, desktop_is 11 | import enum 12 | 13 | 14 | class Status(enum.Enum): 15 | DISCONNECTED = "disconnected" 16 | CONNECTED = "connected" 17 | BLINKING = "blinking" 18 | 19 | 20 | class StatusIconImpl(object): 21 | def __init__(self, delegate): 22 | self.delegate = delegate 23 | 24 | def __del__(self): 25 | self.delegate = None 26 | 27 | def set_tooltip(self, text): 28 | raise NotImplementedError 29 | 30 | def set_status(self, status): 31 | raise NotImplementedError 32 | 33 | 34 | class StatusIconImplSNI(StatusIconImpl): 35 | ICON_PIXBUF_SIZE = 64 # This seems to be a reasonable size for all DEs. 36 | 37 | def __init__(self, delegate, context_menu, app, failure_callback): 38 | super().__init__(delegate) 39 | 40 | import gi 41 | gi.require_version("StatusNotifier", "1.0") 42 | from gi.repository import StatusNotifier 43 | 44 | if hasattr(StatusNotifier.Icon, "ATTENTION_ICON"): 45 | self.SNI_ATTENTION_ICON = StatusNotifier.Icon.ATTENTION_ICON 46 | self.SNI_ACTIVE_ICON = StatusNotifier.Icon.ICON 47 | else: 48 | self.SNI_ATTENTION_ICON = StatusNotifier.Icon.STATUS_NOTIFIER_ATTENTION_ICON 49 | self.SNI_ACTIVE_ICON = StatusNotifier.Icon.STATUS_NOTIFIER_ICON 50 | self.SNI_ATTENTION = StatusNotifier.Status.NEEDS_ATTENTION 51 | self.SNI_ACTIVE = StatusNotifier.Status.ACTIVE 52 | 53 | theme = Gtk.IconTheme.get_default() 54 | self._offline_icon_pixbuf = theme.load_icon("org.perezdecastro.Revolt", 55 | self.ICON_PIXBUF_SIZE, 56 | Gtk.IconLookupFlags.FORCE_SVG | 57 | Gtk.IconLookupFlags.FORCE_SYMBOLIC) 58 | self._attention_icon_pixbuf = theme.load_icon("org.perezdecastro.Revolt-status-blink", 59 | self.ICON_PIXBUF_SIZE, 60 | Gtk.IconLookupFlags.FORCE_SVG | 61 | Gtk.IconLookupFlags.FORCE_SYMBOLIC) 62 | self._online_icon_pixbuf = theme.load_icon("org.perezdecastro.Revolt-status-online", 63 | self.ICON_PIXBUF_SIZE, 64 | Gtk.IconLookupFlags.FORCE_SVG | 65 | Gtk.IconLookupFlags.FORCE_SYMBOLIC) 66 | 67 | self._failure_callback = failure_callback 68 | self._sni = StatusNotifier.Item.new_from_pixbuf(app.get_application_id(), 69 | StatusNotifier.Category.COMMUNICATIONS, 70 | self._offline_icon_pixbuf) 71 | if not self._sni.set_context_menu(context_menu): 72 | # TODO: No DbusMenu support built into StatusIcon, we need to handle the 73 | # "context-menu" signal ourselves. For now, fallback to use GtkStatusIcon 74 | raise RuntimeError("StatusNotifier does not support DbusMenu, falling back to GtkStatusIcon") 75 | 76 | self._sni.connect("registration-failed", self.__on_registration_failed) 77 | self._sni.connect("activate", self.__on_activate) 78 | self._sni.set_from_pixbuf(self.SNI_ATTENTION_ICON, self._attention_icon_pixbuf) 79 | self._sni.set_title("Revolt") 80 | self._sni.set_status(self.SNI_ACTIVE) 81 | self._sni.set_item_is_menu(False) 82 | self._sni.freeze_tooltip() 83 | self._sni.set_tooltip_title("Revolt") 84 | self._sni.thaw_tooltip() 85 | self._sni.register() 86 | 87 | def set_status(self, status): 88 | if status is Status.BLINKING: 89 | self._sni.set_status(self.SNI_ATTENTION) 90 | else: 91 | self._sni.set_status(self.SNI_ACTIVE) 92 | if status is Status.CONNECTED: 93 | self._sni.set_from_pixbuf(self.SNI_ACTIVE_ICON, self._online_icon_pixbuf) 94 | elif status is Status.DISCONNECTED: 95 | self._sni.set_from_pixbuf(self.SNI_ACTIVE_ICON, self._offline_icon_pixbuf) 96 | else: 97 | assert False, "Unrechable" 98 | 99 | def __on_registration_failed(self, sni, error): 100 | assert sni == self._sni 101 | print("StatusNotifier registration failed, falling back to GtkStatusIcon") 102 | self._failure_callback(self) 103 | 104 | def __on_activate(self, sni, x, y): 105 | assert sni == self._sni 106 | self.delegate.on_icon_activate(self) 107 | 108 | def set_tooltip(self, text): 109 | self._sni.freeze_tooltip() 110 | self._sni.set_tooltip_body("" if text is None else text) 111 | self._sni.thaw_tooltip() 112 | 113 | 114 | class StatusIconImplGSI(StatusIconImpl): 115 | ICON_STATUS_NAMES = { 116 | Status.DISCONNECTED.value: "", 117 | Status.CONNECTED.value: "-status-online", 118 | "flip": "-status-blink", 119 | "flop": "" 120 | } 121 | 122 | def __init__(self, delegate, context_menu, app): 123 | super().__init__(delegate) 124 | self._status = Status.DISCONNECTED 125 | self._contextmenu = context_menu 126 | self._size = 16 127 | self._flipflop = True 128 | self._blinkmilliseconds = 500 129 | self._icondata = {} 130 | self.__load_icons(self._size, app) 131 | self._icon = Gtk.StatusIcon() 132 | self._icon.set_visible(True) 133 | self._icon.set_property("has-tooltip", True) 134 | self._icon.set_property("title", "Revolt") 135 | self._icon.connect("activate", self.__on_activate) 136 | self._icon.connect("popup-menu", self.__on_popup_menu) 137 | self._icon.connect("size-changed", self.__on_icon_size_change) 138 | 139 | def set_tooltip(self, text): 140 | if text is None: 141 | self._icon.set_tooltip_text("Revolt") 142 | else: 143 | self._icon.set_tooltip_markup("Revolt\n{!s}".format(text)) 144 | 145 | def set_status(self, status): 146 | if status is Status.BLINKING: 147 | # We only want one blink callback active at a time. 148 | if self._status is not Status.BLINKING: 149 | GLib.timeout_add(self._blinkmilliseconds, self.__blink) 150 | else: 151 | GLib.timeout_add(2 * self._blinkmilliseconds, self.__draw_icon, status) 152 | self._status = status 153 | 154 | def __load_icons(self, size, app=None): 155 | if app is None: 156 | app = Gtk.Application.get_default() 157 | self._size = size 158 | theme = Gtk.IconTheme.get_default() 159 | for status, icon_suffix in self.ICON_STATUS_NAMES.items(): 160 | icon_name = "org.perezdecastro.Revolt" + icon_suffix 161 | self._icondata[status] = theme.load_icon(icon_name, int(size), 162 | Gtk.IconLookupFlags.FORCE_SVG | 163 | Gtk.IconLookupFlags.FORCE_SYMBOLIC) 164 | 165 | def __draw_icon(self, status=None): 166 | if status is None: 167 | status = self._status 168 | if status is Status.BLINKING: 169 | if self._flipflop: 170 | self._icon.set_from_pixbuf(self._icondata["flip"]) 171 | else: 172 | self._icon.set_from_pixbuf(self._icondata["flop"]) 173 | else: 174 | self._icon.set_from_pixbuf(self._icondata[status.value]) 175 | return False 176 | 177 | def __on_activate(self, icon): 178 | assert icon == self._icon 179 | self.delegate.on_icon_activate(self) 180 | 181 | def __on_popup_menu(self, icon, button, time): 182 | assert icon == self._icon 183 | self._contextmenu.show_all() 184 | self._contextmenu.popup(None, None, None, self._icon, button, time) 185 | 186 | def __on_icon_size_change(self, statusicon, size): 187 | if size > 31: 188 | icon_size = "32" 189 | elif size > 23: 190 | icon_size = "24" 191 | else: 192 | icon_size = "16" 193 | if desktop_is("kde"): # KDE: see gajim bug #5476 194 | icon_size = "32" 195 | if desktop_is("mate"): 196 | icon_size = "16" 197 | self.__load_icons(icon_size) 198 | self.__draw_icon() 199 | 200 | def __blink(self): 201 | self._flipflop = not self._flipflop 202 | self.__draw_icon() 203 | return self._status is Status.BLINKING 204 | 205 | 206 | class StatusIcon(object): 207 | def __init__(self, app, initial_status=Status.DISCONNECTED): 208 | self.status = Status(initial_status) 209 | self.__app = app 210 | self.__tooltip = None 211 | # Try using StatusNotifier first 212 | self._contextmenu.insert_action_group("app", app) 213 | try: 214 | self._impl = StatusIconImplSNI(self, self._contextmenu, app, self.__sni_failed) 215 | except Exception as e: 216 | print("StatusNotifier failed, using GtkStatusIcon instead -", str(e)) 217 | self.__sni_failed(None) 218 | self.__configure_impl() 219 | 220 | def __sni_failed(self, sni_impl): 221 | # Use the (deprecated) GtkStatusIcon as fallback 222 | self._impl = StatusIconImplGSI(self, self._contextmenu, self.__app) 223 | self.__configure_impl() 224 | 225 | def __configure_impl(self): 226 | self._impl.set_tooltip(None) 227 | self.clear_notifications() 228 | 229 | @cachedproperty 230 | def _contextmenu(self): 231 | model = self.__app.get_menu_by_id("app-menu") 232 | if model is None: 233 | # If showing the application menu in the GNOME Shell top bar is 234 | # disabled, then GtkApplication won't load gtk/menus.ui 235 | # automatically, but we still need it for the context menu. 236 | (model,) = self.__app._build("gtk/menus.ui", "app-menu") 237 | return Gtk.Menu.new_from_model(model) 238 | 239 | def __add_notification_tooltip_text(self, text): 240 | if self.__tooltip is None: 241 | self.__tooltip = text 242 | else: 243 | self.__tooltip += "\n" 244 | self.__tooltip += text 245 | self._impl.set_tooltip(self.__tooltip) 246 | 247 | def __clear_notification_tooltip_text(self): 248 | self._impl.set_tooltip(None) 249 | self.__tooltip = None 250 | 251 | def set_status(self, status): 252 | status = Status(status) 253 | if status is not self.status: 254 | self.status = status 255 | self._impl.set_status(self.status) 256 | 257 | def add_notification(self, text): 258 | self.__add_notification_tooltip_text(text) 259 | self.set_status(Status.BLINKING) 260 | 261 | def clear_notifications(self): 262 | self.__clear_notification_tooltip_text() 263 | self.set_status(Status.CONNECTED) 264 | 265 | # Delegate methods. 266 | def on_icon_activate(self, icon_impl): 267 | self.clear_notifications() 268 | if self.__app.is_visible_and_focused(): 269 | self.__app.hide() 270 | else: 271 | self.__app.show() 272 | -------------------------------------------------------------------------------- /revolt/util.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # vim:fenc=utf-8 4 | # 5 | # Copyright © 2016 Adrian Perez 6 | # 7 | # Distributed under terms of the GPv3 license. 8 | 9 | from gi.repository import Gdk 10 | from gi.repository import Gtk 11 | import os 12 | 13 | 14 | if hasattr(Gtk, "show_uri_on_window"): 15 | def show_uri(parent, uri, timestamp=None): 16 | if timestamp is None: 17 | timestamp = Gdk.CURRENT_TIME 18 | Gtk.show_uri_on_window(parent, uri, timestamp) 19 | else: 20 | def show_uri(parent, uri, timestamp=None): 21 | if timestamp is None: 22 | timestamp = Gdk.CURRENT_TIME 23 | Gtk.show_uri(None, uri, timestamp) 24 | 25 | 26 | class CachedProperty(object): 27 | __slots__ = ("value", "get_value") 28 | 29 | INVALID = object() 30 | 31 | def __init__(self, f): 32 | self.value = self.INVALID 33 | self.get_value = f 34 | 35 | def __call__(self, obj): 36 | if self.value is self.INVALID: 37 | self.value = self.get_value(obj) 38 | return self.value 39 | 40 | 41 | def cachedproperty(f, doc=None): 42 | return property(CachedProperty(f), doc=doc) 43 | 44 | 45 | def desktop_is(desktopname): 46 | desktopname = desktopname.lower() 47 | if desktopname == "kde" and os.environ.get("KDE_FULL_SESSION") == "true": 48 | return True 49 | if desktopname == "mate" and os.environ.get("MATE_DESKTOP_SESSION_ID"): 50 | return True 51 | for desktopvarname in ["XDG_SESSION_DESKTOP", "DESKTOP_SESSION", "XDG_CURRENT_DESKTOP", 52 | "XDG_SESSION_DESKTOP", "XDG_MENU_PREFIX", "GDMSESSION", "XDG_DATA_DIRS"]: 53 | desktopvarvalue = os.environ.get(desktopvarname) 54 | if desktopvarvalue and desktopname in desktopvarvalue.lower(): 55 | return True 56 | return False 57 | -------------------------------------------------------------------------------- /revolt/window.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # vim:fenc=utf-8 4 | # 5 | # Copyright © 2016-2017 Adrian Perez 6 | # 7 | # Distributed under terms of the GPLv3 license. 8 | 9 | from gi.repository import GLib, Gtk, Gio, WebKit2, GObject 10 | from .util import cachedproperty, show_uri, desktop_is 11 | from . import accelerators 12 | from . import statusicon 13 | 14 | 15 | class MainWindow(Gtk.ApplicationWindow): 16 | network_busy = GObject.Property(type=bool, default=False) 17 | 18 | def __init__(self, application, saved_state): 19 | self.application = application 20 | self.saved_state = saved_state 21 | Gtk.ApplicationWindow.__init__(self, 22 | application=application, 23 | icon_name="revolt", 24 | role="main-window", 25 | default_width=saved_state.get_uint("width"), 26 | default_height=saved_state.get_uint("height")) 27 | if self.saved_state.get_boolean("maximized"): 28 | self.maximize() 29 | self.saved_state.bind("maximized", self, "is-maximized", Gio.SettingsBindFlags.SET) 30 | 31 | if application.settings.get_boolean("use-header-bar"): 32 | self.set_titlebar(self.__make_headerbar()) 33 | 34 | if application.settings.get_boolean("hide-on-window-close"): 35 | self.connect("delete-event", self.__hide_on_destroy) 36 | 37 | self.set_title(u"Revolt") 38 | application.add_window(self) 39 | self._webview = WebKit2.WebView(user_content_manager=self._user_content_manager, 40 | web_context=self._web_context) 41 | self._webview.connect("decide-policy", self.__on_decide_policy) 42 | self._webview.connect("context-menu", self.__on_context_menu) 43 | application.settings.bind("zoom-factor", self._webview, "zoom-level", 44 | Gio.SettingsBindFlags.GET) 45 | if hasattr(self._webview, "set_maintains_back_forward_list"): 46 | self._webview.set_maintains_back_forward_list(False) 47 | websettings = self._webview.get_settings() 48 | application.settings.bind("enable-developer-tools", websettings, 49 | "enable-developer-extras", 50 | Gio.SettingsBindFlags.GET) 51 | application.settings.bind("enable-developer-tools", websettings, 52 | "enable-write-console-messages-to-stdout", 53 | Gio.SettingsBindFlags.GET) 54 | 55 | self.add_accel_group(accelerators.window_keys) 56 | 57 | websettings.set_allow_file_access_from_file_urls(True) 58 | websettings.set_allow_modal_dialogs(False) # TODO 59 | websettings.set_enable_fullscreen(False) 60 | websettings.set_enable_java(False) 61 | websettings.set_enable_media_stream(True) 62 | websettings.set_enable_page_cache(False) # Single-page app 63 | websettings.set_enable_plugins(False) 64 | websettings.set_enable_smooth_scrolling(True) 65 | websettings.set_enable_webaudio(True) 66 | websettings.set_javascript_can_access_clipboard(True) 67 | websettings.set_minimum_font_size(12) # TODO: Make it a setting 68 | websettings.set_property("enable-mediasource", True) 69 | 70 | if hasattr(websettings, "set_hardware_acceleration_policy"): 71 | websettings.set_hardware_acceleration_policy(WebKit2.HardwareAccelerationPolicy.ALWAYS) 72 | 73 | self._webview.show_all() 74 | self.add(self._webview) 75 | self.__connect_widgets() 76 | self.__notification_ids = set() 77 | 78 | def do_configure_event(self, event): 79 | result = Gtk.ApplicationWindow.do_configure_event(self, event) 80 | width, height = self.get_size() 81 | self.saved_state.set_uint("width", width) 82 | self.saved_state.set_uint("height", height) 83 | return result 84 | 85 | def __make_headerbar(self): 86 | header = Gtk.HeaderBar() 87 | header.set_show_close_button(True) 88 | header.get_style_context().add_class("revolt-slim") 89 | spinner = Gtk.Spinner() 90 | header.pack_end(spinner) 91 | self.bind_property("network-busy", spinner, "active", 92 | GObject.BindingFlags.DEFAULT) 93 | header.show_all() 94 | return header 95 | 96 | @cachedproperty 97 | def _website_data_manager(self): 98 | from os import path as P 99 | print("Creating WebsiteDataManager...") 100 | app_id = self.application.get_application_id() 101 | cache_dir = P.join(GLib.get_user_cache_dir(), "revolt", app_id) 102 | data_dir = P.join(GLib.get_user_data_dir(), "revolt", app_id) 103 | return WebKit2.WebsiteDataManager(base_cache_directory=cache_dir, 104 | base_data_directory=data_dir) 105 | 106 | @cachedproperty 107 | def _web_context(self): 108 | print("Creating WebContext...") 109 | ctx = WebKit2.WebContext(website_data_manager=self._website_data_manager) 110 | ctx.set_spell_checking_enabled(False) 111 | ctx.set_tls_errors_policy(WebKit2.TLSErrorsPolicy.FAIL) 112 | return ctx 113 | 114 | @cachedproperty 115 | def _user_content_manager(self): 116 | mgr = WebKit2.UserContentManager() 117 | script = WebKit2.UserScript("Notification.requestPermission();", 118 | WebKit2.UserContentInjectedFrames.TOP_FRAME, 119 | WebKit2.UserScriptInjectionTime.START, 120 | None, None) 121 | mgr.add_script(script) 122 | return mgr 123 | 124 | def __on_decide_policy(self, webview, decision, decision_type): 125 | if decision_type == WebKit2.PolicyDecisionType.NAVIGATION_ACTION: 126 | if decision.get_navigation_type() == WebKit2.NavigationType.LINK_CLICKED: 127 | uri = decision.get_request().get_uri() 128 | if not uri.startswith(self.application.element_url): 129 | show_uri(self, uri) 130 | return True 131 | elif decision_type == WebKit2.PolicyDecisionType.NEW_WINDOW_ACTION: 132 | if decision.get_navigation_type() == WebKit2.NavigationType.LINK_CLICKED: 133 | show_uri(self, decision.get_request().get_uri()) 134 | return True 135 | return False 136 | 137 | @cachedproperty 138 | def _context_menu_actions(self): 139 | action_list = [] 140 | action = Gio.SimpleAction.new("preferences") 141 | action.connect("activate", self.application.on_app_preferences) 142 | action_list.append((action, "_Preferences")) 143 | action = Gio.SimpleAction.new("element-settings") 144 | action.connect("activate", self.application.on_element_settings) 145 | action_list.append((action, "_Element Settings")) 146 | return tuple(action_list) 147 | 148 | def __on_context_menu(self, webview, menu, event, hit_test): 149 | # Tweak built-in entries. 150 | for action in (WebKit2.ContextMenuAction.GO_BACK, 151 | WebKit2.ContextMenuAction.GO_FORWARD, 152 | WebKit2.ContextMenuAction.STOP): 153 | for index in range(menu.get_n_items()): 154 | item = menu.get_item_at_position(index) 155 | if action == item.get_stock_action(): 156 | menu.remove(item) 157 | break 158 | # Add a separator. 159 | menu.append(WebKit2.ContextMenuItem.new_separator()) 160 | # Append application-specfic entries. 161 | for (action, label) in self._context_menu_actions: 162 | menu.append(WebKit2.ContextMenuItem.new_from_gaction(action, label)) 163 | return False 164 | 165 | def __on_has_toplevel_focus_changed(self, window, has_focus): 166 | assert window == self 167 | if window.has_toplevel_focus(): 168 | # Clear the window's urgency hint 169 | window.set_urgency_hint(False) 170 | # Dismiss notifications 171 | for notification_id in self.__notification_ids: 172 | self.application.withdraw_notification(notification_id) 173 | self.__notification_ids.clear() 174 | self.application.statusicon.clear_notifications() 175 | 176 | def __on_load_changed(self, webview, event): 177 | if event == WebKit2.LoadEvent.FINISHED: 178 | self.network_busy = False 179 | self.application.statusicon.set_status(statusicon.Status.CONNECTED) 180 | else: 181 | self.network_busy = True 182 | self.application.statusicon.set_status(statusicon.Status.DISCONNECTED) 183 | 184 | @cachedproperty 185 | def _notification_icon(self): 186 | icon_id = self.application.get_application_id() + "-symbolic" 187 | return Gio.ThemedIcon.new(icon_id) 188 | 189 | def __on_show_notification(self, webview, notification): 190 | # TODO: Handle notification clicked, and so 191 | if not self.has_toplevel_focus(): 192 | self.set_urgency_hint(True) 193 | notif = Gio.Notification.new(notification.get_title()) 194 | notif.set_body(notification.get_body()) 195 | # TODO: Use the avatar of the contact, if available. 196 | notif.set_icon(self._notification_icon) 197 | if not desktop_is("xfce"): # Workaround for XFCE bug #13586 198 | notif.set_priority(Gio.NotificationPriority.HIGH) 199 | # use title as notification id: 200 | # allows to reuse one notification for the same conversation 201 | notification_id = notification.get_title() 202 | self.__notification_ids.add(notification_id) 203 | self.application.send_notification(notification_id, notif) 204 | self.application.statusicon.add_notification("%s: %s" % (notification.get_title(), 205 | notification.get_body())) 206 | return True 207 | 208 | def __on_permission_request(self, webview, request): 209 | if isinstance(request, WebKit2.NotificationPermissionRequest): 210 | request.allow() 211 | return True 212 | 213 | def __connect_widgets(self): 214 | self.connect("notify::has-toplevel-focus", self.__on_has_toplevel_focus_changed) 215 | self._webview.connect("load-changed", self.__on_load_changed) 216 | self._webview.connect("show-notification", self.__on_show_notification) 217 | self._webview.connect("permission-request", self.__on_permission_request) 218 | 219 | def __hide_on_destroy(self, widget, event): 220 | self.application.hide() 221 | return True 222 | 223 | def reload_element(self, bypass_cache=False): 224 | if bypass_cache: 225 | self._webview.reload_bypass_cache() 226 | else: 227 | self._webview.reload() 228 | 229 | def load_element(self): 230 | self._webview.load_uri(self.application.element_url) 231 | return self 232 | 233 | def load_settings_page(self): 234 | from urllib.parse import urlsplit, urlunsplit 235 | url = list(urlsplit(self._webview.get_uri())) 236 | url[-1] = "#settings" 237 | self._webview.load_uri(urlunsplit(url)) 238 | 239 | def finish(self): 240 | self._webview.stop_loading() 241 | self.hide() 242 | self.destroy() 243 | del self._webview 244 | return self 245 | -------------------------------------------------------------------------------- /syncrepo.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | # 3 | # sync-repo.sh 4 | # Copyright (C) 2016-2017 Adrian Perez 5 | # 6 | # Distributed under terms of the GPLv3 license. 7 | # 8 | set -e 9 | 10 | LOCAL="$(dirname "$0")/.flatpak-repo/" 11 | REMOTE='aperez@perezdecastro.org:/srv/http/flatpak.perezdecastro.org/revolt/' 12 | 13 | RSYNC_REPOS=$(type -P ostree-rsync-repos rsync-repos \ 14 | "$(dirname "$0")/ostree-releng-scripts/rsync-repos" | head -1) 15 | if [[ -z ${RSYNC_REPOS} ]] ; then 16 | echo "$0: The ostree-rsync-repos (or rsync-repos) tool is not installed." 17 | echo 'Please install from https://github.com/ostreedev/ostree-releng-scripts' 18 | echo 'and make sure the tools are in your $PATH' 19 | exit 1 20 | fi 1>&2 21 | 22 | declare -a rsync_command=( "${RSYNC_REPOS}" ) 23 | 24 | case $1 in 25 | push) 26 | rsync_command+=( --src "${LOCAL}" --dest "${REMOTE}" ) 27 | ;; 28 | pull) 29 | rsync_command+=( --src "${REMOTE}" --dest "${LOCAL}" ) 30 | ;; 31 | *) 32 | echo "Usage: $0 push|pull" 1>&2 33 | exit 1 34 | ;; 35 | esac 36 | exec "${rsync_command[@]}" 37 | --------------------------------------------------------------------------------