Commit d5dfda29 authored by o9000's avatar o9000

Buttons

parent 89d57f89
......@@ -100,6 +100,7 @@ include_directories( ${PROJECT_BINARY_DIR}
src/tooltip
src/util
src/execplugin
src/button
src/freespace
src/separator
${X11_INCLUDE_DIRS}
......@@ -128,6 +129,7 @@ set( SOURCES src/config.c
src/taskbar/taskbarname.c
src/tooltip/tooltip.c
src/execplugin/execplugin.c
src/button/button.c
src/freespace/freespace.c
src/separator/separator.c
src/tint2rc.c
......
2017-03-25 master
- Enhancements:
- New plugin: button.
2017-03-25 0.13.3
- Fixes:
- Fixed autohide for non-bottom panels (issue #632)
......
......@@ -229,6 +229,7 @@ It was specifically made for Openbox but it should also work with other window m
<li><p><a href="#tooltip">Tooltip</a></p></li>
<li><p><a href="#battery">Battery</a></p></li>
<li><p><a href="#executor">Executor</a></p></li>
<li><p><a href="#button">Button</a></p></li>
<li><p><a href="#separator">Separator</a></p></li>
<li><p><a href="#example-configuration">Example configuration</a></p></li>
</ul>
......@@ -359,6 +360,7 @@ gradient_id_pressed = 2
<li><code>C</code> shows the Clock</li>
<li><code>F</code> adds an extensible spacer (freespace). You can specify more than one. Has no effect if <code>T</code> is also present. <em>(since 0.12)</em></li>
<li><code>E</code> adds an executor plugin. You can specify more than one. <em>(since 0.12.4)</em></li>
<li><code>P</code> adds a push button. You can specify more than one. <em>(since 0.14)</em></li>
<li><code>:</code> adds a separator. You can specify more than one. <em>(since 0.13.0)</em></li>
</ul>
<p>For example, <code>panel_items = STC</code> will show the systray, the taskbar and the clock (from left to right).</p></li>
......@@ -650,6 +652,23 @@ execp_command = stdbuf -oL bwm-ng -o csv -t 1000 | awk -F ';' '/total/ { printf
execp_continuous = 1
execp_interval = 1
</code></pre>
<h3 id="button">Button<a name="button" href="#button" class="md2man-permalink" title="permalink"></a></h3>
<ul>
<li><p><code>button = new</code> : Begins the configuration of a new button. Multiple such plugins are supported; just use multiple <code>P</code>s in <code>panel_items</code>. <em>(since 0.14)</em></p></li>
<li><p><code>button_icon = text</code> : Name or path of icon (or empty). <em>(since 0.14)</em></p></li>
<li><p><code>button_text = text</code> : Text to display (or empty). <em>(since 0.14)</em></p></li>
<li><p><code>button_tooltip = text</code> : The tooltip (or empty). <em>(since 0.14)</em></p></li>
<li><p><code>button_font = [FAMILY-LIST] [STYLE-OPTIONS] [SIZE]</code> : The font used to draw the text. <em>(since 0.14)</em></p></li>
<li><p><code>button_font_color = color opacity</code> : The font color. <em>(since 0.14)</em></p></li>
<li><p><code>button_background_id = integer</code> : Which background to use. <em>(since 0.14)</em></p></li>
<li><p><code>button_centered = boolean (0 or 1)</code> : Whether to center the text. <em>(since 0.14)</em></p></li>
<li><p><code>button_padding = horizontal_padding vertical_padding spacing_between_icon_and_text</code> <em>(since 0.14)</em></p></li>
<li><p><code>button_lclick_command = text</code> : Command to execute on left click. If not defined, <code>execp_command</code> is executed immediately, unless it is currently running. <em>(since 0.14)</em></p></li>
<li><p><code>button_mclick_command = text</code> : Command to execute on right click. If not defined, <code>execp_command</code> is executed immediately, unless it is currently running. <em>(since 0.14)</em></p></li>
<li><p><code>button_rclick_command = text</code> : Command to execute on middle click. If not defined, <code>execp_command</code> is executed immediately, unless it is currently running. <em>(since 0.14)</em></p></li>
<li><p><code>button_uwheel_command = text</code> : Command to execute on wheel scroll up. If not defined, <code>execp_command</code> is executed immediately, unless it is currently running. <em>(since 0.14)</em></p></li>
<li><p><code>button_dwheel_command = text</code> : Command to execute on wheel scroll down. If not defined, <code>execp_command</code> is executed immediately, unless it is currently running. <em>(since 0.14)</em></p></li>
</ul>
<h3 id="separator">Separator<a name="separator" href="#separator" class="md2man-permalink" title="permalink"></a></h3>
<ul>
<li><p><code>separator = new</code> : Begins the configuration of a new separator. Multiple such plugins are supported; just use multiple <code>:</code>s in <code>panel_items</code>. <em>(since 0.13.0)</em></p></li>
......@@ -659,142 +678,7 @@ execp_interval = 1
<li><p><code>separator_size = integer</code> : The thickness of the separator. Does not include the border and padding. For example, if the style is <code>line</code>, this is the line thickness; if the style is <code>dots</code>, this is the dot&#39;s diameter. <em>(since 0.13.0)</em></p></li>
<li><p><code>separator_padding = side_padding cap_padding</code> : The padding to add to the sides of the separator, in pixels. <em>(since 0.13.0)</em></p></li>
</ul>
<h3 id="example-configuration">Example configuration<a name="example-configuration" href="#example-configuration" class="md2man-permalink" title="permalink"></a></h3><pre class="highlight plaintext"><code>#---------------------------------------------
## TINT2 CONFIG FILE
#---------------------------------------------
#---------------------------------------------
## BACKGROUND AND BORDER
#---------------------------------------------
rounded = 7
border_width = 2
background_color = #000000 60
border_color = #ffffff 18
rounded = 5
border_width = 0
background_color = #ffffff 40
border_color = #ffffff 50
rounded = 5
border_width = 0
background_color = #ffffff 18
border_color = #ffffff 70
#---------------------------------------------
## PANEL
#---------------------------------------------
panel_monitor = all
panel_position = bottom center
panel_size = 94% 30
panel_margin = 0 0
panel_padding = 7 0
font_shadow = 0
panel_background_id = 1
wm_menu = 0
panel_dock = 0
panel_layer = bottom
#---------------------------------------------
## TASKBAR
#---------------------------------------------
#taskbar_mode = multi_desktop
taskbar_mode = single_desktop
taskbar_padding = 2 3 2
taskbar_background_id = 0
#taskbar_active_background_id = 0
#---------------------------------------------
## TASKS
#---------------------------------------------
task_icon = 1
task_text = 1
task_maximum_size = 140 35
task_centered = 1
task_padding = 6 3
task_font = sans 7
task_font_color = #ffffff 70
task_background_id = 3
task_icon_asb = 100 0 0
## replace STATUS by 'urgent', 'active' or 'iconified'
#task_STATUS_background_id = 2
#task_STATUS_font_color = #ffffff 85
#task_STATUS_icon_asb = 100 0 0
## example:
task_active_background_id = 2
task_active_font_color = #ffffff 85
task_active_icon_asb = 100 0 0
urgent_nb_of_blink = 8
#---------------------------------------------
## SYSTRAYBAR
#---------------------------------------------
systray = 1
systray_padding = 0 4 5
systray_background_id = 0
systray_sort = left2right
systray_icon_size = 0
systray_icon_asb = 100 0 0
#---------------------------------------------
## CLOCK
#---------------------------------------------
time1_format = %H:%M
time1_font = sans 8
time2_format = %A %d %B
time2_font = sans 6
clock_font_color = #ffffff 76
clock_padding = 1 0
clock_background_id = 0
#clock_lclick_command = xclock
clock_rclick_command = orage
#clock_tooltip = %A %d %B
#time1_timezone = :US/Hawaii
#time2_timezone = :Europe/Berlin
#clock_tooltip_timezone = :/usr/share/zoneinfo/Europe/Paris
#---------------------------------------------
## BATTERY
#---------------------------------------------
battery = 0
battery_hide = 98
battery_low_status = 10
battery_low_cmd = notify-send "battery low"
bat1_font = sans 8
bat2_font = sans 6
battery_font_color = #ffffff 76
battery_padding = 1 0
battery_background_id = 0
#---------------------------------------------
## TOOLTIP
#---------------------------------------------
tooltip = 0
tooltip_padding = 2 2
tooltip_show_timeout = 0.7
tooltip_hide_timeout = 0.3
tooltip_background_id = 1
tooltip_font_color = #OOOOOO 80
tooltip_font = sans 10
#---------------------------------------------
## MOUSE ACTION ON TASK
#---------------------------------------------
mouse_middle = none
mouse_right = close
mouse_scroll_up = toggle
mouse_scroll_down = iconify
#---------------------------------------------
## AUTOHIDE OPTIONS
#---------------------------------------------
autohide = 0
autohide_show_timeout = 0.3
autohide_hide_timeout = 2
autohide_height = 4
strut_policy = minimum
</code></pre>
<h2 id="author">AUTHOR<a name="author" href="#author" class="md2man-permalink" title="permalink"></a></h2><p>tint2 was written by Thierry Lorthiois <a href="mailto:lorthiois@bbsoft.fr">lorthiois@bbsoft.fr</a>.
<h3 id="example-configuration">Example configuration<a name="example-configuration" href="#example-configuration" class="md2man-permalink" title="permalink"></a></h3><p>See /etc/xdg/tint2/tint2rc.</p><h2 id="author">AUTHOR<a name="author" href="#author" class="md2man-permalink" title="permalink"></a></h2><p>tint2 was written by Thierry Lorthiois <a href="mailto:lorthiois@bbsoft.fr">lorthiois@bbsoft.fr</a>.
It is based on ttm, originally written by Pål Staurland <a href="mailto:staura@gmail.com">staura@gmail.com</a>.</p><p>This manual page was originally written by Daniel Moerner <a href="mailto:dmoerner@gmail.com">dmoerner@gmail.com</a>, for the Debian project (but may be used by others).
It was adopted from the tint2 docs.</p><h2 id="see-also">SEE ALSO<a name="see-also" href="#see-also" class="md2man-permalink" title="permalink"></a></h2><p>The main website <a href="https://gitlab.com/o9000/tint2">https://gitlab.com/o9000/tint2</a>
and the wiki page at <a href="https://gitlab.com/o9000/tint2/wikis/home">https://gitlab.com/o9000/tint2/wikis/home</a>.</p><p>This documentation is also provided in HTML and Markdown format in the system&#39;s default location
......
......@@ -67,6 +67,8 @@ Battery \[la]#battery\[ra]
.IP \(bu 2
Executor \[la]#executor\[ra]
.IP \(bu 2
Button \[la]#button\[ra]
.IP \(bu 2
Separator \[la]#separator\[ra]
.IP \(bu 2
Example configuration \[la]#example-configuration\[ra]
......@@ -294,6 +296,8 @@ gradient_id_pressed = 2
.IP \(bu 2
\fB\fCE\fR adds an executor plugin. You can specify more than one. \fI(since 0.12.4)\fP
.IP \(bu 2
\fB\fCP\fR adds a push button. You can specify more than one. \fI(since 0.14)\fP
.IP \(bu 2
\fB\fC:\fR adds a separator. You can specify more than one. \fI(since 0.13.0)\fP
.RE
.PP
......@@ -800,6 +804,37 @@ execp_continuous = 1
execp_interval = 1
.fi
.RE
.SS Button
.RS
.IP \(bu 2
\fB\fCbutton = new\fR : Begins the configuration of a new button. Multiple such plugins are supported; just use multiple \fB\fCP\fRs in \fB\fCpanel_items\fR\&. \fI(since 0.14)\fP
.IP \(bu 2
\fB\fCbutton_icon = text\fR : Name or path of icon (or empty). \fI(since 0.14)\fP
.IP \(bu 2
\fB\fCbutton_text = text\fR : Text to display (or empty). \fI(since 0.14)\fP
.IP \(bu 2
\fB\fCbutton_tooltip = text\fR : The tooltip (or empty). \fI(since 0.14)\fP
.IP \(bu 2
\fB\fCbutton_font = [FAMILY\-LIST] [STYLE\-OPTIONS] [SIZE]\fR : The font used to draw the text. \fI(since 0.14)\fP
.IP \(bu 2
\fB\fCbutton_font_color = color opacity\fR : The font color. \fI(since 0.14)\fP
.IP \(bu 2
\fB\fCbutton_background_id = integer\fR : Which background to use. \fI(since 0.14)\fP
.IP \(bu 2
\fB\fCbutton_centered = boolean (0 or 1)\fR : Whether to center the text. \fI(since 0.14)\fP
.IP \(bu 2
\fB\fCbutton_padding = horizontal_padding vertical_padding spacing_between_icon_and_text\fR \fI(since 0.14)\fP
.IP \(bu 2
\fB\fCbutton_lclick_command = text\fR : Command to execute on left click. If not defined, \fB\fCexecp_command\fR is executed immediately, unless it is currently running. \fI(since 0.14)\fP
.IP \(bu 2
\fB\fCbutton_mclick_command = text\fR : Command to execute on right click. If not defined, \fB\fCexecp_command\fR is executed immediately, unless it is currently running. \fI(since 0.14)\fP
.IP \(bu 2
\fB\fCbutton_rclick_command = text\fR : Command to execute on middle click. If not defined, \fB\fCexecp_command\fR is executed immediately, unless it is currently running. \fI(since 0.14)\fP
.IP \(bu 2
\fB\fCbutton_uwheel_command = text\fR : Command to execute on wheel scroll up. If not defined, \fB\fCexecp_command\fR is executed immediately, unless it is currently running. \fI(since 0.14)\fP
.IP \(bu 2
\fB\fCbutton_dwheel_command = text\fR : Command to execute on wheel scroll down. If not defined, \fB\fCexecp_command\fR is executed immediately, unless it is currently running. \fI(since 0.14)\fP
.RE
.SS Separator
.RS
.IP \(bu 2
......@@ -817,144 +852,7 @@ execp_interval = 1
.RE
.SS Example configuration
.PP
.RS
.nf
#\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
## TINT2 CONFIG FILE
#\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
#\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
## BACKGROUND AND BORDER
#\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
rounded = 7
border_width = 2
background_color = #000000 60
border_color = #ffffff 18
rounded = 5
border_width = 0
background_color = #ffffff 40
border_color = #ffffff 50
rounded = 5
border_width = 0
background_color = #ffffff 18
border_color = #ffffff 70
#\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
## PANEL
#\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
panel_monitor = all
panel_position = bottom center
panel_size = 94% 30
panel_margin = 0 0
panel_padding = 7 0
font_shadow = 0
panel_background_id = 1
wm_menu = 0
panel_dock = 0
panel_layer = bottom
#\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
## TASKBAR
#\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
#taskbar_mode = multi_desktop
taskbar_mode = single_desktop
taskbar_padding = 2 3 2
taskbar_background_id = 0
#taskbar_active_background_id = 0
#\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
## TASKS
#\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
task_icon = 1
task_text = 1
task_maximum_size = 140 35
task_centered = 1
task_padding = 6 3
task_font = sans 7
task_font_color = #ffffff 70
task_background_id = 3
task_icon_asb = 100 0 0
## replace STATUS by 'urgent', 'active' or 'iconified'
#task_STATUS_background_id = 2
#task_STATUS_font_color = #ffffff 85
#task_STATUS_icon_asb = 100 0 0
## example:
task_active_background_id = 2
task_active_font_color = #ffffff 85
task_active_icon_asb = 100 0 0
urgent_nb_of_blink = 8
#\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
## SYSTRAYBAR
#\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
systray = 1
systray_padding = 0 4 5
systray_background_id = 0
systray_sort = left2right
systray_icon_size = 0
systray_icon_asb = 100 0 0
#\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
## CLOCK
#\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
time1_format = %H:%M
time1_font = sans 8
time2_format = %A %d %B
time2_font = sans 6
clock_font_color = #ffffff 76
clock_padding = 1 0
clock_background_id = 0
#clock_lclick_command = xclock
clock_rclick_command = orage
#clock_tooltip = %A %d %B
#time1_timezone = :US/Hawaii
#time2_timezone = :Europe/Berlin
#clock_tooltip_timezone = :/usr/share/zoneinfo/Europe/Paris
#\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
## BATTERY
#\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
battery = 0
battery_hide = 98
battery_low_status = 10
battery_low_cmd = notify\-send "battery low"
bat1_font = sans 8
bat2_font = sans 6
battery_font_color = #ffffff 76
battery_padding = 1 0
battery_background_id = 0
#\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
## TOOLTIP
#\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
tooltip = 0
tooltip_padding = 2 2
tooltip_show_timeout = 0.7
tooltip_hide_timeout = 0.3
tooltip_background_id = 1
tooltip_font_color = #OOOOOO 80
tooltip_font = sans 10
#\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
## MOUSE ACTION ON TASK
#\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
mouse_middle = none
mouse_right = close
mouse_scroll_up = toggle
mouse_scroll_down = iconify
#\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
## AUTOHIDE OPTIONS
#\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
autohide = 0
autohide_show_timeout = 0.3
autohide_hide_timeout = 2
autohide_height = 4
strut_policy = minimum
.fi
.RE
See /etc/xdg/tint2/tint2rc.
.SH AUTHOR
.PP
tint2 was written by Thierry Lorthiois \[la]lorthiois@bbsoft.fr\[ra]\&.
......
......@@ -58,6 +58,8 @@ Goals:
* [Executor](#executor)
* [Button](#button)
* [Separator](#separator)
* [Example configuration](#example-configuration)
......@@ -244,6 +246,7 @@ gradient_id_pressed = 2
* `C` shows the Clock
* `F` adds an extensible spacer (freespace). You can specify more than one. Has no effect if `T` is also present. *(since 0.12)*
* `E` adds an executor plugin. You can specify more than one. *(since 0.12.4)*
* `P` adds a push button. You can specify more than one. *(since 0.14)*
* `:` adds a separator. You can specify more than one. *(since 0.13.0)*
For example, `panel_items = STC` will show the systray, the taskbar and the clock (from left to right).
......@@ -671,6 +674,32 @@ execp_continuous = 1
execp_interval = 1
```
### Button
* `button = new` : Begins the configuration of a new button. Multiple such plugins are supported; just use multiple `P`s in `panel_items`. *(since 0.14)*
* `button_icon = text` : Name or path of icon (or empty). *(since 0.14)*
* `button_text = text` : Text to display (or empty). *(since 0.14)*
* `button_tooltip = text` : The tooltip (or empty). *(since 0.14)*
* `button_font = [FAMILY-LIST] [STYLE-OPTIONS] [SIZE]` : The font used to draw the text. *(since 0.14)*
* `button_font_color = color opacity` : The font color. *(since 0.14)*
* `button_background_id = integer` : Which background to use. *(since 0.14)*
* `button_centered = boolean (0 or 1)` : Whether to center the text. *(since 0.14)*
* `button_padding = horizontal_padding vertical_padding spacing_between_icon_and_text` *(since 0.14)*
* `button_lclick_command = text` : Command to execute on left click. If not defined, `execp_command` is executed immediately, unless it is currently running. *(since 0.14)*
* `button_mclick_command = text` : Command to execute on right click. If not defined, `execp_command` is executed immediately, unless it is currently running. *(since 0.14)*
* `button_rclick_command = text` : Command to execute on middle click. If not defined, `execp_command` is executed immediately, unless it is currently running. *(since 0.14)*
* `button_uwheel_command = text` : Command to execute on wheel scroll up. If not defined, `execp_command` is executed immediately, unless it is currently running. *(since 0.14)*
* `button_dwheel_command = text` : Command to execute on wheel scroll down. If not defined, `execp_command` is executed immediately, unless it is currently running. *(since 0.14)*
### Separator
* `separator = new` : Begins the configuration of a new separator. Multiple such plugins are supported; just use multiple `:`s in `panel_items`. *(since 0.13.0)*
......@@ -687,142 +716,7 @@ execp_interval = 1
### Example configuration
```
#---------------------------------------------
## TINT2 CONFIG FILE
#---------------------------------------------
#---------------------------------------------
## BACKGROUND AND BORDER
#---------------------------------------------
rounded = 7
border_width = 2
background_color = #000000 60
border_color = #ffffff 18
rounded = 5
border_width = 0
background_color = #ffffff 40
border_color = #ffffff 50
rounded = 5
border_width = 0
background_color = #ffffff 18
border_color = #ffffff 70
#---------------------------------------------
## PANEL
#---------------------------------------------
panel_monitor = all
panel_position = bottom center
panel_size = 94% 30
panel_margin = 0 0
panel_padding = 7 0
font_shadow = 0
panel_background_id = 1
wm_menu = 0
panel_dock = 0
panel_layer = bottom
#---------------------------------------------
## TASKBAR
#---------------------------------------------
#taskbar_mode = multi_desktop
taskbar_mode = single_desktop
taskbar_padding = 2 3 2
taskbar_background_id = 0
#taskbar_active_background_id = 0
#---------------------------------------------
## TASKS
#---------------------------------------------
task_icon = 1
task_text = 1
task_maximum_size = 140 35
task_centered = 1
task_padding = 6 3
task_font = sans 7
task_font_color = #ffffff 70
task_background_id = 3
task_icon_asb = 100 0 0
## replace STATUS by 'urgent', 'active' or 'iconified'
#task_STATUS_background_id = 2
#task_STATUS_font_color = #ffffff 85
#task_STATUS_icon_asb = 100 0 0
## example:
task_active_background_id = 2
task_active_font_color = #ffffff 85
task_active_icon_asb = 100 0 0
urgent_nb_of_blink = 8
#---------------------------------------------
## SYSTRAYBAR
#---------------------------------------------
systray = 1
systray_padding = 0 4 5
systray_background_id = 0
systray_sort = left2right
systray_icon_size = 0
systray_icon_asb = 100 0 0
#---------------------------------------------
## CLOCK
#---------------------------------------------
time1_format = %H:%M
time1_font = sans 8
time2_format = %A %d %B
time2_font = sans 6
clock_font_color = #ffffff 76
clock_padding = 1 0
clock_background_id = 0
#clock_lclick_command = xclock
clock_rclick_command = orage
#clock_tooltip = %A %d %B
#time1_timezone = :US/Hawaii
#time2_timezone = :Europe/Berlin
#clock_tooltip_timezone = :/usr/share/zoneinfo/Europe/Paris
#---------------------------------------------
## BATTERY
#---------------------------------------------
battery = 0
battery_hide = 98
battery_low_status = 10
battery_low_cmd = notify-send "battery low"
bat1_font = sans 8
bat2_font = sans 6
battery_font_color = #ffffff 76
battery_padding = 1 0
battery_background_id = 0
#---------------------------------------------
## TOOLTIP
#---------------------------------------------
tooltip = 0
tooltip_padding = 2 2
tooltip_show_timeout = 0.7
tooltip_hide_timeout = 0.3
tooltip_background_id = 1
tooltip_font_color = #OOOOOO 80
tooltip_font = sans 10
#---------------------------------------------
## MOUSE ACTION ON TASK
#---------------------------------------------
mouse_middle = none
mouse_right = close
mouse_scroll_up = toggle
mouse_scroll_down = iconify
#---------------------------------------------
## AUTOHIDE OPTIONS
#---------------------------------------------
autohide = 0
autohide_show_timeout = 0.3
autohide_hide_timeout = 2
autohide_height = 4
strut_policy = minimum
```
See /etc/xdg/tint2/tint2rc.
## AUTHOR
tint2 was written by Thierry Lorthiois <lorthiois@bbsoft.fr>.
......
This diff is collapsed.
#ifndef BUTTON_H
#define BUTTON_H
#include <sys/time.h>
#include <pango/pangocairo.h>
#include "area.h"
#include "common.h"
#include "timer.h"
// Architecture:
// Panel panel_config contains an array of Button, each storing all config options and all the state variables.
// Only these run commands.
//
// Tint2 maintains an array of Panels, one for each monitor. Each stores an array of Button which was initially copied
// from panel_config. Each works as a frontend to the corresponding Button in panel_config as backend, using the
// backend's config and state variables.
typedef struct ButtonBackend {
// Config:
char *icon_name;
char *text;
char *tooltip;
gboolean centered;
gboolean has_font;
PangoFontDescription *font_desc;
Color font_color;
char *lclick_command;
char *mclick_command;
char *rclick_command;
char *uwheel_command;
char *dwheel_command;
// paddingxlr = horizontal padding left/right
// paddingx = horizontal padding between childs
int paddingxlr, paddingx, paddingy;
Background *bg;
// List of Button which are frontends for this backend, one for each panel
GList *instances;
} ButtonBackend;
typedef struct ButtonFrontend {
// Frontend state:
Imlib_Image icon;
Imlib_Image icon_hover;
Imlib_Image icon_pressed;
int icon_load_size;
int iconx;
int icony;
int iconw;
int iconh;
int textx;
int texty;
int textw;
int texth;
} ButtonFrontend;
typedef struct Button {
Area area;
// All elements have the backend pointer set. However only backend elements have ownership.
ButtonBackend *backend;
// Set only for frontend Button items.
ButtonFrontend *frontend;
} Button;
// Called before the config is read and panel_config/panels are created.
// Afterwards, the config parsing code creates the array of Button in panel_config and populates the configuration fields
// in the backend.
// Probably does nothing.
void default_button();
// Creates a new Button item with only the backend field set. The state is NOT initialized. The config is initialized to
// the default values.
// This will be used by the config code to populate its backedn config fields.
Button *create_button();
void destroy_button(void *obj);
// Called after the config is read and panel_config is populated, but before panels are created.
// Initializes the state of the backend items.
// panel_config.panel_items is used to determine which backend items are enabled. The others should be destroyed and
// removed from panel_config.button_list.
void init_button();
// Called after each on-screen panel is created, with a pointer to the panel.
// Initializes the state of the frontend items. Also adds a pointer to it in backend->instances.
// At this point the Area has not been added yet to the GUI tree, but it will be added right away.
void init_button_panel(void *panel);
// Called just before the panels are destroyed. Afterwards, tint2 exits or restarts and reads the config again.
// Releases all frontends and then all the backends.
// The frontend items are not freed by this function, only their members. The items are Areas which are freed in the
// GUI element tree cleanup function (remove_area).
void cleanup_button();
// Called on draw, obj = pointer to the front-end Button item.
void draw_button(void *obj, cairo_t *c);
// Called on resize, obj = pointer to the front-end Button item.
// Returns 1 if the new size is different than the previous size.
gboolean resize_button(void *obj);
// Called on mouse click event.
void button_action(void *obj, int button, int x, int y);
void button_default_font_changed();
void button_default_icon_theme_changed();
void button_reload_icon(Button *button);
#endif // BUTTON_H
......@@ -221,6 +221,15 @@ Execp *get_or_create_last_execp()
return (Execp *)g_list_last(panel_config.execp_list)->data;
}
Button *get_or_create_last_button()
{
if (!panel_config.button_list) {
fprintf(stderr, "Warning: button items should start with 'button = new'\n");
panel_config.button_list = g_list_append(panel_config.button_list, create_button());
}
return (Button *)g_list_last(panel_config.button_list)->data;
}
void add_entry(char *key, char *value)
{
char *value1 = 0, *value2 = 0, *value3 = 0;
......@@ -738,6 +747,78 @@ void add_entry(char *key, char *value)
execp->backend->dwheel_command = strdup(value);
}
/* Button */
else if (strcmp(key, "button") == 0) {
panel_config.button_list = g_list_append(panel_config.button_list, create_button());
} else if (strcmp(key, "button_icon") == 0) {
Button *button = get_or_create_last_button();
button->backend->icon_name = strdup(value);
} else if (strcmp(key, "button_text") == 0) {
Button *button = get_or_create_last_button();
free_and_null(button->backend->text);
button->backend->text = strdup(value);
} else if (strcmp(key, "button_tooltip") == 0) {
Button *button = get_or_create_last_button();
free_and_null(button->backend->tooltip);
button->backend->tooltip = strdup(value);
} else if (strcmp(key, "button_font") == 0) {
Button *button = get_or_create_last_button();
pango_font_description_free(button->backend->font_desc);
button->backend->font_desc = pango_font_description_from_string(value);
button->backend->has_font = TRUE;
} else if (strcmp(key, "button_font_color") == 0) {
Button *button = get_or_create_last_button();
extract_values(value, &value1, &value2, &value3);
get_color(value1, button->backend->font_color.rgb);
if (value2)
button->backend->font_color.alpha = atoi(value2) / 100.0;
else
button->backend->font_color.alpha = 0.5;