├── .clang-format ├── .gitignore ├── AUTHORS ├── CMakeLists.txt ├── CONTRIBUTING.md ├── COPYING ├── ChangeLog ├── README.md ├── default_icon.png ├── doc ├── footer.html ├── generate-doc.sh ├── header.html ├── images │ ├── panel_padding.jpg │ ├── panel_size_margin.jpg │ ├── task_padding.jpg │ └── taskbar_padding.jpg ├── manual.html ├── readme.html ├── tint2.1 ├── tint2.html └── tint2.md ├── format-code.sh ├── get_version.sh ├── make_release.sh ├── new-release.py ├── packaging ├── compile-deps.sh ├── configure ├── debian │ ├── changelog │ ├── compat │ ├── control │ ├── copyright │ ├── examples │ ├── postinst │ ├── rules │ ├── source │ │ ├── format │ │ └── include-binaries │ ├── tint2.install │ ├── tint2.manpages │ ├── tint2conf.1 │ └── watch ├── make_ubuntu.sh ├── update_version_status.sh ├── version_status.py └── version_status_test.py ├── src ├── battery │ ├── battery.c │ ├── battery.h │ ├── dummy.c │ ├── freebsd.c │ ├── linux.c │ └── openbsd.c ├── button │ ├── button.c │ └── button.h ├── clock │ ├── clock.c │ └── clock.h ├── config.c ├── config.h ├── default_icon.c ├── default_icon.h ├── drag_and_drop.c ├── drag_and_drop.h ├── execplugin │ ├── execplugin.c │ └── execplugin.h ├── freespace │ ├── freespace.c │ └── freespace.h ├── init.c ├── init.h ├── launcher │ ├── apps-common.c │ ├── apps-common.h │ ├── icon-theme-common.c │ ├── icon-theme-common.h │ ├── launcher.c │ ├── launcher.h │ ├── xsettings-client.c │ ├── xsettings-client.h │ ├── xsettings-common.c │ └── xsettings-common.h ├── main.c ├── mouse_actions.c ├── mouse_actions.h ├── panel.c ├── panel.h ├── separator │ ├── separator.c │ └── separator.h ├── systray │ ├── systraybar.c │ └── systraybar.h ├── taskbar │ ├── task.c │ ├── task.h │ ├── taskbar.c │ ├── taskbar.h │ ├── taskbarname.c │ └── taskbarname.h ├── tint2conf │ ├── CMakeLists.txt │ ├── background_gui.c │ ├── background_gui.h │ ├── gradient_gui.c │ ├── gradient_gui.h │ ├── gui.h │ ├── main.c │ ├── main.h │ ├── md4.c │ ├── md4.h │ ├── po │ │ ├── CMakeLists.txt │ │ ├── bs.po │ │ ├── es.po │ │ ├── fr.po │ │ ├── hr.po │ │ ├── pl.po │ │ ├── readme.txt │ │ ├── ru.po │ │ ├── sr.po │ │ ├── tint2conf.pot │ │ └── update-translations.sh │ ├── properties.c │ ├── properties.h │ ├── properties_rw.c │ ├── properties_rw.h │ ├── theme_view.c │ ├── theme_view.h │ ├── tint2conf.desktop │ ├── tint2conf.svg │ └── tint2conf.xml ├── tint2rc.c ├── tint2rc.h ├── tooltip │ ├── tooltip.c │ └── tooltip.h └── util │ ├── area.c │ ├── area.h │ ├── bool.h │ ├── bt.c │ ├── bt.h │ ├── cache.c │ ├── cache.h │ ├── color.c │ ├── color.h │ ├── colors.h │ ├── common.c │ ├── common.h │ ├── fps_distribution.c │ ├── fps_distribution.h │ ├── gradient.c │ ├── gradient.h │ ├── mem.c │ ├── print.c │ ├── print.h │ ├── server.c │ ├── server.h │ ├── signals.c │ ├── signals.h │ ├── strlcat.c │ ├── strlcat.h │ ├── strnatcmp.c │ ├── strnatcmp.h │ ├── test.c │ ├── test.h │ ├── timer.c │ ├── timer.h │ ├── tracing.c │ ├── tracing.h │ ├── uevent.c │ ├── uevent.h │ ├── window.c │ └── window.h ├── test ├── 2battery-gijsbers │ ├── bat.txt │ └── sys │ │ └── class │ │ └── power_supply │ │ ├── AC0 │ │ ├── online │ │ ├── power │ │ │ ├── async │ │ │ ├── control │ │ │ ├── runtime_active_kids │ │ │ ├── runtime_active_time │ │ │ ├── runtime_enabled │ │ │ ├── runtime_status │ │ │ ├── runtime_suspended_time │ │ │ ├── runtime_usage │ │ │ ├── wakeup │ │ │ ├── wakeup_abort_count │ │ │ ├── wakeup_active │ │ │ ├── wakeup_active_count │ │ │ ├── wakeup_count │ │ │ ├── wakeup_expire_count │ │ │ ├── wakeup_last_time_ms │ │ │ ├── wakeup_max_time_ms │ │ │ ├── wakeup_prevent_sleep_time_ms │ │ │ └── wakeup_total_time_ms │ │ ├── type │ │ └── uevent │ │ ├── BAT0 │ │ ├── capacity │ │ ├── capacity_level │ │ ├── charge_full │ │ ├── charge_full_design │ │ ├── charge_now │ │ ├── charge_type │ │ ├── health │ │ ├── manufacturer │ │ ├── model_name │ │ ├── power │ │ │ ├── async │ │ │ ├── control │ │ │ ├── runtime_active_kids │ │ │ ├── runtime_active_time │ │ │ ├── runtime_enabled │ │ │ ├── runtime_status │ │ │ ├── runtime_suspended_time │ │ │ ├── runtime_usage │ │ │ ├── wakeup │ │ │ ├── wakeup_abort_count │ │ │ ├── wakeup_active │ │ │ ├── wakeup_active_count │ │ │ ├── wakeup_count │ │ │ ├── wakeup_expire_count │ │ │ ├── wakeup_last_time_ms │ │ │ ├── wakeup_max_time_ms │ │ │ ├── wakeup_prevent_sleep_time_ms │ │ │ └── wakeup_total_time_ms │ │ ├── present │ │ ├── serial_number │ │ ├── status │ │ ├── technology │ │ ├── temp │ │ ├── time_to_empty_avg │ │ ├── time_to_full_now │ │ ├── type │ │ ├── uevent │ │ └── voltage_now │ │ └── BAT1 │ │ ├── capacity │ │ ├── capacity_level │ │ ├── charge_full │ │ ├── charge_full_design │ │ ├── charge_now │ │ ├── charge_type │ │ ├── health │ │ ├── manufacturer │ │ ├── model_name │ │ ├── power │ │ ├── async │ │ ├── control │ │ ├── runtime_active_kids │ │ ├── runtime_active_time │ │ ├── runtime_enabled │ │ ├── runtime_status │ │ ├── runtime_suspended_time │ │ ├── runtime_usage │ │ ├── wakeup │ │ ├── wakeup_abort_count │ │ ├── wakeup_active │ │ ├── wakeup_active_count │ │ ├── wakeup_count │ │ ├── wakeup_expire_count │ │ ├── wakeup_last_time_ms │ │ ├── wakeup_max_time_ms │ │ ├── wakeup_prevent_sleep_time_ms │ │ └── wakeup_total_time_ms │ │ ├── present │ │ ├── serial_number │ │ ├── status │ │ ├── technology │ │ ├── temp │ │ ├── time_to_empty_avg │ │ ├── time_to_full_now │ │ ├── type │ │ ├── uevent │ │ └── voltage_now ├── acer-chromebook-c100pa │ ├── out.txt │ └── sys │ │ └── class │ │ └── power_supply │ │ ├── bq27500-0 │ │ ├── capacity │ │ ├── capacity_level │ │ ├── charge_full │ │ ├── charge_full_design │ │ ├── charge_now │ │ ├── current_now │ │ ├── cycle_count │ │ ├── energy_now │ │ ├── health │ │ ├── manufacturer │ │ ├── model_name │ │ ├── power │ │ │ ├── async │ │ │ ├── autosuspend_delay_ms │ │ │ ├── control │ │ │ ├── runtime_active_kids │ │ │ ├── runtime_active_time │ │ │ ├── runtime_enabled │ │ │ ├── runtime_status │ │ │ ├── runtime_suspended_time │ │ │ ├── runtime_usage │ │ │ ├── wakeup │ │ │ ├── wakeup_abort_count │ │ │ ├── wakeup_active │ │ │ ├── wakeup_active_count │ │ │ ├── wakeup_count │ │ │ ├── wakeup_expire_count │ │ │ ├── wakeup_last_time_ms │ │ │ ├── wakeup_max_time_ms │ │ │ ├── wakeup_total_time_ms │ │ │ └── wakeup_type │ │ ├── power_avg │ │ ├── present │ │ ├── status │ │ ├── technology │ │ ├── temp │ │ ├── time_to_empty_avg │ │ ├── time_to_empty_now │ │ ├── time_to_full_now │ │ ├── type │ │ ├── uevent │ │ └── voltage_now │ │ └── gpio-charger │ │ ├── online │ │ ├── power │ │ ├── async │ │ ├── autosuspend_delay_ms │ │ ├── control │ │ ├── runtime_active_kids │ │ ├── runtime_active_time │ │ ├── runtime_enabled │ │ ├── runtime_status │ │ ├── runtime_suspended_time │ │ ├── runtime_usage │ │ ├── wakeup │ │ ├── wakeup_abort_count │ │ ├── wakeup_active │ │ ├── wakeup_active_count │ │ ├── wakeup_count │ │ ├── wakeup_expire_count │ │ ├── wakeup_last_time_ms │ │ ├── wakeup_max_time_ms │ │ ├── wakeup_total_time_ms │ │ └── wakeup_type │ │ ├── type │ │ └── uevent ├── configs │ ├── compton.conf │ ├── openbox.xml │ ├── tint2 │ │ └── 661.tint2rc │ └── xsettingsd.conf ├── expand.py ├── expand2.py ├── fabfile.py ├── ff.desktop ├── gather-battery-data.py ├── lenovo │ ├── out.txt │ └── sys │ │ └── class │ │ └── power_supply │ │ └── BAT0 │ │ ├── alarm │ │ ├── capacity │ │ ├── capacity_level │ │ ├── cycle_count │ │ ├── energy_full │ │ ├── energy_full_design │ │ ├── energy_now │ │ ├── manufacturer │ │ ├── model_name │ │ ├── power │ │ ├── async │ │ ├── autosuspend_delay_ms │ │ ├── control │ │ ├── runtime_active_kids │ │ ├── runtime_active_time │ │ ├── runtime_enabled │ │ ├── runtime_status │ │ ├── runtime_suspended_time │ │ └── runtime_usage │ │ ├── power_now │ │ ├── present │ │ ├── serial_number │ │ ├── status │ │ ├── technology │ │ ├── type │ │ ├── uevent │ │ ├── voltage_min_design │ │ └── voltage_now ├── manual-theme-check.sh ├── meminfo.py ├── regression.py ├── update_test_status.sh └── workspaces-stress.sh ├── themes ├── CMakeLists.txt ├── horizontal-dark-opaque.tint2rc ├── horizontal-dark-transparent.tint2rc ├── horizontal-icon-only.tint2rc ├── horizontal-light-opaque.tint2rc ├── horizontal-light-transparent.tint2rc ├── horizontal-text-only.tint2rc ├── tint2rc ├── vertical-dark-opaque.tint2rc ├── vertical-dark-transparent.tint2rc ├── vertical-light-opaque.tint2rc ├── vertical-light-transparent.tint2rc └── vertical-neutral-icons.tint2rc ├── tint2.config ├── tint2.creator ├── tint2.desktop ├── tint2.files ├── tint2.includes └── tint2.svg /.clang-format: -------------------------------------------------------------------------------- 1 | # works with clang-format-3.7 2 | # 3 | # Most controversial fields are UseTab, IndentWidth, ContinuationIndentWidth, ColumnLimit, BreakBeforeBraces 4 | 5 | #BasedOnStyle: Google 6 | AccessModifierOffset: 0 7 | AlignAfterOpenBracket: true 8 | AlignConsecutiveAssignments: false 9 | #AlignConsecutiveDeclarations: false 10 | AlignEscapedNewlinesLeft: true 11 | AlignOperands: true 12 | AlignTrailingComments: true 13 | AllowAllParametersOfDeclarationOnNextLine: false 14 | AllowShortBlocksOnASingleLine: false 15 | AllowShortCaseLabelsOnASingleLine: false 16 | AllowShortFunctionsOnASingleLine: Empty 17 | AllowShortIfStatementsOnASingleLine: false 18 | AllowShortLoopsOnASingleLine: false 19 | AlwaysBreakAfterDefinitionReturnType: None 20 | AlwaysBreakBeforeMultilineStrings: false 21 | AlwaysBreakTemplateDeclarations: false 22 | BinPackArguments: false 23 | BinPackParameters: false 24 | BreakBeforeBinaryOperators: None 25 | BreakBeforeBraces: Linux 26 | BreakBeforeTernaryOperators: true 27 | BreakConstructorInitializersBeforeComma: false 28 | ColumnLimit: 120 29 | CommentPragmas: '' 30 | ConstructorInitializerAllOnOneLineOrOnePerLine: true 31 | ConstructorInitializerIndentWidth: 0 32 | ContinuationIndentWidth: 4 33 | Cpp11BracedListStyle: true 34 | DerivePointerAlignment: false 35 | DerivePointerBinding: false 36 | DisableFormat: false 37 | ForEachMacros: ['foreach'] 38 | IndentCaseLabels: false 39 | IndentFunctionDeclarationAfterType: false 40 | IndentWidth: 4 41 | IndentWrappedFunctionNames: false 42 | Language: Cpp 43 | MaxEmptyLinesToKeep: 1 44 | NamespaceIndentation: None 45 | ObjCSpaceAfterProperty: true 46 | ObjCSpaceBeforeProtocolList: true 47 | PenaltyBreakBeforeFirstCallParameter: 1000 48 | PenaltyBreakComment: 100 49 | PenaltyBreakFirstLessLess: 0 50 | PenaltyBreakString: 100 51 | PenaltyExcessCharacter: 100 52 | PenaltyReturnTypeOnItsOwnLine: 2000 53 | PointerAlignment: Right 54 | SpaceAfterCStyleCast: false 55 | SpaceBeforeAssignmentOperators: true 56 | SpaceBeforeParens: ControlStatements 57 | SpaceInEmptyParentheses: false 58 | SpacesBeforeTrailingComments: 1 59 | SpacesInAngles: false 60 | SpacesInCStyleCastParentheses: false 61 | SpacesInContainerLiterals: false 62 | SpacesInParentheses: false 63 | SpacesInSquareBrackets: false 64 | Standard: Cpp11 65 | TabWidth: 4 66 | UseTab: Never 67 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | *.user 3 | version.h 4 | *.pyc 5 | *.todo 6 | packaging/make_ubuntu2.sh 7 | test_*.log 8 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | tint2 is developped by : 2 | - Thierry Lorthiois from Omega distribution 3 | - Andreas Fink 4 | - Euan Freeman (tintwizard) 5 | - Christian Ruppert (autotools build system) 6 | - Ovidiu M : launcher, bug fixes 7 | - Mishael A Sibiryakov (death@junki.org) : freespace 8 | - Sebastian Reichel : battery, various fixes, debian package maintainer 9 | - Chris Lee : bug fixes, maintainer starting with v16.3 10 | 11 | tint2 is based on the ttm source code (http://code.google.com/p/ttm/) 12 | - 2007-2008 Pål Staurland 13 | 14 | Contributors: 15 | Kwaku Yeboah : wiki page 16 | Daniel Moerner : man page and debian package 17 | Doug Barton : freebsd package 18 | James Buren : Frugalware package 19 | Pierre-Emmanuel Andre : openbsd port 20 | Redroar : arch package 21 | Rene Garcia : launcher SVG support 22 | Marcelo Vianna : taskbar sorting 23 | Xico Atelo : startup notifications 24 | Craig Oakes : WM flags, issue tracker organization 25 | Jeff Blake (https://gitlab.com/u/berkley4) : more mouse event handlers 26 | Vladimir : translations, bug reports 27 | Christophe D. : non-rectangular borders 28 | Benoit Averty : taskbar enhancements 29 | Justin Jacobs : tint2conf fixes 30 | Oskari Rauta : separator plugin, gradients 31 | Michael Messmore : Support for Path in .desktop files 32 | Matthew Otnel : config option systray_name_filter 33 | Ryan Gray, Jeff Blake (https://gitlab.com/berkley4) : battery format 34 | aaaz (https://gitlab.com/aaaz) : clock fixes 35 | heisenbug (https://gitlab.com/heisenbugh) : taskbar button tinting with icon color 36 | Fabian Carlström : taskbar sort order by app name 37 | Chris Billington (https://gitlab.com/chrisjbillington) : panel struts pivoting 38 | 39 | Translations: 40 | Bosnian: 41 | Dino Duratović 42 | Croatian: 43 | Dino Duratović 44 | French: 45 | Jocelyn 46 | The Bento team 47 | Wagner 48 | Polish: 49 | Daniel Napora 50 | Serbian: 51 | Dino Duratović 52 | Spanish: 53 | Vic 54 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | Please read https://gitlab.com/o9000/tint2/wikis/Development 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Latest stable release: 16.6.1 2 | Changes: https://gitlab.com/o9000/tint2/blob/16.6.1/ChangeLog 3 | 4 | Documentation: [doc/tint2.md](doc/tint2.md) 5 | 6 | Compile it with (after you install the [dependencies](https://gitlab.com/o9000/tint2/wikis/Install#dependencies)): 7 | 8 | ``` 9 | git clone https://gitlab.com/o9000/tint2.git 10 | cd tint2 11 | git checkout 16.6.1 12 | mkdir build 13 | cd build 14 | cmake .. 15 | make -j4 16 | ``` 17 | 18 | To install, run (as root): 19 | 20 | ``` 21 | make install 22 | update-icon-caches /usr/local/share/icons/hicolor 23 | update-mime-database /usr/local/share/mime 24 | ``` 25 | 26 | And then you can run the panel `tint2` and the configuration program `tint2conf`. 27 | 28 | Please report any problems to https://gitlab.com/o9000/tint2/issues. Your feedback is much appreciated. 29 | 30 | P.S. GitLab is now the official location of the tint2 project, migrated from Google Code, which is shutting down. In case you are wondering why not GitHub, BitBucket etc., we chose GitLab because it is open source, it is mature and works well, looks cool and has a very nice team. 31 | 32 | # What is tint2? 33 | 34 | tint2 is a simple panel/taskbar made for modern X window managers. It was specifically made for Openbox but it should also work with other window managers (GNOME, KDE, XFCE etc.). It is based on ttm https://code.google.com/p/ttm/. 35 | 36 | # Features 37 | 38 | * Panel with taskbar, system tray, clock and launcher icons; 39 | * Easy to customize: color/transparency on fonts, icons, borders and backgrounds; 40 | * Pager like capability: move tasks between workspaces (virtual desktops), switch between workspaces; 41 | * Multi-monitor capability: create one panel per monitor, showing only the tasks from the current monitor; 42 | * Customizable mouse events. 43 | 44 | # Goals 45 | 46 | * Be unintrusive and light (in terms of memory, CPU and aesthetic); 47 | * Follow the freedesktop.org specifications; 48 | * Make certain workflows, such as multi-desktop and multi-monitor, easy to use. 49 | 50 | # I want it! 51 | 52 | * [Install tint2](https://gitlab.com/o9000/tint2/wikis/Install) 53 | 54 | # How do I ... 55 | 56 | * [Install](https://gitlab.com/o9000/tint2/wikis/Install) 57 | * [Configure](https://gitlab.com/o9000/tint2/blob/master/doc/tint2.md) 58 | * [Add applet not supported by tint2](https://gitlab.com/o9000/tint2/wikis/ThirdPartyApplets) 59 | * [Other frequently asked questions](https://gitlab.com/o9000/tint2/wikis/FAQ) 60 | * [Obtain a stack trace when tint2 crashes](https://gitlab.com/o9000/tint2/wikis/Debug) 61 | 62 | # Known issues 63 | 64 | * Graphical glitches on Intel graphics cards can be avoided by changing the acceleration method to UXA ([issue 595](https://gitlab.com/o9000/tint2/issues/595)) 65 | * Window managers that do not follow exactly the EWMH specification might not interact well with tint2 ([issue 627](https://gitlab.com/o9000/tint2/issues/627)). 66 | * Full transparency requires a compositor such as Compton (if not provided already by the window manager, as in Compiz/Unity, KDE or XFCE). 67 | 68 | # How can I help out? 69 | 70 | * Report bugs and ask questions on the [issue tracker](https://gitlab.com/o9000/tint2/issues); 71 | * Contribute to the development by helping us fix bugs and suggesting new features. Please read the contribution guide: [CONTRIBUTING.md](CONTRIBUTING.md) 72 | 73 | # Links 74 | * Home page: https://gitlab.com/o9000/tint2 75 | * Git repository: https://gitlab.com/o9000/tint2.git 76 | * Documentation: https://gitlab.com/o9000/tint2/wikis/home 77 | * Downloads: https://gitlab.com/o9000/tint2-archive/tree/master or https://code.google.com/p/tint2/downloads/list 78 | * Old project location (inactive): https://code.google.com/p/tint2 79 | 80 | # Screenshots 81 | 82 | ## Default config: 83 | 84 | ![Screenshot_2016-01-23_14-42-57](https://gitlab.com/o9000/tint2/uploads/948fa74eca60864352a033580350b4c3/Screenshot_2016-01-23_14-42-57.png) 85 | 86 | ## Various configs: 87 | 88 | * [Screenshots](https://gitlab.com/o9000/tint2/wikis/screenshots) 89 | 90 | ## Demos 91 | 92 | * [Compact panel, separator, color gradients](https://gitlab.com/o9000/tint2/wikis/whats-new-0.13.0.gif) 93 | * [Executor](https://gitlab.com/o9000/tint2/wikis/whats-new-0.12.4.gif) 94 | * [Mouse over effects](https://gitlab.com/o9000/tint2/wikis/whats-new-0.12.3.gif) 95 | * [Distribute size between taskbars, freespace](https://gitlab.com/o9000/tint2/wikis/whats-new-0.12.gif) 96 | 97 | ## More 98 | 99 | * [Tint2 wiki](https://gitlab.com/o9000/tint2/wikis/Home) 100 | -------------------------------------------------------------------------------- /default_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o9000/tint2/784edaccd2ac5f6ebb0f83db7b2d805062d0f095/default_icon.png -------------------------------------------------------------------------------- /doc/footer.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /doc/generate-doc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # You can install md2man with gem install md2man. You need gem and ruby-dev. 4 | 5 | set -e 6 | set -x 7 | 8 | md2man-roff tint2.md > tint2.1 9 | 10 | cat header.html > manual.html 11 | cat tint2.md | sed 's/^# TINT2 .*$/# TINT2/g' | md2man-html >> manual.html 12 | cat footer.html >> manual.html 13 | 14 | cat header.html > readme.html 15 | cat ../README.md | sed 's|doc/tint2.md|manual.html|g' | md2man-html >> readme.html 16 | cat footer.html >> readme.html 17 | -------------------------------------------------------------------------------- /doc/header.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 200 | 201 | 202 | -------------------------------------------------------------------------------- /doc/images/panel_padding.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o9000/tint2/784edaccd2ac5f6ebb0f83db7b2d805062d0f095/doc/images/panel_padding.jpg -------------------------------------------------------------------------------- /doc/images/panel_size_margin.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o9000/tint2/784edaccd2ac5f6ebb0f83db7b2d805062d0f095/doc/images/panel_size_margin.jpg -------------------------------------------------------------------------------- /doc/images/task_padding.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o9000/tint2/784edaccd2ac5f6ebb0f83db7b2d805062d0f095/doc/images/task_padding.jpg -------------------------------------------------------------------------------- /doc/images/taskbar_padding.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o9000/tint2/784edaccd2ac5f6ebb0f83db7b2d805062d0f095/doc/images/taskbar_padding.jpg -------------------------------------------------------------------------------- /format-code.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | find . '(' -name '*.h' -o -name '*.c' ')' -exec clang-format-3.7 -style=file -i '{}' \; 4 | -------------------------------------------------------------------------------- /get_version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | SCRIPT_DIR=$(dirname "$0") 4 | DIRTY="" 5 | VERSION="" 6 | 7 | OLD_DIR=$(pwd) 8 | cd ${SCRIPT_DIR} 9 | 10 | if [ -d .git ] && git status 1>/dev/null 2>/dev/null 11 | then 12 | git update-index -q --ignore-submodules --refresh 13 | # Disallow unstaged changes in the working tree 14 | if ! git diff-files --quiet --ignore-submodules -- 15 | then 16 | if [ "$1" = "--strict" ] 17 | then 18 | echo >&2 "Error: there are unstaged changes." 19 | git diff-files --name-status -r --ignore-submodules -- >&2 20 | exit 1 21 | else 22 | DIRTY="-dirty" 23 | fi 24 | fi 25 | 26 | # Disallow uncommitted changes in the index 27 | if ! git diff-index --cached --quiet HEAD --ignore-submodules -- 28 | then 29 | if [ "$1" = "--strict" ] 30 | then 31 | echo >&2 "Error: there are uncommitted changes." 32 | git diff-index --cached --name-status -r --ignore-submodules HEAD -- >&2 33 | exit 1 34 | else 35 | DIRTY="-dirty" 36 | fi 37 | fi 38 | if git describe 1>/dev/null 2>/dev/null 39 | then 40 | VERSION=$(git describe 2>/dev/null)$DIRTY 41 | elif git log -n 1 1>/dev/null 2>/dev/null 42 | then 43 | VERSION=$(head -n 1 "ChangeLog" | cut -d ' ' -f 2) 44 | if [ "$VERSION" = "master" ] 45 | then 46 | PREVIOUS=$(grep '^2' "ChangeLog" | head -n 2 | tail -n 1 | cut -d ' ' -f 2) 47 | HASH=$(git log -n 1 --pretty=format:%cI.%ct.%h | tr -d ':' | tr -d '-' | tr '.' '-' | sed 's/T[0-9\+]*//g' 2>/dev/null) 48 | VERSION=$PREVIOUS-next-$HASH 49 | fi 50 | fi 51 | fi 52 | 53 | if [ -z "$VERSION" ] 54 | then 55 | VERSION=$(head -n 1 "ChangeLog" | cut -d ' ' -f 2) 56 | if [ "$VERSION" = "master" ] 57 | then 58 | VERSION=$VERSION-$(head -n 1 "ChangeLog" | cut -d ' ' -f 1) 59 | fi 60 | fi 61 | 62 | cd "${OLD_DIR}" 63 | 64 | VERSION=$(echo "$VERSION" | sed 's/^v//') 65 | 66 | echo '#define VERSION_STRING "'$VERSION'"' > version.h 67 | echo $VERSION 68 | -------------------------------------------------------------------------------- /make_release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Usage: ./make_release.sh 4 | # Creates a tar.gz archive of the current tree. 5 | 6 | VERSION=$(./get_version.sh --strict) 7 | if [ ! $? -eq 0 ] 8 | then 9 | echo >&2 "Error: get_version.sh failed!" 10 | exit 1 11 | fi 12 | 13 | ARCHIVE=tint2-$VERSION.tar.gz 14 | 15 | echo "Making release tint2-$VERSION" 16 | git archive --format=tar.gz --prefix=tint2-$VERSION/ v$VERSION >$ARCHIVE 17 | 18 | sha1sum -b $ARCHIVE 19 | sha256sum -b $ARCHIVE 20 | -------------------------------------------------------------------------------- /packaging/compile-deps.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | PS4='\e[99;33m${BASH_SOURCE}:$LINENO\e[0m ' 4 | set -e 5 | set -x 6 | 7 | sudo apt-get install ninja-build python2.7 wget 8 | sudo apt-get build-dep libx11-6 libxrender1 libcairo2 libglib2.0-0 libpango-1.0-0 libimlib2 librsvg2-2 9 | 10 | export PKG_CONFIG_PATH="" 11 | 12 | DEPS=$HOME/tint2-deps 13 | X11=$(pkg-config --modversion x11) 14 | XRENDER=$(pkg-config --modversion xrender) 15 | XCOMPOSITE=$(pkg-config --modversion xcomposite) 16 | XDAMAGE=$(pkg-config --modversion xdamage) 17 | XEXT=$(pkg-config --modversion xext) 18 | XRANDR=$(pkg-config --modversion xrandr) 19 | XINERAMA=$(pkg-config --modversion xinerama) 20 | IMLIB=$(pkg-config --modversion imlib2) 21 | GLIB=$(pkg-config --modversion glib-2.0) 22 | CAIRO=$(pkg-config --modversion cairo) 23 | PANGO=$(pkg-config --modversion pango) 24 | PIXBUF=$(pkg-config --modversion gdk-pixbuf-2.0) 25 | RSVG=$(pkg-config --modversion librsvg-2.0) 26 | 27 | mkdir -p $DEPS/src 28 | 29 | function two_digits() { 30 | echo "$@" | cut -d. -f 1-2 31 | } 32 | 33 | function download_and_build() { 34 | URL="$1" 35 | shift 36 | CFGARGS="$@" 37 | ARCHIVE="$(basename "$URL")" 38 | NAME="$(echo "$ARCHIVE" | sed s/\.tar.*$//g)" 39 | 40 | cd "$DEPS/src" 41 | rm -rf "$ARCHIVE" 42 | rm -rf "$NAME" 43 | wget "$URL" -O "$ARCHIVE" 44 | tar xf "$ARCHIVE" 45 | cd "$NAME" 46 | export PKG_CONFIG_PATH="$DEPS/lib/pkgconfig" 47 | export PATH="$DEPS/bin:$PATH" 48 | export CFLAGS="-O0 -fno-common -fno-omit-frame-pointer -rdynamic -fsanitize=address -g" 49 | export LDFLAGS="-Wl,--no-as-needed -Wl,-z,defs -O0 -fno-common -fno-omit-frame-pointer -rdynamic -fsanitize=address -fuse-ld=gold -g -ldl -lasan" 50 | if [[ -x ./configure ]] 51 | then 52 | ./configure "--prefix=$DEPS" "$@" 53 | make -j 54 | make install 55 | elif [[ -f meson.build ]] 56 | then 57 | mkdir build 58 | cd build 59 | meson "--prefix=$DEPS" "$@" .. 60 | ninja install 61 | else 62 | echo "unknown build method" 63 | exit 1 64 | fi 65 | } 66 | 67 | download_and_build "https://www.x.org/archive/individual/lib/libX11-$X11.tar.gz" --enable-static=no 68 | download_and_build "https://www.x.org/archive//individual/lib/libXrender-$XRENDER.tar.gz" --enable-static=no 69 | download_and_build "https://www.x.org/archive//individual/lib/libXcomposite-$XCOMPOSITE.tar.gz" --enable-static=no 70 | download_and_build "https://www.x.org/archive//individual/lib/libXdamage-$XDAMAGE.tar.gz" --enable-static=no 71 | download_and_build "https://www.x.org/archive//individual/lib/libXext-$XEXT.tar.gz" --enable-static=no 72 | download_and_build "https://www.x.org/archive//individual/lib/libXrandr-$XRANDR.tar.gz" --enable-static=no 73 | download_and_build "https://www.x.org/archive//individual/lib/libXinerama-$XINERAMA.tar.gz" --enable-static=no 74 | download_and_build "https://downloads.sourceforge.net/enlightenment/imlib2-$IMLIB.tar.bz2" --enable-static=no 75 | download_and_build "https://ftp.gnome.org/pub/gnome/sources/glib/$(two_digits "$GLIB")/glib-$GLIB.tar.xz" --enable-debug=yes 76 | download_and_build "https://ftp.gnome.org/pub/gnome/sources/gdk-pixbuf/$(two_digits "$PIXBUF")/gdk-pixbuf-$PIXBUF.tar.xz" 77 | download_and_build "https://cairographics.org/snapshots/cairo-$CAIRO.tar.xz" 78 | download_and_build "https://ftp.gnome.org/pub/gnome/sources/pango/$(two_digits "$PANGO")/pango-$PANGO.tar.xz" 79 | download_and_build "https://ftp.gnome.org/pub/gnome/sources/librsvg/$(two_digits "$RSVG")/librsvg-$RSVG.tar.xz" --enable-pixbuf-loader 80 | -------------------------------------------------------------------------------- /packaging/debian/compat: -------------------------------------------------------------------------------- 1 | 9 2 | -------------------------------------------------------------------------------- /packaging/debian/control: -------------------------------------------------------------------------------- 1 | Source: tint2 2 | Section: x11 3 | Priority: optional 4 | Maintainer: Sebastian Reichel 5 | Build-Depends: cmake, 6 | debhelper (>= 9), 7 | libcairo2-dev, 8 | libglib2.0-dev, 9 | libgtk2.0-dev, 10 | libimlib2-dev, 11 | libpango1.0-dev, 12 | librsvg2-dev, 13 | libstartup-notification0-dev, 14 | libxcomposite-dev, 15 | libxdamage-dev, 16 | libxinerama-dev, 17 | libxrandr-dev 18 | Standards-Version: 3.9.7 19 | Vcs-Git: https://alioth.debian.org/anonscm/git/collab-maint/tint2.git 20 | Vcs-Browser: https://anonscm.debian.org/gitweb/?p=collab-maint/tint2.git 21 | Homepage: https://gitlab.com/o9000/tint2/ 22 | 23 | Package: tint2 24 | Architecture: any 25 | Depends: ${shlibs:Depends}, 26 | ${misc:Depends}, 27 | procps 28 | Description: lightweight taskbar 29 | Tint is a simple panel/taskbar intentionally made for openbox3, but should 30 | also work with other window managers. The taskbar includes transparency and 31 | color settings for the font, icons, border, and background. It also supports 32 | multihead setups, customized mouse actions, and a built-in clock. Tint was 33 | originally based on ttm code. Since then, support has also been added 34 | for a battery monitor and system tray. 35 | . 36 | The goal is to keep a clean and unintrusive look with lightweight code and 37 | compliance with freedesktop specification. 38 | -------------------------------------------------------------------------------- /packaging/debian/copyright: -------------------------------------------------------------------------------- 1 | Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ 2 | Source: https://gitlab.com/o9000/tint2.git 3 | 4 | Files: * 5 | Copyright: 2007-2008 Pål Staurland 6 | 2008-2009 Thierry Lorthiois 7 | 2009 Andreas Fink 8 | 2011-2015 Ovidiu M 9 | License: GPL-2 10 | This program is free software; you can redistribute it and/or 11 | modify it under the terms of the GNU General Public License version 2 12 | as published by the Free Software Foundation, or (at your option) any 13 | later version. 14 | . 15 | This program is distributed in the hope that it will be useful, 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | GNU General Public License for more details. 19 | You should have received a copy of the GNU General Public License 20 | along with this program; if not, write to the Free Software 21 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 22 | MA 02110-1301, USA. 23 | . 24 | On Debian systems, the full text of the GNU General Public License 2 25 | can be found in `/usr/share/common-licenses/GPL-2'. 26 | 27 | Files: src/battery/* 28 | Copyright: 2009 Sebastian Reichel 29 | License: GPL-2+ 30 | This program is free software; you can redistribute it and/or 31 | modify it under the terms of the GNU General Public License version 2 32 | as published by the Free Software Foundation, or (at your option) any 33 | later version. 34 | . 35 | This program is distributed in the hope that it will be useful, 36 | but WITHOUT ANY WARRANTY; without even the implied warranty of 37 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 38 | GNU General Public License for more details. 39 | You should have received a copy of the GNU General Public License 40 | along with this program; if not, write to the Free Software 41 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 42 | MA 02110-1301, USA. 43 | . 44 | On Debian systems, the full text of the GNU General Public License 2 45 | can be found in `/usr/share/common-licenses/GPL-2'. 46 | 47 | Files: debian/* 48 | Copyright: 2008-2010 Daniel Moerner 49 | 2010-2012 Sebastian Reichel 50 | License: ISC 51 | Permission to use, copy, modify, and/or distribute this software for any 52 | purpose with or without fee is hereby granted, provided that the above 53 | copyright notice and this permission notice appear in all copies. 54 | . 55 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 56 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 57 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 58 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 59 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 60 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 61 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 62 | -------------------------------------------------------------------------------- /packaging/debian/examples: -------------------------------------------------------------------------------- 1 | sample/*.tint2rc 2 | -------------------------------------------------------------------------------- /packaging/debian/postinst: -------------------------------------------------------------------------------- 1 | pkill -SIGUSR2 tint2 || true 2 | 3 | -------------------------------------------------------------------------------- /packaging/debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | 3 | %: 4 | dh $@ 5 | 6 | override_dh_auto_configure: 7 | dh_auto_configure -- -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_SYSCONFDIR=/etc 8 | 9 | override_dh_auto_install: 10 | dh_auto_install --destdir=$(CURDIR)/debian/tmp 11 | 12 | override_dh_installdocs: 13 | dh_installdocs --link-doc=tint2 14 | -------------------------------------------------------------------------------- /packaging/debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (quilt) 2 | -------------------------------------------------------------------------------- /packaging/debian/source/include-binaries: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o9000/tint2/784edaccd2ac5f6ebb0f83db7b2d805062d0f095/packaging/debian/source/include-binaries -------------------------------------------------------------------------------- /packaging/debian/tint2.install: -------------------------------------------------------------------------------- 1 | /usr/bin/tint2 2 | /usr/bin/tint2conf 3 | /etc/xdg/tint2/tint2rc 4 | /usr/share/applications/tint2.desktop 5 | /usr/share/applications/tint2conf.desktop 6 | /usr/share/man/man1/tint2.1 7 | /usr/share/doc/tint2/* 8 | /usr/share/icons/hicolor/scalable/apps/tint2.svg 9 | /usr/share/icons/hicolor/scalable/apps/tint2conf.svg 10 | /usr/share/locale/* 11 | /usr/share/tint2/* 12 | /usr/share/mime/packages/* 13 | -------------------------------------------------------------------------------- /packaging/debian/tint2.manpages: -------------------------------------------------------------------------------- 1 | debian/tint2conf.1 2 | -------------------------------------------------------------------------------- /packaging/debian/tint2conf.1: -------------------------------------------------------------------------------- 1 | .TH TINT2CONF 1 "April 25, 2011" 2 | .\" Please adjust this date whenever revising the manpage. 3 | .SH NAME 4 | tint2conf \- tint configuration manager 5 | .SH SYNOPSIS 6 | .B tint2conf 7 | .SH DESCRIPTION 8 | tint2conf is a GTK based configuration previewer for tint2. 9 | .SH OPTIONS 10 | tint2conf takes no parameters. 11 | .SH AUTHOR 12 | tint2conf was written by the tint2 team. 13 | .PP 14 | This manual page was written by Sebastian Reichel , 15 | for the Debian project (but may be used by others). 16 | -------------------------------------------------------------------------------- /packaging/debian/watch: -------------------------------------------------------------------------------- 1 | version=3 2 | 3 | opts=filenamemangle=s/.*\.tar\.gz\?ref=v?(\d\S*)/tint2-$1\.tar\.gz/g,uversionmangle=s/\-rc(\d)/\~rc$1/ \ 4 | https://gitlab.com/o9000/tint2/tags .*archive\.tar\.gz\?ref=v?(\d\S*) 5 | -------------------------------------------------------------------------------- /packaging/make_ubuntu.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Requirements: devscripts 4 | 5 | set -x 6 | 7 | rm -rf tint2* 2>/dev/null || true 8 | 9 | if [ ! -z "$1" ] 10 | then 11 | MINOR="$1" 12 | else 13 | MINOR="1" 14 | fi 15 | 16 | # Get version (and check that the repository is clean) 17 | VERSION=$(../get_version.sh --strict) 18 | if [ ! $? -eq 0 ] 19 | then 20 | echo >&2 "Error: get_version.sh failed!" 21 | exit 1 22 | fi 23 | rm -f version.h 24 | VERSION=$(false 2>/dev/null) 25 | if [ $? -eq 0 ] 26 | then 27 | VERSION=$(echo "$VERSION" | sed 's/^v//') 28 | REPO="tint2" 29 | else 30 | VERSION="$(git show -s --pretty=format:%cI.%ct.%h | tr -d ':' | tr -d '-' | tr '.' '-' | sed 's/T[0-9\+]*//g').$MINOR" 31 | REPO="tint2-git" 32 | fi 33 | 34 | set -e 35 | 36 | # Export repository contents to source directory 37 | DIR=tint2-$VERSION 38 | echo "Making release $DIR" 39 | 40 | pushd . 41 | cd .. 42 | git checkout-index --prefix=packaging/$DIR/ -a 43 | popd 44 | 45 | # Update version file in source directory 46 | rm -f $DIR/make_release.sh 47 | echo "echo \"#define VERSION_STRING \\\"$VERSION\\\"\" > version.h" > $DIR/get_version.sh 48 | 49 | # Copy the debian files into the source directory 50 | cp -r debian $DIR/debian 51 | 52 | for DISTRO in trusty xenial artful bionic 53 | do 54 | # Cleanup from previous builds 55 | rm -rf tint2_$VERSION-* 56 | 57 | # Update debian package changelog if necessary 58 | echo -e "tint2 ($VERSION-$DISTRO-1) $DISTRO; urgency=medium\n\n$(git log --pretty=format:' * %h %an (%ci) %s %d')\n -- o9000 $(date -R)\n" > $DIR/debian/changelog 59 | 60 | # Create source tarball 61 | ARCHIVE=tint2_$VERSION-$DISTRO.orig.tar.gz 62 | rm -rf $ARCHIVE 63 | tar -czf $ARCHIVE $DIR 64 | 65 | # Build package 66 | KEY=$(gpg --list-secret-keys | awk '/^sec/ { print $2 }' | cut -d / -f 2) 67 | 68 | pushd . 69 | cd $DIR 70 | debuild -S -k$KEY 71 | popd 72 | 73 | # Upload package 74 | dput ppa:o9000/$REPO tint2_$VERSION-$DISTRO-1_source.changes 75 | done 76 | 77 | # Cleanup 78 | rm -rf $DIR $ARCHIVE 79 | rm -rf tint2_$VERSION-* 80 | -------------------------------------------------------------------------------- /packaging/update_version_status.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin 4 | 5 | set -e 6 | set -x 7 | 8 | [ "${FLOCKER}" != "$0" ] && exec env FLOCKER="$0" flock -en "$0" "$0" "$@" || : 9 | 10 | exec > ~/tint2.runner-version.log 11 | exec 2>&1 12 | 13 | cd ~/tint2.wiki 14 | git reset --hard 15 | git pull 16 | 17 | 18 | timeout -k 10 600 ~/tint2/packaging/version_status.py > packaging.tmp.md 19 | cat packaging.tmp.md > packaging.md 20 | rm packaging.tmp.md 21 | 22 | git commit -am 'Update packaging info' 23 | git push origin master 24 | -------------------------------------------------------------------------------- /src/battery/battery.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * Copyright (C) 2009-2015 Sebastian Reichel 3 | * 4 | * Battery with functional data (percentage, time to life) and drawing data 5 | * (area, font, ...). Each panel use his own drawing data. 6 | * 7 | **************************************************************************/ 8 | 9 | #ifndef BATTERY_H 10 | #define BATTERY_H 11 | 12 | #include 13 | #include 14 | #include 15 | 16 | #include "common.h" 17 | #include "area.h" 18 | 19 | typedef struct Battery { 20 | Area area; 21 | Color font_color; 22 | int bat1_posy; 23 | int bat2_posy; 24 | } Battery; 25 | 26 | typedef enum ChargeState { 27 | BATTERY_UNKNOWN = 0, 28 | BATTERY_CHARGING, 29 | BATTERY_DISCHARGING, 30 | BATTERY_FULL, 31 | } ChargeState; 32 | 33 | typedef struct BatteryTime { 34 | int16_t hours; 35 | int8_t minutes; 36 | int8_t seconds; 37 | } BatteryTime; 38 | 39 | typedef struct BatteryState { 40 | int percentage; 41 | BatteryTime time; 42 | ChargeState state; 43 | gboolean ac_connected; 44 | } BatteryState; 45 | 46 | extern struct BatteryState battery_state; 47 | extern gboolean bat1_has_font; 48 | extern PangoFontDescription *bat1_font_desc; 49 | extern gboolean bat2_has_font; 50 | extern PangoFontDescription *bat2_font_desc; 51 | extern char *bat1_format; 52 | extern char *bat2_format; 53 | extern gboolean battery_enabled; 54 | extern gboolean battery_tooltip_enabled; 55 | extern int percentage_hide; 56 | 57 | extern int8_t battery_low_status; 58 | extern char *battery_low_cmd; 59 | extern char *battery_full_cmd; 60 | 61 | extern char *ac_connected_cmd; 62 | extern char *ac_disconnected_cmd; 63 | 64 | extern char *battery_lclick_command; 65 | extern char *battery_mclick_command; 66 | extern char *battery_rclick_command; 67 | extern char *battery_uwheel_command; 68 | extern char *battery_dwheel_command; 69 | 70 | extern char *battery_sys_prefix; 71 | 72 | static inline gchar *chargestate2str(ChargeState state) 73 | { 74 | switch (state) { 75 | case BATTERY_CHARGING: 76 | return "Charging"; 77 | case BATTERY_DISCHARGING: 78 | return "Discharging"; 79 | case BATTERY_FULL: 80 | return "Full"; 81 | case BATTERY_UNKNOWN: 82 | default: 83 | return "Unknown"; 84 | }; 85 | } 86 | 87 | static inline void battery_state_set_time(BatteryState *state, int seconds) 88 | { 89 | state->time.hours = seconds / 3600; 90 | seconds -= 3600 * state->time.hours; 91 | state->time.minutes = seconds / 60; 92 | seconds -= 60 * state->time.minutes; 93 | state->time.seconds = seconds; 94 | } 95 | 96 | // default global data 97 | void default_battery(); 98 | 99 | // freed memory 100 | void cleanup_battery(); 101 | 102 | void update_battery_tick(void *arg); 103 | int update_battery(); 104 | 105 | void init_battery(); 106 | void init_battery_panel(void *panel); 107 | 108 | void reinit_battery(); 109 | void draw_battery(void *obj, cairo_t *c); 110 | void battery_default_font_changed(); 111 | 112 | gboolean resize_battery(void *obj); 113 | 114 | void battery_action(void *obj, int button, int x, int y, Time time); 115 | 116 | /* operating system specific functions */ 117 | gboolean battery_os_init(); 118 | void battery_os_free(); 119 | int battery_os_update(BatteryState *state); 120 | char *battery_os_tooltip(); 121 | 122 | #endif 123 | -------------------------------------------------------------------------------- /src/battery/dummy.c: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Tint2 : Dummy battery (non-functional) 4 | * 5 | * Copyright (C) 2015 Sebastian Reichel 6 | * 7 | * This program is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU General Public License version 2 9 | * or any later version as published by the Free Software Foundation. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | **************************************************************************/ 19 | 20 | #include 21 | #include "common.h" 22 | #include "battery.h" 23 | 24 | #warning tint2 has no battery support for this operating system! 25 | 26 | gboolean battery_os_init() 27 | { 28 | return FALSE; 29 | } 30 | 31 | void battery_os_free() 32 | { 33 | return; 34 | } 35 | 36 | int battery_os_update(BatteryState *state) 37 | { 38 | return -1; 39 | } 40 | 41 | char *battery_os_tooltip() 42 | { 43 | return strdup("Operating System not supported"); 44 | } 45 | -------------------------------------------------------------------------------- /src/battery/freebsd.c: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Tint2 : FreeBSD battery 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU General Public License version 2 7 | * or any later version as published by the Free Software Foundation. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, write to the Free Software 15 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 16 | **************************************************************************/ 17 | 18 | #if defined(__FreeBSD__) || defined(__DragonFly__) 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | #include "common.h" 25 | #include "battery.h" 26 | 27 | gboolean battery_os_init() 28 | { 29 | int sysctl_out = 0; 30 | size_t len = sizeof(sysctl_out); 31 | 32 | return (sysctlbyname("hw.acpi.battery.state", &sysctl_out, &len, NULL, 0) == 0) || 33 | (sysctlbyname("hw.acpi.battery.time", &sysctl_out, &len, NULL, 0) == 0) || 34 | (sysctlbyname("hw.acpi.battery.life", &sysctl_out, &len, NULL, 0) == 0); 35 | } 36 | 37 | void battery_os_free() 38 | { 39 | return; 40 | } 41 | 42 | int battery_os_update(BatteryState *state) 43 | { 44 | int sysctl_out = 0; 45 | size_t len = sizeof(sysctl_out); 46 | gboolean err = 0; 47 | 48 | if (sysctlbyname("hw.acpi.battery.state", &sysctl_out, &len, NULL, 0) == 0) { 49 | switch (sysctl_out) { 50 | case 1: 51 | state->state = BATTERY_DISCHARGING; 52 | break; 53 | case 2: 54 | state->state = BATTERY_CHARGING; 55 | break; 56 | default: 57 | state->state = BATTERY_FULL; 58 | break; 59 | } 60 | } else { 61 | fprintf(stderr, "tint2: power update: no such sysctl"); 62 | err = -1; 63 | } 64 | 65 | if (sysctlbyname("hw.acpi.battery.time", &sysctl_out, &len, NULL, 0) == 0) 66 | battery_state_set_time(state, sysctl_out * 60); 67 | else 68 | err = -1; 69 | 70 | if (sysctlbyname("hw.acpi.battery.life", &sysctl_out, &len, NULL, 0) == 0) 71 | state->percentage = sysctl_out; 72 | else 73 | err = -1; 74 | 75 | if (sysctlbyname("hw.acpi.acline", &sysctl_out, &len, NULL, 0) == 0) 76 | state->ac_connected = sysctl_out; 77 | 78 | return err; 79 | } 80 | 81 | char *battery_os_tooltip() 82 | { 83 | GString *tooltip = g_string_new(""); 84 | gchar *result; 85 | 86 | g_string_append_printf(tooltip, "Battery\n"); 87 | 88 | gchar *state = (battery_state.state == BATTERY_UNKNOWN) ? "Level" : chargestate2str(battery_state.state); 89 | 90 | g_string_append_printf(tooltip, "\t%s: %d%%", state, battery_state.percentage); 91 | 92 | g_string_append_c(tooltip, '\n'); 93 | g_string_append_printf(tooltip, "AC\n"); 94 | g_string_append_printf(tooltip, battery_state.ac_connected ? "\tConnected" : "\tDisconnected"); 95 | 96 | result = tooltip->str; 97 | g_string_free(tooltip, FALSE); 98 | 99 | return result; 100 | } 101 | 102 | #endif 103 | -------------------------------------------------------------------------------- /src/battery/openbsd.c: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Tint2 : OpenBSD & NetBSD battery 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU General Public License version 2 7 | * or any later version as published by the Free Software Foundation. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, write to the Free Software 15 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 16 | **************************************************************************/ 17 | 18 | #if defined(__OpenBSD__) || defined(__NetBSD__) 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | #include "common.h" 28 | #include "battery.h" 29 | 30 | int apm_fd = -1; 31 | 32 | gboolean battery_os_init() 33 | { 34 | if (apm_fd > 0) 35 | close(apm_fd); 36 | 37 | apm_fd = open("/dev/apm", O_RDONLY); 38 | 39 | if (apm_fd < 0) { 40 | warn("ERROR: battery applet cannot open /dev/apm."); 41 | return FALSE; 42 | } else { 43 | return TRUE; 44 | } 45 | } 46 | 47 | void battery_os_free() 48 | { 49 | if ((apm_fd != -1) && (close(apm_fd) == -1)) 50 | warn("cannot close /dev/apm"); 51 | apm_fd = -1; 52 | } 53 | 54 | int battery_os_update(BatteryState *state) 55 | { 56 | struct apm_power_info info; 57 | 58 | if (apm_fd > 0 && ioctl(apm_fd, APM_IOC_GETPOWER, &(info)) == 0) { 59 | // best attempt at mapping to Linux battery states 60 | switch (info.battery_state) { 61 | case APM_BATT_CHARGING: 62 | state->state = BATTERY_CHARGING; 63 | break; 64 | default: 65 | state->state = BATTERY_DISCHARGING; 66 | break; 67 | } 68 | 69 | if (info.battery_life > 100) 70 | info.battery_life = 100; 71 | if (info.battery_life == 100) 72 | state->state = BATTERY_FULL; 73 | 74 | state->percentage = info.battery_life; 75 | if (info.minutes_left != -1) 76 | battery_state_set_time(state, info.minutes_left * 60); 77 | 78 | state->ac_connected = info.ac_state == APM_AC_ON; 79 | } else { 80 | warn("power update: APM_IOC_GETPOWER"); 81 | return -1; 82 | } 83 | 84 | return 0; 85 | } 86 | 87 | char *battery_os_tooltip() 88 | { 89 | GString *tooltip = g_string_new(""); 90 | gchar *result; 91 | 92 | g_string_append_printf(tooltip, "Battery\n"); 93 | 94 | gchar *state = (battery_state.state == BATTERY_UNKNOWN) ? "Level" : chargestate2str(battery_state.state); 95 | 96 | g_string_append_printf(tooltip, "\t%s: %d%%", state, battery_state.percentage); 97 | 98 | g_string_append_c(tooltip, '\n'); 99 | g_string_append_printf(tooltip, "AC\n"); 100 | g_string_append_printf(tooltip, battery_state.ac_connected ? "\tConnected" : "\tDisconnected"); 101 | 102 | result = tooltip->str; 103 | g_string_free(tooltip, FALSE); 104 | 105 | return result; 106 | } 107 | 108 | #endif 109 | -------------------------------------------------------------------------------- /src/button/button.h: -------------------------------------------------------------------------------- 1 | #ifndef BUTTON_H 2 | #define BUTTON_H 3 | 4 | #include 5 | #include 6 | 7 | #include "area.h" 8 | #include "common.h" 9 | #include "timer.h" 10 | 11 | // Architecture: 12 | // Panel panel_config contains an array of Button, each storing all config options and all the state variables. 13 | // Only these run commands. 14 | // 15 | // Tint2 maintains an array of Panels, one for each monitor. Each stores an array of Button which was initially copied 16 | // from panel_config. Each works as a frontend to the corresponding Button in panel_config as backend, using the 17 | // backend's config and state variables. 18 | 19 | typedef struct ButtonBackend { 20 | // Config: 21 | char *icon_name; 22 | char *text; 23 | char *tooltip; 24 | gboolean centered; 25 | int max_icon_size; 26 | gboolean has_font; 27 | PangoFontDescription *font_desc; 28 | Color font_color; 29 | char *lclick_command; 30 | char *mclick_command; 31 | char *rclick_command; 32 | char *uwheel_command; 33 | char *dwheel_command; 34 | // paddingxlr = horizontal padding left/right 35 | // paddingx = horizontal padding between childs 36 | int paddingxlr, paddingx, paddingy; 37 | Background *bg; 38 | 39 | // List of Button which are frontends for this backend, one for each panel 40 | GList *instances; 41 | } ButtonBackend; 42 | 43 | typedef struct ButtonFrontend { 44 | // Frontend state: 45 | Imlib_Image icon; 46 | Imlib_Image icon_hover; 47 | Imlib_Image icon_pressed; 48 | int icon_load_size; 49 | int iconx; 50 | int icony; 51 | int iconw; 52 | int iconh; 53 | int textx; 54 | int texty; 55 | int textw; 56 | int texth; 57 | } ButtonFrontend; 58 | 59 | typedef struct Button { 60 | Area area; 61 | // All elements have the backend pointer set. However only backend elements have ownership. 62 | ButtonBackend *backend; 63 | // Set only for frontend Button items. 64 | ButtonFrontend *frontend; 65 | } Button; 66 | 67 | // Called before the config is read and panel_config/panels are created. 68 | // Afterwards, the config parsing code creates the array of Button in panel_config and populates the configuration 69 | // fields 70 | // in the backend. 71 | // Probably does nothing. 72 | void default_button(); 73 | 74 | // Creates a new Button item with only the backend field set. The state is NOT initialized. The config is initialized to 75 | // the default values. 76 | // This will be used by the config code to populate its backedn config fields. 77 | Button *create_button(); 78 | 79 | void destroy_button(void *obj); 80 | 81 | // Called after the config is read and panel_config is populated, but before panels are created. 82 | // Initializes the state of the backend items. 83 | // panel_config.panel_items is used to determine which backend items are enabled. The others should be destroyed and 84 | // removed from panel_config.button_list. 85 | void init_button(); 86 | 87 | // Called after each on-screen panel is created, with a pointer to the panel. 88 | // Initializes the state of the frontend items. Also adds a pointer to it in backend->instances. 89 | // At this point the Area has not been added yet to the GUI tree, but it will be added right away. 90 | void init_button_panel(void *panel); 91 | 92 | // Called just before the panels are destroyed. Afterwards, tint2 exits or restarts and reads the config again. 93 | // Releases all frontends and then all the backends. 94 | // The frontend items are not freed by this function, only their members. The items are Areas which are freed in the 95 | // GUI element tree cleanup function (remove_area). 96 | void cleanup_button(); 97 | 98 | // Called on draw, obj = pointer to the front-end Button item. 99 | void draw_button(void *obj, cairo_t *c); 100 | 101 | // Called on resize, obj = pointer to the front-end Button item. 102 | // Returns 1 if the new size is different than the previous size. 103 | gboolean resize_button(void *obj); 104 | 105 | // Called on mouse click event. 106 | void button_action(void *obj, int button, int x, int y, Time time); 107 | 108 | void button_default_font_changed(); 109 | void button_default_icon_theme_changed(); 110 | 111 | void button_reload_icon(Button *button); 112 | 113 | #endif // BUTTON_H 114 | -------------------------------------------------------------------------------- /src/clock/clock.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * Copyright (C) 2008 thierry lorthiois (lorthiois@bbsoft.fr) 3 | * 4 | * Clock with fonctionnal data (timeval, precision) and drawing data (area, font, ...). 5 | * Each panel use his own drawing data. 6 | * 7 | **************************************************************************/ 8 | 9 | #ifndef CLOCK_H 10 | #define CLOCK_H 11 | 12 | #include 13 | #include "common.h" 14 | #include "area.h" 15 | 16 | typedef struct Clock { 17 | // always start with area 18 | Area area; 19 | 20 | Color font; 21 | int time1_posy; 22 | int time2_posy; 23 | } Clock; 24 | 25 | extern char *time1_format; 26 | extern char *time1_timezone; 27 | extern char *time2_format; 28 | extern char *time2_timezone; 29 | extern char *time_tooltip_format; 30 | extern char *time_tooltip_timezone; 31 | extern gboolean time1_has_font; 32 | extern PangoFontDescription *time1_font_desc; 33 | extern gboolean time2_has_font; 34 | extern PangoFontDescription *time2_font_desc; 35 | extern char *clock_lclick_command; 36 | extern char *clock_mclick_command; 37 | extern char *clock_rclick_command; 38 | extern char *clock_uwheel_command; 39 | extern char *clock_dwheel_command; 40 | extern gboolean clock_enabled; 41 | 42 | // default global data 43 | void default_clock(); 44 | 45 | // freed memory 46 | void cleanup_clock(); 47 | 48 | // initialize clock : y position, precision, ... 49 | void init_clock(); 50 | void init_clock_panel(void *panel); 51 | void clock_default_font_changed(); 52 | 53 | void draw_clock(void *obj, cairo_t *c); 54 | 55 | gboolean resize_clock(void *obj); 56 | 57 | void clock_action(void *obj, int button, int x, int y, Time time); 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /src/config.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * config : 3 | * - parse config file in Panel struct. 4 | * 5 | * Check COPYING file for Copyright 6 | * 7 | **************************************************************************/ 8 | 9 | #ifndef CONFIG_H 10 | #define CONFIG_H 11 | 12 | #include 13 | 14 | extern char *config_path; 15 | extern char *snapshot_path; 16 | 17 | // default global data 18 | void default_config(); 19 | 20 | // freed memory 21 | void cleanup_config(); 22 | 23 | gboolean config_read(); 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /src/default_icon.h: -------------------------------------------------------------------------------- 1 | #ifndef default_icon_h 2 | #define default_icon_h 3 | 4 | #include 5 | 6 | extern int default_icon_width; 7 | extern int default_icon_height; 8 | extern DATA32 default_icon_data[]; 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /src/drag_and_drop.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * Copyright (C) 2017 tint2 authors 3 | * 4 | **************************************************************************/ 5 | 6 | #ifndef DRAG_AND_DROP_H 7 | #define DRAG_AND_DROP_H 8 | 9 | #include 10 | #include 11 | 12 | extern gboolean hidden_panel_shown_for_dnd; 13 | extern gboolean debug_dnd; 14 | 15 | void dnd_init(); 16 | 17 | void handle_dnd_enter(XClientMessageEvent *e); 18 | void handle_dnd_position(XClientMessageEvent *e); 19 | void handle_dnd_drop(XClientMessageEvent *e); 20 | void handle_dnd_selection_notify(XSelectionEvent *e); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /src/freespace/freespace.c: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Tint2 : freespace 4 | * 5 | * Copyright (C) 2011 Mishael A Sibiryakov (death@junki.org) 6 | * 7 | * This program is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU General Public License version 2 9 | * as published by the Free Software Foundation. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | **************************************************************************/ 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | #include "window.h" 28 | #include "server.h" 29 | #include "panel.h" 30 | #include "freespace.h" 31 | #include "common.h" 32 | 33 | int freespace_area_compute_desired_size(void *obj); 34 | 35 | void init_freespace_panel(void *p) 36 | { 37 | Panel *panel = (Panel *)p; 38 | 39 | // Make sure this is only done once if there are multiple items 40 | if (panel->freespace_list) 41 | return; 42 | 43 | for (size_t k = 0; k < strlen(panel_items_order); k++) { 44 | if (panel_items_order[k] == 'F') { 45 | FreeSpace *freespace = (FreeSpace *)calloc(1, sizeof(FreeSpace)); 46 | panel->freespace_list = g_list_append(panel->freespace_list, freespace); 47 | if (!freespace->area.bg) 48 | freespace->area.bg = &g_array_index(backgrounds, Background, 0); 49 | freespace->area.parent = p; 50 | freespace->area.panel = p; 51 | snprintf(freespace->area.name, sizeof(freespace->area.name), "Freespace"); 52 | freespace->area.size_mode = LAYOUT_FIXED; 53 | freespace->area.resize_needed = 1; 54 | freespace->area.on_screen = TRUE; 55 | freespace->area._resize = resize_freespace; 56 | freespace->area._compute_desired_size = freespace_area_compute_desired_size; 57 | } 58 | } 59 | } 60 | 61 | void cleanup_freespace(Panel *panel) 62 | { 63 | if (panel->freespace_list) 64 | g_list_free_full(panel->freespace_list, free); 65 | panel->freespace_list = NULL; 66 | } 67 | 68 | int freespace_get_max_size(Panel *panel) 69 | { 70 | if (panel_shrink) 71 | return 0; 72 | // Get space used by every element except the freespace 73 | int size = 0; 74 | int spacers = 0; 75 | for (GList *walk = panel->area.children; walk; walk = g_list_next(walk)) { 76 | Area *a = (Area *)walk->data; 77 | 78 | if (!a->on_screen) 79 | continue; 80 | if (a->_resize == resize_freespace) { 81 | spacers++; 82 | continue; 83 | } 84 | 85 | if (panel_horizontal) 86 | size += a->width + panel->area.paddingx * panel->scale; 87 | else 88 | size += a->height + panel->area.paddingy * panel->scale; 89 | } 90 | 91 | if (panel_horizontal) 92 | size = panel->area.width - size - left_right_border_width(&panel->area) - panel->area.paddingxlr * panel->scale; 93 | else 94 | size = panel->area.height - size - top_bottom_border_width(&panel->area) - panel->area.paddingxlr * panel->scale; 95 | 96 | return size / spacers; 97 | } 98 | 99 | int freespace_area_compute_desired_size(void *obj) 100 | { 101 | FreeSpace *freespace = (FreeSpace *)obj; 102 | return freespace_get_max_size((Panel *)freespace->area.panel); 103 | } 104 | 105 | gboolean resize_freespace(void *obj) 106 | { 107 | FreeSpace *freespace = (FreeSpace *)obj; 108 | Panel *panel = (Panel *)freespace->area.panel; 109 | if (!freespace->area.on_screen) 110 | return FALSE; 111 | 112 | int old_size = panel_horizontal ? freespace->area.width : freespace->area.height; 113 | int size = freespace_get_max_size(panel); 114 | if (old_size == size) 115 | return FALSE; 116 | 117 | if (panel_horizontal) { 118 | freespace->area.width = size; 119 | } else { 120 | freespace->area.height = size; 121 | } 122 | 123 | schedule_redraw(&freespace->area); 124 | schedule_panel_redraw(); 125 | return TRUE; 126 | } 127 | -------------------------------------------------------------------------------- /src/freespace/freespace.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * Copyright (C) 2011 Mishael A Sibiryakov (death@junki.org) 3 | **************************************************************************/ 4 | 5 | #ifndef FREESPACE_H 6 | #define FREESPACE_H 7 | 8 | #include "common.h" 9 | #include "area.h" 10 | 11 | typedef struct FreeSpace { 12 | Area area; 13 | } FreeSpace; 14 | 15 | struct Panel; 16 | 17 | void cleanup_freespace(struct Panel *panel); 18 | void init_freespace_panel(void *panel); 19 | 20 | gboolean resize_freespace(void *obj); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /src/init.h: -------------------------------------------------------------------------------- 1 | #ifndef INIT_H 2 | #define INIT_H 3 | 4 | void init(int argc, char **argv); 5 | void cleanup(); 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /src/launcher/apps-common.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * Copyright (C) 2015 (mrovi9000@gmail.com) 3 | * 4 | * 5 | **************************************************************************/ 6 | 7 | #ifndef APPS_COMMON_H 8 | #define APPS_COMMON_H 9 | 10 | #include 11 | 12 | typedef struct DesktopEntry { 13 | char *name; 14 | char *generic_name; 15 | char *exec; 16 | char *icon; 17 | char *path; 18 | char *cwd; 19 | gboolean hidden_from_menus; 20 | gboolean start_in_terminal; 21 | gboolean startup_notification; 22 | } DesktopEntry; 23 | 24 | // Parses a line of the form "key = value". Modifies the line. 25 | // Returns 1 if successful, and parts are not empty. 26 | // Key and value point to the parts. 27 | int parse_dektop_line(char *line, char **key, char **value); 28 | 29 | // Reads the .desktop file from the given path into the DesktopEntry entry. 30 | // The DesktopEntry object must be initially empty. 31 | // Returns 1 if successful. 32 | gboolean read_desktop_file(const char *path, DesktopEntry *entry); 33 | 34 | // Empties DesktopEntry: releases the memory of the *members* of entry. 35 | void free_desktop_entry(DesktopEntry *entry); 36 | 37 | // Returns a list of the directories used to store desktop files. 38 | // Do not free the result, it is cached. 39 | const GSList *get_apps_locations(); 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /src/launcher/icon-theme-common.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * Copyright (C) 2015 (mrovi9000@gmail.com) 3 | * 4 | **************************************************************************/ 5 | 6 | #ifndef ICON_THEME_COMMON_H 7 | #define ICON_THEME_COMMON_H 8 | 9 | #include 10 | #include "cache.h" 11 | 12 | typedef struct IconThemeWrapper { 13 | // The icon theme name for which this wrapper was created 14 | char *icon_theme_name; 15 | // List of IconTheme* 16 | GSList *themes; 17 | // Themes are loaded lazily when needed. 18 | gboolean _themes_loaded; 19 | // List of IconTheme* 20 | GSList *themes_fallback; 21 | // Fallback themes are loaded lazily when needed. 22 | gboolean _fallback_loaded; 23 | Cache _cache; 24 | // List of icon theme names that have been queued for loading. 25 | // Used to avoid loading the same theme twice, and to avoid cycles. 26 | GSList *_queued; 27 | } IconThemeWrapper; 28 | 29 | typedef struct IconTheme { 30 | char *name; 31 | char *description; 32 | GSList *list_inherits; // each item is a char* (theme name) 33 | GSList *list_directories; // each item is an IconThemeDir* 34 | } IconTheme; 35 | 36 | // Parses a line of the form "key = value". Modifies the line. 37 | // Returns 1 if successful, and parts are not empty. 38 | // Key and value point to the parts. 39 | int parse_theme_line(char *line, char **key, char **value); 40 | 41 | // Returns an IconThemeWrapper* containing the icon theme identified by the name icon_theme_name, all the 42 | // inherited themes, the hicolor theme and possibly fallback themes. 43 | IconThemeWrapper *load_themes(const char *icon_theme_name); 44 | 45 | void save_icon_cache(IconThemeWrapper *wrapper); 46 | 47 | void free_themes(IconThemeWrapper *wrapper); 48 | void free_icon_theme(IconTheme *theme); 49 | 50 | #define DEFAULT_ICON "application-x-executable" 51 | 52 | // Returns the full path to an icon file (or NULL) given the list of icon themes to search and the icon name 53 | // Note: needs to be released with free(). 54 | char *get_icon_path(IconThemeWrapper *wrapper, const char *icon_name, int size, gboolean use_fallbacks); 55 | 56 | // Returns a list of the directories used to store icons. 57 | // Do not free the result, it is cached. 58 | const GSList *get_icon_locations(); 59 | 60 | extern gboolean debug_icons; 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /src/launcher/launcher.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * Copyright (C) 2010 (mrovi@interfete-web-club.com) 3 | * 4 | * 5 | **************************************************************************/ 6 | 7 | #ifndef LAUNCHER_H 8 | #define LAUNCHER_H 9 | 10 | #include "common.h" 11 | #include "area.h" 12 | #include "xsettings-client.h" 13 | #include "icon-theme-common.h" 14 | 15 | extern IconThemeWrapper *icon_theme_wrapper; 16 | void load_icon_themes(); 17 | void free_icon_themes(); 18 | 19 | typedef struct Launcher { 20 | // always start with area 21 | Area area; 22 | GSList *list_apps; // List of char*, each is a path to a app.desktop file 23 | GSList *list_icons; // List of LauncherIcon* 24 | int icon_size; 25 | } Launcher; 26 | 27 | typedef struct LauncherIcon { 28 | // always start with area 29 | Area area; 30 | char *config_path; 31 | Imlib_Image image; 32 | Imlib_Image image_hover; 33 | Imlib_Image image_pressed; 34 | char *cmd; 35 | char *cwd; 36 | gboolean start_in_terminal; 37 | gboolean startup_notification; 38 | char *icon_name; 39 | char *icon_path; 40 | char *icon_tooltip; 41 | int icon_size; 42 | int x, y; 43 | } LauncherIcon; 44 | 45 | extern gboolean launcher_enabled; 46 | extern int launcher_max_icon_size; 47 | extern int launcher_tooltip_enabled; 48 | extern int launcher_alpha; 49 | extern int launcher_saturation; 50 | extern int launcher_brightness; 51 | extern char *icon_theme_name_xsettings; // theme name 52 | extern char *icon_theme_name_config; 53 | extern int launcher_icon_theme_override; 54 | extern Background *launcher_icon_bg; 55 | extern GList *launcher_icon_gradients; 56 | 57 | // default global data 58 | void default_launcher(); 59 | 60 | // initialize launcher : y position, precision, ... 61 | void init_launcher(); 62 | void init_launcher_panel(void *panel); 63 | void cleanup_launcher(); 64 | void cleanup_launcher_theme(Launcher *launcher); 65 | 66 | gboolean resize_launcher(void *obj); 67 | void draw_launcher(void *obj, cairo_t *c); 68 | void launcher_default_icon_theme_changed(); 69 | 70 | // Populates the list_icons list 71 | void launcher_load_icons(Launcher *launcher); 72 | void launcher_action(LauncherIcon *icon, XEvent *e, int x, int y); 73 | 74 | void test_launcher_read_desktop_file(); 75 | void test_launcher_read_theme_file(); 76 | 77 | #endif 78 | -------------------------------------------------------------------------------- /src/launcher/xsettings-client.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2001 Red Hat, Inc. 3 | * 4 | * Permission to use, copy, modify, distribute, and sell this software and its 5 | * documentation for any purpose is hereby granted without fee, provided that 6 | * the above copyright notice appear in all copies and that both that 7 | * copyright notice and this permission notice appear in supporting 8 | * documentation, and that the name of Red Hat not be used in advertising or 9 | * publicity pertaining to distribution of the software without specific, 10 | * written prior permission. Red Hat makes no representations about the 11 | * suitability of this software for any purpose. It is provided "as is" 12 | * without express or implied warranty. 13 | * 14 | * RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL 15 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL RED HAT 16 | * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 17 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION 18 | * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 19 | * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 20 | * 21 | * Author: Owen Taylor, Red Hat, Inc. 22 | */ 23 | #ifndef XSETTINGS_CLIENT_H 24 | #define XSETTINGS_CLIENT_H 25 | 26 | #include 27 | #include "xsettings-common.h" 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif /* __cplusplus */ 32 | 33 | typedef struct _XSettingsClient XSettingsClient; 34 | 35 | typedef enum { XSETTINGS_ACTION_NEW, XSETTINGS_ACTION_CHANGED, XSETTINGS_ACTION_DELETED } XSettingsAction; 36 | 37 | typedef void (*XSettingsNotifyFunc)(const char *name, XSettingsAction action, XSettingsSetting *setting, void *cb_data); 38 | typedef void (*XSettingsWatchFunc)(Window window, Bool is_start, long mask, void *cb_data); 39 | 40 | XSettingsClient *xsettings_client_new(Display *display, 41 | int screen, 42 | XSettingsNotifyFunc notify, 43 | XSettingsWatchFunc watch, 44 | void *cb_data); 45 | void xsettings_client_destroy(XSettingsClient *client); 46 | Bool xsettings_client_process_event(XSettingsClient *client, XEvent *xev); 47 | 48 | void xsettings_notify_cb(const char *name, XSettingsAction action, XSettingsSetting *setting, void *data); 49 | 50 | XSettingsResult xsettings_client_get_setting(XSettingsClient *client, const char *name, XSettingsSetting **setting); 51 | 52 | #ifdef __cplusplus 53 | } 54 | #endif /* __cplusplus */ 55 | 56 | #endif /* XSETTINGS_CLIENT_H */ 57 | -------------------------------------------------------------------------------- /src/launcher/xsettings-common.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2001 Red Hat, Inc. 3 | * 4 | * Permission to use, copy, modify, distribute, and sell this software and its 5 | * documentation for any purpose is hereby granted without fee, provided that 6 | * the above copyright notice appear in all copies and that both that 7 | * copyright notice and this permission notice appear in supporting 8 | * documentation, and that the name of Red Hat not be used in advertising or 9 | * publicity pertaining to distribution of the software without specific, 10 | * written prior permission. Red Hat makes no representations about the 11 | * suitability of this software for any purpose. It is provided "as is" 12 | * without express or implied warranty. 13 | * 14 | * RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL 15 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL RED HAT 16 | * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 17 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION 18 | * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 19 | * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 20 | * 21 | * Author: Owen Taylor, Red Hat, Inc. 22 | */ 23 | #ifndef XSETTINGS_COMMON_H 24 | #define XSETTINGS_COMMON_H 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif /* __cplusplus */ 29 | 30 | typedef struct _XSettingsBuffer XSettingsBuffer; 31 | typedef struct _XSettingsColor XSettingsColor; 32 | typedef struct _XSettingsList XSettingsList; 33 | typedef struct _XSettingsSetting XSettingsSetting; 34 | 35 | /* Types of settings possible. Enum values correspond to 36 | * protocol values. 37 | */ 38 | typedef enum { 39 | XSETTINGS_TYPE_INT = 0, 40 | XSETTINGS_TYPE_STRING = 1, 41 | XSETTINGS_TYPE_COLOR = 2, 42 | XSETTINGS_TYPE_NONE = 0xff 43 | } XSettingsType; 44 | 45 | typedef enum { 46 | XSETTINGS_SUCCESS, 47 | XSETTINGS_NO_MEM, 48 | XSETTINGS_ACCESS, 49 | XSETTINGS_FAILED, 50 | XSETTINGS_NO_ENTRY, 51 | XSETTINGS_DUPLICATE_ENTRY 52 | } XSettingsResult; 53 | 54 | struct _XSettingsBuffer { 55 | char byte_order; 56 | size_t len; 57 | unsigned char *data; 58 | unsigned char *pos; 59 | }; 60 | 61 | struct _XSettingsColor { 62 | unsigned short red, green, blue, alpha; 63 | }; 64 | 65 | struct _XSettingsList { 66 | XSettingsSetting *setting; 67 | XSettingsList *next; 68 | }; 69 | 70 | struct _XSettingsSetting { 71 | char *name; 72 | XSettingsType type; 73 | 74 | union { 75 | int v_int; 76 | char *v_string; 77 | XSettingsColor v_color; 78 | } data; 79 | 80 | unsigned long last_change_serial; 81 | }; 82 | 83 | XSettingsSetting *xsettings_setting_copy(XSettingsSetting *setting); 84 | void xsettings_setting_free(XSettingsSetting *setting); 85 | int xsettings_setting_equal(XSettingsSetting *setting_a, XSettingsSetting *setting_b); 86 | 87 | void xsettings_list_free(XSettingsList *list); 88 | XSettingsList *xsettings_list_copy(XSettingsList *list); 89 | XSettingsResult xsettings_list_insert(XSettingsList **list, XSettingsSetting *setting); 90 | XSettingsSetting *xsettings_list_lookup(XSettingsList *list, const char *name); 91 | XSettingsResult xsettings_list_delete(XSettingsList **list, const char *name); 92 | 93 | char xsettings_byte_order(void); 94 | 95 | #define XSETTINGS_PAD(n, m) ((n + m - 1) & (~(m - 1))) 96 | 97 | #ifdef __cplusplus 98 | } 99 | #endif /* __cplusplus */ 100 | 101 | #endif /* XSETTINGS_COMMON_H */ 102 | -------------------------------------------------------------------------------- /src/mouse_actions.h: -------------------------------------------------------------------------------- 1 | #ifndef MOUSE_ACTIONS_H 2 | #define MOUSE_ACTIONS_H 3 | 4 | #include "panel.h" 5 | 6 | gboolean tint2_handles_click(Panel *panel, XButtonEvent *e); 7 | 8 | void handle_mouse_press_event(XEvent *e); 9 | void handle_mouse_move_event(XEvent *e); 10 | void handle_mouse_release_event(XEvent *e); 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /src/separator/separator.h: -------------------------------------------------------------------------------- 1 | // Tint2 : Separator 2 | // Author: Oskari Rauta 3 | 4 | #ifndef SEPARATOR_H 5 | #define SEPARATOR_H 6 | 7 | #include "common.h" 8 | #include "area.h" 9 | 10 | typedef enum SeparatorStyle { SEPARATOR_EMPTY = 0, SEPARATOR_LINE, SEPARATOR_DOTS } SeparatorStyle; 11 | 12 | typedef struct Separator { 13 | Area area; 14 | SeparatorStyle style; 15 | Color color; 16 | int thickness; 17 | int length; 18 | } Separator; 19 | 20 | Separator *create_separator(); 21 | void destroy_separator(void *obj); 22 | void init_separator(); 23 | void init_separator_panel(void *p); 24 | void cleanup_separator(); 25 | gboolean resize_separator(void *obj); 26 | void draw_separator(void *obj, cairo_t *c); 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /src/systray/systraybar.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * Copyright (C) 2009 thierry lorthiois (lorthiois@bbsoft.fr) 3 | * 4 | * systraybar 5 | * systray implementation come from 'docker-1.5' by Ben Jansens, 6 | * and from systray/xembed specification (freedesktop.org). 7 | * 8 | **************************************************************************/ 9 | 10 | #ifndef SYSTRAYBAR_H 11 | #define SYSTRAYBAR_H 12 | 13 | #include "common.h" 14 | #include "area.h" 15 | #include "timer.h" 16 | #include 17 | 18 | // XEMBED messages 19 | #define XEMBED_EMBEDDED_NOTIFY 0 20 | // Flags for _XEMBED_INFO 21 | #define XEMBED_MAPPED (1 << 0) 22 | 23 | typedef enum SystraySortMethod { 24 | SYSTRAY_SORT_ASCENDING = 0, 25 | SYSTRAY_SORT_DESCENDING, 26 | SYSTRAY_SORT_LEFT2RIGHT, 27 | SYSTRAY_SORT_RIGHT2LEFT, 28 | } SystraySortMethod; 29 | 30 | typedef struct { 31 | // always start with area 32 | Area area; 33 | 34 | GSList *list_icons; 35 | SystraySortMethod sort; 36 | int alpha, saturation, brightness; 37 | int icon_size, icons_per_column, icons_per_row, margin; 38 | } Systray; 39 | 40 | typedef struct { 41 | // The actual tray icon window (created by the application) 42 | Window win; 43 | // The parent window created by tint2 to embed the icon 44 | Window parent; 45 | int x, y; 46 | int width, height; 47 | int depth; 48 | gboolean reparented; 49 | gboolean embedded; 50 | // Process PID or zero. 51 | int pid; 52 | // A number that is incremented for each new icon, used to sort them by the order in which they were created. 53 | int chrono; 54 | // Name of the tray icon window. 55 | char *name; 56 | // Members used for rendering 57 | struct timespec time_last_render; 58 | int num_fast_renders; 59 | Timer render_timer; 60 | // Members used for resizing 61 | int bad_size_counter; 62 | struct timespec time_last_resize; 63 | Timer resize_timer; 64 | // Icon contents if we are compositing the icon, otherwise null 65 | Imlib_Image image; 66 | // XDamage 67 | Damage damage; 68 | } TrayWindow; 69 | 70 | // net_sel_win != None when protocol started 71 | extern Window net_sel_win; 72 | extern Systray systray; 73 | extern gboolean refresh_systray; 74 | extern gboolean systray_enabled; 75 | extern int systray_max_icon_size; 76 | extern int systray_monitor; 77 | extern gboolean systray_profile; 78 | extern char *systray_hide_name_filter; 79 | 80 | // default global data 81 | void default_systray(); 82 | 83 | // freed memory 84 | void cleanup_systray(); 85 | 86 | // initialize protocol and panel position 87 | void init_systray(); 88 | void init_systray_panel(void *p); 89 | 90 | void draw_systray(void *obj, cairo_t *c); 91 | gboolean resize_systray(void *obj); 92 | void on_change_systray(void *obj); 93 | gboolean systray_on_monitor(int i_monitor, int num_panels); 94 | 95 | // systray protocol 96 | // many tray icon doesn't manage stop/restart of the systray manager 97 | void start_net(); 98 | void stop_net(); 99 | void handle_systray_event(XClientMessageEvent *e); 100 | 101 | gboolean add_icon(Window id); 102 | gboolean reparent_icon(TrayWindow *traywin); 103 | gboolean embed_icon(TrayWindow *traywin); 104 | void remove_icon(TrayWindow *traywin); 105 | 106 | void refresh_systray_icons(); 107 | void systray_render_icon(void *t); 108 | gboolean request_embed_icon(TrayWindow *traywin); 109 | void systray_resize_request_event(TrayWindow *traywin, XEvent *e); 110 | gboolean request_embed_icon(TrayWindow *traywin); 111 | void systray_reconfigure_event(TrayWindow *traywin, XEvent *e); 112 | void systray_property_notify(TrayWindow *traywin, XEvent *e); 113 | void systray_destroy_event(TrayWindow *traywin); 114 | void kde_update_icons(); 115 | 116 | TrayWindow *systray_find_icon(Window win); 117 | 118 | #endif 119 | -------------------------------------------------------------------------------- /src/taskbar/task.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * task : 3 | * - 4 | * 5 | **************************************************************************/ 6 | 7 | #ifndef TASK_H 8 | #define TASK_H 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | #include "common.h" 15 | #include "timer.h" 16 | 17 | typedef enum TaskState { 18 | TASK_NORMAL = 0, 19 | TASK_ACTIVE, 20 | TASK_ICONIFIED, 21 | TASK_URGENT, 22 | TASK_UNDEFINED, 23 | TASK_STATE_COUNT, 24 | } TaskState; 25 | 26 | typedef struct GlobalTask { 27 | Area area; 28 | gboolean has_text; 29 | gboolean has_icon; 30 | gboolean centered; 31 | int icon_posy; 32 | int icon_size1; 33 | int maximum_width; 34 | int maximum_height; 35 | int alpha[TASK_STATE_COUNT]; 36 | int saturation[TASK_STATE_COUNT]; 37 | int brightness[TASK_STATE_COUNT]; 38 | int config_asb_mask; 39 | Background *background[TASK_STATE_COUNT]; 40 | GList *gradient[TASK_STATE_COUNT]; 41 | int config_background_mask; 42 | // starting position for text ~ task_padding + task_border + icon_size 43 | double text_posx, text_height; 44 | gboolean has_font; 45 | gboolean has_content_tint; 46 | PangoFontDescription *font_desc; 47 | Color font[TASK_STATE_COUNT]; 48 | int config_font_mask; 49 | gboolean tooltip_enabled; 50 | gboolean thumbnail_enabled; 51 | int thumbnail_width; 52 | } GlobalTask; 53 | 54 | // Stores information about a task. 55 | // Warning: any dynamically allocated members are shared between the Task instances created for the same window 56 | // (if the task appears on all desktops, there will be a different instance on each desktop's taskbar). 57 | typedef struct Task { 58 | Area area; 59 | Window win; 60 | int desktop; 61 | TaskState current_state; 62 | Imlib_Image icon[TASK_STATE_COUNT]; 63 | Imlib_Image icon_hover[TASK_STATE_COUNT]; 64 | Imlib_Image icon_press[TASK_STATE_COUNT]; 65 | unsigned int icon_width; 66 | unsigned int icon_height; 67 | Color icon_color; 68 | Color icon_color_hover; 69 | Color icon_color_press; 70 | char *title; 71 | char *application; 72 | int urgent_tick; 73 | // These may not be up-to-date 74 | int win_x; 75 | int win_y; 76 | int win_w; 77 | int win_h; 78 | struct timespec last_activation_time; 79 | int _text_width; 80 | int _text_height; 81 | double _text_posy; 82 | int _icon_x; 83 | int _icon_y; 84 | cairo_surface_t *thumbnail; 85 | double thumbnail_last_update; 86 | } Task; 87 | 88 | extern Timer urgent_timer; 89 | extern GSList *urgent_list; 90 | 91 | Task *add_task(Window win); 92 | void remove_task(Task *task); 93 | 94 | void draw_task(void *obj, cairo_t *c); 95 | void on_change_task(void *obj); 96 | 97 | void task_update_icon(Task *task); 98 | void task_update_desktop(Task *task); 99 | gboolean task_update_title(Task *task); 100 | void reset_active_task(); 101 | void set_task_state(Task *task, TaskState state); 102 | void task_handle_mouse_event(Task *task, MouseAction action); 103 | void task_refresh_thumbnail(Task *task); 104 | 105 | // Given a pointer to the task that is currently under the mouse (current_task), 106 | // returns a pointer to the Task for the active window on the same taskbar. 107 | // If not found, returns the current task. 108 | Task *find_active_task(Task *current_task); 109 | 110 | Task *next_task(Task *task); 111 | Task *prev_task(Task *task); 112 | 113 | void add_urgent(Task *task); 114 | void del_urgent(Task *task); 115 | 116 | #endif 117 | -------------------------------------------------------------------------------- /src/taskbar/taskbar.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * Copyright (C) 2008 thierry lorthiois (lorthiois@bbsoft.fr) 3 | * 4 | * taskbar 5 | * 6 | **************************************************************************/ 7 | 8 | #ifndef TASKBAR_H 9 | #define TASKBAR_H 10 | 11 | #include "task.h" 12 | #include "taskbarname.h" 13 | 14 | typedef enum TaskbarState { 15 | TASKBAR_NORMAL = 0, 16 | TASKBAR_ACTIVE, 17 | TASKBAR_STATE_COUNT, 18 | } TaskbarState; 19 | 20 | typedef enum TaskbarSortMethod { 21 | TASKBAR_NOSORT = 0, 22 | TASKBAR_SORT_CENTER, 23 | TASKBAR_SORT_TITLE, 24 | TASKBAR_SORT_APPLICATION, 25 | TASKBAR_SORT_LRU, 26 | TASKBAR_SORT_MRU, 27 | } TaskbarSortMethod; 28 | 29 | typedef enum ThumbnailUpdateMode { 30 | THUMB_MODE_ACTIVE_WINDOW = 0, 31 | THUMB_MODE_TOOLTIP_WINDOW, 32 | THUMB_MODE_ALL 33 | } ThumbnailUpdateMode; 34 | 35 | typedef struct { 36 | Area area; 37 | gchar *name; 38 | int posy; 39 | } TaskbarName; 40 | 41 | typedef struct { 42 | Area area; 43 | int desktop; 44 | TaskbarName bar_name; 45 | int text_width; 46 | } Taskbar; 47 | 48 | typedef struct GlobalTaskbar { 49 | Area area; 50 | Area area_name; 51 | Background *background[TASKBAR_STATE_COUNT]; 52 | Background *background_name[TASKBAR_STATE_COUNT]; 53 | GList *gradient[TASKBAR_STATE_COUNT]; 54 | GList *gradient_name[TASKBAR_STATE_COUNT]; 55 | } GlobalTaskbar; 56 | 57 | extern gboolean taskbar_enabled; 58 | extern gboolean taskbar_distribute_size; 59 | extern gboolean hide_task_diff_desktop; 60 | extern gboolean hide_inactive_tasks; 61 | extern gboolean hide_task_diff_monitor; 62 | extern gboolean hide_taskbar_if_empty; 63 | extern gboolean always_show_all_desktop_tasks; 64 | extern TaskbarSortMethod taskbar_sort_method; 65 | extern Alignment taskbar_alignment; 66 | 67 | // win_to_task holds for every Window an array of tasks. Usually the array contains only one 68 | // element. However for omnipresent windows (windows which are visible in every taskbar) the array 69 | // contains to every Task* on each panel a pointer (i.e. GPtrArray.len == server.num_desktops) 70 | extern GHashTable *win_to_task; 71 | 72 | extern Task *active_task; 73 | extern Task *task_drag; 74 | 75 | void default_taskbar(); 76 | void cleanup_taskbar(); 77 | void init_taskbar(); 78 | void init_taskbar_panel(void *p); 79 | 80 | gboolean resize_taskbar(void *obj); 81 | void taskbar_default_font_changed(); 82 | void taskbar_start_thumbnail_timer(ThumbnailUpdateMode mode); 83 | 84 | // Reloads the entire list of tasks from the window manager and recreates the task buttons. 85 | void taskbar_refresh_tasklist(); 86 | 87 | // Returns the task button for this window. If there are multiple buttons, returns the first one. 88 | Task *get_task(Window win); 89 | 90 | // Returns the task buttons for this window, usually having only one element. 91 | // However for windows shown on all desktops, there are multiple buttons, one for each taskbar. 92 | GPtrArray *get_task_buttons(Window win); 93 | 94 | // Change state of a taskbar (ACTIVE or NORMAL) 95 | void set_taskbar_state(Taskbar *taskbar, TaskbarState state); 96 | 97 | // Updates the visibility of all taskbars 98 | void update_all_taskbars_visibility(); 99 | 100 | void update_minimized_icon_positions(void *p); 101 | 102 | // Sorts the taskbar(s) on which the window is present. 103 | void sort_taskbar_for_win(Window win); 104 | 105 | void sort_tasks(Taskbar *taskbar); 106 | 107 | gboolean taskbar_is_under_mouse(void *obj, int x, int y); 108 | 109 | #endif 110 | -------------------------------------------------------------------------------- /src/taskbar/taskbarname.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * Copyright (C) 2008 thierry lorthiois (lorthiois@bbsoft.fr) 3 | **************************************************************************/ 4 | 5 | #ifndef TASKBARNAME_H 6 | #define TASKBARNAME_H 7 | 8 | #include "common.h" 9 | #include "area.h" 10 | 11 | extern gboolean taskbarname_enabled; 12 | extern Color taskbarname_font; 13 | extern Color taskbarname_active_font; 14 | 15 | void default_taskbarname(); 16 | void cleanup_taskbarname(); 17 | 18 | void init_taskbarname_panel(void *p); 19 | 20 | void draw_taskbarname(void *obj, cairo_t *c); 21 | 22 | gboolean resize_taskbarname(void *obj); 23 | 24 | void taskbarname_default_font_changed(); 25 | 26 | void update_desktop_names(); 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /src/tint2conf/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(tint2conf) 2 | cmake_minimum_required(VERSION 2.6) 3 | 4 | include( FindPkgConfig ) 5 | pkg_check_modules( X11_T2C REQUIRED x11 xcomposite xdamage xinerama xrender xrandr>=1.3 ) 6 | pkg_check_modules( GLIB2 REQUIRED glib-2.0 ) 7 | pkg_check_modules( GOBJECT2 REQUIRED gobject-2.0 ) 8 | pkg_check_modules( IMLIB2 REQUIRED imlib2 ) 9 | pkg_check_modules( GTHREAD2 REQUIRED gthread-2.0 ) 10 | pkg_check_modules( GTK2 REQUIRED gtk+-x11-2.0 ) 11 | pkg_check_modules( RSVG librsvg-2.0>=2.36.0 ) 12 | 13 | include_directories( ../util 14 | ${X11_T2C_INCLUDE_DIRS} 15 | ${GLIB2_INCLUDE_DIRS} 16 | ${GOBJECT2_INCLUDE_DIRS} 17 | ${IMLIB2_INCLUDE_DIRS} 18 | ${GTHREAD2_INCLUDE_DIRS} 19 | ${GTK2_INCLUDE_DIRS} 20 | ${RSVG_INCLUDE_DIRS} ) 21 | 22 | set(SOURCES ../util/common.c 23 | ../util/bt.c 24 | ../util/strnatcmp.c 25 | ../util/cache.c 26 | ../util/timer.c 27 | ../util/test.c 28 | ../util/print.c 29 | ../util/signals.c 30 | ../config.c 31 | ../util/server.c 32 | ../util/strlcat.c 33 | ../launcher/apps-common.c 34 | ../launcher/icon-theme-common.c 35 | md4.c 36 | main.c 37 | properties.c 38 | properties_rw.c 39 | theme_view.c 40 | background_gui.c 41 | gradient_gui.c ) 42 | 43 | add_definitions( -DTINT2CONF ) 44 | 45 | option( ENABLE_RSVG "Rsvg support (launcher only)" ON ) 46 | 47 | if( ENABLE_RSVG ) 48 | if( RSVG_FOUND ) 49 | add_definitions( -DHAVE_RSVG ) 50 | endif( RSVG_FOUND ) 51 | endif( ENABLE_RSVG ) 52 | 53 | link_directories( ${X11_T2C_LIBRARY_DIRS} 54 | ${GLIB2_LIBRARY_DIRS} 55 | ${GOBJECT2_LIBRARY_DIRS} 56 | ${IMLIB2_LIBRARY_DIRS} 57 | ${GTHREAD2_LIBRARY_DIRS} 58 | ${GTK2_LIBRARY_DIRS} 59 | ${RSVG_LIBRARY_DIRS} ) 60 | add_executable( tint2conf ${SOURCES} ) 61 | target_link_libraries( tint2conf ${X11_T2C_LIBRARIES} 62 | ${GLIB2_LIBRARIES} 63 | ${GOBJECT2_LIBRARIES} 64 | ${IMLIB2_LIBRARIES} 65 | ${GTHREAD2_LIBRARIES} 66 | ${GTK2_LIBRARIES} 67 | ${RSVG_LIBRARIES} ) 68 | 69 | add_definitions( -DINSTALL_PREFIX=\"${CMAKE_INSTALL_PREFIX}\" ) 70 | add_definitions( -DLOCALEDIR=\"${CMAKE_INSTALL_FULL_LOCALEDIR}\" ) 71 | add_definitions( -DGETTEXT_PACKAGE=\"tint2conf\" ) 72 | set_target_properties( tint2conf PROPERTIES COMPILE_FLAGS "-Wall -pthread -std=c99" ) 73 | set_target_properties( tint2conf PROPERTIES LINK_FLAGS "-pthread" ) 74 | 75 | add_subdirectory(po) 76 | 77 | install( TARGETS tint2conf DESTINATION bin ) 78 | install( FILES tint2conf.svg DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/scalable/apps ) 79 | install( FILES tint2conf.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications ) 80 | install( FILES tint2conf.xml DESTINATION ${CMAKE_INSTALL_DATADIR}/mime/packages ) 81 | -------------------------------------------------------------------------------- /src/tint2conf/background_gui.h: -------------------------------------------------------------------------------- 1 | #ifndef BACKGROUND_GUI_H 2 | #define BACKGROUND_GUI_H 3 | 4 | #include "gui.h" 5 | 6 | void create_background(GtkWidget *parent); 7 | void background_duplicate(GtkWidget *widget, gpointer data); 8 | void background_delete(GtkWidget *widget, gpointer data); 9 | void background_update_image(int index); 10 | void background_update(GtkWidget *widget, gpointer data); 11 | void current_background_changed(GtkWidget *widget, gpointer data); 12 | void background_combo_changed(GtkWidget *widget, gpointer data); 13 | GtkWidget *create_background_combo(const char *label); 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /src/tint2conf/gradient_gui.h: -------------------------------------------------------------------------------- 1 | #ifndef GRADIENT_GUI_H 2 | #define GRADIENT_GUI_H 3 | 4 | #include "gui.h" 5 | 6 | int gradient_index_safe(int index); 7 | void create_gradient(GtkWidget *parent); 8 | GtkWidget *create_gradient_combo(); 9 | void gradient_duplicate(GtkWidget *widget, gpointer data); 10 | void gradient_delete(GtkWidget *widget, gpointer data); 11 | void gradient_update_image(int index); 12 | void gradient_update(GtkWidget *widget, gpointer data); 13 | void gradient_force_update(); 14 | void current_gradient_changed(GtkWidget *widget, gpointer data); 15 | void background_update_for_gradient(int gradient_id); 16 | 17 | GtkWidget *create_gradient_stop_combo(); 18 | void gradient_stop_duplicate(GtkWidget *widget, gpointer data); 19 | void gradient_stop_delete(GtkWidget *widget, gpointer data); 20 | void gradient_stop_update(GtkWidget *widget, gpointer data); 21 | void gradient_stop_update_image(int index); 22 | void current_gradient_stop_changed(GtkWidget *widget, gpointer data); 23 | 24 | typedef enum GradientConfigType { 25 | GRADIENT_CONFIG_VERTICAL = 0, 26 | GRADIENT_CONFIG_HORIZONTAL, 27 | GRADIENT_CONFIG_RADIAL 28 | } GradientConfigType; 29 | 30 | typedef struct GradientConfigColorStop { 31 | Color color; 32 | // offset in 0-1 33 | double offset; 34 | } GradientConfigColorStop; 35 | 36 | typedef struct GradientConfig { 37 | GradientConfigType type; 38 | GradientConfigColorStop start_color; 39 | GradientConfigColorStop end_color; 40 | // Each element is a GradientConfigColorStop 41 | GList *extra_color_stops; 42 | } GradientConfig; 43 | 44 | void gradient_create_new(GradientConfigType t); 45 | void gradient_draw(cairo_t *c, GradientConfig *g, int w, int h, gboolean preserve); 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /src/tint2conf/gui.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "main.h" 5 | #include "properties.h" 6 | #include "properties_rw.h" 7 | #include "../launcher/apps-common.h" 8 | #include "../launcher/icon-theme-common.h" 9 | #include "../util/common.h" 10 | #include "strnatcmp.h" 11 | 12 | #define ROW_SPACING 10 13 | #define COL_SPACING 8 14 | #define DEFAULT_HOR_SPACING 5 15 | 16 | gint compare_strings(gconstpointer a, gconstpointer b); 17 | void change_paragraph(GtkWidget *widget); 18 | int get_model_length(GtkTreeModel *model); 19 | void gdkColor2CairoColor(GdkColor color, double *red, double *green, double *blue); 20 | void cairoColor2GdkColor(double red, double green, double blue, GdkColor *color); 21 | -------------------------------------------------------------------------------- /src/tint2conf/main.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #ifdef GETTEXT_PACKAGE 11 | #include 12 | #else 13 | #define _(String) String 14 | #define GETTEXT_PACKAGE "tint2conf" 15 | #endif 16 | 17 | #define SNAPSHOT_TICK 190 18 | gboolean update_snapshot(gpointer ignored); 19 | void menuApply(); 20 | void refresh_current_theme(); 21 | extern GtkWidget *g_window; 22 | -------------------------------------------------------------------------------- /src/tint2conf/md4.h: -------------------------------------------------------------------------------- 1 | #ifndef MD4_H 2 | #define MD4_H 3 | 4 | #define MD4_HEX_SIZE 33 5 | void md4hexf(const char *path, char *hash); 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /src/tint2conf/po/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include(FindGettext) 2 | if (GETTEXT_FOUND) 3 | set(GETTEXT_PACKAGE tint2conf) 4 | file(GLOB POTFILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.po") 5 | string(REPLACE ".po" " " LANGUAGES ${POTFILES}) 6 | message(STATUS "gettext found languages: ${LANGUAGES}") 7 | string(REPLACE " " ";" LANGUAGES ${LANGUAGES}) 8 | if ("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_LESS "2.8.8") 9 | GETTEXT_CREATE_TRANSLATIONS("${CMAKE_CURRENT_SOURCE_DIR}/tint2conf.pot" ALL ${POTFILES}) 10 | else() 11 | foreach(LANG ${LANGUAGES}) 12 | GETTEXT_PROCESS_PO_FILES(${LANG} ALL PO_FILES ${LANG}.po) 13 | install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${LANG}.gmo" 14 | DESTINATION "${CMAKE_INSTALL_LOCALEDIR}/${LANG}/LC_MESSAGES" 15 | RENAME "${GETTEXT_PACKAGE}.mo") 16 | endforeach () 17 | endif() 18 | else () 19 | message(STATUS "gettext not found") 20 | endif () 21 | -------------------------------------------------------------------------------- /src/tint2conf/po/readme.txt: -------------------------------------------------------------------------------- 1 | Updating pot file: 2 | 3 | find .. -name '*.c' | sort -r | xargs xgettext --keyword=_ --language=C --output=updated.pot - 4 | 5 | Followed by manual editing of updated.pot to make sure the header is OK. Then: 6 | 7 | cat updated.pot > tint2conf.pot && rm -f updated.pot 8 | 9 | Then update the po files: 10 | 11 | for f in *.po ; do lang=$(basename $f .po); echo $lang ; msgmerge -i -o $lang.pox $lang.po tint2conf.pot ; cat ${lang}.pox > ${lang}.po ; rm ${lang}.pox ; done 12 | -------------------------------------------------------------------------------- /src/tint2conf/po/update-translations.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | set -x 5 | 6 | find .. -name '*.c' | sort -r | xargs xgettext --keyword=_ --language=C --output=tint2conf.pot - 7 | sed -i "s/PACKAGE VERSION/tint2conf $(../../../get_version.sh | head -n1)/g" tint2conf.pot 8 | sed -i "s/CHARSET/UTF-8/g" tint2conf.pot 9 | 10 | for f in *.po 11 | do 12 | lang=$(basename $f .po) 13 | echo $lang 14 | msgmerge -i -o $lang.pox $lang.po tint2conf.pot 15 | cat ${lang}.pox > ${lang}.po 16 | rm ${lang}.pox 17 | done 18 | 19 | set +e 20 | set +x 21 | echo "Status:" 22 | for f in *.po 23 | do 24 | lang=$(basename $f .po) 25 | fuzzy=$(cat ${lang}.po | grep -A2 "#, fuzzy") 26 | missing=$(cat ${lang}.po | grep -B1 'msgstr ""') 27 | if [ -z "$fuzzy" ] && [ -z "$missing" ] 28 | then 29 | echo $lang ": Up to date" 30 | else 31 | count=$(( $(echo -e "$fuzzy" "\n" "$missing" | grep "^--$" | wc -l) + 1)) 32 | echo "${lang}: Translation incomplete: ${count} strings to be updated. See ${lang}.todo" 33 | echo "$fuzzy" > ${lang}.todo 34 | echo "$missing" >> ${lang}.todo 35 | fi 36 | done 37 | -------------------------------------------------------------------------------- /src/tint2conf/properties_rw.h: -------------------------------------------------------------------------------- 1 | #ifndef PROPERTIES_RW 2 | #define PROPERTIES_RW 3 | 4 | #include 5 | 6 | char *get_current_theme_path(); 7 | gboolean config_is_manual(const char *path); 8 | void config_read_file(const char *path); 9 | void config_save_file(const char *path); 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /src/tint2conf/theme_view.h: -------------------------------------------------------------------------------- 1 | #ifndef THEME_VIEW 2 | #define THEME_VIEW 3 | 4 | #include 5 | 6 | extern GtkWidget *g_theme_view; 7 | extern GtkListStore *theme_list_store; 8 | enum { 9 | COL_THEME_FILE = 0, 10 | COL_THEME_NAME, 11 | COL_SNAPSHOT, 12 | COL_WIDTH, 13 | COL_HEIGHT, 14 | COL_FORCE_REFRESH, 15 | NB_COL, 16 | }; 17 | 18 | GtkWidget *create_view(); 19 | 20 | void theme_list_append(const gchar *path); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /src/tint2conf/tint2conf.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Type=Application 3 | 4 | Name=Tint2 Settings 5 | Name[am]=ፓነል አስተዳዳሪ 6 | Name[ar]=مدير الائحة : 7 | Name[ast]=Alministrador de panel 8 | Name[be]=Кіраўнік Панэляў 9 | Name[ca]=Gestor de quadres 10 | Name[cs]=Správce panelu 11 | Name[da]=Panelhåndtering 12 | Name[de]=Leistenverwaltung 13 | Name[dz]=པེ་ནཱལ་འཛིན་སྐྱོང་པ། 14 | Name[el]=Διαχειριστής ταμπλό 15 | Name[en_GB]=Panel Manager 16 | Name[eo]=Administrilo de Panelo 17 | Name[es]=Administrador de panel 18 | Name[et]=Paneelihaldur 19 | Name[eu]=Panel Kudeatzailea: 20 | Name[fi]=Paneelin hallinta 21 | Name[fr]=Gestionnaire du panneau tint2 22 | Name[gl]=Xestor de paneis 23 | Name[he]=מנהל הלוח 24 | Name[hu]=Panelkezelő 25 | Name[id]=Manajer Panel 26 | Name[it]=Gestore dei pannelli 27 | Name[ja]=パネルマネージャ 28 | Name[kk]=Панель менеджері 29 | Name[ko]=패널 관리자 30 | Name[ku]=Gerinendeyê panelan 31 | Name[lv]=Paneļu pārvaldnieks 32 | Name[mk]=Менаџер за панели 33 | Name[nb]=Panelbehandler 34 | Name[nl]=Paneel Manager 35 | Name[nn]=Panelhandsamar 36 | Name[pa]=ਪੈਨਲ ਮੈਨੇਜਰ 37 | Name[pl]=Ustawienia panelu tint2 38 | Name[pt]=Gestor do Painel 39 | Name[pt_BR]=Gerenciador do painel 40 | Name[ro]=Manager de panouri 41 | Name[ru]=Настройки tint2 42 | Name[si]=පුවරු කළමණාකරු 43 | Name[sk]=Nastavenie panelu 44 | Name[sq]=Përgjegjës Panelesh 45 | Name[sv]=Panelhanterare 46 | Name[ta]=பலகை மேளாலர்: 47 | Name[tr]=Panel Yöneticisi 48 | Name[ug]=Panel باشقۇرغۇ 49 | Name[uk]=Настройки tint2 50 | Name[ur]=پینل منیجر 51 | Name[ur_PK]=پینل منیجر 52 | Name[vi]=Quản lý panel 53 | Name[zh_CN]=面板管理器 54 | Name[zh_TW]=面板管理程式 55 | 56 | GenericName=Panel configurator 57 | GenericName[am]=ፓነል አስተዳዳሪ 58 | GenericName[ar]=مدير الائحة : 59 | GenericName[ast]=Alministrador de panel 60 | GenericName[be]=Кіраўнік Панэляў 61 | GenericName[ca]=Gestor de quadres 62 | GenericName[cs]=Správce panelu 63 | GenericName[da]=Panelhåndtering 64 | GenericName[de]=Leistenverwaltung 65 | GenericName[dz]=པེ་ནཱལ་འཛིན་སྐྱོང་པ། 66 | GenericName[el]=Διαχειριστής ταμπλό 67 | GenericName[en_GB]=Panel Manager 68 | GenericName[eo]=Administrilo de Panelo 69 | GenericName[es]=Administrador de panel 70 | GenericName[et]=Paneelihaldur 71 | GenericName[eu]=Panel Kudeatzailea: 72 | GenericName[fi]=Paneelin hallinta 73 | GenericName[fr]=Gestionnaire de panneau 74 | GenericName[gl]=Xestor de paneis 75 | GenericName[he]=מנהל הלוח 76 | GenericName[hu]=Panelkezelő 77 | GenericName[id]=Manajer Panel 78 | GenericName[it]=Gestore dei pannelli 79 | GenericName[ja]=パネルマネージャ 80 | GenericName[kk]=Панель менеджері 81 | GenericName[ko]=패널 관리자 82 | GenericName[ku]=Gerinendeyê panelan 83 | GenericName[lv]=Paneļu pārvaldnieks 84 | GenericName[mk]=Менаџер за панели 85 | GenericName[nb]=Panelbehandler 86 | GenericName[nl]=Paneel Manager 87 | GenericName[nn]=Panelhandsamar 88 | GenericName[pa]=ਪੈਨਲ ਮੈਨੇਜਰ 89 | GenericName[pl]=Ustawienia panelu tint2 90 | GenericName[pt]=Gestor do Painel 91 | GenericName[pt_BR]=Gerenciador do painel 92 | GenericName[ro]=Manager de panouri 93 | GenericName[ru]=Настройки панелей 94 | GenericName[si]=පුවරු කළමණාකරු 95 | GenericName[sk]=Nastavenie panelu 96 | GenericName[sq]=Përgjegjës Panelesh 97 | GenericName[sv]=Panelhanterare 98 | GenericName[ta]=பலகை மேளாலர்: 99 | GenericName[tr]=Panel Yöneticisi 100 | GenericName[ug]=Panel باشقۇرغۇ 101 | GenericName[uk]=Настройки панелi 102 | GenericName[ur]=پینل منیجر 103 | GenericName[ur_PK]=پینل منیجر 104 | GenericName[vi]=Quản lý panel 105 | GenericName[zh_CN]=面板管理器 106 | GenericName[zh_TW]=面板管理程式 107 | 108 | Comment=Tool to configure the tint2 panel 109 | Comment[pl]=Narzędzie do konfiguracji panelu tint2 configure the tint2 panel 110 | Comment[ru]=Инструмент конфигурирования панели tint2 111 | 112 | Exec=tint2conf 113 | Icon=tint2conf 114 | Terminal=false 115 | Categories=Settings;DesktopSettings; 116 | MimeType=application/x-tint2-theme 117 | -------------------------------------------------------------------------------- /src/tint2conf/tint2conf.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | tint2 theme file 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/tint2rc.h: -------------------------------------------------------------------------------- 1 | #ifndef TINT2RC_H 2 | #define TINT2RC_H 3 | 4 | // Content of .c file generated with xxd from the vim package: 5 | // echo '#include "tint2rc.h"' > src/tint2rc.c && xxd -i themes/tint2rc >> src/tint2rc.c 6 | 7 | extern unsigned char themes_tint2rc[]; 8 | extern unsigned int themes_tint2rc_len; 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /src/tooltip/tooltip.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright (C) 2009 Andreas.Fink (Andreas.Fink85@gmail.com) 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU General Public License version 2 7 | * as published by the Free Software Foundation. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, write to the Free Software 15 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 16 | **************************************************************************/ 17 | 18 | #ifndef TOOLTIP_H 19 | #define TOOLTIP_H 20 | 21 | #include "task.h" 22 | #include "panel.h" 23 | #include "timer.h" 24 | 25 | typedef struct { 26 | Area *area; // never ever use the area attribut if you are not 100% sure that this area was not freed 27 | char *tooltip_text; 28 | Panel *panel; 29 | Window window; 30 | int show_timeout_msec; 31 | int hide_timeout_msec; 32 | Bool mapped; 33 | int paddingx; 34 | int paddingy; 35 | gboolean has_font; 36 | PangoFontDescription *font_desc; 37 | Color font_color; 38 | Background *bg; 39 | Timer visibility_timer; 40 | Timer update_timer; 41 | cairo_surface_t *image; 42 | } Tooltip; 43 | 44 | extern Tooltip g_tooltip; 45 | 46 | // default global data 47 | void default_tooltip(); 48 | 49 | // freed memory 50 | void cleanup_tooltip(); 51 | 52 | void init_tooltip(); 53 | void tooltip_trigger_show(Area *area, Panel *p, XEvent *e); 54 | void tooltip_show(void * /*arg*/); 55 | void tooltip_update(); 56 | void tooltip_trigger_hide(); 57 | void tooltip_hide(void * /*arg*/); 58 | void tooltip_update_contents_for(Area *area); 59 | void tooltip_default_font_changed(); 60 | 61 | #endif // TOOLTIP_H 62 | -------------------------------------------------------------------------------- /src/util/bool.h: -------------------------------------------------------------------------------- 1 | #ifndef BOOL_H 2 | #define BOOL_H 3 | 4 | #ifndef bool 5 | #define bool int 6 | #define false 0 7 | #define true 1 8 | #endif 9 | 10 | #define SUCCESS true 11 | #define FAILURE false 12 | 13 | #ifndef Status 14 | typedef int Status; 15 | #endif 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /src/util/bt.h: -------------------------------------------------------------------------------- 1 | #ifndef BT_H 2 | #define BT_H 3 | 4 | #include 5 | 6 | #define BT_FRAME_SIZE 64 7 | #define BT_MAX_FRAMES 64 8 | 9 | struct backtrace_frame { 10 | char name[BT_FRAME_SIZE]; 11 | }; 12 | 13 | struct backtrace { 14 | struct backtrace_frame frames[BT_MAX_FRAMES]; 15 | size_t frame_count; 16 | }; 17 | 18 | void get_backtrace(struct backtrace *bt, int skip); 19 | 20 | #endif // BT_H 21 | -------------------------------------------------------------------------------- /src/util/cache.c: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Tint2 : cache 4 | * 5 | * Copyright (C) 2016 @o9000 6 | * 7 | * This program is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU General Public License version 2 9 | * as published by the Free Software Foundation. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | **************************************************************************/ 19 | 20 | #include "cache.h" 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | #include "common.h" 32 | 33 | void init_cache(Cache *cache) 34 | { 35 | if (cache->_table) 36 | free_cache(cache); 37 | cache->_table = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); 38 | cache->dirty = FALSE; 39 | cache->loaded = FALSE; 40 | } 41 | 42 | void free_cache(Cache *cache) 43 | { 44 | if (cache->_table) 45 | g_hash_table_destroy(cache->_table); 46 | cache->_table = NULL; 47 | cache->dirty = FALSE; 48 | cache->loaded = FALSE; 49 | } 50 | 51 | void load_cache(Cache *cache, const gchar *cache_path) 52 | { 53 | init_cache(cache); 54 | 55 | cache->loaded = TRUE; 56 | 57 | int fd = open(cache_path, O_RDONLY); 58 | if (fd == -1) 59 | return; 60 | flock(fd, LOCK_SH); 61 | 62 | FILE *f = fopen(cache_path, "rt"); 63 | if (!f) 64 | goto unlock; 65 | 66 | char *line = NULL; 67 | size_t line_size; 68 | 69 | while (getline(&line, &line_size, f) >= 0) { 70 | char *key, *value; 71 | 72 | size_t line_len = strlen(line); 73 | gboolean has_newline = FALSE; 74 | if (line_len >= 1) { 75 | if (line[line_len - 1] == '\n') { 76 | line[line_len - 1] = '\0'; 77 | line_len--; 78 | has_newline = TRUE; 79 | } 80 | } 81 | if (!has_newline) 82 | break; 83 | 84 | if (line_len == 0) 85 | continue; 86 | 87 | if (parse_line(line, &key, &value)) { 88 | g_hash_table_insert(cache->_table, g_strdup(key), g_strdup(value)); 89 | free(key); 90 | free(value); 91 | } 92 | } 93 | free(line); 94 | fclose(f); 95 | 96 | unlock: 97 | flock(fd, LOCK_UN); 98 | close(fd); 99 | } 100 | 101 | void write_cache_line(gpointer key, gpointer value, gpointer user_data) 102 | { 103 | gchar *k = key; 104 | gchar *v = value; 105 | FILE *f = user_data; 106 | 107 | fprintf(f, "%s=%s\n", k, v); 108 | } 109 | 110 | void save_cache(Cache *cache, const gchar *cache_path) 111 | { 112 | int fd = open(cache_path, O_RDONLY | O_CREAT, 0600); 113 | if (fd == -1) { 114 | gchar *dir_path = g_path_get_dirname(cache_path); 115 | g_mkdir_with_parents(dir_path, 0700); 116 | g_free(dir_path); 117 | fd = open(cache_path, O_RDONLY | O_CREAT, 0600); 118 | } 119 | if (fd == -1) { 120 | fprintf(stderr, RED "tint2: Could not save icon theme cache!" RESET "\n"); 121 | return; 122 | } 123 | flock(fd, LOCK_EX); 124 | 125 | FILE *f = fopen(cache_path, "w"); 126 | if (!f) { 127 | fprintf(stderr, RED "tint2: Could not save icon theme cache!" RESET "\n"); 128 | goto unlock; 129 | } 130 | g_hash_table_foreach(cache->_table, write_cache_line, f); 131 | fclose(f); 132 | cache->dirty = FALSE; 133 | 134 | unlock: 135 | flock(fd, LOCK_UN); 136 | close(fd); 137 | } 138 | 139 | const gchar *get_from_cache(Cache *cache, const gchar *key) 140 | { 141 | if (!cache->_table) 142 | return NULL; 143 | return g_hash_table_lookup(cache->_table, key); 144 | } 145 | 146 | void add_to_cache(Cache *cache, const gchar *key, const gchar *value) 147 | { 148 | if (!cache->_table) 149 | init_cache(cache); 150 | 151 | if (!key || !value) 152 | return; 153 | 154 | gchar *old_value = g_hash_table_lookup(cache->_table, key); 155 | if (old_value && g_str_equal(old_value, value)) 156 | return; 157 | 158 | g_hash_table_insert(cache->_table, g_strdup(key), g_strdup(value)); 159 | cache->dirty = TRUE; 160 | } 161 | -------------------------------------------------------------------------------- /src/util/cache.h: -------------------------------------------------------------------------------- 1 | #ifndef CACHE_H 2 | #define CACHE_H 3 | 4 | #include 5 | 6 | // A cache with string keys and values, backed by a file. 7 | // The strings must not be NULL and are stripped of any whitespace at start and end. 8 | typedef struct Cache { 9 | gboolean dirty; 10 | gboolean loaded; 11 | GHashTable *_table; 12 | } Cache; 13 | 14 | // Initializes the cache. You can also call load_cache directly if you set the memory contents to zero first. 15 | void init_cache(Cache *cache); 16 | 17 | // Clears the cache contents and releases all memory, but not the object. 18 | // You can use init_cache or load_cache afterwards. 19 | void free_cache(Cache *cache); 20 | 21 | // Clears the cache contents and loads new contents from a file. 22 | // Sets the loaded flag to TRUE. 23 | void load_cache(Cache *cache, const gchar *cache_path); 24 | 25 | // Saves the cache contents to a file. 26 | // Clears the dirty flag. 27 | void save_cache(Cache *cache, const gchar *cache_path); 28 | 29 | // Returns a pointer to the value in the cache, or NULL if not found. 30 | // Do not free the returned value! 31 | const gchar *get_from_cache(Cache *cache, const gchar *key); 32 | 33 | // Adds a key-value pair to the cache. NULL keys or values are not allowed. 34 | // If the key already exists, the old value is and replaced with the new value. 35 | // Does not take ownership of the pointers (neither key, nor value); instead it makes copies. 36 | // Sets the dirty flag to TRUE. 37 | void add_to_cache(Cache *cache, const gchar *key, const gchar *value); 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /src/util/color.c: -------------------------------------------------------------------------------- 1 | #include "color.h" 2 | -------------------------------------------------------------------------------- /src/util/color.h: -------------------------------------------------------------------------------- 1 | #ifndef COLOR_H 2 | #define COLOR_H 3 | 4 | typedef struct Color { 5 | // Values are in [0, 1], with 0 meaning no intensity. 6 | double rgb[3]; 7 | // Values are in [0, 1], with 0 meaning fully transparent, 1 meaning fully opaque. 8 | double alpha; 9 | } Color; 10 | 11 | #endif // COLOR_H 12 | -------------------------------------------------------------------------------- /src/util/colors.h: -------------------------------------------------------------------------------- 1 | #ifndef COLORS_H 2 | #define COLORS_H 3 | 4 | #define GREEN "\033[1;32m" 5 | #define YELLOW "\033[1;33m" 6 | #define RED "\033[1;31m" 7 | #define BLUE "\033[1;34m" 8 | #define RESET "\033[0m" 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /src/util/fps_distribution.c: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Copyright (C) 2017 tint2 authors 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU General Public License version 2 7 | * as published by the Free Software Foundation. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, write to the Free Software 15 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 16 | **************************************************************************/ 17 | 18 | #include 19 | 20 | #include "fps_distribution.h" 21 | 22 | static float *fps_distribution = NULL; 23 | 24 | void init_fps_distribution() 25 | { 26 | // measure FPS with resolution: 27 | // 0-59: 1 (60 samples) 28 | // 60-199: 10 (14) 29 | // 200-1,999: 25 (72) 30 | // 1k-19,999: 1000 (19) 31 | // 20x+: inf (1) 32 | // => 166 samples 33 | if (fps_distribution) 34 | return; 35 | fps_distribution = calloc(170, sizeof(float)); 36 | } 37 | 38 | void cleanup_fps_distribution() 39 | { 40 | free(fps_distribution); 41 | fps_distribution = NULL; 42 | } 43 | 44 | void sample_fps(double fps) 45 | { 46 | int fps_rounded = (int)(fps + 0.5); 47 | int i = 1; 48 | if (fps_rounded < 60) { 49 | i += fps_rounded; 50 | } else { 51 | i += 60; 52 | if (fps_rounded < 200) { 53 | i += (fps_rounded - 60) / 10; 54 | } else { 55 | i += 14; 56 | if (fps_rounded < 2000) { 57 | i += (fps_rounded - 200) / 25; 58 | } else { 59 | i += 72; 60 | if (fps_rounded < 20000) { 61 | i += (fps_rounded - 2000) / 1000; 62 | } else { 63 | i += 20; 64 | } 65 | } 66 | } 67 | } 68 | // fprintf(stderr, "tint2: fps = %.0f => i = %d\n", fps, i); 69 | fps_distribution[i] += 1.; 70 | fps_distribution[0] += 1.; 71 | } 72 | 73 | void fps_compute_stats(double *low, double *median, double *high, double *samples) 74 | { 75 | *median = *low = *high = *samples = -1; 76 | if (!fps_distribution || fps_distribution[0] < 1) 77 | return; 78 | float total = fps_distribution[0]; 79 | *samples = (double)fps_distribution[0]; 80 | float cum_low = 0.05f * total; 81 | float cum_median = 0.5f * total; 82 | float cum_high = 0.95f * total; 83 | float cum = 0; 84 | for (int i = 1; i <= 166; i++) { 85 | double value = 86 | (i < 60) ? i : (i < 74) ? (60 + (i - 60) * 10) : (i < 146) ? (200 + (i - 74) * 25) 87 | : (i < 165) ? (2000 + (i - 146) * 1000) : 20000; 88 | // fprintf(stderr, "tint2: %6.0f (i = %3d) : %.0f | ", value, i, (double)fps_distribution[i]); 89 | cum += fps_distribution[i]; 90 | if (*low < 0 && cum >= cum_low) 91 | *low = value; 92 | if (*median < 0 && cum >= cum_median) 93 | *median = value; 94 | if (*high < 0 && cum >= cum_high) 95 | *high = value; 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /src/util/fps_distribution.h: -------------------------------------------------------------------------------- 1 | #ifndef FPS_DISTRIBUTION_H 2 | #define FPS_DISTRIBUTION_H 3 | 4 | void init_fps_distribution(); 5 | void cleanup_fps_distribution(); 6 | void sample_fps(double fps); 7 | void fps_compute_stats(double *low, double *median, double *high, double *samples); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /src/util/gradient.c: -------------------------------------------------------------------------------- 1 | #include "gradient.h" 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #include "common.h" 8 | 9 | gboolean read_double(const char *str, double *value) 10 | { 11 | if (!str[0]) 12 | return FALSE; 13 | char *end; 14 | *value = strtod(str, &end); 15 | if (end[0]) 16 | return FALSE; 17 | return TRUE; 18 | } 19 | 20 | gboolean read_double_with_percent(const char *str, double *value) 21 | { 22 | if (!str[0]) 23 | return FALSE; 24 | char *end; 25 | *value = strtod(str, &end); 26 | if (end[0] == '%' && !end[1]) { 27 | *value *= 0.01; 28 | return TRUE; 29 | } 30 | if (end[0]) 31 | return FALSE; 32 | return TRUE; 33 | } 34 | 35 | GradientType gradient_type_from_string(const char *str) 36 | { 37 | if (g_str_equal(str, "horizontal")) 38 | return GRADIENT_HORIZONTAL; 39 | if (g_str_equal(str, "vertical")) 40 | return GRADIENT_VERTICAL; 41 | if (g_str_equal(str, "radial")) 42 | return GRADIENT_CENTERED; 43 | fprintf(stderr, RED "tint2: Invalid gradient type: %s" RESET "\n", str); 44 | return GRADIENT_VERTICAL; 45 | } 46 | 47 | void init_gradient(GradientClass *g, GradientType type) 48 | { 49 | memset(g, 0, sizeof(*g)); 50 | g->type = type; 51 | if (g->type == GRADIENT_VERTICAL) { 52 | Offset *offset_top = (Offset *)calloc(1, sizeof(Offset)); 53 | offset_top->constant = TRUE; 54 | offset_top->constant_value = 0; 55 | g->from.offsets_y = g_list_append(g->from.offsets_y, offset_top); 56 | Offset *offset_bottom = (Offset *)calloc(1, sizeof(Offset)); 57 | offset_bottom->constant = FALSE; 58 | offset_bottom->element = ELEMENT_SELF; 59 | offset_bottom->variable = SIZE_HEIGHT; 60 | offset_bottom->multiplier = 1.0; 61 | g->to.offsets_y = g_list_append(g->to.offsets_y, offset_bottom); 62 | } else if (g->type == GRADIENT_HORIZONTAL) { 63 | Offset *offset_left = (Offset *)calloc(1, sizeof(Offset)); 64 | offset_left->constant = TRUE; 65 | offset_left->constant_value = 0; 66 | g->from.offsets_x = g_list_append(g->from.offsets_x, offset_left); 67 | Offset *offset_right = (Offset *)calloc(1, sizeof(Offset)); 68 | offset_right->constant = FALSE; 69 | offset_right->element = ELEMENT_SELF; 70 | offset_right->variable = SIZE_WIDTH; 71 | offset_right->multiplier = 1.0; 72 | g->to.offsets_x = g_list_append(g->to.offsets_x, offset_right); 73 | } else if (g->type == GRADIENT_CENTERED) { 74 | // from 75 | Offset *offset_center_x = (Offset *)calloc(1, sizeof(Offset)); 76 | offset_center_x->constant = FALSE; 77 | offset_center_x->element = ELEMENT_SELF; 78 | offset_center_x->variable = SIZE_CENTERX; 79 | offset_center_x->multiplier = 1.0; 80 | g->from.offsets_x = g_list_append(g->from.offsets_x, offset_center_x); 81 | Offset *offset_center_y = (Offset *)calloc(1, sizeof(Offset)); 82 | offset_center_y->constant = FALSE; 83 | offset_center_y->element = ELEMENT_SELF; 84 | offset_center_y->variable = SIZE_CENTERY; 85 | offset_center_y->multiplier = 1.0; 86 | g->from.offsets_y = g_list_append(g->from.offsets_y, offset_center_y); 87 | Offset *offset_center_r = (Offset *)calloc(1, sizeof(Offset)); 88 | offset_center_r->constant = TRUE; 89 | offset_center_r->constant_value = 0; 90 | g->from.offsets_r = g_list_append(g->from.offsets_r, offset_center_r); 91 | // to 92 | offset_center_x = (Offset *)calloc(1, sizeof(Offset)); 93 | offset_center_x->constant = FALSE; 94 | offset_center_x->element = ELEMENT_SELF; 95 | offset_center_x->variable = SIZE_CENTERX; 96 | offset_center_x->multiplier = 1.0; 97 | g->to.offsets_x = g_list_append(g->to.offsets_x, offset_center_x); 98 | offset_center_y = (Offset *)calloc(1, sizeof(Offset)); 99 | offset_center_y->constant = FALSE; 100 | offset_center_y->element = ELEMENT_SELF; 101 | offset_center_y->variable = SIZE_CENTERY; 102 | offset_center_y->multiplier = 1.0; 103 | g->to.offsets_y = g_list_append(g->to.offsets_y, offset_center_y); 104 | offset_center_r = (Offset *)calloc(1, sizeof(Offset)); 105 | offset_center_r->constant = FALSE; 106 | offset_center_r->element = ELEMENT_SELF; 107 | offset_center_r->variable = SIZE_RADIUS; 108 | offset_center_r->multiplier = 1.0; 109 | g->to.offsets_r = g_list_append(g->to.offsets_r, offset_center_r); 110 | } 111 | } 112 | 113 | void cleanup_gradient(GradientClass *g) 114 | { 115 | g_list_free_full(g->extra_color_stops, free); 116 | g_list_free_full(g->from.offsets_x, free); 117 | g_list_free_full(g->from.offsets_y, free); 118 | g_list_free_full(g->from.offsets_r, free); 119 | g_list_free_full(g->to.offsets_x, free); 120 | g_list_free_full(g->to.offsets_y, free); 121 | g_list_free_full(g->to.offsets_r, free); 122 | bzero(g, sizeof(*g)); 123 | } 124 | -------------------------------------------------------------------------------- /src/util/gradient.h: -------------------------------------------------------------------------------- 1 | #ifndef GRADIENT_H 2 | #define GRADIENT_H 3 | 4 | #include 5 | #include 6 | 7 | #include "color.h" 8 | 9 | ////////////////////////////////////////////////////////////////////// 10 | // Gradient types read from config options, not associated to any area 11 | 12 | typedef enum GradientType { GRADIENT_VERTICAL = 0, GRADIENT_HORIZONTAL, GRADIENT_CENTERED } GradientType; 13 | 14 | typedef struct ColorStop { 15 | Color color; 16 | // offset in 0-1 17 | double offset; 18 | } ColorStop; 19 | 20 | typedef enum Element { ELEMENT_SELF = 0, ELEMENT_PARENT, ELEMENT_PANEL } Element; 21 | 22 | typedef enum SizeVariable { 23 | SIZE_WIDTH = 0, 24 | SIZE_HEIGHT, 25 | SIZE_RADIUS, 26 | SIZE_LEFT, 27 | SIZE_RIGHT, 28 | SIZE_TOP, 29 | SIZE_BOTTOM, 30 | SIZE_CENTERX, 31 | SIZE_CENTERY 32 | } SizeVariable; 33 | 34 | typedef struct Offset { 35 | gboolean constant; 36 | // if constant == true 37 | double constant_value; 38 | // else 39 | Element element; 40 | SizeVariable variable; 41 | double multiplier; 42 | } Offset; 43 | 44 | typedef struct ControlPoint { 45 | // Each element is an Offset 46 | GList *offsets_x; 47 | GList *offsets_y; 48 | // Defined only for radial gradients 49 | GList *offsets_r; 50 | } ControlPoint; 51 | 52 | typedef struct GradientClass { 53 | GradientType type; 54 | Color start_color; 55 | Color end_color; 56 | // Each element is a ColorStop 57 | GList *extra_color_stops; 58 | ControlPoint from; 59 | ControlPoint to; 60 | } GradientClass; 61 | 62 | GradientType gradient_type_from_string(const char *str); 63 | void init_gradient(GradientClass *g, GradientType type); 64 | void cleanup_gradient(GradientClass *g); 65 | 66 | ///////////////////////////////////////// 67 | // Gradient instances associated to Areas 68 | 69 | struct Area; 70 | 71 | typedef struct GradientInstance { 72 | GradientClass *gradient_class; 73 | struct Area *area; 74 | cairo_pattern_t *pattern; 75 | } GradientInstance; 76 | 77 | extern gboolean debug_gradients; 78 | 79 | #endif // GRADIENT_H 80 | -------------------------------------------------------------------------------- /src/util/print.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "print.h" 4 | 5 | int print_uchar(unsigned char v) 6 | { 7 | return printf("%u", v); 8 | } 9 | 10 | int print_char(char v) 11 | { 12 | return printf("%c", v); 13 | } 14 | 15 | int print_short(short v) 16 | { 17 | return printf("%d", v); 18 | } 19 | 20 | int print_ushort(unsigned short v) 21 | { 22 | return printf("%u", v); 23 | } 24 | 25 | int print_int(int v) 26 | { 27 | return printf("%d", v); 28 | } 29 | 30 | int print_uint(unsigned v) 31 | { 32 | return printf("%u", v); 33 | } 34 | 35 | int print_long(long v) 36 | { 37 | return printf("%ld", v); 38 | } 39 | 40 | int print_ulong(unsigned long v) 41 | { 42 | return printf("%lu", v); 43 | } 44 | 45 | int print_long_long(long long v) 46 | { 47 | return printf("%lld", v); 48 | } 49 | 50 | int print_ulong_long(unsigned long long v) 51 | { 52 | return printf("%llu", v); 53 | } 54 | 55 | int print_float(float v) 56 | { 57 | return printf("%f", (double)v); 58 | } 59 | 60 | int print_double(double v) 61 | { 62 | return printf("%f", v); 63 | } 64 | 65 | int print_long_double(long double v) 66 | { 67 | return printf("%Lf", v); 68 | } 69 | 70 | int print_string(char *s) 71 | { 72 | return printf("%s", s); 73 | } 74 | 75 | int print_pointer(void *v) 76 | { 77 | return printf("%p", v); 78 | } 79 | 80 | int print_unknown() 81 | { 82 | return printf("(variable of unknown type)"); 83 | } 84 | -------------------------------------------------------------------------------- /src/util/print.h: -------------------------------------------------------------------------------- 1 | #ifndef PRINT_H 2 | #define PRINT_H 3 | 4 | #ifdef HAS_GENERIC 5 | 6 | int print_uchar(unsigned char v); 7 | 8 | int print_char(char v); 9 | 10 | int print_short(short v); 11 | 12 | int print_ushort(unsigned short v); 13 | 14 | int print_int(int v); 15 | 16 | int print_uint(unsigned v); 17 | 18 | int print_long(long v); 19 | 20 | int print_ulong(unsigned long v); 21 | 22 | int print_long_long(long long v); 23 | 24 | int print_ulong_long(unsigned long long v); 25 | 26 | int print_float(float v); 27 | 28 | int print_double(double v); 29 | 30 | int print_long_double(long double v); 31 | 32 | int print_string(char *s); 33 | 34 | int print_pointer(void *v); 35 | 36 | int print_unknown(); 37 | 38 | #define print(x) \ 39 | _Generic((x), \ 40 | unsigned char: print_uchar, \ 41 | char: print_char, \ 42 | short int: print_short, \ 43 | unsigned short int: print_ushort, \ 44 | int: print_int, \ 45 | unsigned int: print_uint, \ 46 | long int: print_long, \ 47 | unsigned long int: print_ulong, \ 48 | long long int: print_long_long, \ 49 | unsigned long long int: print_ulong_long, \ 50 | float: print_float, \ 51 | double: print_double, \ 52 | long double: print_long_double, \ 53 | char *: print_string, \ 54 | void *: print_pointer, \ 55 | default : print_unknown)(x) 56 | 57 | #else 58 | #define print(...) printf("Omitted, the compiler does not support C11 generics.\n") 59 | #endif 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /src/util/signals.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #ifndef TINT2CONF 5 | #ifdef HAVE_SN 6 | #include 7 | #endif 8 | #endif 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | #include "common.h" 16 | #include "panel.h" 17 | #include "launcher.h" 18 | #include "server.h" 19 | #include "signals.h" 20 | 21 | static sig_atomic_t signal_pending; 22 | 23 | void signal_handler(int sig) 24 | { 25 | // signal handler is light as it should be 26 | signal_pending = sig; 27 | } 28 | 29 | void reset_signals() 30 | { 31 | for (int sig = 1; sig < 32; sig++) { 32 | signal(sig, SIG_DFL); 33 | } 34 | sigset_t signal_set; 35 | sigemptyset(&signal_set); 36 | sigprocmask(SIG_SETMASK, &signal_set, NULL); 37 | } 38 | 39 | #ifndef TINT2CONF 40 | void init_signals() 41 | { 42 | // Set signal handlers 43 | signal_pending = 0; 44 | 45 | reset_signals(); 46 | 47 | struct sigaction sa_chld = {.sa_handler = SIG_IGN}; 48 | sigaction(SIGCHLD, &sa_chld, 0); 49 | 50 | struct sigaction sa = {.sa_handler = signal_handler, .sa_flags = SA_RESTART}; 51 | sigaction(SIGUSR1, &sa, 0); 52 | sigaction(SIGUSR2, &sa, 0); 53 | sigaction(SIGINT, &sa, 0); 54 | sigaction(SIGTERM, &sa, 0); 55 | sigaction(SIGHUP, &sa, 0); 56 | 57 | #ifdef BACKTRACE_ON_SIGNAL 58 | struct sigaction sa_crash = {.sa_handler = crash_handler}; 59 | sigaction(SIGSEGV, &sa_crash, 0); 60 | sigaction(SIGFPE, &sa_crash, 0); 61 | sigaction(SIGPIPE, &sa_crash, 0); 62 | sigaction(SIGBUS, &sa_crash, 0); 63 | sigaction(SIGABRT, &sa_crash, 0); 64 | sigaction(SIGSYS, &sa_crash, 0); 65 | #endif 66 | } 67 | 68 | #ifdef BACKTRACE_ON_SIGNAL 69 | void crash_handler(int sig) 70 | { 71 | handle_crash(signal_name(sig)); 72 | struct sigaction sa = {.sa_handler = SIG_DFL}; 73 | sigaction(sig, &sa, 0); 74 | raise(sig); 75 | } 76 | #endif 77 | 78 | int sigchild_pipe_valid = FALSE; 79 | int sigchild_pipe[2]; 80 | 81 | static void sigchld_handler(int sig) 82 | { 83 | if (!sigchild_pipe_valid) 84 | return; 85 | int savedErrno = errno; 86 | ssize_t unused = write(sigchild_pipe[1], "x", 1); 87 | (void)unused; 88 | fsync(sigchild_pipe[1]); 89 | errno = savedErrno; 90 | } 91 | 92 | void sigchld_handler_async() 93 | { 94 | // Wait for all dead processes 95 | pid_t pid; 96 | int status; 97 | while ((pid = waitpid(-1, &status, WNOHANG)) != -1 && pid != 0) { 98 | #ifdef HAVE_SN 99 | if (startup_notifications) { 100 | SnLauncherContext *ctx = (SnLauncherContext *)g_tree_lookup(server.pids, GINT_TO_POINTER(pid)); 101 | if (ctx) { 102 | g_tree_remove(server.pids, GINT_TO_POINTER(pid)); 103 | sn_launcher_context_complete(ctx); 104 | sn_launcher_context_unref(ctx); 105 | } 106 | } 107 | #endif 108 | for (GList *l = panel_config.execp_list; l; l = l->next) { 109 | Execp *execp = (Execp *)l->data; 110 | if (g_tree_lookup(execp->backend->cmd_pids, GINT_TO_POINTER(pid))) 111 | execp_cmd_completed(execp, pid); 112 | } 113 | } 114 | } 115 | 116 | void handle_sigchld_events() 117 | { 118 | if (sigchild_pipe_valid) { 119 | char buffer[1]; 120 | while (read(sigchild_pipe[0], buffer, sizeof(buffer)) > 0) { 121 | sigchld_handler_async(); 122 | } 123 | } 124 | } 125 | 126 | void init_signals_postconfig() 127 | { 128 | gboolean need_sigchld = FALSE; 129 | #ifdef HAVE_SN 130 | // Initialize startup-notification 131 | if (startup_notifications) { 132 | server.sn_display = sn_display_new(server.display, error_trap_push, error_trap_pop); 133 | server.pids = g_tree_new(cmp_ptr); 134 | need_sigchld = TRUE; 135 | } 136 | #endif // HAVE_SN 137 | if (panel_config.execp_list) 138 | need_sigchld = TRUE; 139 | 140 | if (need_sigchld) { 141 | // Setup a handler for child termination 142 | if (pipe(sigchild_pipe) != 0) { 143 | fprintf(stderr, "tint2: Creating pipe failed.\n"); 144 | } else { 145 | fcntl(sigchild_pipe[0], F_SETFL, O_NONBLOCK | fcntl(sigchild_pipe[0], F_GETFL)); 146 | fcntl(sigchild_pipe[1], F_SETFL, O_NONBLOCK | fcntl(sigchild_pipe[1], F_GETFL)); 147 | sigchild_pipe_valid = 1; 148 | struct sigaction act = {.sa_handler = sigchld_handler, .sa_flags = SA_RESTART}; 149 | if (sigaction(SIGCHLD, &act, 0)) { 150 | perror("sigaction"); 151 | } 152 | } 153 | } 154 | } 155 | 156 | void emit_self_restart(const char *reason) 157 | { 158 | fprintf(stderr, 159 | YELLOW "%s %d: triggering tint2 restart, reason: %s" RESET "\n", 160 | __FILE__, 161 | __LINE__, 162 | reason); 163 | signal_pending = SIGUSR1; 164 | } 165 | 166 | int get_signal_pending() 167 | { 168 | return signal_pending; 169 | } 170 | #endif 171 | -------------------------------------------------------------------------------- /src/util/signals.h: -------------------------------------------------------------------------------- 1 | #ifndef SIGNALS_H 2 | #define SIGNALS_H 3 | 4 | void init_signals(); 5 | void init_signals_postconfig(); 6 | void emit_self_restart(const char *reason); 7 | int get_signal_pending(); 8 | void reset_signals(); 9 | 10 | void handle_sigchld_events(); 11 | 12 | extern int sigchild_pipe_valid; 13 | extern int sigchild_pipe[2]; 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /src/util/strlcat.c: -------------------------------------------------------------------------------- 1 | /* $NetBSD: strlcat.c,v 1.4 2005/05/16 06:55:48 lukem Exp $ */ 2 | /* from NetBSD: strlcat.c,v 1.16 2003/10/27 00:12:42 lukem Exp */ 3 | /* from OpenBSD: strlcat.c,v 1.10 2003/04/12 21:56:39 millert Exp */ 4 | 5 | /* 6 | * Copyright (c) 1998 Todd C. Miller 7 | * 8 | * Permission to use, copy, modify, and distribute this software for any 9 | * purpose with or without fee is hereby granted, provided that the above 10 | * copyright notice and this permission notice appear in all copies. 11 | * 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND TODD C. MILLER DISCLAIMS ALL 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES 14 | * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL TODD C. MILLER BE LIABLE 15 | * FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 16 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION 17 | * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 18 | * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 19 | */ 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | #include "strlcat.h" 26 | 27 | /* 28 | * Appends src to string dst of size siz (unlike strncat, siz is the 29 | * full size of dst, not space left). At most siz-1 characters 30 | * will be copied. Always NUL terminates (unless siz <= strlen(dst)). 31 | * Returns strlen(src) + MIN(siz, strlen(initial dst)). 32 | * If retval >= siz, truncation occurred. 33 | */ 34 | size_t 35 | strlcat(char *dst, const char *src, size_t siz) 36 | { 37 | char *d = dst; 38 | const char *s = src; 39 | size_t n = siz; 40 | size_t dlen; 41 | 42 | /* Find the end of dst and adjust bytes left but don't go past end */ 43 | while (n-- != 0 && *d != '\0') 44 | d++; 45 | dlen = d - dst; 46 | n = siz - dlen; 47 | 48 | if (n == 0) 49 | return(dlen + strlen(s)); 50 | while (*s != '\0') { 51 | if (n != 1) { 52 | *d++ = *s; 53 | n--; 54 | } 55 | s++; 56 | } 57 | *d = '\0'; 58 | 59 | return(dlen + (s - src)); /* count does not include NUL */ 60 | } 61 | -------------------------------------------------------------------------------- /src/util/strlcat.h: -------------------------------------------------------------------------------- 1 | #ifndef STRLCAT_H 2 | #define STRLCAT_H 3 | 4 | #include 5 | #include 6 | 7 | /* 8 | * Appends src to string dst of size siz (unlike strncat, siz is the 9 | * full size of dst, not space left). At most siz-1 characters 10 | * will be copied. Always NUL terminates (unless siz <= strlen(dst)). 11 | * Returns strlen(src) + MIN(siz, strlen(initial dst)). 12 | * If retval >= siz, truncation occurred. 13 | */ 14 | size_t strlcat(char *dst, const char *src, size_t siz); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /src/util/strnatcmp.c: -------------------------------------------------------------------------------- 1 | /* -*- mode: c; c-file-style: "k&r" -*- 2 | 3 | strnatcmp.c -- Perform 'natural order' comparisons of strings in C. 4 | Copyright (C) 2000, 2004 by Martin Pool 5 | 6 | This software is provided 'as-is', without any express or implied 7 | warranty. In no event will the authors be held liable for any damages 8 | arising from the use of this software. 9 | 10 | Permission is granted to anyone to use this software for any purpose, 11 | including commercial applications, and to alter it and redistribute it 12 | freely, subject to the following restrictions: 13 | 14 | 1. The origin of this software must not be misrepresented; you must not 15 | claim that you wrote the original software. If you use this software 16 | in a product, an acknowledgment in the product documentation would be 17 | appreciated but is not required. 18 | 2. Altered source versions must be plainly marked as such, and must not be 19 | misrepresented as being the original software. 20 | 3. This notice may not be removed or altered from any source distribution. 21 | */ 22 | 23 | /* partial change history: 24 | * 25 | * 2004-10-10 mbp: Lift out character type dependencies into macros. 26 | * 27 | * Eric Sosman pointed out that ctype functions take a parameter whose 28 | * value must be that of an unsigned int, even on platforms that have 29 | * negative chars in their default char type. 30 | */ 31 | 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | #include "strnatcmp.h" 38 | 39 | // Compare two right-aligned numbers: 40 | // The longest run of digits wins. That aside, the greatest 41 | // value wins, but we can't know that it will until we've scanned 42 | // both numbers to know that they have the same magnitude, so we 43 | // remember it in BIAS. 44 | static int compare_right(char const *a, char const *b) 45 | { 46 | int bias = 0; 47 | 48 | for (;; a++, b++) { 49 | if (!isdigit(*a) && !isdigit(*b)) 50 | return bias; 51 | else if (!isdigit(*a)) 52 | return -1; 53 | else if (!isdigit(*b)) 54 | return +1; 55 | else if (*a < *b) { 56 | if (!bias) 57 | bias = -1; 58 | } else if (*a > *b) { 59 | if (!bias) 60 | bias = +1; 61 | } else if (!*a && !*b) 62 | return bias; 63 | } 64 | 65 | return 0; 66 | } 67 | 68 | // Compare two left-aligned numbers: 69 | // The first to have a different value wins. 70 | static int compare_left(char const *a, char const *b) 71 | { 72 | for (;; a++, b++) { 73 | if (!isdigit(*a) && !isdigit(*b)) 74 | return 0; 75 | else if (!isdigit(*a)) 76 | return -1; 77 | else if (!isdigit(*b)) 78 | return +1; 79 | else if (*a < *b) 80 | return -1; 81 | else if (*a > *b) 82 | return +1; 83 | } 84 | 85 | return 0; 86 | } 87 | 88 | static int strnatcmp0(char const *a, char const *b, int ignore_case) 89 | { 90 | assert(a && b); 91 | 92 | int ai, bi; 93 | ai = bi = 0; 94 | while (1) { 95 | char ca = a[ai]; 96 | char cb = b[bi]; 97 | 98 | // Skip over leading spaces 99 | while (isspace(ca)) { 100 | ai++; 101 | ca = a[ai]; 102 | } 103 | 104 | while (isspace(cb)) { 105 | bi++; 106 | cb = b[bi]; 107 | } 108 | 109 | // Process run of digits 110 | if (isdigit(ca) && isdigit(cb)) { 111 | int fractional = (ca == '0' || cb == '0'); 112 | 113 | if (fractional) { 114 | int result = compare_left(a + ai, b + bi); 115 | if (result) 116 | return result; 117 | } else { 118 | int result = compare_right(a + ai, b + bi); 119 | if (result) 120 | return result; 121 | } 122 | } 123 | 124 | if (!ca && !cb) { 125 | // The strings compare the same. Perhaps the caller will want to call strcmp to break the tie. 126 | return 0; 127 | } 128 | 129 | if (ignore_case) { 130 | ca = toupper(ca); 131 | cb = toupper(cb); 132 | } 133 | 134 | if (ca < cb) 135 | return -1; 136 | else if (ca > cb) 137 | return +1; 138 | 139 | ai++; 140 | bi++; 141 | } 142 | } 143 | 144 | int strnatcmp(char const *a, char const *b) 145 | { 146 | return strnatcmp0(a, b, 0); 147 | } 148 | 149 | int strnatcasecmp(char const *a, char const *b) 150 | { 151 | return strnatcmp0(a, b, 1); 152 | } 153 | -------------------------------------------------------------------------------- /src/util/strnatcmp.h: -------------------------------------------------------------------------------- 1 | /* -*- mode: c; c-file-style: "k&r" -*- 2 | 3 | strnatcmp.c -- Perform 'natural order' comparisons of strings in C. 4 | Copyright (C) 2000, 2004 by Martin Pool 5 | 6 | This software is provided 'as-is', without any express or implied 7 | warranty. In no event will the authors be held liable for any damages 8 | arising from the use of this software. 9 | 10 | Permission is granted to anyone to use this software for any purpose, 11 | including commercial applications, and to alter it and redistribute it 12 | freely, subject to the following restrictions: 13 | 14 | 1. The origin of this software must not be misrepresented; you must not 15 | claim that you wrote the original software. If you use this software 16 | in a product, an acknowledgment in the product documentation would be 17 | appreciated but is not required. 18 | 2. Altered source versions must be plainly marked as such, and must not be 19 | misrepresented as being the original software. 20 | 3. This notice may not be removed or altered from any source distribution. 21 | */ 22 | 23 | // Compare, recognizing numeric strings. Case sensitive. 24 | int strnatcmp(char const *a, char const *b); 25 | 26 | // Compare, recognizing numeric strings. Case insensitive. 27 | int strnatcasecmp(char const *a, char const *b); 28 | -------------------------------------------------------------------------------- /src/util/test.h: -------------------------------------------------------------------------------- 1 | #ifndef TEST_H 2 | #define TEST_H 3 | 4 | #include "bool.h" 5 | #include "print.h" 6 | 7 | typedef void Test(Status *test_result_); 8 | 9 | void register_test_(Test *test, const char *name); 10 | 11 | #define TEST(name) \ 12 | void test_##name(Status *test_result_); \ 13 | __attribute__((constructor)) void test_register_##name() \ 14 | { \ 15 | register_test_(test_##name, #name); \ 16 | } \ 17 | void test_##name(Status *test_result_) 18 | 19 | void run_all_tests(bool verbose); 20 | 21 | #define FAIL_TEST_ \ 22 | *test_result_ = FAILURE; \ 23 | return; 24 | 25 | #define ASSERT(value) \ 26 | if (!(value)) { \ 27 | FAIL_TEST_ \ 28 | } 29 | 30 | #define ASSERT_EQUAL(a, b) \ 31 | if (!(a == b)) { \ 32 | printf("%s:%d: Assertion failed: %s == %s: ", __FILE__, __LINE__, #a, #b); \ 33 | print(a); \ 34 | printf(" != "); \ 35 | print(b); \ 36 | FAIL_TEST_ \ 37 | } 38 | 39 | #define ASSERT_DIFFERENT(a, b) \ 40 | if (a == b) { \ 41 | printf("%s:%d: Assertion failed: %s != %s: ", __FILE__, __LINE__, #a, #b); \ 42 | print(a); \ 43 | printf(" == "); \ 44 | print(b); \ 45 | FAIL_TEST_ \ 46 | } 47 | 48 | 49 | #define ASSERT_STR_EQUAL(a, b) \ 50 | if (strcmp(a, b) != 0) { \ 51 | printf("%s:%d: Assertion failed: %s == %s: ", __FILE__, __LINE__, #a, #b); \ 52 | print(a); \ 53 | printf(" != "); \ 54 | print(b); \ 55 | FAIL_TEST_ \ 56 | } 57 | 58 | #define ASSERT_STR_DIFFERENT(a, b) \ 59 | if (strcmp(a, b) == 0) { \ 60 | printf("%s:%d: Assertion failed: %s != %s: ", __FILE__, __LINE__, #a, #b); \ 61 | print(a); \ 62 | printf(" == "); \ 63 | print(b); \ 64 | FAIL_TEST_ \ 65 | } 66 | 67 | #define ASSERT_TRUE(value) ASSERT_EQUAL(value, 1) 68 | #define ASSERT_FALSE(value) ASSERT_EQUAL(value, 0) 69 | #define ASSERT_NULL(value) ASSERT_EQUAL(value, NULL) 70 | #define ASSERT_NON_NULL(value) ASSERT_DIFFERENT(value, NULL) 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /src/util/timer.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * 3 | * Copyright (C) 2009 Andreas.Fink (Andreas.Fink85@gmail.com) 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU General Public License version 2 7 | * as published by the Free Software Foundation. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, write to the Free Software 15 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 16 | **************************************************************************/ 17 | 18 | #ifndef TIMER_H 19 | #define TIMER_H 20 | 21 | #include 22 | #include 23 | #include 24 | #include "bool.h" 25 | 26 | extern bool warnings_for_timers; 27 | extern bool debug_timers; 28 | 29 | typedef void TimerCallback(void *arg); 30 | 31 | typedef struct { 32 | char name_[64]; 33 | bool enabled_; 34 | long long expiration_time_ms_; 35 | int period_ms_; 36 | TimerCallback *callback_; 37 | void *arg_; 38 | bool handled_; 39 | } Timer; 40 | 41 | #define DEFAULT_TIMER {"", 0, 0, 0, 0, 0, 0} 42 | 43 | #define INIT_TIMER(t) init_timer(&t, #t) 44 | 45 | // Initialize the timer module. 46 | void default_timers(); 47 | 48 | // Destroy the timer module. 49 | void cleanup_timers(); 50 | 51 | // Initialize a timer. Caller keeps ownership. 52 | void init_timer(Timer *timer, const char *name); 53 | 54 | // Destroy a timer. Does not free() the pointer. 55 | void destroy_timer(Timer *timer); 56 | 57 | // Modify a timer. 58 | void change_timer(Timer *timer, bool enabled, int delay_ms, int period_ms, TimerCallback *callback, void *arg); 59 | 60 | void stop_timer(Timer *timer); 61 | 62 | // Get the time duration to the next expiration time, or NULL if there is no active timer. 63 | // Do not free the pointer; it is harmless to change its contents. 64 | struct timeval *get_duration_to_next_timer_expiration(); 65 | 66 | // Trigger all expired timers, and reschedule them if they are periodic timers 67 | void handle_expired_timers(); 68 | 69 | // Time helper functions. 70 | 71 | // Returns -1 if t1 < t2, 0 if t1 == t2, 1 if t1 > t2 72 | gint compare_timespecs(const struct timespec *t1, const struct timespec *t2); 73 | 74 | struct timespec add_msec_to_timespec(struct timespec ts, int msec); 75 | 76 | // Returns the time difference in seconds between the current time and the last time this function was called. 77 | // At the first call returns zero. 78 | double profiling_get_time(); 79 | 80 | // Get current time in seconds, from an unspecified origin. 81 | double get_time(); 82 | 83 | #endif // TIMER_H 84 | -------------------------------------------------------------------------------- /src/util/tracing.c: -------------------------------------------------------------------------------- 1 | #include "timer.h" 2 | 3 | #ifdef HAVE_TRACING 4 | 5 | #ifdef ENABLE_EXECINFO 6 | #include 7 | #endif 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #define GREEN "\033[1;32m" 14 | #define YELLOW "\033[1;33m" 15 | #define RED "\033[1;31m" 16 | #define BLUE "\033[1;34m" 17 | #define RESET "\033[0m" 18 | 19 | static GList *tracing_events = NULL; 20 | static sig_atomic_t tracing = FALSE; 21 | 22 | typedef struct TracingEvent { 23 | void *address; 24 | void *caller; 25 | double time; 26 | gboolean enter; 27 | } TracingEvent; 28 | 29 | void __attribute__ ((constructor)) init_tracing() 30 | { 31 | tracing_events = NULL; 32 | tracing = FALSE; 33 | } 34 | 35 | void cleanup_tracing() 36 | { 37 | g_list_free_full(tracing_events, free); 38 | tracing_events = NULL; 39 | tracing = FALSE; 40 | } 41 | 42 | char *addr2name(void *func) 43 | { 44 | #ifdef ENABLE_EXECINFO 45 | void *array[1]; 46 | array[0] = func; 47 | char **strings = backtrace_symbols(array, 1); 48 | char *result = strdup(strings[0] ? strings[0] : "??"); 49 | free(strings); 50 | return result; 51 | #else 52 | const size_t buf_size = 32; 53 | char *result = (char*) calloc(buf_size, 1); 54 | snprintf(result, buf_size, "%p", func); 55 | return result; 56 | #endif 57 | } 58 | 59 | void add_tracing_event(void *func, void *caller, gboolean enter) 60 | { 61 | TracingEvent *entry = (TracingEvent *)calloc(sizeof(TracingEvent), 1); 62 | entry->address = func; 63 | entry->caller = caller; 64 | entry->time = get_time(); 65 | entry->enter = enter; 66 | tracing_events = g_list_append(tracing_events, entry); 67 | } 68 | 69 | void start_tracing(void *root) 70 | { 71 | if (tracing_events) 72 | cleanup_tracing(); 73 | add_tracing_event(root, NULL, TRUE); 74 | tracing = TRUE; 75 | } 76 | 77 | void stop_tracing() 78 | { 79 | tracing = FALSE; 80 | } 81 | 82 | void __cyg_profile_func_enter(void *func, void *caller) 83 | { 84 | if (tracing) 85 | add_tracing_event(func, caller, TRUE); 86 | } 87 | 88 | void __cyg_profile_func_exit(void *func, void *caller) 89 | { 90 | if (tracing) 91 | add_tracing_event(func, caller, FALSE); 92 | } 93 | 94 | void print_tracing_events() 95 | { 96 | GList *stack = NULL; 97 | int depth = 0; 98 | double now = get_time(); 99 | for (GList *i = tracing_events; i; i = i->next) { 100 | TracingEvent *e = (TracingEvent *)i->data; 101 | if (e->enter) { 102 | // Push a new function on the stack 103 | for (int d = 0; d < depth; d++) 104 | fprintf(stderr, "tint2: "); 105 | char *name = addr2name(e->address); 106 | char *caller = addr2name(e->caller); 107 | fprintf(stderr, 108 | "%s called from %s\n", 109 | name, 110 | caller); 111 | stack = g_list_append(stack, e); 112 | depth++; 113 | } else { 114 | // Pop a function from the stack, if matching, and print 115 | if (stack) { 116 | TracingEvent *old = (TracingEvent *)g_list_last(stack)->data; 117 | if (old->address == e->address) { 118 | depth--; 119 | for (int d = 0; d < depth; d++) 120 | fprintf(stderr, "tint2: "); 121 | char *name = addr2name(e->address); 122 | double duration = (e->time - old->time) * 1.0e3; 123 | fprintf(stderr, 124 | "-- %s exited after %.1f ms", 125 | name, 126 | duration); 127 | if (duration >= 1.0) { 128 | fprintf(stderr, YELLOW "tint2: "); 129 | for (int d = 0; d < duration; d++) { 130 | fprintf(stderr, "tint2: #"); 131 | } 132 | fprintf(stderr, RESET); 133 | } 134 | fprintf(stderr, "tint2: \n"); 135 | free(name); 136 | stack = g_list_delete_link(stack, g_list_last(stack)); 137 | } 138 | } 139 | } 140 | } 141 | while (stack) { 142 | TracingEvent *old = (TracingEvent *)g_list_last(stack)->data; 143 | depth--; 144 | for (int d = 0; d < depth; d++) 145 | fprintf(stderr, "tint2: "); 146 | char *name = addr2name(old->address); 147 | double duration = (now - old->time) * 1.0e3; 148 | fprintf(stderr, 149 | "-- %s exited after %.1f ms", 150 | name, 151 | duration); 152 | if (duration >= 1.0) { 153 | fprintf(stderr, YELLOW "tint2: "); 154 | for (int d = 0; d < duration; d++) { 155 | fprintf(stderr, "tint2: #"); 156 | } 157 | fprintf(stderr, RESET); 158 | } 159 | fprintf(stderr, "tint2: \n"); 160 | free(name); 161 | stack = g_list_delete_link(stack, g_list_last(stack)); 162 | } 163 | } 164 | 165 | #endif 166 | -------------------------------------------------------------------------------- /src/util/tracing.h: -------------------------------------------------------------------------------- 1 | #ifndef TRACING_H 2 | #define TRACING_H 3 | 4 | #ifdef HAVE_TRACING 5 | 6 | void init_tracing(); 7 | void cleanup_tracing(); 8 | 9 | void start_tracing(void *root); 10 | void stop_tracing(); 11 | void print_tracing_events(); 12 | 13 | #endif 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /src/util/uevent.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * Linux Kernel uevent handler 4 | * 5 | * Copyright (C) 2015 Sebastian Reichel 6 | * 7 | * This program is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU General Public License version 2 9 | * or any later version as published by the Free Software Foundation. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | **************************************************************************/ 19 | 20 | #ifndef UEVENT_H 21 | #define UEVENT_H 22 | 23 | #include 24 | 25 | enum uevent_action { 26 | UEVENT_UNKNOWN = 0x01, 27 | UEVENT_ADD = 0x02, 28 | UEVENT_REMOVE = 0x04, 29 | UEVENT_CHANGE = 0x08, 30 | }; 31 | 32 | struct uevent_parameter { 33 | char *key; 34 | char *val; 35 | }; 36 | 37 | struct uevent { 38 | char *path; 39 | enum uevent_action action; 40 | int sequence; 41 | char *subsystem; 42 | GList *params; 43 | }; 44 | 45 | struct uevent_notify { 46 | int action; /* bitfield */ 47 | char *subsystem; /* NULL => any */ 48 | void *userdata; 49 | 50 | void (*cb)(struct uevent *e, void *userdata); 51 | }; 52 | 53 | extern int uevent_fd; 54 | 55 | #if ENABLE_UEVENT 56 | int uevent_init(); 57 | void uevent_cleanup(); 58 | void uevent_handler(); 59 | 60 | void uevent_register_notifier(struct uevent_notify *nb); 61 | void uevent_unregister_notifier(struct uevent_notify *nb); 62 | #else 63 | static inline int uevent_init() 64 | { 65 | return -1; 66 | } 67 | 68 | static inline void uevent_cleanup() 69 | { 70 | } 71 | 72 | static inline void uevent_handler() 73 | { 74 | } 75 | 76 | static inline void uevent_register_notifier(struct uevent_notify *nb) 77 | { 78 | } 79 | 80 | static inline void uevent_unregister_notifier(struct uevent_notify *nb) 81 | { 82 | } 83 | #endif 84 | 85 | #endif 86 | -------------------------------------------------------------------------------- /src/util/window.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * window : 3 | * - 4 | * 5 | * Check COPYING file for Copyright 6 | * 7 | **************************************************************************/ 8 | 9 | #ifndef WINDOW_H 10 | #define WINDOW_H 11 | 12 | #include 13 | #include 14 | #include 15 | 16 | Window get_active_window(); 17 | 18 | gboolean window_is_iconified(Window win); 19 | gboolean window_is_urgent(Window win); 20 | gboolean window_is_hidden(Window win); 21 | gboolean window_is_active(Window win); 22 | gboolean window_is_skip_taskbar(Window win); 23 | int get_window_desktop(Window win); 24 | int get_window_monitor(Window win); 25 | 26 | void activate_window(Window win); 27 | void close_window(Window win); 28 | gboolean get_window_coordinates(Window win, int *x, int *y, int *w, int *h); 29 | void toggle_window_maximized(Window win); 30 | void toggle_window_shade(Window win); 31 | void change_window_desktop(Window win, int desktop); 32 | 33 | int get_icon_count(gulong *data, int num); 34 | gulong *get_best_icon(gulong *data, int icon_count, int num, int *iw, int *ih, int best_icon_size); 35 | 36 | char *get_window_name(Window win); 37 | cairo_surface_t *get_window_thumbnail(Window win, int size); 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/bat.txt: -------------------------------------------------------------------------------- 1 | AC0/type:Mains 2 | AC0/power/control:auto 3 | AC0/power/wakeup_prevent_sleep_time_ms:0 4 | AC0/power/async:disabled 5 | AC0/power/wakeup_abort_count:0 6 | AC0/power/wakeup_active:0 7 | AC0/power/wakeup_total_time_ms:0 8 | AC0/power/wakeup_active_count:4 9 | AC0/power/runtime_enabled:disabled 10 | AC0/power/runtime_active_kids:0 11 | AC0/power/runtime_active_time:0 12 | AC0/power/wakeup_max_time_ms:0 13 | AC0/power/wakeup_count:4 14 | AC0/power/wakeup_last_time_ms:18773802 15 | AC0/power/wakeup:enabled 16 | AC0/power/runtime_status:unsupported 17 | AC0/power/runtime_usage:0 18 | AC0/power/wakeup_expire_count:0 19 | AC0/power/runtime_suspended_time:0 20 | AC0/online:1 21 | AC0/uevent:POWER_SUPPLY_NAME=AC0 22 | AC0/uevent:POWER_SUPPLY_ONLINE=1 23 | BAT0/temp:26 24 | BAT0/type:Battery 25 | BAT0/power/control:auto 26 | BAT0/power/wakeup_prevent_sleep_time_ms:0 27 | BAT0/power/async:disabled 28 | BAT0/power/wakeup_abort_count:0 29 | BAT0/power/wakeup_active:0 30 | BAT0/power/wakeup_total_time_ms:0 31 | BAT0/power/wakeup_active_count:4 32 | BAT0/power/runtime_enabled:disabled 33 | BAT0/power/runtime_active_kids:0 34 | BAT0/power/runtime_active_time:0 35 | BAT0/power/wakeup_max_time_ms:0 36 | BAT0/power/wakeup_count:4 37 | BAT0/power/wakeup_last_time_ms:18773802 38 | BAT0/power/wakeup:enabled 39 | BAT0/power/runtime_status:unsupported 40 | BAT0/power/runtime_usage:0 41 | BAT0/power/wakeup_expire_count:0 42 | BAT0/power/runtime_suspended_time:0 43 | BAT0/charge_full_design:100 44 | BAT0/charge_now:17 45 | BAT0/charge_full:100 46 | BAT0/charge_type:Fast 47 | BAT0/capacity:17 48 | BAT0/health:Good 49 | BAT0/capacity_level:Critical 50 | BAT0/status:Charging 51 | BAT0/voltage_now:3300 52 | BAT0/uevent:POWER_SUPPLY_NAME=BAT0 53 | BAT0/uevent:POWER_SUPPLY_STATUS=Charging 54 | BAT0/uevent:POWER_SUPPLY_CHARGE_TYPE=Fast 55 | BAT0/uevent:POWER_SUPPLY_HEALTH=Good 56 | BAT0/uevent:POWER_SUPPLY_PRESENT=1 57 | BAT0/uevent:POWER_SUPPLY_TECHNOLOGY=Li-ion 58 | BAT0/uevent:POWER_SUPPLY_CHARGE_FULL_DESIGN=100 59 | BAT0/uevent:POWER_SUPPLY_CHARGE_FULL=100 60 | BAT0/uevent:POWER_SUPPLY_CHARGE_NOW=17 61 | BAT0/uevent:POWER_SUPPLY_CAPACITY=17 62 | BAT0/uevent:POWER_SUPPLY_CAPACITY_LEVEL=Critical 63 | BAT0/uevent:POWER_SUPPLY_TIME_TO_EMPTY_AVG=612 64 | BAT0/uevent:POWER_SUPPLY_TIME_TO_FULL_NOW=612 65 | BAT0/uevent:POWER_SUPPLY_MODEL_NAME=Fake battery 1 66 | BAT0/uevent:POWER_SUPPLY_MANUFACTURER=Linux 67 | BAT0/uevent:POWER_SUPPLY_SERIAL_NUMBER=12345678 68 | BAT0/uevent:POWER_SUPPLY_TEMP=26 69 | BAT0/uevent:POWER_SUPPLY_VOLTAGE_NOW=3300 70 | BAT0/model_name:Fake battery 1 71 | BAT0/manufacturer:Linux 72 | BAT0/technology:Li-ion 73 | BAT0/time_to_full_now:612 74 | BAT0/time_to_empty_avg:612 75 | BAT0/serial_number:12345678 76 | BAT0/present:1 77 | BAT1/temp:26 78 | BAT1/type:Battery 79 | BAT1/power/control:auto 80 | BAT1/power/wakeup_prevent_sleep_time_ms:0 81 | BAT1/power/async:disabled 82 | BAT1/power/wakeup_abort_count:0 83 | BAT1/power/wakeup_active:0 84 | BAT1/power/wakeup_total_time_ms:0 85 | BAT1/power/wakeup_active_count:4 86 | BAT1/power/runtime_enabled:disabled 87 | BAT1/power/runtime_active_kids:0 88 | BAT1/power/runtime_active_time:0 89 | BAT1/power/wakeup_max_time_ms:0 90 | BAT1/power/wakeup_count:4 91 | BAT1/power/wakeup_last_time_ms:18773802 92 | BAT1/power/wakeup:enabled 93 | BAT1/power/runtime_status:unsupported 94 | BAT1/power/runtime_usage:0 95 | BAT1/power/wakeup_expire_count:0 96 | BAT1/power/runtime_suspended_time:0 97 | BAT1/charge_full_design:100 98 | BAT1/charge_now:7 99 | BAT1/charge_full:100 100 | BAT1/charge_type:Fast 101 | BAT1/capacity:7 102 | BAT1/health:Good 103 | BAT1/capacity_level:Low 104 | BAT1/status:Charging 105 | BAT1/voltage_now:3300 106 | BAT1/uevent:POWER_SUPPLY_NAME=BAT1 107 | BAT1/uevent:POWER_SUPPLY_STATUS=Charging 108 | BAT1/uevent:POWER_SUPPLY_CHARGE_TYPE=Fast 109 | BAT1/uevent:POWER_SUPPLY_HEALTH=Good 110 | BAT1/uevent:POWER_SUPPLY_PRESENT=1 111 | BAT1/uevent:POWER_SUPPLY_TECHNOLOGY=Li-ion 112 | BAT1/uevent:POWER_SUPPLY_CHARGE_FULL_DESIGN=100 113 | BAT1/uevent:POWER_SUPPLY_CHARGE_FULL=100 114 | BAT1/uevent:POWER_SUPPLY_CHARGE_NOW=7 115 | BAT1/uevent:POWER_SUPPLY_CAPACITY=7 116 | BAT1/uevent:POWER_SUPPLY_CAPACITY_LEVEL=Low 117 | BAT1/uevent:POWER_SUPPLY_TIME_TO_EMPTY_AVG=252 118 | BAT1/uevent:POWER_SUPPLY_TIME_TO_FULL_NOW=252 119 | BAT1/uevent:POWER_SUPPLY_MODEL_NAME=Fake battery 2 120 | BAT1/uevent:POWER_SUPPLY_MANUFACTURER=Linux 121 | BAT1/uevent:POWER_SUPPLY_SERIAL_NUMBER=12345678 122 | BAT1/uevent:POWER_SUPPLY_TEMP=26 123 | BAT1/uevent:POWER_SUPPLY_VOLTAGE_NOW=3300 124 | BAT1/model_name:Fake battery 2 125 | BAT1/manufacturer:Linux 126 | BAT1/technology:Li-ion 127 | BAT1/time_to_full_now:252 128 | BAT1/time_to_empty_avg:252 129 | BAT1/serial_number:12345678 130 | BAT1/present:1 131 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/AC0/online: -------------------------------------------------------------------------------- 1 | 1 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/AC0/power/async: -------------------------------------------------------------------------------- 1 | disabled 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/AC0/power/control: -------------------------------------------------------------------------------- 1 | auto 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/AC0/power/runtime_active_kids: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/AC0/power/runtime_active_time: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/AC0/power/runtime_enabled: -------------------------------------------------------------------------------- 1 | disabled 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/AC0/power/runtime_status: -------------------------------------------------------------------------------- 1 | unsupported 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/AC0/power/runtime_suspended_time: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/AC0/power/runtime_usage: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/AC0/power/wakeup: -------------------------------------------------------------------------------- 1 | enabled 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/AC0/power/wakeup_abort_count: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/AC0/power/wakeup_active: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/AC0/power/wakeup_active_count: -------------------------------------------------------------------------------- 1 | 4 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/AC0/power/wakeup_count: -------------------------------------------------------------------------------- 1 | 4 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/AC0/power/wakeup_expire_count: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/AC0/power/wakeup_last_time_ms: -------------------------------------------------------------------------------- 1 | 18773802 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/AC0/power/wakeup_max_time_ms: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/AC0/power/wakeup_prevent_sleep_time_ms: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/AC0/power/wakeup_total_time_ms: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/AC0/type: -------------------------------------------------------------------------------- 1 | Mains 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/AC0/uevent: -------------------------------------------------------------------------------- 1 | POWER_SUPPLY_ONLINE=1 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT0/capacity: -------------------------------------------------------------------------------- 1 | 17 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT0/capacity_level: -------------------------------------------------------------------------------- 1 | Critical 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT0/charge_full: -------------------------------------------------------------------------------- 1 | 100 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT0/charge_full_design: -------------------------------------------------------------------------------- 1 | 100 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT0/charge_now: -------------------------------------------------------------------------------- 1 | 17 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT0/charge_type: -------------------------------------------------------------------------------- 1 | Fast 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT0/health: -------------------------------------------------------------------------------- 1 | Good 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT0/manufacturer: -------------------------------------------------------------------------------- 1 | Linux 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT0/model_name: -------------------------------------------------------------------------------- 1 | Fake battery 1 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT0/power/async: -------------------------------------------------------------------------------- 1 | disabled 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT0/power/control: -------------------------------------------------------------------------------- 1 | auto 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT0/power/runtime_active_kids: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT0/power/runtime_active_time: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT0/power/runtime_enabled: -------------------------------------------------------------------------------- 1 | disabled 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT0/power/runtime_status: -------------------------------------------------------------------------------- 1 | unsupported 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT0/power/runtime_suspended_time: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT0/power/runtime_usage: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT0/power/wakeup: -------------------------------------------------------------------------------- 1 | enabled 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT0/power/wakeup_abort_count: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT0/power/wakeup_active: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT0/power/wakeup_active_count: -------------------------------------------------------------------------------- 1 | 4 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT0/power/wakeup_count: -------------------------------------------------------------------------------- 1 | 4 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT0/power/wakeup_expire_count: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT0/power/wakeup_last_time_ms: -------------------------------------------------------------------------------- 1 | 18773802 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT0/power/wakeup_max_time_ms: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT0/power/wakeup_prevent_sleep_time_ms: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT0/power/wakeup_total_time_ms: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT0/present: -------------------------------------------------------------------------------- 1 | 1 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT0/serial_number: -------------------------------------------------------------------------------- 1 | 12345678 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT0/status: -------------------------------------------------------------------------------- 1 | Charging 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT0/technology: -------------------------------------------------------------------------------- 1 | Li-ion 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT0/temp: -------------------------------------------------------------------------------- 1 | 26 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT0/time_to_empty_avg: -------------------------------------------------------------------------------- 1 | 612 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT0/time_to_full_now: -------------------------------------------------------------------------------- 1 | 612 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT0/type: -------------------------------------------------------------------------------- 1 | Battery 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT0/uevent: -------------------------------------------------------------------------------- 1 | POWER_SUPPLY_VOLTAGE_NOW=3300 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT0/voltage_now: -------------------------------------------------------------------------------- 1 | 3300 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT1/capacity: -------------------------------------------------------------------------------- 1 | 7 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT1/capacity_level: -------------------------------------------------------------------------------- 1 | Low 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT1/charge_full: -------------------------------------------------------------------------------- 1 | 100 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT1/charge_full_design: -------------------------------------------------------------------------------- 1 | 100 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT1/charge_now: -------------------------------------------------------------------------------- 1 | 7 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT1/charge_type: -------------------------------------------------------------------------------- 1 | Fast 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT1/health: -------------------------------------------------------------------------------- 1 | Good 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT1/manufacturer: -------------------------------------------------------------------------------- 1 | Linux 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT1/model_name: -------------------------------------------------------------------------------- 1 | Fake battery 2 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT1/power/async: -------------------------------------------------------------------------------- 1 | disabled 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT1/power/control: -------------------------------------------------------------------------------- 1 | auto 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT1/power/runtime_active_kids: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT1/power/runtime_active_time: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT1/power/runtime_enabled: -------------------------------------------------------------------------------- 1 | disabled 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT1/power/runtime_status: -------------------------------------------------------------------------------- 1 | unsupported 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT1/power/runtime_suspended_time: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT1/power/runtime_usage: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT1/power/wakeup: -------------------------------------------------------------------------------- 1 | enabled 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT1/power/wakeup_abort_count: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT1/power/wakeup_active: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT1/power/wakeup_active_count: -------------------------------------------------------------------------------- 1 | 4 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT1/power/wakeup_count: -------------------------------------------------------------------------------- 1 | 4 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT1/power/wakeup_expire_count: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT1/power/wakeup_last_time_ms: -------------------------------------------------------------------------------- 1 | 18773802 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT1/power/wakeup_max_time_ms: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT1/power/wakeup_prevent_sleep_time_ms: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT1/power/wakeup_total_time_ms: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT1/present: -------------------------------------------------------------------------------- 1 | 1 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT1/serial_number: -------------------------------------------------------------------------------- 1 | 12345678 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT1/status: -------------------------------------------------------------------------------- 1 | Charging 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT1/technology: -------------------------------------------------------------------------------- 1 | Li-ion 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT1/temp: -------------------------------------------------------------------------------- 1 | 26 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT1/time_to_empty_avg: -------------------------------------------------------------------------------- 1 | 252 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT1/time_to_full_now: -------------------------------------------------------------------------------- 1 | 252 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT1/type: -------------------------------------------------------------------------------- 1 | Battery 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT1/uevent: -------------------------------------------------------------------------------- 1 | POWER_SUPPLY_VOLTAGE_NOW=3300 2 | -------------------------------------------------------------------------------- /test/2battery-gijsbers/sys/class/power_supply/BAT1/voltage_now: -------------------------------------------------------------------------------- 1 | 3300 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/bq27500-0/capacity: -------------------------------------------------------------------------------- 1 | 98 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/bq27500-0/capacity_level: -------------------------------------------------------------------------------- 1 | Normal 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/bq27500-0/charge_full: -------------------------------------------------------------------------------- 1 | 7323000 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/bq27500-0/charge_full_design: -------------------------------------------------------------------------------- 1 | 8180000 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/bq27500-0/charge_now: -------------------------------------------------------------------------------- 1 | 7253000 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/bq27500-0/current_now: -------------------------------------------------------------------------------- 1 | -498000 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/bq27500-0/cycle_count: -------------------------------------------------------------------------------- 1 | 46 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/bq27500-0/energy_now: -------------------------------------------------------------------------------- 1 | 7253000 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/bq27500-0/health: -------------------------------------------------------------------------------- 1 | Good 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/bq27500-0/manufacturer: -------------------------------------------------------------------------------- 1 | Texas Instruments 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/bq27500-0/model_name: -------------------------------------------------------------------------------- 1 | C100-80 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/bq27500-0/power/async: -------------------------------------------------------------------------------- 1 | disabled 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/bq27500-0/power/autosuspend_delay_ms: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o9000/tint2/784edaccd2ac5f6ebb0f83db7b2d805062d0f095/test/acer-chromebook-c100pa/sys/class/power_supply/bq27500-0/power/autosuspend_delay_ms -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/bq27500-0/power/control: -------------------------------------------------------------------------------- 1 | auto 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/bq27500-0/power/runtime_active_kids: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/bq27500-0/power/runtime_active_time: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/bq27500-0/power/runtime_enabled: -------------------------------------------------------------------------------- 1 | disabled 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/bq27500-0/power/runtime_status: -------------------------------------------------------------------------------- 1 | unsupported 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/bq27500-0/power/runtime_suspended_time: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/bq27500-0/power/runtime_usage: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/bq27500-0/power/wakeup: -------------------------------------------------------------------------------- 1 | enabled 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/bq27500-0/power/wakeup_abort_count: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/bq27500-0/power/wakeup_active: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/bq27500-0/power/wakeup_active_count: -------------------------------------------------------------------------------- 1 | 3 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/bq27500-0/power/wakeup_count: -------------------------------------------------------------------------------- 1 | 3 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/bq27500-0/power/wakeup_expire_count: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/bq27500-0/power/wakeup_last_time_ms: -------------------------------------------------------------------------------- 1 | 264291 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/bq27500-0/power/wakeup_max_time_ms: -------------------------------------------------------------------------------- 1 | 16 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/bq27500-0/power/wakeup_total_time_ms: -------------------------------------------------------------------------------- 1 | 46 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/bq27500-0/power/wakeup_type: -------------------------------------------------------------------------------- 1 | unknown 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/bq27500-0/power_avg: -------------------------------------------------------------------------------- 1 | 65324 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/bq27500-0/present: -------------------------------------------------------------------------------- 1 | 1 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/bq27500-0/status: -------------------------------------------------------------------------------- 1 | Discharging 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/bq27500-0/technology: -------------------------------------------------------------------------------- 1 | Li-ion 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/bq27500-0/temp: -------------------------------------------------------------------------------- 1 | 236 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/bq27500-0/time_to_empty_avg: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/bq27500-0/time_to_empty_now: -------------------------------------------------------------------------------- 1 | 40980 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/bq27500-0/time_to_full_now: -------------------------------------------------------------------------------- 1 | 441780 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/bq27500-0/type: -------------------------------------------------------------------------------- 1 | Battery 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/bq27500-0/uevent: -------------------------------------------------------------------------------- 1 | POWER_SUPPLY_NAME=bq27500-0 2 | POWER_SUPPLY_STATUS=Discharging 3 | POWER_SUPPLY_PRESENT=1 4 | POWER_SUPPLY_VOLTAGE_NOW=4260000 5 | POWER_SUPPLY_CURRENT_NOW=-498000 6 | POWER_SUPPLY_CAPACITY=98 7 | POWER_SUPPLY_CAPACITY_LEVEL=Normal 8 | POWER_SUPPLY_TEMP=236 9 | POWER_SUPPLY_TIME_TO_EMPTY_NOW=40980 10 | POWER_SUPPLY_TIME_TO_EMPTY_AVG=0 11 | POWER_SUPPLY_TIME_TO_FULL_NOW=441780 12 | POWER_SUPPLY_TECHNOLOGY=Li-ion 13 | POWER_SUPPLY_CHARGE_FULL=7323000 14 | POWER_SUPPLY_CHARGE_NOW=7253000 15 | POWER_SUPPLY_CHARGE_FULL_DESIGN=8180000 16 | POWER_SUPPLY_CYCLE_COUNT=46 17 | POWER_SUPPLY_ENERGY_NOW=7253000 18 | POWER_SUPPLY_POWER_AVG=65324 19 | POWER_SUPPLY_HEALTH=Good 20 | POWER_SUPPLY_MANUFACTURER=Texas Instruments 21 | POWER_SUPPLY_MODEL_NAME=C100-80 22 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/bq27500-0/voltage_now: -------------------------------------------------------------------------------- 1 | 4260000 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/gpio-charger/online: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/gpio-charger/power/async: -------------------------------------------------------------------------------- 1 | disabled 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/gpio-charger/power/autosuspend_delay_ms: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o9000/tint2/784edaccd2ac5f6ebb0f83db7b2d805062d0f095/test/acer-chromebook-c100pa/sys/class/power_supply/gpio-charger/power/autosuspend_delay_ms -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/gpio-charger/power/control: -------------------------------------------------------------------------------- 1 | auto 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/gpio-charger/power/runtime_active_kids: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/gpio-charger/power/runtime_active_time: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/gpio-charger/power/runtime_enabled: -------------------------------------------------------------------------------- 1 | disabled 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/gpio-charger/power/runtime_status: -------------------------------------------------------------------------------- 1 | unsupported 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/gpio-charger/power/runtime_suspended_time: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/gpio-charger/power/runtime_usage: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/gpio-charger/power/wakeup: -------------------------------------------------------------------------------- 1 | enabled 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/gpio-charger/power/wakeup_abort_count: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/gpio-charger/power/wakeup_active: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/gpio-charger/power/wakeup_active_count: -------------------------------------------------------------------------------- 1 | 1 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/gpio-charger/power/wakeup_count: -------------------------------------------------------------------------------- 1 | 1 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/gpio-charger/power/wakeup_expire_count: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/gpio-charger/power/wakeup_last_time_ms: -------------------------------------------------------------------------------- 1 | 349 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/gpio-charger/power/wakeup_max_time_ms: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/gpio-charger/power/wakeup_total_time_ms: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/gpio-charger/power/wakeup_type: -------------------------------------------------------------------------------- 1 | unknown 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/gpio-charger/type: -------------------------------------------------------------------------------- 1 | Mains 2 | -------------------------------------------------------------------------------- /test/acer-chromebook-c100pa/sys/class/power_supply/gpio-charger/uevent: -------------------------------------------------------------------------------- 1 | POWER_SUPPLY_NAME=gpio-charger 2 | POWER_SUPPLY_ONLINE=0 3 | -------------------------------------------------------------------------------- /test/configs/tint2/661.tint2rc: -------------------------------------------------------------------------------- 1 | #---- Generated by tint2conf 6abf ---- 2 | # See https://gitlab.com/o9000/tint2/wikis/Configure for 3 | # full documentation of the configuration options. 4 | #------------------------------------- 5 | # Gradients 6 | #------------------------------------- 7 | # Backgrounds 8 | # Background 1: Executor 9 | rounded = 0 10 | border_width = 0 11 | border_sides = TBLR 12 | background_color = #ff0000 100 13 | border_color = #000000 0 14 | background_color_hover = #000000 0 15 | border_color_hover = #000000 0 16 | background_color_pressed = #000000 0 17 | border_color_pressed = #000000 0 18 | 19 | #------------------------------------- 20 | # Panel 21 | panel_items = EF 22 | panel_size = 100% 30 23 | panel_margin = 0 0 24 | panel_padding = 0 0 0 25 | panel_background_id = -1 26 | wm_menu = 0 27 | panel_dock = 0 28 | panel_position = top center horizontal 29 | panel_layer = normal 30 | panel_monitor = all 31 | panel_shrink = 0 32 | autohide = 0 33 | autohide_show_timeout = 0 34 | autohide_hide_timeout = 0 35 | autohide_height = 1 36 | strut_policy = follow_size 37 | panel_window_name = tint2 38 | disable_transparency = 0 39 | mouse_effects = 0 40 | font_shadow = 0 41 | mouse_hover_icon_asb = 100 0 10 42 | mouse_pressed_icon_asb = 100 0 0 43 | 44 | #------------------------------------- 45 | # Taskbar 46 | taskbar_mode = single_desktop 47 | taskbar_hide_if_empty = 0 48 | taskbar_padding = 0 0 0 49 | taskbar_background_id = -1 50 | taskbar_active_background_id = -1 51 | taskbar_name = 0 52 | taskbar_hide_inactive_tasks = 0 53 | taskbar_hide_different_monitor = 0 54 | taskbar_hide_different_desktop = 0 55 | taskbar_always_show_all_desktop_tasks = 0 56 | taskbar_name_padding = 0 0 57 | taskbar_name_background_id = -1 58 | taskbar_name_active_background_id = -1 59 | taskbar_name_font_color = #000000 100 60 | taskbar_name_active_font_color = #000000 100 61 | taskbar_distribute_size = 0 62 | taskbar_sort_order = none 63 | task_align = left 64 | 65 | #------------------------------------- 66 | # Task 67 | task_text = 0 68 | task_icon = 0 69 | task_centered = 0 70 | urgent_nb_of_blink = 0 71 | task_maximum_size = 0 0 72 | task_padding = 0 0 0 73 | task_tooltip = 0 74 | mouse_left = toggle_iconify 75 | mouse_middle = none 76 | mouse_right = close 77 | mouse_scroll_up = none 78 | mouse_scroll_down = none 79 | 80 | #------------------------------------- 81 | # System tray (notification area) 82 | systray_padding = 0 0 0 83 | systray_background_id = -1 84 | systray_sort = ascending 85 | systray_icon_size = 0 86 | systray_icon_asb = 100 0 0 87 | systray_monitor = primary 88 | systray_name_filter = 89 | 90 | #------------------------------------- 91 | # Launcher 92 | launcher_padding = 0 0 0 93 | launcher_background_id = -1 94 | launcher_icon_background_id = -1 95 | launcher_icon_size = 0 96 | launcher_icon_asb = 100 0 0 97 | launcher_icon_theme_override = 0 98 | startup_notifications = 0 99 | launcher_tooltip = 0 100 | 101 | #------------------------------------- 102 | # Clock 103 | time1_format = 104 | time2_format = 105 | time1_timezone = 106 | time2_timezone = 107 | clock_font_color = #000000 100 108 | clock_padding = 0 0 109 | clock_background_id = -1 110 | clock_tooltip = 111 | clock_tooltip_timezone = 112 | clock_lclick_command = 113 | clock_rclick_command = 114 | clock_mclick_command = 115 | clock_uwheel_command = 116 | clock_dwheel_command = 117 | 118 | #------------------------------------- 119 | # Battery 120 | battery_tooltip = 1 121 | battery_low_status = 0 122 | battery_low_cmd = 123 | battery_full_cmd = 124 | battery_font_color = #000000 100 125 | bat1_format = 126 | bat2_format = 127 | battery_padding = 0 0 128 | battery_background_id = -1 129 | battery_hide = 0 130 | battery_lclick_command = 131 | battery_rclick_command = 132 | battery_mclick_command = 133 | battery_uwheel_command = 134 | battery_dwheel_command = 135 | ac_connected_cmd = 136 | ac_disconnected_cmd = 137 | 138 | #------------------------------------- 139 | # Executor 1 140 | execp = new 141 | execp_command = cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 4 | head -n 1 142 | execp_interval = 1 143 | execp_has_icon = 0 144 | execp_cache_icon = 1 145 | execp_continuous = 0 146 | execp_markup = 1 147 | execp_lclick_command = 148 | execp_rclick_command = 149 | execp_mclick_command = 150 | execp_uwheel_command = 151 | execp_dwheel_command = 152 | execp_font = DejaVu Sans Ultra-Light 10 153 | execp_font_color = #000000 100 154 | execp_padding = 0 0 155 | execp_background_id = 1 156 | execp_centered = 0 157 | execp_icon_w = 0 158 | execp_icon_h = 0 159 | 160 | #------------------------------------- 161 | # Tooltip 162 | tooltip_show_timeout = 0 163 | tooltip_hide_timeout = 0 164 | tooltip_padding = 0 0 165 | tooltip_background_id = -1 166 | tooltip_font_color = #000000 100 167 | 168 | -------------------------------------------------------------------------------- /test/configs/xsettingsd.conf: -------------------------------------------------------------------------------- 1 | Net/ThemeName "ChromeDark" 2 | Net/IconThemeName "elementary-xfce-dark" 3 | 4 | Xft/Antialias 1 5 | #Xft/DPI 100352 6 | Xft/HintStyle "hintmedium" 7 | Xft/Hinting 1 8 | Xft/RGBA "none" 9 | Xft/lcdfilter "none" 10 | 11 | Gtk/FontName "Liberation Sans 10" 12 | -------------------------------------------------------------------------------- /test/expand.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python2 2 | 3 | # Creates directory tree printed by: 4 | # bash -c "for d in /sys/class/power_supply/* ; do find $d/ -exec sh -c 'echo {} ; cat {} ' ';' ; done" 2>&1 | tee out.txt 5 | 6 | import os 7 | import sys 8 | 9 | 10 | def flush(path, content): 11 | if not path: 12 | return 13 | if content.startswith("cat: %s: Is a directory" % path): 14 | try: 15 | os.makedirs("./" + path) 16 | except: 17 | pass 18 | elif content.startswith("cat: %s:" % path): 19 | with open("./" + path, "w") as f: 20 | pass 21 | else: 22 | with open("./" + path, "w") as f: 23 | f.write(content) 24 | 25 | 26 | with open(sys.argv[1], "r") as f: 27 | path = None 28 | content = "" 29 | for line in f: 30 | if line.startswith("/"): 31 | flush(path, content) 32 | content = "" 33 | path = line.strip() 34 | else: 35 | content += line 36 | if content: 37 | flush(path, content) 38 | -------------------------------------------------------------------------------- /test/expand2.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python2 2 | 3 | # Creates directory tree printed by: 4 | # bash -c "for d in /sys/class/power_supply/* ; do find $d/ -exec sh -c 'echo {} ; cat {} ' ';' ; done" 2>&1 | tee out.txt 5 | 6 | import os 7 | import sys 8 | 9 | 10 | def flush(path, content): 11 | if not path or "/" not in path: 12 | return 13 | path = "./" + path 14 | dir_path, fname = path.rsplit("/", 1) 15 | try: 16 | os.makedirs("./" + dir_path) 17 | except: 18 | pass 19 | with open("./" + path, "w") as f: 20 | f.write(content) 21 | 22 | 23 | with open(sys.argv[1], "r") as f: 24 | path = None 25 | content = "" 26 | for line in f: 27 | if "/" in line and ":" in line: 28 | flush(path, content) 29 | content = "" 30 | path, content = line.split(":", 1) 31 | else: 32 | content += line 33 | if content: 34 | flush(path, content) 35 | -------------------------------------------------------------------------------- /test/fabfile.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python2 2 | 3 | # Setup: add tint2-runner, tint2-freebsd and tint2-openbsd in /etc/hosts. 4 | # Run: pip install fabric; pip install fabtools. 5 | 6 | # TODO: setup bsd workers 7 | # TODO: prin ssh public key to be added on gitlab 8 | 9 | from fabric.api import * 10 | from fabric.contrib.files import * 11 | from fabtools import require 12 | import fabtools 13 | import os 14 | 15 | 16 | env.use_ssh_config = True 17 | env.user = 'root' 18 | env.sudo_prefix += '-H ' 19 | env.roledefs = { 20 | 'runner': ['tint2-runner'], 21 | 'freebsd': ['tint2-freebsd'], 22 | 'openbsd': ['tint2-openbsd'], 23 | } 24 | 25 | 26 | def str2hex(s): 27 | return ''.join('{:02x}'.format(ord(c)) for c in s) 28 | 29 | 30 | def generate_random_password(): 31 | return str2hex(os.urandom(32)) 32 | 33 | 34 | def read_file(path): 35 | with open(path) as f: 36 | return f.read() 37 | 38 | 39 | @task 40 | @roles('runner', 'freebsd', 'openbsd') 41 | def create_users(): 42 | require.user('root', password=generate_random_password()) 43 | require.user('runner', password=generate_random_password()) 44 | sudo('cd; mkdir -p .ssh; chmod 700 .ssh', user='runner') 45 | if not exists('/home/runner/.ssh/id_rsa'): 46 | sudo('cd; ssh-keygen -f ~/.ssh/id_rsa -t rsa -N ""', user='runner') 47 | 48 | 49 | @task 50 | @roles('runner') 51 | def install_deps(): 52 | require.deb.packages([ 53 | # Repo deps 54 | 'git', 55 | # Build deps 56 | 'build-essential', 57 | 'cmake', 58 | 'libglib2.0-dev', 59 | 'libcairo2-dev', 60 | 'libglib2.0-dev', 61 | 'libgtk2.0-dev', 62 | 'libimlib2-dev', 63 | 'libpango1.0-dev', 64 | 'librsvg2-dev', 65 | 'libstartup-notification0-dev', 66 | 'libx11-dev', 67 | 'libxcomposite-dev', 68 | 'libxdamage-dev', 69 | 'libxinerama-dev', 70 | 'libxrandr-dev', 71 | 'libxrender-dev', 72 | # Tester deps 73 | 'python-minimal', 74 | 'xvfb', 75 | 'xsettingsd', 76 | 'openbox', 77 | 'compton', 78 | 'x11-utils', 79 | 'gnome-calculator' 80 | ]) 81 | 82 | 83 | @task 84 | @roles('runner') 85 | def pull_code(): 86 | if not exists('/home/runner/tint2'): 87 | sudo('cd; git clone https://gitlab.com/o9000/tint2.git', user='runner') 88 | if not exists('/home/runner/tint2.wiki'): 89 | sudo('cd; git clone git@gitlab.com:o9000/tint2.wiki.git', user='runner') 90 | sudo('cd; git config --global user.name "tint2.runner"', user='runner') 91 | sudo('cd; git config --global user.email "tint2.runner@netperf.tools"', user='runner') 92 | 93 | 94 | @task 95 | @roles('runner') 96 | def add_cron_jobs(): 97 | fabtools.cron.add_task('tests', '* * * * *', 'runner', '/home/runner/tint2/test/update_test_status.sh') 98 | fabtools.cron.add_task('packaging_check', '10 */2 * * *', 'runner', '/home/runner/tint2/packaging/update_version_status.sh') 99 | 100 | 101 | @task(default=True) 102 | @roles('runner') 103 | def full_runner(): 104 | create_users() 105 | install_deps() 106 | pull_code() 107 | add_cron_jobs() 108 | -------------------------------------------------------------------------------- /test/gather-battery-data.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import os 4 | import os.path 5 | import tarfile 6 | try: 7 | from StringIO import StringIO 8 | except ImportError: 9 | from io import StringIO 10 | 11 | 12 | class TarWriter: 13 | def __init__(self, out_name): 14 | print("Creating: " + out_name) 15 | self.tar = tarfile.open(out_name, "w") 16 | 17 | def add(self, path): 18 | print("Adding: " + path) 19 | if os.path.isfile(path): 20 | metadata = self.tar.gettarinfo(path) 21 | try: 22 | with open(path) as f: 23 | buf = f.read() 24 | fbuf = StringIO(buf) 25 | metadata.size = len(buf) 26 | self.tar.addfile(metadata, fbuf) 27 | fbuf.close() 28 | except: 29 | fbuf = StringIO() 30 | metadata.size = 0 31 | self.tar.addfile(metadata, fbuf) 32 | fbuf.close() 33 | 34 | def close(self): 35 | self.tar.close() 36 | 37 | 38 | writer = TarWriter("battery.tar") 39 | for root, dirs, files in os.walk("/sys/class/power_supply"): 40 | for device in dirs: 41 | for root2, dirs2, files2 in os.walk(root + "/" + device): 42 | for f in files2: 43 | writer.add(root2 + "/" + f) 44 | writer.close() 45 | print("Finished.") 46 | -------------------------------------------------------------------------------- /test/lenovo/sys/class/power_supply/BAT0/alarm: -------------------------------------------------------------------------------- 1 | 2446000 2 | -------------------------------------------------------------------------------- /test/lenovo/sys/class/power_supply/BAT0/capacity: -------------------------------------------------------------------------------- 1 | 97 2 | -------------------------------------------------------------------------------- /test/lenovo/sys/class/power_supply/BAT0/capacity_level: -------------------------------------------------------------------------------- 1 | Normal 2 | -------------------------------------------------------------------------------- /test/lenovo/sys/class/power_supply/BAT0/cycle_count: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /test/lenovo/sys/class/power_supply/BAT0/energy_full: -------------------------------------------------------------------------------- 1 | 48920000 2 | -------------------------------------------------------------------------------- /test/lenovo/sys/class/power_supply/BAT0/energy_full_design: -------------------------------------------------------------------------------- 1 | 86580000 2 | -------------------------------------------------------------------------------- /test/lenovo/sys/class/power_supply/BAT0/energy_now: -------------------------------------------------------------------------------- 1 | 47660000 2 | -------------------------------------------------------------------------------- /test/lenovo/sys/class/power_supply/BAT0/manufacturer: -------------------------------------------------------------------------------- 1 | LGC 2 | -------------------------------------------------------------------------------- /test/lenovo/sys/class/power_supply/BAT0/model_name: -------------------------------------------------------------------------------- 1 | 45N1029 2 | -------------------------------------------------------------------------------- /test/lenovo/sys/class/power_supply/BAT0/power/async: -------------------------------------------------------------------------------- 1 | disabled 2 | -------------------------------------------------------------------------------- /test/lenovo/sys/class/power_supply/BAT0/power/autosuspend_delay_ms: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o9000/tint2/784edaccd2ac5f6ebb0f83db7b2d805062d0f095/test/lenovo/sys/class/power_supply/BAT0/power/autosuspend_delay_ms -------------------------------------------------------------------------------- /test/lenovo/sys/class/power_supply/BAT0/power/control: -------------------------------------------------------------------------------- 1 | auto 2 | -------------------------------------------------------------------------------- /test/lenovo/sys/class/power_supply/BAT0/power/runtime_active_kids: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /test/lenovo/sys/class/power_supply/BAT0/power/runtime_active_time: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /test/lenovo/sys/class/power_supply/BAT0/power/runtime_enabled: -------------------------------------------------------------------------------- 1 | disabled 2 | -------------------------------------------------------------------------------- /test/lenovo/sys/class/power_supply/BAT0/power/runtime_status: -------------------------------------------------------------------------------- 1 | unsupported 2 | -------------------------------------------------------------------------------- /test/lenovo/sys/class/power_supply/BAT0/power/runtime_suspended_time: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /test/lenovo/sys/class/power_supply/BAT0/power/runtime_usage: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /test/lenovo/sys/class/power_supply/BAT0/power_now: -------------------------------------------------------------------------------- 1 | 16382000 2 | -------------------------------------------------------------------------------- /test/lenovo/sys/class/power_supply/BAT0/present: -------------------------------------------------------------------------------- 1 | 1 2 | -------------------------------------------------------------------------------- /test/lenovo/sys/class/power_supply/BAT0/serial_number: -------------------------------------------------------------------------------- 1 | 494 2 | -------------------------------------------------------------------------------- /test/lenovo/sys/class/power_supply/BAT0/status: -------------------------------------------------------------------------------- 1 | Discharging 2 | -------------------------------------------------------------------------------- /test/lenovo/sys/class/power_supply/BAT0/technology: -------------------------------------------------------------------------------- 1 | Li-ion 2 | -------------------------------------------------------------------------------- /test/lenovo/sys/class/power_supply/BAT0/type: -------------------------------------------------------------------------------- 1 | Battery 2 | -------------------------------------------------------------------------------- /test/lenovo/sys/class/power_supply/BAT0/uevent: -------------------------------------------------------------------------------- 1 | POWER_SUPPLY_NAME=BAT0 2 | POWER_SUPPLY_STATUS=Discharging 3 | POWER_SUPPLY_PRESENT=1 4 | POWER_SUPPLY_TECHNOLOGY=Li-ion 5 | POWER_SUPPLY_CYCLE_COUNT=0 6 | POWER_SUPPLY_VOLTAGE_MIN_DESIGN=11100000 7 | POWER_SUPPLY_VOLTAGE_NOW=12144000 8 | POWER_SUPPLY_POWER_NOW=16382000 9 | POWER_SUPPLY_ENERGY_FULL_DESIGN=86580000 10 | POWER_SUPPLY_ENERGY_FULL=48920000 11 | POWER_SUPPLY_ENERGY_NOW=47660000 12 | POWER_SUPPLY_CAPACITY=97 13 | POWER_SUPPLY_CAPACITY_LEVEL=Normal 14 | POWER_SUPPLY_MODEL_NAME=45N1029 15 | POWER_SUPPLY_MANUFACTURER=LGC 16 | POWER_SUPPLY_SERIAL_NUMBER= 494 17 | -------------------------------------------------------------------------------- /test/lenovo/sys/class/power_supply/BAT0/voltage_min_design: -------------------------------------------------------------------------------- 1 | 11100000 2 | -------------------------------------------------------------------------------- /test/lenovo/sys/class/power_supply/BAT0/voltage_now: -------------------------------------------------------------------------------- 1 | 12144000 2 | -------------------------------------------------------------------------------- /test/manual-theme-check.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo -e '\033kTerminal\033\\' 4 | 5 | echo "" > ../../tint2.wiki/screenshots.md 6 | 7 | for f in ../themes/*tint2rc 8 | do 9 | reset 10 | echo $f 11 | name=$(basename -s .tint2rc $f) 12 | ( ( sleep 1 ; import -window tint2 ../../tint2.wiki/screenshots/${name}.png ; echo "Screenshot taken for ${name}!" ) &) 13 | ../build/tint2 -c $f 14 | sleep 1 15 | echo -e "### [${name}](https://gitlab.com/o9000/tint2/blob/master/themes/$(basename $f))\n" >> ../../tint2.wiki/screenshots.md 16 | echo -e "![${name}](https://gitlab.com/o9000/tint2/wikis/screenshots/${name}.png)\n" >> ../../tint2.wiki/screenshots.md 17 | done 18 | -------------------------------------------------------------------------------- /test/update_test_status.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin 4 | 5 | set -e 6 | set -x 7 | 8 | [ "${FLOCKER}" != "$0" ] && exec env FLOCKER="$0" flock -en "$0" "$0" "$@" || : 9 | 10 | exec > ~/tint2.runner-test.log 11 | exec 2>&1 12 | 13 | cd ~/tint2 14 | git reset --hard 15 | git pull 16 | last=$(cat .last-reg-test || true) 17 | curr=$(git rev-parse --verify HEAD) 18 | [ "$last" == "$curr" ] && exit 0 19 | 20 | cd ~/tint2.wiki 21 | git reset --hard 22 | git pull 23 | 24 | 25 | cd ~/tint2/test 26 | ~/tint2/test/regression.py > ~/tint2.wiki/tests.tmp.md 27 | cat ~/tint2.wiki/tests.tmp.md > ~/tint2.wiki/tests.md 28 | rm ~/tint2.wiki/tests.tmp.md 29 | 30 | cd ~/tint2.wiki 31 | git add tests.md 32 | git commit -am 'Update test results' 33 | git push origin master 34 | 35 | cd ~/tint2 36 | echo "$curr" > .last-reg-test 37 | -------------------------------------------------------------------------------- /test/workspaces-stress.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # List normal windows 4 | # wmctrl -l | awk '{if ($4 != "Desktop") print $1}' 5 | # 6 | # Change the number of desktops 7 | # xprop -root -f _NET_NUMBER_OF_DESKTOPS 32c -set _NET_NUMBER_OF_DESKTOPS 2 8 | # 9 | # Move window to desktop 10 | # xprop -id 0x03600007 -f _NET_WM_DESKTOP 32c -set _NET_WM_DESKTOP 0 11 | # 12 | # Move window to all desktops 13 | # xprop -id 0x03600007 -f _NET_WM_DESKTOP 32c -set _NET_WM_DESKTOP 4294967295 14 | 15 | while true 16 | do 17 | # change the number of desktops to a random value 18 | num_desktops=$(( $RANDOM % 8 + 1 )) 19 | xprop -root -f _NET_NUMBER_OF_DESKTOPS 32c -set _NET_NUMBER_OF_DESKTOPS $num_desktops 20 | max_desktop=$(( $num_desktops - 1 )) 21 | desktops=$(echo 4294967295; seq 0 $max_desktop) 22 | for run in 1 2 3 23 | do 24 | # start and stop calculators 25 | if (( $RANDOM % 5 == 0 )) 26 | then 27 | killall gnome-calculator 1>/dev/null 2>/dev/null 28 | sleep 0.1 29 | else 30 | (gnome-calculator 1>/dev/null 2>/dev/null &) 31 | fi 32 | # change the current desktop to a random value 33 | for change in 1 2 3 34 | do 35 | desktop=$(shuf -n 1 -e $(seq 0 $max_desktop)) 36 | xprop -root -f _NET_CURRENT_DESKTOP 32c -set _NET_CURRENT_DESKTOP $desktop 37 | sleep 0.1 38 | done 39 | # move windows around 40 | for win in $(wmctrl -l | awk '!/Terminal/ {if ($4 != "Desktop") print $1}') 41 | do 42 | desktop=$(shuf -n 1 -e $desktops) 43 | xprop -id $win -f _NET_WM_DESKTOP 32c -set _NET_WM_DESKTOP $desktop 44 | done 45 | sleep 0.1 46 | done 47 | sleep 0.1 48 | done 49 | -------------------------------------------------------------------------------- /themes/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file( GLOB EXTRATHEMEFILES *.tint2rc ) 2 | install( FILES ${EXTRATHEMEFILES} DESTINATION ${CMAKE_INSTALL_DATADIR}/tint2 ) 3 | -------------------------------------------------------------------------------- /tint2.config: -------------------------------------------------------------------------------- 1 | // ADD PREDEFINED MACROS HERE! 2 | #define DISABLE_BACKTRACE 1 3 | #define ENABLE_BATTERY 1 4 | #define ENABLE_UEVENT 1 5 | #define GETTEXT_PACKAGE "tint2conf" 6 | #define HAS_GENERIC 1 7 | #define HAVE_RSVG 1 8 | #define HAVE_SN 1 9 | #define HAVE_VERSION_H 1 10 | #define INSTALL_PREFIX "/usr/local" 11 | #define LOCALEDIR "/usr/local/share/locale" 12 | #define SN_API_NOT_YET_FROZEN 13 | #define _BSD_SOURCE 14 | #define _DEFAULT_SOURCE 15 | #define _POSIX_C_SOURCE=200809L 16 | #define _WITH_GETLINE 17 | -------------------------------------------------------------------------------- /tint2.creator: -------------------------------------------------------------------------------- 1 | [General] 2 | -------------------------------------------------------------------------------- /tint2.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Type=Application 3 | Encoding=UTF-8 4 | 5 | Name=Tint2 6 | 7 | GenericName=Panel 8 | GenericName[am]=ፓነል 9 | GenericName[ar]=الشريط 10 | GenericName[ast]=Panel 11 | GenericName[be]=Панэль 12 | GenericName[ca]=Quadre 13 | GenericName[cs]=Panel 14 | GenericName[da]=Panel 15 | GenericName[de]=Leiste 16 | GenericName[dz]=པེ་ནཱལ། 17 | GenericName[el]=Ταμπλό 18 | GenericName[en]=Tint2 panel 19 | GenericName[eo]=Panelo 20 | GenericName[es]=Panel 21 | GenericName[et]=Ääreriba 22 | GenericName[eu]=Panela 23 | GenericName[fi]=Paneeli 24 | GenericName[fr]=Panneau 25 | GenericName[gl]=Panel 26 | GenericName[he]=לוח 27 | GenericName[hu]=Panel 28 | GenericName[id]=Panel 29 | GenericName[it]=Pannello 30 | GenericName[ja]=パネル 31 | GenericName[kk]=Панель 32 | GenericName[ko]=패널 33 | GenericName[ku]=Panel 34 | GenericName[lv]=Panelis 35 | GenericName[mk]=Панел 36 | GenericName[nb]=Panel 37 | GenericName[nl]=Paneel 38 | GenericName[nn]=Panel 39 | GenericName[pa]=ਪੈਨਲ 40 | GenericName[pl]=Panel 41 | GenericName[pt]=Painel 42 | GenericName[ro]=Panou 43 | GenericName[ru]=Панель 44 | GenericName[si]=පුවරුව 45 | GenericName[sk]=Panel 46 | GenericName[sq]=Panel 47 | GenericName[sv]=Panel 48 | GenericName[ta]=பலகை 49 | GenericName[tr]=Panel 50 | GenericName[ug]=panel 51 | GenericName[uk]=Панель 52 | GenericName[ur]=پینل 53 | GenericName[vi]=Panel 54 | GenericName[zh]=面板 55 | 56 | Comment=Lightweight panel 57 | Comment[fr]=Panel léger 58 | Comment[pl]=Lekki panel 59 | Comment[ru]=Легковесная панель 60 | 61 | Exec=tint2 62 | Icon=tint2 63 | Terminal=false 64 | Categories=System; 65 | -------------------------------------------------------------------------------- /tint2.includes: -------------------------------------------------------------------------------- 1 | . 2 | ./build 3 | ./src 4 | ./src/battery 5 | ./src/clock 6 | ./src/systray 7 | ./src/taskbar 8 | ./src/launcher 9 | ./src/tooltip 10 | ./src/util 11 | ./src/execplugin 12 | ./src/button 13 | ./src/freespace 14 | ./src/separator 15 | /usr/include/pango-1.0 16 | /usr/include/cairo 17 | /usr/include/glib-2.0 18 | /usr/lib/x86_64-linux-gnu/glib-2.0/include 19 | /usr/include/pixman-1 20 | /usr/include/freetype2 21 | /usr/include/libpng12 22 | /usr/include/librsvg-2.0 23 | /usr/include/gdk-pixbuf-2.0 24 | /usr/include/startup-notification-1.0 25 | /usr/include/gtk-2.0 26 | /usr/lib/x86_64-linux-gnu/gtk-2.0/include 27 | /usr/include/atk-1.0 28 | /usr/include/gio-unix-2.0 29 | /usr/include/harfbuzz 30 | /usr/include 31 | po 32 | src/tint2conf/po 33 | src/freespace 34 | src/execplugin 35 | src/separator 36 | themes 37 | doc 38 | src/button 39 | --------------------------------------------------------------------------------