Compare commits
88 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5f41544089 | ||
|
|
e8d78f4656 | ||
|
|
3960ab31da | ||
|
|
e185e3fb47 | ||
|
|
095b311edc | ||
|
|
96b9a46c07 | ||
|
|
3037d8b507 | ||
|
|
df9df99c23 | ||
|
|
7d972e53d7 | ||
|
|
6061b76331 | ||
|
|
0900c088ee | ||
|
|
68d3799c47 | ||
|
|
1b554ebc1e | ||
|
|
732b9d3910 | ||
|
|
34b341767c | ||
|
|
070eb7ba4d | ||
|
|
57c35549f3 | ||
|
|
f2922d7dbd | ||
|
|
61016a9318 | ||
|
|
9e2fbec797 | ||
|
|
294fdee57f | ||
|
|
fe06ff5075 | ||
|
|
73ed55f288 | ||
|
|
2ff9ee9eba | ||
|
|
3b434c0ef5 | ||
|
|
6d59e55d8d | ||
|
|
d2636c8c57 | ||
|
|
b52f193804 | ||
|
|
23ce5df057 | ||
|
|
da06691292 | ||
|
|
8b6aad3a41 | ||
|
|
985c557dcd | ||
|
|
6937aa8b9d | ||
|
|
2299132cd3 | ||
|
|
005e5a49c0 | ||
|
|
85b3b8a749 | ||
|
|
42d1ba2b20 | ||
|
|
b887d50409 | ||
|
|
66b38cc7d6 | ||
|
|
dca5c2586c | ||
|
|
89f26595b6 | ||
|
|
3d39da9330 | ||
|
|
eb86d5ac00 | ||
|
|
5b01670a22 | ||
|
|
1f7f1971ec | ||
|
|
7109bac4a0 | ||
|
|
00a1803348 | ||
|
|
03dd8b8483 | ||
|
|
553adbb946 | ||
|
|
2fb556031b | ||
|
|
9e85b6dcfe | ||
|
|
0d0b1249c7 | ||
|
|
46a6d2c2ad | ||
|
|
1051be9815 | ||
|
|
f241c4546b | ||
|
|
00b88c2725 | ||
|
|
10b006ffb2 | ||
|
|
133bbc911e | ||
|
|
28272621b0 | ||
|
|
61d786cf4f | ||
|
|
9d2e62f724 | ||
|
|
6e77b59ef8 | ||
|
|
3a733d7353 | ||
|
|
8df9ed5977 | ||
|
|
cf748d6d41 | ||
|
|
8528a6a4a4 | ||
|
|
169278c9d8 | ||
|
|
db490247e0 | ||
|
|
3c45cf29c7 | ||
|
|
66acd8ed38 | ||
|
|
d1c22762c4 | ||
|
|
441c420773 | ||
|
|
edad9bb7f5 | ||
|
|
f954be3e87 | ||
|
|
cbd52d1a48 | ||
|
|
aa47642161 | ||
|
|
57c38c462c | ||
|
|
995ae3c72b | ||
|
|
9df55d5ef7 | ||
|
|
ffd659208a | ||
|
|
76b69b86dc | ||
|
|
a8e1c9d3aa | ||
|
|
3dbd13aa77 | ||
|
|
291be57cde | ||
|
|
ae375ae526 | ||
|
|
84f9f6d0cd | ||
|
|
ed24d0bd4c | ||
|
|
8eca71ac95 |
@@ -7,6 +7,9 @@ option( ENABLE_EXAMPLES "Install additional tin2rc examples" ON )
|
|||||||
option( ENABLE_RSVG "Rsvg support (launcher only)" ON )
|
option( ENABLE_RSVG "Rsvg support (launcher only)" ON )
|
||||||
option( ENABLE_SN "Startup notification support" ON )
|
option( ENABLE_SN "Startup notification support" ON )
|
||||||
option( ENABLE_ASAN "Build tint2 with AddressSanitizer" OFF )
|
option( ENABLE_ASAN "Build tint2 with AddressSanitizer" OFF )
|
||||||
|
if( CMAKE_SYSTEM_NAME STREQUAL "Linux" )
|
||||||
|
option( ENABLE_UEVENT "Kernel event handling support" ON )
|
||||||
|
endif( CMAKE_SYSTEM_NAME STREQUAL "Linux" )
|
||||||
|
|
||||||
include( FindPkgConfig )
|
include( FindPkgConfig )
|
||||||
include( CheckLibraryExists )
|
include( CheckLibraryExists )
|
||||||
@@ -78,7 +81,20 @@ set( SOURCES src/config.c
|
|||||||
src/util/window.c )
|
src/util/window.c )
|
||||||
|
|
||||||
if( ENABLE_BATTERY )
|
if( ENABLE_BATTERY )
|
||||||
set( SOURCES ${SOURCES} src/battery/battery.c )
|
set( SOURCES ${SOURCES} src/battery/battery.c)
|
||||||
|
|
||||||
|
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
|
set( SOURCES ${SOURCES} src/battery/linux.c)
|
||||||
|
elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
||||||
|
set( SOURCES ${SOURCES} src/battery/freebsd.c)
|
||||||
|
elseif(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
|
||||||
|
set( SOURCES ${SOURCES} src/battery/openbsd.c)
|
||||||
|
elseif(CMAKE_SYSTEM_NAME STREQUAL "NetBSD")
|
||||||
|
set( SOURCES ${SOURCES} src/battery/openbsd.c)
|
||||||
|
else(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
|
set( SOURCES ${SOURCES} src/battery/dummy.c)
|
||||||
|
endif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
|
|
||||||
add_definitions( -DENABLE_BATTERY )
|
add_definitions( -DENABLE_BATTERY )
|
||||||
endif( ENABLE_BATTERY )
|
endif( ENABLE_BATTERY )
|
||||||
|
|
||||||
@@ -98,6 +114,11 @@ if( ENABLE_SN )
|
|||||||
endif( SN_FOUND )
|
endif( SN_FOUND )
|
||||||
endif( ENABLE_SN)
|
endif( ENABLE_SN)
|
||||||
|
|
||||||
|
if( ENABLE_UEVENT )
|
||||||
|
add_definitions( -DENABLE_UEVENT )
|
||||||
|
set( SOURCES ${SOURCES} src/util/uevent.c)
|
||||||
|
endif( ENABLE_UEVENT )
|
||||||
|
|
||||||
if( ENABLE_TINT2CONF )
|
if( ENABLE_TINT2CONF )
|
||||||
add_definitions( -DHAVE_VERSION_H )
|
add_definitions( -DHAVE_VERSION_H )
|
||||||
add_subdirectory( src/tint2conf )
|
add_subdirectory( src/tint2conf )
|
||||||
@@ -135,9 +156,13 @@ target_link_libraries( tint2 ${X11_LIBRARIES}
|
|||||||
${CAIRO_LIBRARIES}
|
${CAIRO_LIBRARIES}
|
||||||
${GLIB2_LIBRARIES}
|
${GLIB2_LIBRARIES}
|
||||||
${GOBJECT2_LIBRARIES}
|
${GOBJECT2_LIBRARIES}
|
||||||
${IMLIB2_LIBRARIES}
|
${IMLIB2_LIBRARIES} )
|
||||||
${RSVG_LIBRARIES}
|
if( ENABLE_RSVG )
|
||||||
${SN_LIBRARIES} )
|
target_link_libraries( tint2 ${RSVG_LIBRARIES} )
|
||||||
|
endif( ENABLE_RSVG )
|
||||||
|
if( ENABLE_SN )
|
||||||
|
target_link_libraries( tint2 ${SN_LIBRARIES} )
|
||||||
|
endif( ENABLE_SN )
|
||||||
if( RT_LIBRARY )
|
if( RT_LIBRARY )
|
||||||
target_link_libraries( tint2 ${RT_LIBRARY} )
|
target_link_libraries( tint2 ${RT_LIBRARY} )
|
||||||
endif( RT_LIBRARY )
|
endif( RT_LIBRARY )
|
||||||
|
|||||||
19
ChangeLog
19
ChangeLog
@@ -1,3 +1,22 @@
|
|||||||
|
2015-11-12 0.12.3
|
||||||
|
- Enhancements:
|
||||||
|
- Battery: Multiple batteries are now supported under Linux (issue #139;
|
||||||
|
thanks to Sebastian Reichel)
|
||||||
|
- Battery: The time left for charging/discharging the battery is now estimated
|
||||||
|
when the system is not able to read current data from sensors (issue #522;
|
||||||
|
thanks to Sebastian Reichel)
|
||||||
|
- Battery: Reacts to plug/unplug events (thanks to Sebastian Reichel)
|
||||||
|
- tint2conf: Backgrounds now have a text label showing which panel component
|
||||||
|
uses them, to make them easier to identify; the label is saved as a comment
|
||||||
|
in the config file (issue #521)
|
||||||
|
- New config options:
|
||||||
|
- Mouse over effects (mouse_effects, background_color_hover, border_color_hover)
|
||||||
|
- Launcher icon background (launcher_icon_background_id)
|
||||||
|
- Enable/disable battery tooltips (battery_tooltip_enabled)
|
||||||
|
- Fixes:
|
||||||
|
- Updated French translation
|
||||||
|
- The correct icon is now used in tint2.desktop (issue #523)
|
||||||
|
- The font setting for the desktop name is no longer lost on tint2 restart
|
||||||
2015-08-11 0.12.2
|
2015-08-11 0.12.2
|
||||||
- Fixes:
|
- Fixes:
|
||||||
- Systray: do not move empty icons to the side, as it breaks GTK2 StatusIcon blinking (issue #515)
|
- Systray: do not move empty icons to the side, as it breaks GTK2 StatusIcon blinking (issue #515)
|
||||||
|
|||||||
10
README.md
10
README.md
@@ -1,13 +1,13 @@
|
|||||||
### New stable release: 0.12.2
|
### New stable release: 0.12.3
|
||||||
Changes: https://gitlab.com/o9000/tint2/blob/0.12.2/ChangeLog
|
Changes: https://gitlab.com/o9000/tint2/blob/0.12.3/ChangeLog
|
||||||
|
|
||||||
Documentation: https://gitlab.com/o9000/tint2/wikis/home
|
Documentation: https://gitlab.com/o9000/tint2/wikis/Configure
|
||||||
|
|
||||||
Try it out with (see also [dependencies](https://gitlab.com/o9000/tint2/wikis/Install#dependencies)):
|
Try it out with (see also [dependencies](https://gitlab.com/o9000/tint2/wikis/Install#dependencies)):
|
||||||
```
|
```
|
||||||
git clone https://gitlab.com/o9000/tint2.git
|
git clone https://gitlab.com/o9000/tint2.git
|
||||||
cd tint2
|
cd tint2
|
||||||
git checkout 0.12.2
|
git checkout 0.12.3
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
cmake ..
|
cmake ..
|
||||||
@@ -71,7 +71,7 @@ tint2 is a simple panel/taskbar made for modern X window managers. It was specif
|
|||||||
* Old project location (inactive): https://code.google.com/p/tint2
|
* Old project location (inactive): https://code.google.com/p/tint2
|
||||||
|
|
||||||
### Releases
|
### Releases
|
||||||
* Latest stable release: tint2 0.12.2 (August 2015)
|
* Latest stable release: tint2 0.12.3 (November 2015)
|
||||||
|
|
||||||
### Screenshots
|
### Screenshots
|
||||||

|

|
||||||
@@ -1,47 +1,77 @@
|
|||||||
#---- Generated by tint2conf 1238 ----
|
#---- Generated by tint2conf bd50 ----
|
||||||
|
# See https://gitlab.com/o9000/tint2/wikis/Configure for
|
||||||
|
# full documentation of the configuration options.
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
# Backgrounds
|
# Backgrounds
|
||||||
# Background 1
|
# Background 1: Panel
|
||||||
rounded = 5
|
rounded = 5
|
||||||
border_width = 1
|
border_width = 1
|
||||||
background_color = #111111 100
|
background_color = #111111 100
|
||||||
border_color = #333333 100
|
border_color = #333333 100
|
||||||
|
background_color_hover = #111111 100
|
||||||
|
border_color_hover = #333333 100
|
||||||
|
background_color_pressed = #111111 100
|
||||||
|
border_color_pressed = #333333 100
|
||||||
|
|
||||||
# Background 2
|
# Background 2: Default task, Iconified task
|
||||||
rounded = 5
|
rounded = 5
|
||||||
border_width = 0
|
border_width = 1
|
||||||
background_color = #111111 100
|
background_color = #111111 100
|
||||||
border_color = #222222 100
|
border_color = #222222 100
|
||||||
|
background_color_hover = #111111 100
|
||||||
|
border_color_hover = #555555 100
|
||||||
|
background_color_pressed = #333333 100
|
||||||
|
border_color_pressed = #555555 100
|
||||||
|
|
||||||
# Background 3
|
# Background 3: Active task
|
||||||
rounded = 5
|
rounded = 5
|
||||||
border_width = 1
|
border_width = 1
|
||||||
background_color = #222222 100
|
background_color = #222222 100
|
||||||
border_color = #777777 100
|
border_color = #777777 100
|
||||||
|
background_color_hover = #222222 100
|
||||||
|
border_color_hover = #777777 100
|
||||||
|
background_color_pressed = #333333 100
|
||||||
|
border_color_pressed = #777777 100
|
||||||
|
|
||||||
# Background 4
|
# Background 4: Urgent task
|
||||||
rounded = 5
|
rounded = 5
|
||||||
border_width = 1
|
border_width = 1
|
||||||
background_color = #aa4400 100
|
background_color = #aa4400 100
|
||||||
border_color = #aa7733 100
|
border_color = #aa7733 100
|
||||||
|
background_color_hover = #aa4400 100
|
||||||
|
border_color_hover = #aa7733 100
|
||||||
|
background_color_pressed = #aa4400 100
|
||||||
|
border_color_pressed = #aa7733 100
|
||||||
|
|
||||||
# Background 5
|
# Background 5: Tooltip
|
||||||
rounded = 2
|
rounded = 2
|
||||||
border_width = 1
|
border_width = 1
|
||||||
background_color = #ffffaa 100
|
background_color = #ffffaa 100
|
||||||
border_color = #999999 100
|
border_color = #999999 100
|
||||||
|
background_color_hover = #ffffaa 100
|
||||||
|
border_color_hover = #999999 100
|
||||||
|
background_color_pressed = #ffffaa 100
|
||||||
|
border_color_pressed = #999999 100
|
||||||
|
|
||||||
# Background 6
|
# Background 6: Inactive desktop name
|
||||||
rounded = 2
|
rounded = 2
|
||||||
border_width = 1
|
border_width = 1
|
||||||
background_color = #111111 100
|
background_color = #111111 100
|
||||||
border_color = #222222 100
|
border_color = #222222 100
|
||||||
|
background_color_hover = #111111 100
|
||||||
|
border_color_hover = #555555 100
|
||||||
|
background_color_pressed = #333333 100
|
||||||
|
border_color_pressed = #555555 100
|
||||||
|
|
||||||
# Background 7
|
# Background 7: Active desktop name
|
||||||
rounded = 2
|
rounded = 2
|
||||||
border_width = 1
|
border_width = 1
|
||||||
background_color = #222222 100
|
background_color = #222222 100
|
||||||
border_color = #777777 100
|
border_color = #777777 100
|
||||||
|
background_color_hover = #222222 100
|
||||||
|
border_color_hover = #777777 100
|
||||||
|
background_color_pressed = #222222 100
|
||||||
|
border_color_pressed = #777777 100
|
||||||
|
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
# Panel
|
# Panel
|
||||||
@@ -62,7 +92,10 @@ autohide_height = 2
|
|||||||
strut_policy = follow_size
|
strut_policy = follow_size
|
||||||
panel_window_name = tint2
|
panel_window_name = tint2
|
||||||
disable_transparency = 0
|
disable_transparency = 0
|
||||||
|
mouse_effects = 1
|
||||||
font_shadow = 0
|
font_shadow = 0
|
||||||
|
mouse_hover_icon_asb = 100 0 10
|
||||||
|
mouse_pressed_icon_asb = 100 0 0
|
||||||
|
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
# Taskbar
|
# Taskbar
|
||||||
@@ -81,6 +114,7 @@ taskbar_name_font_color = #dddddd 100
|
|||||||
taskbar_name_active_font_color = #dddddd 100
|
taskbar_name_active_font_color = #dddddd 100
|
||||||
taskbar_distribute_size = 1
|
taskbar_distribute_size = 1
|
||||||
taskbar_sort_order = none
|
taskbar_sort_order = none
|
||||||
|
task_align = left
|
||||||
|
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
# Task
|
# Task
|
||||||
@@ -117,8 +151,10 @@ systray_monitor = 1
|
|||||||
# Launcher
|
# Launcher
|
||||||
launcher_padding = 0 0 2
|
launcher_padding = 0 0 2
|
||||||
launcher_background_id = 0
|
launcher_background_id = 0
|
||||||
|
launcher_icon_background_id = 0
|
||||||
launcher_icon_size = 22
|
launcher_icon_size = 22
|
||||||
launcher_icon_asb = 100 0 0
|
launcher_icon_asb = 100 0 0
|
||||||
|
launcher_icon_theme_override = 0
|
||||||
startup_notifications = 1
|
startup_notifications = 1
|
||||||
launcher_tooltip = 1
|
launcher_tooltip = 1
|
||||||
launcher_item_app = /usr/share/applications/tint2conf.desktop
|
launcher_item_app = /usr/share/applications/tint2conf.desktop
|
||||||
@@ -143,9 +179,13 @@ clock_tooltip =
|
|||||||
clock_tooltip_timezone =
|
clock_tooltip_timezone =
|
||||||
clock_lclick_command = zenity --calendar --text ""
|
clock_lclick_command = zenity --calendar --text ""
|
||||||
clock_rclick_command = orage
|
clock_rclick_command = orage
|
||||||
|
clock_mclick_command =
|
||||||
|
clock_uwheel_command =
|
||||||
|
clock_dwheel_command =
|
||||||
|
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
# Battery
|
# Battery
|
||||||
|
battery_tooltip = 1
|
||||||
battery_low_status = 10
|
battery_low_status = 10
|
||||||
battery_low_cmd = notify-send "battery low"
|
battery_low_cmd = notify-send "battery low"
|
||||||
bat1_font = sans 8
|
bat1_font = sans 8
|
||||||
@@ -154,6 +194,13 @@ battery_font_color = #eeeeee 100
|
|||||||
battery_padding = 1 0
|
battery_padding = 1 0
|
||||||
battery_background_id = 0
|
battery_background_id = 0
|
||||||
battery_hide = 101
|
battery_hide = 101
|
||||||
|
battery_lclick_command =
|
||||||
|
battery_rclick_command =
|
||||||
|
battery_mclick_command =
|
||||||
|
battery_uwheel_command =
|
||||||
|
battery_dwheel_command =
|
||||||
|
ac_connected_cmd =
|
||||||
|
ac_disconnected_cmd =
|
||||||
|
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
# Tooltip
|
# Tooltip
|
||||||
|
|||||||
@@ -1,47 +1,77 @@
|
|||||||
#---- Generated by tint2conf 24b3 ----
|
#---- Generated by tint2conf ab72 ----
|
||||||
|
# See https://gitlab.com/o9000/tint2/wikis/Configure for
|
||||||
|
# full documentation of the configuration options.
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
# Backgrounds
|
# Backgrounds
|
||||||
# Background 1
|
# Background 1: Panel
|
||||||
rounded = 5
|
rounded = 5
|
||||||
border_width = 1
|
border_width = 1
|
||||||
background_color = #000000 80
|
background_color = #000000 80
|
||||||
border_color = #555555 80
|
border_color = #555555 80
|
||||||
|
background_color_hover = #000000 80
|
||||||
|
border_color_hover = #555555 80
|
||||||
|
background_color_pressed = #000000 80
|
||||||
|
border_color_pressed = #555555 80
|
||||||
|
|
||||||
# Background 2
|
# Background 2: Default task, Iconified task
|
||||||
rounded = 5
|
rounded = 5
|
||||||
border_width = 0
|
border_width = 1
|
||||||
background_color = #777777 0
|
background_color = #777777 0
|
||||||
border_color = #777777 10
|
border_color = #777777 0
|
||||||
|
background_color_hover = #777777 4
|
||||||
|
border_color_hover = #cccccc 30
|
||||||
|
background_color_pressed = #333333 4
|
||||||
|
border_color_pressed = #777777 30
|
||||||
|
|
||||||
# Background 3
|
# Background 3: Active task
|
||||||
rounded = 5
|
rounded = 5
|
||||||
border_width = 1
|
border_width = 1
|
||||||
background_color = #555555 10
|
background_color = #555555 10
|
||||||
border_color = #ffffff 60
|
border_color = #ffffff 60
|
||||||
|
background_color_hover = #cccccc 10
|
||||||
|
border_color_hover = #ffffff 60
|
||||||
|
background_color_pressed = #555555 10
|
||||||
|
border_color_pressed = #ffffff 60
|
||||||
|
|
||||||
# Background 4
|
# Background 4: Urgent task
|
||||||
rounded = 5
|
rounded = 5
|
||||||
border_width = 1
|
border_width = 1
|
||||||
background_color = #aa4400 100
|
background_color = #aa4400 100
|
||||||
border_color = #aa7733 100
|
border_color = #aa7733 100
|
||||||
|
background_color_hover = #aa4400 100
|
||||||
|
border_color_hover = #aa7733 100
|
||||||
|
background_color_pressed = #aa4400 100
|
||||||
|
border_color_pressed = #aa7733 100
|
||||||
|
|
||||||
# Background 5
|
# Background 5: Tooltip
|
||||||
rounded = 2
|
rounded = 2
|
||||||
border_width = 1
|
border_width = 1
|
||||||
background_color = #ffffaa 100
|
background_color = #ffffaa 100
|
||||||
border_color = #999999 100
|
border_color = #999999 100
|
||||||
|
background_color_hover = #ffffaa 100
|
||||||
|
border_color_hover = #999999 100
|
||||||
|
background_color_pressed = #ffffaa 100
|
||||||
|
border_color_pressed = #999999 100
|
||||||
|
|
||||||
# Background 6
|
# Background 6: Inactive desktop name
|
||||||
rounded = 2
|
rounded = 2
|
||||||
border_width = 1
|
border_width = 1
|
||||||
background_color = #777777 0
|
background_color = #777777 0
|
||||||
border_color = #777777 30
|
border_color = #777777 30
|
||||||
|
background_color_hover = #777777 4
|
||||||
|
border_color_hover = #cccccc 30
|
||||||
|
background_color_pressed = #777777 0
|
||||||
|
border_color_pressed = #777777 30
|
||||||
|
|
||||||
# Background 7
|
# Background 7: Active desktop name
|
||||||
rounded = 2
|
rounded = 2
|
||||||
border_width = 1
|
border_width = 1
|
||||||
background_color = #555555 10
|
background_color = #555555 10
|
||||||
border_color = #ffffff 60
|
border_color = #ffffff 60
|
||||||
|
background_color_hover = #555555 10
|
||||||
|
border_color_hover = #ffffff 60
|
||||||
|
background_color_pressed = #555555 10
|
||||||
|
border_color_pressed = #ffffff 60
|
||||||
|
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
# Panel
|
# Panel
|
||||||
@@ -62,7 +92,10 @@ autohide_height = 2
|
|||||||
strut_policy = follow_size
|
strut_policy = follow_size
|
||||||
panel_window_name = tint2
|
panel_window_name = tint2
|
||||||
disable_transparency = 0
|
disable_transparency = 0
|
||||||
|
mouse_effects = 1
|
||||||
font_shadow = 0
|
font_shadow = 0
|
||||||
|
mouse_hover_icon_asb = 100 0 10
|
||||||
|
mouse_pressed_icon_asb = 100 0 0
|
||||||
|
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
# Taskbar
|
# Taskbar
|
||||||
@@ -81,6 +114,7 @@ taskbar_name_font_color = #dddddd 100
|
|||||||
taskbar_name_active_font_color = #dddddd 100
|
taskbar_name_active_font_color = #dddddd 100
|
||||||
taskbar_distribute_size = 1
|
taskbar_distribute_size = 1
|
||||||
taskbar_sort_order = none
|
taskbar_sort_order = none
|
||||||
|
task_align = left
|
||||||
|
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
# Task
|
# Task
|
||||||
@@ -117,16 +151,16 @@ systray_monitor = 1
|
|||||||
# Launcher
|
# Launcher
|
||||||
launcher_padding = 0 0 2
|
launcher_padding = 0 0 2
|
||||||
launcher_background_id = 0
|
launcher_background_id = 0
|
||||||
|
launcher_icon_background_id = 0
|
||||||
launcher_icon_size = 22
|
launcher_icon_size = 22
|
||||||
launcher_icon_asb = 100 0 0
|
launcher_icon_asb = 100 0 0
|
||||||
|
launcher_icon_theme_override = 0
|
||||||
startup_notifications = 1
|
startup_notifications = 1
|
||||||
launcher_tooltip = 1
|
launcher_tooltip = 1
|
||||||
launcher_item_app = /usr/share/applications/tint2conf.desktop
|
|
||||||
launcher_item_app = /usr/local/share/applications/tint2conf.desktop
|
|
||||||
launcher_item_app = /usr/share/applications/firefox.desktop
|
launcher_item_app = /usr/share/applications/firefox.desktop
|
||||||
launcher_item_app = /usr/share/applications/iceweasel.desktop
|
launcher_item_app = /usr/share/applications/iceweasel.desktop
|
||||||
launcher_item_app = /usr/share/applications/chromium-browser.desktop
|
|
||||||
launcher_item_app = /usr/share/applications/google-chrome.desktop
|
launcher_item_app = /usr/share/applications/google-chrome.desktop
|
||||||
|
launcher_item_app = /usr/local/share/applications/tint2conf.desktop
|
||||||
|
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
# Clock
|
# Clock
|
||||||
@@ -143,9 +177,13 @@ clock_tooltip =
|
|||||||
clock_tooltip_timezone =
|
clock_tooltip_timezone =
|
||||||
clock_lclick_command = zenity --calendar --text ""
|
clock_lclick_command = zenity --calendar --text ""
|
||||||
clock_rclick_command = orage
|
clock_rclick_command = orage
|
||||||
|
clock_mclick_command =
|
||||||
|
clock_uwheel_command =
|
||||||
|
clock_dwheel_command =
|
||||||
|
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
# Battery
|
# Battery
|
||||||
|
battery_tooltip = 1
|
||||||
battery_low_status = 10
|
battery_low_status = 10
|
||||||
battery_low_cmd = notify-send "battery low"
|
battery_low_cmd = notify-send "battery low"
|
||||||
bat1_font = sans 8
|
bat1_font = sans 8
|
||||||
@@ -154,6 +192,13 @@ battery_font_color = #eeeeee 100
|
|||||||
battery_padding = 1 0
|
battery_padding = 1 0
|
||||||
battery_background_id = 0
|
battery_background_id = 0
|
||||||
battery_hide = 101
|
battery_hide = 101
|
||||||
|
battery_lclick_command =
|
||||||
|
battery_rclick_command =
|
||||||
|
battery_mclick_command =
|
||||||
|
battery_uwheel_command =
|
||||||
|
battery_dwheel_command =
|
||||||
|
ac_connected_cmd =
|
||||||
|
ac_disconnected_cmd =
|
||||||
|
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
# Tooltip
|
# Tooltip
|
||||||
|
|||||||
@@ -1,53 +1,87 @@
|
|||||||
#---- Generated by tint2conf 3ad3 ----
|
#---- Generated by tint2conf 079a ----
|
||||||
|
# See https://gitlab.com/o9000/tint2/wikis/Configure for
|
||||||
|
# full documentation of the configuration options.
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
# Backgrounds
|
# Backgrounds
|
||||||
# Background 1
|
# Background 1: Panel
|
||||||
rounded = 0
|
rounded = 0
|
||||||
border_width = 1
|
border_width = 1
|
||||||
background_color = #eeeeee 100
|
background_color = #eeeeee 100
|
||||||
border_color = #bbbbbb 100
|
border_color = #bbbbbb 100
|
||||||
|
background_color_hover = #eeeeee 100
|
||||||
|
border_color_hover = #bbbbbb 100
|
||||||
|
background_color_pressed = #eeeeee 100
|
||||||
|
border_color_pressed = #bbbbbb 100
|
||||||
|
|
||||||
# Background 2
|
# Background 2: Default task, Iconified task
|
||||||
rounded = 5
|
rounded = 5
|
||||||
border_width = 0
|
border_width = 1
|
||||||
background_color = #eeeeee 100
|
background_color = #eeeeee 100
|
||||||
border_color = #cccccc 100
|
border_color = #eeeeee 100
|
||||||
|
background_color_hover = #eeeeee 100
|
||||||
|
border_color_hover = #cccccc 100
|
||||||
|
background_color_pressed = #cccccc 100
|
||||||
|
border_color_pressed = #cccccc 100
|
||||||
|
|
||||||
# Background 3
|
# Background 3: Active task
|
||||||
rounded = 5
|
rounded = 5
|
||||||
border_width = 1
|
border_width = 1
|
||||||
background_color = #dddddd 100
|
background_color = #dddddd 100
|
||||||
border_color = #999999 100
|
border_color = #999999 100
|
||||||
|
background_color_hover = #eeeeee 100
|
||||||
|
border_color_hover = #aaaaaa 100
|
||||||
|
background_color_pressed = #cccccc 100
|
||||||
|
border_color_pressed = #999999 100
|
||||||
|
|
||||||
# Background 4
|
# Background 4: Urgent task
|
||||||
rounded = 5
|
rounded = 5
|
||||||
border_width = 1
|
border_width = 1
|
||||||
background_color = #aa4400 100
|
background_color = #aa4400 100
|
||||||
border_color = #aa7733 100
|
border_color = #aa7733 100
|
||||||
|
background_color_hover = #aa4400 100
|
||||||
|
border_color_hover = #aa7733 100
|
||||||
|
background_color_pressed = #aa4400 100
|
||||||
|
border_color_pressed = #aa7733 100
|
||||||
|
|
||||||
# Background 5
|
# Background 5: Tooltip
|
||||||
rounded = 2
|
rounded = 2
|
||||||
border_width = 1
|
border_width = 1
|
||||||
background_color = #ffffaa 100
|
background_color = #ffffaa 100
|
||||||
border_color = #999999 100
|
border_color = #999999 100
|
||||||
|
background_color_hover = #ffffaa 100
|
||||||
|
border_color_hover = #999999 100
|
||||||
|
background_color_pressed = #ffffaa 100
|
||||||
|
border_color_pressed = #999999 100
|
||||||
|
|
||||||
# Background 6
|
# Background 6: Inactive desktop name
|
||||||
rounded = 2
|
rounded = 2
|
||||||
border_width = 1
|
border_width = 1
|
||||||
background_color = #eeeeee 100
|
background_color = #eeeeee 100
|
||||||
border_color = #cccccc 100
|
border_color = #cccccc 100
|
||||||
|
background_color_hover = #eeeeee 100
|
||||||
|
border_color_hover = #cccccc 100
|
||||||
|
background_color_pressed = #eeeeee 100
|
||||||
|
border_color_pressed = #cccccc 100
|
||||||
|
|
||||||
# Background 7
|
# Background 7: Active desktop name
|
||||||
rounded = 2
|
rounded = 2
|
||||||
border_width = 1
|
border_width = 1
|
||||||
background_color = #dddddd 100
|
background_color = #dddddd 100
|
||||||
border_color = #999999 100
|
border_color = #999999 100
|
||||||
|
background_color_hover = #dddddd 100
|
||||||
|
border_color_hover = #999999 100
|
||||||
|
background_color_pressed = #dddddd 100
|
||||||
|
border_color_pressed = #999999 100
|
||||||
|
|
||||||
# Background 8
|
# Background 8: Systray
|
||||||
rounded = 3
|
rounded = 3
|
||||||
border_width = 0
|
border_width = 0
|
||||||
background_color = #999999 100
|
background_color = #dddddd 100
|
||||||
border_color = #cccccc 100
|
border_color = #cccccc 100
|
||||||
|
background_color_hover = #dddddd 100
|
||||||
|
border_color_hover = #cccccc 100
|
||||||
|
background_color_pressed = #dddddd 100
|
||||||
|
border_color_pressed = #cccccc 100
|
||||||
|
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
# Panel
|
# Panel
|
||||||
@@ -68,7 +102,10 @@ autohide_height = 2
|
|||||||
strut_policy = follow_size
|
strut_policy = follow_size
|
||||||
panel_window_name = tint2
|
panel_window_name = tint2
|
||||||
disable_transparency = 0
|
disable_transparency = 0
|
||||||
|
mouse_effects = 1
|
||||||
font_shadow = 0
|
font_shadow = 0
|
||||||
|
mouse_hover_icon_asb = 100 0 10
|
||||||
|
mouse_pressed_icon_asb = 100 0 0
|
||||||
|
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
# Taskbar
|
# Taskbar
|
||||||
@@ -87,6 +124,7 @@ taskbar_name_font_color = #222222 100
|
|||||||
taskbar_name_active_font_color = #222222 100
|
taskbar_name_active_font_color = #222222 100
|
||||||
taskbar_distribute_size = 1
|
taskbar_distribute_size = 1
|
||||||
taskbar_sort_order = none
|
taskbar_sort_order = none
|
||||||
|
task_align = left
|
||||||
|
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
# Task
|
# Task
|
||||||
@@ -123,16 +161,14 @@ systray_monitor = 1
|
|||||||
# Launcher
|
# Launcher
|
||||||
launcher_padding = 0 0 2
|
launcher_padding = 0 0 2
|
||||||
launcher_background_id = 0
|
launcher_background_id = 0
|
||||||
|
launcher_icon_background_id = 0
|
||||||
launcher_icon_size = 22
|
launcher_icon_size = 22
|
||||||
launcher_icon_asb = 100 0 0
|
launcher_icon_asb = 100 0 0
|
||||||
|
launcher_icon_theme_override = 0
|
||||||
startup_notifications = 1
|
startup_notifications = 1
|
||||||
launcher_tooltip = 1
|
launcher_tooltip = 1
|
||||||
launcher_item_app = /usr/share/applications/tint2conf.desktop
|
|
||||||
launcher_item_app = /usr/local/share/applications/tint2conf.desktop
|
|
||||||
launcher_item_app = /usr/share/applications/firefox.desktop
|
launcher_item_app = /usr/share/applications/firefox.desktop
|
||||||
launcher_item_app = /usr/share/applications/iceweasel.desktop
|
launcher_item_app = /usr/share/applications/iceweasel.desktop
|
||||||
launcher_item_app = /usr/share/applications/chromium-browser.desktop
|
|
||||||
launcher_item_app = /usr/share/applications/google-chrome.desktop
|
|
||||||
|
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
# Clock
|
# Clock
|
||||||
@@ -149,9 +185,13 @@ clock_tooltip =
|
|||||||
clock_tooltip_timezone =
|
clock_tooltip_timezone =
|
||||||
clock_lclick_command = zenity --calendar --text ""
|
clock_lclick_command = zenity --calendar --text ""
|
||||||
clock_rclick_command = orage
|
clock_rclick_command = orage
|
||||||
|
clock_mclick_command =
|
||||||
|
clock_uwheel_command =
|
||||||
|
clock_dwheel_command =
|
||||||
|
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
# Battery
|
# Battery
|
||||||
|
battery_tooltip = 1
|
||||||
battery_low_status = 10
|
battery_low_status = 10
|
||||||
battery_low_cmd = notify-send "battery low"
|
battery_low_cmd = notify-send "battery low"
|
||||||
bat1_font = sans 8
|
bat1_font = sans 8
|
||||||
@@ -160,6 +200,13 @@ battery_font_color = #222222 100
|
|||||||
battery_padding = 1 0
|
battery_padding = 1 0
|
||||||
battery_background_id = 0
|
battery_background_id = 0
|
||||||
battery_hide = 101
|
battery_hide = 101
|
||||||
|
battery_lclick_command =
|
||||||
|
battery_rclick_command =
|
||||||
|
battery_mclick_command =
|
||||||
|
battery_uwheel_command =
|
||||||
|
battery_dwheel_command =
|
||||||
|
ac_connected_cmd =
|
||||||
|
ac_disconnected_cmd =
|
||||||
|
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
# Tooltip
|
# Tooltip
|
||||||
|
|||||||
@@ -1,55 +1,77 @@
|
|||||||
#---- Generated by tint2conf e324 ----
|
#---- Generated by tint2conf 5b63 ----
|
||||||
# See https://gitlab.com/o9000/tint2/wikis/Configure for
|
# See https://gitlab.com/o9000/tint2/wikis/Configure for
|
||||||
# full documentation of the configuration options.
|
# full documentation of the configuration options.
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
# Backgrounds
|
# Backgrounds
|
||||||
# Background 1
|
# Background 1: Panel
|
||||||
rounded = 0
|
rounded = 0
|
||||||
border_width = 1
|
border_width = 1
|
||||||
background_color = #eeeeee 0
|
background_color = #eeeeee 0
|
||||||
border_color = #bbbbbb 10
|
border_color = #bbbbbb 10
|
||||||
|
background_color_hover = #eeeeee 0
|
||||||
|
border_color_hover = #bbbbbb 10
|
||||||
|
background_color_pressed = #eeeeee 0
|
||||||
|
border_color_pressed = #bbbbbb 10
|
||||||
|
|
||||||
# Background 2
|
# Background 2: Default task, Iconified task
|
||||||
rounded = 5
|
rounded = 5
|
||||||
border_width = 0
|
border_width = 1
|
||||||
background_color = #eeeeee 4
|
background_color = #eeeeee 4
|
||||||
border_color = #cccccc 100
|
border_color = #cccccc 44
|
||||||
|
background_color_hover = #eeeeee 22
|
||||||
|
border_color_hover = #eaeaea 44
|
||||||
|
background_color_pressed = #dddddd 4
|
||||||
|
border_color_pressed = #eaeaea 44
|
||||||
|
|
||||||
# Background 3
|
# Background 3: Active task
|
||||||
rounded = 5
|
rounded = 5
|
||||||
border_width = 1
|
border_width = 1
|
||||||
background_color = #dddddd 4
|
background_color = #dddddd 4
|
||||||
border_color = #999999 100
|
border_color = #999999 100
|
||||||
|
background_color_hover = #eeeeee 22
|
||||||
|
border_color_hover = #999999 100
|
||||||
|
background_color_pressed = #dddddd 4
|
||||||
|
border_color_pressed = #999999 100
|
||||||
|
|
||||||
# Background 4
|
# Background 4: Urgent task
|
||||||
rounded = 5
|
rounded = 5
|
||||||
border_width = 1
|
border_width = 1
|
||||||
background_color = #aa4400 100
|
background_color = #aa4400 100
|
||||||
border_color = #aa7733 100
|
border_color = #aa7733 100
|
||||||
|
background_color_hover = #aa4400 100
|
||||||
|
border_color_hover = #aa7733 100
|
||||||
|
background_color_pressed = #aa4400 100
|
||||||
|
border_color_pressed = #aa7733 100
|
||||||
|
|
||||||
# Background 5
|
# Background 5: Tooltip
|
||||||
rounded = 2
|
rounded = 2
|
||||||
border_width = 1
|
border_width = 1
|
||||||
background_color = #ffffaa 100
|
background_color = #ffffaa 100
|
||||||
border_color = #999999 100
|
border_color = #999999 100
|
||||||
|
background_color_hover = #ffffaa 100
|
||||||
|
border_color_hover = #999999 100
|
||||||
|
background_color_pressed = #ffffaa 100
|
||||||
|
border_color_pressed = #999999 100
|
||||||
|
|
||||||
# Background 6
|
# Background 6: Inactive desktop name
|
||||||
rounded = 2
|
rounded = 2
|
||||||
border_width = 1
|
border_width = 1
|
||||||
background_color = #eeeeee 4
|
background_color = #eeeeee 4
|
||||||
border_color = #cccccc 100
|
border_color = #cccccc 100
|
||||||
|
background_color_hover = #eeeeee 22
|
||||||
|
border_color_hover = #999999 100
|
||||||
|
background_color_pressed = #dddddd 4
|
||||||
|
border_color_pressed = #999999 100
|
||||||
|
|
||||||
# Background 7
|
# Background 7: Active desktop name
|
||||||
rounded = 2
|
rounded = 2
|
||||||
border_width = 1
|
border_width = 1
|
||||||
background_color = #dddddd 3
|
background_color = #dddddd 3
|
||||||
border_color = #999999 100
|
border_color = #999999 100
|
||||||
|
background_color_hover = #dddddd 3
|
||||||
# Background 8
|
border_color_hover = #999999 100
|
||||||
rounded = 3
|
background_color_pressed = #dddddd 3
|
||||||
border_width = 0
|
border_color_pressed = #999999 100
|
||||||
background_color = #999999 4
|
|
||||||
border_color = #cccccc 100
|
|
||||||
|
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
# Panel
|
# Panel
|
||||||
@@ -70,7 +92,10 @@ autohide_height = 2
|
|||||||
strut_policy = follow_size
|
strut_policy = follow_size
|
||||||
panel_window_name = tint2
|
panel_window_name = tint2
|
||||||
disable_transparency = 0
|
disable_transparency = 0
|
||||||
|
mouse_effects = 1
|
||||||
font_shadow = 0
|
font_shadow = 0
|
||||||
|
mouse_hover_icon_asb = 100 0 10
|
||||||
|
mouse_pressed_icon_asb = 100 0 0
|
||||||
|
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
# Taskbar
|
# Taskbar
|
||||||
@@ -126,6 +151,7 @@ systray_monitor = 1
|
|||||||
# Launcher
|
# Launcher
|
||||||
launcher_padding = 0 0 2
|
launcher_padding = 0 0 2
|
||||||
launcher_background_id = 0
|
launcher_background_id = 0
|
||||||
|
launcher_icon_background_id = 0
|
||||||
launcher_icon_size = 22
|
launcher_icon_size = 22
|
||||||
launcher_icon_asb = 100 0 0
|
launcher_icon_asb = 100 0 0
|
||||||
launcher_icon_theme_override = 0
|
launcher_icon_theme_override = 0
|
||||||
@@ -153,9 +179,13 @@ clock_tooltip =
|
|||||||
clock_tooltip_timezone =
|
clock_tooltip_timezone =
|
||||||
clock_lclick_command = zenity --calendar --text ""
|
clock_lclick_command = zenity --calendar --text ""
|
||||||
clock_rclick_command = orage
|
clock_rclick_command = orage
|
||||||
|
clock_mclick_command =
|
||||||
|
clock_uwheel_command =
|
||||||
|
clock_dwheel_command =
|
||||||
|
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
# Battery
|
# Battery
|
||||||
|
battery_tooltip = 1
|
||||||
battery_low_status = 10
|
battery_low_status = 10
|
||||||
battery_low_cmd = notify-send "battery low"
|
battery_low_cmd = notify-send "battery low"
|
||||||
bat1_font = sans 8
|
bat1_font = sans 8
|
||||||
@@ -164,6 +194,13 @@ battery_font_color = #ffffff 100
|
|||||||
battery_padding = 1 0
|
battery_padding = 1 0
|
||||||
battery_background_id = 0
|
battery_background_id = 0
|
||||||
battery_hide = 101
|
battery_hide = 101
|
||||||
|
battery_lclick_command =
|
||||||
|
battery_rclick_command =
|
||||||
|
battery_mclick_command =
|
||||||
|
battery_uwheel_command =
|
||||||
|
battery_dwheel_command =
|
||||||
|
ac_connected_cmd =
|
||||||
|
ac_disconnected_cmd =
|
||||||
|
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
# Tooltip
|
# Tooltip
|
||||||
|
|||||||
@@ -1,49 +1,77 @@
|
|||||||
#---- Generated by tint2conf 258e ----
|
#---- Generated by tint2conf 14e9 ----
|
||||||
# See https://gitlab.com/o9000/tint2/wikis/Configure for
|
# See https://gitlab.com/o9000/tint2/wikis/Configure for
|
||||||
# full documentation of the configuration options.
|
# full documentation of the configuration options.
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
# Backgrounds
|
# Backgrounds
|
||||||
# Background 1
|
# Background 1: Panel
|
||||||
rounded = 5
|
rounded = 5
|
||||||
border_width = 1
|
border_width = 1
|
||||||
background_color = #111111 100
|
background_color = #111111 100
|
||||||
border_color = #333333 100
|
border_color = #333333 100
|
||||||
|
background_color_hover = #111111 100
|
||||||
|
border_color_hover = #333333 100
|
||||||
|
background_color_pressed = #111111 100
|
||||||
|
border_color_pressed = #333333 100
|
||||||
|
|
||||||
# Background 2
|
# Background 2: Default task, Iconified task
|
||||||
rounded = 5
|
rounded = 5
|
||||||
border_width = 0
|
border_width = 1
|
||||||
background_color = #111111 100
|
background_color = #111111 100
|
||||||
border_color = #222222 100
|
border_color = #222222 100
|
||||||
|
background_color_hover = #111111 100
|
||||||
|
border_color_hover = #555555 100
|
||||||
|
background_color_pressed = #333333 100
|
||||||
|
border_color_pressed = #555555 100
|
||||||
|
|
||||||
# Background 3
|
# Background 3: Active task
|
||||||
rounded = 5
|
rounded = 5
|
||||||
border_width = 1
|
border_width = 1
|
||||||
background_color = #222222 100
|
background_color = #222222 100
|
||||||
border_color = #777777 100
|
border_color = #777777 100
|
||||||
|
background_color_hover = #333333 100
|
||||||
|
border_color_hover = #777777 100
|
||||||
|
background_color_pressed = #555555 100
|
||||||
|
border_color_pressed = #777777 100
|
||||||
|
|
||||||
# Background 4
|
# Background 4: Urgent task
|
||||||
rounded = 5
|
rounded = 5
|
||||||
border_width = 1
|
border_width = 1
|
||||||
background_color = #aa4400 100
|
background_color = #aa4400 100
|
||||||
border_color = #aa7733 100
|
border_color = #aa7733 100
|
||||||
|
background_color_hover = #aa4400 100
|
||||||
|
border_color_hover = #aa7733 100
|
||||||
|
background_color_pressed = #aa4400 100
|
||||||
|
border_color_pressed = #aa7733 100
|
||||||
|
|
||||||
# Background 5
|
# Background 5: Tooltip
|
||||||
rounded = 2
|
rounded = 2
|
||||||
border_width = 1
|
border_width = 1
|
||||||
background_color = #ffffaa 100
|
background_color = #ffffaa 100
|
||||||
border_color = #999999 100
|
border_color = #999999 100
|
||||||
|
background_color_hover = #ffffaa 100
|
||||||
|
border_color_hover = #999999 100
|
||||||
|
background_color_pressed = #ffffaa 100
|
||||||
|
border_color_pressed = #999999 100
|
||||||
|
|
||||||
# Background 6
|
# Background 6: Inactive desktop name
|
||||||
rounded = 2
|
rounded = 2
|
||||||
border_width = 1
|
border_width = 1
|
||||||
background_color = #111111 100
|
background_color = #111111 100
|
||||||
border_color = #222222 100
|
border_color = #222222 100
|
||||||
|
background_color_hover = #111111 100
|
||||||
|
border_color_hover = #333333 100
|
||||||
|
background_color_pressed = #555555 100
|
||||||
|
border_color_pressed = #333333 100
|
||||||
|
|
||||||
# Background 7
|
# Background 7: Active desktop name
|
||||||
rounded = 2
|
rounded = 2
|
||||||
border_width = 1
|
border_width = 1
|
||||||
background_color = #222222 100
|
background_color = #222222 100
|
||||||
border_color = #777777 100
|
border_color = #777777 100
|
||||||
|
background_color_hover = #222222 100
|
||||||
|
border_color_hover = #777777 100
|
||||||
|
background_color_pressed = #222222 100
|
||||||
|
border_color_pressed = #777777 100
|
||||||
|
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
# Panel
|
# Panel
|
||||||
@@ -64,7 +92,10 @@ autohide_height = 2
|
|||||||
strut_policy = follow_size
|
strut_policy = follow_size
|
||||||
panel_window_name = tint2
|
panel_window_name = tint2
|
||||||
disable_transparency = 0
|
disable_transparency = 0
|
||||||
|
mouse_effects = 1
|
||||||
font_shadow = 0
|
font_shadow = 0
|
||||||
|
mouse_hover_icon_asb = 100 0 10
|
||||||
|
mouse_pressed_icon_asb = 100 0 0
|
||||||
|
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
# Taskbar
|
# Taskbar
|
||||||
@@ -120,17 +151,16 @@ systray_monitor = 1
|
|||||||
# Launcher
|
# Launcher
|
||||||
launcher_padding = 0 0 2
|
launcher_padding = 0 0 2
|
||||||
launcher_background_id = 0
|
launcher_background_id = 0
|
||||||
|
launcher_icon_background_id = -1
|
||||||
launcher_icon_size = 22
|
launcher_icon_size = 22
|
||||||
launcher_icon_asb = 100 0 0
|
launcher_icon_asb = 100 0 0
|
||||||
launcher_icon_theme_override = 0
|
launcher_icon_theme_override = 0
|
||||||
startup_notifications = 1
|
startup_notifications = 1
|
||||||
launcher_tooltip = 1
|
launcher_tooltip = 1
|
||||||
launcher_item_app = /usr/share/applications/tint2conf.desktop
|
|
||||||
launcher_item_app = /usr/local/share/applications/tint2conf.desktop
|
|
||||||
launcher_item_app = /usr/share/applications/firefox.desktop
|
launcher_item_app = /usr/share/applications/firefox.desktop
|
||||||
launcher_item_app = /usr/share/applications/iceweasel.desktop
|
launcher_item_app = /usr/share/applications/iceweasel.desktop
|
||||||
launcher_item_app = /usr/share/applications/chromium-browser.desktop
|
|
||||||
launcher_item_app = /usr/share/applications/google-chrome.desktop
|
launcher_item_app = /usr/share/applications/google-chrome.desktop
|
||||||
|
launcher_item_app = /usr/local/share/applications/tint2conf.desktop
|
||||||
|
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
# Clock
|
# Clock
|
||||||
@@ -147,9 +177,13 @@ clock_tooltip =
|
|||||||
clock_tooltip_timezone =
|
clock_tooltip_timezone =
|
||||||
clock_lclick_command = zenity --calendar --text ""
|
clock_lclick_command = zenity --calendar --text ""
|
||||||
clock_rclick_command = orage
|
clock_rclick_command = orage
|
||||||
|
clock_mclick_command =
|
||||||
|
clock_uwheel_command =
|
||||||
|
clock_dwheel_command =
|
||||||
|
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
# Battery
|
# Battery
|
||||||
|
battery_tooltip = 1
|
||||||
battery_low_status = 10
|
battery_low_status = 10
|
||||||
battery_low_cmd = notify-send "battery low"
|
battery_low_cmd = notify-send "battery low"
|
||||||
bat1_font = sans 8
|
bat1_font = sans 8
|
||||||
@@ -158,6 +192,13 @@ battery_font_color = #eeeeee 100
|
|||||||
battery_padding = 1 0
|
battery_padding = 1 0
|
||||||
battery_background_id = 0
|
battery_background_id = 0
|
||||||
battery_hide = 101
|
battery_hide = 101
|
||||||
|
battery_lclick_command =
|
||||||
|
battery_rclick_command =
|
||||||
|
battery_mclick_command =
|
||||||
|
battery_uwheel_command =
|
||||||
|
battery_dwheel_command =
|
||||||
|
ac_connected_cmd =
|
||||||
|
ac_disconnected_cmd =
|
||||||
|
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
# Tooltip
|
# Tooltip
|
||||||
|
|||||||
@@ -1,47 +1,77 @@
|
|||||||
#---- Generated by tint2conf bec8 ----
|
#---- Generated by tint2conf fc8e ----
|
||||||
|
# See https://gitlab.com/o9000/tint2/wikis/Configure for
|
||||||
|
# full documentation of the configuration options.
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
# Backgrounds
|
# Backgrounds
|
||||||
# Background 1
|
# Background 1: Panel
|
||||||
rounded = 5
|
rounded = 5
|
||||||
border_width = 1
|
border_width = 1
|
||||||
background_color = #000000 80
|
background_color = #000000 80
|
||||||
border_color = #555555 80
|
border_color = #555555 80
|
||||||
|
background_color_hover = #000000 80
|
||||||
|
border_color_hover = #555555 80
|
||||||
|
background_color_pressed = #000000 80
|
||||||
|
border_color_pressed = #555555 80
|
||||||
|
|
||||||
# Background 2
|
# Background 2: Default task, Iconified task
|
||||||
rounded = 5
|
rounded = 5
|
||||||
border_width = 0
|
border_width = 1
|
||||||
background_color = #777777 0
|
background_color = #777777 0
|
||||||
border_color = #777777 10
|
border_color = #777777 10
|
||||||
|
background_color_hover = #777777 4
|
||||||
|
border_color_hover = #cccccc 30
|
||||||
|
background_color_pressed = #333333 4
|
||||||
|
border_color_pressed = #777777 30
|
||||||
|
|
||||||
# Background 3
|
# Background 3: Active task
|
||||||
rounded = 5
|
rounded = 5
|
||||||
border_width = 1
|
border_width = 1
|
||||||
background_color = #555555 10
|
background_color = #555555 10
|
||||||
border_color = #ffffff 60
|
border_color = #ffffff 60
|
||||||
|
background_color_hover = #cccccc 10
|
||||||
|
border_color_hover = #ffffff 60
|
||||||
|
background_color_pressed = #555555 10
|
||||||
|
border_color_pressed = #ffffff 60
|
||||||
|
|
||||||
# Background 4
|
# Background 4: Urgent task
|
||||||
rounded = 5
|
rounded = 5
|
||||||
border_width = 1
|
border_width = 1
|
||||||
background_color = #aa4400 100
|
background_color = #aa4400 100
|
||||||
border_color = #aa7733 100
|
border_color = #aa7733 100
|
||||||
|
background_color_hover = #aa4400 100
|
||||||
|
border_color_hover = #aa7733 100
|
||||||
|
background_color_pressed = #aa4400 100
|
||||||
|
border_color_pressed = #aa7733 100
|
||||||
|
|
||||||
# Background 5
|
# Background 5: Tooltip
|
||||||
rounded = 2
|
rounded = 2
|
||||||
border_width = 1
|
border_width = 1
|
||||||
background_color = #ffffaa 100
|
background_color = #ffffaa 100
|
||||||
border_color = #999999 100
|
border_color = #999999 100
|
||||||
|
background_color_hover = #ffffaa 100
|
||||||
|
border_color_hover = #999999 100
|
||||||
|
background_color_pressed = #ffffaa 100
|
||||||
|
border_color_pressed = #999999 100
|
||||||
|
|
||||||
# Background 6
|
# Background 6: Inactive desktop name
|
||||||
rounded = 2
|
rounded = 2
|
||||||
border_width = 1
|
border_width = 1
|
||||||
background_color = #777777 0
|
background_color = #777777 0
|
||||||
border_color = #777777 30
|
border_color = #777777 30
|
||||||
|
background_color_hover = #777777 4
|
||||||
|
border_color_hover = #cccccc 30
|
||||||
|
background_color_pressed = #777777 0
|
||||||
|
border_color_pressed = #777777 30
|
||||||
|
|
||||||
# Background 7
|
# Background 7: Active desktop name
|
||||||
rounded = 2
|
rounded = 2
|
||||||
border_width = 1
|
border_width = 1
|
||||||
background_color = #555555 10
|
background_color = #555555 10
|
||||||
border_color = #ffffff 60
|
border_color = #ffffff 60
|
||||||
|
background_color_hover = #555555 10
|
||||||
|
border_color_hover = #ffffff 60
|
||||||
|
background_color_pressed = #555555 10
|
||||||
|
border_color_pressed = #ffffff 60
|
||||||
|
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
# Panel
|
# Panel
|
||||||
@@ -62,7 +92,10 @@ autohide_height = 2
|
|||||||
strut_policy = follow_size
|
strut_policy = follow_size
|
||||||
panel_window_name = tint2
|
panel_window_name = tint2
|
||||||
disable_transparency = 0
|
disable_transparency = 0
|
||||||
|
mouse_effects = 1
|
||||||
font_shadow = 0
|
font_shadow = 0
|
||||||
|
mouse_hover_icon_asb = 100 0 10
|
||||||
|
mouse_pressed_icon_asb = 100 0 0
|
||||||
|
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
# Taskbar
|
# Taskbar
|
||||||
@@ -81,6 +114,7 @@ taskbar_name_font_color = #dddddd 100
|
|||||||
taskbar_name_active_font_color = #dddddd 100
|
taskbar_name_active_font_color = #dddddd 100
|
||||||
taskbar_distribute_size = 1
|
taskbar_distribute_size = 1
|
||||||
taskbar_sort_order = none
|
taskbar_sort_order = none
|
||||||
|
task_align = left
|
||||||
|
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
# Task
|
# Task
|
||||||
@@ -117,16 +151,16 @@ systray_monitor = 1
|
|||||||
# Launcher
|
# Launcher
|
||||||
launcher_padding = 0 0 2
|
launcher_padding = 0 0 2
|
||||||
launcher_background_id = 0
|
launcher_background_id = 0
|
||||||
|
launcher_icon_background_id = -1
|
||||||
launcher_icon_size = 22
|
launcher_icon_size = 22
|
||||||
launcher_icon_asb = 100 0 0
|
launcher_icon_asb = 100 0 0
|
||||||
|
launcher_icon_theme_override = 0
|
||||||
startup_notifications = 1
|
startup_notifications = 1
|
||||||
launcher_tooltip = 1
|
launcher_tooltip = 1
|
||||||
launcher_item_app = /usr/share/applications/tint2conf.desktop
|
|
||||||
launcher_item_app = /usr/local/share/applications/tint2conf.desktop
|
|
||||||
launcher_item_app = /usr/share/applications/firefox.desktop
|
launcher_item_app = /usr/share/applications/firefox.desktop
|
||||||
launcher_item_app = /usr/share/applications/iceweasel.desktop
|
launcher_item_app = /usr/share/applications/iceweasel.desktop
|
||||||
launcher_item_app = /usr/share/applications/chromium-browser.desktop
|
|
||||||
launcher_item_app = /usr/share/applications/google-chrome.desktop
|
launcher_item_app = /usr/share/applications/google-chrome.desktop
|
||||||
|
launcher_item_app = /usr/local/share/applications/tint2conf.desktop
|
||||||
|
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
# Clock
|
# Clock
|
||||||
@@ -143,9 +177,13 @@ clock_tooltip =
|
|||||||
clock_tooltip_timezone =
|
clock_tooltip_timezone =
|
||||||
clock_lclick_command = zenity --calendar --text ""
|
clock_lclick_command = zenity --calendar --text ""
|
||||||
clock_rclick_command = orage
|
clock_rclick_command = orage
|
||||||
|
clock_mclick_command =
|
||||||
|
clock_uwheel_command =
|
||||||
|
clock_dwheel_command =
|
||||||
|
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
# Battery
|
# Battery
|
||||||
|
battery_tooltip = 1
|
||||||
battery_low_status = 10
|
battery_low_status = 10
|
||||||
battery_low_cmd = notify-send "battery low"
|
battery_low_cmd = notify-send "battery low"
|
||||||
bat1_font = sans 8
|
bat1_font = sans 8
|
||||||
@@ -154,6 +192,13 @@ battery_font_color = #eeeeee 100
|
|||||||
battery_padding = 1 0
|
battery_padding = 1 0
|
||||||
battery_background_id = 0
|
battery_background_id = 0
|
||||||
battery_hide = 101
|
battery_hide = 101
|
||||||
|
battery_lclick_command =
|
||||||
|
battery_rclick_command =
|
||||||
|
battery_mclick_command =
|
||||||
|
battery_uwheel_command =
|
||||||
|
battery_dwheel_command =
|
||||||
|
ac_connected_cmd =
|
||||||
|
ac_disconnected_cmd =
|
||||||
|
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
# Tooltip
|
# Tooltip
|
||||||
|
|||||||
@@ -1,53 +1,87 @@
|
|||||||
#---- Generated by tint2conf f7f7 ----
|
#---- Generated by tint2conf 1f37 ----
|
||||||
|
# See https://gitlab.com/o9000/tint2/wikis/Configure for
|
||||||
|
# full documentation of the configuration options.
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
# Backgrounds
|
# Backgrounds
|
||||||
# Background 1
|
# Background 1: Panel
|
||||||
rounded = 0
|
rounded = 0
|
||||||
border_width = 1
|
border_width = 1
|
||||||
background_color = #eeeeee 100
|
background_color = #eeeeee 100
|
||||||
border_color = #bbbbbb 100
|
border_color = #bbbbbb 100
|
||||||
|
background_color_hover = #eeeeee 100
|
||||||
|
border_color_hover = #bbbbbb 100
|
||||||
|
background_color_pressed = #eeeeee 100
|
||||||
|
border_color_pressed = #bbbbbb 100
|
||||||
|
|
||||||
# Background 2
|
# Background 2: Default task, Iconified task
|
||||||
rounded = 5
|
rounded = 5
|
||||||
border_width = 0
|
border_width = 1
|
||||||
background_color = #eeeeee 100
|
background_color = #eeeeee 100
|
||||||
border_color = #cccccc 100
|
border_color = #cccccc 100
|
||||||
|
background_color_hover = #fafafa 100
|
||||||
|
border_color_hover = #cccccc 100
|
||||||
|
background_color_pressed = #cccccc 100
|
||||||
|
border_color_pressed = #cccccc 100
|
||||||
|
|
||||||
# Background 3
|
# Background 3: Active task
|
||||||
rounded = 5
|
rounded = 5
|
||||||
border_width = 1
|
border_width = 1
|
||||||
background_color = #dddddd 100
|
background_color = #dddddd 100
|
||||||
border_color = #999999 100
|
border_color = #999999 100
|
||||||
|
background_color_hover = #fafafa 100
|
||||||
|
border_color_hover = #aaaaaa 100
|
||||||
|
background_color_pressed = #cccccc 100
|
||||||
|
border_color_pressed = #999999 100
|
||||||
|
|
||||||
# Background 4
|
# Background 4: Urgent task
|
||||||
rounded = 5
|
rounded = 5
|
||||||
border_width = 1
|
border_width = 1
|
||||||
background_color = #aa4400 100
|
background_color = #aa4400 100
|
||||||
border_color = #aa7733 100
|
border_color = #aa7733 100
|
||||||
|
background_color_hover = #aa4400 100
|
||||||
|
border_color_hover = #aa7733 100
|
||||||
|
background_color_pressed = #aa4400 100
|
||||||
|
border_color_pressed = #aa7733 100
|
||||||
|
|
||||||
# Background 5
|
# Background 5: Tooltip
|
||||||
rounded = 2
|
rounded = 2
|
||||||
border_width = 1
|
border_width = 1
|
||||||
background_color = #ffffaa 100
|
background_color = #ffffaa 100
|
||||||
border_color = #999999 100
|
border_color = #999999 100
|
||||||
|
background_color_hover = #ffffaa 100
|
||||||
|
border_color_hover = #999999 100
|
||||||
|
background_color_pressed = #ffffaa 100
|
||||||
|
border_color_pressed = #999999 100
|
||||||
|
|
||||||
# Background 6
|
# Background 6: Inactive desktop name
|
||||||
rounded = 2
|
rounded = 2
|
||||||
border_width = 1
|
border_width = 1
|
||||||
background_color = #eeeeee 100
|
background_color = #eeeeee 100
|
||||||
border_color = #cccccc 100
|
border_color = #cccccc 100
|
||||||
|
background_color_hover = #fafafa 100
|
||||||
|
border_color_hover = #cccccc 100
|
||||||
|
background_color_pressed = #eeeeee 100
|
||||||
|
border_color_pressed = #cccccc 100
|
||||||
|
|
||||||
# Background 7
|
# Background 7: Active desktop name
|
||||||
rounded = 2
|
rounded = 2
|
||||||
border_width = 1
|
border_width = 1
|
||||||
background_color = #dddddd 100
|
background_color = #dddddd 100
|
||||||
border_color = #999999 100
|
border_color = #999999 100
|
||||||
|
background_color_hover = #dddddd 100
|
||||||
|
border_color_hover = #999999 100
|
||||||
|
background_color_pressed = #dddddd 100
|
||||||
|
border_color_pressed = #999999 100
|
||||||
|
|
||||||
# Background 8
|
# Background 8: Systray
|
||||||
rounded = 3
|
rounded = 3
|
||||||
border_width = 0
|
border_width = 0
|
||||||
background_color = #aaaaaa 100
|
background_color = #dddddd 100
|
||||||
border_color = #cccccc 100
|
border_color = #cccccc 100
|
||||||
|
background_color_hover = #cccccc 100
|
||||||
|
border_color_hover = #cccccc 100
|
||||||
|
background_color_pressed = #cccccc 100
|
||||||
|
border_color_pressed = #cccccc 100
|
||||||
|
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
# Panel
|
# Panel
|
||||||
@@ -68,7 +102,10 @@ autohide_height = 2
|
|||||||
strut_policy = follow_size
|
strut_policy = follow_size
|
||||||
panel_window_name = tint2
|
panel_window_name = tint2
|
||||||
disable_transparency = 0
|
disable_transparency = 0
|
||||||
|
mouse_effects = 1
|
||||||
font_shadow = 0
|
font_shadow = 0
|
||||||
|
mouse_hover_icon_asb = 100 0 10
|
||||||
|
mouse_pressed_icon_asb = 100 0 0
|
||||||
|
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
# Taskbar
|
# Taskbar
|
||||||
@@ -87,6 +124,7 @@ taskbar_name_font_color = #222222 100
|
|||||||
taskbar_name_active_font_color = #222222 100
|
taskbar_name_active_font_color = #222222 100
|
||||||
taskbar_distribute_size = 1
|
taskbar_distribute_size = 1
|
||||||
taskbar_sort_order = none
|
taskbar_sort_order = none
|
||||||
|
task_align = left
|
||||||
|
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
# Task
|
# Task
|
||||||
@@ -123,16 +161,16 @@ systray_monitor = 1
|
|||||||
# Launcher
|
# Launcher
|
||||||
launcher_padding = 0 0 2
|
launcher_padding = 0 0 2
|
||||||
launcher_background_id = 0
|
launcher_background_id = 0
|
||||||
|
launcher_icon_background_id = 0
|
||||||
launcher_icon_size = 22
|
launcher_icon_size = 22
|
||||||
launcher_icon_asb = 100 0 0
|
launcher_icon_asb = 100 0 0
|
||||||
|
launcher_icon_theme_override = 0
|
||||||
startup_notifications = 1
|
startup_notifications = 1
|
||||||
launcher_tooltip = 1
|
launcher_tooltip = 1
|
||||||
launcher_item_app = /usr/share/applications/tint2conf.desktop
|
|
||||||
launcher_item_app = /usr/local/share/applications/tint2conf.desktop
|
|
||||||
launcher_item_app = /usr/share/applications/firefox.desktop
|
launcher_item_app = /usr/share/applications/firefox.desktop
|
||||||
launcher_item_app = /usr/share/applications/iceweasel.desktop
|
launcher_item_app = /usr/share/applications/iceweasel.desktop
|
||||||
launcher_item_app = /usr/share/applications/chromium-browser.desktop
|
|
||||||
launcher_item_app = /usr/share/applications/google-chrome.desktop
|
launcher_item_app = /usr/share/applications/google-chrome.desktop
|
||||||
|
launcher_item_app = /usr/local/share/applications/tint2conf.desktop
|
||||||
|
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
# Clock
|
# Clock
|
||||||
@@ -149,9 +187,13 @@ clock_tooltip =
|
|||||||
clock_tooltip_timezone =
|
clock_tooltip_timezone =
|
||||||
clock_lclick_command = zenity --calendar --text ""
|
clock_lclick_command = zenity --calendar --text ""
|
||||||
clock_rclick_command = orage
|
clock_rclick_command = orage
|
||||||
|
clock_mclick_command =
|
||||||
|
clock_uwheel_command =
|
||||||
|
clock_dwheel_command =
|
||||||
|
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
# Battery
|
# Battery
|
||||||
|
battery_tooltip = 1
|
||||||
battery_low_status = 10
|
battery_low_status = 10
|
||||||
battery_low_cmd = notify-send "battery low"
|
battery_low_cmd = notify-send "battery low"
|
||||||
bat1_font = sans 8
|
bat1_font = sans 8
|
||||||
@@ -160,6 +202,13 @@ battery_font_color = #222222 100
|
|||||||
battery_padding = 1 0
|
battery_padding = 1 0
|
||||||
battery_background_id = 0
|
battery_background_id = 0
|
||||||
battery_hide = 101
|
battery_hide = 101
|
||||||
|
battery_lclick_command =
|
||||||
|
battery_rclick_command =
|
||||||
|
battery_mclick_command =
|
||||||
|
battery_uwheel_command =
|
||||||
|
battery_dwheel_command =
|
||||||
|
ac_connected_cmd =
|
||||||
|
ac_disconnected_cmd =
|
||||||
|
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
# Tooltip
|
# Tooltip
|
||||||
|
|||||||
@@ -1,55 +1,77 @@
|
|||||||
#---- Generated by tint2conf e324 ----
|
#---- Generated by tint2conf 812e ----
|
||||||
# See https://gitlab.com/o9000/tint2/wikis/Configure for
|
# See https://gitlab.com/o9000/tint2/wikis/Configure for
|
||||||
# full documentation of the configuration options.
|
# full documentation of the configuration options.
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
# Backgrounds
|
# Backgrounds
|
||||||
# Background 1
|
# Background 1: Panel
|
||||||
rounded = 0
|
rounded = 0
|
||||||
border_width = 1
|
border_width = 1
|
||||||
background_color = #eeeeee 0
|
background_color = #eeeeee 0
|
||||||
border_color = #bbbbbb 10
|
border_color = #bbbbbb 10
|
||||||
|
background_color_hover = #eeeeee 0
|
||||||
|
border_color_hover = #bbbbbb 10
|
||||||
|
background_color_pressed = #eeeeee 0
|
||||||
|
border_color_pressed = #bbbbbb 10
|
||||||
|
|
||||||
# Background 2
|
# Background 2: Default task, Iconified task
|
||||||
rounded = 5
|
rounded = 5
|
||||||
border_width = 0
|
border_width = 1
|
||||||
background_color = #eeeeee 4
|
background_color = #eeeeee 4
|
||||||
border_color = #cccccc 100
|
border_color = #eeeeee 0
|
||||||
|
background_color_hover = #eeeeee 22
|
||||||
|
border_color_hover = #eaeaea 44
|
||||||
|
background_color_pressed = #dddddd 4
|
||||||
|
border_color_pressed = #eaeaea 44
|
||||||
|
|
||||||
# Background 3
|
# Background 3: Active task
|
||||||
rounded = 5
|
rounded = 5
|
||||||
border_width = 1
|
border_width = 1
|
||||||
background_color = #dddddd 4
|
background_color = #dddddd 4
|
||||||
border_color = #999999 100
|
border_color = #999999 100
|
||||||
|
background_color_hover = #eeeeee 22
|
||||||
|
border_color_hover = #999999 100
|
||||||
|
background_color_pressed = #dddddd 4
|
||||||
|
border_color_pressed = #999999 100
|
||||||
|
|
||||||
# Background 4
|
# Background 4: Urgent task
|
||||||
rounded = 5
|
rounded = 5
|
||||||
border_width = 1
|
border_width = 1
|
||||||
background_color = #aa4400 100
|
background_color = #aa4400 100
|
||||||
border_color = #aa7733 100
|
border_color = #aa7733 100
|
||||||
|
background_color_hover = #aa4400 100
|
||||||
|
border_color_hover = #aa7733 100
|
||||||
|
background_color_pressed = #aa4400 100
|
||||||
|
border_color_pressed = #aa7733 100
|
||||||
|
|
||||||
# Background 5
|
# Background 5: Tooltip
|
||||||
rounded = 2
|
rounded = 2
|
||||||
border_width = 1
|
border_width = 1
|
||||||
background_color = #ffffaa 100
|
background_color = #ffffaa 100
|
||||||
border_color = #999999 100
|
border_color = #999999 100
|
||||||
|
background_color_hover = #ffffaa 100
|
||||||
|
border_color_hover = #999999 100
|
||||||
|
background_color_pressed = #ffffaa 100
|
||||||
|
border_color_pressed = #999999 100
|
||||||
|
|
||||||
# Background 6
|
# Background 6: Inactive desktop name
|
||||||
rounded = 2
|
rounded = 2
|
||||||
border_width = 1
|
border_width = 1
|
||||||
background_color = #eeeeee 4
|
background_color = #eeeeee 4
|
||||||
border_color = #cccccc 100
|
border_color = #999999 100
|
||||||
|
background_color_hover = #eeeeee 22
|
||||||
|
border_color_hover = #999999 100
|
||||||
|
background_color_pressed = #dddddd 4
|
||||||
|
border_color_pressed = #999999 100
|
||||||
|
|
||||||
# Background 7
|
# Background 7: Active desktop name
|
||||||
rounded = 2
|
rounded = 2
|
||||||
border_width = 1
|
border_width = 1
|
||||||
background_color = #dddddd 3
|
background_color = #dddddd 3
|
||||||
border_color = #999999 100
|
border_color = #999999 100
|
||||||
|
background_color_hover = #dddddd 3
|
||||||
# Background 8
|
border_color_hover = #999999 100
|
||||||
rounded = 3
|
background_color_pressed = #dddddd 3
|
||||||
border_width = 0
|
border_color_pressed = #999999 100
|
||||||
background_color = #999999 4
|
|
||||||
border_color = #cccccc 100
|
|
||||||
|
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
# Panel
|
# Panel
|
||||||
@@ -70,7 +92,10 @@ autohide_height = 2
|
|||||||
strut_policy = follow_size
|
strut_policy = follow_size
|
||||||
panel_window_name = tint2
|
panel_window_name = tint2
|
||||||
disable_transparency = 0
|
disable_transparency = 0
|
||||||
|
mouse_effects = 1
|
||||||
font_shadow = 0
|
font_shadow = 0
|
||||||
|
mouse_hover_icon_asb = 100 0 10
|
||||||
|
mouse_pressed_icon_asb = 100 0 0
|
||||||
|
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
# Taskbar
|
# Taskbar
|
||||||
@@ -126,6 +151,7 @@ systray_monitor = 1
|
|||||||
# Launcher
|
# Launcher
|
||||||
launcher_padding = 0 0 2
|
launcher_padding = 0 0 2
|
||||||
launcher_background_id = 0
|
launcher_background_id = 0
|
||||||
|
launcher_icon_background_id = 0
|
||||||
launcher_icon_size = 22
|
launcher_icon_size = 22
|
||||||
launcher_icon_asb = 100 0 0
|
launcher_icon_asb = 100 0 0
|
||||||
launcher_icon_theme_override = 0
|
launcher_icon_theme_override = 0
|
||||||
@@ -153,9 +179,13 @@ clock_tooltip =
|
|||||||
clock_tooltip_timezone =
|
clock_tooltip_timezone =
|
||||||
clock_lclick_command = zenity --calendar --text ""
|
clock_lclick_command = zenity --calendar --text ""
|
||||||
clock_rclick_command = orage
|
clock_rclick_command = orage
|
||||||
|
clock_mclick_command =
|
||||||
|
clock_uwheel_command =
|
||||||
|
clock_dwheel_command =
|
||||||
|
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
# Battery
|
# Battery
|
||||||
|
battery_tooltip = 1
|
||||||
battery_low_status = 10
|
battery_low_status = 10
|
||||||
battery_low_cmd = notify-send "battery low"
|
battery_low_cmd = notify-send "battery low"
|
||||||
bat1_font = sans 8
|
bat1_font = sans 8
|
||||||
@@ -164,6 +194,13 @@ battery_font_color = #ffffff 100
|
|||||||
battery_padding = 1 0
|
battery_padding = 1 0
|
||||||
battery_background_id = 0
|
battery_background_id = 0
|
||||||
battery_hide = 101
|
battery_hide = 101
|
||||||
|
battery_lclick_command =
|
||||||
|
battery_rclick_command =
|
||||||
|
battery_mclick_command =
|
||||||
|
battery_uwheel_command =
|
||||||
|
battery_dwheel_command =
|
||||||
|
ac_connected_cmd =
|
||||||
|
ac_disconnected_cmd =
|
||||||
|
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
# Tooltip
|
# Tooltip
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
*
|
*
|
||||||
* Tint2 : battery
|
* Tint2 : Generic battery
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 Sebastian Reichel <elektranox@gmail.com>
|
* Copyright (C) 2009-2015 Sebastian Reichel <sre@ring0.de>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License version 2
|
* modify it under the terms of the GNU General Public License version 2
|
||||||
@@ -24,18 +24,6 @@
|
|||||||
#include <cairo-xlib.h>
|
#include <cairo-xlib.h>
|
||||||
#include <pango/pangocairo.h>
|
#include <pango/pangocairo.h>
|
||||||
|
|
||||||
#if defined(__OpenBSD__) || defined(__NetBSD__)
|
|
||||||
#include <machine/apmvar.h>
|
|
||||||
#include <err.h>
|
|
||||||
#include <sys/ioctl.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__FreeBSD__)
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/sysctl.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "window.h"
|
#include "window.h"
|
||||||
#include "server.h"
|
#include "server.h"
|
||||||
#include "panel.h"
|
#include "panel.h"
|
||||||
@@ -47,6 +35,7 @@ PangoFontDescription *bat1_font_desc;
|
|||||||
PangoFontDescription *bat2_font_desc;
|
PangoFontDescription *bat2_font_desc;
|
||||||
struct batstate battery_state;
|
struct batstate battery_state;
|
||||||
int battery_enabled;
|
int battery_enabled;
|
||||||
|
int battery_tooltip_enabled;
|
||||||
int percentage_hide;
|
int percentage_hide;
|
||||||
static timeout* battery_timeout;
|
static timeout* battery_timeout;
|
||||||
|
|
||||||
@@ -55,22 +44,16 @@ static char buf_bat_time[20];
|
|||||||
|
|
||||||
int8_t battery_low_status;
|
int8_t battery_low_status;
|
||||||
unsigned char battery_low_cmd_sent;
|
unsigned char battery_low_cmd_sent;
|
||||||
|
char *ac_connected_cmd;
|
||||||
|
char *ac_disconnected_cmd;
|
||||||
char *battery_low_cmd;
|
char *battery_low_cmd;
|
||||||
char *battery_lclick_command;
|
char *battery_lclick_command;
|
||||||
char *battery_mclick_command;
|
char *battery_mclick_command;
|
||||||
char *battery_rclick_command;
|
char *battery_rclick_command;
|
||||||
char *battery_uwheel_command;
|
char *battery_uwheel_command;
|
||||||
char *battery_dwheel_command;
|
char *battery_dwheel_command;
|
||||||
gchar *path_energy_now;
|
|
||||||
gchar *path_energy_full;
|
|
||||||
gchar *path_current_now;
|
|
||||||
gchar *path_status;
|
|
||||||
int battery_found;
|
int battery_found;
|
||||||
|
|
||||||
#if defined(__OpenBSD__) || defined(__NetBSD__)
|
|
||||||
int apm_fd;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void update_battery_tick(void* arg)
|
void update_battery_tick(void* arg)
|
||||||
{
|
{
|
||||||
if (!battery_enabled)
|
if (!battery_enabled)
|
||||||
@@ -78,18 +61,26 @@ void update_battery_tick(void* arg)
|
|||||||
|
|
||||||
int old_found = battery_found;
|
int old_found = battery_found;
|
||||||
int old_percentage = battery_state.percentage;
|
int old_percentage = battery_state.percentage;
|
||||||
|
gboolean old_ac_connected = battery_state.ac_connected;
|
||||||
int16_t old_hours = battery_state.time.hours;
|
int16_t old_hours = battery_state.time.hours;
|
||||||
int8_t old_minutes = battery_state.time.minutes;
|
int8_t old_minutes = battery_state.time.minutes;
|
||||||
|
|
||||||
if (!battery_found) {
|
if (!battery_found) {
|
||||||
init_battery();
|
init_battery();
|
||||||
|
old_ac_connected = battery_state.ac_connected;
|
||||||
}
|
}
|
||||||
if (update_battery() != 0) {
|
if (update_battery() != 0) {
|
||||||
// Reconfigure
|
// Try to reconfigure on failed update
|
||||||
init_battery();
|
init_battery();
|
||||||
// Try again
|
|
||||||
update_battery();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (old_ac_connected != battery_state.ac_connected) {
|
||||||
|
if (battery_state.ac_connected)
|
||||||
|
tint_exec(ac_connected_cmd);
|
||||||
|
else
|
||||||
|
tint_exec(ac_disconnected_cmd);
|
||||||
|
}
|
||||||
|
|
||||||
if (old_found == battery_found &&
|
if (old_found == battery_found &&
|
||||||
old_percentage == battery_state.percentage &&
|
old_percentage == battery_state.percentage &&
|
||||||
old_hours == battery_state.time.hours &&
|
old_hours == battery_state.time.hours &&
|
||||||
@@ -139,30 +130,26 @@ void update_battery_tick(void* arg)
|
|||||||
void default_battery()
|
void default_battery()
|
||||||
{
|
{
|
||||||
battery_enabled = 0;
|
battery_enabled = 0;
|
||||||
|
battery_tooltip_enabled = 1;
|
||||||
battery_found = 0;
|
battery_found = 0;
|
||||||
percentage_hide = 101;
|
percentage_hide = 101;
|
||||||
battery_low_cmd_sent = 0;
|
battery_low_cmd_sent = 0;
|
||||||
battery_timeout = NULL;
|
battery_timeout = NULL;
|
||||||
bat1_font_desc = NULL;
|
bat1_font_desc = NULL;
|
||||||
bat2_font_desc = NULL;
|
bat2_font_desc = NULL;
|
||||||
|
ac_connected_cmd = NULL;
|
||||||
|
ac_disconnected_cmd = NULL;
|
||||||
battery_low_cmd = NULL;
|
battery_low_cmd = NULL;
|
||||||
battery_lclick_command = NULL;
|
battery_lclick_command = NULL;
|
||||||
battery_mclick_command = NULL;
|
battery_mclick_command = NULL;
|
||||||
battery_rclick_command = NULL;
|
battery_rclick_command = NULL;
|
||||||
battery_uwheel_command = NULL;
|
battery_uwheel_command = NULL;
|
||||||
battery_dwheel_command = NULL;
|
battery_dwheel_command = NULL;
|
||||||
path_energy_now = NULL;
|
|
||||||
path_energy_full = NULL;
|
|
||||||
path_current_now = NULL;
|
|
||||||
path_status = NULL;
|
|
||||||
battery_state.percentage = 0;
|
battery_state.percentage = 0;
|
||||||
battery_state.time.hours = 0;
|
battery_state.time.hours = 0;
|
||||||
battery_state.time.minutes = 0;
|
battery_state.time.minutes = 0;
|
||||||
battery_state.time.seconds = 0;
|
battery_state.time.seconds = 0;
|
||||||
battery_state.state = BATTERY_UNKNOWN;
|
battery_state.state = BATTERY_UNKNOWN;
|
||||||
#if defined(__OpenBSD__) || defined(__NetBSD__)
|
|
||||||
apm_fd = -1;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void cleanup_battery()
|
void cleanup_battery()
|
||||||
@@ -171,14 +158,6 @@ void cleanup_battery()
|
|||||||
bat1_font_desc = NULL;
|
bat1_font_desc = NULL;
|
||||||
pango_font_description_free(bat2_font_desc);
|
pango_font_description_free(bat2_font_desc);
|
||||||
bat2_font_desc = NULL;
|
bat2_font_desc = NULL;
|
||||||
g_free(path_energy_now);
|
|
||||||
path_energy_now = NULL;
|
|
||||||
g_free(path_energy_full);
|
|
||||||
path_energy_full = NULL;
|
|
||||||
g_free(path_current_now);
|
|
||||||
path_current_now = NULL;
|
|
||||||
g_free(path_status);
|
|
||||||
path_status = NULL;
|
|
||||||
free(battery_low_cmd);
|
free(battery_low_cmd);
|
||||||
battery_low_cmd = NULL;
|
battery_low_cmd = NULL;
|
||||||
free(battery_lclick_command);
|
free(battery_lclick_command);
|
||||||
@@ -191,128 +170,39 @@ void cleanup_battery()
|
|||||||
battery_uwheel_command = NULL;
|
battery_uwheel_command = NULL;
|
||||||
free(battery_dwheel_command);
|
free(battery_dwheel_command);
|
||||||
battery_dwheel_command = NULL;
|
battery_dwheel_command = NULL;
|
||||||
|
free(ac_connected_cmd);
|
||||||
|
ac_connected_cmd = NULL;
|
||||||
|
free(ac_disconnected_cmd);
|
||||||
|
ac_disconnected_cmd = NULL;
|
||||||
stop_timeout(battery_timeout);
|
stop_timeout(battery_timeout);
|
||||||
battery_timeout = NULL;
|
battery_timeout = NULL;
|
||||||
battery_found = 0;
|
battery_found = 0;
|
||||||
|
|
||||||
#if defined(__OpenBSD__) || defined(__NetBSD__)
|
battery_os_free();
|
||||||
if ((apm_fd != -1) && (close(apm_fd) == -1))
|
|
||||||
warn("cannot close /dev/apm");
|
|
||||||
apm_fd = -1;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void reinit_battery()
|
||||||
|
{
|
||||||
|
battery_os_free();
|
||||||
|
battery_found = battery_os_init();
|
||||||
|
update_battery();
|
||||||
|
}
|
||||||
void init_battery()
|
void init_battery()
|
||||||
{
|
{
|
||||||
if (!battery_enabled)
|
if (!battery_enabled)
|
||||||
return;
|
return;
|
||||||
battery_found = 0;
|
|
||||||
|
|
||||||
#if defined(__OpenBSD__) || defined(__NetBSD__)
|
battery_found = battery_os_init();
|
||||||
if (apm_fd > 0)
|
|
||||||
close(apm_fd);
|
|
||||||
apm_fd = open("/dev/apm", O_RDONLY);
|
|
||||||
if (apm_fd < 0) {
|
|
||||||
warn("ERROR: battery applet cannot open /dev/apm.");
|
|
||||||
battery_found = 0;
|
|
||||||
} else {
|
|
||||||
battery_found = 1;
|
|
||||||
}
|
|
||||||
#elif defined(__FreeBSD__)
|
|
||||||
int sysctl_out = 0;
|
|
||||||
size_t len = sizeof(sysctl_out);
|
|
||||||
battery_found = (sysctlbyname("hw.acpi.battery.state", &sysctl_out, &len, NULL, 0) == 0) ||
|
|
||||||
(sysctlbyname("hw.acpi.battery.time", &sysctl_out, &len, NULL, 0) == 0) ||
|
|
||||||
(sysctlbyname("hw.acpi.battery.life", &sysctl_out, &len, NULL, 0) == 0);
|
|
||||||
#else // Linux
|
|
||||||
GDir *directory = 0;
|
|
||||||
GError *error = NULL;
|
|
||||||
const char *entryname;
|
|
||||||
gchar *battery_dir = 0;
|
|
||||||
|
|
||||||
directory = g_dir_open("/sys/class/power_supply", 0, &error);
|
|
||||||
if (error) {
|
|
||||||
g_error_free(error);
|
|
||||||
} else {
|
|
||||||
while ((entryname = g_dir_read_name(directory))) {
|
|
||||||
if (strncmp(entryname, "AC", 2) == 0)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
gchar *path1 = g_build_filename("/sys/class/power_supply", entryname, "present", NULL);
|
|
||||||
if (g_file_test(path1, G_FILE_TEST_EXISTS)) {
|
|
||||||
g_free(path1);
|
|
||||||
battery_dir = g_build_filename("/sys/class/power_supply", entryname, NULL);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
g_free(path1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (directory)
|
|
||||||
g_dir_close(directory);
|
|
||||||
if (!battery_dir) {
|
|
||||||
fprintf(stderr, "ERROR: battery applet cannot find any battery\n");
|
|
||||||
battery_found = 0;
|
|
||||||
} else {
|
|
||||||
battery_found = 1;
|
|
||||||
|
|
||||||
g_free(path_energy_now);
|
|
||||||
path_energy_now = g_build_filename(battery_dir, "energy_now", NULL);
|
|
||||||
if (!g_file_test(path_energy_now, G_FILE_TEST_EXISTS)) {
|
|
||||||
g_free(path_energy_now);
|
|
||||||
path_energy_now = g_build_filename(battery_dir, "charge_now", NULL);
|
|
||||||
}
|
|
||||||
if (!g_file_test(path_energy_now, G_FILE_TEST_EXISTS)) {
|
|
||||||
fprintf(stderr, "ERROR: battery applet cannot find energy_now nor charge_now\n");
|
|
||||||
g_free(path_energy_now);
|
|
||||||
path_energy_now = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_free(path_energy_full);
|
|
||||||
path_energy_full = g_build_filename(battery_dir, "energy_full", NULL);
|
|
||||||
if (!g_file_test(path_energy_full, G_FILE_TEST_EXISTS)) {
|
|
||||||
g_free(path_energy_full);
|
|
||||||
path_energy_full = g_build_filename(battery_dir, "charge_full", NULL);
|
|
||||||
}
|
|
||||||
if (!g_file_test(path_energy_full, G_FILE_TEST_EXISTS)) {
|
|
||||||
fprintf(stderr, "ERROR: battery applet cannot find energy_now nor charge_now\n");
|
|
||||||
g_free(path_energy_full);
|
|
||||||
path_energy_full = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_free(path_current_now);
|
|
||||||
path_current_now = g_build_filename(battery_dir, "power_now", NULL);
|
|
||||||
if (!g_file_test(path_current_now, G_FILE_TEST_EXISTS)) {
|
|
||||||
g_free(path_current_now);
|
|
||||||
path_current_now = g_build_filename(battery_dir, "current_now", NULL);
|
|
||||||
}
|
|
||||||
if (!g_file_test(path_current_now, G_FILE_TEST_EXISTS)) {
|
|
||||||
fprintf(stderr, "ERROR: battery applet cannot find power_now nor current_now\n");
|
|
||||||
g_free(path_current_now);
|
|
||||||
path_current_now = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_free(path_status);
|
|
||||||
path_status = g_build_filename(battery_dir, "status", NULL);
|
|
||||||
if (!g_file_test(path_status, G_FILE_TEST_EXISTS)) {
|
|
||||||
fprintf(stderr, "ERROR: battery applet cannot find battery status\n");
|
|
||||||
g_free(path_status);
|
|
||||||
path_status = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_free(battery_dir);
|
|
||||||
battery_dir = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!path_status) {
|
|
||||||
battery_found = 0;
|
|
||||||
fprintf(stderr, "ERROR: battery applet cannot find any batteries\n");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!battery_timeout)
|
if (!battery_timeout)
|
||||||
battery_timeout = add_timeout(10, 30000, update_battery_tick, 0, &battery_timeout);
|
battery_timeout = add_timeout(10, 30000, update_battery_tick, 0, &battery_timeout);
|
||||||
|
|
||||||
|
update_battery();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char* battery_get_tooltip(void* obj) {
|
||||||
|
return battery_os_tooltip();
|
||||||
|
}
|
||||||
|
|
||||||
void init_battery_panel(void *p)
|
void init_battery_panel(void *p)
|
||||||
{
|
{
|
||||||
@@ -337,184 +227,34 @@ void init_battery_panel(void *p)
|
|||||||
battery->area._resize = resize_battery;
|
battery->area._resize = resize_battery;
|
||||||
battery->area.on_screen = 1;
|
battery->area.on_screen = 1;
|
||||||
battery->area.resize = 1;
|
battery->area.resize = 1;
|
||||||
|
battery->area.mouse_over_effect = battery_lclick_command ||
|
||||||
|
battery_mclick_command ||
|
||||||
|
battery_rclick_command ||
|
||||||
|
battery_uwheel_command ||
|
||||||
|
battery_dwheel_command;
|
||||||
|
battery->area.mouse_press_effect = battery->area.mouse_over_effect;
|
||||||
|
if (battery_tooltip_enabled)
|
||||||
|
battery->area._get_tooltip_text = battery_get_tooltip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int update_battery() {
|
int update_battery() {
|
||||||
int64_t energy_now = 0,
|
int err;
|
||||||
energy_full = 0;
|
|
||||||
int seconds = 0;
|
|
||||||
int8_t new_percentage = 0;
|
|
||||||
int errors = 0;
|
|
||||||
|
|
||||||
|
/* reset */
|
||||||
battery_state.state = BATTERY_UNKNOWN;
|
battery_state.state = BATTERY_UNKNOWN;
|
||||||
|
battery_state.percentage = 0;
|
||||||
|
battery_state.ac_connected = FALSE;
|
||||||
|
batstate_set_time(&battery_state, 0);
|
||||||
|
|
||||||
#if defined(__OpenBSD__) || defined(__NetBSD__)
|
err = battery_os_update(&battery_state);
|
||||||
struct apm_power_info info;
|
|
||||||
if (apm_fd > 0 && ioctl(apm_fd, APM_IOC_GETPOWER, &(info)) == 0) {
|
|
||||||
// best attempt at mapping to Linux battery states
|
|
||||||
switch (info.battery_state) {
|
|
||||||
case APM_BATT_CHARGING:
|
|
||||||
battery_state.state = BATTERY_CHARGING;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
battery_state.state = BATTERY_DISCHARGING;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (info.battery_life == 100)
|
|
||||||
battery_state.state = BATTERY_FULL;
|
|
||||||
|
|
||||||
// no mapping for openbsd really
|
|
||||||
energy_full = 0;
|
|
||||||
energy_now = 0;
|
|
||||||
|
|
||||||
if (info.minutes_left != -1)
|
|
||||||
seconds = info.minutes_left * 60;
|
|
||||||
else
|
|
||||||
seconds = -1;
|
|
||||||
|
|
||||||
new_percentage = info.battery_life;
|
|
||||||
} else {
|
|
||||||
warn("power update: APM_IOC_GETPOWER");
|
|
||||||
errors = 1;
|
|
||||||
}
|
|
||||||
#elif defined(__FreeBSD__)
|
|
||||||
int sysctl_out = 0;
|
|
||||||
size_t len = sizeof(sysctl_out);
|
|
||||||
|
|
||||||
if (sysctlbyname("hw.acpi.battery.state", &sysctl_out, &len, NULL, 0) == 0) {
|
|
||||||
// attemp to map the battery state to Linux
|
|
||||||
battery_state.state = BATTERY_UNKNOWN;
|
|
||||||
switch(sysctl_out) {
|
|
||||||
case 1:
|
|
||||||
battery_state.state = BATTERY_DISCHARGING;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
battery_state.state = BATTERY_CHARGING;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
battery_state.state = BATTERY_FULL;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
fprintf(stderr, "power update: no such sysctl");
|
|
||||||
errors = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// no mapping for freebsd
|
|
||||||
energy_full = 0;
|
|
||||||
energy_now = 0;
|
|
||||||
|
|
||||||
if (sysctlbyname("hw.acpi.battery.time", &sysctl_out, &len, NULL, 0) != 0)
|
|
||||||
seconds = -1;
|
|
||||||
else
|
|
||||||
seconds = sysctl_out * 60;
|
|
||||||
|
|
||||||
// charging or error
|
|
||||||
if (seconds < 0)
|
|
||||||
seconds = 0;
|
|
||||||
|
|
||||||
if (sysctlbyname("hw.acpi.battery.life", &sysctl_out, &len, NULL, 0) != 0)
|
|
||||||
new_percentage = -1;
|
|
||||||
else
|
|
||||||
new_percentage = sysctl_out;
|
|
||||||
#else
|
|
||||||
FILE *fp = NULL;
|
|
||||||
char tmp[25] = "";
|
|
||||||
int64_t current_now = 0;
|
|
||||||
if (path_status) {
|
|
||||||
fp = fopen(path_status, "r");
|
|
||||||
if (fp != NULL) {
|
|
||||||
if (fgets(tmp, sizeof(tmp), fp)) {
|
|
||||||
if (strcasecmp(tmp, "Charging\n") == 0)
|
|
||||||
battery_state.state = BATTERY_CHARGING;
|
|
||||||
if (strcasecmp(tmp, "Discharging\n") == 0)
|
|
||||||
battery_state.state = BATTERY_DISCHARGING;
|
|
||||||
if (strcasecmp(tmp, "Full\n") == 0)
|
|
||||||
battery_state.state = BATTERY_FULL;
|
|
||||||
}
|
|
||||||
fclose(fp);
|
|
||||||
} else {
|
|
||||||
errors = 1;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
errors = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (path_energy_now) {
|
|
||||||
fp = fopen(path_energy_now, "r");
|
|
||||||
if (fp != NULL) {
|
|
||||||
if (fgets(tmp, sizeof tmp, fp))
|
|
||||||
energy_now = atoi(tmp);
|
|
||||||
fclose(fp);
|
|
||||||
} else {
|
|
||||||
errors = 1;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
errors = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (path_energy_full) {
|
|
||||||
fp = fopen(path_energy_full, "r");
|
|
||||||
if (fp != NULL) {
|
|
||||||
if (fgets(tmp, sizeof tmp, fp))
|
|
||||||
energy_full = atoi(tmp);
|
|
||||||
fclose(fp);
|
|
||||||
} else {
|
|
||||||
errors = 1;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
errors = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (path_current_now) {
|
|
||||||
fp = fopen(path_current_now, "r");
|
|
||||||
if (fp != NULL) {
|
|
||||||
if (fgets(tmp, sizeof tmp, fp))
|
|
||||||
current_now = atoi(tmp);
|
|
||||||
fclose(fp);
|
|
||||||
} else {
|
|
||||||
errors = 1;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
errors = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (current_now > 0) {
|
|
||||||
switch (battery_state.state) {
|
|
||||||
case BATTERY_CHARGING:
|
|
||||||
seconds = 3600 * (energy_full - energy_now) / current_now;
|
|
||||||
break;
|
|
||||||
case BATTERY_DISCHARGING:
|
|
||||||
seconds = 3600 * energy_now / current_now;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
seconds = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
seconds = 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
battery_state.time.hours = seconds / 3600;
|
|
||||||
seconds -= 3600 * battery_state.time.hours;
|
|
||||||
battery_state.time.minutes = seconds / 60;
|
|
||||||
seconds -= 60 * battery_state.time.minutes;
|
|
||||||
battery_state.time.seconds = seconds;
|
|
||||||
|
|
||||||
if (energy_full > 0)
|
|
||||||
new_percentage = 0.5 + ((energy_now <= energy_full ? energy_now : energy_full) * 100.0) / energy_full;
|
|
||||||
|
|
||||||
battery_state.percentage = new_percentage;
|
|
||||||
|
|
||||||
// clamp percentage to 100 in case battery is misreporting that its current charge is more than its max
|
// clamp percentage to 100 in case battery is misreporting that its current charge is more than its max
|
||||||
if (battery_state.percentage > 100) {
|
if (battery_state.percentage > 100) {
|
||||||
battery_state.percentage = 100;
|
battery_state.percentage = 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
return errors;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -529,6 +269,8 @@ void draw_battery (void *obj, cairo_t *c)
|
|||||||
pango_layout_set_font_description(layout, bat1_font_desc);
|
pango_layout_set_font_description(layout, bat1_font_desc);
|
||||||
pango_layout_set_width(layout, battery->area.width * PANGO_SCALE);
|
pango_layout_set_width(layout, battery->area.width * PANGO_SCALE);
|
||||||
pango_layout_set_alignment(layout, PANGO_ALIGN_CENTER);
|
pango_layout_set_alignment(layout, PANGO_ALIGN_CENTER);
|
||||||
|
pango_layout_set_wrap(layout, PANGO_WRAP_WORD_CHAR);
|
||||||
|
pango_layout_set_ellipsize(layout, PANGO_ELLIPSIZE_NONE);
|
||||||
pango_layout_set_text(layout, buf_bat_percentage, strlen(buf_bat_percentage));
|
pango_layout_set_text(layout, buf_bat_percentage, strlen(buf_bat_percentage));
|
||||||
|
|
||||||
cairo_set_source_rgba(c, battery->font.color[0], battery->font.color[1], battery->font.color[2], battery->font.alpha);
|
cairo_set_source_rgba(c, battery->font.color[0], battery->font.color[1], battery->font.color[2], battery->font.alpha);
|
||||||
@@ -538,6 +280,8 @@ void draw_battery (void *obj, cairo_t *c)
|
|||||||
|
|
||||||
pango_layout_set_font_description(layout, bat2_font_desc);
|
pango_layout_set_font_description(layout, bat2_font_desc);
|
||||||
pango_layout_set_indent(layout, 0);
|
pango_layout_set_indent(layout, 0);
|
||||||
|
pango_layout_set_wrap(layout, PANGO_WRAP_WORD_CHAR);
|
||||||
|
pango_layout_set_ellipsize(layout, PANGO_ELLIPSIZE_NONE);
|
||||||
pango_layout_set_text(layout, buf_bat_time, strlen(buf_bat_time));
|
pango_layout_set_text(layout, buf_bat_time, strlen(buf_bat_time));
|
||||||
pango_layout_set_width(layout, battery->area.width * PANGO_SCALE);
|
pango_layout_set_width(layout, battery->area.width * PANGO_SCALE);
|
||||||
|
|
||||||
@@ -566,9 +310,13 @@ int resize_battery(void *obj)
|
|||||||
snprintf(buf_bat_time, sizeof(buf_bat_time), "%02d:%02d", battery_state.time.hours, battery_state.time.minutes);
|
snprintf(buf_bat_time, sizeof(buf_bat_time), "%02d:%02d", battery_state.time.hours, battery_state.time.minutes);
|
||||||
}
|
}
|
||||||
get_text_size2(bat1_font_desc, &bat_percentage_height_ink, &bat_percentage_height, &bat_percentage_width,
|
get_text_size2(bat1_font_desc, &bat_percentage_height_ink, &bat_percentage_height, &bat_percentage_width,
|
||||||
panel->area.height, panel->area.width, buf_bat_percentage, strlen(buf_bat_percentage));
|
panel->area.height, panel->area.width, buf_bat_percentage, strlen(buf_bat_percentage),
|
||||||
|
PANGO_WRAP_WORD_CHAR,
|
||||||
|
PANGO_ELLIPSIZE_NONE);
|
||||||
get_text_size2(bat2_font_desc, &bat_time_height_ink, &bat_time_height, &bat_time_width,
|
get_text_size2(bat2_font_desc, &bat_time_height_ink, &bat_time_height, &bat_time_width,
|
||||||
panel->area.height, panel->area.width, buf_bat_time, strlen(buf_bat_time));
|
panel->area.height, panel->area.width, buf_bat_time, strlen(buf_bat_time),
|
||||||
|
PANGO_WRAP_WORD_CHAR,
|
||||||
|
PANGO_ELLIPSIZE_NONE);
|
||||||
|
|
||||||
if (panel_horizontal) {
|
if (panel_horizontal) {
|
||||||
int new_size = (bat_percentage_width > bat_time_width) ? bat_percentage_width : bat_time_width;
|
int new_size = (bat_percentage_width > bat_time_width) ? bat_percentage_width : bat_time_width;
|
||||||
@@ -616,4 +364,4 @@ void battery_action(int button)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
tint_exec(command);
|
tint_exec(command);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* Copyright (C) 2009 Sebastian Reichel <elektranox@gmail.com>
|
* Copyright (C) 2009-2015 Sebastian Reichel <sre@ring0.de>
|
||||||
*
|
*
|
||||||
* Battery with functional data (percentage, time to life) and drawing data
|
* Battery with functional data (percentage, time to life) and drawing data
|
||||||
* (area, font, ...). Each panel use his own drawing data.
|
* (area, font, ...). Each panel use his own drawing data.
|
||||||
* Need kernel > 2.6.23.
|
|
||||||
*
|
*
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
@@ -45,38 +44,73 @@ typedef struct batstate {
|
|||||||
int percentage;
|
int percentage;
|
||||||
struct battime time;
|
struct battime time;
|
||||||
enum chargestate state;
|
enum chargestate state;
|
||||||
|
gboolean ac_connected;
|
||||||
} batstate;
|
} batstate;
|
||||||
|
|
||||||
extern struct batstate battery_state;
|
extern struct batstate battery_state;
|
||||||
extern PangoFontDescription *bat1_font_desc;
|
extern PangoFontDescription *bat1_font_desc;
|
||||||
extern PangoFontDescription *bat2_font_desc;
|
extern PangoFontDescription *bat2_font_desc;
|
||||||
extern int battery_enabled;
|
extern int battery_enabled;
|
||||||
|
extern int battery_tooltip_enabled;
|
||||||
extern int percentage_hide;
|
extern int percentage_hide;
|
||||||
|
|
||||||
extern int8_t battery_low_status;
|
extern int8_t battery_low_status;
|
||||||
extern char *battery_low_cmd;
|
extern char *battery_low_cmd;
|
||||||
|
|
||||||
|
extern char *ac_connected_cmd;
|
||||||
|
extern char *ac_disconnected_cmd;
|
||||||
|
|
||||||
extern char *battery_lclick_command;
|
extern char *battery_lclick_command;
|
||||||
extern char *battery_mclick_command;
|
extern char *battery_mclick_command;
|
||||||
extern char *battery_rclick_command;
|
extern char *battery_rclick_command;
|
||||||
extern char *battery_uwheel_command;
|
extern char *battery_uwheel_command;
|
||||||
extern char *battery_dwheel_command;
|
extern char *battery_dwheel_command;
|
||||||
|
|
||||||
|
static inline gchar* chargestate2str(enum chargestate state) {
|
||||||
|
switch(state) {
|
||||||
|
case BATTERY_CHARGING:
|
||||||
|
return "Charging";
|
||||||
|
case BATTERY_DISCHARGING:
|
||||||
|
return "Discharging";
|
||||||
|
case BATTERY_FULL:
|
||||||
|
return "Full";
|
||||||
|
case BATTERY_UNKNOWN:
|
||||||
|
default:
|
||||||
|
return "Unknown";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void batstate_set_time(struct batstate *state, int seconds) {
|
||||||
|
state->time.hours = seconds / 3600;
|
||||||
|
seconds -= 3600 * state->time.hours;
|
||||||
|
state->time.minutes = seconds / 60;
|
||||||
|
seconds -= 60 * state->time.minutes;
|
||||||
|
state->time.seconds = seconds;
|
||||||
|
}
|
||||||
|
|
||||||
// default global data
|
// default global data
|
||||||
void default_battery();
|
void default_battery();
|
||||||
|
|
||||||
// freed memory
|
// freed memory
|
||||||
void cleanup_battery();
|
void cleanup_battery();
|
||||||
|
|
||||||
|
void update_battery_tick(void* arg);
|
||||||
int update_battery();
|
int update_battery();
|
||||||
|
|
||||||
void init_battery();
|
void init_battery();
|
||||||
void init_battery_panel(void *panel);
|
void init_battery_panel(void *panel);
|
||||||
|
|
||||||
|
void reinit_battery();
|
||||||
void draw_battery(void *obj, cairo_t *c);
|
void draw_battery(void *obj, cairo_t *c);
|
||||||
|
|
||||||
int resize_battery(void *obj);
|
int resize_battery(void *obj);
|
||||||
|
|
||||||
void battery_action(int button);
|
void battery_action(int button);
|
||||||
|
|
||||||
|
/* operating system specific functions */
|
||||||
|
gboolean battery_os_init();
|
||||||
|
void battery_os_free();
|
||||||
|
int battery_os_update(struct batstate *state);
|
||||||
|
char* battery_os_tooltip();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
40
src/battery/dummy.c
Normal file
40
src/battery/dummy.c
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
/**************************************************************************
|
||||||
|
*
|
||||||
|
* Tint2 : Dummy battery (non-functional)
|
||||||
|
*
|
||||||
|
* Copyright (C) 2015 Sebastian Reichel <sre@ring0.de>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License version 2
|
||||||
|
* or any later version as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include "common.h"
|
||||||
|
#include "battery.h"
|
||||||
|
|
||||||
|
#warning tint2 has no battery support for this operating system!
|
||||||
|
|
||||||
|
gboolean battery_os_init() {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void battery_os_free() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int battery_os_update(struct batstate *state) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
char* battery_os_tooltip() {
|
||||||
|
return strdup("Operating System not supported");
|
||||||
|
}
|
||||||
98
src/battery/freebsd.c
Normal file
98
src/battery/freebsd.c
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
/**************************************************************************
|
||||||
|
*
|
||||||
|
* Tint2 : FreeBSD battery
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License version 2
|
||||||
|
* or any later version as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
#if defined(__FreeBSD__)
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/sysctl.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "common.h"
|
||||||
|
#include "battery.h"
|
||||||
|
|
||||||
|
gboolean battery_os_init() {
|
||||||
|
int sysctl_out = 0;
|
||||||
|
size_t len = sizeof(sysctl_out);
|
||||||
|
|
||||||
|
return (sysctlbyname("hw.acpi.battery.state", &sysctl_out, &len, NULL, 0) == 0) ||
|
||||||
|
(sysctlbyname("hw.acpi.battery.time", &sysctl_out, &len, NULL, 0) == 0) ||
|
||||||
|
(sysctlbyname("hw.acpi.battery.life", &sysctl_out, &len, NULL, 0) == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void battery_os_free() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int battery_os_update(struct batstate *state) {
|
||||||
|
int sysctl_out = 0;
|
||||||
|
size_t len = sizeof(sysctl_out);
|
||||||
|
gboolean err = 0;
|
||||||
|
|
||||||
|
if (sysctlbyname("hw.acpi.battery.state", &sysctl_out, &len, NULL, 0) == 0) {
|
||||||
|
switch(sysctl_out) {
|
||||||
|
case 1:
|
||||||
|
state->state = BATTERY_DISCHARGING;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
state->state = BATTERY_CHARGING;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
state->state = BATTERY_FULL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fprintf(stderr, "power update: no such sysctl");
|
||||||
|
err = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sysctlbyname("hw.acpi.battery.time", &sysctl_out, &len, NULL, 0) == 0)
|
||||||
|
batstate_set_time(state, sysctl_out * 60);
|
||||||
|
else
|
||||||
|
err = -1;
|
||||||
|
|
||||||
|
if (sysctlbyname("hw.acpi.battery.life", &sysctl_out, &len, NULL, 0) == 0)
|
||||||
|
state->percentage = sysctl_out;
|
||||||
|
else
|
||||||
|
err = -1;
|
||||||
|
|
||||||
|
if (sysctlbyname("hw.acpi.acline", &sysctl_out, &len, NULL, 0) == 0)
|
||||||
|
state->ac_connected = sysctl_out;
|
||||||
|
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
char* battery_os_tooltip() {
|
||||||
|
GString *tooltip = g_string_new("");
|
||||||
|
gchar *result;
|
||||||
|
|
||||||
|
g_string_append_printf(tooltip, "Battery\n");
|
||||||
|
|
||||||
|
gchar *state = (battery_state.state == BATTERY_UNKNOWN) ? "Level" : chargestate2str(battery_state.state);
|
||||||
|
|
||||||
|
g_string_append_printf(tooltip, "\t%s: %d%%", state, battery_state.percentage);
|
||||||
|
|
||||||
|
g_string_append_c(tooltip, '\n');
|
||||||
|
g_string_append_printf(tooltip, "AC\n");
|
||||||
|
g_string_append_printf(tooltip, battery_state.ac_connected ? "\tConnected" : "\tDisconnected");
|
||||||
|
|
||||||
|
result = tooltip->str;
|
||||||
|
g_string_free(tooltip, FALSE);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
517
src/battery/linux.c
Normal file
517
src/battery/linux.c
Normal file
@@ -0,0 +1,517 @@
|
|||||||
|
/**************************************************************************
|
||||||
|
*
|
||||||
|
* Tint2 : Linux battery
|
||||||
|
*
|
||||||
|
* Copyright (C) 2015 Sebastian Reichel <sre@ring0.de>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License version 2
|
||||||
|
* or any later version as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
#ifdef __linux
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "common.h"
|
||||||
|
#include "battery.h"
|
||||||
|
#include "uevent.h"
|
||||||
|
|
||||||
|
enum psy_type {
|
||||||
|
PSY_UNKNOWN,
|
||||||
|
PSY_BATTERY,
|
||||||
|
PSY_MAINS,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct psy_battery {
|
||||||
|
/* generic properties */
|
||||||
|
gchar* name;
|
||||||
|
gint64 timestamp;
|
||||||
|
/* sysfs files */
|
||||||
|
gchar* path_present;
|
||||||
|
gchar* path_energy_now;
|
||||||
|
gchar* path_energy_full;
|
||||||
|
gchar* path_power_now;
|
||||||
|
gchar* path_status;
|
||||||
|
/* sysfs hints */
|
||||||
|
gboolean energy_in_uamp;
|
||||||
|
gboolean power_in_uamp;
|
||||||
|
/* values */
|
||||||
|
gboolean present;
|
||||||
|
gint energy_now;
|
||||||
|
gint energy_full;
|
||||||
|
gint power_now;
|
||||||
|
enum chargestate status;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct psy_mains {
|
||||||
|
/* generic properties */
|
||||||
|
gchar* name;
|
||||||
|
/* sysfs files */
|
||||||
|
gchar* path_online;
|
||||||
|
/* values */
|
||||||
|
gboolean online;
|
||||||
|
};
|
||||||
|
|
||||||
|
static void uevent_battery_update() {
|
||||||
|
update_battery_tick(NULL);
|
||||||
|
}
|
||||||
|
static struct uevent_notify psy_change = {
|
||||||
|
UEVENT_CHANGE,
|
||||||
|
"power_supply",
|
||||||
|
NULL,
|
||||||
|
uevent_battery_update
|
||||||
|
};
|
||||||
|
|
||||||
|
static void uevent_battery_plug() {
|
||||||
|
printf("reinitialize batteries after HW change\n");
|
||||||
|
reinit_battery();
|
||||||
|
}
|
||||||
|
static struct uevent_notify psy_plug = {
|
||||||
|
UEVENT_ADD | UEVENT_REMOVE,
|
||||||
|
"power_supply",
|
||||||
|
NULL,
|
||||||
|
uevent_battery_plug
|
||||||
|
};
|
||||||
|
|
||||||
|
#define RETURN_ON_ERROR(err) if (error) { g_error_free(err); return FALSE; }
|
||||||
|
|
||||||
|
static GList *batteries = NULL;
|
||||||
|
static GList *mains = NULL;
|
||||||
|
|
||||||
|
static guint8 energy_to_percent(gint energy_now, gint energy_full) {
|
||||||
|
return 0.5 + ((energy_now <= energy_full ? energy_now : energy_full) * 100.0) / energy_full;
|
||||||
|
}
|
||||||
|
|
||||||
|
static enum psy_type power_supply_get_type(const gchar *entryname) {
|
||||||
|
gchar *path_type = g_build_filename("/sys/class/power_supply", entryname, "type", NULL);
|
||||||
|
GError *error = NULL;
|
||||||
|
gchar *type;
|
||||||
|
gsize typelen;
|
||||||
|
|
||||||
|
g_file_get_contents(path_type, &type, &typelen, &error);
|
||||||
|
g_free(path_type);
|
||||||
|
if (error) {
|
||||||
|
g_error_free(error);
|
||||||
|
return PSY_UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!g_strcmp0(type, "Battery\n")) {
|
||||||
|
g_free(type);
|
||||||
|
return PSY_BATTERY;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!g_strcmp0(type, "Mains\n")) {
|
||||||
|
g_free(type);
|
||||||
|
return PSY_MAINS;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_free(type);
|
||||||
|
|
||||||
|
return PSY_UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean init_linux_battery(struct psy_battery *bat) {
|
||||||
|
const gchar *entryname = bat->name;
|
||||||
|
|
||||||
|
bat->energy_in_uamp = FALSE;
|
||||||
|
bat->power_in_uamp = FALSE;
|
||||||
|
|
||||||
|
bat->path_present = g_build_filename("/sys/class/power_supply", entryname, "present", NULL);
|
||||||
|
if (!g_file_test(bat->path_present, G_FILE_TEST_EXISTS)) {
|
||||||
|
goto err0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bat->path_energy_now = g_build_filename("/sys/class/power_supply", entryname, "energy_now", NULL);
|
||||||
|
if (!g_file_test(bat->path_energy_now, G_FILE_TEST_EXISTS)) {
|
||||||
|
g_free(bat->path_energy_now);
|
||||||
|
bat->path_energy_now = g_build_filename("/sys/class/power_supply", entryname, "charge_now", NULL);
|
||||||
|
bat->energy_in_uamp = TRUE;
|
||||||
|
}
|
||||||
|
if (!g_file_test(bat->path_energy_now, G_FILE_TEST_EXISTS)) {
|
||||||
|
goto err1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!bat->energy_in_uamp) {
|
||||||
|
bat->path_energy_full = g_build_filename("/sys/class/power_supply", entryname, "energy_full", NULL);
|
||||||
|
if (!g_file_test(bat->path_energy_full, G_FILE_TEST_EXISTS))
|
||||||
|
goto err2;
|
||||||
|
} else {
|
||||||
|
bat->path_energy_full = g_build_filename("/sys/class/power_supply", entryname, "charge_full", NULL);
|
||||||
|
if (!g_file_test(bat->path_energy_full, G_FILE_TEST_EXISTS))
|
||||||
|
goto err2;
|
||||||
|
}
|
||||||
|
|
||||||
|
bat->path_power_now = g_build_filename("/sys/class/power_supply", entryname, "power_now", NULL);
|
||||||
|
if (!g_file_test(bat->path_power_now, G_FILE_TEST_EXISTS)) {
|
||||||
|
g_free(bat->path_power_now);
|
||||||
|
bat->path_power_now = g_build_filename("/sys/class/power_supply", entryname, "current_now", NULL);
|
||||||
|
bat->power_in_uamp = TRUE;
|
||||||
|
}
|
||||||
|
if (!g_file_test(bat->path_power_now, G_FILE_TEST_EXISTS)) {
|
||||||
|
goto err3;
|
||||||
|
}
|
||||||
|
|
||||||
|
bat->path_status = g_build_filename("/sys/class/power_supply", entryname, "status", NULL);
|
||||||
|
if (!g_file_test(bat->path_status, G_FILE_TEST_EXISTS)) {
|
||||||
|
goto err4;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
err4:
|
||||||
|
g_free(bat->path_status);
|
||||||
|
err3:
|
||||||
|
g_free(bat->path_power_now);
|
||||||
|
err2:
|
||||||
|
g_free(bat->path_energy_full);
|
||||||
|
err1:
|
||||||
|
g_free(bat->path_energy_now);
|
||||||
|
err0:
|
||||||
|
g_free(bat->path_present);
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean init_linux_mains(struct psy_mains *ac) {
|
||||||
|
const gchar *entryname = ac->name;
|
||||||
|
|
||||||
|
ac->path_online = g_build_filename("/sys/class/power_supply", entryname, "online", NULL);
|
||||||
|
if (!g_file_test(ac->path_online, G_FILE_TEST_EXISTS)) {
|
||||||
|
g_free(ac->path_online);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void psy_battery_free(gpointer data) {
|
||||||
|
struct psy_battery *bat = data;
|
||||||
|
g_free(bat->name);
|
||||||
|
g_free(bat->path_status);
|
||||||
|
g_free(bat->path_power_now);
|
||||||
|
g_free(bat->path_energy_full);
|
||||||
|
g_free(bat->path_energy_now);
|
||||||
|
g_free(bat->path_present);
|
||||||
|
g_free(bat);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void psy_mains_free(gpointer data) {
|
||||||
|
struct psy_mains *ac = data;
|
||||||
|
g_free(ac->name);
|
||||||
|
g_free(ac->path_online);
|
||||||
|
g_free(ac);
|
||||||
|
}
|
||||||
|
|
||||||
|
void battery_os_free() {
|
||||||
|
uevent_unregister_notifier(&psy_change);
|
||||||
|
uevent_unregister_notifier(&psy_plug);
|
||||||
|
|
||||||
|
g_list_free_full(batteries, psy_battery_free);
|
||||||
|
batteries = NULL;
|
||||||
|
g_list_free_full(mains, psy_mains_free);
|
||||||
|
mains = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void add_battery(const char *entryname) {
|
||||||
|
struct psy_battery *bat = g_malloc0(sizeof(*bat));
|
||||||
|
bat->name = g_strdup(entryname);
|
||||||
|
|
||||||
|
if (init_linux_battery(bat)) {
|
||||||
|
batteries = g_list_append(batteries, bat);
|
||||||
|
fprintf(stdout, "found battery \"%s\"\n", bat->name);
|
||||||
|
} else {
|
||||||
|
g_free(bat);
|
||||||
|
fprintf(stderr, RED "failed to initialize battery \"%s\"\n" RESET, entryname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void add_mains(const char *entryname) {
|
||||||
|
struct psy_mains *ac = g_malloc0(sizeof(*ac));
|
||||||
|
ac->name = g_strdup(entryname);
|
||||||
|
|
||||||
|
if (init_linux_mains(ac)) {
|
||||||
|
mains = g_list_append(mains, ac);
|
||||||
|
fprintf(stdout, "found mains \"%s\"\n", ac->name);
|
||||||
|
} else {
|
||||||
|
g_free(ac);
|
||||||
|
fprintf(stderr, RED "failed to initialize mains \"%s\"\n" RESET, entryname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gboolean battery_os_init() {
|
||||||
|
GDir *directory = 0;
|
||||||
|
GError *error = NULL;
|
||||||
|
const char *entryname;
|
||||||
|
|
||||||
|
battery_os_free();
|
||||||
|
|
||||||
|
directory = g_dir_open("/sys/class/power_supply", 0, &error);
|
||||||
|
RETURN_ON_ERROR(error);
|
||||||
|
|
||||||
|
while ((entryname = g_dir_read_name(directory))) {
|
||||||
|
enum psy_type type = power_supply_get_type(entryname);
|
||||||
|
|
||||||
|
switch(type) {
|
||||||
|
case PSY_BATTERY:
|
||||||
|
add_battery(entryname);
|
||||||
|
break;
|
||||||
|
case PSY_MAINS:
|
||||||
|
add_mains(entryname);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
g_dir_close(directory);
|
||||||
|
|
||||||
|
uevent_register_notifier(&psy_change);
|
||||||
|
uevent_register_notifier(&psy_plug);
|
||||||
|
|
||||||
|
return batteries != NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static gint estimate_power_usage(struct psy_battery *bat, gint old_energy_now, gint64 old_timestamp) {
|
||||||
|
gint64 diff_power = ABS(bat->energy_now - old_energy_now);
|
||||||
|
gint64 diff_time = bat->timestamp - old_timestamp;
|
||||||
|
|
||||||
|
/* µW = (µWh * 3600) / (µs / 1000000) */
|
||||||
|
gint power = diff_power * 3600 * 1000000 / MAX(1, diff_time);
|
||||||
|
|
||||||
|
return power;
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean update_linux_battery(struct psy_battery *bat) {
|
||||||
|
GError *error = NULL;
|
||||||
|
gchar *data;
|
||||||
|
gsize datalen;
|
||||||
|
|
||||||
|
gint64 old_timestamp = bat->timestamp;
|
||||||
|
int old_energy_now = bat->energy_now;
|
||||||
|
|
||||||
|
/* reset values */
|
||||||
|
bat->present = 0;
|
||||||
|
bat->status = BATTERY_UNKNOWN;
|
||||||
|
bat->energy_now = 0;
|
||||||
|
bat->energy_full = 0;
|
||||||
|
bat->power_now = 0;
|
||||||
|
bat->timestamp = g_get_monotonic_time();
|
||||||
|
|
||||||
|
/* present */
|
||||||
|
g_file_get_contents(bat->path_present, &data, &datalen, &error);
|
||||||
|
RETURN_ON_ERROR(error);
|
||||||
|
bat->present = (atoi(data) == 1);
|
||||||
|
g_free(data);
|
||||||
|
|
||||||
|
/* we are done, if battery is not present */
|
||||||
|
if (!bat->present)
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
/* status */
|
||||||
|
bat->status = BATTERY_UNKNOWN;
|
||||||
|
g_file_get_contents(bat->path_status, &data, &datalen, &error);
|
||||||
|
RETURN_ON_ERROR(error);
|
||||||
|
if (!g_strcmp0(data, "Charging\n")) {
|
||||||
|
bat->status = BATTERY_CHARGING;
|
||||||
|
} else if (!g_strcmp0(data, "Discharging\n")) {
|
||||||
|
bat->status = BATTERY_DISCHARGING;
|
||||||
|
} else if (!g_strcmp0(data, "Full\n")) {
|
||||||
|
bat->status = BATTERY_FULL;
|
||||||
|
}
|
||||||
|
g_free(data);
|
||||||
|
|
||||||
|
/* energy now */
|
||||||
|
g_file_get_contents(bat->path_energy_now, &data, &datalen, &error);
|
||||||
|
RETURN_ON_ERROR(error);
|
||||||
|
bat->energy_now = atoi(data);
|
||||||
|
g_free(data);
|
||||||
|
|
||||||
|
/* energy full */
|
||||||
|
g_file_get_contents(bat->path_energy_full, &data, &datalen, &error);
|
||||||
|
RETURN_ON_ERROR(error);
|
||||||
|
bat->energy_full = atoi(data);
|
||||||
|
g_free(data);
|
||||||
|
|
||||||
|
/* power now */
|
||||||
|
g_file_get_contents(bat->path_power_now, &data, &datalen, &error);
|
||||||
|
if (g_error_matches(error, G_FILE_ERROR, G_FILE_ERROR_NODEV)) {
|
||||||
|
/* some hardware does not support reading current power consumption */
|
||||||
|
g_error_free(error);
|
||||||
|
bat->power_now = estimate_power_usage(bat, old_energy_now, old_timestamp);
|
||||||
|
} else if (error) {
|
||||||
|
g_error_free(error);
|
||||||
|
return FALSE;
|
||||||
|
} else {
|
||||||
|
bat->power_now = atoi(data);
|
||||||
|
g_free(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static gboolean update_linux_mains(struct psy_mains *ac) {
|
||||||
|
GError *error = NULL;
|
||||||
|
gchar *data;
|
||||||
|
gsize datalen;
|
||||||
|
ac->online = FALSE;
|
||||||
|
|
||||||
|
/* online */
|
||||||
|
g_file_get_contents(ac->path_online, &data, &datalen, &error);
|
||||||
|
RETURN_ON_ERROR(error);
|
||||||
|
ac->online = (atoi(data) == 1);
|
||||||
|
g_free(data);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
int battery_os_update(struct batstate *state) {
|
||||||
|
GList *l;
|
||||||
|
|
||||||
|
gint64 total_energy_now = 0;
|
||||||
|
gint64 total_energy_full = 0;
|
||||||
|
gint64 total_power_now = 0;
|
||||||
|
gint seconds = 0;
|
||||||
|
|
||||||
|
gboolean charging = FALSE;
|
||||||
|
gboolean discharging = FALSE;
|
||||||
|
gboolean full = FALSE;
|
||||||
|
gboolean ac_connected = FALSE;
|
||||||
|
|
||||||
|
for (l = batteries; l != NULL; l = l->next) {
|
||||||
|
struct psy_battery *bat = l->data;
|
||||||
|
update_linux_battery(bat);
|
||||||
|
|
||||||
|
total_energy_now += bat->energy_now;
|
||||||
|
total_energy_full += bat->energy_full;
|
||||||
|
total_power_now += bat->power_now;
|
||||||
|
|
||||||
|
charging |= (bat->status == BATTERY_CHARGING);
|
||||||
|
discharging |= (bat->status == BATTERY_DISCHARGING);
|
||||||
|
full |= (bat->status == BATTERY_FULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (l = mains; l != NULL; l = l->next) {
|
||||||
|
struct psy_mains *ac = l->data;
|
||||||
|
update_linux_mains(ac);
|
||||||
|
ac_connected |= (ac->online);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* build global state */
|
||||||
|
if (charging && !discharging)
|
||||||
|
state->state = BATTERY_CHARGING;
|
||||||
|
else if (!charging && discharging)
|
||||||
|
state->state = BATTERY_DISCHARGING;
|
||||||
|
else if (!charging && !discharging && full)
|
||||||
|
state->state = BATTERY_FULL;
|
||||||
|
|
||||||
|
/* calculate seconds */
|
||||||
|
if (total_power_now > 0) {
|
||||||
|
if (state->state == BATTERY_CHARGING)
|
||||||
|
seconds = 3600 * (total_energy_full - total_energy_now) / total_power_now;
|
||||||
|
else if (state->state == BATTERY_DISCHARGING)
|
||||||
|
seconds = 3600 * total_energy_now / total_power_now;
|
||||||
|
}
|
||||||
|
batstate_set_time(state, seconds);
|
||||||
|
|
||||||
|
/* calculate percentage */
|
||||||
|
state->percentage = energy_to_percent(total_energy_now, total_energy_full);
|
||||||
|
|
||||||
|
/* AC state */
|
||||||
|
state->ac_connected = ac_connected;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static gchar* energy_human_readable(struct psy_battery *bat) {
|
||||||
|
gint now = bat->energy_now;
|
||||||
|
gint full = bat->energy_full;
|
||||||
|
gchar unit = bat->energy_in_uamp ? 'A' : 'W';
|
||||||
|
|
||||||
|
if (full >= 1000000) {
|
||||||
|
return g_strdup_printf("%d.%d / %d.%d %ch",
|
||||||
|
now / 1000000, (now % 1000000) / 100000,
|
||||||
|
full / 1000000, (full % 1000000) / 100000,
|
||||||
|
unit);
|
||||||
|
} else if (full >= 1000) {
|
||||||
|
return g_strdup_printf("%d.%d / %d.%d m%ch",
|
||||||
|
now / 1000, (now % 1000) / 100,
|
||||||
|
full / 1000, (full % 1000) / 100,
|
||||||
|
unit);
|
||||||
|
} else {
|
||||||
|
return g_strdup_printf("%d / %d µ%ch", now, full, unit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static gchar* power_human_readable(struct psy_battery *bat) {
|
||||||
|
gint power = bat->power_now;
|
||||||
|
gchar unit = bat->power_in_uamp ? 'A' : 'W';
|
||||||
|
|
||||||
|
if (power >= 1000000) {
|
||||||
|
return g_strdup_printf("%d.%d %c", power / 1000000, (power % 1000000) / 100000, unit);
|
||||||
|
} else if (power >= 1000) {
|
||||||
|
return g_strdup_printf("%d.%d m%c", power / 1000, (power % 1000) / 100, unit);
|
||||||
|
} else if (power > 0) {
|
||||||
|
return g_strdup_printf("%d µ%c", power, unit);
|
||||||
|
} else {
|
||||||
|
return g_strdup_printf("0 %c", unit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
char* battery_os_tooltip() {
|
||||||
|
GList *l;
|
||||||
|
GString *tooltip = g_string_new("");
|
||||||
|
gchar *result;
|
||||||
|
|
||||||
|
for (l = batteries; l != NULL; l = l->next) {
|
||||||
|
struct psy_battery *bat = l->data;
|
||||||
|
|
||||||
|
if (tooltip->len)
|
||||||
|
g_string_append_c(tooltip, '\n');
|
||||||
|
|
||||||
|
g_string_append_printf(tooltip, "%s\n", bat->name);
|
||||||
|
|
||||||
|
if (!bat->present) {
|
||||||
|
g_string_append_printf(tooltip, "\tnot connected");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
gchar *power = power_human_readable(bat);
|
||||||
|
gchar *energy = energy_human_readable(bat);
|
||||||
|
gchar *state = (bat->status == BATTERY_UNKNOWN) ? "Level" : chargestate2str(bat->status);
|
||||||
|
|
||||||
|
guint8 percentage = energy_to_percent(bat->energy_now, bat->energy_full);
|
||||||
|
|
||||||
|
g_string_append_printf(tooltip, "\t%s: %s (%u %%)\n\tPower: %s",
|
||||||
|
state, energy, percentage, power);
|
||||||
|
|
||||||
|
g_free(power);
|
||||||
|
g_free(energy);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (l = mains; l != NULL; l = l->next) {
|
||||||
|
struct psy_mains *ac = l->data;
|
||||||
|
|
||||||
|
if (tooltip->len)
|
||||||
|
g_string_append_c(tooltip, '\n');
|
||||||
|
|
||||||
|
g_string_append_printf(tooltip, "%s\n", ac->name);
|
||||||
|
g_string_append_printf(tooltip, ac->online ? "\tConnected" : "\tDisconnected");
|
||||||
|
}
|
||||||
|
|
||||||
|
result = tooltip->str;
|
||||||
|
g_string_free(tooltip, FALSE);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
104
src/battery/openbsd.c
Normal file
104
src/battery/openbsd.c
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
/**************************************************************************
|
||||||
|
*
|
||||||
|
* Tint2 : OpenBSD & NetBSD battery
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License version 2
|
||||||
|
* or any later version as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
#if defined(__OpenBSD__) || defined(__NetBSD__)
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <err.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <machine/apmvar.h>
|
||||||
|
|
||||||
|
#include "common.h"
|
||||||
|
#include "battery.h"
|
||||||
|
|
||||||
|
int apm_fd = -1;
|
||||||
|
|
||||||
|
gboolean battery_os_init() {
|
||||||
|
if (apm_fd > 0)
|
||||||
|
close(apm_fd);
|
||||||
|
|
||||||
|
apm_fd = open("/dev/apm", O_RDONLY);
|
||||||
|
|
||||||
|
if (apm_fd < 0) {
|
||||||
|
warn("ERROR: battery applet cannot open /dev/apm.");
|
||||||
|
return FALSE;
|
||||||
|
} else {
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void battery_os_free() {
|
||||||
|
if ((apm_fd != -1) && (close(apm_fd) == -1))
|
||||||
|
warn("cannot close /dev/apm");
|
||||||
|
apm_fd = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int battery_os_update(struct batstate *state) {
|
||||||
|
struct apm_power_info info;
|
||||||
|
|
||||||
|
if (apm_fd > 0 && ioctl(apm_fd, APM_IOC_GETPOWER, &(info)) == 0) {
|
||||||
|
// best attempt at mapping to Linux battery states
|
||||||
|
switch (info.battery_state) {
|
||||||
|
case APM_BATT_CHARGING:
|
||||||
|
state->state = BATTERY_CHARGING;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
state->state = BATTERY_DISCHARGING;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (info.battery_life > 100)
|
||||||
|
info.battery_life = 100;
|
||||||
|
if (info.battery_life == 100)
|
||||||
|
state->state = BATTERY_FULL;
|
||||||
|
|
||||||
|
state->percentage = info.battery_life;
|
||||||
|
if (info.minutes_left != -1)
|
||||||
|
batstate_set_time(state, info.minutes_left * 60);
|
||||||
|
|
||||||
|
state->ac_connected = info.ac_state == APM_AC_ON;
|
||||||
|
} else {
|
||||||
|
warn("power update: APM_IOC_GETPOWER");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
char* battery_os_tooltip() {
|
||||||
|
GString *tooltip = g_string_new("");
|
||||||
|
gchar *result;
|
||||||
|
|
||||||
|
g_string_append_printf(tooltip, "Battery\n");
|
||||||
|
|
||||||
|
gchar *state = (battery_state.state == BATTERY_UNKNOWN) ? "Level" : chargestate2str(battery_state.state);
|
||||||
|
|
||||||
|
g_string_append_printf(tooltip, "\t%s: %d%%", state, battery_state.percentage);
|
||||||
|
|
||||||
|
g_string_append_c(tooltip, '\n');
|
||||||
|
g_string_append_printf(tooltip, "AC\n");
|
||||||
|
g_string_append_printf(tooltip, battery_state.ac_connected ? "\tConnected" : "\tDisconnected");
|
||||||
|
|
||||||
|
result = tooltip->str;
|
||||||
|
g_string_free(tooltip, FALSE);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -144,10 +144,10 @@ struct tm* clock_gettime_for_tz(const char* timezone) {
|
|||||||
else return localtime(&time_clock.tv_sec);
|
else return localtime(&time_clock.tv_sec);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* clock_get_tooltip(void* obj)
|
char* clock_get_tooltip(void* obj)
|
||||||
{
|
{
|
||||||
strftime(buf_tooltip, sizeof(buf_tooltip), time_tooltip_format, clock_gettime_for_tz(time_tooltip_timezone));
|
strftime(buf_tooltip, sizeof(buf_tooltip), time_tooltip_format, clock_gettime_for_tz(time_tooltip_timezone));
|
||||||
return buf_tooltip;
|
return strdup(buf_tooltip);
|
||||||
}
|
}
|
||||||
|
|
||||||
int time_format_needs_sec_ticks(char *time_format)
|
int time_format_needs_sec_ticks(char *time_format)
|
||||||
@@ -185,6 +185,11 @@ void init_clock_panel(void *p)
|
|||||||
clock->area.bg = &g_array_index(backgrounds, Background, 0);
|
clock->area.bg = &g_array_index(backgrounds, Background, 0);
|
||||||
clock->area.parent = p;
|
clock->area.parent = p;
|
||||||
clock->area.panel = p;
|
clock->area.panel = p;
|
||||||
|
clock->area.mouse_press_effect = clock->area.mouse_over_effect = clock_lclick_command ||
|
||||||
|
clock_mclick_command ||
|
||||||
|
clock_rclick_command ||
|
||||||
|
clock_uwheel_command ||
|
||||||
|
clock_dwheel_command;
|
||||||
clock->area._draw_foreground = draw_clock;
|
clock->area._draw_foreground = draw_clock;
|
||||||
clock->area.size_mode = SIZE_BY_CONTENT;
|
clock->area.size_mode = SIZE_BY_CONTENT;
|
||||||
clock->area._resize = resize_clock;
|
clock->area._resize = resize_clock;
|
||||||
@@ -213,6 +218,8 @@ void draw_clock (void *obj, cairo_t *c)
|
|||||||
pango_layout_set_font_description (layout, time1_font_desc);
|
pango_layout_set_font_description (layout, time1_font_desc);
|
||||||
pango_layout_set_width (layout, clock->area.width * PANGO_SCALE);
|
pango_layout_set_width (layout, clock->area.width * PANGO_SCALE);
|
||||||
pango_layout_set_alignment (layout, PANGO_ALIGN_CENTER);
|
pango_layout_set_alignment (layout, PANGO_ALIGN_CENTER);
|
||||||
|
pango_layout_set_wrap(layout, PANGO_WRAP_WORD_CHAR);
|
||||||
|
pango_layout_set_ellipsize(layout, PANGO_ELLIPSIZE_NONE);
|
||||||
pango_layout_set_text (layout, buf_time, strlen(buf_time));
|
pango_layout_set_text (layout, buf_time, strlen(buf_time));
|
||||||
|
|
||||||
cairo_set_source_rgba (c, clock->font.color[0], clock->font.color[1], clock->font.color[2], clock->font.alpha);
|
cairo_set_source_rgba (c, clock->font.color[0], clock->font.color[1], clock->font.color[2], clock->font.alpha);
|
||||||
@@ -244,10 +251,14 @@ int resize_clock (void *obj)
|
|||||||
|
|
||||||
date_height = date_width = 0;
|
date_height = date_width = 0;
|
||||||
strftime(buf_time, sizeof(buf_time), time1_format, clock_gettime_for_tz(time1_timezone));
|
strftime(buf_time, sizeof(buf_time), time1_format, clock_gettime_for_tz(time1_timezone));
|
||||||
get_text_size2(time1_font_desc, &time_height_ink, &time_height, &time_width, panel->area.height, panel->area.width, buf_time, strlen(buf_time));
|
get_text_size2(time1_font_desc, &time_height_ink, &time_height, &time_width, panel->area.height, panel->area.width, buf_time, strlen(buf_time),
|
||||||
|
PANGO_WRAP_WORD_CHAR,
|
||||||
|
PANGO_ELLIPSIZE_NONE);
|
||||||
if (time2_format) {
|
if (time2_format) {
|
||||||
strftime(buf_date, sizeof(buf_date), time2_format, clock_gettime_for_tz(time2_timezone));
|
strftime(buf_date, sizeof(buf_date), time2_format, clock_gettime_for_tz(time2_timezone));
|
||||||
get_text_size2(time2_font_desc, &date_height_ink, &date_height, &date_width, panel->area.height, panel->area.width, buf_date, strlen(buf_date));
|
get_text_size2(time2_font_desc, &date_height_ink, &date_height, &date_width, panel->area.height, panel->area.width, buf_date, strlen(buf_date),
|
||||||
|
PANGO_WRAP_WORD_CHAR,
|
||||||
|
PANGO_ELLIPSIZE_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (panel_horizontal) {
|
if (panel_horizontal) {
|
||||||
|
|||||||
107
src/config.c
107
src/config.c
@@ -70,6 +70,11 @@ char *snapshot_path;
|
|||||||
// detect if it's an old config file (==1)
|
// detect if it's an old config file (==1)
|
||||||
static int new_config_file;
|
static int new_config_file;
|
||||||
|
|
||||||
|
static int read_bg_color_hover;
|
||||||
|
static int read_border_color_hover;
|
||||||
|
static int read_bg_color_press;
|
||||||
|
static int read_border_color_press;
|
||||||
|
|
||||||
|
|
||||||
void default_config()
|
void default_config()
|
||||||
{
|
{
|
||||||
@@ -205,10 +210,25 @@ void add_entry (char *key, char *value)
|
|||||||
/* Background and border */
|
/* Background and border */
|
||||||
if (strcmp (key, "rounded") == 0) {
|
if (strcmp (key, "rounded") == 0) {
|
||||||
// 'rounded' is the first parameter => alloc a new background
|
// 'rounded' is the first parameter => alloc a new background
|
||||||
|
if (backgrounds->len > 0) {
|
||||||
|
Background *bg = &g_array_index(backgrounds, Background, backgrounds->len-1);
|
||||||
|
if (!read_bg_color_hover)
|
||||||
|
memcpy(&bg->back_hover, &bg->back, sizeof(Color));
|
||||||
|
if (!read_border_color_hover)
|
||||||
|
memcpy(&bg->border_hover, &bg->border, sizeof(Color));
|
||||||
|
if (!read_bg_color_press)
|
||||||
|
memcpy(&bg->back_pressed, &bg->back_hover, sizeof(Color));
|
||||||
|
if (!read_border_color_press)
|
||||||
|
memcpy(&bg->border_pressed, &bg->border_hover, sizeof(Color));
|
||||||
|
}
|
||||||
Background bg;
|
Background bg;
|
||||||
memset(&bg, 0, sizeof(bg));
|
init_background(&bg);
|
||||||
bg.border.rounded = atoi(value);
|
bg.border.rounded = atoi(value);
|
||||||
g_array_append_val(backgrounds, bg);
|
g_array_append_val(backgrounds, bg);
|
||||||
|
read_bg_color_hover = 0;
|
||||||
|
read_border_color_hover = 0;
|
||||||
|
read_bg_color_press = 0;
|
||||||
|
read_border_color_press = 0;
|
||||||
}
|
}
|
||||||
else if (strcmp (key, "border_width") == 0) {
|
else if (strcmp (key, "border_width") == 0) {
|
||||||
g_array_index(backgrounds, Background, backgrounds->len-1).border.width = atoi(value);
|
g_array_index(backgrounds, Background, backgrounds->len-1).border.width = atoi(value);
|
||||||
@@ -227,6 +247,38 @@ void add_entry (char *key, char *value)
|
|||||||
if (value2) bg->border.alpha = (atoi (value2) / 100.0);
|
if (value2) bg->border.alpha = (atoi (value2) / 100.0);
|
||||||
else bg->border.alpha = 0.5;
|
else bg->border.alpha = 0.5;
|
||||||
}
|
}
|
||||||
|
else if (strcmp (key, "background_color_hover") == 0) {
|
||||||
|
Background* bg = &g_array_index(backgrounds, Background, backgrounds->len-1);
|
||||||
|
extract_values(value, &value1, &value2, &value3);
|
||||||
|
get_color (value1, bg->back_hover.color);
|
||||||
|
if (value2) bg->back_hover.alpha = (atoi (value2) / 100.0);
|
||||||
|
else bg->back_hover.alpha = 0.5;
|
||||||
|
read_bg_color_hover = 1;
|
||||||
|
}
|
||||||
|
else if (strcmp (key, "border_color_hover") == 0) {
|
||||||
|
Background* bg = &g_array_index(backgrounds, Background, backgrounds->len-1);
|
||||||
|
extract_values(value, &value1, &value2, &value3);
|
||||||
|
get_color (value1, bg->border_hover.color);
|
||||||
|
if (value2) bg->border_hover.alpha = (atoi (value2) / 100.0);
|
||||||
|
else bg->border_hover.alpha = 0.5;
|
||||||
|
read_border_color_hover = 1;
|
||||||
|
}
|
||||||
|
else if (strcmp (key, "background_color_pressed") == 0) {
|
||||||
|
Background* bg = &g_array_index(backgrounds, Background, backgrounds->len-1);
|
||||||
|
extract_values(value, &value1, &value2, &value3);
|
||||||
|
get_color (value1, bg->back_pressed.color);
|
||||||
|
if (value2) bg->back_pressed.alpha = (atoi (value2) / 100.0);
|
||||||
|
else bg->back_pressed.alpha = 0.5;
|
||||||
|
read_bg_color_press = 1;
|
||||||
|
}
|
||||||
|
else if (strcmp (key, "border_color_pressed") == 0) {
|
||||||
|
Background* bg = &g_array_index(backgrounds, Background, backgrounds->len-1);
|
||||||
|
extract_values(value, &value1, &value2, &value3);
|
||||||
|
get_color (value1, bg->border_pressed.color);
|
||||||
|
if (value2) bg->border_pressed.alpha = (atoi (value2) / 100.0);
|
||||||
|
else bg->border_pressed.alpha = 0.5;
|
||||||
|
read_border_color_press = 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Panel */
|
/* Panel */
|
||||||
else if (strcmp (key, "panel_monitor") == 0) {
|
else if (strcmp (key, "panel_monitor") == 0) {
|
||||||
@@ -354,7 +406,7 @@ void add_entry (char *key, char *value)
|
|||||||
else if (strcmp (key, "battery_low_status") == 0) {
|
else if (strcmp (key, "battery_low_status") == 0) {
|
||||||
#ifdef ENABLE_BATTERY
|
#ifdef ENABLE_BATTERY
|
||||||
battery_low_status = atoi(value);
|
battery_low_status = atoi(value);
|
||||||
if(battery_low_status < 0 || battery_low_status > 100)
|
if (battery_low_status < 0 || battery_low_status > 100)
|
||||||
battery_low_status = 0;
|
battery_low_status = 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -392,6 +444,18 @@ void add_entry (char *key, char *value)
|
|||||||
#ifdef ENABLE_BATTERY
|
#ifdef ENABLE_BATTERY
|
||||||
if (strlen(value) > 0)
|
if (strlen(value) > 0)
|
||||||
battery_low_cmd = strdup (value);
|
battery_low_cmd = strdup (value);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
else if (strcmp (key, "ac_connected_cmd") == 0) {
|
||||||
|
#ifdef ENABLE_BATTERY
|
||||||
|
if (strlen(value) > 0)
|
||||||
|
ac_connected_cmd = strdup (value);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
else if (strcmp (key, "ac_disconnected_cmd") == 0) {
|
||||||
|
#ifdef ENABLE_BATTERY
|
||||||
|
if (strlen(value) > 0)
|
||||||
|
ac_disconnected_cmd = strdup (value);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if (strcmp (key, "bat1_font") == 0) {
|
else if (strcmp (key, "bat1_font") == 0) {
|
||||||
@@ -434,6 +498,11 @@ void add_entry (char *key, char *value)
|
|||||||
percentage_hide = 101;
|
percentage_hide = 101;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
else if (strcmp (key, "battery_tooltip") == 0) {
|
||||||
|
#ifdef ENABLE_BATTERY
|
||||||
|
battery_tooltip_enabled = atoi(value);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/* Clock */
|
/* Clock */
|
||||||
else if (strcmp (key, "time1_format") == 0) {
|
else if (strcmp (key, "time1_format") == 0) {
|
||||||
@@ -564,7 +633,7 @@ void add_entry (char *key, char *value)
|
|||||||
panel_config.g_taskbar.background_name[TASKBAR_ACTIVE] = &g_array_index(backgrounds, Background, id);
|
panel_config.g_taskbar.background_name[TASKBAR_ACTIVE] = &g_array_index(backgrounds, Background, id);
|
||||||
}
|
}
|
||||||
else if (strcmp (key, "taskbar_name_font") == 0) {
|
else if (strcmp (key, "taskbar_name_font") == 0) {
|
||||||
taskbarname_font_desc = pango_font_description_from_string (value);
|
panel_config.taskbarname_font_desc = pango_font_description_from_string(value);
|
||||||
}
|
}
|
||||||
else if (strcmp (key, "taskbar_name_font_color") == 0) {
|
else if (strcmp (key, "taskbar_name_font_color") == 0) {
|
||||||
extract_values(value, &value1, &value2, &value3);
|
extract_values(value, &value1, &value2, &value3);
|
||||||
@@ -730,6 +799,11 @@ void add_entry (char *key, char *value)
|
|||||||
id = (id < backgrounds->len && id >= 0) ? id : 0;
|
id = (id < backgrounds->len && id >= 0) ? id : 0;
|
||||||
panel_config.launcher.area.bg = &g_array_index(backgrounds, Background, id);
|
panel_config.launcher.area.bg = &g_array_index(backgrounds, Background, id);
|
||||||
}
|
}
|
||||||
|
else if (strcmp (key, "launcher_icon_background_id") == 0) {
|
||||||
|
int id = atoi (value);
|
||||||
|
id = (id < backgrounds->len && id >= 0) ? id : 0;
|
||||||
|
launcher_icon_bg = &g_array_index(backgrounds, Background, id);
|
||||||
|
}
|
||||||
else if (strcmp(key, "launcher_icon_size") == 0) {
|
else if (strcmp(key, "launcher_icon_size") == 0) {
|
||||||
launcher_max_icon_size = atoi(value);
|
launcher_max_icon_size = atoi(value);
|
||||||
}
|
}
|
||||||
@@ -804,6 +878,21 @@ void add_entry (char *key, char *value)
|
|||||||
get_action (value, &mouse_scroll_up);
|
get_action (value, &mouse_scroll_up);
|
||||||
else if (strcmp (key, "mouse_scroll_down") == 0)
|
else if (strcmp (key, "mouse_scroll_down") == 0)
|
||||||
get_action (value, &mouse_scroll_down);
|
get_action (value, &mouse_scroll_down);
|
||||||
|
else if (strcmp (key, "mouse_effects") == 0)
|
||||||
|
panel_config.mouse_effects = atoi(value);
|
||||||
|
else if (strcmp(key, "mouse_hover_icon_asb") == 0) {
|
||||||
|
extract_values(value, &value1, &value2, &value3);
|
||||||
|
panel_config.mouse_over_alpha = atoi(value1);
|
||||||
|
panel_config.mouse_over_saturation = atoi(value2);
|
||||||
|
panel_config.mouse_over_brightness = atoi(value3);
|
||||||
|
}
|
||||||
|
else if (strcmp(key, "mouse_pressed_icon_asb") == 0) {
|
||||||
|
extract_values(value, &value1, &value2, &value3);
|
||||||
|
panel_config.mouse_pressed_alpha = atoi(value1);
|
||||||
|
panel_config.mouse_pressed_saturation = atoi(value2);
|
||||||
|
panel_config.mouse_pressed_brightness = atoi(value3);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* autohide options */
|
/* autohide options */
|
||||||
else if (strcmp(key, "autohide") == 0)
|
else if (strcmp(key, "autohide") == 0)
|
||||||
@@ -947,6 +1036,18 @@ int config_read_file (const char *path)
|
|||||||
panel_items_order = strdup("T");
|
panel_items_order = strdup("T");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (backgrounds->len > 0) {
|
||||||
|
Background *bg = &g_array_index(backgrounds, Background, backgrounds->len-1);
|
||||||
|
if (!read_bg_color_hover)
|
||||||
|
memcpy(&bg->back_hover, &bg->back, sizeof(Color));
|
||||||
|
if (!read_border_color_hover)
|
||||||
|
memcpy(&bg->border_hover, &bg->border, sizeof(Color));
|
||||||
|
if (!read_bg_color_press)
|
||||||
|
memcpy(&bg->back_pressed, &bg->back_hover, sizeof(Color));
|
||||||
|
if (!read_border_color_press)
|
||||||
|
memcpy(&bg->border_pressed, &bg->border_hover, sizeof(Color));
|
||||||
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ int freespace_get_max_size(Panel *p) {
|
|||||||
// Get space used by every element except the freespace
|
// Get space used by every element except the freespace
|
||||||
GList *walk;
|
GList *walk;
|
||||||
int size = 0;
|
int size = 0;
|
||||||
for (walk = p->area.list; walk; walk = g_list_next(walk)) {
|
for (walk = p->area.children; walk; walk = g_list_next(walk)) {
|
||||||
Area *a = (Area *)walk->data;
|
Area *a = (Area *)walk->data;
|
||||||
|
|
||||||
if (a->_resize == resize_freespace || !a->on_screen)
|
if (a->_resize == resize_freespace || !a->on_screen)
|
||||||
|
|||||||
@@ -32,11 +32,6 @@
|
|||||||
#include <glib/gstdio.h>
|
#include <glib/gstdio.h>
|
||||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/wait.h>
|
|
||||||
|
|
||||||
#ifdef HAVE_RSVG
|
|
||||||
#include <librsvg/rsvg.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "window.h"
|
#include "window.h"
|
||||||
#include "server.h"
|
#include "server.h"
|
||||||
@@ -58,6 +53,7 @@ char *icon_theme_name_xsettings;
|
|||||||
int launcher_icon_theme_override;
|
int launcher_icon_theme_override;
|
||||||
XSettingsClient *xsettings_client;
|
XSettingsClient *xsettings_client;
|
||||||
int startup_notifications;
|
int startup_notifications;
|
||||||
|
Background *launcher_icon_bg;
|
||||||
|
|
||||||
Imlib_Image scale_icon(Imlib_Image original, int icon_size);
|
Imlib_Image scale_icon(Imlib_Image original, int icon_size);
|
||||||
void free_icon(Imlib_Image icon);
|
void free_icon(Imlib_Image icon);
|
||||||
@@ -75,6 +71,7 @@ void default_launcher()
|
|||||||
launcher_icon_theme_override = 0;
|
launcher_icon_theme_override = 0;
|
||||||
xsettings_client = NULL;
|
xsettings_client = NULL;
|
||||||
startup_notifications = 0;
|
startup_notifications = 0;
|
||||||
|
launcher_icon_bg = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -102,6 +99,9 @@ void init_launcher_panel(void *p)
|
|||||||
if (!launcher->area.bg)
|
if (!launcher->area.bg)
|
||||||
launcher->area.bg = &g_array_index(backgrounds, Background, 0);
|
launcher->area.bg = &g_array_index(backgrounds, Background, 0);
|
||||||
|
|
||||||
|
if (!launcher_icon_bg)
|
||||||
|
launcher_icon_bg = &g_array_index(backgrounds, Background, 0);
|
||||||
|
|
||||||
// check consistency
|
// check consistency
|
||||||
if (launcher->list_apps == NULL)
|
if (launcher->list_apps == NULL)
|
||||||
return;
|
return;
|
||||||
@@ -153,6 +153,8 @@ void cleanup_launcher_theme(Launcher *launcher)
|
|||||||
LauncherIcon *launcherIcon = (LauncherIcon*)l->data;
|
LauncherIcon *launcherIcon = (LauncherIcon*)l->data;
|
||||||
if (launcherIcon) {
|
if (launcherIcon) {
|
||||||
free_icon(launcherIcon->image);
|
free_icon(launcherIcon->image);
|
||||||
|
free_icon(launcherIcon->image_hover);
|
||||||
|
free_icon(launcherIcon->image_pressed);
|
||||||
free(launcherIcon->icon_name);
|
free(launcherIcon->icon_name);
|
||||||
free(launcherIcon->icon_path);
|
free(launcherIcon->icon_path);
|
||||||
free(launcherIcon->cmd);
|
free(launcherIcon->cmd);
|
||||||
@@ -197,49 +199,18 @@ int resize_launcher(void *obj)
|
|||||||
if (!new_icon_path) {
|
if (!new_icon_path) {
|
||||||
// Draw a blank icon
|
// Draw a blank icon
|
||||||
free_icon(launcherIcon->image);
|
free_icon(launcherIcon->image);
|
||||||
|
free_icon(launcherIcon->image_hover);
|
||||||
|
free_icon(launcherIcon->image_pressed);
|
||||||
launcherIcon->image = NULL;
|
launcherIcon->image = NULL;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Free the old files
|
// Free the old files
|
||||||
free_icon(launcherIcon->image);
|
free_icon(launcherIcon->image);
|
||||||
launcherIcon->image = NULL;
|
free_icon(launcherIcon->image_hover);
|
||||||
// Load the new file and scale
|
free_icon(launcherIcon->image_pressed);
|
||||||
launcherIcon->image = imlib_load_image_immediately(new_icon_path);
|
// Load the new file
|
||||||
#ifdef HAVE_RSVG
|
launcherIcon->image = load_image(new_icon_path, 1);
|
||||||
if (!launcherIcon->image && g_str_has_suffix(new_icon_path, ".svg")) {
|
|
||||||
char suffix[128];
|
|
||||||
sprintf(suffix, "tmpicon-%d.png", getpid());
|
|
||||||
// We fork here because librsvg allocates memory like crazy
|
|
||||||
pid_t pid = fork();
|
|
||||||
if (pid == 0) {
|
|
||||||
// Child
|
|
||||||
GError* err = NULL;
|
|
||||||
RsvgHandle* svg = rsvg_handle_new_from_file(new_icon_path, &err);
|
|
||||||
|
|
||||||
if (err != NULL) {
|
|
||||||
fprintf(stderr, "Could not load svg image!: %s", err->message);
|
|
||||||
g_error_free(err);
|
|
||||||
launcherIcon->image = NULL;
|
|
||||||
} else {
|
|
||||||
gchar *name = g_build_filename(g_get_user_config_dir(), "tint2", suffix, NULL);
|
|
||||||
GdkPixbuf *pixbuf = rsvg_handle_get_pixbuf(svg);
|
|
||||||
gdk_pixbuf_save(pixbuf, name, "png", NULL, NULL);
|
|
||||||
}
|
|
||||||
exit(0);
|
|
||||||
} else {
|
|
||||||
// Parent
|
|
||||||
waitpid(pid, 0, 0);
|
|
||||||
gchar *name = g_build_filename(g_get_user_config_dir(), "tint2", suffix, NULL);
|
|
||||||
launcherIcon->image = imlib_load_image_immediately_without_cache(name);
|
|
||||||
g_remove(name);
|
|
||||||
g_free(name);
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
launcherIcon->image = imlib_load_image_immediately(new_icon_path);
|
|
||||||
}
|
|
||||||
// On loading error, fallback to default
|
// On loading error, fallback to default
|
||||||
if (!launcherIcon->image) {
|
if (!launcherIcon->image) {
|
||||||
free(new_icon_path);
|
free(new_icon_path);
|
||||||
@@ -252,7 +223,7 @@ int resize_launcher(void *obj)
|
|||||||
// Loading default icon failed, draw a blank icon
|
// Loading default icon failed, draw a blank icon
|
||||||
free(new_icon_path);
|
free(new_icon_path);
|
||||||
} else {
|
} else {
|
||||||
// Loaded icon successfully
|
// Loaded icon successfully, rescale it
|
||||||
Imlib_Image original = launcherIcon->image;
|
Imlib_Image original = launcherIcon->image;
|
||||||
launcherIcon->image = scale_icon(launcherIcon->image, launcherIcon->icon_size);
|
launcherIcon->image = scale_icon(launcherIcon->image, launcherIcon->icon_size);
|
||||||
free_icon(original);
|
free_icon(original);
|
||||||
@@ -261,6 +232,11 @@ int resize_launcher(void *obj)
|
|||||||
fprintf(stderr, "launcher.c %d: Using icon %s\n", __LINE__, launcherIcon->icon_path);
|
fprintf(stderr, "launcher.c %d: Using icon %s\n", __LINE__, launcherIcon->icon_path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (panel_config.mouse_effects) {
|
||||||
|
launcherIcon->image_hover = adjust_icon(launcherIcon->image, panel_config.mouse_over_alpha, panel_config.mouse_over_saturation, panel_config.mouse_over_brightness);
|
||||||
|
launcherIcon->image_pressed = adjust_icon(launcherIcon->image, panel_config.mouse_pressed_alpha, panel_config.mouse_pressed_saturation, panel_config.mouse_pressed_brightness);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
count = g_slist_length(launcher->list_icons);
|
count = g_slist_length(launcher->list_icons);
|
||||||
@@ -347,18 +323,29 @@ void launcher_icon_on_change_layout(void *obj)
|
|||||||
launcherIcon->area.height = launcherIcon->icon_size;
|
launcherIcon->area.height = launcherIcon->icon_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* launcher_icon_get_tooltip_text(void *obj)
|
char* launcher_icon_get_tooltip_text(void *obj)
|
||||||
{
|
{
|
||||||
LauncherIcon *launcherIcon = (LauncherIcon*)obj;
|
LauncherIcon *launcherIcon = (LauncherIcon*)obj;
|
||||||
return launcherIcon->icon_tooltip;
|
return strdup(launcherIcon->icon_tooltip);
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw_launcher_icon(void *obj, cairo_t *c)
|
void draw_launcher_icon(void *obj, cairo_t *c)
|
||||||
{
|
{
|
||||||
LauncherIcon *launcherIcon = (LauncherIcon*)obj;
|
LauncherIcon *launcherIcon = (LauncherIcon*)obj;
|
||||||
|
|
||||||
|
Imlib_Image image;
|
||||||
// Render
|
// Render
|
||||||
imlib_context_set_image(launcherIcon->image);
|
if (panel_config.mouse_effects) {
|
||||||
|
if (launcherIcon->area.mouse_state == MOUSE_OVER)
|
||||||
|
image = launcherIcon->image_hover ? launcherIcon->image_hover : launcherIcon->image;
|
||||||
|
else if (launcherIcon->area.mouse_state == MOUSE_DOWN)
|
||||||
|
image = launcherIcon->image_pressed ? launcherIcon->image_pressed : launcherIcon->image;
|
||||||
|
else
|
||||||
|
image = launcherIcon->image;
|
||||||
|
} else {
|
||||||
|
image = launcherIcon->image;
|
||||||
|
}
|
||||||
|
imlib_context_set_image(image);
|
||||||
render_image(launcherIcon->area.pix, 0, 0);
|
render_image(launcherIcon->area.pix, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -466,7 +453,9 @@ void launcher_load_icons(Launcher *launcher)
|
|||||||
launcherIcon->area._resize = NULL;
|
launcherIcon->area._resize = NULL;
|
||||||
launcherIcon->area.resize = 0;
|
launcherIcon->area.resize = 0;
|
||||||
launcherIcon->area.redraw = 1;
|
launcherIcon->area.redraw = 1;
|
||||||
launcherIcon->area.bg = &g_array_index(backgrounds, Background, 0);
|
launcherIcon->area.mouse_over_effect = 1;
|
||||||
|
launcherIcon->area.mouse_press_effect = 1;
|
||||||
|
launcherIcon->area.bg = launcher_icon_bg;
|
||||||
launcherIcon->area.on_screen = 1;
|
launcherIcon->area.on_screen = 1;
|
||||||
launcherIcon->area._on_change_layout = launcher_icon_on_change_layout;
|
launcherIcon->area._on_change_layout = launcher_icon_on_change_layout;
|
||||||
if (launcher_tooltip_enabled) {
|
if (launcher_tooltip_enabled) {
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ typedef struct LauncherIcon {
|
|||||||
// always start with area
|
// always start with area
|
||||||
Area area;
|
Area area;
|
||||||
Imlib_Image image;
|
Imlib_Image image;
|
||||||
|
Imlib_Image image_hover;
|
||||||
|
Imlib_Image image_pressed;
|
||||||
char *cmd;
|
char *cmd;
|
||||||
char *icon_name;
|
char *icon_name;
|
||||||
char *icon_path;
|
char *icon_path;
|
||||||
@@ -44,6 +46,7 @@ extern char *icon_theme_name_config;
|
|||||||
extern int launcher_icon_theme_override;
|
extern int launcher_icon_theme_override;
|
||||||
extern XSettingsClient *xsettings_client;
|
extern XSettingsClient *xsettings_client;
|
||||||
extern int startup_notifications;
|
extern int startup_notifications;
|
||||||
|
extern Background *launcher_icon_bg;
|
||||||
|
|
||||||
// default global data
|
// default global data
|
||||||
void default_launcher();
|
void default_launcher();
|
||||||
|
|||||||
59
src/panel.c
59
src/panel.c
@@ -97,10 +97,16 @@ void default_panel()
|
|||||||
backgrounds = g_array_new(0, 0, sizeof(Background));
|
backgrounds = g_array_new(0, 0, sizeof(Background));
|
||||||
|
|
||||||
memset(&panel_config, 0, sizeof(Panel));
|
memset(&panel_config, 0, sizeof(Panel));
|
||||||
|
panel_config.mouse_over_alpha = 100;
|
||||||
|
panel_config.mouse_over_saturation = 0;
|
||||||
|
panel_config.mouse_over_brightness = 10;
|
||||||
|
panel_config.mouse_pressed_alpha = 100;
|
||||||
|
panel_config.mouse_pressed_saturation = 0;
|
||||||
|
panel_config.mouse_pressed_brightness = 0;
|
||||||
|
|
||||||
// append full transparency background
|
// append full transparency background
|
||||||
Background transparent_bg;
|
Background transparent_bg;
|
||||||
memset(&transparent_bg, 0, sizeof(Background));
|
init_background(&transparent_bg);
|
||||||
g_array_append_val(backgrounds, transparent_bg);
|
g_array_append_val(backgrounds, transparent_bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,6 +146,8 @@ void cleanup_panel()
|
|||||||
backgrounds = NULL;
|
backgrounds = NULL;
|
||||||
pango_font_description_free(panel_config.g_task.font_desc);
|
pango_font_description_free(panel_config.g_task.font_desc);
|
||||||
panel_config.g_task.font_desc = NULL;
|
panel_config.g_task.font_desc = NULL;
|
||||||
|
pango_font_description_free(panel_config.taskbarname_font_desc);
|
||||||
|
panel_config.taskbarname_font_desc = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void init_panel()
|
void init_panel()
|
||||||
@@ -215,14 +223,17 @@ void init_panel()
|
|||||||
p->main_win = XCreateWindow(server.dsp, server.root_win, p->posx, p->posy, p->area.width, p->area.height, 0, server.depth, InputOutput, server.visual, mask, &att);
|
p->main_win = XCreateWindow(server.dsp, server.root_win, p->posx, p->posy, p->area.width, p->area.height, 0, server.depth, InputOutput, server.visual, mask, &att);
|
||||||
|
|
||||||
long event_mask = ExposureMask|ButtonPressMask|ButtonReleaseMask|ButtonMotionMask;
|
long event_mask = ExposureMask|ButtonPressMask|ButtonReleaseMask|ButtonMotionMask;
|
||||||
if (p->g_task.tooltip_enabled || p->clock.area._get_tooltip_text || (launcher_enabled && launcher_tooltip_enabled))
|
if (p->mouse_effects ||
|
||||||
|
p->g_task.tooltip_enabled ||
|
||||||
|
p->clock.area._get_tooltip_text ||
|
||||||
|
(launcher_enabled && launcher_tooltip_enabled))
|
||||||
event_mask |= PointerMotionMask|LeaveWindowMask;
|
event_mask |= PointerMotionMask|LeaveWindowMask;
|
||||||
if (panel_autohide)
|
if (panel_autohide)
|
||||||
event_mask |= LeaveWindowMask|EnterWindowMask;
|
event_mask |= LeaveWindowMask|EnterWindowMask;
|
||||||
XChangeWindowAttributes(server.dsp, p->main_win, CWEventMask, &(XSetWindowAttributes){.event_mask=event_mask});
|
XChangeWindowAttributes(server.dsp, p->main_win, CWEventMask, &(XSetWindowAttributes){.event_mask=event_mask});
|
||||||
|
|
||||||
if (!server.gc) {
|
if (!server.gc) {
|
||||||
XGCValues gcv;
|
XGCValues gcv;
|
||||||
server.gc = XCreateGC(server.dsp, p->main_win, 0, &gcv);
|
server.gc = XCreateGC(server.dsp, p->main_win, 0, &gcv);
|
||||||
}
|
}
|
||||||
//printf("panel %d : %d, %d, %d, %d\n", i, p->posx, p->posy, p->area.width, p->area.height);
|
//printf("panel %d : %d, %d, %d, %d\n", i, p->posx, p->posy, p->area.width, p->area.height);
|
||||||
@@ -356,16 +367,16 @@ int resize_panel(void *obj)
|
|||||||
|
|
||||||
Taskbar *taskbar = &panel->taskbar[i];
|
Taskbar *taskbar = &panel->taskbar[i];
|
||||||
GList *l;
|
GList *l;
|
||||||
for (l = taskbar->area.list; l; l = l->next) {
|
for (l = taskbar->area.children; l; l = l->next) {
|
||||||
Area *child = l->data;
|
Area *child = l->data;
|
||||||
if (!child->on_screen)
|
if (!child->on_screen)
|
||||||
continue;
|
continue;
|
||||||
total_items++;
|
total_items++;
|
||||||
}
|
}
|
||||||
if (taskbarname_enabled) {
|
if (taskbarname_enabled) {
|
||||||
if (taskbar->area.list) {
|
if (taskbar->area.children) {
|
||||||
total_items--;
|
total_items--;
|
||||||
Area *name = taskbar->area.list->data;
|
Area *name = taskbar->area.children->data;
|
||||||
if (panel_horizontal) {
|
if (panel_horizontal) {
|
||||||
total_name_size += name->width;
|
total_name_size += name->width;
|
||||||
} else {
|
} else {
|
||||||
@@ -390,7 +401,7 @@ int resize_panel(void *obj)
|
|||||||
|
|
||||||
int requested_size = (2 * taskbar->area.bg->border.width) + (2 * taskbar->area.paddingxlr);
|
int requested_size = (2 * taskbar->area.bg->border.width) + (2 * taskbar->area.paddingxlr);
|
||||||
int items = 0;
|
int items = 0;
|
||||||
GList *l = taskbar->area.list;
|
GList *l = taskbar->area.children;
|
||||||
if (taskbarname_enabled)
|
if (taskbarname_enabled)
|
||||||
l = l->next;
|
l = l->next;
|
||||||
for (; l; l = l->next) {
|
for (; l; l = l->next) {
|
||||||
@@ -439,7 +450,7 @@ void update_strut(Panel* p)
|
|||||||
int d3;
|
int d3;
|
||||||
XGetGeometry(server.dsp, server.root_win, &d2, &d3, &d3, &screen_width, &screen_height, &d1, &d1);
|
XGetGeometry(server.dsp, server.root_win, &d2, &d3, &d3, &screen_width, &screen_height, &d1, &d1);
|
||||||
Monitor monitor = server.monitor[p->monitor];
|
Monitor monitor = server.monitor[p->monitor];
|
||||||
long struts [12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
long struts [12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||||
if (panel_horizontal) {
|
if (panel_horizontal) {
|
||||||
int height = p->area.height + p->marginy;
|
int height = p->area.height + p->marginy;
|
||||||
if (panel_strut_policy == STRUT_MINIMUM || (panel_strut_policy == STRUT_FOLLOW_SIZE && p->is_hidden))
|
if (panel_strut_policy == STRUT_MINIMUM || (panel_strut_policy == STRUT_FOLLOW_SIZE && p->is_hidden))
|
||||||
@@ -484,32 +495,32 @@ void set_panel_items_order(Panel *p)
|
|||||||
{
|
{
|
||||||
int k, j;
|
int k, j;
|
||||||
|
|
||||||
if (p->area.list) {
|
if (p->area.children) {
|
||||||
g_list_free(p->area.list);
|
g_list_free(p->area.children);
|
||||||
p->area.list = 0;
|
p->area.children = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (k=0 ; k < strlen(panel_items_order) ; k++) {
|
for (k=0 ; k < strlen(panel_items_order) ; k++) {
|
||||||
if (panel_items_order[k] == 'L') {
|
if (panel_items_order[k] == 'L') {
|
||||||
p->area.list = g_list_append(p->area.list, &p->launcher);
|
p->area.children = g_list_append(p->area.children, &p->launcher);
|
||||||
p->launcher.area.resize = 1;
|
p->launcher.area.resize = 1;
|
||||||
}
|
}
|
||||||
if (panel_items_order[k] == 'T') {
|
if (panel_items_order[k] == 'T') {
|
||||||
for (j=0 ; j < p->nb_desktop ; j++)
|
for (j=0 ; j < p->nb_desktop ; j++)
|
||||||
p->area.list = g_list_append(p->area.list, &p->taskbar[j]);
|
p->area.children = g_list_append(p->area.children, &p->taskbar[j]);
|
||||||
}
|
}
|
||||||
#ifdef ENABLE_BATTERY
|
#ifdef ENABLE_BATTERY
|
||||||
if (panel_items_order[k] == 'B')
|
if (panel_items_order[k] == 'B')
|
||||||
p->area.list = g_list_append(p->area.list, &p->battery);
|
p->area.children = g_list_append(p->area.children, &p->battery);
|
||||||
#endif
|
#endif
|
||||||
int i = p - panel1;
|
int i = p - panel1;
|
||||||
if (panel_items_order[k] == 'S' && systray_on_monitor(i, nb_panel)) {
|
if (panel_items_order[k] == 'S' && systray_on_monitor(i, nb_panel)) {
|
||||||
p->area.list = g_list_append(p->area.list, &systray);
|
p->area.children = g_list_append(p->area.children, &systray);
|
||||||
}
|
}
|
||||||
if (panel_items_order[k] == 'C')
|
if (panel_items_order[k] == 'C')
|
||||||
p->area.list = g_list_append(p->area.list, &p->clock);
|
p->area.children = g_list_append(p->area.children, &p->clock);
|
||||||
if (panel_items_order[k] == 'F')
|
if (panel_items_order[k] == 'F')
|
||||||
p->area.list = g_list_append(p->area.list, &p->freespace);
|
p->area.children = g_list_append(p->area.children, &p->freespace);
|
||||||
}
|
}
|
||||||
init_rendering(&p->area, 0);
|
init_rendering(&p->area, 0);
|
||||||
}
|
}
|
||||||
@@ -608,7 +619,7 @@ void set_panel_background(Panel *p)
|
|||||||
get_root_pixmap();
|
get_root_pixmap();
|
||||||
// copy background (server.root_pmap) in panel.area.pix
|
// copy background (server.root_pmap) in panel.area.pix
|
||||||
Window dummy;
|
Window dummy;
|
||||||
int x, y;
|
int x, y;
|
||||||
XTranslateCoordinates(server.dsp, p->main_win, server.root_win, 0, 0, &x, &y, &dummy);
|
XTranslateCoordinates(server.dsp, p->main_win, server.root_win, 0, 0, &x, &y, &dummy);
|
||||||
if (panel_autohide && p->is_hidden) {
|
if (panel_autohide && p->is_hidden) {
|
||||||
x -= xoff;
|
x -= xoff;
|
||||||
@@ -636,7 +647,7 @@ void set_panel_background(Panel *p)
|
|||||||
// redraw panel's object
|
// redraw panel's object
|
||||||
GList *l0;
|
GList *l0;
|
||||||
Area *a;
|
Area *a;
|
||||||
for (l0 = p->area.list; l0 ; l0 = l0->next) {
|
for (l0 = p->area.children; l0 ; l0 = l0->next) {
|
||||||
a = l0->data;
|
a = l0->data;
|
||||||
set_redraw(a);
|
set_redraw(a);
|
||||||
}
|
}
|
||||||
@@ -654,7 +665,7 @@ void set_panel_background(Panel *p)
|
|||||||
}
|
}
|
||||||
tskbar->area.pix = 0;
|
tskbar->area.pix = 0;
|
||||||
tskbar->bar_name.area.pix = 0;
|
tskbar->bar_name.area.pix = 0;
|
||||||
l0 = tskbar->area.list;
|
l0 = tskbar->area.children;
|
||||||
if (taskbarname_enabled) l0 = l0->next;
|
if (taskbarname_enabled) l0 = l0->next;
|
||||||
for (; l0 ; l0 = l0->next) {
|
for (; l0 ; l0 = l0->next) {
|
||||||
set_task_redraw((Task *)l0->data);
|
set_task_redraw((Task *)l0->data);
|
||||||
@@ -706,7 +717,7 @@ Task *click_task (Panel *panel, int x, int y)
|
|||||||
if ( (tskbar = click_taskbar(panel, x, y)) ) {
|
if ( (tskbar = click_taskbar(panel, x, y)) ) {
|
||||||
if (panel_horizontal) {
|
if (panel_horizontal) {
|
||||||
Task *tsk;
|
Task *tsk;
|
||||||
l0 = tskbar->area.list;
|
l0 = tskbar->area.children;
|
||||||
if (taskbarname_enabled) l0 = l0->next;
|
if (taskbarname_enabled) l0 = l0->next;
|
||||||
for (; l0 ; l0 = l0->next) {
|
for (; l0 ; l0 = l0->next) {
|
||||||
tsk = l0->data;
|
tsk = l0->data;
|
||||||
@@ -717,7 +728,7 @@ Task *click_task (Panel *panel, int x, int y)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Task *tsk;
|
Task *tsk;
|
||||||
l0 = tskbar->area.list;
|
l0 = tskbar->area.children;
|
||||||
if (taskbarname_enabled) l0 = l0->next;
|
if (taskbarname_enabled) l0 = l0->next;
|
||||||
for (; l0 ; l0 = l0->next) {
|
for (; l0 ; l0 = l0->next) {
|
||||||
tsk = l0->data;
|
tsk = l0->data;
|
||||||
@@ -818,9 +829,9 @@ Area* click_area(Panel *panel, int x, int y)
|
|||||||
Area* new_result = result;
|
Area* new_result = result;
|
||||||
do {
|
do {
|
||||||
result = new_result;
|
result = new_result;
|
||||||
GList* it = result->list;
|
GList* it = result->children;
|
||||||
while (it) {
|
while (it) {
|
||||||
Area* a = it->data;
|
Area* a = (Area*)it->data;
|
||||||
if (a->on_screen && x >= a->posx && x <= (a->posx + a->width)
|
if (a->on_screen && x >= a->posx && x <= (a->posx + a->width)
|
||||||
&& y >= a->posy && y <= (a->posy + a->height)) {
|
&& y >= a->posy && y <= (a->posy + a->height)) {
|
||||||
new_result = a;
|
new_result = a;
|
||||||
|
|||||||
@@ -91,6 +91,14 @@ typedef struct {
|
|||||||
// location of the panel (monitor number)
|
// location of the panel (monitor number)
|
||||||
int monitor;
|
int monitor;
|
||||||
int font_shadow;
|
int font_shadow;
|
||||||
|
int mouse_effects;
|
||||||
|
// Mouse effects for icons
|
||||||
|
int mouse_over_alpha;
|
||||||
|
int mouse_over_saturation;
|
||||||
|
int mouse_over_brightness;
|
||||||
|
int mouse_pressed_alpha;
|
||||||
|
int mouse_pressed_saturation;
|
||||||
|
int mouse_pressed_brightness;
|
||||||
|
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
// task and taskbar parameter per panel
|
// task and taskbar parameter per panel
|
||||||
@@ -104,6 +112,7 @@ typedef struct {
|
|||||||
// while panel->area.list is used to loop over all panel's objects
|
// while panel->area.list is used to loop over all panel's objects
|
||||||
Taskbar *taskbar;
|
Taskbar *taskbar;
|
||||||
int nb_desktop;
|
int nb_desktop;
|
||||||
|
PangoFontDescription *taskbarname_font_desc;
|
||||||
|
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
// clock
|
// clock
|
||||||
|
|||||||
@@ -38,10 +38,10 @@
|
|||||||
timeout* urgent_timeout;
|
timeout* urgent_timeout;
|
||||||
GSList* urgent_list;
|
GSList* urgent_list;
|
||||||
|
|
||||||
const char* task_get_tooltip(void* obj)
|
char* task_get_tooltip(void* obj)
|
||||||
{
|
{
|
||||||
Task* t = obj;
|
Task* t = obj;
|
||||||
return t->title;
|
return strdup(t->title);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -61,6 +61,9 @@ Task *add_task (Window win)
|
|||||||
else monitor = 0;
|
else monitor = 0;
|
||||||
|
|
||||||
Task new_tsk;
|
Task new_tsk;
|
||||||
|
memset(&new_tsk, 0, sizeof(new_tsk));
|
||||||
|
new_tsk.area.mouse_over_effect = 1;
|
||||||
|
new_tsk.area.mouse_press_effect = 1;
|
||||||
new_tsk.win = win;
|
new_tsk.win = win;
|
||||||
new_tsk.desktop = window_get_desktop (win);
|
new_tsk.desktop = window_get_desktop (win);
|
||||||
new_tsk.area.panel = &panel1[monitor];
|
new_tsk.area.panel = &panel1[monitor];
|
||||||
@@ -91,6 +94,8 @@ Task *add_task (Window win)
|
|||||||
new_tsk2 = calloc(1, sizeof(Task));
|
new_tsk2 = calloc(1, sizeof(Task));
|
||||||
memcpy(&new_tsk2->area, &panel1[monitor].g_task.area, sizeof(Area));
|
memcpy(&new_tsk2->area, &panel1[monitor].g_task.area, sizeof(Area));
|
||||||
new_tsk2->area.parent = tskbar;
|
new_tsk2->area.parent = tskbar;
|
||||||
|
new_tsk2->area.mouse_over_effect = 1;
|
||||||
|
new_tsk2->area.mouse_press_effect = 1;
|
||||||
new_tsk2->win = new_tsk.win;
|
new_tsk2->win = new_tsk.win;
|
||||||
new_tsk2->desktop = new_tsk.desktop;
|
new_tsk2->desktop = new_tsk.desktop;
|
||||||
new_tsk2->win_x = new_tsk.win_x;
|
new_tsk2->win_x = new_tsk.win_x;
|
||||||
@@ -107,11 +112,13 @@ Task *add_task (Window win)
|
|||||||
new_tsk2->area._get_tooltip_text = task_get_tooltip;
|
new_tsk2->area._get_tooltip_text = task_get_tooltip;
|
||||||
for (k=0; k<TASK_STATE_COUNT; ++k) {
|
for (k=0; k<TASK_STATE_COUNT; ++k) {
|
||||||
new_tsk2->icon[k] = new_tsk.icon[k];
|
new_tsk2->icon[k] = new_tsk.icon[k];
|
||||||
|
new_tsk2->icon_hover[k] = new_tsk.icon_hover[k];
|
||||||
|
new_tsk2->icon_press[k] = new_tsk.icon_press[k];
|
||||||
new_tsk2->state_pix[k] = 0;
|
new_tsk2->state_pix[k] = 0;
|
||||||
}
|
}
|
||||||
new_tsk2->icon_width = new_tsk.icon_width;
|
new_tsk2->icon_width = new_tsk.icon_width;
|
||||||
new_tsk2->icon_height = new_tsk.icon_height;
|
new_tsk2->icon_height = new_tsk.icon_height;
|
||||||
tskbar->area.list = g_list_append(tskbar->area.list, new_tsk2);
|
tskbar->area.children = g_list_append(tskbar->area.children, new_tsk2);
|
||||||
tskbar->area.resize = 1;
|
tskbar->area.resize = 1;
|
||||||
g_ptr_array_add(task_group, new_tsk2);
|
g_ptr_array_add(task_group, new_tsk2);
|
||||||
//printf("add_task panel %d, desktop %d, task %s\n", i, j, new_tsk2->title);
|
//printf("add_task panel %d, desktop %d, task %s\n", i, j, new_tsk2->title);
|
||||||
@@ -158,22 +165,29 @@ void remove_task (Task *tsk)
|
|||||||
imlib_context_set_image(tsk->icon[k]);
|
imlib_context_set_image(tsk->icon[k]);
|
||||||
imlib_free_image();
|
imlib_free_image();
|
||||||
tsk->icon[k] = 0;
|
tsk->icon[k] = 0;
|
||||||
if (tsk->state_pix[k]) XFreePixmap(server.dsp, tsk->state_pix[k]);
|
|
||||||
}
|
}
|
||||||
|
if (tsk->icon_hover[k]) {
|
||||||
|
imlib_context_set_image(tsk->icon_hover[k]);
|
||||||
|
imlib_free_image();
|
||||||
|
tsk->icon_hover[k] = 0;
|
||||||
|
}
|
||||||
|
if (tsk->icon_press[k]) {
|
||||||
|
imlib_context_set_image(tsk->icon_press[k]);
|
||||||
|
imlib_free_image();
|
||||||
|
tsk->icon_press[k] = 0;
|
||||||
|
}
|
||||||
|
if (tsk->state_pix[k]) XFreePixmap(server.dsp, tsk->state_pix[k]);
|
||||||
}
|
}
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
Task *tsk2;
|
Task *tsk2;
|
||||||
Taskbar *tskbar;
|
|
||||||
GPtrArray* task_group = g_hash_table_lookup(win_to_task_table, &win);
|
GPtrArray* task_group = g_hash_table_lookup(win_to_task_table, &win);
|
||||||
for (i=0; i<task_group->len; ++i) {
|
for (i=0; i<task_group->len; ++i) {
|
||||||
tsk2 = g_ptr_array_index(task_group, i);
|
tsk2 = g_ptr_array_index(task_group, i);
|
||||||
tskbar = tsk2->area.parent;
|
|
||||||
tskbar->area.list = g_list_remove(tskbar->area.list, tsk2);
|
|
||||||
tskbar->area.resize = 1;
|
|
||||||
if (tsk2 == task_active) task_active = 0;
|
if (tsk2 == task_active) task_active = 0;
|
||||||
if (tsk2 == task_drag) task_drag = 0;
|
if (tsk2 == task_drag) task_drag = 0;
|
||||||
if (g_slist_find(urgent_list, tsk2)) del_urgent(tsk2);
|
if (g_slist_find(urgent_list, tsk2)) del_urgent(tsk2);
|
||||||
|
remove_area(tsk2);
|
||||||
free(tsk2);
|
free(tsk2);
|
||||||
}
|
}
|
||||||
g_hash_table_remove(win_to_task_table, &win);
|
g_hash_table_remove(win_to_task_table, &win);
|
||||||
@@ -258,7 +272,7 @@ void get_icon (Task *tsk)
|
|||||||
DATA32 icon_data[w * h];
|
DATA32 icon_data[w * h];
|
||||||
int length = w * h;
|
int length = w * h;
|
||||||
for (i = 0; i < length; ++i)
|
for (i = 0; i < length; ++i)
|
||||||
icon_data[i] = tmp_data[i];
|
icon_data[i] = tmp_data[i];
|
||||||
img = imlib_create_image_using_copied_data (w, h, icon_data);
|
img = imlib_create_image_using_copied_data (w, h, icon_data);
|
||||||
#else
|
#else
|
||||||
img = imlib_create_image_using_data (w, h, (DATA32*)tmp_data);
|
img = imlib_create_image_using_data (w, h, (DATA32*)tmp_data);
|
||||||
@@ -271,7 +285,7 @@ void get_icon (Task *tsk)
|
|||||||
if (hints->flags & IconPixmapHint && hints->icon_pixmap != 0) {
|
if (hints->flags & IconPixmapHint && hints->icon_pixmap != 0) {
|
||||||
// get width, height and depth for the pixmap
|
// get width, height and depth for the pixmap
|
||||||
Window root;
|
Window root;
|
||||||
int icon_x, icon_y;
|
int icon_x, icon_y;
|
||||||
uint border_width, bpp;
|
uint border_width, bpp;
|
||||||
uint w, h;
|
uint w, h;
|
||||||
|
|
||||||
@@ -309,6 +323,10 @@ void get_icon (Task *tsk)
|
|||||||
adjust_asb(data32, tsk->icon_width, tsk->icon_height, panel->g_task.alpha[k], (float)panel->g_task.saturation[k]/100, (float)panel->g_task.brightness[k]/100);
|
adjust_asb(data32, tsk->icon_width, tsk->icon_height, panel->g_task.alpha[k], (float)panel->g_task.saturation[k]/100, (float)panel->g_task.brightness[k]/100);
|
||||||
imlib_image_put_back_data(data32);
|
imlib_image_put_back_data(data32);
|
||||||
}
|
}
|
||||||
|
if (panel_config.mouse_effects) {
|
||||||
|
tsk->icon_hover[k] = adjust_icon(tsk->icon[k], panel_config.mouse_over_alpha, panel_config.mouse_over_saturation, panel_config.mouse_over_brightness);
|
||||||
|
tsk->icon_press[k] = adjust_icon(tsk->icon[k], panel_config.mouse_pressed_alpha, panel_config.mouse_pressed_saturation, panel_config.mouse_pressed_brightness);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
imlib_context_set_image(orig_image);
|
imlib_context_set_image(orig_image);
|
||||||
imlib_free_image();
|
imlib_free_image();
|
||||||
@@ -325,8 +343,11 @@ void get_icon (Task *tsk)
|
|||||||
tsk2->icon_width = tsk->icon_width;
|
tsk2->icon_width = tsk->icon_width;
|
||||||
tsk2->icon_height = tsk->icon_height;
|
tsk2->icon_height = tsk->icon_height;
|
||||||
int k;
|
int k;
|
||||||
for (k=0; k<TASK_STATE_COUNT; ++k)
|
for (k=0; k<TASK_STATE_COUNT; ++k) {
|
||||||
tsk2->icon[k] = tsk->icon[k];
|
tsk2->icon[k] = tsk->icon[k];
|
||||||
|
tsk2->icon_hover[k] = tsk->icon_hover[k];
|
||||||
|
tsk2->icon_press[k] = tsk->icon_press[k];
|
||||||
|
}
|
||||||
set_task_redraw(tsk2);
|
set_task_redraw(tsk2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -349,7 +370,21 @@ void draw_task_icon (Task *tsk, int text_width)
|
|||||||
else pos_x = panel->g_task.area.paddingxlr + tsk->area.bg->border.width;
|
else pos_x = panel->g_task.area.paddingxlr + tsk->area.bg->border.width;
|
||||||
|
|
||||||
// Render
|
// Render
|
||||||
imlib_context_set_image (tsk->icon[tsk->current_state]);
|
|
||||||
|
Imlib_Image image;
|
||||||
|
// Render
|
||||||
|
if (panel_config.mouse_effects) {
|
||||||
|
if (tsk->area.mouse_state == MOUSE_OVER)
|
||||||
|
image = tsk->icon_hover[tsk->current_state];
|
||||||
|
else if (tsk->area.mouse_state == MOUSE_DOWN)
|
||||||
|
image = tsk->icon_press[tsk->current_state];
|
||||||
|
else
|
||||||
|
image = tsk->icon[tsk->current_state];
|
||||||
|
} else {
|
||||||
|
image = tsk->icon[tsk->current_state];
|
||||||
|
}
|
||||||
|
|
||||||
|
imlib_context_set_image(image);
|
||||||
render_image(tsk->area.pix, pos_x, panel->g_task.icon_posy);
|
render_image(tsk->area.pix, pos_x, panel->g_task.icon_posy);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -357,7 +392,8 @@ void draw_task_icon (Task *tsk, int text_width)
|
|||||||
void draw_task (void *obj, cairo_t *c)
|
void draw_task (void *obj, cairo_t *c)
|
||||||
{
|
{
|
||||||
Task *tsk = obj;
|
Task *tsk = obj;
|
||||||
tsk->state_pix[tsk->current_state] = tsk->area.pix;
|
if (!panel_config.mouse_effects)
|
||||||
|
tsk->state_pix[tsk->current_state] = tsk->area.pix;
|
||||||
PangoLayout *layout;
|
PangoLayout *layout;
|
||||||
Color *config_text;
|
Color *config_text;
|
||||||
int width=0, height;
|
int width=0, height;
|
||||||
@@ -420,7 +456,7 @@ Task *find_active_task(Task *current_task, Task *active_task)
|
|||||||
|
|
||||||
Taskbar* tskbar = current_task->area.parent;
|
Taskbar* tskbar = current_task->area.parent;
|
||||||
|
|
||||||
GList *l0 = tskbar->area.list;
|
GList *l0 = tskbar->area.children;
|
||||||
if (taskbarname_enabled)
|
if (taskbarname_enabled)
|
||||||
l0 = l0->next;
|
l0 = l0->next;
|
||||||
for (; l0 ; l0 = l0->next) {
|
for (; l0 ; l0 = l0->next) {
|
||||||
@@ -439,7 +475,7 @@ Task *next_task(Task *tsk)
|
|||||||
|
|
||||||
Taskbar* tskbar = tsk->area.parent;
|
Taskbar* tskbar = tsk->area.parent;
|
||||||
|
|
||||||
GList *l0 = tskbar->area.list;
|
GList *l0 = tskbar->area.children;
|
||||||
if (taskbarname_enabled) l0 = l0->next;
|
if (taskbarname_enabled) l0 = l0->next;
|
||||||
GList *lfirst_tsk = l0;
|
GList *lfirst_tsk = l0;
|
||||||
for (; l0 ; l0 = l0->next) {
|
for (; l0 ; l0 = l0->next) {
|
||||||
@@ -463,7 +499,7 @@ Task *prev_task(Task *tsk)
|
|||||||
Taskbar* tskbar = tsk->area.parent;
|
Taskbar* tskbar = tsk->area.parent;
|
||||||
|
|
||||||
tsk2 = 0;
|
tsk2 = 0;
|
||||||
GList *l0 = tskbar->area.list;
|
GList *l0 = tskbar->area.children;
|
||||||
if (taskbarname_enabled) l0 = l0->next;
|
if (taskbarname_enabled) l0 = l0->next;
|
||||||
GList *lfirst_tsk = l0;
|
GList *lfirst_tsk = l0;
|
||||||
for (; l0 ; l0 = l0->next) {
|
for (; l0 ; l0 = l0->next) {
|
||||||
@@ -516,9 +552,13 @@ void set_task_state(Task *tsk, int state)
|
|||||||
Task* tsk1 = g_ptr_array_index(task_group, i);
|
Task* tsk1 = g_ptr_array_index(task_group, i);
|
||||||
tsk1->current_state = state;
|
tsk1->current_state = state;
|
||||||
tsk1->area.bg = panel1[0].g_task.background[state];
|
tsk1->area.bg = panel1[0].g_task.background[state];
|
||||||
tsk1->area.pix = tsk1->state_pix[state];
|
if (!panel_config.mouse_effects) {
|
||||||
if (tsk1->state_pix[state] == 0)
|
tsk1->area.pix = tsk1->state_pix[state];
|
||||||
|
if (!tsk1->area.pix)
|
||||||
|
tsk1->area.redraw = 1;
|
||||||
|
} else {
|
||||||
tsk1->area.redraw = 1;
|
tsk1->area.redraw = 1;
|
||||||
|
}
|
||||||
if (state == TASK_ACTIVE && g_slist_find(urgent_list, tsk1))
|
if (state == TASK_ACTIVE && g_slist_find(urgent_list, tsk1))
|
||||||
del_urgent(tsk1);
|
del_urgent(tsk1);
|
||||||
int hide = 0;
|
int hide = 0;
|
||||||
|
|||||||
@@ -57,6 +57,8 @@ typedef struct {
|
|||||||
int desktop;
|
int desktop;
|
||||||
int current_state;
|
int current_state;
|
||||||
Imlib_Image icon[TASK_STATE_COUNT];
|
Imlib_Image icon[TASK_STATE_COUNT];
|
||||||
|
Imlib_Image icon_hover[TASK_STATE_COUNT];
|
||||||
|
Imlib_Image icon_press[TASK_STATE_COUNT];
|
||||||
Pixmap state_pix[TASK_STATE_COUNT];
|
Pixmap state_pix[TASK_STATE_COUNT];
|
||||||
unsigned int icon_width;
|
unsigned int icon_width;
|
||||||
unsigned int icon_height;
|
unsigned int icon_height;
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ void cleanup_taskbar()
|
|||||||
}
|
}
|
||||||
free_area(&tskbar->area);
|
free_area(&tskbar->area);
|
||||||
// remove taskbar from the panel
|
// remove taskbar from the panel
|
||||||
panel->area.list = g_list_remove(panel->area.list, tskbar);
|
remove_area(tskbar);
|
||||||
}
|
}
|
||||||
if (panel->taskbar) {
|
if (panel->taskbar) {
|
||||||
free(panel->taskbar);
|
free(panel->taskbar);
|
||||||
@@ -232,8 +232,8 @@ void init_taskbar_panel(void *p)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// compute vertical position : text and icon
|
// compute vertical position : text and icon
|
||||||
int height_ink, height;
|
int height_ink, height, width;
|
||||||
get_text_size(panel->g_task.font_desc, &height_ink, &height, panel->area.height, "TAjpg", 5);
|
get_text_size2(panel->g_task.font_desc, &height_ink, &height, &width, panel->area.height, panel->area.width, "TAjpg", 5, PANGO_WRAP_WORD_CHAR, PANGO_ELLIPSIZE_END);
|
||||||
|
|
||||||
if (!panel->g_task.maximum_width && panel_horizontal)
|
if (!panel->g_task.maximum_width && panel_horizontal)
|
||||||
panel->g_task.maximum_width = server.monitor[panel->monitor].width;
|
panel->g_task.maximum_width = server.monitor[panel->monitor].width;
|
||||||
@@ -337,7 +337,7 @@ int resize_taskbar(void *obj)
|
|||||||
resize_by_layout(obj, panel->g_task.maximum_width);
|
resize_by_layout(obj, panel->g_task.maximum_width);
|
||||||
|
|
||||||
text_width = panel->g_task.maximum_width;
|
text_width = panel->g_task.maximum_width;
|
||||||
GList *l = taskbar->area.list;
|
GList *l = taskbar->area.children;
|
||||||
if (taskbarname_enabled) l = l->next;
|
if (taskbarname_enabled) l = l->next;
|
||||||
for (; l != NULL; l = l->next) {
|
for (; l != NULL; l = l->next) {
|
||||||
if (((Task *)l->data)->area.on_screen) {
|
if (((Task *)l->data)->area.on_screen) {
|
||||||
@@ -377,7 +377,9 @@ void set_taskbar_state(Taskbar *tskbar, int state)
|
|||||||
tskbar->area.pix = tskbar->state_pix[state];
|
tskbar->area.pix = tskbar->state_pix[state];
|
||||||
if (taskbarname_enabled) {
|
if (taskbarname_enabled) {
|
||||||
tskbar->bar_name.area.bg = panel1[0].g_taskbar.background_name[state];
|
tskbar->bar_name.area.bg = panel1[0].g_taskbar.background_name[state];
|
||||||
tskbar->bar_name.area.pix = tskbar->bar_name.state_pix[state];
|
if (!panel_config.mouse_effects) {
|
||||||
|
tskbar->bar_name.area.pix = tskbar->bar_name.state_pix[state];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (panel_mode != MULTI_DESKTOP) {
|
if (panel_mode != MULTI_DESKTOP) {
|
||||||
if (state == TASKBAR_NORMAL)
|
if (state == TASKBAR_NORMAL)
|
||||||
@@ -388,10 +390,16 @@ void set_taskbar_state(Taskbar *tskbar, int state)
|
|||||||
if (tskbar->area.on_screen == 1) {
|
if (tskbar->area.on_screen == 1) {
|
||||||
if (tskbar->state_pix[state] == 0)
|
if (tskbar->state_pix[state] == 0)
|
||||||
tskbar->area.redraw = 1;
|
tskbar->area.redraw = 1;
|
||||||
if (taskbarname_enabled && tskbar->bar_name.state_pix[state] == 0)
|
if (taskbarname_enabled) {
|
||||||
tskbar->bar_name.area.redraw = 1;
|
if (!panel_config.mouse_effects) {
|
||||||
|
if (tskbar->bar_name.state_pix[state] == 0)
|
||||||
|
tskbar->bar_name.area.redraw = 1;
|
||||||
|
} else {
|
||||||
|
tskbar->bar_name.area.redraw = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (panel_mode == MULTI_DESKTOP && panel1[0].g_taskbar.background[TASKBAR_NORMAL] != panel1[0].g_taskbar.background[TASKBAR_ACTIVE]) {
|
if (panel_mode == MULTI_DESKTOP && panel1[0].g_taskbar.background[TASKBAR_NORMAL] != panel1[0].g_taskbar.background[TASKBAR_ACTIVE]) {
|
||||||
GList *l = tskbar->area.list;
|
GList *l = tskbar->area.children;
|
||||||
if (taskbarname_enabled) l = l->next;
|
if (taskbarname_enabled) l = l->next;
|
||||||
for ( ; l ; l = l->next)
|
for ( ; l ; l = l->next)
|
||||||
set_task_redraw(l->data);
|
set_task_redraw(l->data);
|
||||||
@@ -426,9 +434,9 @@ gint compare_tasks_trivial(Task *a, Task *b, Taskbar *taskbar)
|
|||||||
if (a == b)
|
if (a == b)
|
||||||
return 0;
|
return 0;
|
||||||
if (taskbarname_enabled) {
|
if (taskbarname_enabled) {
|
||||||
if (a == taskbar->area.list->data)
|
if (a == taskbar->area.children->data)
|
||||||
return -1;
|
return -1;
|
||||||
if (b == taskbar->area.list->data)
|
if (b == taskbar->area.children->data)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return NONTRIVIAL;
|
return NONTRIVIAL;
|
||||||
@@ -515,7 +523,7 @@ int taskbar_needs_sort(Taskbar *taskbar)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
GList *i, *j;
|
GList *i, *j;
|
||||||
for (i = taskbar->area.list, j = i ? i->next : NULL; i && j; i = i->next, j = j->next) {
|
for (i = taskbar->area.children, j = i ? i->next : NULL; i && j; i = i->next, j = j->next) {
|
||||||
if (compare_tasks(i->data, j->data, taskbar) > 0) {
|
if (compare_tasks(i->data, j->data, taskbar) > 0) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -531,7 +539,7 @@ void sort_tasks(Taskbar *taskbar)
|
|||||||
if (!taskbar_needs_sort(taskbar)) {
|
if (!taskbar_needs_sort(taskbar)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
taskbar->area.list = g_list_sort_with_data(taskbar->area.list, (GCompareDataFunc)compare_tasks, taskbar);
|
taskbar->area.children = g_list_sort_with_data(taskbar->area.children, (GCompareDataFunc)compare_tasks, taskbar);
|
||||||
taskbar->area.resize = 1;
|
taskbar->area.resize = 1;
|
||||||
panel_refresh = 1;
|
panel_refresh = 1;
|
||||||
((Panel*)taskbar->area.panel)->area.resize = 1;
|
((Panel*)taskbar->area.panel)->area.resize = 1;
|
||||||
|
|||||||
@@ -54,14 +54,16 @@ void init_taskbarname_panel(void *p)
|
|||||||
if (!taskbarname_enabled)
|
if (!taskbarname_enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!taskbarname_font_desc)
|
if (!panel_config.taskbarname_font_desc)
|
||||||
taskbarname_font_desc = pango_font_description_from_string(DEFAULT_FONT);
|
panel_config.taskbarname_font_desc = pango_font_description_from_string(DEFAULT_FONT);
|
||||||
|
|
||||||
GSList *l, *list = server_get_name_of_desktop();
|
GSList *l, *list = server_get_name_of_desktop();
|
||||||
for (j=0, l=list ; j < panel->nb_desktop ; j++) {
|
for (j=0, l=list ; j < panel->nb_desktop ; j++) {
|
||||||
tskbar = &panel->taskbar[j];
|
tskbar = &panel->taskbar[j];
|
||||||
memcpy(&tskbar->bar_name.area, &panel->g_taskbar.area_name, sizeof(Area));
|
memcpy(&tskbar->bar_name.area, &panel->g_taskbar.area_name, sizeof(Area));
|
||||||
tskbar->bar_name.area.parent = tskbar;
|
tskbar->bar_name.area.parent = tskbar;
|
||||||
|
tskbar->bar_name.area.mouse_over_effect = 1;
|
||||||
|
tskbar->bar_name.area.mouse_press_effect = 1;
|
||||||
if (j == server.desktop)
|
if (j == server.desktop)
|
||||||
tskbar->bar_name.area.bg = panel->g_taskbar.background_name[TASKBAR_ACTIVE];
|
tskbar->bar_name.area.bg = panel->g_taskbar.background_name[TASKBAR_ACTIVE];
|
||||||
else
|
else
|
||||||
@@ -76,7 +78,7 @@ void init_taskbarname_panel(void *p)
|
|||||||
tskbar->bar_name.name = g_strdup_printf("%d", j+1);
|
tskbar->bar_name.name = g_strdup_printf("%d", j+1);
|
||||||
|
|
||||||
// append the name at the beginning of taskbar
|
// append the name at the beginning of taskbar
|
||||||
tskbar->area.list = g_list_append(tskbar->area.list, &tskbar->bar_name);
|
tskbar->area.children = g_list_append(tskbar->area.children, &tskbar->bar_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (l=list ; l ; l = l->next)
|
for (l=list ; l ; l = l->next)
|
||||||
@@ -103,12 +105,9 @@ void cleanup_taskbarname()
|
|||||||
XFreePixmap(server.dsp, tskbar->bar_name.state_pix[k]);
|
XFreePixmap(server.dsp, tskbar->bar_name.state_pix[k]);
|
||||||
tskbar->bar_name.state_pix[k] = 0;
|
tskbar->bar_name.state_pix[k] = 0;
|
||||||
}
|
}
|
||||||
tskbar->area.list = g_list_remove(tskbar->area.list, &tskbar->bar_name);
|
remove_area(&tskbar->bar_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pango_font_description_free(taskbarname_font_desc);
|
|
||||||
taskbarname_font_desc = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -120,13 +119,16 @@ void draw_taskbarname (void *obj, cairo_t *c)
|
|||||||
Color *config_text = (taskbar->desktop == server.desktop) ? &taskbarname_active_font : &taskbarname_font;
|
Color *config_text = (taskbar->desktop == server.desktop) ? &taskbarname_active_font : &taskbarname_font;
|
||||||
|
|
||||||
int state = (taskbar->desktop == server.desktop) ? TASKBAR_ACTIVE : TASKBAR_NORMAL;
|
int state = (taskbar->desktop == server.desktop) ? TASKBAR_ACTIVE : TASKBAR_NORMAL;
|
||||||
taskbar_name->state_pix[state] = taskbar_name->area.pix;
|
if (!panel_config.mouse_effects)
|
||||||
|
taskbar_name->state_pix[state] = taskbar_name->area.pix;
|
||||||
|
|
||||||
// draw content
|
// draw content
|
||||||
layout = pango_cairo_create_layout (c);
|
layout = pango_cairo_create_layout (c);
|
||||||
pango_layout_set_font_description (layout, taskbarname_font_desc);
|
pango_layout_set_font_description (layout, panel_config.taskbarname_font_desc);
|
||||||
pango_layout_set_width (layout, taskbar_name->area.width * PANGO_SCALE);
|
pango_layout_set_width (layout, taskbar_name->area.width * PANGO_SCALE);
|
||||||
pango_layout_set_alignment (layout, PANGO_ALIGN_CENTER);
|
pango_layout_set_alignment (layout, PANGO_ALIGN_CENTER);
|
||||||
|
pango_layout_set_wrap(layout, PANGO_WRAP_WORD_CHAR);
|
||||||
|
pango_layout_set_ellipsize(layout, PANGO_ELLIPSIZE_NONE);
|
||||||
pango_layout_set_text (layout, taskbar_name->name, strlen(taskbar_name->name));
|
pango_layout_set_text (layout, taskbar_name->name, strlen(taskbar_name->name));
|
||||||
|
|
||||||
cairo_set_source_rgba (c, config_text->color[0], config_text->color[1], config_text->color[2], config_text->alpha);
|
cairo_set_source_rgba (c, config_text->color[0], config_text->color[1], config_text->color[2], config_text->alpha);
|
||||||
@@ -147,7 +149,9 @@ int resize_taskbarname(void *obj)
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
taskbar_name->area.redraw = 1;
|
taskbar_name->area.redraw = 1;
|
||||||
get_text_size2(taskbarname_font_desc, &name_height_ink, &name_height, &name_width, panel->area.height, panel->area.width, taskbar_name->name, strlen(taskbar_name->name));
|
get_text_size2(panel_config.taskbarname_font_desc, &name_height_ink, &name_height, &name_width, panel->area.height, panel->area.width, taskbar_name->name, strlen(taskbar_name->name),
|
||||||
|
PANGO_WRAP_WORD_CHAR,
|
||||||
|
PANGO_ELLIPSIZE_NONE);
|
||||||
|
|
||||||
if (panel_horizontal) {
|
if (panel_horizontal) {
|
||||||
int new_size = name_width + (2* (taskbar_name->area.paddingxlr + taskbar_name->area.bg->border.width));
|
int new_size = name_width + (2* (taskbar_name->area.paddingxlr + taskbar_name->area.bg->border.width));
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
#include "area.h"
|
#include "area.h"
|
||||||
|
|
||||||
extern int taskbarname_enabled;
|
extern int taskbarname_enabled;
|
||||||
extern PangoFontDescription *taskbarname_font_desc;
|
|
||||||
extern Color taskbarname_font;
|
extern Color taskbarname_font;
|
||||||
extern Color taskbarname_active_font;
|
extern Color taskbarname_active_font;
|
||||||
|
|
||||||
|
|||||||
57
src/tint.c
57
src/tint.c
@@ -49,6 +49,7 @@
|
|||||||
#include "tooltip.h"
|
#include "tooltip.h"
|
||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
#include "xsettings-client.h"
|
#include "xsettings-client.h"
|
||||||
|
#include "uevent.h"
|
||||||
|
|
||||||
// Drag and Drop state variables
|
// Drag and Drop state variables
|
||||||
Window dnd_source_window;
|
Window dnd_source_window;
|
||||||
@@ -340,6 +341,8 @@ void cleanup()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
uevent_cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -435,7 +438,7 @@ int tint2_handles_click(Panel* panel, XButtonEvent* e)
|
|||||||
{
|
{
|
||||||
Task* task = click_task(panel, e->x, e->y);
|
Task* task = click_task(panel, e->x, e->y);
|
||||||
if (task) {
|
if (task) {
|
||||||
if( (e->button == 1 && mouse_left != 0)
|
if ( (e->button == 1 && mouse_left != 0)
|
||||||
|| (e->button == 2 && mouse_middle != 0)
|
|| (e->button == 2 && mouse_middle != 0)
|
||||||
|| (e->button == 3 && mouse_right != 0)
|
|| (e->button == 3 && mouse_right != 0)
|
||||||
|| (e->button == 4 && mouse_scroll_up != 0)
|
|| (e->button == 4 && mouse_scroll_up != 0)
|
||||||
@@ -518,27 +521,27 @@ void event_button_press (XEvent *e)
|
|||||||
void event_button_motion_notify (XEvent *e)
|
void event_button_motion_notify (XEvent *e)
|
||||||
{
|
{
|
||||||
Panel * panel = get_panel(e->xany.window);
|
Panel * panel = get_panel(e->xany.window);
|
||||||
if(!panel || !task_drag)
|
if (!panel || !task_drag)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Find the taskbar on the event's location
|
// Find the taskbar on the event's location
|
||||||
Taskbar * event_taskbar = click_taskbar(panel, e->xbutton.x, e->xbutton.y);
|
Taskbar * event_taskbar = click_taskbar(panel, e->xbutton.x, e->xbutton.y);
|
||||||
if(event_taskbar == NULL)
|
if (event_taskbar == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Find the task on the event's location
|
// Find the task on the event's location
|
||||||
Task * event_task = click_task(panel, e->xbutton.x, e->xbutton.y);
|
Task * event_task = click_task(panel, e->xbutton.x, e->xbutton.y);
|
||||||
|
|
||||||
// If the event takes place on the same taskbar as the task being dragged
|
// If the event takes place on the same taskbar as the task being dragged
|
||||||
if(event_taskbar == task_drag->area.parent) {
|
if (event_taskbar == task_drag->area.parent) {
|
||||||
if (taskbar_sort_method != TASKBAR_NOSORT) {
|
if (taskbar_sort_method != TASKBAR_NOSORT) {
|
||||||
sort_tasks(event_taskbar);
|
sort_tasks(event_taskbar);
|
||||||
} else {
|
} else {
|
||||||
// Swap the task_drag with the task on the event's location (if they differ)
|
// Swap the task_drag with the task on the event's location (if they differ)
|
||||||
if(event_task && event_task != task_drag) {
|
if (event_task && event_task != task_drag) {
|
||||||
GList * drag_iter = g_list_find(event_taskbar->area.list, task_drag);
|
GList * drag_iter = g_list_find(event_taskbar->area.children, task_drag);
|
||||||
GList * task_iter = g_list_find(event_taskbar->area.list, event_task);
|
GList * task_iter = g_list_find(event_taskbar->area.children, event_task);
|
||||||
if(drag_iter && task_iter) {
|
if (drag_iter && task_iter) {
|
||||||
gpointer temp = task_iter->data;
|
gpointer temp = task_iter->data;
|
||||||
task_iter->data = drag_iter->data;
|
task_iter->data = drag_iter->data;
|
||||||
drag_iter->data = temp;
|
drag_iter->data = temp;
|
||||||
@@ -550,18 +553,18 @@ void event_button_motion_notify (XEvent *e)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else { // The event is on another taskbar than the task being dragged
|
else { // The event is on another taskbar than the task being dragged
|
||||||
if(task_drag->desktop == ALLDESKTOP || panel_mode != MULTI_DESKTOP)
|
if (task_drag->desktop == ALLDESKTOP || panel_mode != MULTI_DESKTOP)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Taskbar * drag_taskbar = (Taskbar*)task_drag->area.parent;
|
Taskbar * drag_taskbar = (Taskbar*)task_drag->area.parent;
|
||||||
drag_taskbar->area.list = g_list_remove(drag_taskbar->area.list, task_drag);
|
remove_area(task_drag);
|
||||||
|
|
||||||
if(event_taskbar->area.posx > drag_taskbar->area.posx || event_taskbar->area.posy > drag_taskbar->area.posy) {
|
if (event_taskbar->area.posx > drag_taskbar->area.posx || event_taskbar->area.posy > drag_taskbar->area.posy) {
|
||||||
int i = (taskbarname_enabled) ? 1 : 0;
|
int i = (taskbarname_enabled) ? 1 : 0;
|
||||||
event_taskbar->area.list = g_list_insert(event_taskbar->area.list, task_drag, i);
|
event_taskbar->area.children = g_list_insert(event_taskbar->area.children, task_drag, i);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
event_taskbar->area.list = g_list_append(event_taskbar->area.list, task_drag);
|
event_taskbar->area.children = g_list_append(event_taskbar->area.children, task_drag);
|
||||||
|
|
||||||
// Move task to other desktop (but avoid the 'Window desktop changed' code in 'event_property_notify')
|
// Move task to other desktop (but avoid the 'Window desktop changed' code in 'event_property_notify')
|
||||||
task_drag->area.parent = event_taskbar;
|
task_drag->area.parent = event_taskbar;
|
||||||
@@ -755,7 +758,7 @@ void event_property_notify (XEvent *e)
|
|||||||
Task *tsk;
|
Task *tsk;
|
||||||
if (server.nb_desktop > old_desktop) {
|
if (server.nb_desktop > old_desktop) {
|
||||||
tskbar = &panel->taskbar[old_desktop];
|
tskbar = &panel->taskbar[old_desktop];
|
||||||
GList *l = tskbar->area.list;
|
GList *l = tskbar->area.children;
|
||||||
if (taskbarname_enabled) l = l->next;
|
if (taskbarname_enabled) l = l->next;
|
||||||
for (; l ; l = l->next) {
|
for (; l ; l = l->next) {
|
||||||
tsk = l->data;
|
tsk = l->data;
|
||||||
@@ -769,7 +772,7 @@ void event_property_notify (XEvent *e)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
tskbar = &panel->taskbar[server.desktop];
|
tskbar = &panel->taskbar[server.desktop];
|
||||||
GList *l = tskbar->area.list;
|
GList *l = tskbar->area.children;
|
||||||
if (taskbarname_enabled) l = l->next;
|
if (taskbarname_enabled) l = l->next;
|
||||||
for (; l ; l = l->next) {
|
for (; l ; l = l->next) {
|
||||||
tsk = l->data;
|
tsk = l->data;
|
||||||
@@ -1201,6 +1204,8 @@ start:
|
|||||||
dnd_sent_request = 0;
|
dnd_sent_request = 0;
|
||||||
dnd_launcher_exec = 0;
|
dnd_launcher_exec = 0;
|
||||||
|
|
||||||
|
int ufd = uevent_init();
|
||||||
|
|
||||||
// sigset_t empty_mask;
|
// sigset_t empty_mask;
|
||||||
// sigemptyset(&empty_mask);
|
// sigemptyset(&empty_mask);
|
||||||
|
|
||||||
@@ -1243,6 +1248,10 @@ start:
|
|||||||
FD_SET (sn_pipe[0], &fdset);
|
FD_SET (sn_pipe[0], &fdset);
|
||||||
maxfd = maxfd < sn_pipe[0] ? sn_pipe[0] : maxfd;
|
maxfd = maxfd < sn_pipe[0] ? sn_pipe[0] : maxfd;
|
||||||
}
|
}
|
||||||
|
if (ufd > 0) {
|
||||||
|
FD_SET (ufd, &fdset);
|
||||||
|
maxfd = maxfd < ufd ? ufd : maxfd;
|
||||||
|
}
|
||||||
update_next_timeout();
|
update_next_timeout();
|
||||||
if (next_timeout.tv_sec >= 0 && next_timeout.tv_usec >= 0)
|
if (next_timeout.tv_sec >= 0 && next_timeout.tv_usec >= 0)
|
||||||
select_timeout = &next_timeout;
|
select_timeout = &next_timeout;
|
||||||
@@ -1251,6 +1260,8 @@ start:
|
|||||||
|
|
||||||
// Wait for X Event or a Timer
|
// Wait for X Event or a Timer
|
||||||
if (XPending(server.dsp) > 0 || select(maxfd+1, &fdset, 0, 0, select_timeout) >= 0) {
|
if (XPending(server.dsp) > 0 || select(maxfd+1, &fdset, 0, 0, select_timeout) >= 0) {
|
||||||
|
uevent_handler();
|
||||||
|
|
||||||
if (sn_pipe_valid) {
|
if (sn_pipe_valid) {
|
||||||
char buffer[1];
|
char buffer[1];
|
||||||
while (read(sn_pipe[0], buffer, sizeof(buffer)) > 0) {
|
while (read(sn_pipe[0], buffer, sizeof(buffer)) > 0) {
|
||||||
@@ -1285,14 +1296,22 @@ start:
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (e.type) {
|
switch (e.type) {
|
||||||
case ButtonPress:
|
case ButtonPress: {
|
||||||
tooltip_hide(0);
|
tooltip_hide(0);
|
||||||
event_button_press (&e);
|
event_button_press (&e);
|
||||||
|
Area* area = click_area(panel, e.xbutton.x, e.xbutton.y);
|
||||||
|
if (panel_config.mouse_effects)
|
||||||
|
mouse_over(area, 1);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case ButtonRelease:
|
case ButtonRelease: {
|
||||||
event_button_release(&e);
|
event_button_release(&e);
|
||||||
|
Area* area = click_area(panel, e.xbutton.x, e.xbutton.y);
|
||||||
|
if (panel_config.mouse_effects)
|
||||||
|
mouse_over(area, 0);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case MotionNotify: {
|
case MotionNotify: {
|
||||||
unsigned int button_mask = Button1Mask | Button2Mask | Button3Mask | Button4Mask | Button5Mask;
|
unsigned int button_mask = Button1Mask | Button2Mask | Button3Mask | Button4Mask | Button5Mask;
|
||||||
@@ -1305,11 +1324,15 @@ start:
|
|||||||
tooltip_trigger_show(area, panel, &e);
|
tooltip_trigger_show(area, panel, &e);
|
||||||
else
|
else
|
||||||
tooltip_trigger_hide();
|
tooltip_trigger_hide();
|
||||||
|
if (panel_config.mouse_effects)
|
||||||
|
mouse_over(area, e.xmotion.state & button_mask);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case LeaveNotify:
|
case LeaveNotify:
|
||||||
tooltip_trigger_hide();
|
tooltip_trigger_hide();
|
||||||
|
if (panel_config.mouse_effects)
|
||||||
|
mouse_out();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Expose:
|
case Expose:
|
||||||
|
|||||||
@@ -124,6 +124,7 @@ static const char *global_ui =
|
|||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
setlocale(LC_ALL, "");
|
||||||
bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
|
bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
|
||||||
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
|
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
|
||||||
textdomain(GETTEXT_PACKAGE);
|
textdomain(GETTEXT_PACKAGE);
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
|||||||
Updating pot file:
|
Updating pot file:
|
||||||
|
|
||||||
find .. -name '*.c' | xargs xgettext --keyword=_ --language=C --output=updated.pot -
|
find .. -name '*.c' | sort -r | xargs xgettext --keyword=_ --language=C --output=updated.pot -
|
||||||
|
|
||||||
Followed by manual editing of updated.pot to make sure the header is OK. Then:
|
Followed by manual editing of updated.pot to make sure the header is OK. Then:
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -34,6 +34,9 @@ GtkWidget *panel_width, *panel_height, *panel_margin_x, *panel_margin_y, *panel_
|
|||||||
GtkWidget *panel_wm_menu, *panel_dock, *panel_autohide, *panel_autohide_show_time, *panel_autohide_hide_time, *panel_autohide_size;
|
GtkWidget *panel_wm_menu, *panel_dock, *panel_autohide, *panel_autohide_show_time, *panel_autohide_hide_time, *panel_autohide_size;
|
||||||
GtkWidget *panel_combo_strut_policy, *panel_combo_layer, *panel_combo_width_type, *panel_combo_height_type, *panel_combo_monitor;
|
GtkWidget *panel_combo_strut_policy, *panel_combo_layer, *panel_combo_width_type, *panel_combo_height_type, *panel_combo_monitor;
|
||||||
GtkWidget *panel_window_name, *disable_transparency;
|
GtkWidget *panel_window_name, *disable_transparency;
|
||||||
|
GtkWidget *panel_mouse_effects;
|
||||||
|
GtkWidget *mouse_hover_icon_opacity, *mouse_hover_icon_saturation, *mouse_hover_icon_brightness;
|
||||||
|
GtkWidget *mouse_pressed_icon_opacity, *mouse_pressed_icon_saturation, *mouse_pressed_icon_brightness;
|
||||||
|
|
||||||
GtkListStore *panel_items, *all_items;
|
GtkListStore *panel_items, *all_items;
|
||||||
GtkWidget *panel_items_view, *all_items_view;
|
GtkWidget *panel_items_view, *all_items_view;
|
||||||
@@ -92,7 +95,9 @@ GtkWidget *clock_background;
|
|||||||
GtkWidget *battery_hide_if_higher, *battery_alert_if_lower, *battery_alert_cmd;
|
GtkWidget *battery_hide_if_higher, *battery_alert_if_lower, *battery_alert_cmd;
|
||||||
GtkWidget *battery_padding_x, *battery_padding_y, *battery_font_line1, *battery_font_line2, *battery_font_color;
|
GtkWidget *battery_padding_x, *battery_padding_y, *battery_font_line1, *battery_font_line2, *battery_font_color;
|
||||||
GtkWidget *battery_background;
|
GtkWidget *battery_background;
|
||||||
|
GtkWidget *battery_tooltip;
|
||||||
GtkWidget *battery_left_command, *battery_mclick_command, *battery_right_command, *battery_uwheel_command, *battery_dwheel_command;
|
GtkWidget *battery_left_command, *battery_mclick_command, *battery_right_command, *battery_uwheel_command, *battery_dwheel_command;
|
||||||
|
GtkWidget *ac_connected_cmd, *ac_disconnected_cmd;
|
||||||
|
|
||||||
// systray
|
// systray
|
||||||
GtkWidget *systray_icon_order, *systray_padding_x, *systray_padding_y, *systray_spacing;
|
GtkWidget *systray_icon_order, *systray_padding_x, *systray_padding_y, *systray_spacing;
|
||||||
@@ -114,7 +119,7 @@ GtkWidget *launcher_apps_dirs;
|
|||||||
GtkWidget *launcher_icon_size, *launcher_icon_theme, *launcher_padding_x, *launcher_padding_y, *launcher_spacing;
|
GtkWidget *launcher_icon_size, *launcher_icon_theme, *launcher_padding_x, *launcher_padding_y, *launcher_spacing;
|
||||||
GtkWidget *launcher_icon_opacity, *launcher_icon_saturation, *launcher_icon_brightness;
|
GtkWidget *launcher_icon_opacity, *launcher_icon_saturation, *launcher_icon_brightness;
|
||||||
GtkWidget *margin_x, *margin_y;
|
GtkWidget *margin_x, *margin_y;
|
||||||
GtkWidget *launcher_background;
|
GtkWidget *launcher_background, *launcher_icon_background;
|
||||||
GtkWidget *startup_notifications;
|
GtkWidget *startup_notifications;
|
||||||
IconThemeWrapper *icon_theme;
|
IconThemeWrapper *icon_theme;
|
||||||
GtkWidget *launcher_tooltip;
|
GtkWidget *launcher_tooltip;
|
||||||
@@ -124,6 +129,10 @@ GtkListStore *backgrounds;
|
|||||||
GtkWidget *current_background,
|
GtkWidget *current_background,
|
||||||
*background_fill_color,
|
*background_fill_color,
|
||||||
*background_border_color,
|
*background_border_color,
|
||||||
|
*background_fill_color_over,
|
||||||
|
*background_border_color_over,
|
||||||
|
*background_fill_color_press,
|
||||||
|
*background_border_color_press,
|
||||||
*background_border_width,
|
*background_border_width,
|
||||||
*background_corner_radius;
|
*background_corner_radius;
|
||||||
|
|
||||||
@@ -139,6 +148,7 @@ void background_delete(GtkWidget *widget, gpointer data);
|
|||||||
void background_update_image(int index);
|
void background_update_image(int index);
|
||||||
void background_update(GtkWidget *widget, gpointer data);
|
void background_update(GtkWidget *widget, gpointer data);
|
||||||
void current_background_changed(GtkWidget *widget, gpointer data);
|
void current_background_changed(GtkWidget *widget, gpointer data);
|
||||||
|
void background_combo_changed(GtkWidget *widget, gpointer data);
|
||||||
void create_panel(GtkWidget *parent);
|
void create_panel(GtkWidget *parent);
|
||||||
void create_panel_items(GtkWidget *parent);
|
void create_panel_items(GtkWidget *parent);
|
||||||
void create_launcher(GtkWidget *parent);
|
void create_launcher(GtkWidget *parent);
|
||||||
@@ -149,6 +159,7 @@ void create_taskbar(GtkWidget *parent);
|
|||||||
void create_task(GtkWidget *parent);
|
void create_task(GtkWidget *parent);
|
||||||
void create_task_status(GtkWidget *notebook,
|
void create_task_status(GtkWidget *notebook,
|
||||||
char *name,
|
char *name,
|
||||||
|
char *text,
|
||||||
GtkWidget **task_status_color,
|
GtkWidget **task_status_color,
|
||||||
GtkWidget **task_status_color_set,
|
GtkWidget **task_status_color_set,
|
||||||
GtkWidget **task_status_icon_opacity,
|
GtkWidget **task_status_icon_opacity,
|
||||||
@@ -166,6 +177,11 @@ void panel_remove_item(GtkWidget *widget, gpointer data);
|
|||||||
void panel_move_item_down(GtkWidget *widget, gpointer data);
|
void panel_move_item_down(GtkWidget *widget, gpointer data);
|
||||||
void panel_move_item_up(GtkWidget *widget, gpointer data);
|
void panel_move_item_up(GtkWidget *widget, gpointer data);
|
||||||
|
|
||||||
|
static gint compare_strings(gconstpointer a, gconstpointer b)
|
||||||
|
{
|
||||||
|
return strnatcasecmp((const char*)a, (const char*)b);
|
||||||
|
}
|
||||||
|
|
||||||
void applyClicked(GtkWidget *widget, gpointer data)
|
void applyClicked(GtkWidget *widget, gpointer data)
|
||||||
{
|
{
|
||||||
gchar *file = get_current_theme_file_name();
|
gchar *file = get_current_theme_file_name();
|
||||||
@@ -267,13 +283,6 @@ GtkWidget *create_properties()
|
|||||||
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), addScrollBarToWidget(page_panel_items), label);
|
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), addScrollBarToWidget(page_panel_items), label);
|
||||||
create_panel_items(page_panel_items);
|
create_panel_items(page_panel_items);
|
||||||
|
|
||||||
label = gtk_label_new(_("Launcher"));
|
|
||||||
gtk_widget_show(label);
|
|
||||||
page_launcher = gtk_vbox_new(FALSE, DEFAULT_HOR_SPACING);
|
|
||||||
gtk_container_set_border_width(GTK_CONTAINER(page_launcher), 10);
|
|
||||||
gtk_widget_show(page_launcher);
|
|
||||||
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), addScrollBarToWidget(page_launcher), label);
|
|
||||||
create_launcher(page_launcher);
|
|
||||||
|
|
||||||
label = gtk_label_new(_("Taskbar"));
|
label = gtk_label_new(_("Taskbar"));
|
||||||
gtk_widget_show(label);
|
gtk_widget_show(label);
|
||||||
@@ -291,6 +300,14 @@ GtkWidget *create_properties()
|
|||||||
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), addScrollBarToWidget(page_task), label);
|
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), addScrollBarToWidget(page_task), label);
|
||||||
create_task(page_task);
|
create_task(page_task);
|
||||||
|
|
||||||
|
label = gtk_label_new(_("Launcher"));
|
||||||
|
gtk_widget_show(label);
|
||||||
|
page_launcher = gtk_vbox_new(FALSE, DEFAULT_HOR_SPACING);
|
||||||
|
gtk_container_set_border_width(GTK_CONTAINER(page_launcher), 10);
|
||||||
|
gtk_widget_show(page_launcher);
|
||||||
|
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), addScrollBarToWidget(page_launcher), label);
|
||||||
|
create_launcher(page_launcher);
|
||||||
|
|
||||||
label = gtk_label_new(_("Clock"));
|
label = gtk_label_new(_("Clock"));
|
||||||
gtk_widget_show(label);
|
gtk_widget_show(label);
|
||||||
page_clock = gtk_vbox_new(FALSE, DEFAULT_HOR_SPACING);
|
page_clock = gtk_vbox_new(FALSE, DEFAULT_HOR_SPACING);
|
||||||
@@ -335,15 +352,94 @@ void change_paragraph(GtkWidget *widget)
|
|||||||
gtk_container_set_border_width(GTK_CONTAINER(hbox), 6);
|
gtk_container_set_border_width(GTK_CONTAINER(hbox), 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget *create_background_combo()
|
GtkWidget *create_background_combo(const char *label)
|
||||||
{
|
{
|
||||||
GtkWidget *combo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(backgrounds));
|
GtkWidget *combo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(backgrounds));
|
||||||
GtkCellRenderer *renderer = gtk_cell_renderer_pixbuf_new();
|
GtkCellRenderer *renderer = gtk_cell_renderer_pixbuf_new();
|
||||||
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo), renderer, FALSE);
|
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo), renderer, FALSE);
|
||||||
gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo), renderer, "pixbuf", 0, NULL);
|
gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo), renderer, "pixbuf", bgColPixbuf, NULL);
|
||||||
|
renderer = gtk_cell_renderer_text_new();
|
||||||
|
g_object_set(renderer, "wrap-mode", PANGO_WRAP_WORD, NULL);
|
||||||
|
g_object_set(renderer, "wrap-width", 300, NULL);
|
||||||
|
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo), renderer, FALSE);
|
||||||
|
gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo), renderer, "text", bgColText, NULL);
|
||||||
|
g_signal_connect(G_OBJECT(combo), "changed", G_CALLBACK(background_combo_changed), (void*)label);
|
||||||
return combo;
|
return combo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void background_combo_changed(GtkWidget *widget, gpointer data)
|
||||||
|
{
|
||||||
|
gchar *combo_text = (gchar*)data;
|
||||||
|
if (!combo_text || g_str_equal(combo_text, ""))
|
||||||
|
return;
|
||||||
|
int selected_index = gtk_combo_box_get_active(GTK_COMBO_BOX(widget));
|
||||||
|
|
||||||
|
int index;
|
||||||
|
for (index = 0; ; index++) {
|
||||||
|
GtkTreePath *path;
|
||||||
|
GtkTreeIter iter;
|
||||||
|
|
||||||
|
path = gtk_tree_path_new_from_indices(index, -1);
|
||||||
|
gboolean found = gtk_tree_model_get_iter(GTK_TREE_MODEL(backgrounds), &iter, path);
|
||||||
|
gtk_tree_path_free(path);
|
||||||
|
|
||||||
|
if (!found) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
gchar *text;
|
||||||
|
gtk_tree_model_get(GTK_TREE_MODEL(backgrounds), &iter,
|
||||||
|
bgColText, &text,
|
||||||
|
-1);
|
||||||
|
gchar **parts = g_strsplit(text, ", ", -1);
|
||||||
|
int ifound;
|
||||||
|
for (ifound = 0; parts[ifound]; ifound++) {
|
||||||
|
if (g_str_equal(parts[ifound], combo_text))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (parts[ifound] && index != selected_index) {
|
||||||
|
for (; parts[ifound+1]; ifound++) {
|
||||||
|
gchar *tmp = parts[ifound];
|
||||||
|
parts[ifound] = parts[ifound+1];
|
||||||
|
parts[ifound+1] = tmp;
|
||||||
|
}
|
||||||
|
g_free(parts[ifound]);
|
||||||
|
parts[ifound] = NULL;
|
||||||
|
text = g_strjoinv(", ", parts);
|
||||||
|
g_strfreev(parts);
|
||||||
|
gtk_list_store_set(backgrounds, &iter,
|
||||||
|
bgColText, text,
|
||||||
|
-1);
|
||||||
|
g_free(text);
|
||||||
|
} else if (!parts[ifound] && index == selected_index) {
|
||||||
|
if (!ifound) {
|
||||||
|
text = g_strdup(combo_text);
|
||||||
|
} else {
|
||||||
|
for (ifound = 0; parts[ifound]; ifound++) {
|
||||||
|
if (compare_strings(combo_text, parts[ifound]) < 0)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (parts[ifound]) {
|
||||||
|
gchar *tmp = parts[ifound];
|
||||||
|
parts[ifound] = g_strconcat(combo_text, ", ", tmp, NULL);
|
||||||
|
g_free(tmp);
|
||||||
|
} else {
|
||||||
|
ifound--;
|
||||||
|
gchar *tmp = parts[ifound];
|
||||||
|
parts[ifound] = g_strconcat(tmp, ", ", combo_text, NULL);
|
||||||
|
g_free(tmp);
|
||||||
|
}
|
||||||
|
text = g_strjoinv(", ", parts);
|
||||||
|
g_strfreev(parts);
|
||||||
|
}
|
||||||
|
gtk_list_store_set(backgrounds, &iter,
|
||||||
|
bgColText, text,
|
||||||
|
-1);
|
||||||
|
g_free(text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void gdkColor2CairoColor(GdkColor color, double *red, double *green, double *blue)
|
void gdkColor2CairoColor(GdkColor color, double *red, double *green, double *blue)
|
||||||
{
|
{
|
||||||
*red = color.red / (double)0xffff;
|
*red = color.red / (double)0xffff;
|
||||||
@@ -368,6 +464,15 @@ void create_background(GtkWidget *parent)
|
|||||||
GDK_TYPE_COLOR,
|
GDK_TYPE_COLOR,
|
||||||
GTK_TYPE_INT,
|
GTK_TYPE_INT,
|
||||||
GTK_TYPE_INT,
|
GTK_TYPE_INT,
|
||||||
|
GTK_TYPE_INT,
|
||||||
|
GTK_TYPE_STRING,
|
||||||
|
GDK_TYPE_COLOR,
|
||||||
|
GTK_TYPE_INT,
|
||||||
|
GDK_TYPE_COLOR,
|
||||||
|
GTK_TYPE_INT,
|
||||||
|
GDK_TYPE_COLOR,
|
||||||
|
GTK_TYPE_INT,
|
||||||
|
GDK_TYPE_COLOR,
|
||||||
GTK_TYPE_INT);
|
GTK_TYPE_INT);
|
||||||
|
|
||||||
GtkWidget *table, *label, *button;
|
GtkWidget *table, *label, *button;
|
||||||
@@ -388,7 +493,7 @@ void create_background(GtkWidget *parent)
|
|||||||
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
col++;
|
col++;
|
||||||
|
|
||||||
current_background = create_background_combo();
|
current_background = create_background_combo(NULL);
|
||||||
gtk_widget_show(current_background);
|
gtk_widget_show(current_background);
|
||||||
gtk_table_attach(GTK_TABLE(table), current_background, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
gtk_table_attach(GTK_TABLE(table), current_background, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
col++;
|
col++;
|
||||||
@@ -442,6 +547,62 @@ void create_background(GtkWidget *parent)
|
|||||||
col++;
|
col++;
|
||||||
gtk_tooltips_set_tip(tooltips, background_border_color, _("The border color of the current background"), NULL);
|
gtk_tooltips_set_tip(tooltips, background_border_color, _("The border color of the current background"), NULL);
|
||||||
|
|
||||||
|
row++, col = 2;
|
||||||
|
label = gtk_label_new(_("Fill color (mouse over)"));
|
||||||
|
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
|
||||||
|
gtk_widget_show(label);
|
||||||
|
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
|
col++;
|
||||||
|
|
||||||
|
background_fill_color_over = gtk_color_button_new();
|
||||||
|
gtk_color_button_set_use_alpha(GTK_COLOR_BUTTON(background_fill_color_over), TRUE);
|
||||||
|
gtk_widget_show(background_fill_color_over);
|
||||||
|
gtk_table_attach(GTK_TABLE(table), background_fill_color_over, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
|
col++;
|
||||||
|
gtk_tooltips_set_tip(tooltips, background_fill_color_over, _("The fill color of the current background on mouse over"), NULL);
|
||||||
|
|
||||||
|
row++, col = 2;
|
||||||
|
label = gtk_label_new(_("Border color (mouse over)"));
|
||||||
|
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
|
||||||
|
gtk_widget_show(label);
|
||||||
|
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
|
col++;
|
||||||
|
|
||||||
|
background_border_color_over = gtk_color_button_new();
|
||||||
|
gtk_color_button_set_use_alpha(GTK_COLOR_BUTTON(background_border_color_over), TRUE);
|
||||||
|
gtk_widget_show(background_border_color_over);
|
||||||
|
gtk_table_attach(GTK_TABLE(table), background_border_color_over, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
|
col++;
|
||||||
|
gtk_tooltips_set_tip(tooltips, background_border_color_over, _("The border color of the current background on mouse over"), NULL);
|
||||||
|
|
||||||
|
row++, col = 2;
|
||||||
|
label = gtk_label_new(_("Fill color (pressed)"));
|
||||||
|
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
|
||||||
|
gtk_widget_show(label);
|
||||||
|
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
|
col++;
|
||||||
|
|
||||||
|
background_fill_color_press = gtk_color_button_new();
|
||||||
|
gtk_color_button_set_use_alpha(GTK_COLOR_BUTTON(background_fill_color_press), TRUE);
|
||||||
|
gtk_widget_show(background_fill_color_press);
|
||||||
|
gtk_table_attach(GTK_TABLE(table), background_fill_color_press, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
|
col++;
|
||||||
|
gtk_tooltips_set_tip(tooltips, background_fill_color_press, _("The fill color of the current background on mouse button press"), NULL);
|
||||||
|
|
||||||
|
row++, col = 2;
|
||||||
|
label = gtk_label_new(_("Border color (pressed)"));
|
||||||
|
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
|
||||||
|
gtk_widget_show(label);
|
||||||
|
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
|
col++;
|
||||||
|
|
||||||
|
background_border_color_press = gtk_color_button_new();
|
||||||
|
gtk_color_button_set_use_alpha(GTK_COLOR_BUTTON(background_border_color_press), TRUE);
|
||||||
|
gtk_widget_show(background_border_color_press);
|
||||||
|
gtk_table_attach(GTK_TABLE(table), background_border_color_press, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
|
col++;
|
||||||
|
gtk_tooltips_set_tip(tooltips, background_border_color_press, _("The border color of the current background on mouse button press"), NULL);
|
||||||
|
|
||||||
row++, col = 2;
|
row++, col = 2;
|
||||||
label = gtk_label_new(_("Border width"));
|
label = gtk_label_new(_("Border width"));
|
||||||
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
|
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
|
||||||
@@ -471,6 +632,10 @@ void create_background(GtkWidget *parent)
|
|||||||
g_signal_connect(G_OBJECT(current_background), "changed", G_CALLBACK(current_background_changed), NULL);
|
g_signal_connect(G_OBJECT(current_background), "changed", G_CALLBACK(current_background_changed), NULL);
|
||||||
g_signal_connect(G_OBJECT(background_fill_color), "color-set", G_CALLBACK(background_update), NULL);
|
g_signal_connect(G_OBJECT(background_fill_color), "color-set", G_CALLBACK(background_update), NULL);
|
||||||
g_signal_connect(G_OBJECT(background_border_color), "color-set", G_CALLBACK(background_update), NULL);
|
g_signal_connect(G_OBJECT(background_border_color), "color-set", G_CALLBACK(background_update), NULL);
|
||||||
|
g_signal_connect(G_OBJECT(background_fill_color_over), "color-set", G_CALLBACK(background_update), NULL);
|
||||||
|
g_signal_connect(G_OBJECT(background_border_color_over), "color-set", G_CALLBACK(background_update), NULL);
|
||||||
|
g_signal_connect(G_OBJECT(background_fill_color_press), "color-set", G_CALLBACK(background_update), NULL);
|
||||||
|
g_signal_connect(G_OBJECT(background_border_color_press), "color-set", G_CALLBACK(background_update), NULL);
|
||||||
g_signal_connect(G_OBJECT(background_border_width), "value-changed", G_CALLBACK(background_update), NULL);
|
g_signal_connect(G_OBJECT(background_border_width), "value-changed", G_CALLBACK(background_update), NULL);
|
||||||
g_signal_connect(G_OBJECT(background_corner_radius), "value-changed", G_CALLBACK(background_update), NULL);
|
g_signal_connect(G_OBJECT(background_corner_radius), "value-changed", G_CALLBACK(background_update), NULL);
|
||||||
|
|
||||||
@@ -514,6 +679,20 @@ void background_create_new()
|
|||||||
cairoColor2GdkColor(0, 0, 0, &borderColor);
|
cairoColor2GdkColor(0, 0, 0, &borderColor);
|
||||||
int borderOpacity = 0;
|
int borderOpacity = 0;
|
||||||
|
|
||||||
|
GdkColor fillColorOver;
|
||||||
|
cairoColor2GdkColor(0, 0, 0, &fillColorOver);
|
||||||
|
int fillOpacityOver = 0;
|
||||||
|
GdkColor borderColorOver;
|
||||||
|
cairoColor2GdkColor(0, 0, 0, &borderColorOver);
|
||||||
|
int borderOpacityOver = 0;
|
||||||
|
|
||||||
|
GdkColor fillColorPress;
|
||||||
|
cairoColor2GdkColor(0, 0, 0, &fillColorPress);
|
||||||
|
int fillOpacityPress = 0;
|
||||||
|
GdkColor borderColorPress;
|
||||||
|
cairoColor2GdkColor(0, 0, 0, &borderColorPress);
|
||||||
|
int borderOpacityPress = 0;
|
||||||
|
|
||||||
int index = 0;
|
int index = 0;
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
|
|
||||||
@@ -526,10 +705,20 @@ void background_create_new()
|
|||||||
bgColBorderOpacity, borderOpacity,
|
bgColBorderOpacity, borderOpacity,
|
||||||
bgColBorderWidth, b,
|
bgColBorderWidth, b,
|
||||||
bgColCornerRadius, r,
|
bgColCornerRadius, r,
|
||||||
|
bgColFillColorOver, &fillColorOver,
|
||||||
|
bgColFillOpacityOver, fillOpacityOver,
|
||||||
|
bgColBorderColorOver, &borderColorOver,
|
||||||
|
bgColBorderOpacityOver, borderOpacityOver,
|
||||||
|
bgColFillColorPress, &fillColorPress,
|
||||||
|
bgColFillOpacityPress, fillOpacityPress,
|
||||||
|
bgColBorderColorPress, &borderColorPress,
|
||||||
|
bgColBorderOpacityPress, borderOpacityPress,
|
||||||
|
bgColText, "",
|
||||||
-1);
|
-1);
|
||||||
|
|
||||||
background_update_image(index);
|
background_update_image(index);
|
||||||
gtk_combo_box_set_active(GTK_COMBO_BOX(current_background), get_model_length(GTK_TREE_MODEL(backgrounds)) - 1);
|
gtk_combo_box_set_active(GTK_COMBO_BOX(current_background), get_model_length(GTK_TREE_MODEL(backgrounds)) - 1);
|
||||||
|
current_background_changed(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void background_duplicate(GtkWidget *widget, gpointer data)
|
void background_duplicate(GtkWidget *widget, gpointer data)
|
||||||
@@ -553,12 +742,28 @@ void background_duplicate(GtkWidget *widget, gpointer data)
|
|||||||
int fillOpacity;
|
int fillOpacity;
|
||||||
GdkColor *borderColor;
|
GdkColor *borderColor;
|
||||||
int borderOpacity;
|
int borderOpacity;
|
||||||
|
GdkColor *fillColorOver;
|
||||||
|
int fillOpacityOver;
|
||||||
|
GdkColor *borderColorOver;
|
||||||
|
int borderOpacityOver;
|
||||||
|
GdkColor *fillColorPress;
|
||||||
|
int fillOpacityPress;
|
||||||
|
GdkColor *borderColorPress;
|
||||||
|
int borderOpacityPress;
|
||||||
|
|
||||||
gtk_tree_model_get(GTK_TREE_MODEL(backgrounds), &iter,
|
gtk_tree_model_get(GTK_TREE_MODEL(backgrounds), &iter,
|
||||||
bgColFillColor, &fillColor,
|
bgColFillColor, &fillColor,
|
||||||
bgColFillOpacity, &fillOpacity,
|
bgColFillOpacity, &fillOpacity,
|
||||||
bgColBorderColor, &borderColor,
|
bgColBorderColor, &borderColor,
|
||||||
bgColBorderOpacity, &borderOpacity,
|
bgColBorderOpacity, &borderOpacity,
|
||||||
|
bgColFillColorOver, &fillColorOver,
|
||||||
|
bgColFillOpacityOver, &fillOpacityOver,
|
||||||
|
bgColBorderColorOver, &borderColorOver,
|
||||||
|
bgColBorderOpacityOver, &borderOpacityOver,
|
||||||
|
bgColFillColorPress, &fillColorPress,
|
||||||
|
bgColFillOpacityPress, &fillOpacityPress,
|
||||||
|
bgColBorderColorPress, &borderColorPress,
|
||||||
|
bgColBorderOpacityPress, &borderOpacityPress,
|
||||||
bgColBorderWidth, &b,
|
bgColBorderWidth, &b,
|
||||||
bgColCornerRadius, &r,
|
bgColCornerRadius, &r,
|
||||||
-1);
|
-1);
|
||||||
@@ -570,11 +775,24 @@ void background_duplicate(GtkWidget *widget, gpointer data)
|
|||||||
bgColFillOpacity, fillOpacity,
|
bgColFillOpacity, fillOpacity,
|
||||||
bgColBorderColor, borderColor,
|
bgColBorderColor, borderColor,
|
||||||
bgColBorderOpacity, borderOpacity,
|
bgColBorderOpacity, borderOpacity,
|
||||||
|
bgColFillColorOver, fillColorOver,
|
||||||
|
bgColFillOpacityOver, fillOpacityOver,
|
||||||
|
bgColBorderColorOver, borderColorOver,
|
||||||
|
bgColBorderOpacityOver, borderOpacityOver,
|
||||||
|
bgColFillColorPress, fillColorPress,
|
||||||
|
bgColFillOpacityPress, fillOpacityPress,
|
||||||
|
bgColBorderColorPress, borderColorPress,
|
||||||
|
bgColBorderOpacityPress, borderOpacityPress,
|
||||||
bgColBorderWidth, b,
|
bgColBorderWidth, b,
|
||||||
bgColCornerRadius, r,
|
bgColCornerRadius, r,
|
||||||
|
bgColText, ""
|
||||||
-1);
|
-1);
|
||||||
g_boxed_free(GDK_TYPE_COLOR, fillColor);
|
g_boxed_free(GDK_TYPE_COLOR, fillColor);
|
||||||
g_boxed_free(GDK_TYPE_COLOR, borderColor);
|
g_boxed_free(GDK_TYPE_COLOR, borderColor);
|
||||||
|
g_boxed_free(GDK_TYPE_COLOR, fillColorOver);
|
||||||
|
g_boxed_free(GDK_TYPE_COLOR, borderColorOver);
|
||||||
|
g_boxed_free(GDK_TYPE_COLOR, fillColorPress);
|
||||||
|
g_boxed_free(GDK_TYPE_COLOR, borderColorPress);
|
||||||
background_update_image(get_model_length(GTK_TREE_MODEL(backgrounds)) - 1);
|
background_update_image(get_model_length(GTK_TREE_MODEL(backgrounds)) - 1);
|
||||||
gtk_combo_box_set_active(GTK_COMBO_BOX(current_background), get_model_length(GTK_TREE_MODEL(backgrounds)) - 1);
|
gtk_combo_box_set_active(GTK_COMBO_BOX(current_background), get_model_length(GTK_TREE_MODEL(backgrounds)) - 1);
|
||||||
}
|
}
|
||||||
@@ -697,24 +915,50 @@ void background_update(GtkWidget *widget, gpointer data)
|
|||||||
|
|
||||||
int r;
|
int r;
|
||||||
int b;
|
int b;
|
||||||
|
r = gtk_spin_button_get_value(GTK_SPIN_BUTTON(background_corner_radius));
|
||||||
|
b = gtk_spin_button_get_value(GTK_SPIN_BUTTON(background_border_width));
|
||||||
|
|
||||||
GdkColor fillColor;
|
GdkColor fillColor;
|
||||||
int fillOpacity;
|
int fillOpacity;
|
||||||
GdkColor borderColor;
|
GdkColor borderColor;
|
||||||
int borderOpacity;
|
int borderOpacity;
|
||||||
|
|
||||||
r = gtk_spin_button_get_value(GTK_SPIN_BUTTON(background_corner_radius));
|
|
||||||
b = gtk_spin_button_get_value(GTK_SPIN_BUTTON(background_border_width));
|
|
||||||
gtk_color_button_get_color(GTK_COLOR_BUTTON(background_fill_color), &fillColor);
|
gtk_color_button_get_color(GTK_COLOR_BUTTON(background_fill_color), &fillColor);
|
||||||
fillOpacity = MIN(100, 0.5 + gtk_color_button_get_alpha(GTK_COLOR_BUTTON(background_fill_color)) * 100.0 / 0xffff);
|
fillOpacity = MIN(100, 0.5 + gtk_color_button_get_alpha(GTK_COLOR_BUTTON(background_fill_color)) * 100.0 / 0xffff);
|
||||||
gtk_color_button_get_color(GTK_COLOR_BUTTON(background_border_color), &borderColor);
|
gtk_color_button_get_color(GTK_COLOR_BUTTON(background_border_color), &borderColor);
|
||||||
borderOpacity = MIN(100, 0.5 + gtk_color_button_get_alpha(GTK_COLOR_BUTTON(background_border_color)) * 100.0 / 0xffff);
|
borderOpacity = MIN(100, 0.5 + gtk_color_button_get_alpha(GTK_COLOR_BUTTON(background_border_color)) * 100.0 / 0xffff);
|
||||||
|
|
||||||
|
GdkColor fillColorOver;
|
||||||
|
int fillOpacityOver;
|
||||||
|
GdkColor borderColorOver;
|
||||||
|
int borderOpacityOver;
|
||||||
|
gtk_color_button_get_color(GTK_COLOR_BUTTON(background_fill_color_over), &fillColorOver);
|
||||||
|
fillOpacityOver = MIN(100, 0.5 + gtk_color_button_get_alpha(GTK_COLOR_BUTTON(background_fill_color_over)) * 100.0 / 0xffff);
|
||||||
|
gtk_color_button_get_color(GTK_COLOR_BUTTON(background_border_color_over), &borderColorOver);
|
||||||
|
borderOpacityOver = MIN(100, 0.5 + gtk_color_button_get_alpha(GTK_COLOR_BUTTON(background_border_color_over)) * 100.0 / 0xffff);
|
||||||
|
|
||||||
|
GdkColor fillColorPress;
|
||||||
|
int fillOpacityPress;
|
||||||
|
GdkColor borderColorPress;
|
||||||
|
int borderOpacityPress;
|
||||||
|
gtk_color_button_get_color(GTK_COLOR_BUTTON(background_fill_color_press), &fillColorPress);
|
||||||
|
fillOpacityPress = MIN(100, 0.5 + gtk_color_button_get_alpha(GTK_COLOR_BUTTON(background_fill_color_press)) * 100.0 / 0xffff);
|
||||||
|
gtk_color_button_get_color(GTK_COLOR_BUTTON(background_border_color_press), &borderColorPress);
|
||||||
|
borderOpacityPress = MIN(100, 0.5 + gtk_color_button_get_alpha(GTK_COLOR_BUTTON(background_border_color_press)) * 100.0 / 0xffff);
|
||||||
|
|
||||||
gtk_list_store_set(backgrounds, &iter,
|
gtk_list_store_set(backgrounds, &iter,
|
||||||
bgColPixbuf, NULL,
|
bgColPixbuf, NULL,
|
||||||
bgColFillColor, &fillColor,
|
bgColFillColor, &fillColor,
|
||||||
bgColFillOpacity, fillOpacity,
|
bgColFillOpacity, fillOpacity,
|
||||||
bgColBorderColor, &borderColor,
|
bgColBorderColor, &borderColor,
|
||||||
bgColBorderOpacity, borderOpacity,
|
bgColBorderOpacity, borderOpacity,
|
||||||
|
bgColFillColorOver, &fillColorOver,
|
||||||
|
bgColFillOpacityOver, fillOpacityOver,
|
||||||
|
bgColBorderColorOver, &borderColorOver,
|
||||||
|
bgColBorderOpacityOver, borderOpacityOver,
|
||||||
|
bgColFillColorPress, &fillColorPress,
|
||||||
|
bgColFillOpacityPress, fillOpacityPress,
|
||||||
|
bgColBorderColorPress, &borderColorPress,
|
||||||
|
bgColBorderOpacityPress, borderOpacityPress,
|
||||||
bgColBorderWidth, b,
|
bgColBorderWidth, b,
|
||||||
bgColCornerRadius, r,
|
bgColCornerRadius, r,
|
||||||
-1);
|
-1);
|
||||||
@@ -740,12 +984,29 @@ void current_background_changed(GtkWidget *widget, gpointer data)
|
|||||||
int fillOpacity;
|
int fillOpacity;
|
||||||
GdkColor *borderColor;
|
GdkColor *borderColor;
|
||||||
int borderOpacity;
|
int borderOpacity;
|
||||||
|
GdkColor *fillColorOver;
|
||||||
|
int fillOpacityOver;
|
||||||
|
GdkColor *borderColorOver;
|
||||||
|
int borderOpacityOver;
|
||||||
|
GdkColor *fillColorPress;
|
||||||
|
int fillOpacityPress;
|
||||||
|
GdkColor *borderColorPress;
|
||||||
|
int borderOpacityPress;
|
||||||
|
|
||||||
|
|
||||||
gtk_tree_model_get(GTK_TREE_MODEL(backgrounds), &iter,
|
gtk_tree_model_get(GTK_TREE_MODEL(backgrounds), &iter,
|
||||||
bgColFillColor, &fillColor,
|
bgColFillColor, &fillColor,
|
||||||
bgColFillOpacity, &fillOpacity,
|
bgColFillOpacity, &fillOpacity,
|
||||||
bgColBorderColor, &borderColor,
|
bgColBorderColor, &borderColor,
|
||||||
bgColBorderOpacity, &borderOpacity,
|
bgColBorderOpacity, &borderOpacity,
|
||||||
|
bgColFillColorOver, &fillColorOver,
|
||||||
|
bgColFillOpacityOver, &fillOpacityOver,
|
||||||
|
bgColBorderColorOver, &borderColorOver,
|
||||||
|
bgColBorderOpacityOver, &borderOpacityOver,
|
||||||
|
bgColFillColorPress, &fillColorPress,
|
||||||
|
bgColFillOpacityPress, &fillOpacityPress,
|
||||||
|
bgColBorderColorPress, &borderColorPress,
|
||||||
|
bgColBorderOpacityPress, &borderOpacityPress,
|
||||||
bgColBorderWidth, &b,
|
bgColBorderWidth, &b,
|
||||||
bgColCornerRadius, &r,
|
bgColCornerRadius, &r,
|
||||||
-1);
|
-1);
|
||||||
@@ -754,11 +1015,26 @@ void current_background_changed(GtkWidget *widget, gpointer data)
|
|||||||
gtk_color_button_set_alpha(GTK_COLOR_BUTTON(background_fill_color), (fillOpacity*0xffff)/100);
|
gtk_color_button_set_alpha(GTK_COLOR_BUTTON(background_fill_color), (fillOpacity*0xffff)/100);
|
||||||
gtk_color_button_set_color(GTK_COLOR_BUTTON(background_border_color), borderColor);
|
gtk_color_button_set_color(GTK_COLOR_BUTTON(background_border_color), borderColor);
|
||||||
gtk_color_button_set_alpha(GTK_COLOR_BUTTON(background_border_color), (borderOpacity*0xffff)/100);
|
gtk_color_button_set_alpha(GTK_COLOR_BUTTON(background_border_color), (borderOpacity*0xffff)/100);
|
||||||
|
|
||||||
|
gtk_color_button_set_color(GTK_COLOR_BUTTON(background_fill_color_over), fillColorOver);
|
||||||
|
gtk_color_button_set_alpha(GTK_COLOR_BUTTON(background_fill_color_over), (fillOpacityOver*0xffff)/100);
|
||||||
|
gtk_color_button_set_color(GTK_COLOR_BUTTON(background_border_color_over), borderColorOver);
|
||||||
|
gtk_color_button_set_alpha(GTK_COLOR_BUTTON(background_border_color_over), (borderOpacityOver*0xffff)/100);
|
||||||
|
|
||||||
|
gtk_color_button_set_color(GTK_COLOR_BUTTON(background_fill_color_press), fillColorPress);
|
||||||
|
gtk_color_button_set_alpha(GTK_COLOR_BUTTON(background_fill_color_press), (fillOpacityPress*0xffff)/100);
|
||||||
|
gtk_color_button_set_color(GTK_COLOR_BUTTON(background_border_color_press), borderColorPress);
|
||||||
|
gtk_color_button_set_alpha(GTK_COLOR_BUTTON(background_border_color_press), (borderOpacityPress*0xffff)/100);
|
||||||
|
|
||||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(background_border_width), b);
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(background_border_width), b);
|
||||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(background_corner_radius), r);
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(background_corner_radius), r);
|
||||||
|
|
||||||
g_boxed_free(GDK_TYPE_COLOR, fillColor);
|
g_boxed_free(GDK_TYPE_COLOR, fillColor);
|
||||||
g_boxed_free(GDK_TYPE_COLOR, borderColor);
|
g_boxed_free(GDK_TYPE_COLOR, borderColor);
|
||||||
|
g_boxed_free(GDK_TYPE_COLOR, fillColorOver);
|
||||||
|
g_boxed_free(GDK_TYPE_COLOR, borderColorOver);
|
||||||
|
g_boxed_free(GDK_TYPE_COLOR, fillColorPress);
|
||||||
|
g_boxed_free(GDK_TYPE_COLOR, borderColorPress);
|
||||||
}
|
}
|
||||||
|
|
||||||
void create_panel(GtkWidget *parent)
|
void create_panel(GtkWidget *parent)
|
||||||
@@ -956,7 +1232,7 @@ void create_panel(GtkWidget *parent)
|
|||||||
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
col++;
|
col++;
|
||||||
|
|
||||||
panel_background = create_background_combo();
|
panel_background = create_background_combo(_("Panel"));
|
||||||
gtk_widget_show(panel_background);
|
gtk_widget_show(panel_background);
|
||||||
gtk_table_attach(GTK_TABLE(table), panel_background, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
gtk_table_attach(GTK_TABLE(table), panel_background, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
col++;
|
col++;
|
||||||
@@ -1036,6 +1312,110 @@ void create_panel(GtkWidget *parent)
|
|||||||
gtk_tooltips_set_tip(tooltips, font_shadow, _("If enabled, a shadow will be drawn behind text. "
|
gtk_tooltips_set_tip(tooltips, font_shadow, _("If enabled, a shadow will be drawn behind text. "
|
||||||
"This may improve legibility on transparent panels."), NULL);
|
"This may improve legibility on transparent panels."), NULL);
|
||||||
|
|
||||||
|
row++;
|
||||||
|
col = 2;
|
||||||
|
label = gtk_label_new(_("Mouse effects"));
|
||||||
|
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
|
||||||
|
gtk_widget_show(label);
|
||||||
|
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
|
col++;
|
||||||
|
|
||||||
|
panel_mouse_effects = gtk_check_button_new();
|
||||||
|
gtk_widget_show(panel_mouse_effects);
|
||||||
|
gtk_table_attach(GTK_TABLE(table), panel_mouse_effects, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
|
col++;
|
||||||
|
gtk_tooltips_set_tip(tooltips, panel_mouse_effects, _("Clickable interface items change appearance when the mouse is moved over them."), NULL);
|
||||||
|
|
||||||
|
row++;
|
||||||
|
col = 2;
|
||||||
|
label = gtk_label_new(_("Icon opacity (hovered)"));
|
||||||
|
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
|
||||||
|
gtk_widget_show(label);
|
||||||
|
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
|
col++;
|
||||||
|
|
||||||
|
mouse_hover_icon_opacity = gtk_spin_button_new_with_range(0, 100, 1);
|
||||||
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(mouse_hover_icon_opacity), 100);
|
||||||
|
gtk_widget_show(mouse_hover_icon_opacity);
|
||||||
|
gtk_table_attach(GTK_TABLE(table), mouse_hover_icon_opacity, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
|
col++;
|
||||||
|
gtk_tooltips_set_tip(tooltips, mouse_hover_icon_opacity, _("Specifies the opacity adjustment of the icons under the mouse, in percent."), NULL);
|
||||||
|
|
||||||
|
row++;
|
||||||
|
col = 2;
|
||||||
|
label = gtk_label_new(_("Icon saturation (hovered)"));
|
||||||
|
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
|
||||||
|
gtk_widget_show(label);
|
||||||
|
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
|
col++;
|
||||||
|
|
||||||
|
mouse_hover_icon_saturation = gtk_spin_button_new_with_range(-100, 100, 1);
|
||||||
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(mouse_hover_icon_saturation), 0);
|
||||||
|
gtk_widget_show(mouse_hover_icon_saturation);
|
||||||
|
gtk_table_attach(GTK_TABLE(table), mouse_hover_icon_saturation, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
|
col++;
|
||||||
|
gtk_tooltips_set_tip(tooltips, mouse_hover_icon_saturation, _("Specifies the saturation adjustment of the icons under the mouse, in percent."), NULL);
|
||||||
|
|
||||||
|
row++;
|
||||||
|
col = 2;
|
||||||
|
label = gtk_label_new(_("Icon brightness (hovered)"));
|
||||||
|
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
|
||||||
|
gtk_widget_show(label);
|
||||||
|
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
|
col++;
|
||||||
|
|
||||||
|
mouse_hover_icon_brightness = gtk_spin_button_new_with_range(-100, 100, 1);
|
||||||
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(mouse_hover_icon_brightness), 10);
|
||||||
|
gtk_widget_show(mouse_hover_icon_brightness);
|
||||||
|
gtk_table_attach(GTK_TABLE(table), mouse_hover_icon_brightness, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
|
col++;
|
||||||
|
gtk_tooltips_set_tip(tooltips, mouse_hover_icon_brightness, _("Specifies the brightness adjustment of the icons under the mouse, in percent."), NULL);
|
||||||
|
|
||||||
|
row++;
|
||||||
|
col = 2;
|
||||||
|
label = gtk_label_new(_("Icon opacity (pressed)"));
|
||||||
|
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
|
||||||
|
gtk_widget_show(label);
|
||||||
|
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
|
col++;
|
||||||
|
|
||||||
|
mouse_pressed_icon_opacity = gtk_spin_button_new_with_range(0, 100, 1);
|
||||||
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(mouse_pressed_icon_opacity), 100);
|
||||||
|
gtk_widget_show(mouse_pressed_icon_opacity);
|
||||||
|
gtk_table_attach(GTK_TABLE(table), mouse_pressed_icon_opacity, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
|
col++;
|
||||||
|
gtk_tooltips_set_tip(tooltips, mouse_pressed_icon_opacity, _("Specifies the opacity adjustment of the icons on mouse button press, in percent."), NULL);
|
||||||
|
|
||||||
|
row++;
|
||||||
|
col = 2;
|
||||||
|
label = gtk_label_new(_("Icon saturation (pressed)"));
|
||||||
|
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
|
||||||
|
gtk_widget_show(label);
|
||||||
|
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
|
col++;
|
||||||
|
|
||||||
|
mouse_pressed_icon_saturation = gtk_spin_button_new_with_range(-100, 100, 1);
|
||||||
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(mouse_pressed_icon_saturation), 0);
|
||||||
|
gtk_widget_show(mouse_pressed_icon_saturation);
|
||||||
|
gtk_table_attach(GTK_TABLE(table), mouse_pressed_icon_saturation, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
|
col++;
|
||||||
|
gtk_tooltips_set_tip(tooltips, mouse_pressed_icon_saturation, _("Specifies the saturation adjustment of the icons on mouse button press, in percent."), NULL);
|
||||||
|
|
||||||
|
row++;
|
||||||
|
col = 2;
|
||||||
|
label = gtk_label_new(_("Icon brightness (pressed)"));
|
||||||
|
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
|
||||||
|
gtk_widget_show(label);
|
||||||
|
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
|
col++;
|
||||||
|
|
||||||
|
mouse_pressed_icon_brightness = gtk_spin_button_new_with_range(-100, 100, 1);
|
||||||
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(mouse_pressed_icon_brightness), 0);
|
||||||
|
gtk_widget_show(mouse_pressed_icon_brightness);
|
||||||
|
gtk_table_attach(GTK_TABLE(table), mouse_pressed_icon_brightness, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
|
col++;
|
||||||
|
gtk_tooltips_set_tip(tooltips, mouse_pressed_icon_brightness, _("Specifies the brightness adjustment of the icons on mouse button press, in percent."), NULL);
|
||||||
|
|
||||||
change_paragraph(parent);
|
change_paragraph(parent);
|
||||||
|
|
||||||
label = gtk_label_new(_("<b>Autohide</b>"));
|
label = gtk_label_new(_("<b>Autohide</b>"));
|
||||||
@@ -1808,11 +2188,6 @@ void load_desktop_entry(const char *file, GList **entries)
|
|||||||
*entries = g_list_append(*entries, entry);
|
*entries = g_list_append(*entries, entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint compare_strings(gconstpointer a, gconstpointer b)
|
|
||||||
{
|
|
||||||
return strnatcasecmp((const char*)a, (const char*)b);
|
|
||||||
}
|
|
||||||
|
|
||||||
void load_desktop_entries(const char *path, GList **entries)
|
void load_desktop_entries(const char *path, GList **entries)
|
||||||
{
|
{
|
||||||
GList *subdirs = NULL;
|
GList *subdirs = NULL;
|
||||||
@@ -2107,13 +2482,27 @@ void create_launcher(GtkWidget *parent)
|
|||||||
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
col++;
|
col++;
|
||||||
|
|
||||||
launcher_background = create_background_combo();
|
launcher_background = create_background_combo(_("Launcher"));
|
||||||
gtk_widget_show(launcher_background);
|
gtk_widget_show(launcher_background);
|
||||||
gtk_table_attach(GTK_TABLE(table), launcher_background, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
gtk_table_attach(GTK_TABLE(table), launcher_background, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
col++;
|
col++;
|
||||||
gtk_tooltips_set_tip(tooltips, launcher_background, _("Selects the background used to display the launcher. "
|
gtk_tooltips_set_tip(tooltips, launcher_background, _("Selects the background used to display the launcher. "
|
||||||
"Backgrounds can be edited in the Backgrounds tab."), NULL);
|
"Backgrounds can be edited in the Backgrounds tab."), NULL);
|
||||||
|
|
||||||
|
row++, col = 2;
|
||||||
|
label = gtk_label_new(_("Icon background"));
|
||||||
|
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
|
||||||
|
gtk_widget_show(label);
|
||||||
|
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
|
col++;
|
||||||
|
|
||||||
|
launcher_icon_background = create_background_combo(_("Launcher icon"));
|
||||||
|
gtk_widget_show(launcher_icon_background);
|
||||||
|
gtk_table_attach(GTK_TABLE(table), launcher_icon_background, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
|
col++;
|
||||||
|
gtk_tooltips_set_tip(tooltips, launcher_icon_background, _("Selects the background used to display the launcher icon. "
|
||||||
|
"Backgrounds can be edited in the Backgrounds tab."), NULL);
|
||||||
|
|
||||||
row++, col = 2;
|
row++, col = 2;
|
||||||
label = gtk_label_new(_("Horizontal padding"));
|
label = gtk_label_new(_("Horizontal padding"));
|
||||||
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
|
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
|
||||||
@@ -2177,6 +2566,7 @@ void create_launcher(GtkWidget *parent)
|
|||||||
col++;
|
col++;
|
||||||
|
|
||||||
launcher_icon_opacity = gtk_spin_button_new_with_range(0, 100, 1);
|
launcher_icon_opacity = gtk_spin_button_new_with_range(0, 100, 1);
|
||||||
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(launcher_icon_opacity), 100);
|
||||||
gtk_widget_show(launcher_icon_opacity);
|
gtk_widget_show(launcher_icon_opacity);
|
||||||
gtk_table_attach(GTK_TABLE(table), launcher_icon_opacity, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
gtk_table_attach(GTK_TABLE(table), launcher_icon_opacity, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
col++;
|
col++;
|
||||||
@@ -2191,6 +2581,7 @@ void create_launcher(GtkWidget *parent)
|
|||||||
col++;
|
col++;
|
||||||
|
|
||||||
launcher_icon_saturation = gtk_spin_button_new_with_range(-100, 100, 1);
|
launcher_icon_saturation = gtk_spin_button_new_with_range(-100, 100, 1);
|
||||||
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(launcher_icon_saturation), 0);
|
||||||
gtk_widget_show(launcher_icon_saturation);
|
gtk_widget_show(launcher_icon_saturation);
|
||||||
gtk_table_attach(GTK_TABLE(table), launcher_icon_saturation, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
gtk_table_attach(GTK_TABLE(table), launcher_icon_saturation, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
col++;
|
col++;
|
||||||
@@ -2205,6 +2596,7 @@ void create_launcher(GtkWidget *parent)
|
|||||||
col++;
|
col++;
|
||||||
|
|
||||||
launcher_icon_brightness = gtk_spin_button_new_with_range(-100, 100, 1);
|
launcher_icon_brightness = gtk_spin_button_new_with_range(-100, 100, 1);
|
||||||
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(launcher_icon_brightness), 0);
|
||||||
gtk_widget_show(launcher_icon_brightness);
|
gtk_widget_show(launcher_icon_brightness);
|
||||||
gtk_table_attach(GTK_TABLE(table), launcher_icon_brightness, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
gtk_table_attach(GTK_TABLE(table), launcher_icon_brightness, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
col++;
|
col++;
|
||||||
@@ -2483,7 +2875,7 @@ void create_taskbar(GtkWidget *parent)
|
|||||||
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
col++;
|
col++;
|
||||||
|
|
||||||
taskbar_active_background = create_background_combo();
|
taskbar_active_background = create_background_combo(_("Active taskbar"));
|
||||||
gtk_widget_show(taskbar_active_background);
|
gtk_widget_show(taskbar_active_background);
|
||||||
gtk_table_attach(GTK_TABLE(table), taskbar_active_background, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
gtk_table_attach(GTK_TABLE(table), taskbar_active_background, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
col++;
|
col++;
|
||||||
@@ -2497,7 +2889,7 @@ void create_taskbar(GtkWidget *parent)
|
|||||||
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
col++;
|
col++;
|
||||||
|
|
||||||
taskbar_inactive_background = create_background_combo();
|
taskbar_inactive_background = create_background_combo(_("Inactive taskbar"));
|
||||||
gtk_widget_show(taskbar_inactive_background);
|
gtk_widget_show(taskbar_inactive_background);
|
||||||
gtk_table_attach(GTK_TABLE(table), taskbar_inactive_background, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
gtk_table_attach(GTK_TABLE(table), taskbar_inactive_background, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
col++;
|
col++;
|
||||||
@@ -2617,7 +3009,7 @@ void create_taskbar(GtkWidget *parent)
|
|||||||
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
col++;
|
col++;
|
||||||
|
|
||||||
taskbar_name_active_background = create_background_combo();
|
taskbar_name_active_background = create_background_combo(_("Active desktop name"));
|
||||||
gtk_widget_show(taskbar_name_active_background);
|
gtk_widget_show(taskbar_name_active_background);
|
||||||
gtk_table_attach(GTK_TABLE(table), taskbar_name_active_background, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
gtk_table_attach(GTK_TABLE(table), taskbar_name_active_background, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
col++;
|
col++;
|
||||||
@@ -2632,7 +3024,7 @@ void create_taskbar(GtkWidget *parent)
|
|||||||
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
col++;
|
col++;
|
||||||
|
|
||||||
taskbar_name_inactive_background = create_background_combo();
|
taskbar_name_inactive_background = create_background_combo(_("Inactive desktop name"));
|
||||||
gtk_widget_show(taskbar_name_inactive_background);
|
gtk_widget_show(taskbar_name_inactive_background);
|
||||||
gtk_table_attach(GTK_TABLE(table), taskbar_name_inactive_background, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
gtk_table_attach(GTK_TABLE(table), taskbar_name_inactive_background, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
col++;
|
col++;
|
||||||
@@ -2996,6 +3388,7 @@ void create_task(GtkWidget *parent)
|
|||||||
|
|
||||||
create_task_status(notebook,
|
create_task_status(notebook,
|
||||||
_("Default style"),
|
_("Default style"),
|
||||||
|
_("Default task"),
|
||||||
&task_default_color,
|
&task_default_color,
|
||||||
&task_default_color_set,
|
&task_default_color_set,
|
||||||
&task_default_icon_opacity,
|
&task_default_icon_opacity,
|
||||||
@@ -3005,6 +3398,7 @@ void create_task(GtkWidget *parent)
|
|||||||
&task_default_background,
|
&task_default_background,
|
||||||
&task_default_background_set);
|
&task_default_background_set);
|
||||||
create_task_status(notebook,
|
create_task_status(notebook,
|
||||||
|
_("Normal task"),
|
||||||
_("Normal task"),
|
_("Normal task"),
|
||||||
&task_normal_color,
|
&task_normal_color,
|
||||||
&task_normal_color_set,
|
&task_normal_color_set,
|
||||||
@@ -3015,6 +3409,7 @@ void create_task(GtkWidget *parent)
|
|||||||
&task_normal_background,
|
&task_normal_background,
|
||||||
&task_normal_background_set);
|
&task_normal_background_set);
|
||||||
create_task_status(notebook,
|
create_task_status(notebook,
|
||||||
|
_("Active task"),
|
||||||
_("Active task"),
|
_("Active task"),
|
||||||
&task_active_color,
|
&task_active_color,
|
||||||
&task_active_color_set,
|
&task_active_color_set,
|
||||||
@@ -3025,6 +3420,7 @@ void create_task(GtkWidget *parent)
|
|||||||
&task_active_background,
|
&task_active_background,
|
||||||
&task_active_background_set);
|
&task_active_background_set);
|
||||||
create_task_status(notebook,
|
create_task_status(notebook,
|
||||||
|
_("Urgent task"),
|
||||||
_("Urgent task"),
|
_("Urgent task"),
|
||||||
&task_urgent_color,
|
&task_urgent_color,
|
||||||
&task_urgent_color_set,
|
&task_urgent_color_set,
|
||||||
@@ -3035,6 +3431,7 @@ void create_task(GtkWidget *parent)
|
|||||||
&task_urgent_background,
|
&task_urgent_background,
|
||||||
&task_urgent_background_set);
|
&task_urgent_background_set);
|
||||||
create_task_status(notebook,
|
create_task_status(notebook,
|
||||||
|
_("Iconified task"),
|
||||||
_("Iconified task"),
|
_("Iconified task"),
|
||||||
&task_iconified_color,
|
&task_iconified_color,
|
||||||
&task_iconified_color_set,
|
&task_iconified_color_set,
|
||||||
@@ -3111,6 +3508,7 @@ void task_status_toggle_button_callback(GtkWidget *widget, gpointer data)
|
|||||||
|
|
||||||
void create_task_status(GtkWidget *notebook,
|
void create_task_status(GtkWidget *notebook,
|
||||||
char *name,
|
char *name,
|
||||||
|
char *text,
|
||||||
GtkWidget **task_status_color,
|
GtkWidget **task_status_color,
|
||||||
GtkWidget **task_status_color_set,
|
GtkWidget **task_status_color_set,
|
||||||
GtkWidget **task_status_icon_opacity,
|
GtkWidget **task_status_icon_opacity,
|
||||||
@@ -3163,6 +3561,7 @@ void create_task_status(GtkWidget *notebook,
|
|||||||
gtk_table_attach(GTK_TABLE(table), label, 1, 2, 1, 2, GTK_FILL, 0, 0, 0);
|
gtk_table_attach(GTK_TABLE(table), label, 1, 2, 1, 2, GTK_FILL, 0, 0, 0);
|
||||||
|
|
||||||
*task_status_icon_opacity = gtk_spin_button_new_with_range(0, 100, 1);
|
*task_status_icon_opacity = gtk_spin_button_new_with_range(0, 100, 1);
|
||||||
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(*task_status_icon_opacity), 100);
|
||||||
gtk_widget_show(*task_status_icon_opacity);
|
gtk_widget_show(*task_status_icon_opacity);
|
||||||
gtk_table_attach(GTK_TABLE(table), *task_status_icon_opacity, 2, 3, 1, 2, GTK_FILL, 0, 0, 0);
|
gtk_table_attach(GTK_TABLE(table), *task_status_icon_opacity, 2, 3, 1, 2, GTK_FILL, 0, 0, 0);
|
||||||
gtk_tooltips_set_tip(tooltips, *task_status_icon_opacity, _("Specifies the opacity (in %) used to display the task icon."), NULL);
|
gtk_tooltips_set_tip(tooltips, *task_status_icon_opacity, _("Specifies the opacity (in %) used to display the task icon."), NULL);
|
||||||
@@ -3173,6 +3572,7 @@ void create_task_status(GtkWidget *notebook,
|
|||||||
gtk_table_attach(GTK_TABLE(table), label, 1, 2, 2, 3, GTK_FILL, 0, 0, 0);
|
gtk_table_attach(GTK_TABLE(table), label, 1, 2, 2, 3, GTK_FILL, 0, 0, 0);
|
||||||
|
|
||||||
*task_status_icon_saturation = gtk_spin_button_new_with_range(-100, 100, 1);
|
*task_status_icon_saturation = gtk_spin_button_new_with_range(-100, 100, 1);
|
||||||
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(*task_status_icon_saturation), 0);
|
||||||
gtk_widget_show(*task_status_icon_saturation);
|
gtk_widget_show(*task_status_icon_saturation);
|
||||||
gtk_table_attach(GTK_TABLE(table), *task_status_icon_saturation, 2, 3, 2, 3, GTK_FILL, 0, 0, 0);
|
gtk_table_attach(GTK_TABLE(table), *task_status_icon_saturation, 2, 3, 2, 3, GTK_FILL, 0, 0, 0);
|
||||||
gtk_tooltips_set_tip(tooltips, *task_status_icon_saturation, _("Specifies the saturation adjustment (in %) used to display the task icon."), NULL);
|
gtk_tooltips_set_tip(tooltips, *task_status_icon_saturation, _("Specifies the saturation adjustment (in %) used to display the task icon."), NULL);
|
||||||
@@ -3183,6 +3583,7 @@ void create_task_status(GtkWidget *notebook,
|
|||||||
gtk_table_attach(GTK_TABLE(table), label, 1, 2, 3, 4, GTK_FILL, 0, 0, 0);
|
gtk_table_attach(GTK_TABLE(table), label, 1, 2, 3, 4, GTK_FILL, 0, 0, 0);
|
||||||
|
|
||||||
*task_status_icon_brightness = gtk_spin_button_new_with_range(-100, 100, 1);
|
*task_status_icon_brightness = gtk_spin_button_new_with_range(-100, 100, 1);
|
||||||
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(*task_status_icon_brightness), 0);
|
||||||
gtk_widget_show(*task_status_icon_brightness);
|
gtk_widget_show(*task_status_icon_brightness);
|
||||||
gtk_table_attach(GTK_TABLE(table), *task_status_icon_brightness, 2, 3, 3, 4, GTK_FILL, 0, 0, 0);
|
gtk_table_attach(GTK_TABLE(table), *task_status_icon_brightness, 2, 3, 3, 4, GTK_FILL, 0, 0, 0);
|
||||||
gtk_tooltips_set_tip(tooltips, *task_status_icon_brightness, _("Specifies the brightness adjustment (in %) used to display the task icon."), NULL);
|
gtk_tooltips_set_tip(tooltips, *task_status_icon_brightness, _("Specifies the brightness adjustment (in %) used to display the task icon."), NULL);
|
||||||
@@ -3198,7 +3599,7 @@ void create_task_status(GtkWidget *notebook,
|
|||||||
gtk_widget_show(label);
|
gtk_widget_show(label);
|
||||||
gtk_table_attach(GTK_TABLE(table), label, 1, 2, 4, 5, GTK_FILL, 0, 0, 0);
|
gtk_table_attach(GTK_TABLE(table), label, 1, 2, 4, 5, GTK_FILL, 0, 0, 0);
|
||||||
|
|
||||||
*task_status_background = create_background_combo();
|
*task_status_background = create_background_combo(text);
|
||||||
gtk_widget_show(*task_status_background);
|
gtk_widget_show(*task_status_background);
|
||||||
gtk_table_attach(GTK_TABLE(table), *task_status_background, 2, 3, 4, 5, GTK_FILL, 0, 0, 0);
|
gtk_table_attach(GTK_TABLE(table), *task_status_background, 2, 3, 4, 5, GTK_FILL, 0, 0, 0);
|
||||||
gtk_tooltips_set_tip(tooltips, *task_status_background, _("Selects the background used to display the task. "
|
gtk_tooltips_set_tip(tooltips, *task_status_background, _("Selects the background used to display the task. "
|
||||||
@@ -3420,7 +3821,7 @@ void create_clock(GtkWidget *parent)
|
|||||||
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
col++;
|
col++;
|
||||||
|
|
||||||
clock_background = create_background_combo();
|
clock_background = create_background_combo(_("Clock"));
|
||||||
gtk_widget_show(clock_background);
|
gtk_widget_show(clock_background);
|
||||||
gtk_table_attach(GTK_TABLE(table), clock_background, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
gtk_table_attach(GTK_TABLE(table), clock_background, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
col++;
|
col++;
|
||||||
@@ -3629,7 +4030,7 @@ void create_systemtray(GtkWidget *parent)
|
|||||||
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
col++;
|
col++;
|
||||||
|
|
||||||
systray_background = create_background_combo();
|
systray_background = create_background_combo(_("Systray"));
|
||||||
gtk_widget_show(systray_background);
|
gtk_widget_show(systray_background);
|
||||||
gtk_table_attach(GTK_TABLE(table), systray_background, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
gtk_table_attach(GTK_TABLE(table), systray_background, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
col++;
|
col++;
|
||||||
@@ -3703,6 +4104,7 @@ void create_systemtray(GtkWidget *parent)
|
|||||||
col++;
|
col++;
|
||||||
|
|
||||||
systray_icon_opacity = gtk_spin_button_new_with_range(0, 100, 1);
|
systray_icon_opacity = gtk_spin_button_new_with_range(0, 100, 1);
|
||||||
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(systray_icon_opacity), 100);
|
||||||
gtk_widget_show(systray_icon_opacity);
|
gtk_widget_show(systray_icon_opacity);
|
||||||
gtk_table_attach(GTK_TABLE(table), systray_icon_opacity, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
gtk_table_attach(GTK_TABLE(table), systray_icon_opacity, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
col++;
|
col++;
|
||||||
@@ -3717,6 +4119,7 @@ void create_systemtray(GtkWidget *parent)
|
|||||||
col++;
|
col++;
|
||||||
|
|
||||||
systray_icon_saturation = gtk_spin_button_new_with_range(-100, 100, 1);
|
systray_icon_saturation = gtk_spin_button_new_with_range(-100, 100, 1);
|
||||||
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(systray_icon_saturation), 0);
|
||||||
gtk_widget_show(systray_icon_saturation);
|
gtk_widget_show(systray_icon_saturation);
|
||||||
gtk_table_attach(GTK_TABLE(table), systray_icon_saturation, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
gtk_table_attach(GTK_TABLE(table), systray_icon_saturation, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
col++;
|
col++;
|
||||||
@@ -3731,6 +4134,7 @@ void create_systemtray(GtkWidget *parent)
|
|||||||
col++;
|
col++;
|
||||||
|
|
||||||
systray_icon_brightness = gtk_spin_button_new_with_range(-100, 100, 1);
|
systray_icon_brightness = gtk_spin_button_new_with_range(-100, 100, 1);
|
||||||
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(systray_icon_brightness), 0);
|
||||||
gtk_widget_show(systray_icon_brightness);
|
gtk_widget_show(systray_icon_brightness);
|
||||||
gtk_table_attach(GTK_TABLE(table), systray_icon_brightness, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
gtk_table_attach(GTK_TABLE(table), systray_icon_brightness, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
col++;
|
col++;
|
||||||
@@ -3816,6 +4220,50 @@ void create_battery(GtkWidget *parent)
|
|||||||
|
|
||||||
change_paragraph(parent);
|
change_paragraph(parent);
|
||||||
|
|
||||||
|
label = gtk_label_new(_("<b>AC connection events</b>"));
|
||||||
|
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
|
||||||
|
gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
|
||||||
|
gtk_widget_show(label);
|
||||||
|
gtk_box_pack_start(GTK_BOX(parent), label, FALSE, FALSE, 0);
|
||||||
|
|
||||||
|
table = gtk_table_new(2, 10, FALSE);
|
||||||
|
gtk_widget_show(table);
|
||||||
|
gtk_box_pack_start(GTK_BOX(parent), table, FALSE, FALSE, 0);
|
||||||
|
gtk_table_set_row_spacings(GTK_TABLE(table), ROW_SPACING);
|
||||||
|
gtk_table_set_col_spacings(GTK_TABLE(table), COL_SPACING);
|
||||||
|
|
||||||
|
row = 0, col = 2;
|
||||||
|
label = gtk_label_new(_("AC connected command"));
|
||||||
|
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
|
||||||
|
gtk_widget_show(label);
|
||||||
|
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
|
col++;
|
||||||
|
|
||||||
|
ac_connected_cmd = gtk_entry_new();
|
||||||
|
gtk_widget_show(ac_connected_cmd);
|
||||||
|
gtk_entry_set_width_chars(GTK_ENTRY(ac_connected_cmd), 50);
|
||||||
|
gtk_table_attach(GTK_TABLE(table), ac_connected_cmd, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
|
col++;
|
||||||
|
gtk_tooltips_set_tip(tooltips, ac_connected_cmd,
|
||||||
|
_("Specifies a command that will be executed when AC is connected to the system."), NULL);
|
||||||
|
|
||||||
|
row++, col = 2;
|
||||||
|
label = gtk_label_new(_("AC disconnected command"));
|
||||||
|
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
|
||||||
|
gtk_widget_show(label);
|
||||||
|
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
|
col++;
|
||||||
|
|
||||||
|
ac_disconnected_cmd = gtk_entry_new();
|
||||||
|
gtk_widget_show(ac_disconnected_cmd);
|
||||||
|
gtk_entry_set_width_chars(GTK_ENTRY(ac_disconnected_cmd), 50);
|
||||||
|
gtk_table_attach(GTK_TABLE(table), ac_disconnected_cmd, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
|
col++;
|
||||||
|
gtk_tooltips_set_tip(tooltips, ac_disconnected_cmd,
|
||||||
|
_("Specifies a command that will be executed when AC is disconnected to the system."), NULL);
|
||||||
|
|
||||||
|
change_paragraph(parent);
|
||||||
|
|
||||||
label = gtk_label_new(_("<b>Mouse events</b>"));
|
label = gtk_label_new(_("<b>Mouse events</b>"));
|
||||||
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
|
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
|
||||||
gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
|
gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
|
||||||
@@ -3829,6 +4277,20 @@ void create_battery(GtkWidget *parent)
|
|||||||
gtk_table_set_col_spacings(GTK_TABLE(table), COL_SPACING);
|
gtk_table_set_col_spacings(GTK_TABLE(table), COL_SPACING);
|
||||||
row = 0, col = 2;
|
row = 0, col = 2;
|
||||||
|
|
||||||
|
label = gtk_label_new(_("Tooltips"));
|
||||||
|
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
|
||||||
|
gtk_widget_show(label);
|
||||||
|
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
|
col++;
|
||||||
|
|
||||||
|
battery_tooltip = gtk_check_button_new();
|
||||||
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(battery_tooltip), 1);
|
||||||
|
gtk_widget_show(battery_tooltip);
|
||||||
|
gtk_table_attach(GTK_TABLE(table), battery_tooltip, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
|
col++;
|
||||||
|
gtk_tooltips_set_tip(tooltips, battery_tooltip, _("If enabled, shows a tooltip with detailed battery information when the mouse is moved over the battery widget."), NULL);
|
||||||
|
|
||||||
|
row++, col = 2;
|
||||||
label = gtk_label_new(_("Left click command"));
|
label = gtk_label_new(_("Left click command"));
|
||||||
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
|
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
|
||||||
gtk_widget_show(label);
|
gtk_widget_show(label);
|
||||||
@@ -3924,7 +4386,7 @@ void create_battery(GtkWidget *parent)
|
|||||||
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
col++;
|
col++;
|
||||||
|
|
||||||
battery_background = create_background_combo();
|
battery_background = create_background_combo(_("Battery"));
|
||||||
gtk_widget_show(battery_background);
|
gtk_widget_show(battery_background);
|
||||||
gtk_table_attach(GTK_TABLE(table), battery_background, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
gtk_table_attach(GTK_TABLE(table), battery_background, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
col++;
|
col++;
|
||||||
@@ -4082,7 +4544,7 @@ void create_tooltip(GtkWidget *parent)
|
|||||||
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
gtk_table_attach(GTK_TABLE(table), label, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
col++;
|
col++;
|
||||||
|
|
||||||
tooltip_background = create_background_combo();
|
tooltip_background = create_background_combo(_("Tooltip"));
|
||||||
gtk_widget_show(tooltip_background);
|
gtk_widget_show(tooltip_background);
|
||||||
gtk_table_attach(GTK_TABLE(table), tooltip_background, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
gtk_table_attach(GTK_TABLE(table), tooltip_background, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||||
col++;
|
col++;
|
||||||
|
|||||||
@@ -14,6 +14,9 @@ extern GtkWidget *panel_width, *panel_height, *panel_margin_x, *panel_margin_y,
|
|||||||
extern GtkWidget *panel_wm_menu, *panel_dock, *panel_autohide, *panel_autohide_show_time, *panel_autohide_hide_time, *panel_autohide_size;
|
extern GtkWidget *panel_wm_menu, *panel_dock, *panel_autohide, *panel_autohide_show_time, *panel_autohide_hide_time, *panel_autohide_size;
|
||||||
extern GtkWidget *panel_combo_strut_policy, *panel_combo_layer, *panel_combo_width_type, *panel_combo_height_type, *panel_combo_monitor;
|
extern GtkWidget *panel_combo_strut_policy, *panel_combo_layer, *panel_combo_width_type, *panel_combo_height_type, *panel_combo_monitor;
|
||||||
extern GtkWidget *panel_window_name, *disable_transparency;
|
extern GtkWidget *panel_window_name, *disable_transparency;
|
||||||
|
extern GtkWidget *panel_mouse_effects;
|
||||||
|
extern GtkWidget *mouse_hover_icon_opacity, *mouse_hover_icon_saturation, *mouse_hover_icon_brightness;
|
||||||
|
extern GtkWidget *mouse_pressed_icon_opacity, *mouse_pressed_icon_saturation, *mouse_pressed_icon_brightness;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
itemsColName = 0,
|
itemsColName = 0,
|
||||||
@@ -95,7 +98,9 @@ extern GtkWidget *clock_background;
|
|||||||
extern GtkWidget *battery_hide_if_higher, *battery_alert_if_lower, *battery_alert_cmd;
|
extern GtkWidget *battery_hide_if_higher, *battery_alert_if_lower, *battery_alert_cmd;
|
||||||
extern GtkWidget *battery_padding_x, *battery_padding_y, *battery_font_line1, *battery_font_line2, *battery_font_color;
|
extern GtkWidget *battery_padding_x, *battery_padding_y, *battery_font_line1, *battery_font_line2, *battery_font_color;
|
||||||
extern GtkWidget *battery_background;
|
extern GtkWidget *battery_background;
|
||||||
|
extern GtkWidget *battery_tooltip;
|
||||||
extern GtkWidget *battery_left_command, *battery_mclick_command, *battery_right_command, *battery_uwheel_command, *battery_dwheel_command;
|
extern GtkWidget *battery_left_command, *battery_mclick_command, *battery_right_command, *battery_uwheel_command, *battery_dwheel_command;
|
||||||
|
extern GtkWidget *ac_connected_cmd, *ac_disconnected_cmd;
|
||||||
|
|
||||||
// systray
|
// systray
|
||||||
extern GtkWidget *systray_icon_order, *systray_padding_x, *systray_padding_y, *systray_spacing;
|
extern GtkWidget *systray_icon_order, *systray_padding_x, *systray_padding_y, *systray_spacing;
|
||||||
@@ -125,7 +130,7 @@ extern GtkWidget *launcher_apps_dirs;
|
|||||||
extern GtkWidget *launcher_icon_size, *launcher_icon_theme, *launcher_padding_x, *launcher_padding_y, *launcher_spacing;
|
extern GtkWidget *launcher_icon_size, *launcher_icon_theme, *launcher_padding_x, *launcher_padding_y, *launcher_spacing;
|
||||||
extern GtkWidget *launcher_icon_opacity, *launcher_icon_saturation, *launcher_icon_brightness;
|
extern GtkWidget *launcher_icon_opacity, *launcher_icon_saturation, *launcher_icon_brightness;
|
||||||
extern GtkWidget *margin_x, *margin_y;
|
extern GtkWidget *margin_x, *margin_y;
|
||||||
extern GtkWidget *launcher_background;
|
extern GtkWidget *launcher_background, *launcher_icon_background;
|
||||||
extern GtkWidget *startup_notifications;
|
extern GtkWidget *startup_notifications;
|
||||||
extern IconThemeWrapper *icon_theme;
|
extern IconThemeWrapper *icon_theme;
|
||||||
extern GtkWidget *launcher_tooltip;
|
extern GtkWidget *launcher_tooltip;
|
||||||
@@ -144,6 +149,15 @@ enum {
|
|||||||
bgColBorderOpacity,
|
bgColBorderOpacity,
|
||||||
bgColBorderWidth,
|
bgColBorderWidth,
|
||||||
bgColCornerRadius,
|
bgColCornerRadius,
|
||||||
|
bgColText,
|
||||||
|
bgColFillColorOver,
|
||||||
|
bgColFillOpacityOver,
|
||||||
|
bgColBorderColorOver,
|
||||||
|
bgColBorderOpacityOver,
|
||||||
|
bgColFillColorPress,
|
||||||
|
bgColFillOpacityPress,
|
||||||
|
bgColBorderColorPress,
|
||||||
|
bgColBorderOpacityPress,
|
||||||
bgNumCols
|
bgNumCols
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -151,6 +165,10 @@ extern GtkListStore *backgrounds;
|
|||||||
extern GtkWidget *current_background,
|
extern GtkWidget *current_background,
|
||||||
*background_fill_color,
|
*background_fill_color,
|
||||||
*background_border_color,
|
*background_border_color,
|
||||||
|
*background_fill_color_over,
|
||||||
|
*background_border_color_over,
|
||||||
|
*background_fill_color_press,
|
||||||
|
*background_border_color_press,
|
||||||
*background_border_width,
|
*background_border_width,
|
||||||
*background_corner_radius;
|
*background_corner_radius;
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
#include "properties.h"
|
#include "properties.h"
|
||||||
#include "properties_rw.h"
|
#include "properties_rw.h"
|
||||||
|
|
||||||
|
void finalize_bg();
|
||||||
void add_entry(char *key, char *value);
|
void add_entry(char *key, char *value);
|
||||||
void hex2gdk(char *hex, GdkColor *color);
|
void hex2gdk(char *hex, GdkColor *color);
|
||||||
void set_action(char *event, GtkWidget *combo);
|
void set_action(char *event, GtkWidget *combo);
|
||||||
@@ -22,8 +22,15 @@ int no_items_clock_enabled;
|
|||||||
int no_items_systray_enabled;
|
int no_items_systray_enabled;
|
||||||
int no_items_battery_enabled;
|
int no_items_battery_enabled;
|
||||||
|
|
||||||
|
static int num_bg;
|
||||||
|
static int read_bg_color_hover;
|
||||||
|
static int read_border_color_hover;
|
||||||
|
static int read_bg_color_press;
|
||||||
|
static int read_border_color_press;
|
||||||
|
|
||||||
void config_read_file(const char *path)
|
void config_read_file(const char *path)
|
||||||
{
|
{
|
||||||
|
num_bg = 0;
|
||||||
background_create_new();
|
background_create_new();
|
||||||
|
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
@@ -51,6 +58,8 @@ void config_read_file(const char *path)
|
|||||||
}
|
}
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
|
finalize_bg();
|
||||||
|
|
||||||
if (!config_has_panel_items) {
|
if (!config_has_panel_items) {
|
||||||
char panel_items[256];
|
char panel_items[256];
|
||||||
panel_items[0] = 0;
|
panel_items[0] = 0;
|
||||||
@@ -75,7 +84,7 @@ void config_read_file(const char *path)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void config_write_color(FILE *fp, char *name, GdkColor color, int opacity)
|
void config_write_color(FILE *fp, const char *name, GdkColor color, int opacity)
|
||||||
{
|
{
|
||||||
fprintf(fp,
|
fprintf(fp,
|
||||||
"%s = #%02x%02x%02x %d\n",
|
"%s = #%02x%02x%02x %d\n",
|
||||||
@@ -110,20 +119,42 @@ void config_write_backgrounds(FILE *fp)
|
|||||||
int fillOpacity;
|
int fillOpacity;
|
||||||
GdkColor *borderColor;
|
GdkColor *borderColor;
|
||||||
int borderOpacity;
|
int borderOpacity;
|
||||||
|
GdkColor *fillColorOver;
|
||||||
|
int fillOpacityOver;
|
||||||
|
GdkColor *borderColorOver;
|
||||||
|
int borderOpacityOver;
|
||||||
|
GdkColor *fillColorPress;
|
||||||
|
int fillOpacityPress;
|
||||||
|
GdkColor *borderColorPress;
|
||||||
|
int borderOpacityPress;
|
||||||
|
gchar *text;
|
||||||
|
|
||||||
gtk_tree_model_get(GTK_TREE_MODEL(backgrounds), &iter,
|
gtk_tree_model_get(GTK_TREE_MODEL(backgrounds), &iter,
|
||||||
bgColFillColor, &fillColor,
|
bgColFillColor, &fillColor,
|
||||||
bgColFillOpacity, &fillOpacity,
|
bgColFillOpacity, &fillOpacity,
|
||||||
bgColBorderColor, &borderColor,
|
bgColBorderColor, &borderColor,
|
||||||
bgColBorderOpacity, &borderOpacity,
|
bgColBorderOpacity, &borderOpacity,
|
||||||
|
bgColFillColorOver, &fillColorOver,
|
||||||
|
bgColFillOpacityOver, &fillOpacityOver,
|
||||||
|
bgColBorderColorOver, &borderColorOver,
|
||||||
|
bgColBorderOpacityOver, &borderOpacityOver,
|
||||||
|
bgColFillColorPress, &fillColorPress,
|
||||||
|
bgColFillOpacityPress, &fillOpacityPress,
|
||||||
|
bgColBorderColorPress, &borderColorPress,
|
||||||
|
bgColBorderOpacityPress, &borderOpacityPress,
|
||||||
bgColBorderWidth, &b,
|
bgColBorderWidth, &b,
|
||||||
bgColCornerRadius, &r,
|
bgColCornerRadius, &r,
|
||||||
|
bgColText, &text,
|
||||||
-1);
|
-1);
|
||||||
fprintf(fp, "# Background %d\n", index);
|
fprintf(fp, "# Background %d: %s\n", index, text ? text : "");
|
||||||
fprintf(fp, "rounded = %d\n", r);
|
fprintf(fp, "rounded = %d\n", r);
|
||||||
fprintf(fp, "border_width = %d\n", b);
|
fprintf(fp, "border_width = %d\n", b);
|
||||||
config_write_color(fp, "background_color", *fillColor, fillOpacity);
|
config_write_color(fp, "background_color", *fillColor, fillOpacity);
|
||||||
config_write_color(fp, "border_color", *borderColor, borderOpacity);
|
config_write_color(fp, "border_color", *borderColor, borderOpacity);
|
||||||
|
config_write_color(fp, "background_color_hover", *fillColorOver, fillOpacityOver);
|
||||||
|
config_write_color(fp, "border_color_hover", *borderColorOver, borderOpacityOver);
|
||||||
|
config_write_color(fp, "background_color_pressed", *fillColorPress, fillOpacityPress);
|
||||||
|
config_write_color(fp, "border_color_pressed", *borderColorPress, borderOpacityPress);
|
||||||
fprintf(fp, "\n");
|
fprintf(fp, "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -214,7 +245,19 @@ void config_write_panel(FILE *fp)
|
|||||||
|
|
||||||
fprintf(fp, "panel_window_name = %s\n", gtk_entry_get_text(GTK_ENTRY(panel_window_name)));
|
fprintf(fp, "panel_window_name = %s\n", gtk_entry_get_text(GTK_ENTRY(panel_window_name)));
|
||||||
fprintf(fp, "disable_transparency = %d\n", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(disable_transparency)) ? 1 : 0);
|
fprintf(fp, "disable_transparency = %d\n", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(disable_transparency)) ? 1 : 0);
|
||||||
|
fprintf(fp, "mouse_effects = %d\n", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(panel_mouse_effects)) ? 1 : 0);
|
||||||
fprintf(fp, "font_shadow = %d\n", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(font_shadow)) ? 1 : 0);
|
fprintf(fp, "font_shadow = %d\n", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(font_shadow)) ? 1 : 0);
|
||||||
|
fprintf(fp,
|
||||||
|
"mouse_hover_icon_asb = %d %d %d\n",
|
||||||
|
(int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(mouse_hover_icon_opacity)),
|
||||||
|
(int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(mouse_hover_icon_saturation)),
|
||||||
|
(int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(mouse_hover_icon_brightness)));
|
||||||
|
fprintf(fp,
|
||||||
|
"mouse_pressed_icon_asb = %d %d %d\n",
|
||||||
|
(int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(mouse_pressed_icon_opacity)),
|
||||||
|
(int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(mouse_pressed_icon_saturation)),
|
||||||
|
(int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(mouse_pressed_icon_brightness)));
|
||||||
|
|
||||||
|
|
||||||
fprintf(fp, "\n");
|
fprintf(fp, "\n");
|
||||||
}
|
}
|
||||||
@@ -466,6 +509,7 @@ void config_write_launcher(FILE *fp)
|
|||||||
(int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(launcher_padding_y)),
|
(int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(launcher_padding_y)),
|
||||||
(int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(launcher_spacing)));
|
(int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(launcher_spacing)));
|
||||||
fprintf(fp, "launcher_background_id = %d\n", gtk_combo_box_get_active(GTK_COMBO_BOX(launcher_background)));
|
fprintf(fp, "launcher_background_id = %d\n", gtk_combo_box_get_active(GTK_COMBO_BOX(launcher_background)));
|
||||||
|
fprintf(fp, "launcher_icon_background_id = %d\n", gtk_combo_box_get_active(GTK_COMBO_BOX(launcher_icon_background)));
|
||||||
fprintf(fp, "launcher_icon_size = %d\n", (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(launcher_icon_size)));
|
fprintf(fp, "launcher_icon_size = %d\n", (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(launcher_icon_size)));
|
||||||
fprintf(fp,
|
fprintf(fp,
|
||||||
"launcher_icon_asb = %d %d %d\n",
|
"launcher_icon_asb = %d %d %d\n",
|
||||||
@@ -560,6 +604,7 @@ void config_write_battery(FILE *fp)
|
|||||||
fprintf(fp, "#-------------------------------------\n");
|
fprintf(fp, "#-------------------------------------\n");
|
||||||
fprintf(fp, "# Battery\n");
|
fprintf(fp, "# Battery\n");
|
||||||
|
|
||||||
|
fprintf(fp, "battery_tooltip = %d\n", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(battery_tooltip)) ? 1 : 0);
|
||||||
fprintf(fp, "battery_low_status = %g\n", gtk_spin_button_get_value(GTK_SPIN_BUTTON(battery_alert_if_lower)));
|
fprintf(fp, "battery_low_status = %g\n", gtk_spin_button_get_value(GTK_SPIN_BUTTON(battery_alert_if_lower)));
|
||||||
fprintf(fp, "battery_low_cmd = %s\n", gtk_entry_get_text(GTK_ENTRY(battery_alert_cmd)));
|
fprintf(fp, "battery_low_cmd = %s\n", gtk_entry_get_text(GTK_ENTRY(battery_alert_cmd)));
|
||||||
fprintf(fp, "bat1_font = %s\n", gtk_font_button_get_font_name(GTK_FONT_BUTTON(battery_font_line1)));
|
fprintf(fp, "bat1_font = %s\n", gtk_font_button_get_font_name(GTK_FONT_BUTTON(battery_font_line1)));
|
||||||
@@ -582,6 +627,9 @@ void config_write_battery(FILE *fp)
|
|||||||
fprintf(fp, "battery_uwheel_command = %s\n", gtk_entry_get_text(GTK_ENTRY(battery_uwheel_command)));
|
fprintf(fp, "battery_uwheel_command = %s\n", gtk_entry_get_text(GTK_ENTRY(battery_uwheel_command)));
|
||||||
fprintf(fp, "battery_dwheel_command = %s\n", gtk_entry_get_text(GTK_ENTRY(battery_dwheel_command)));
|
fprintf(fp, "battery_dwheel_command = %s\n", gtk_entry_get_text(GTK_ENTRY(battery_dwheel_command)));
|
||||||
|
|
||||||
|
fprintf(fp, "ac_connected_cmd = %s\n", gtk_entry_get_text(GTK_ENTRY(ac_connected_cmd)));
|
||||||
|
fprintf(fp, "ac_disconnected_cmd = %s\n", gtk_entry_get_text(GTK_ENTRY(ac_disconnected_cmd)));
|
||||||
|
|
||||||
fprintf(fp, "\n");
|
fprintf(fp, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -690,6 +738,44 @@ gboolean config_is_manual(const char *path)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void finalize_bg()
|
||||||
|
{
|
||||||
|
if (num_bg > 0) {
|
||||||
|
if (!read_bg_color_hover) {
|
||||||
|
GdkColor fillColor;
|
||||||
|
gtk_color_button_get_color(GTK_COLOR_BUTTON(background_fill_color), &fillColor);
|
||||||
|
gtk_color_button_set_color(GTK_COLOR_BUTTON(background_fill_color_over), &fillColor);
|
||||||
|
int fillOpacity = gtk_color_button_get_alpha(GTK_COLOR_BUTTON(background_fill_color));
|
||||||
|
gtk_color_button_set_alpha(GTK_COLOR_BUTTON(background_fill_color_over), fillOpacity);
|
||||||
|
background_force_update();
|
||||||
|
}
|
||||||
|
if (!read_border_color_hover) {
|
||||||
|
GdkColor fillColor;
|
||||||
|
gtk_color_button_get_color(GTK_COLOR_BUTTON(background_border_color), &fillColor);
|
||||||
|
gtk_color_button_set_color(GTK_COLOR_BUTTON(background_border_color_over), &fillColor);
|
||||||
|
int fillOpacity = gtk_color_button_get_alpha(GTK_COLOR_BUTTON(background_border_color));
|
||||||
|
gtk_color_button_set_alpha(GTK_COLOR_BUTTON(background_border_color_over), fillOpacity);
|
||||||
|
background_force_update();
|
||||||
|
}
|
||||||
|
if (!read_bg_color_press) {
|
||||||
|
GdkColor fillColor;
|
||||||
|
gtk_color_button_get_color(GTK_COLOR_BUTTON(background_fill_color), &fillColor);
|
||||||
|
gtk_color_button_set_color(GTK_COLOR_BUTTON(background_fill_color_press), &fillColor);
|
||||||
|
int fillOpacity = gtk_color_button_get_alpha(GTK_COLOR_BUTTON(background_fill_color));
|
||||||
|
gtk_color_button_set_alpha(GTK_COLOR_BUTTON(background_fill_color_press), fillOpacity);
|
||||||
|
background_force_update();
|
||||||
|
}
|
||||||
|
if (!read_border_color_press) {
|
||||||
|
GdkColor fillColor;
|
||||||
|
gtk_color_button_get_color(GTK_COLOR_BUTTON(background_border_color_over), &fillColor);
|
||||||
|
gtk_color_button_set_color(GTK_COLOR_BUTTON(background_border_color_press), &fillColor);
|
||||||
|
int fillOpacity = gtk_color_button_get_alpha(GTK_COLOR_BUTTON(background_border_color_over));
|
||||||
|
gtk_color_button_set_alpha(GTK_COLOR_BUTTON(background_border_color_press), fillOpacity);
|
||||||
|
background_force_update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void add_entry(char *key, char *value)
|
void add_entry(char *key, char *value)
|
||||||
{
|
{
|
||||||
char *value1=0, *value2=0, *value3=0;
|
char *value1=0, *value2=0, *value3=0;
|
||||||
@@ -697,7 +783,13 @@ void add_entry(char *key, char *value)
|
|||||||
/* Background and border */
|
/* Background and border */
|
||||||
if (strcmp(key, "rounded") == 0) {
|
if (strcmp(key, "rounded") == 0) {
|
||||||
// 'rounded' is the first parameter => alloc a new background
|
// 'rounded' is the first parameter => alloc a new background
|
||||||
|
finalize_bg();
|
||||||
background_create_new();
|
background_create_new();
|
||||||
|
num_bg++;
|
||||||
|
read_bg_color_hover = 0;
|
||||||
|
read_border_color_hover = 0;
|
||||||
|
read_bg_color_press = 0;
|
||||||
|
read_border_color_press = 0;
|
||||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(background_corner_radius), atoi(value));
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(background_corner_radius), atoi(value));
|
||||||
background_force_update();
|
background_force_update();
|
||||||
}
|
}
|
||||||
@@ -723,6 +815,46 @@ void add_entry(char *key, char *value)
|
|||||||
gtk_color_button_set_alpha(GTK_COLOR_BUTTON(background_border_color), (alpha*65535)/100);
|
gtk_color_button_set_alpha(GTK_COLOR_BUTTON(background_border_color), (alpha*65535)/100);
|
||||||
background_force_update();
|
background_force_update();
|
||||||
}
|
}
|
||||||
|
else if (strcmp(key, "background_color_hover") == 0) {
|
||||||
|
extract_values(value, &value1, &value2, &value3);
|
||||||
|
GdkColor col;
|
||||||
|
hex2gdk(value1, &col);
|
||||||
|
gtk_color_button_set_color(GTK_COLOR_BUTTON(background_fill_color_over), &col);
|
||||||
|
int alpha = value2 ? atoi(value2) : 50;
|
||||||
|
gtk_color_button_set_alpha(GTK_COLOR_BUTTON(background_fill_color_over), (alpha*65535)/100);
|
||||||
|
background_force_update();
|
||||||
|
read_bg_color_hover = 1;
|
||||||
|
}
|
||||||
|
else if (strcmp(key, "border_color_hover") == 0) {
|
||||||
|
extract_values(value, &value1, &value2, &value3);
|
||||||
|
GdkColor col;
|
||||||
|
hex2gdk(value1, &col);
|
||||||
|
gtk_color_button_set_color(GTK_COLOR_BUTTON(background_border_color_over), &col);
|
||||||
|
int alpha = value2 ? atoi(value2) : 50;
|
||||||
|
gtk_color_button_set_alpha(GTK_COLOR_BUTTON(background_border_color_over), (alpha*65535)/100);
|
||||||
|
background_force_update();
|
||||||
|
read_border_color_hover = 1;
|
||||||
|
}
|
||||||
|
else if (strcmp(key, "background_color_pressed") == 0) {
|
||||||
|
extract_values(value, &value1, &value2, &value3);
|
||||||
|
GdkColor col;
|
||||||
|
hex2gdk(value1, &col);
|
||||||
|
gtk_color_button_set_color(GTK_COLOR_BUTTON(background_fill_color_press), &col);
|
||||||
|
int alpha = value2 ? atoi(value2) : 50;
|
||||||
|
gtk_color_button_set_alpha(GTK_COLOR_BUTTON(background_fill_color_press), (alpha*65535)/100);
|
||||||
|
background_force_update();
|
||||||
|
read_bg_color_press = 1;
|
||||||
|
}
|
||||||
|
else if (strcmp(key, "border_color_pressed") == 0) {
|
||||||
|
extract_values(value, &value1, &value2, &value3);
|
||||||
|
GdkColor col;
|
||||||
|
hex2gdk(value1, &col);
|
||||||
|
gtk_color_button_set_color(GTK_COLOR_BUTTON(background_border_color_press), &col);
|
||||||
|
int alpha = value2 ? atoi(value2) : 50;
|
||||||
|
gtk_color_button_set_alpha(GTK_COLOR_BUTTON(background_border_color_press), (alpha*65535)/100);
|
||||||
|
background_force_update();
|
||||||
|
read_border_color_press = 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Panel */
|
/* Panel */
|
||||||
else if (strcmp(key, "panel_size") == 0) {
|
else if (strcmp(key, "panel_size") == 0) {
|
||||||
@@ -836,6 +968,21 @@ void add_entry(char *key, char *value)
|
|||||||
else if (strcmp(key, "disable_transparency") == 0) {
|
else if (strcmp(key, "disable_transparency") == 0) {
|
||||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(disable_transparency), atoi(value));
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(disable_transparency), atoi(value));
|
||||||
}
|
}
|
||||||
|
else if (strcmp(key, "mouse_effects") == 0) {
|
||||||
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(panel_mouse_effects), atoi(value));
|
||||||
|
}
|
||||||
|
else if (strcmp(key, "mouse_hover_icon_asb") == 0) {
|
||||||
|
extract_values(value, &value1, &value2, &value3);
|
||||||
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(mouse_hover_icon_opacity), atoi(value1));
|
||||||
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(mouse_hover_icon_saturation), atoi(value2));
|
||||||
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(mouse_hover_icon_brightness), atoi(value3));
|
||||||
|
}
|
||||||
|
else if (strcmp(key, "mouse_pressed_icon_asb") == 0) {
|
||||||
|
extract_values(value, &value1, &value2, &value3);
|
||||||
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(mouse_pressed_icon_opacity), atoi(value1));
|
||||||
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(mouse_pressed_icon_saturation), atoi(value2));
|
||||||
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(mouse_pressed_icon_brightness), atoi(value3));
|
||||||
|
}
|
||||||
else if (strcmp(key, "font_shadow") == 0) {
|
else if (strcmp(key, "font_shadow") == 0) {
|
||||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(font_shadow), atoi(value));
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(font_shadow), atoi(value));
|
||||||
}
|
}
|
||||||
@@ -902,8 +1049,9 @@ void add_entry(char *key, char *value)
|
|||||||
// Obsolete option
|
// Obsolete option
|
||||||
config_has_battery = 1;
|
config_has_battery = 1;
|
||||||
config_battery_enabled = atoi(value);
|
config_battery_enabled = atoi(value);
|
||||||
}
|
} else if (strcmp(key, "battery_tooltip") == 0) {
|
||||||
else if (strcmp(key, "battery_low_status") == 0) {
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(battery_tooltip), atoi(value));
|
||||||
|
} else if (strcmp(key, "battery_low_status") == 0) {
|
||||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(battery_alert_if_lower), atof(value));
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(battery_alert_if_lower), atof(value));
|
||||||
}
|
}
|
||||||
else if (strcmp(key, "battery_low_cmd") == 0) {
|
else if (strcmp(key, "battery_low_cmd") == 0) {
|
||||||
@@ -956,6 +1104,12 @@ void add_entry(char *key, char *value)
|
|||||||
else if (strcmp(key, "battery_dwheel_command") == 0) {
|
else if (strcmp(key, "battery_dwheel_command") == 0) {
|
||||||
gtk_entry_set_text(GTK_ENTRY(battery_dwheel_command), value);
|
gtk_entry_set_text(GTK_ENTRY(battery_dwheel_command), value);
|
||||||
}
|
}
|
||||||
|
else if (strcmp(key, "ac_connected_cmd") == 0) {
|
||||||
|
gtk_entry_set_text(GTK_ENTRY(ac_connected_cmd), value);
|
||||||
|
}
|
||||||
|
else if (strcmp(key, "ac_disconnected_cmd") == 0) {
|
||||||
|
gtk_entry_set_text(GTK_ENTRY(ac_disconnected_cmd), value);
|
||||||
|
}
|
||||||
|
|
||||||
/* Clock */
|
/* Clock */
|
||||||
else if (strcmp(key, "time1_format") == 0) {
|
else if (strcmp(key, "time1_format") == 0) {
|
||||||
@@ -1313,6 +1467,10 @@ void add_entry(char *key, char *value)
|
|||||||
int id = background_index_safe(atoi(value));
|
int id = background_index_safe(atoi(value));
|
||||||
gtk_combo_box_set_active(GTK_COMBO_BOX(launcher_background), id);
|
gtk_combo_box_set_active(GTK_COMBO_BOX(launcher_background), id);
|
||||||
}
|
}
|
||||||
|
else if (strcmp(key, "launcher_icon_background_id") == 0) {
|
||||||
|
int id = background_index_safe(atoi(value));
|
||||||
|
gtk_combo_box_set_active(GTK_COMBO_BOX(launcher_icon_background), id);
|
||||||
|
}
|
||||||
else if (strcmp(key, "launcher_icon_size") == 0) {
|
else if (strcmp(key, "launcher_icon_size") == 0) {
|
||||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(launcher_icon_size), atoi(value));
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(launcher_icon_size), atoi(value));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -304,7 +304,7 @@ void tooltip_copy_text(Area* area)
|
|||||||
{
|
{
|
||||||
free(g_tooltip.tooltip_text);
|
free(g_tooltip.tooltip_text);
|
||||||
if (area && area->_get_tooltip_text)
|
if (area && area->_get_tooltip_text)
|
||||||
g_tooltip.tooltip_text = strdup(area->_get_tooltip_text(area));
|
g_tooltip.tooltip_text = area->_get_tooltip_text(area);
|
||||||
else
|
else
|
||||||
g_tooltip.tooltip_text = NULL;
|
g_tooltip.tooltip_text = NULL;
|
||||||
g_tooltip.area = area;
|
g_tooltip.area = area;
|
||||||
|
|||||||
171
src/util/area.c
171
src/util/area.c
@@ -71,13 +71,15 @@
|
|||||||
*
|
*
|
||||||
************************************************************/
|
************************************************************/
|
||||||
|
|
||||||
|
Area *mouse_over_area = NULL;
|
||||||
|
|
||||||
void init_rendering(void *obj, int pos)
|
void init_rendering(void *obj, int pos)
|
||||||
{
|
{
|
||||||
Area *a = (Area*)obj;
|
Area *a = (Area*)obj;
|
||||||
|
|
||||||
// initialize fixed position/size
|
// initialize fixed position/size
|
||||||
GList *l;
|
GList *l;
|
||||||
for (l = a->list; l ; l = l->next) {
|
for (l = a->children; l ; l = l->next) {
|
||||||
Area *child = ((Area*)l->data);
|
Area *child = ((Area*)l->data);
|
||||||
if (panel_horizontal) {
|
if (panel_horizontal) {
|
||||||
child->posy = pos + a->bg->border.width + a->paddingy;
|
child->posy = pos + a->bg->border.width + a->paddingy;
|
||||||
@@ -116,7 +118,7 @@ void size_by_content (Area *a)
|
|||||||
|
|
||||||
// children node are resized before its parent
|
// children node are resized before its parent
|
||||||
GList *l;
|
GList *l;
|
||||||
for (l = a->list; l ; l = l->next)
|
for (l = a->children; l ; l = l->next)
|
||||||
size_by_content(l->data);
|
size_by_content(l->data);
|
||||||
|
|
||||||
// calculate area's size
|
// calculate area's size
|
||||||
@@ -150,20 +152,20 @@ void size_by_layout (Area *a, int level)
|
|||||||
if (a->_resize) {
|
if (a->_resize) {
|
||||||
a->_resize(a);
|
a->_resize(a);
|
||||||
// resize childs with SIZE_BY_LAYOUT
|
// resize childs with SIZE_BY_LAYOUT
|
||||||
for (l = a->list; l ; l = l->next) {
|
for (l = a->children; l ; l = l->next) {
|
||||||
Area *child = ((Area*)l->data);
|
Area *child = ((Area*)l->data);
|
||||||
if (child->size_mode == SIZE_BY_LAYOUT && child->list)
|
if (child->size_mode == SIZE_BY_LAYOUT && child->children)
|
||||||
child->resize = 1;
|
child->resize = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// update position of children
|
// update position of children
|
||||||
if (a->list) {
|
if (a->children) {
|
||||||
if (a->alignment == ALIGN_LEFT) {
|
if (a->alignment == ALIGN_LEFT) {
|
||||||
int pos = (panel_horizontal ? a->posx : a->posy) + a->bg->border.width + a->paddingxlr;
|
int pos = (panel_horizontal ? a->posx : a->posy) + a->bg->border.width + a->paddingxlr;
|
||||||
|
|
||||||
for (l = a->list; l ; l = l->next) {
|
for (l = a->children; l ; l = l->next) {
|
||||||
Area *child = ((Area*)l->data);
|
Area *child = ((Area*)l->data);
|
||||||
if (!child->on_screen)
|
if (!child->on_screen)
|
||||||
continue;
|
continue;
|
||||||
@@ -189,7 +191,7 @@ void size_by_layout (Area *a, int level)
|
|||||||
} else if (a->alignment == ALIGN_RIGHT) {
|
} else if (a->alignment == ALIGN_RIGHT) {
|
||||||
int pos = (panel_horizontal ? a->posx + a->width : a->posy + a->height) - a->bg->border.width - a->paddingxlr;
|
int pos = (panel_horizontal ? a->posx + a->width : a->posy + a->height) - a->bg->border.width - a->paddingxlr;
|
||||||
|
|
||||||
for (l = g_list_last(a->list); l ; l = l->prev) {
|
for (l = g_list_last(a->children); l ; l = l->prev) {
|
||||||
Area *child = ((Area*)l->data);
|
Area *child = ((Area*)l->data);
|
||||||
if (!child->on_screen)
|
if (!child->on_screen)
|
||||||
continue;
|
continue;
|
||||||
@@ -218,19 +220,19 @@ void size_by_layout (Area *a, int level)
|
|||||||
|
|
||||||
int children_size = 0;
|
int children_size = 0;
|
||||||
|
|
||||||
for (l = a->list; l ; l = l->next) {
|
for (l = a->children; l ; l = l->next) {
|
||||||
Area *child = ((Area*)l->data);
|
Area *child = ((Area*)l->data);
|
||||||
if (!child->on_screen)
|
if (!child->on_screen)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
children_size += panel_horizontal ? child->width : child->height;
|
children_size += panel_horizontal ? child->width : child->height;
|
||||||
children_size += (l == a->list) ? 0 : a->paddingx;
|
children_size += (l == a->children) ? 0 : a->paddingx;
|
||||||
}
|
}
|
||||||
|
|
||||||
int pos = (panel_horizontal ? a->posx : a->posy) + a->bg->border.width + a->paddingxlr;
|
int pos = (panel_horizontal ? a->posx : a->posy) + a->bg->border.width + a->paddingxlr;
|
||||||
pos += ((panel_horizontal ? a->width : a->height) - children_size) / 2;
|
pos += ((panel_horizontal ? a->width : a->height) - children_size) / 2;
|
||||||
|
|
||||||
for (l = a->list; l ; l = l->next) {
|
for (l = a->children; l ; l = l->next) {
|
||||||
Area *child = ((Area*)l->data);
|
Area *child = ((Area*)l->data);
|
||||||
if (!child->on_screen)
|
if (!child->on_screen)
|
||||||
continue;
|
continue;
|
||||||
@@ -275,7 +277,7 @@ void refresh (Area *a)
|
|||||||
a->redraw = 0;
|
a->redraw = 0;
|
||||||
// force redraw of child
|
// force redraw of child
|
||||||
//GList *l;
|
//GList *l;
|
||||||
//for (l = a->list ; l ; l = l->next)
|
//for (l = a->children ; l ; l = l->next)
|
||||||
//((Area*)l->data)->redraw = 1;
|
//((Area*)l->data)->redraw = 1;
|
||||||
|
|
||||||
//printf("draw area posx %d, width %d\n", a->posx, a->width);
|
//printf("draw area posx %d, width %d\n", a->posx, a->width);
|
||||||
@@ -288,8 +290,8 @@ void refresh (Area *a)
|
|||||||
|
|
||||||
// and then refresh child object
|
// and then refresh child object
|
||||||
GList *l;
|
GList *l;
|
||||||
for (l = a->list; l ; l = l->next)
|
for (l = a->children; l ; l = l->next)
|
||||||
refresh(l->data);
|
refresh((Area*)l->data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -302,7 +304,7 @@ int resize_by_layout(void *obj, int maximum_size)
|
|||||||
// detect free size for SIZE_BY_LAYOUT's Area
|
// detect free size for SIZE_BY_LAYOUT's Area
|
||||||
size = a->width - (2 * (a->paddingxlr + a->bg->border.width));
|
size = a->width - (2 * (a->paddingxlr + a->bg->border.width));
|
||||||
GList *l;
|
GList *l;
|
||||||
for (l = a->list ; l ; l = l->next) {
|
for (l = a->children ; l ; l = l->next) {
|
||||||
child = (Area*)l->data;
|
child = (Area*)l->data;
|
||||||
if (child->on_screen && child->size_mode == SIZE_BY_CONTENT) {
|
if (child->on_screen && child->size_mode == SIZE_BY_CONTENT) {
|
||||||
size -= child->width;
|
size -= child->width;
|
||||||
@@ -326,7 +328,7 @@ int resize_by_layout(void *obj, int maximum_size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// resize SIZE_BY_LAYOUT objects
|
// resize SIZE_BY_LAYOUT objects
|
||||||
for (l = a->list ; l ; l = l->next) {
|
for (l = a->children ; l ; l = l->next) {
|
||||||
child = (Area*)l->data;
|
child = (Area*)l->data;
|
||||||
if (child->on_screen && child->size_mode == SIZE_BY_LAYOUT) {
|
if (child->on_screen && child->size_mode == SIZE_BY_LAYOUT) {
|
||||||
old_width = child->width;
|
old_width = child->width;
|
||||||
@@ -344,7 +346,7 @@ int resize_by_layout(void *obj, int maximum_size)
|
|||||||
// detect free size for SIZE_BY_LAYOUT's Area
|
// detect free size for SIZE_BY_LAYOUT's Area
|
||||||
size = a->height - (2 * (a->paddingxlr + a->bg->border.width));
|
size = a->height - (2 * (a->paddingxlr + a->bg->border.width));
|
||||||
GList *l;
|
GList *l;
|
||||||
for (l = a->list ; l ; l = l->next) {
|
for (l = a->children ; l ; l = l->next) {
|
||||||
child = (Area*)l->data;
|
child = (Area*)l->data;
|
||||||
if (child->on_screen && child->size_mode == SIZE_BY_CONTENT) {
|
if (child->on_screen && child->size_mode == SIZE_BY_CONTENT) {
|
||||||
size -= child->height;
|
size -= child->height;
|
||||||
@@ -367,7 +369,7 @@ int resize_by_layout(void *obj, int maximum_size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// resize SIZE_BY_LAYOUT objects
|
// resize SIZE_BY_LAYOUT objects
|
||||||
for (l = a->list ; l ; l = l->next) {
|
for (l = a->children ; l ; l = l->next) {
|
||||||
child = (Area*)l->data;
|
child = (Area*)l->data;
|
||||||
if (child->on_screen && child->size_mode == SIZE_BY_LAYOUT) {
|
if (child->on_screen && child->size_mode == SIZE_BY_LAYOUT) {
|
||||||
int old_height = child->height;
|
int old_height = child->height;
|
||||||
@@ -390,8 +392,8 @@ void set_redraw (Area *a)
|
|||||||
a->redraw = 1;
|
a->redraw = 1;
|
||||||
|
|
||||||
GList *l;
|
GList *l;
|
||||||
for (l = a->list ; l ; l = l->next)
|
for (l = a->children ; l ; l = l->next)
|
||||||
set_redraw(l->data);
|
set_redraw((Area*)l->data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void hide(Area *a)
|
void hide(Area *a)
|
||||||
@@ -443,69 +445,50 @@ void draw (Area *a)
|
|||||||
|
|
||||||
void draw_background (Area *a, cairo_t *c)
|
void draw_background (Area *a, cairo_t *c)
|
||||||
{
|
{
|
||||||
if (a->bg->back.alpha > 0.0) {
|
if (a->bg->back.alpha > 0.0 ||
|
||||||
|
(panel_config.mouse_effects && (a->mouse_over_effect || a->mouse_press_effect))) {
|
||||||
//printf(" draw_background (%d %d) RGBA (%lf, %lf, %lf, %lf)\n", a->posx, a->posy, pix->back.color[0], pix->back.color[1], pix->back.color[2], pix->back.alpha);
|
//printf(" draw_background (%d %d) RGBA (%lf, %lf, %lf, %lf)\n", a->posx, a->posy, pix->back.color[0], pix->back.color[1], pix->back.color[2], pix->back.alpha);
|
||||||
|
if (a->mouse_state == MOUSE_OVER)
|
||||||
|
cairo_set_source_rgba(c, a->bg->back_hover.color[0], a->bg->back_hover.color[1], a->bg->back_hover.color[2], a->bg->back_hover.alpha);
|
||||||
|
else if (a->mouse_state == MOUSE_DOWN)
|
||||||
|
cairo_set_source_rgba(c, a->bg->back_pressed.color[0], a->bg->back_pressed.color[1], a->bg->back_pressed.color[2], a->bg->back_pressed.alpha);
|
||||||
|
else
|
||||||
|
cairo_set_source_rgba(c, a->bg->back.color[0], a->bg->back.color[1], a->bg->back.color[2], a->bg->back.alpha);
|
||||||
draw_rect(c, a->bg->border.width, a->bg->border.width, a->width-(2.0 * a->bg->border.width), a->height-(2.0*a->bg->border.width), a->bg->border.rounded - a->bg->border.width/1.571);
|
draw_rect(c, a->bg->border.width, a->bg->border.width, a->width-(2.0 * a->bg->border.width), a->height-(2.0*a->bg->border.width), a->bg->border.rounded - a->bg->border.width/1.571);
|
||||||
cairo_set_source_rgba(c, a->bg->back.color[0], a->bg->back.color[1], a->bg->back.color[2], a->bg->back.alpha);
|
|
||||||
cairo_fill(c);
|
cairo_fill(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (a->bg->border.width > 0 && a->bg->border.alpha > 0.0) {
|
if (a->bg->border.width > 0) {
|
||||||
cairo_set_line_width (c, a->bg->border.width);
|
cairo_set_line_width (c, a->bg->border.width);
|
||||||
|
|
||||||
// draw border inside (x, y, width, height)
|
// draw border inside (x, y, width, height)
|
||||||
|
if (a->mouse_state == MOUSE_OVER)
|
||||||
|
cairo_set_source_rgba(c, a->bg->border_hover.color[0], a->bg->border_hover.color[1], a->bg->border_hover.color[2], a->bg->border_hover.alpha);
|
||||||
|
else if (a->mouse_state == MOUSE_DOWN)
|
||||||
|
cairo_set_source_rgba(c, a->bg->border_pressed.color[0], a->bg->border_pressed.color[1], a->bg->border_pressed.color[2], a->bg->border_pressed.alpha);
|
||||||
|
else
|
||||||
|
cairo_set_source_rgba(c, a->bg->border.color[0], a->bg->border.color[1], a->bg->border.color[2], a->bg->border.alpha);
|
||||||
draw_rect(c, a->bg->border.width/2.0, a->bg->border.width/2.0, a->width - a->bg->border.width, a->height - a->bg->border.width, a->bg->border.rounded);
|
draw_rect(c, a->bg->border.width/2.0, a->bg->border.width/2.0, a->width - a->bg->border.width, a->height - a->bg->border.width, a->bg->border.rounded);
|
||||||
/*
|
|
||||||
// convert : radian = degre * M_PI/180
|
|
||||||
// definir le degrade dans un carre de (0,0) (100,100)
|
|
||||||
// ensuite ce degrade est extrapoler selon le ratio width/height
|
|
||||||
// dans repere (0, 0) (100, 100)
|
|
||||||
double X0, Y0, X1, Y1, degre;
|
|
||||||
// x = X * (a->width / 100), y = Y * (a->height / 100)
|
|
||||||
double x0, y0, x1, y1;
|
|
||||||
X0 = 0;
|
|
||||||
Y0 = 100;
|
|
||||||
X1 = 100;
|
|
||||||
Y1 = 0;
|
|
||||||
degre = 45;
|
|
||||||
// et ensuite faire la changement d'unite du repere
|
|
||||||
// car ce qui doit reste inchangee est les traits et pas la direction
|
|
||||||
|
|
||||||
// il faut d'abord appliquer une rotation de 90 (et -180 si l'angle est superieur a 180)
|
cairo_stroke(c);
|
||||||
// ceci peut etre applique une fois pour toute au depart
|
|
||||||
// ensuite calculer l'angle dans le nouveau repare
|
|
||||||
// puis faire une rotation de 90
|
|
||||||
x0 = X0 * ((double)a->width / 100);
|
|
||||||
x1 = X1 * ((double)a->width / 100);
|
|
||||||
y0 = Y0 * ((double)a->height / 100);
|
|
||||||
y1 = Y1 * ((double)a->height / 100);
|
|
||||||
|
|
||||||
x0 = X0 * ((double)a->height / 100);
|
|
||||||
x1 = X1 * ((double)a->height / 100);
|
|
||||||
y0 = Y0 * ((double)a->width / 100);
|
|
||||||
y1 = Y1 * ((double)a->width / 100);
|
|
||||||
|
|
||||||
cairo_pattern_t *linpat;
|
|
||||||
linpat = cairo_pattern_create_linear (x0, y0, x1, y1);
|
|
||||||
cairo_pattern_add_color_stop_rgba (linpat, 0, a->border.color[0], a->border.color[1], a->border.color[2], a->border.alpha);
|
|
||||||
cairo_pattern_add_color_stop_rgba (linpat, 1, a->border.color[0], a->border.color[1], a->border.color[2], 0);
|
|
||||||
cairo_set_source (c, linpat);
|
|
||||||
*/
|
|
||||||
cairo_set_source_rgba (c, a->bg->border.color[0], a->bg->border.color[1], a->bg->border.color[2], a->bg->border.alpha);
|
|
||||||
|
|
||||||
cairo_stroke (c);
|
|
||||||
//cairo_pattern_destroy (linpat);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void remove_area (Area *a)
|
void remove_area (void *a)
|
||||||
{
|
{
|
||||||
Area *parent = (Area*)a->parent;
|
Area *area = (Area*)a;
|
||||||
|
Area *parent = (Area*)area->parent;
|
||||||
|
|
||||||
parent->list = g_list_remove(parent->list, a);
|
if (parent) {
|
||||||
set_redraw (parent);
|
parent->children = g_list_remove(parent->children, area);
|
||||||
|
parent->resize = 1;
|
||||||
|
set_redraw(parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mouse_over_area == a) {
|
||||||
|
mouse_out();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -513,7 +496,7 @@ void add_area (Area *a)
|
|||||||
{
|
{
|
||||||
Area *parent = (Area*)a->parent;
|
Area *parent = (Area*)a->parent;
|
||||||
|
|
||||||
parent->list = g_list_append(parent->list, a);
|
parent->children = g_list_append(parent->children, a);
|
||||||
set_redraw (parent);
|
set_redraw (parent);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -525,17 +508,20 @@ void free_area (Area *a)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
GList *l0;
|
GList *l0;
|
||||||
for (l0 = a->list; l0 ; l0 = l0->next)
|
for (l0 = a->children; l0 ; l0 = l0->next)
|
||||||
free_area (l0->data);
|
free_area (l0->data);
|
||||||
|
|
||||||
if (a->list) {
|
if (a->children) {
|
||||||
g_list_free(a->list);
|
g_list_free(a->children);
|
||||||
a->list = 0;
|
a->children = 0;
|
||||||
}
|
}
|
||||||
if (a->pix) {
|
if (a->pix) {
|
||||||
XFreePixmap (server.dsp, a->pix);
|
XFreePixmap (server.dsp, a->pix);
|
||||||
a->pix = 0;
|
a->pix = 0;
|
||||||
}
|
}
|
||||||
|
if (mouse_over_area == a) {
|
||||||
|
mouse_over_area = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -566,3 +552,48 @@ void clear_pixmap(Pixmap p, int x, int y, int w, int h)
|
|||||||
XRenderFillRectangle(server.dsp, PictOpSrc, pict, &col, x, y, w, h);
|
XRenderFillRectangle(server.dsp, PictOpSrc, pict, &col, x, y, w, h);
|
||||||
XRenderFreePicture(server.dsp, pict);
|
XRenderFreePicture(server.dsp, pict);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void mouse_over(Area *area, int pressed)
|
||||||
|
{
|
||||||
|
if (mouse_over_area == area && !area)
|
||||||
|
return;
|
||||||
|
|
||||||
|
MouseState new_state = MOUSE_NORMAL;
|
||||||
|
if (area) {
|
||||||
|
if (!pressed) {
|
||||||
|
new_state = area->mouse_over_effect ? MOUSE_OVER : MOUSE_NORMAL;
|
||||||
|
} else {
|
||||||
|
new_state = area->mouse_press_effect
|
||||||
|
? MOUSE_DOWN
|
||||||
|
: area->mouse_over_effect
|
||||||
|
? MOUSE_OVER
|
||||||
|
: MOUSE_NORMAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mouse_over_area == area && mouse_over_area->mouse_state == new_state)
|
||||||
|
return;
|
||||||
|
mouse_out();
|
||||||
|
if (new_state == MOUSE_NORMAL)
|
||||||
|
return;
|
||||||
|
mouse_over_area = area;
|
||||||
|
|
||||||
|
mouse_over_area->mouse_state = new_state;
|
||||||
|
set_redraw(mouse_over_area);
|
||||||
|
panel_refresh = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void mouse_out()
|
||||||
|
{
|
||||||
|
if (!mouse_over_area)
|
||||||
|
return;
|
||||||
|
mouse_over_area->mouse_state = MOUSE_NORMAL;
|
||||||
|
set_redraw(mouse_over_area);
|
||||||
|
panel_refresh = 1;
|
||||||
|
mouse_over_area = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void init_background(Background *bg)
|
||||||
|
{
|
||||||
|
memset(bg, 0, sizeof(Background));
|
||||||
|
}
|
||||||
|
|||||||
@@ -44,6 +44,10 @@ typedef struct
|
|||||||
{
|
{
|
||||||
Color back;
|
Color back;
|
||||||
Border border;
|
Border border;
|
||||||
|
Color back_hover;
|
||||||
|
Color border_hover;
|
||||||
|
Color back_pressed;
|
||||||
|
Color border_pressed;
|
||||||
} Background;
|
} Background;
|
||||||
|
|
||||||
|
|
||||||
@@ -53,6 +57,13 @@ typedef struct
|
|||||||
enum { SIZE_BY_LAYOUT, SIZE_BY_CONTENT };
|
enum { SIZE_BY_LAYOUT, SIZE_BY_CONTENT };
|
||||||
enum { ALIGN_LEFT = 0, ALIGN_CENTER = 1, ALIGN_RIGHT = 2 };
|
enum { ALIGN_LEFT = 0, ALIGN_CENTER = 1, ALIGN_RIGHT = 2 };
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
MOUSE_NORMAL = 0,
|
||||||
|
MOUSE_OVER = 1,
|
||||||
|
MOUSE_DOWN = 2
|
||||||
|
} MouseState;
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
// coordinate relative to panel window
|
// coordinate relative to panel window
|
||||||
int posx, posy;
|
int posx, posy;
|
||||||
@@ -62,7 +73,7 @@ typedef struct {
|
|||||||
Background *bg;
|
Background *bg;
|
||||||
|
|
||||||
// list of child : Area object
|
// list of child : Area object
|
||||||
GList *list;
|
GList *children;
|
||||||
|
|
||||||
// object visible on screen.
|
// object visible on screen.
|
||||||
// An object (like systray) could be enabled but hidden (because no tray icon).
|
// An object (like systray) could be enabled but hidden (because no tray icon).
|
||||||
@@ -83,6 +94,10 @@ typedef struct {
|
|||||||
// panel
|
// panel
|
||||||
void *panel;
|
void *panel;
|
||||||
|
|
||||||
|
int mouse_over_effect;
|
||||||
|
int mouse_press_effect;
|
||||||
|
MouseState mouse_state;
|
||||||
|
|
||||||
// each object can overwrite following function
|
// each object can overwrite following function
|
||||||
void (*_draw_foreground)(void *obj, cairo_t *c);
|
void (*_draw_foreground)(void *obj, cairo_t *c);
|
||||||
// update area's content and update size (width/heith).
|
// update area's content and update size (width/heith).
|
||||||
@@ -91,9 +106,12 @@ typedef struct {
|
|||||||
// after pos/size changed, the rendering engine will call _on_change_layout(Area*)
|
// after pos/size changed, the rendering engine will call _on_change_layout(Area*)
|
||||||
int on_changed;
|
int on_changed;
|
||||||
void (*_on_change_layout)(void *obj);
|
void (*_on_change_layout)(void *obj);
|
||||||
const char* (*_get_tooltip_text)(void *obj);
|
// returns allocated string, that must be free'd after usage
|
||||||
|
char* (*_get_tooltip_text)(void *obj);
|
||||||
} Area;
|
} Area;
|
||||||
|
|
||||||
|
void init_background(Background *bg);
|
||||||
|
|
||||||
// on startup, initialize fixed pos/size
|
// on startup, initialize fixed pos/size
|
||||||
void init_rendering(void *obj, int pos);
|
void init_rendering(void *obj, int pos);
|
||||||
|
|
||||||
@@ -117,7 +135,7 @@ void show(Area *a);
|
|||||||
void draw (Area *a);
|
void draw (Area *a);
|
||||||
void draw_background (Area *a, cairo_t *c);
|
void draw_background (Area *a, cairo_t *c);
|
||||||
|
|
||||||
void remove_area (Area *a);
|
void remove_area (void *a);
|
||||||
void add_area (Area *a);
|
void add_area (Area *a);
|
||||||
void free_area (Area *a);
|
void free_area (Area *a);
|
||||||
|
|
||||||
@@ -126,5 +144,9 @@ void draw_rect(cairo_t *c, double x, double y, double w, double h, double r);
|
|||||||
|
|
||||||
// clear pixmap with transparent color
|
// clear pixmap with transparent color
|
||||||
void clear_pixmap(Pixmap p, int x, int y, int w, int h);
|
void clear_pixmap(Pixmap p, int x, int y, int w, int h);
|
||||||
|
|
||||||
|
void mouse_over(Area *area, int pressed);
|
||||||
|
void mouse_out();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -28,9 +28,14 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
#include <glib/gstdio.h>
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "../server.h"
|
#include "../server.h"
|
||||||
|
#include <sys/wait.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_RSVG
|
||||||
|
#include <librsvg/rsvg.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void copy_file(const char *pathSrc, const char *pathDest)
|
void copy_file(const char *pathSrc, const char *pathDest)
|
||||||
@@ -455,3 +460,67 @@ void draw_text(PangoLayout *layout, cairo_t *c, int posx, int posy, Color *color
|
|||||||
cairo_move_to (c, posx, posy);
|
cairo_move_to (c, posx, posy);
|
||||||
pango_cairo_show_layout (c, layout);
|
pango_cairo_show_layout (c, layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Imlib_Image load_image(const char *path, int cached)
|
||||||
|
{
|
||||||
|
Imlib_Image image;
|
||||||
|
#ifdef HAVE_RSVG
|
||||||
|
if (cached) {
|
||||||
|
image = imlib_load_image_immediately(path);
|
||||||
|
} else {
|
||||||
|
image = imlib_load_image_immediately_without_cache(path);
|
||||||
|
}
|
||||||
|
if (!image && g_str_has_suffix(path, ".svg")) {
|
||||||
|
char suffix[128];
|
||||||
|
sprintf(suffix, "tmpimage-%d.png", getpid());
|
||||||
|
// We fork here because librsvg allocates memory like crazy
|
||||||
|
pid_t pid = fork();
|
||||||
|
if (pid == 0) {
|
||||||
|
// Child
|
||||||
|
GError* err = NULL;
|
||||||
|
RsvgHandle* svg = rsvg_handle_new_from_file(path, &err);
|
||||||
|
|
||||||
|
if (err != NULL) {
|
||||||
|
fprintf(stderr, "Could not load svg image!: %s", err->message);
|
||||||
|
g_error_free(err);
|
||||||
|
} else {
|
||||||
|
gchar *name = g_build_filename(g_get_user_config_dir(), "tint2", suffix, NULL);
|
||||||
|
GdkPixbuf *pixbuf = rsvg_handle_get_pixbuf(svg);
|
||||||
|
gdk_pixbuf_save(pixbuf, name, "png", NULL, NULL);
|
||||||
|
}
|
||||||
|
exit(0);
|
||||||
|
} else {
|
||||||
|
// Parent
|
||||||
|
waitpid(pid, 0, 0);
|
||||||
|
gchar *name = g_build_filename(g_get_user_config_dir(), "tint2", suffix, NULL);
|
||||||
|
image = imlib_load_image_immediately_without_cache(name);
|
||||||
|
g_remove(name);
|
||||||
|
g_free(name);
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
if (cached) {
|
||||||
|
image = imlib_load_image_immediately(path);
|
||||||
|
} else {
|
||||||
|
image = imlib_load_image_immediately_without_cache(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
|
||||||
|
Imlib_Image adjust_icon(Imlib_Image original, int alpha, int saturation, int brightness)
|
||||||
|
{
|
||||||
|
if (!original)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
imlib_context_set_image(original);
|
||||||
|
Imlib_Image copy = imlib_clone_image();
|
||||||
|
|
||||||
|
imlib_context_set_image(copy);
|
||||||
|
imlib_image_set_has_alpha(1);
|
||||||
|
DATA32* data = imlib_image_get_data();
|
||||||
|
adjust_asb(data, imlib_image_get_width(), imlib_image_get_height(), alpha, (float)saturation/100, (float)brightness/100);
|
||||||
|
imlib_image_put_back_data(data);
|
||||||
|
return copy;
|
||||||
|
}
|
||||||
|
|||||||
@@ -20,15 +20,15 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
void fxfree(void** ptr){
|
void fxfree(void** ptr){
|
||||||
if(*ptr){
|
if (*ptr){
|
||||||
free(*ptr);
|
free(*ptr);
|
||||||
*ptr=NULL;
|
*ptr=NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FXint fxmalloc(void** ptr,unsigned long size){
|
FXint fxmalloc(void** ptr,unsigned long size){
|
||||||
*ptr=NULL;
|
*ptr=NULL;
|
||||||
if(size!=0){
|
if (size!=0){
|
||||||
if((*ptr=malloc(size))==NULL) return FALSE;
|
if ((*ptr=malloc(size))==NULL) return FALSE;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -74,5 +74,9 @@ void render_image(Drawable d, int x, int y);
|
|||||||
|
|
||||||
void draw_text(PangoLayout *layout, cairo_t *c, int posx, int posy, Color *color, int font_shadow);
|
void draw_text(PangoLayout *layout, cairo_t *c, int posx, int posy, Color *color, int font_shadow);
|
||||||
|
|
||||||
|
Imlib_Image load_image(const char *path, int cached);
|
||||||
|
|
||||||
|
Imlib_Image adjust_icon(Imlib_Image original, int alpha, int saturation, int brightness);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
202
src/util/uevent.c
Normal file
202
src/util/uevent.c
Normal file
@@ -0,0 +1,202 @@
|
|||||||
|
/**************************************************************************
|
||||||
|
*
|
||||||
|
* Linux Kernel uevent handler
|
||||||
|
*
|
||||||
|
* Copyright (C) 2015 Sebastian Reichel <sre@ring0.de>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License version 2
|
||||||
|
* or any later version as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
#ifdef ENABLE_UEVENT
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include <linux/types.h>
|
||||||
|
#include <linux/netlink.h>
|
||||||
|
|
||||||
|
#include "common.h"
|
||||||
|
#include "uevent.h"
|
||||||
|
|
||||||
|
static int ueventfd = -1;
|
||||||
|
static struct sockaddr_nl nls;
|
||||||
|
static GList *notifiers = NULL;
|
||||||
|
|
||||||
|
static const char* has_prefix(const char *str, const char *end, const char *prefix, size_t prefixlen) {
|
||||||
|
if ((end-str) < prefixlen)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if (!memcmp(str, prefix, prefixlen))
|
||||||
|
return str + prefixlen;
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define HAS_CONST_PREFIX(str,end,prefix) has_prefix((str),end,prefix,sizeof(prefix)-1)
|
||||||
|
|
||||||
|
static void uevent_param_free(gpointer data) {
|
||||||
|
struct uevent_parameter *param = data;
|
||||||
|
free(param->key);
|
||||||
|
free(param->val);
|
||||||
|
free(param);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void uevent_free(struct uevent *ev) {
|
||||||
|
free(ev->path);
|
||||||
|
free(ev->subsystem);
|
||||||
|
g_list_free_full(ev->params, uevent_param_free);
|
||||||
|
free(ev);
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct uevent *uevent_new(char *buffer, int size) {
|
||||||
|
struct uevent *ev;
|
||||||
|
const char* s = buffer;
|
||||||
|
const char* end = s + size;
|
||||||
|
gboolean first = TRUE;
|
||||||
|
|
||||||
|
if (size == 0)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
ev = calloc(1, sizeof(*ev));
|
||||||
|
if (!ev)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
/* ensure nul termination required by strlen() */
|
||||||
|
buffer[size-1] = '\0';
|
||||||
|
|
||||||
|
for (; s < end; s += strlen(s) + 1) {
|
||||||
|
if (first) {
|
||||||
|
const char *p = strchr(s, '@');
|
||||||
|
if (!p) {
|
||||||
|
/* error: kernel events contain @ */
|
||||||
|
/* triggered by udev events, though */
|
||||||
|
free(ev);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
ev->path = strdup(p+1);
|
||||||
|
first = FALSE;
|
||||||
|
} else {
|
||||||
|
const char* val;
|
||||||
|
if ((val = HAS_CONST_PREFIX(s, end, "ACTION=")) != NULL) {
|
||||||
|
if (!strcmp(val, "add"))
|
||||||
|
ev->action = UEVENT_ADD;
|
||||||
|
else if (!strcmp(val, "remove"))
|
||||||
|
ev->action = UEVENT_REMOVE;
|
||||||
|
else if (!strcmp(val, "change"))
|
||||||
|
ev->action = UEVENT_CHANGE;
|
||||||
|
else
|
||||||
|
ev->action = UEVENT_UNKNOWN;
|
||||||
|
} else if ((val = HAS_CONST_PREFIX(s, end, "SEQNUM=")) != NULL) {
|
||||||
|
ev->sequence = atoi(val);
|
||||||
|
} else if ((val = HAS_CONST_PREFIX(s, end, "SUBSYSTEM=")) != NULL) {
|
||||||
|
ev->subsystem = strdup(val);
|
||||||
|
} else {
|
||||||
|
val = strchr(s, '=');
|
||||||
|
if (val) {
|
||||||
|
struct uevent_parameter *param = malloc(sizeof(*param));
|
||||||
|
if (param) {
|
||||||
|
param->key = strndup(s, val-s);
|
||||||
|
param->val = strdup(val+1);
|
||||||
|
ev->params = g_list_append(ev->params, param);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ev;
|
||||||
|
}
|
||||||
|
|
||||||
|
void uevent_register_notifier(struct uevent_notify *nb) {
|
||||||
|
notifiers = g_list_append(notifiers, nb);
|
||||||
|
}
|
||||||
|
|
||||||
|
void uevent_unregister_notifier(struct uevent_notify *nb) {
|
||||||
|
GList *l = notifiers;
|
||||||
|
|
||||||
|
while (l != NULL) {
|
||||||
|
GList *next = l->next;
|
||||||
|
struct uevent_notify *lnb = l->data;
|
||||||
|
|
||||||
|
if (memcmp(nb, lnb, sizeof(struct uevent_notify)) == 0)
|
||||||
|
notifiers = g_list_delete_link(notifiers, l);
|
||||||
|
|
||||||
|
l = next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void uevent_handler() {
|
||||||
|
struct uevent *ev;
|
||||||
|
char buf[512];
|
||||||
|
GList *l;
|
||||||
|
|
||||||
|
if (ueventfd < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
int len = recv(ueventfd, buf, sizeof(buf), MSG_DONTWAIT);
|
||||||
|
if (len < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ev = uevent_new(buf, len);
|
||||||
|
if (ev) {
|
||||||
|
for (l = notifiers; l != NULL; l = l->next) {
|
||||||
|
struct uevent_notify *nb = l->data;
|
||||||
|
|
||||||
|
if (!(ev->action & nb->action))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (nb->subsystem && strcmp(ev->subsystem, nb->subsystem))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
nb->cb(ev, nb->userdata);
|
||||||
|
}
|
||||||
|
|
||||||
|
uevent_free(ev);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int uevent_init() {
|
||||||
|
/* Open hotplug event netlink socket */
|
||||||
|
memset(&nls,0,sizeof(struct sockaddr_nl));
|
||||||
|
nls.nl_family = AF_NETLINK;
|
||||||
|
nls.nl_pid = getpid();
|
||||||
|
nls.nl_groups = -1;
|
||||||
|
|
||||||
|
/* open socket */
|
||||||
|
ueventfd = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT);
|
||||||
|
if (ueventfd < 0) {
|
||||||
|
fprintf(stderr, "Error: socket open failed\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Listen to netlink socket */
|
||||||
|
if (bind(ueventfd, (void *)&nls, sizeof(struct sockaddr_nl))) {
|
||||||
|
fprintf(stderr, "Bind failed\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("Kernel uevent interface initialized...\n");
|
||||||
|
|
||||||
|
return ueventfd;
|
||||||
|
}
|
||||||
|
|
||||||
|
void uevent_cleanup() {
|
||||||
|
if (ueventfd >= 0)
|
||||||
|
close(ueventfd);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
70
src/util/uevent.h
Normal file
70
src/util/uevent.h
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
/**************************************************************************
|
||||||
|
*
|
||||||
|
* Linux Kernel uevent handler
|
||||||
|
*
|
||||||
|
* Copyright (C) 2015 Sebastian Reichel <sre@ring0.de>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License version 2
|
||||||
|
* or any later version as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
#ifndef UEVENT_H
|
||||||
|
#define UEVENT_H
|
||||||
|
|
||||||
|
enum uevent_action {
|
||||||
|
UEVENT_UNKNOWN = 0x01,
|
||||||
|
UEVENT_ADD = 0x02,
|
||||||
|
UEVENT_REMOVE = 0x04,
|
||||||
|
UEVENT_CHANGE = 0x08,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct uevent_parameter {
|
||||||
|
char *key;
|
||||||
|
char *val;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct uevent {
|
||||||
|
char *path;
|
||||||
|
enum uevent_action action;
|
||||||
|
int sequence;
|
||||||
|
char *subsystem;
|
||||||
|
GList *params;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct uevent_notify {
|
||||||
|
int action; /* bitfield */
|
||||||
|
char *subsystem; /* NULL => any */
|
||||||
|
void *userdata;
|
||||||
|
|
||||||
|
void (*cb)(struct uevent *e, void *userdata);
|
||||||
|
};
|
||||||
|
|
||||||
|
#if ENABLE_UEVENT
|
||||||
|
int uevent_init();
|
||||||
|
void uevent_cleanup();
|
||||||
|
void uevent_handler();
|
||||||
|
|
||||||
|
void uevent_register_notifier(struct uevent_notify *nb);
|
||||||
|
void uevent_unregister_notifier(struct uevent_notify *nb);
|
||||||
|
#else
|
||||||
|
static inline int uevent_init() {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void uevent_cleanup() { }
|
||||||
|
static inline void uevent_handler() { }
|
||||||
|
|
||||||
|
static inline void uevent_register_notifier(struct uevent_notify *nb) { }
|
||||||
|
static inline void uevent_unregister_notifier(struct uevent_notify *nb) { }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -321,41 +321,29 @@ gulong *get_best_icon (gulong *data, int icon_count, int num, int *iw, int *ih,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void get_text_size(PangoFontDescription *font, int *height_ink, int *height, int panel_height, char *text, int len)
|
void get_text_size2(PangoFontDescription *font,
|
||||||
|
int *height_ink,
|
||||||
|
int *height,
|
||||||
|
int *width,
|
||||||
|
int panel_height,
|
||||||
|
int panel_width,
|
||||||
|
char *text,
|
||||||
|
int len,
|
||||||
|
PangoWrapMode wrap,
|
||||||
|
PangoEllipsizeMode ellipsis)
|
||||||
{
|
{
|
||||||
PangoRectangle rect_ink, rect;
|
PangoRectangle rect_ink, rect;
|
||||||
|
|
||||||
Pixmap pmap = XCreatePixmap (server.dsp, server.root_win, panel_height, panel_height, server.depth);
|
Pixmap pmap = XCreatePixmap (server.dsp, server.root_win, panel_height, panel_width, server.depth);
|
||||||
|
|
||||||
cairo_surface_t *cs = cairo_xlib_surface_create (server.dsp, pmap, server.visual, panel_height, panel_height);
|
cairo_surface_t *cs = cairo_xlib_surface_create (server.dsp, pmap, server.visual, panel_height, panel_width);
|
||||||
cairo_t *c = cairo_create (cs);
|
|
||||||
|
|
||||||
PangoLayout *layout = pango_cairo_create_layout (c);
|
|
||||||
pango_layout_set_font_description (layout, font);
|
|
||||||
pango_layout_set_text (layout, text, len);
|
|
||||||
|
|
||||||
pango_layout_get_pixel_extents(layout, &rect_ink, &rect);
|
|
||||||
*height_ink = rect_ink.height;
|
|
||||||
*height = rect.height;
|
|
||||||
//printf("dimension : %d - %d\n", rect_ink.height, rect.height);
|
|
||||||
|
|
||||||
g_object_unref (layout);
|
|
||||||
cairo_destroy (c);
|
|
||||||
cairo_surface_destroy (cs);
|
|
||||||
XFreePixmap (server.dsp, pmap);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void get_text_size2(PangoFontDescription *font, int *height_ink, int *height, int *width, int panel_height, int panel_with, char *text, int len)
|
|
||||||
{
|
|
||||||
PangoRectangle rect_ink, rect;
|
|
||||||
|
|
||||||
Pixmap pmap = XCreatePixmap (server.dsp, server.root_win, panel_height, panel_height, server.depth);
|
|
||||||
|
|
||||||
cairo_surface_t *cs = cairo_xlib_surface_create (server.dsp, pmap, server.visual, panel_height, panel_with);
|
|
||||||
cairo_t *c = cairo_create (cs);
|
cairo_t *c = cairo_create (cs);
|
||||||
|
|
||||||
PangoLayout *layout = pango_cairo_create_layout (c);
|
PangoLayout *layout = pango_cairo_create_layout (c);
|
||||||
|
pango_layout_set_width(layout, panel_width * PANGO_SCALE);
|
||||||
|
pango_layout_set_height(layout, panel_height * PANGO_SCALE);
|
||||||
|
pango_layout_set_wrap(layout, wrap);
|
||||||
|
pango_layout_set_ellipsize(layout, ellipsis);
|
||||||
pango_layout_set_font_description (layout, font);
|
pango_layout_set_font_description (layout, font);
|
||||||
pango_layout_set_text (layout, text, len);
|
pango_layout_set_text (layout, text, len);
|
||||||
|
|
||||||
|
|||||||
@@ -33,8 +33,16 @@ void windows_set_desktop (Window win, int desktop);
|
|||||||
int window_get_monitor (Window win);
|
int window_get_monitor (Window win);
|
||||||
Window window_get_active ();
|
Window window_get_active ();
|
||||||
|
|
||||||
void get_text_size(PangoFontDescription *font, int *height_ink, int *height, int panel_height, char *text, int len);
|
void get_text_size2(PangoFontDescription *font,
|
||||||
void get_text_size2(PangoFontDescription *font, int *height_ink, int *height, int *width, int panel_height, int panel_with, char *text, int len);
|
int *height_ink,
|
||||||
|
int *height,
|
||||||
|
int *width,
|
||||||
|
int panel_height,
|
||||||
|
int panel_with,
|
||||||
|
char *text,
|
||||||
|
int len,
|
||||||
|
PangoWrapMode wrap,
|
||||||
|
PangoEllipsizeMode ellipsis);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -2,3 +2,5 @@
|
|||||||
#define HAVE_RSVG 1
|
#define HAVE_RSVG 1
|
||||||
#define HAVE_SN 1
|
#define HAVE_SN 1
|
||||||
#define ENABLE_BATTERY 1
|
#define ENABLE_BATTERY 1
|
||||||
|
#define ENABLE_UEVENT 1
|
||||||
|
#define GETTEXT_PACKAGE
|
||||||
|
|||||||
@@ -53,6 +53,6 @@ Comment=Lightweight panel
|
|||||||
Comment[fr]=Panel léger
|
Comment[fr]=Panel léger
|
||||||
Comment[pl]=Lekki panel
|
Comment[pl]=Lekki panel
|
||||||
Exec=tint2
|
Exec=tint2
|
||||||
Icon=taskbar
|
Icon=tint2
|
||||||
Terminal=false
|
Terminal=false
|
||||||
Categories=System;
|
Categories=System;
|
||||||
@@ -151,3 +151,12 @@ src/tint2conf/po/tint2conf.pot
|
|||||||
src/freespace/freespace.c
|
src/freespace/freespace.c
|
||||||
src/freespace/freespace.h
|
src/freespace/freespace.h
|
||||||
src/tint2conf/po/readme.txt
|
src/tint2conf/po/readme.txt
|
||||||
|
src/battery/linux.c
|
||||||
|
src/battery/battery.c
|
||||||
|
src/battery/battery.h
|
||||||
|
src/battery/dummy.c
|
||||||
|
src/battery/freebsd.c
|
||||||
|
src/battery/linux.c
|
||||||
|
src/battery/openbsd.c
|
||||||
|
src/util/uevent.c
|
||||||
|
src/util/uevent.h
|
||||||
|
|||||||
Reference in New Issue
Block a user