Compare commits
76 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0bd49f4227 | ||
|
|
580c3e765f | ||
|
|
7dc24b8ee6 | ||
|
|
6e6dff2ca3 | ||
|
|
3e03e81dbf | ||
|
|
9150a180fa | ||
|
|
7b6ce97940 | ||
|
|
d398795202 | ||
|
|
5f82ef4d3b | ||
|
|
d1b959818e | ||
|
|
219b24cbdb | ||
|
|
7b36910be7 | ||
|
|
4656f7fc94 | ||
|
|
1dcf9c676d | ||
|
|
9768b326aa | ||
|
|
b608cd5960 | ||
|
|
fc7aa2d342 | ||
|
|
3000740213 | ||
|
|
c5c8786363 | ||
|
|
c8250e5200 | ||
|
|
5a08d028ce | ||
|
|
6c3ec392e8 | ||
|
|
e665efb3a0 | ||
|
|
d79b48e3f7 | ||
|
|
9af0f83c89 | ||
|
|
b62138beca | ||
|
|
0c54c36c71 | ||
|
|
9b6d68f966 | ||
|
|
d36d2a5e0b | ||
|
|
e13a03ff74 | ||
|
|
c66f9a0fd4 | ||
|
|
38ef80637f | ||
|
|
7f9ac5c584 | ||
|
|
856ac5d821 | ||
|
|
3811929a6e | ||
|
|
85a97a9cab | ||
|
|
f5236f1d21 | ||
|
|
b0f172a8e1 | ||
|
|
71abe9a7e1 | ||
|
|
b4677426a4 | ||
|
|
745108dc6d | ||
|
|
448feae732 | ||
|
|
3b5ecb631d | ||
|
|
50e6278327 | ||
|
|
4dfe411bf4 | ||
|
|
5a9dc31fbb | ||
|
|
734af1c025 | ||
|
|
1000cbf491 | ||
|
|
df241dfd89 | ||
|
|
a2f02194ee | ||
|
|
fcbc006e43 | ||
|
|
edbf9f4437 | ||
|
|
e8eae27029 | ||
|
|
c4d1614cc3 | ||
|
|
8f40060583 | ||
|
|
46e386a6f8 | ||
|
|
805693f67f | ||
|
|
08c13c10c8 | ||
|
|
f72a7b88ce | ||
|
|
5c54fcb55c | ||
|
|
2f95d31092 | ||
|
|
0a77293f7d | ||
|
|
b038b58015 | ||
|
|
2d57168905 | ||
|
|
1d28475a0c | ||
|
|
7c70ae365e | ||
|
|
6ce441ecf1 | ||
|
|
995a257b2c | ||
|
|
354f679d72 | ||
|
|
e103918050 | ||
|
|
f18345ede6 | ||
|
|
4ab996e796 | ||
|
|
0668e722b6 | ||
|
|
67057adeaf | ||
|
|
e4ced531ad | ||
|
|
7bdae24ddf |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,2 +1,3 @@
|
||||
build
|
||||
*.user
|
||||
version.h
|
||||
|
||||
1
AUTHORS
1
AUTHORS
@@ -22,6 +22,7 @@ Contributors:
|
||||
Xico Atelo : startup notifications
|
||||
Craig Oakes : WM flags, issue tracker organization
|
||||
Jeff Blake (https://gitlab.com/u/berkley4) : more mouse event handlers
|
||||
Vladimir <vladimir-csp@yandex.ru> : translations, bug reports
|
||||
|
||||
Translations:
|
||||
Bosnian:
|
||||
|
||||
@@ -3,7 +3,7 @@ cmake_minimum_required( VERSION 2.6 )
|
||||
|
||||
option( ENABLE_BATTERY "Enable battery status plugin" ON )
|
||||
option( ENABLE_TINT2CONF "Enable tint2conf build, a GTK+2 theme configurator for tint2" ON )
|
||||
option( ENABLE_EXAMPLES "Install additional tin2rc examples" ON )
|
||||
option( ENABLE_EXTRA_THEMES "Install additional tint2 themes" ON )
|
||||
option( ENABLE_RSVG "Rsvg support (launcher only)" ON )
|
||||
option( ENABLE_SN "Startup notification support" ON )
|
||||
option( ENABLE_ASAN "Build tint2 with AddressSanitizer" OFF )
|
||||
@@ -85,7 +85,7 @@ include_directories( ${PROJECT_BINARY_DIR}
|
||||
src/launcher
|
||||
src/tooltip
|
||||
src/util
|
||||
src/execplugin
|
||||
src/execplugin
|
||||
src/freespace
|
||||
${X11_INCLUDE_DIRS}
|
||||
${PANGOCAIRO_INCLUDE_DIRS}
|
||||
@@ -112,12 +112,13 @@ set( SOURCES src/config.c
|
||||
src/taskbar/taskbar.c
|
||||
src/taskbar/taskbarname.c
|
||||
src/tooltip/tooltip.c
|
||||
src/execplugin/execplugin.c
|
||||
src/execplugin/execplugin.c
|
||||
src/freespace/freespace.c
|
||||
src/util/area.c
|
||||
src/util/common.c
|
||||
src/util/strnatcmp.c
|
||||
src/util/timer.c
|
||||
src/util/cache.c
|
||||
src/util/window.c )
|
||||
|
||||
if( ENABLE_BATTERY )
|
||||
@@ -241,11 +242,10 @@ install( TARGETS tint2 DESTINATION bin )
|
||||
install( FILES tint2.svg DESTINATION ${DATADIR}/icons/hicolor/scalable/apps )
|
||||
install( FILES tint2.desktop DESTINATION ${DATADIR}/applications )
|
||||
install( CODE "execute_process(COMMAND gtk-update-icon-cache -f -t ${DATADIR}/icons/hicolor WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX})" )
|
||||
install( FILES sample/tint2rc DESTINATION ${SYSCONFDIR}/xdg/tint2 )
|
||||
install( FILES themes/tint2rc DESTINATION ${SYSCONFDIR}/xdg/tint2 )
|
||||
install( FILES default_icon.png DESTINATION ${DATADIR}/tint2 )
|
||||
install( FILES AUTHORS ChangeLog README.md DESTINATION ${DOCDIR} )
|
||||
install( FILES doc/tint2.1 DESTINATION ${MANDIR}/man1 )
|
||||
if( ENABLE_EXAMPLES )
|
||||
file( GLOB SAMPLEFILES sample/*.tint2rc )
|
||||
install( FILES ${SAMPLEFILES} DESTINATION ${DATADIR}/tint2 )
|
||||
endif( ENABLE_EXAMPLES )
|
||||
if( ENABLE_EXTRA_THEMES )
|
||||
add_subdirectory(themes)
|
||||
endif( ENABLE_EXTRA_THEMES )
|
||||
|
||||
38
ChangeLog
38
ChangeLog
@@ -1,3 +1,41 @@
|
||||
2016-03-25 0.12.8
|
||||
- Major changes (see details below):
|
||||
- Icon cache and lazy icon theme loading to improve performance in tint2 and tint2conf
|
||||
- Extra tint2rc themes are installed to /usr/share/tint2 and available in tint2conf
|
||||
- Tint2conf GUI improvements
|
||||
- Config options with changed behavior:
|
||||
- The launcher now also allows launcher_item_app entries without a full path.
|
||||
In this case the .desktop file is searched in the standard application directories (issue #565).
|
||||
- If the panel size is given as a percentage and a non-zero margin is also specified,
|
||||
the size is now computed as a fraction of the available size (i.e. monitor size - margin).
|
||||
Before it was computed as a fraction of the monitor size first, then the margin was subtracted from the value, which
|
||||
was not intuitive (issue #559).
|
||||
- Fixes:
|
||||
- Taskbar icons are now resized correctly for certain geometries (issue #560)
|
||||
- Fix get_version.sh so that it returns the correct version when .git is missing
|
||||
- Fix build on powerpc
|
||||
- Temporary files are now created in /tmp
|
||||
- The XDG paths are now used in the icon and application lookup in addition to the hardcoded defaults
|
||||
- Brigtness adjustments no longer distort colors
|
||||
- Fixed race in sorting systray icons by name
|
||||
- Fixed desktop entry parsing (issue #570)
|
||||
- tint2conf:
|
||||
- Applications are now sorted correctly
|
||||
- Avoid duplicate icon themes due to symlinks
|
||||
- Avoid loading desktop files marked as NoDisplay
|
||||
- Enhancements:
|
||||
- Launcher icon paths are now cached, which greatly improves loading time for tint2 and tint2conf.
|
||||
The correct icon should be found even if you change the icon theme or install a new theme.
|
||||
If this is not the case, delete the file ~/.cache/tint2/icon.cache, restart tint2 and please file a bug report
|
||||
indicating the application name and the icon theme name.
|
||||
- Fallback icon themes are loaded lazily to speed up tint2 and tint2conf startup
|
||||
- A better Name and GenericName is used in the tint2 and tint2conf .desktop files
|
||||
- tint2conf:
|
||||
- Allows selection of themes from /usr/share
|
||||
- Menu reorganization (thanks @Vladimir-csp for feedback)
|
||||
- Icon themes are now sorted in the displayed list
|
||||
- Updated ru translation (thanks @Vladimir-csp)
|
||||
|
||||
2016-01-29 0.12.7
|
||||
- Fixes:
|
||||
- Fix crash caused by race when reading inconsistent values for _NET_CURRENT_DESKTOP and _NET_NUMBER_OF_DESKTOPS
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# New stable release: 0.12.7
|
||||
Changes: https://gitlab.com/o9000/tint2/blob/0.12.7/ChangeLog
|
||||
# New stable release: 0.12.8
|
||||
Changes: https://gitlab.com/o9000/tint2/blob/0.12.8/ChangeLog
|
||||
|
||||
Documentation: https://gitlab.com/o9000/tint2/wikis/Configure
|
||||
|
||||
@@ -7,7 +7,7 @@ Try it out with (see also [dependencies](https://gitlab.com/o9000/tint2/wikis/In
|
||||
```
|
||||
git clone https://gitlab.com/o9000/tint2.git
|
||||
cd tint2
|
||||
git checkout 0.12.7
|
||||
git checkout 0.12.8
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..
|
||||
|
||||
@@ -3,34 +3,43 @@
|
||||
MAJOR=0.12
|
||||
DIRTY=""
|
||||
|
||||
git update-index -q --ignore-submodules --refresh
|
||||
# Disallow unstaged changes in the working tree
|
||||
if ! git diff-files --quiet --ignore-submodules --
|
||||
if git status 1>/dev/null 2>/dev/null
|
||||
then
|
||||
if [ "$1" = "--strict" ]
|
||||
git update-index -q --ignore-submodules --refresh
|
||||
# Disallow unstaged changes in the working tree
|
||||
if ! git diff-files --quiet --ignore-submodules --
|
||||
then
|
||||
echo >&2 "Error: there are unstaged changes."
|
||||
git diff-files --name-status -r --ignore-submodules -- >&2
|
||||
exit 1
|
||||
else
|
||||
DIRTY="-dirty"
|
||||
if [ "$1" = "--strict" ]
|
||||
then
|
||||
echo >&2 "Error: there are unstaged changes."
|
||||
git diff-files --name-status -r --ignore-submodules -- >&2
|
||||
exit 1
|
||||
else
|
||||
DIRTY="-dirty"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Disallow uncommitted changes in the index
|
||||
if ! git diff-index --cached --quiet HEAD --ignore-submodules --
|
||||
then
|
||||
if [ "$1" = "--strict" ]
|
||||
then
|
||||
echo >&2 "Error: there are uncommitted changes."
|
||||
git diff-index --cached --name-status -r --ignore-submodules HEAD -- >&2
|
||||
exit 1
|
||||
else
|
||||
DIRTY="-dirty"
|
||||
fi
|
||||
fi
|
||||
VERSION=$(git describe --exact-match 2>/dev/null || echo "$MAJOR-git$(git show -s --pretty=format:%ci | cut -d ' ' -f 1 | tr -d '-').$(git show -s --pretty=format:%h)")$DIRTY
|
||||
else
|
||||
VERSION=$(head -n 1 ChangeLog | cut -d ' ' -f 2)
|
||||
if [ $VERSION = "master" ]
|
||||
then
|
||||
VERSION=$VERSION-$(head -n 1 ChangeLog | cut -d ' ' -f 1)
|
||||
fi
|
||||
fi
|
||||
|
||||
# Disallow uncommitted changes in the index
|
||||
if ! git diff-index --cached --quiet HEAD --ignore-submodules --
|
||||
then
|
||||
if [ "$1" = "--strict" ]
|
||||
then
|
||||
echo >&2 "Error: there are uncommitted changes."
|
||||
git diff-index --cached --name-status -r --ignore-submodules HEAD -- >&2
|
||||
exit 1
|
||||
else
|
||||
DIRTY="-dirty"
|
||||
fi
|
||||
fi
|
||||
|
||||
VERSION=$(git describe --exact-match 2>/dev/null || echo "$MAJOR-git$(git show -s --pretty=format:%cI.%h | tr -d ':' | tr -d '-' | tr '.' '-' | sed 's/T[0-9\+]*//g')")$DIRTY
|
||||
VERSION=$(echo "$VERSION" | sed 's/^v//')
|
||||
|
||||
echo '#define VERSION_STRING "'$VERSION'"' > version.h
|
||||
|
||||
75
packaging/make_ubuntu.sh
Executable file
75
packaging/make_ubuntu.sh
Executable file
@@ -0,0 +1,75 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -x
|
||||
|
||||
rm -rf tint2* 2>/dev/null || true
|
||||
|
||||
if [ ! -z "$1" ]
|
||||
then
|
||||
MINOR="$1"
|
||||
else
|
||||
MINOR="1"
|
||||
fi
|
||||
|
||||
# Get version (and check that the repository is clean)
|
||||
VERSION=$(../get_version.sh --strict)
|
||||
if [ ! $? -eq 0 ]
|
||||
then
|
||||
echo >&2 "Error: get_version.sh failed!"
|
||||
exit 1
|
||||
fi
|
||||
rm -f version.h
|
||||
VERSION=$(git describe --exact-match 2>/dev/null)
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
VERSION=$(echo "$VERSION" | sed 's/^v//')
|
||||
REPO="tint2"
|
||||
else
|
||||
VERSION="$(git show -s --pretty=format:%cI.%ct.%h | tr -d ':' | tr -d '-' | tr '.' '-' | sed 's/T[0-9\+]*//g').$MINOR"
|
||||
REPO="tint2-git"
|
||||
fi
|
||||
|
||||
# Export repository contents to source directory
|
||||
DIR=tint2-$VERSION
|
||||
echo "Making release $DIR"
|
||||
|
||||
pushd .
|
||||
cd ..
|
||||
git checkout-index --prefix=packaging/$DIR/ -a
|
||||
popd
|
||||
|
||||
# Update version file in source directory
|
||||
rm -f $DIR/make_release.sh
|
||||
echo "echo \"#define VERSION_STRING \\\"$VERSION\\\"\" > version.h" > $DIR/get_version.sh
|
||||
|
||||
# Copy the debian files into the source directory
|
||||
cp -r ubuntu $DIR/debian
|
||||
|
||||
for DISTRO in precise trusty wily xenial
|
||||
do
|
||||
# Cleanup from previous builds
|
||||
rm -rf tint2_$VERSION-*
|
||||
|
||||
# Update debian package changelog if necessary
|
||||
echo -e "tint2 ($VERSION-$DISTRO-1) $DISTRO; urgency=medium\n\n$(git log --pretty=format:' * %h %an (%ci) %s %d')\n -- o9000 <mrovi9000@gmail.com> $(date -R)\n" > $DIR/debian/changelog
|
||||
|
||||
# Create source tarball
|
||||
ARCHIVE=tint2_$VERSION-$DISTRO.orig.tar.gz
|
||||
rm -rf $ARCHIVE
|
||||
tar -czf $ARCHIVE $DIR
|
||||
|
||||
# Build package
|
||||
KEY=$(gpg --list-secret-keys | awk '/^sec/ { print $2 }' | cut -d / -f 2)
|
||||
|
||||
pushd .
|
||||
cd $DIR
|
||||
debuild -S -k$KEY
|
||||
popd
|
||||
|
||||
# Upload package
|
||||
dput ppa:o9000/$REPO tint2_$VERSION-$DISTRO-1_source.changes
|
||||
done
|
||||
|
||||
# Cleanup
|
||||
rm -rf $DIR $ARCHIVE
|
||||
rm -rf tint2_$VERSION-*
|
||||
212
packaging/ubuntu/changelog
Normal file
212
packaging/ubuntu/changelog
Normal file
@@ -0,0 +1,212 @@
|
||||
tint2 (0.12.7-1) unstable; urgency=medium
|
||||
|
||||
* New upstream release
|
||||
* Update Debian Standards Version to 3.9.7
|
||||
* Drop -dbg package (Debian will build -dbgsym package automatically)
|
||||
|
||||
-- Sebastian Reichel <sre@debian.org> Wed, 10 Feb 2016 00:42:23 +0100
|
||||
|
||||
tint2 (0.12.3-1) unstable; urgency=low
|
||||
|
||||
* New upstream release
|
||||
* Fix privacy-breach-generic in documentation
|
||||
|
||||
-- Sebastian Reichel <sre@debian.org> Thu, 26 Nov 2015 22:49:26 +0100
|
||||
|
||||
tint2 (0.12.2-1) unstable; urgency=medium
|
||||
|
||||
* New upstream release
|
||||
* Drop all patches (applied upstream)
|
||||
|
||||
-- Sebastian Reichel <sre@debian.org> Fri, 11 Sep 2015 18:41:22 +0200
|
||||
|
||||
tint2 (0.12.1-2) unstable; urgency=medium
|
||||
|
||||
* Import upstream patch fixing bug with blinking systray icon
|
||||
|
||||
-- Sebastian Reichel <sre@debian.org> Tue, 04 Aug 2015 01:16:08 +0200
|
||||
|
||||
tint2 (0.12.1-1) unstable; urgency=medium
|
||||
|
||||
* New upstream release
|
||||
|
||||
-- Sebastian Reichel <sre@debian.org> Mon, 03 Aug 2015 17:03:13 +0200
|
||||
|
||||
tint2 (0.12-1) unstable; urgency=medium
|
||||
|
||||
* New upstream release (Closes: #793797)
|
||||
- Drop 04-freespace.patch (applied upstream)
|
||||
- Drop 05-task-align.patch (needs rework)
|
||||
|
||||
-- Sebastian Reichel <sre@debian.org> Wed, 29 Jul 2015 18:53:03 +0200
|
||||
|
||||
tint2 (0.11+svn20121014-3) unstable; urgency=low
|
||||
|
||||
* Add some patches from upstream's bug tracker. Those are already
|
||||
used by the Debian based VSIDO distribution for some time.
|
||||
- 03-launcher_apps_dir.patch
|
||||
Add support for loading multiple launcher icons by specifing
|
||||
the directory for their *.desktop files.
|
||||
- 04-freespace.patch
|
||||
Add support for a separator panel element.
|
||||
- 05-task-align.patch, 06-sample-task-align.patch
|
||||
Add support for task alignment.
|
||||
|
||||
-- Sebastian Reichel <sre@debian.org> Thu, 05 Jun 2014 17:39:43 +0200
|
||||
|
||||
tint2 (0.11+svn20121014-2) unstable; urgency=low
|
||||
|
||||
* Reintroduce tint2conf (Closes: #720200)
|
||||
* Add patch fixing argv evaluation (Closes: #716390)
|
||||
* Add patch fixing incorrect function declaration (Closes: #748171)
|
||||
* Bump Debian Standards Version to 3.9.5
|
||||
|
||||
-- Sebastian Reichel <sre@debian.org> Sun, 01 Jun 2014 17:13:06 +0200
|
||||
|
||||
tint2 (0.11+svn20121014-1) unstable; urgency=low
|
||||
|
||||
* New upstream checkout (Closes: #678918)
|
||||
- Fix for no task cycling if all windows are minimized
|
||||
- Fix for incorrect task cycling when windows visible on
|
||||
all desktops are present
|
||||
- Adding startup-notification support
|
||||
- Drag and drop support for launchers
|
||||
- Localize launcher tooltips
|
||||
- Launcher: add icon lookup in ~/.local and /usr/local
|
||||
- Disable mouse hover events when the launcher tooltip
|
||||
is disabled
|
||||
* Do not install tint2conf (Closes: #672840)
|
||||
* Add libstartup-notification dependency
|
||||
* Bump Debian Standards Version to 3.9.4
|
||||
* Bump compat level to 9
|
||||
|
||||
-- Sebastian Reichel <sre@debian.org> Thu, 25 Oct 2012 13:35:15 +0200
|
||||
|
||||
tint2 (0.11+svn20111022-3) unstable; urgency=low
|
||||
|
||||
* Update debian/copyright to conform with Debian copyright format 1.0
|
||||
* Update Debian Standards Version to 3.9.3
|
||||
* Add dump of tint2's FAQ and Configure wiki page as offline
|
||||
documentation (Closes: #658226)
|
||||
|
||||
-- Sebastian Reichel <sre@debian.org> Wed, 07 Mar 2012 10:09:20 +0100
|
||||
|
||||
tint2 (0.11+svn20111022-2) unstable; urgency=low
|
||||
|
||||
* Add inform-about-unsupported-saving.patch (Closes: #646055)
|
||||
|
||||
-- Sebastian Reichel <sre@debian.org> Sun, 23 Oct 2011 10:57:35 +0200
|
||||
|
||||
tint2 (0.11+svn20111022-1) unstable; urgency=low
|
||||
|
||||
* New upstream checkout
|
||||
- Fix double free of launcher configuration (Closes: #645208)
|
||||
|
||||
-- Sebastian Reichel <sre@debian.org> Sat, 22 Oct 2011 08:17:18 +0200
|
||||
|
||||
tint2 (0.11+svn20111011-2) unstable; urgency=low
|
||||
|
||||
* build debug symbols
|
||||
|
||||
-- Sebastian Reichel <sre@debian.org> Fri, 21 Oct 2011 16:30:50 +0200
|
||||
|
||||
tint2 (0.11+svn20111011-1) unstable; urgency=low
|
||||
|
||||
* New upstream snapshot
|
||||
- misc. fixes
|
||||
- added alpha, saturation, brightness control for launcher icons
|
||||
- launcher tooltips configurable, default off
|
||||
|
||||
-- Sebastian Reichel <sre@debian.org> Wed, 19 Oct 2011 19:49:54 +0200
|
||||
|
||||
tint2 (0.11+svn20110307-1) unstable; urgency=low
|
||||
|
||||
* New upstream snapshot (Closes: #624792)
|
||||
* Remove power_now support patch (applied upstream)
|
||||
* Do not install tintwizard (it does not support config of SVN snapshot)
|
||||
* Also build a tint2-dbg package
|
||||
|
||||
-- Sebastian Reichel <sre@debian.org> Sun, 01 May 2011 19:35:32 +0200
|
||||
|
||||
tint2 (0.11-2) unstable; urgency=low
|
||||
|
||||
* Recommend python-gtk2 instead of python-gtk
|
||||
|
||||
-- Sebastian Reichel <sre@debian.org> Sun, 05 Dec 2010 05:05:46 +0100
|
||||
|
||||
tint2 (0.11-1) unstable; urgency=low
|
||||
|
||||
* Make me the maintainer of this package (Closes: #598688)
|
||||
* New Upstream Version (Closes: #591008)
|
||||
* drop patch (applied upstream)
|
||||
* Update watch file
|
||||
+ use googlecode.debian.net
|
||||
+ new files are release as tar.bz2
|
||||
* Update Debian Standards Version to 3.9.1
|
||||
* Use DEP5 for debian/copyright
|
||||
* Added build dependencies: cmake, libgtk2.0-dev
|
||||
* Add patch renaming tintwizard.py to tintwizard
|
||||
* Add patch adding power_now support
|
||||
* Recommend python (needed by tintwizard)
|
||||
|
||||
-- Sebastian Reichel <sre@debian.org> Fri, 26 Nov 2010 22:01:43 +0100
|
||||
|
||||
tint2 (0.9-2) unstable; urgency=low
|
||||
|
||||
* debian/patches/update-systray-clock-every-second.diff: Cherry-pick
|
||||
patch from upstream to keep systray clock in sync with system time.
|
||||
(Closes: #572227)
|
||||
|
||||
-- Daniel Moerner <dmoerner@gmail.com> Wed, 03 Mar 2010 23:40:02 -0800
|
||||
|
||||
tint2 (0.9-1) unstable; urgency=low
|
||||
|
||||
* New Upstream Version
|
||||
* debian/watch: Upstream uses both _beta and -rc1 for version strings,
|
||||
update uversionmangle to handle both.
|
||||
* debian/control:
|
||||
- Bump to Version 3.8.4, no changes.
|
||||
- Add libxdamage-dev and libxcomposite-dev to Build-Depends.
|
||||
|
||||
-- Daniel Moerner <dmoerner@gmail.com> Wed, 24 Feb 2010 10:21:01 -0800
|
||||
|
||||
tint2 (0.8-1) unstable; urgency=low
|
||||
|
||||
* New Upstream Version
|
||||
* debian/examples: Upstream has renamed the sample tint2rc files.
|
||||
* debian/source: Switch to dpkg-source 3.0 (quilt) format.
|
||||
* debian/copyright: Update with new upstream authors.
|
||||
|
||||
-- Daniel Moerner <dmoerner@gmail.com> Tue, 12 Jan 2010 11:48:49 -0800
|
||||
|
||||
tint2 (0.7.1-1) unstable; urgency=low
|
||||
|
||||
* New Upstream Version
|
||||
* debian/watch: add uversionmangle line to ignore upstream's beta
|
||||
releases.
|
||||
* debian/control: Update to Debian Policy 3.8.3, fix description typo.
|
||||
|
||||
-- Daniel Moerner <dmoerner@gmail.com> Sun, 06 Sep 2009 18:57:06 -0700
|
||||
|
||||
tint2 (0.7-1) unstable; urgency=low
|
||||
|
||||
* New Upstream Version. (LP: #319436)
|
||||
- Update watch file to point to tint2 instead of tint.
|
||||
- Remove debian/tint.1: integrated upstream (Closes: #532307)
|
||||
- Remove dpatch and patches/01-remove-strip-from-makefile.dpatch:
|
||||
integrated upstream.
|
||||
- Refresh debian/examples and remove debian/docs
|
||||
- tint2 is now licensed under the GPL-2.
|
||||
* Added Vcs-Git and Vcs-Browser fields to debian/control.
|
||||
* Updated to Standards Version 3.8.2
|
||||
* Switched to tiny dh 7 rules file with overrides.
|
||||
|
||||
-- Daniel Moerner <dmoerner@gmail.com> Wed, 01 Jul 2009 02:01:27 -0700
|
||||
|
||||
tint2 (0.6.0-1) unstable; urgency=low
|
||||
|
||||
* Initial release (closes: #491596)
|
||||
* Wrote manpage from upstream docs
|
||||
* 01-remove-strip-from-makefile.dpatch: dh_strip will strip the binary instead
|
||||
|
||||
-- Daniel Moerner <dmoerner@gmail.com> Sat, 06 Sep 2008 07:54:24 -0700
|
||||
1
packaging/ubuntu/compat
Normal file
1
packaging/ubuntu/compat
Normal file
@@ -0,0 +1 @@
|
||||
9
|
||||
36
packaging/ubuntu/control
Normal file
36
packaging/ubuntu/control
Normal file
@@ -0,0 +1,36 @@
|
||||
Source: tint2
|
||||
Section: x11
|
||||
Priority: optional
|
||||
Maintainer: o9000 <mrovi9000@gmail.com>
|
||||
Build-Depends: cmake,
|
||||
debhelper (>= 9),
|
||||
libcairo2-dev,
|
||||
libglib2.0-dev,
|
||||
libgtk2.0-dev,
|
||||
libimlib2-dev,
|
||||
libpango1.0-dev,
|
||||
librsvg2-dev,
|
||||
libstartup-notification0-dev,
|
||||
libxcomposite-dev,
|
||||
libxdamage-dev,
|
||||
libxinerama-dev,
|
||||
libxrandr-dev
|
||||
Standards-Version: 3.9.7
|
||||
Vcs-Git: git://anonscm.debian.org/collab-maint/tint2.git
|
||||
Vcs-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/tint2.git
|
||||
Homepage: https://gitlab.com/o9000/tint2/
|
||||
|
||||
Package: tint2
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends},
|
||||
${misc:Depends}
|
||||
Description: lightweight taskbar
|
||||
Tint is a simple panel/taskbar intentionally made for openbox3, but should
|
||||
also work with other window managers. The taskbar includes transparency and
|
||||
color settings for the font, icons, border, and background. It also supports
|
||||
multihead setups, customized mouse actions, and a built-in clock. Tint was
|
||||
originally based on ttm code. Since then, support has also been added
|
||||
for a battery monitor and system tray.
|
||||
.
|
||||
The goal is to keep a clean and unintrusive look with lightweight code and
|
||||
compliance with freedesktop specification.
|
||||
66
packaging/ubuntu/copyright
Normal file
66
packaging/ubuntu/copyright
Normal file
@@ -0,0 +1,66 @@
|
||||
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||
Source: https://gitlab.com/o9000/tint2.git
|
||||
|
||||
Files: *
|
||||
Copyright: 2007-2008 Pål Staurland <staura@gmail.com>
|
||||
2008-2009 Thierry Lorthiois <lorthiois@bbsoft.fr>
|
||||
2009 Andreas Fink <andreas.fink85@googlemail.com>
|
||||
2011-2015 Ovidiu M <mrovi9000@gmail.com>
|
||||
License: GPL-2
|
||||
|
||||
Files: src/battery/*
|
||||
Copyright: 2009 Sebastian Reichel <sre@debian.org>
|
||||
License: GPL-2+
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation, or (at your option) any
|
||||
later version.
|
||||
.
|
||||
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.
|
||||
.
|
||||
On Debian systems, the full text of the GNU General Public License 2
|
||||
can be found in `/usr/share/common-licenses/GPL-2'.
|
||||
|
||||
Files: debian/*
|
||||
Copyright: 2008-2010 Daniel Moerner <dmoerner@gmail.com>
|
||||
2010-2012 Sebastian Reichel <sre@debian.org>
|
||||
License: ISC
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
.
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
Files: debian/wiki/*
|
||||
Copyright: 2009-2012 Andreas Fink <andreas.fink85@googlemail.com>
|
||||
License: GPL-2
|
||||
|
||||
License: GPL-2
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
version 2 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.
|
||||
.
|
||||
On Debian systems, the full text of the GNU General Public License 2
|
||||
can be found in `/usr/share/common-licenses/GPL-2'.
|
||||
1
packaging/ubuntu/examples
Normal file
1
packaging/ubuntu/examples
Normal file
@@ -0,0 +1 @@
|
||||
sample/*.tint2rc
|
||||
14
packaging/ubuntu/rules
Executable file
14
packaging/ubuntu/rules
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/make -f
|
||||
|
||||
%:
|
||||
dh $@
|
||||
|
||||
override_dh_auto_configure:
|
||||
dh_auto_configure -- -DCMAKE_BUILD_TYPE=RelWithDebInfo
|
||||
|
||||
override_dh_auto_install:
|
||||
dh_auto_install --destdir=$(CURDIR)/debian/tmp
|
||||
|
||||
override_dh_installdocs:
|
||||
dh_installdocs --link-doc=tint2
|
||||
cp -r debian/wiki debian/tint2/usr/share/doc/tint2/html
|
||||
1
packaging/ubuntu/source/format
Normal file
1
packaging/ubuntu/source/format
Normal file
@@ -0,0 +1 @@
|
||||
3.0 (quilt)
|
||||
4
packaging/ubuntu/source/include-binaries
Normal file
4
packaging/ubuntu/source/include-binaries
Normal file
@@ -0,0 +1,4 @@
|
||||
debian/wiki/3265475271_81e8ed56e0.jpg
|
||||
debian/wiki/3265475337_262799ded3.jpg
|
||||
debian/wiki/3266303192_476a188196.jpg
|
||||
debian/wiki/3266303292_14d9b6b623.jpg
|
||||
12
packaging/ubuntu/tint2.install
Normal file
12
packaging/ubuntu/tint2.install
Normal file
@@ -0,0 +1,12 @@
|
||||
/usr/bin/tint2
|
||||
/usr/bin/tint2conf
|
||||
/etc/xdg/tint2/tint2rc
|
||||
/usr/share/applications/tint2.desktop
|
||||
/usr/share/applications/tint2conf.desktop
|
||||
/usr/share/man/man1/tint2.1
|
||||
/usr/share/doc/tint2/AUTHORS
|
||||
/usr/share/doc/tint2/README.md
|
||||
/usr/share/icons/hicolor/scalable/apps/tint2.svg
|
||||
/usr/share/icons/hicolor/scalable/apps/tint2conf.svg
|
||||
/usr/share/locale/*
|
||||
/usr/share/tint2/*
|
||||
1
packaging/ubuntu/tint2.manpages
Normal file
1
packaging/ubuntu/tint2.manpages
Normal file
@@ -0,0 +1 @@
|
||||
debian/tint2conf.1
|
||||
15
packaging/ubuntu/tint2conf.1
Normal file
15
packaging/ubuntu/tint2conf.1
Normal file
@@ -0,0 +1,15 @@
|
||||
.TH TINT2CONF 1 "April 25, 2011"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.SH NAME
|
||||
tint2conf \- tint configuration manager
|
||||
.SH SYNOPSIS
|
||||
.B tint2conf
|
||||
.SH DESCRIPTION
|
||||
tint2conf is a GTK based configuration previewer for tint2.
|
||||
.SH OPTIONS
|
||||
tint2conf takes no parameters.
|
||||
.SH AUTHOR
|
||||
tint2conf was written by the tint2 team.
|
||||
.PP
|
||||
This manual page was written by Sebastian Reichel <sre@debian.org>,
|
||||
for the Debian project (but may be used by others).
|
||||
4
packaging/ubuntu/watch
Normal file
4
packaging/ubuntu/watch
Normal file
@@ -0,0 +1,4 @@
|
||||
version=3
|
||||
|
||||
opts=filenamemangle=s/.*\.tar\.gz\?ref=v?(\d\S*)/tint2-$1\.tar\.gz/g,uversionmangle=s/\-rc(\d)/\~rc$1/ \
|
||||
https://gitlab.com/o9000/tint2/tags .*archive\.tar\.gz\?ref=v?(\d\S*)
|
||||
BIN
packaging/ubuntu/wiki/3265475271_81e8ed56e0.jpg
Normal file
BIN
packaging/ubuntu/wiki/3265475271_81e8ed56e0.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
BIN
packaging/ubuntu/wiki/3265475337_262799ded3.jpg
Normal file
BIN
packaging/ubuntu/wiki/3265475337_262799ded3.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
BIN
packaging/ubuntu/wiki/3266303192_476a188196.jpg
Normal file
BIN
packaging/ubuntu/wiki/3266303192_476a188196.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
BIN
packaging/ubuntu/wiki/3266303292_14d9b6b623.jpg
Normal file
BIN
packaging/ubuntu/wiki/3266303292_14d9b6b623.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
405
packaging/ubuntu/wiki/Configure.html
Normal file
405
packaging/ubuntu/wiki/Configure.html
Normal file
@@ -0,0 +1,405 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>tint2 - Configure</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
</head>
|
||||
|
||||
<body class="t6">
|
||||
|
||||
<table class="st" width="100%" cellpadding="0" cellspacing="0" align="center" border="0">
|
||||
<tbody><tr>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<td class="bevel-right" valign="top" align="right"></td>
|
||||
</tr>
|
||||
</tbody></table>
|
||||
|
||||
|
||||
|
||||
<div id="maincol" style="padding: 0pt 3px 3px 0pt; margin: 0pt;">
|
||||
|
||||
|
||||
<!-- IE -->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div id="wikipage">
|
||||
<table>
|
||||
<tbody><tr>
|
||||
|
||||
|
||||
|
||||
|
||||
<td style="vertical-align: top; padding-left: 5px;">
|
||||
|
||||
|
||||
|
||||
<div id="wikicontent">
|
||||
<div class="vt" id="wikimaincol">
|
||||
|
||||
<h1>tint2 - Configure</h1>
|
||||
|
||||
<p></p><ul><li><a href="#Background_and_border">Background and border</a></li><li><a href="#Panel">Panel</a></li><li><a href="#Launcher_SVN_Only">Launcher SVN Only</a></li><li><a href="#Taskbar_%28pager_like_capability%29">Taskbar (pager like capability)</a></li><li><a href="#Task">Task</a></li><li><a href="#System_Tray">System Tray</a></li><li><a href="#Clock">Clock</a></li><li><a href="#Tooltip">Tooltip</a></li><li><a href="#Battery">Battery</a></li><li><a href="#Mouse_action_on_task">Mouse action on task</a></li><li><a href="#Panel_autohide">Panel autohide</a></li><li><a href="#An_example_tint2rc">An example tint2rc</a></li></ul> <p></p><p>The first time you run tint2, it will create the config file in <tt>$HOME/.config/tint2/tint2rc</tt> . (this is true if you have done a clean install. running tint2 in the source directory without doing 'make install' will not create the config file.) </p><p>You can specify another file on the command line with -c option. eg. : <tt>tint2 -c $HOME/tint2.conf</tt> </p><p>When you change the config file, the command line 'killall -SIGUSR1 tint2' will force tint2 to reload it. </p><p>Configuration marked as <tt>SVN ONLY</tt> are not yet supported and could change in the next stable release. </p><h1><a name="Background_and_border"></a>Background and border<a href="#Background_and_border" class="section_anchor"></a></h1><blockquote>tint2rc config file starts with background option.
|
||||
</blockquote><p> </p><ul><li><tt>rounded = number_of_pixels</tt> : How rounded the borders are </li></ul><p></p><ul><li><tt>background_color = color opacity</tt> </li><ul><li><tt>opacity = 0</tt> to get background transparency </li></ul></ul><p> </p><ul><li><tt>border_width = width</tt> </li></ul><p></p><ul><li><tt>border_color = color opacity (0 to 100)</tt> </li><ul><li><tt>opacity = 0</tt> to get border transparency </li></ul></ul><blockquote>you are free to put 1, 2, 3... background
|
||||
<pre class="prettyprint"> rounded = 1
|
||||
border_width = 0
|
||||
background_color = #282828 100
|
||||
border_color = #000000 0
|
||||
|
||||
rounded = 1
|
||||
border_width = 0
|
||||
background_color = #f6b655 90
|
||||
border_color = #cccccc 40</pre>tint2 automatically identifies each background with a number (1, 2, ...).
|
||||
then you can applied background on objects (panel, taskbar, task, clock, systray) with
|
||||
<pre class="prettyprint"> panel_background_id = 1
|
||||
taskbar_background_id = 0
|
||||
task_background_id = 0
|
||||
task_active_background_id = 2
|
||||
systray_background_id = 0
|
||||
clock_background_id = 0</pre>identifier 0 applied full transparency, identifer 1 applied the first background...
|
||||
</blockquote><h1><a name="Panel"></a>Panel<a href="#Panel" class="section_anchor"></a></h1><ul><li><tt>panel_monitor = monitor (all, 1, 2, ...)</tt> Which monitor tint2 draws the panel on </li><ul><li>the first monitor is <tt>1</tt> </li><li>use <tt>panel_monitor = all</tt> to get one panel per monitor (unless it's included into another one) </li></ul></ul><p> </p><blockquote><img src="3265475271_81e8ed56e0.jpg">
|
||||
</blockquote><p></p><p> </p><ul><li><tt>panel_position = vertical_position horizontal_position orientation</tt> </li><ul><li><tt>value for vertical_position : bottom, top, center</tt> </li><li><tt>value for horizontal_position : left, right, center</tt> </li><li><tt>value for orientation : horizontal, vertical</tt> </li></ul></ul> <ul><li><tt>panel_size = width height</tt> </li><ul><li><tt>width = 0</tt> to get full monitor width </li><li>Use <tt>%</tt> to adjust the panel size to monitor size. </li></ul></ul> <blockquote>Example:
|
||||
<p></p><pre class="prettyprint"> #The panel's width is 94% the size of the monitor
|
||||
panel_size = 94% 30</pre></blockquote><ul><li><tt>panel_items = LTSBC</tt> define the items tint2 will show and the order of those items. panel_items = STC will show the Systray, the taskbar and the clock (from left to right). SVN ONLY. </li><ul><li>L to show Launcher </li><li>T to show Taskbar </li><li>S to show Systray (also called notification area) </li><li>B to show Battery status </li><li>C to show Clock </li></ul></ul><ul><li><tt>panel_margin = horizontal_margin vertical_margin</tt> </li><ul><li><tt>horizontal_margin = 0</tt> to get full monitor width </li></ul></ul><blockquote><img src="3266303192_476a188196.jpg">
|
||||
</blockquote><p> </p><ul><li><tt>panel_padding = horizontal_left_right_padding vertical_padding horizontal_spacing</tt> </li></ul><p></p><ul><li><tt>font_shadow = boolean (0 or 1)</tt> </li></ul><ul><li><tt>panel_background_id = integer</tt> : Which background to use </li></ul><ul><li><tt>wm_menu = boolean (0 or 1)</tt> : Allow tint2 to forward mouse event to your Window Manager. </li></ul><ul><li><tt>panel_dock = boolean (0 or 1)</tt> : Put tint2 into the window managers dock. For the openbox window manager I can advise to use also a modifier for the moveButton option, otherwise the mouse click is not forwarded to tint2 (in ~/.config/openbox/rc.xml). </li></ul><p> </p><ul><li><tt>panel_layer = bottom,normal,top</tt> : Puts tint2 into the bottom/normal/top layer. Default is the bottom layer, but for real transparency normal or top layer may be a nice alternative. </li></ul><p></p><ul><li><tt>strut_policy = follow_size/minimum/none</tt> : STRUTs are used by the window manager to decide the size of maximized windows. Should the 'maximized windows' follow tint2 size (follow_size) or use the minimum size (minimum), or use the screen size (none). <tt>minimum</tt> option is interresting when used with <tt>autohide_height</tt> parameter. </li></ul><h1><a name="Launcher_SVN_Only"></a>Launcher SVN Only<a href="#Launcher_SVN_Only" class="section_anchor"></a></h1><ul><li><tt>launcher_icon_theme = name_of_theme</tt> tint2 will follow the theme of your desktop when you have an XSETTINGS manager running. Otherwise, <tt>launcher_icon_theme</tt> parameter is used. </li><li><tt>launcher_padding = horizontal_left_right_padding vertical_padding horizontal_spacing</tt> </li><li><tt>launcher_background_id = integer</tt> : Which background to use </li><li><tt>launcher_icon_size = number</tt> : Set the launcher icon size to <tt>number</tt>. </li><li><tt>launcher_item_app = path_to_application</tt> : Each launcher_item_app must be a full path to a .desktop file. </li></ul><h1><a name="Taskbar_(pager_like_capability)"></a>Taskbar (pager like capability)<a href="#Taskbar_%28pager_like_capability%29" class="section_anchor"></a></h1><ul><li><tt>taskbar_mode = single_desktop or multi_desktop</tt> </li><ul><li><tt>taskbar_mode = single_desktop</tt> : Show one(1) taskbar (current desktop) </li><li><tt>taskbar_mode = multi_desktop</tt> : Pager like capability. Show one(1) taskbar per desktop </li><ul><li>You can drag-and-drop task between desktops` </li><li>And also click on an empty taskbar to switch desktops` </li></ul></ul></ul><p> </p><ul><li><tt>taskbar_padding = horizontal_left_right_padding vertical_padding horizontal_spacing</tt> </li></ul><p></p><ul><li><tt>taskbar_background_id = integer</tt> : Which background to use </li></ul><ul><li><tt>taskbar_active_background_id = integer</tt> : Which background to use for current desktop. </li></ul><blockquote><img src="3266303292_14d9b6b623.jpg">
|
||||
</blockquote><ul><li><tt>taskbar_name = boolean (0 or 1)</tt> : SVN Only enabled(=1) or disabled(=0) desktop name in taskbar </li></ul><ul><li><tt>taskbar_name_padding = left_right_padding</tt> SVN Only </li></ul><ul><li><tt>taskbar_name_background_id = integer</tt> : SVN Only Which background to use </li></ul><ul><li><tt>taskbar_name_active_background_id = integer</tt> : SVN Only Which background to use for current desktop. </li></ul><ul><li><tt>taskbar_name_font = [FAMILY-LIST] [STYLE-OPTIONS] [SIZE]</tt> SVN Only </li></ul><ul><li><tt>taskbar_name_font_color = color opacity (0 to 100)</tt> SVN Only </li></ul><ul><li><tt>taskbar_name_active_font_color = color opacity (0 to 100)</tt> </li></ul><h1><a name="Task"></a>Task<a href="#Task" class="section_anchor"></a></h1><ul><li><tt>urgent_nb_of_blink = integer</tt> : Number of blink on 'get attention' event </li></ul><ul><li><tt>task_icon = boolean (0 or 1)</tt> : Display task icon or not </li></ul><ul><li><tt>task_text = boolean (0 or 1)</tt> : Display task text or not </li></ul><ul><li><tt>task_centered = boolean (0 or 1)</tt> : Task name centered or not </li></ul><ul><li><tt>task_maximum_size = width height</tt> </li><ul><li><tt>width is used with horizontal panel. width = 0 to get full taskbar width</tt> </li><li><tt>height is used with vertical panel</tt> </li></ul></ul><p> </p><ul><li><tt>task_padding = horizontal_padding vertical_padding</tt> </li></ul><p></p><ul><li><tt>task_font = [FAMILY-LIST] [STYLE-OPTIONS] [SIZE]</tt> </li></ul><ul><li><tt>task_font_color = color opacity (0 to 100)</tt> </li></ul><p> </p><ul><li><tt>task_icon_asb = alpha (0 to 100) saturation (-100 to 100) brightness (-100 to 100)</tt> : adjust icon's color and transparency for task. </li></ul><p></p><ul><li><tt>task_background_id = integer</tt> : Which background to use for non selected tasks </li></ul><blockquote>For the next 3 options STATUS can be <tt>active</tt> / <tt>iconified</tt> / <tt>urgent</tt>.
|
||||
</blockquote><ul><li><tt>task_STATUS_font_color = color opacity (0 to 100)</tt> </li></ul><ul><li><tt>task_STATUS_icon_asb = alpha (0 to 100) saturation (-100 to 100) brightness (-100 to 100)</tt> : adjust icon's color and transparency for active task </li></ul><ul><li><tt>task_STATUS_background_id = integer</tt> : Which background to use when task is selected </li></ul><ul><li><tt>task_tooltip = boolean (0 or 1)</tt> : enabled(=1) or disabled(=0) tooltip on task </li></ul><blockquote><img src="3265475337_262799ded3.jpg">
|
||||
</blockquote><h1><a name="System_Tray"></a>System Tray<a href="#System_Tray" class="section_anchor"></a></h1><ul><li><tt>systray = boolean (0 or 1)</tt> : enabled(=1) or disabled(=0) systray </li></ul><ul><li><tt>systray_padding = horizontal_left_right_padding vertical_padding horizontal_spacing</tt> </li></ul><ul><li><tt>systray_background_id = integer</tt> : Which background to use for non selected tasks </li></ul><ul><li> <tt>systray_sort = ascending/descending/left2right/right2left</tt> : Sorting order for icon's systray (if left2right or right2left the order can be different on restart) </li></ul><ul><li> <tt>systray_icon_size = max_icon_size</tt> : Set the maximum system tray icon size to <tt>number</tt>. Set to <tt>0</tt> for automatic icon size </li></ul><ul><li><tt>systray_icon_asb = alpha (0 to 100) saturation (-100 to 100) brightness (-100 to 100)</tt> : adjust icon's color and transparency for system tray icons </li></ul><h1><a name="Clock"></a>Clock<a href="#Clock" class="section_anchor"></a></h1><ul><li><tt>time1_format = %H:%M</tt> </li><ul><li>time1_format, time2_format and clock_tooltip use 'strftime' syntax. more info on parameters on <a href="http://www.manpagez.com/man/3/strftime/" rel="nofollow">http://www.manpagez.com/man/3/strftime/</a> </li><li>comment time1_format and time2_format to hide clock </li></ul></ul><p> </p><ul><li><tt>time1_timezone = :US/Hawaii</tt> </li><ul><li>time1_timezone, time2_timezone and clock_tooltip_timezone can be used to specify a timezone. If you do not specify a value the system-wide timezone is used. The timezones can usually be found in /usr/share/zoneinfo. If your timezones are in a different directory, you need to specify the absolute path, i.e. time1_timezone = :/different/zoneinfo/dir/US/Hawaii (always prepend with a ':') </li></ul></ul><p></p><ul><li><tt>time1_font = [FAMILY-LIST] [STYLE-OPTIONS] [SIZE]</tt> </li></ul><ul><li><tt>time2_format = %A %d %B</tt> </li></ul><ul><li><tt>time2_timezone = :Europe/Berlin</tt> </li></ul><ul><li><tt>time2_font = [FAMILY-LIST] [STYLE-OPTIONS] [SIZE]</tt> </li></ul><ul><li><tt>clock_font_color = color opacity (0 to 100)</tt> </li></ul><ul><li><tt>clock_padding = horizontal_padding vertical_padding</tt> </li></ul><ul><li><tt>clock_background_id = integer</tt> : Which background to use </li></ul><ul><li><tt>clock_tooltip = %a, %d. %b %Y : clock tooltip text</tt> </li></ul><ul><li><tt>clock_tooltip_timezone = :UTC</tt> </li></ul><ul><li><tt>clock_lclick_command = text</tt> : Which command to execute on left click </li></ul><ul><li><tt>clock_rclick_command = text</tt> : Which command to execute on right click </li></ul><h1><a name="Tooltip"></a>Tooltip<a href="#Tooltip" class="section_anchor"></a></h1><ul><li><tt>tooltip_padding = horizontal_padding vertical_padding</tt> </li></ul><ul><li><tt>tooltip_show_timeout = float</tt> : delay to show tooltip in second. Use '.' as decimal separator. </li></ul><ul><li><tt>tooltip_hide_timeout = float</tt> : delay to close tooltip in second. Use '.' as decimal separator. </li></ul><ul><li><tt>tooltip_background_id = integer</tt> : Which background to use (in fake transparency the alpha channel and rounded are not respected) </li></ul><ul><li><tt>tooltip_font_color = color opacity (0 to 100)</tt> </li></ul><ul><li><tt>tooltip_font = [FAMILY-LIST] [STYLE-OPTIONS] [SIZE]</tt> </li></ul><h1><a name="Battery"></a>Battery<a href="#Battery" class="section_anchor"></a></h1><ul><li><tt>battery = boolean (0 or 1)</tt> : enabled(=1) or disabled(=0) battery applet </li></ul><ul><li><tt>battery_hide = never or an integer (0 to 100)</tt>: At what battery percent does the battery hide </li></ul><ul><li><tt>battery_low_status = integer</tt>: At what battery percent does the icon show battery low command </li></ul><ul><li><tt>battery_low_cmd = notify-send "battery low"</tt> :What to do when battery is low </li></ul><ul><li><tt>bat1_font = [FAMILY-LIST] [STYLE-OPTIONS] [SIZE]</tt> </li></ul><ul><li><tt>bat2_font = [FAMILY-LIST] [STYLE-OPTIONS] [SIZE]</tt> </li></ul><ul><li><tt>battery_font_color = color opacity (0 to 100)</tt> </li></ul><ul><li><tt>battery_padding = horizontal_padding vertical_padding</tt> </li></ul><ul><li><tt>battery_background_id = integer</tt> : Which background to use </li></ul><h1><a name="Mouse_action_on_task"></a>Mouse action on task<a href="#Mouse_action_on_task" class="section_anchor"></a></h1><blockquote>Customize mouse action with : <tt>none, close, toggle, iconify, shade, toggle_iconify, maximize_restore, desktop_left, desktop_right, next_task, prev_task</tt>.
|
||||
</blockquote><blockquote>Sample format:
|
||||
<pre class="prettyprint"> mouse_middle = none
|
||||
mouse_right = close
|
||||
mouse_scroll_up = toggle
|
||||
mouse_scroll_down = iconify</pre></blockquote><pre class="prettyprint"> close : close the task
|
||||
toggle : toggle the task
|
||||
iconify : iconify the task
|
||||
toggle_iconify : toggle or iconify the task
|
||||
maximize_restore : maximized or minimized the task
|
||||
desktop_left : send the task to the desktop on the left
|
||||
desktop_right : send the task to the desktop on the right
|
||||
next_task : send the focus to next task
|
||||
prev_task : send the focus to previous task</pre><p>If a mouse action is set to <tt>none</tt> and <tt>wm_menu = 1</tt> is set, the mouse click is forwarded to the window manager </p><h1><a name="Panel_autohide"></a>Panel autohide<a href="#Panel_autohide" class="section_anchor"></a></h1><ul><li><tt>autohide = boolean (0 or 1)</tt> : enable(=1) or disable(=0) autohiding </li></ul><ul><li><tt>autohide_show_timeout = float</tt> : show timeout in seconds. Use '.' as decimal separator. </li></ul><ul><li><tt>autohide_hide_timeout = float</tt> : hide timeout in seconds. Use '.' as decimal separator. </li></ul><ul><li><tt>autohide_height = integer</tt> : panel height (width for vertical panels) in hidden mode </li></ul><h1><a name="An_example_tint2rc"></a>An example tint2rc<a href="#An_example_tint2rc" class="section_anchor"></a></h1><pre class="prettyprint">#---------------------------------------------
|
||||
# TINT2 CONFIG FILE
|
||||
#---------------------------------------------
|
||||
|
||||
#---------------------------------------------
|
||||
# BACKGROUND AND BORDER
|
||||
#---------------------------------------------
|
||||
rounded = 7
|
||||
border_width = 2
|
||||
background_color = #000000 60
|
||||
border_color = #ffffff 18
|
||||
|
||||
rounded = 5
|
||||
border_width = 0
|
||||
background_color = #ffffff 40
|
||||
border_color = #ffffff 50
|
||||
|
||||
rounded = 5
|
||||
border_width = 0
|
||||
background_color = #ffffff 18
|
||||
border_color = #ffffff 70
|
||||
|
||||
#---------------------------------------------
|
||||
# PANEL
|
||||
#---------------------------------------------
|
||||
panel_monitor = all
|
||||
panel_position = bottom center
|
||||
panel_size = 94% 30
|
||||
panel_margin = 0 0
|
||||
panel_padding = 7 0
|
||||
font_shadow = 0
|
||||
panel_background_id = 1
|
||||
wm_menu = 0
|
||||
panel_dock = 0
|
||||
panel_layer = bottom
|
||||
|
||||
#---------------------------------------------
|
||||
# TASKBAR
|
||||
#---------------------------------------------
|
||||
#taskbar_mode = multi_desktop
|
||||
taskbar_mode = single_desktop
|
||||
taskbar_padding = 2 3 2
|
||||
taskbar_background_id = 0
|
||||
#taskbar_active_background_id = 0
|
||||
|
||||
#---------------------------------------------
|
||||
# TASKS
|
||||
#---------------------------------------------
|
||||
task_icon = 1
|
||||
task_text = 1
|
||||
task_maximum_size = 140 35
|
||||
task_centered = 1
|
||||
task_padding = 6 3
|
||||
task_font = sans 7
|
||||
task_font_color = #ffffff 70
|
||||
task_background_id = 3
|
||||
task_icon_asb = 100 0 0
|
||||
# replace STATUS by 'urgent', 'active' or 'iconfied'
|
||||
#task_STATUS_background_id = 2
|
||||
#task_STATUS_font_color = #ffffff 85
|
||||
#task_STATUS_icon_asb = 100 0 0
|
||||
# example:
|
||||
task_active_background_id = 2
|
||||
task_active_font_color = #ffffff 85
|
||||
task_active_icon_asb = 100 0 0
|
||||
urgent_nb_of_blink = 8
|
||||
|
||||
#---------------------------------------------
|
||||
# SYSTRAYBAR
|
||||
#---------------------------------------------
|
||||
systray = 1
|
||||
systray_padding = 0 4 5
|
||||
systray_background_id = 0
|
||||
systray_sort = left2right
|
||||
systray_icon_size = 0
|
||||
systray_icon_asb = 100 0 0
|
||||
|
||||
#---------------------------------------------
|
||||
# CLOCK
|
||||
#---------------------------------------------
|
||||
time1_format = %H:%M
|
||||
time1_font = sans 8
|
||||
time2_format = %A %d %B
|
||||
time2_font = sans 6
|
||||
clock_font_color = #ffffff 76
|
||||
clock_padding = 1 0
|
||||
clock_background_id = 0
|
||||
#clock_lclick_command = xclock
|
||||
clock_rclick_command = orage
|
||||
#clock_tooltip = %A %d %B
|
||||
#time1_timezone = :US/Hawaii
|
||||
#time2_timezone = :Europe/Berlin
|
||||
#clock_tooltip_timezone = :/usr/share/zoneinfo/Europe/Paris
|
||||
|
||||
#---------------------------------------------
|
||||
# BATTERY
|
||||
#---------------------------------------------
|
||||
battery = 0
|
||||
battery_hide = 98
|
||||
battery_low_status = 10
|
||||
battery_low_cmd = notify-send "battery low"
|
||||
bat1_font = sans 8
|
||||
bat2_font = sans 6
|
||||
battery_font_color = #ffffff 76
|
||||
battery_padding = 1 0
|
||||
battery_background_id = 0
|
||||
|
||||
#---------------------------------------------
|
||||
# TOOLTIP
|
||||
#---------------------------------------------
|
||||
tooltip = 0
|
||||
tooltip_padding = 2 2
|
||||
tooltip_show_timeout = 0.7
|
||||
tooltip_hide_timeout = 0.3
|
||||
tooltip_background_id = 1
|
||||
tooltip_font_color = #OOOOOO 80
|
||||
tooltip_font = sans 10
|
||||
|
||||
#---------------------------------------------
|
||||
# MOUSE ACTION ON TASK
|
||||
#---------------------------------------------
|
||||
mouse_middle = none
|
||||
mouse_right = close
|
||||
mouse_scroll_up = toggle
|
||||
mouse_scroll_down = iconify
|
||||
|
||||
#---------------------------------------------
|
||||
# AUTOHIDE OPTIONS
|
||||
#---------------------------------------------
|
||||
autohide = 0
|
||||
autohide_show_timeout = 0.3
|
||||
autohide_hide_timeout = 2
|
||||
autohide_height = 4
|
||||
strut_policy = minimum</pre>
|
||||
</div>
|
||||
</div>
|
||||
</td></tr><tr>
|
||||
</tr></tbody></table>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div id="wikicommentcol">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="collapse">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div id="commentlist">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="hostedBy" style="margin-top: -20px;">
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</body></html>
|
||||
217
packaging/ubuntu/wiki/FAQ.html
Normal file
217
packaging/ubuntu/wiki/FAQ.html
Normal file
@@ -0,0 +1,217 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>tint2 - FAQ</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
</head>
|
||||
|
||||
<body class="t6">
|
||||
|
||||
<table class="st" width="100%" cellpadding="0" cellspacing="0" align="center" border="0">
|
||||
<tbody><tr>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<td class="bevel-right" valign="top" align="right"></td>
|
||||
</tr>
|
||||
</tbody></table>
|
||||
|
||||
|
||||
|
||||
<div id="maincol" style="padding: 0pt 3px 3px 0pt; margin: 0pt;">
|
||||
|
||||
<!-- IE -->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div id="wikipage">
|
||||
<table>
|
||||
<tbody><tr>
|
||||
|
||||
|
||||
|
||||
|
||||
<td style="vertical-align: top; padding-left: 5px;">
|
||||
|
||||
|
||||
|
||||
<div id="wikicontent">
|
||||
<div class="vt" id="wikimaincol">
|
||||
|
||||
<h1>tint2 - FAQ</h1>
|
||||
|
||||
<p></p><ul><li><a href="#What_is_tint2?">What is tint2?</a></li><li><a href="#Who_is_the_developer_of_tint2_?">Who is the developer of tint2 ?</a></li><li><a href="#Does_tint2_have_a_system_tray/notification_area?">Does tint2 have a system tray/notification area?</a></li><li><a href="#I_have_the_latest_build_of_tint2_but_still_no_system_tray">I have the latest build of tint2 but still no system tray</a></li><li><a href="#tint2_doesn%27t_show_the_systray/notification">tint2 doesn't show the systray/notification</a></li><li><a href="#Why_did_some_systray_icons_disappear_from_the_panel?">Why did some systray icons disappear from the panel?</a></li><li><a href="#Why_don%27t_some_systray_icons_appear_when_you_run_tint2_in_a">Why don't some systray icons appear when you run tint2 in a KDE session?</a></li><li><a href="#I_want_to_disable_the_tint2_systray">I want to disable the tint2 systray</a></li><li><a href="#How_to_configure_real_transparency">How to configure real transparency</a></li><li><a href="#Tint2_doesn%27t_work_on_compiz_correctly?">Tint2 doesn't work on compiz correctly?</a></li><li><a href="#I_want_to_disable_compiz_shadow_on_Tint2">I want to disable compiz shadow on Tint2</a></li><li><a href="#Adding_a_%27show_desktop%27_button">Adding a 'show desktop' button</a></li><li><a href="#Task_list_is_limited">Task list is limited</a></li><li><a href="#How_can_I_get_%27pager_like_capability%27_?">How can I get 'pager like capability' ?</a></li><li><a href="#I_want_to_hide_some_tasks_from_the_panel_?">I want to hide some tasks from the panel ?</a></li><li><a href="#The_tint2_panel_is_blank">The tint2 panel is blank</a></li><li><a href="#How_to_maximize_window_over_tint2">How to maximize window over tint2</a></li><li><a href="#I_get_errors_when_I_try_to_compile_tint2_on_my_own">I get errors when I try to compile tint2 on my own</a></li><li><a href="#I_upgraded_to_tint2_and_I_still_have_the_old_panel_with_its_bugs">I upgraded to tint2 and I still have the old panel with its bugs</a></li><li><a href="#Tint2_doesn%27t_show_in_Pekwm">Tint2 doesn't show in Pekwm</a></li><li><a href="#Is_there_an_IRC_channel?">Is there an IRC channel?</a></li></ul> <p></p><p>Frequently asked questions. Please add any extra tips to the comments. </p><h1><a name="What_is_tint2?"></a>What is tint2?<a href="#What_is_tint2?" class="section_anchor"></a></h1><ul><li>Tint2 is a panel/taskbar for modern x window managers like GNOME, KDE, XFCE, openbox, pekwm,etc.. </li></ul><h1><a name="Who_is_the_developer_of_tint2_?"></a>Who is the developer of tint2 ?<a href="#Who_is_the_developer_of_tint2_?" class="section_anchor"></a></h1><ul><li>Main developers of tint2 are Thierry Lorthiois and Andreas Fink </li></ul><h1><a name="Does_tint2_have_a_system_tray/notification_area?"></a>Does tint2 have a system tray/notification area?<a href="#Does_tint2_have_a_system_tray/notification_area?" class="section_anchor"></a></h1><ul><li>YES! Tint2 finally has system tray/notification area. Please <a href="https://code.google.com/p/tint2/wiki/Install">install</a> the latest build if your current build doesn't have it. </li></ul><h1><a name="I_have_the_latest_build_of_tint2_but_still_no_system_tray"></a>I have the latest build of tint2 but still no system tray<a href="#I_have_the_latest_build_of_tint2_but_still_no_system_tray" class="section_anchor"></a></h1><ul><li>Check your tint2rc to see if you have the systray option configured and the options are not commented out. </li><li>The systray section looks like this </li><pre class="prettyprint">#---------------------------------------------
|
||||
# SYSTRAYBAR
|
||||
#---------------------------------------------
|
||||
systray = 1
|
||||
systray_padding = 0 3 3
|
||||
systray_background_id = 0
|
||||
systray_sort = left2right</pre></ul><h1><a name="tint2_doesn't_show_the_systray/notification"></a>tint2 doesn't show the systray/notification<a href="#tint2_doesn%27t_show_the_systray/notification" class="section_anchor"></a></h1><ul><li>Check your tint2rc to see if you have 'systray = 1' </li><li>run tint2 in a terminal. if you get 'tint2 : another systray is running' it's because you have another systray/notification and you can't run more than one at a time. </li><ul><li>In gnome, remove the systray/notification with a right clic on the separator before your systray/notification -> remove </li></ul></ul><h1><a name="Why_did_some_systray_icons_disappear_from_the_panel?"></a>Why did some systray icons disappear from the panel?<a href="#Why_did_some_systray_icons_disappear_from_the_panel?" class="section_anchor"></a></h1><ul><li>tint2 stops/restarts the systray protocol on some events (like switching theme with tint2conf). But some systray icons do not implement the stop/restart of the manager and so disappear from the panel. You can report the problem to us and also to the systray icon developer. </li></ul><h1><a name="Why_don't_some_systray_icons_appear_when_you_run_tint2_in_a"></a>Why don't some systray icons appear when you run tint2 in a KDE session?<a href="#Why_don%27t_some_systray_icons_appear_when_you_run_tint2_in_a" class="section_anchor"></a></h1><ul><li>Some KDE applications use the KDE status notifier service to show system tray icons. If you disable this service (systemsettings -> Startup and Shutdown -> Service Manager -> uncheck "Status Notifier Manager") all the icons should appear normally in tint2. </li></ul><h1><a name="I_want_to_disable_the_tint2_systray"></a>I want to disable the tint2 systray<a href="#I_want_to_disable_the_tint2_systray" class="section_anchor"></a></h1><ul><li>To disable the systray, just put <tt>systray = 0</tt> in your tint2rc </li><li>Example: </li><pre class="prettyprint">systray = 0
|
||||
systray_padding = 0 3 3
|
||||
systray_background_id = 0</pre></ul><h1><a name="How_to_configure_real_transparency"></a>How to configure real transparency<a href="#How_to_configure_real_transparency" class="section_anchor"></a></h1><ul><li>tint2 autodetects your composite manager and uses real transparency when possible. However, xcompmgr have a little bug which prevents tint2 from detecting it. </li><li>If you want autodetect with xcompmgr, download and apply xcompmgr's patch (in bug report). See <a href="http://bugs.freedesktop.org/show_bug.cgi?id=26090" rel="nofollow">xcompmgr patch</a> </li></ul><h1><a name="Tint2_doesn't_work_on_compiz_correctly?"></a>Tint2 doesn't work on compiz correctly?<a href="#Tint2_doesn%27t_work_on_compiz_correctly?" class="section_anchor"></a></h1><ul><li>All my tasks are on one desktop in compiz? </li><ul><li>This is a known issue in compiz. Compiz doesn't support 'Virtual desktop' specification (or you have to disabled visual effect).<br>I look like 'Desktop number' use Viewport instead of 'Virtual desktop'. So pager capabilities are not supported. <br>See <a href="https://bugs.launchpad.net/ubuntu/+source/compiz/+bug/153322" rel="nofollow">https://bugs.launchpad.net/ubuntu/+source/compiz/+bug/153322</a> <br>or <a href="http://forum.compiz.org/viewtopic.php?f=86&t=11943" rel="nofollow">http://forum.compiz.org/viewtopic.php?f=86&t=11943</a> <br>or <a href="https://bugs.launchpad.net/ubuntu/+source/compiz/+bug/150690" rel="nofollow">https://bugs.launchpad.net/ubuntu/+source/compiz/+bug/150690</a> </li></ul><li>Tint is being decorated with a window/ has a shadow /is not fully transparent </li><ul><li>Open CompizConfig Settings manager -> Window Decorations Plugin </li><ul><li>In the box for Decoration windows, put <tt>any & !type=dock</tt> </li><li>In the box for Shadow windows, put <tt>any & !type=dock</tt> </li></ul></ul><blockquote>
|
||||
</blockquote><li>Tint has ugly white streaks </li><ul><li>Set a background for your desktop </li></ul></ul><h1><a name="I_want_to_disable_compiz_shadow_on_Tint2"></a>I want to disable compiz shadow on Tint2<a href="#I_want_to_disable_compiz_shadow_on_Tint2" class="section_anchor"></a></h1><ul><li>Run ccsm the compiz configuration tool. Go to Window Decorations. For both decoration and shadow windows, replace 'any' with 'any & !name=tint2'. </li></ul><h1><a name="Adding_a_'show_desktop'_button"></a>Adding a 'show desktop' button<a href="#Adding_a_%27show_desktop%27_button" class="section_anchor"></a></h1><ul><li>tint2 doesn't implement 'show desktop' button. But here a way to get it. <br> </li></ul><p>Create a file with following text </p><pre class="prettyprint">#!/bin/sh
|
||||
if wmctrl -m | grep "mode: ON"; then
|
||||
exec wmctrl -k off
|
||||
else
|
||||
exec wmctrl -k on
|
||||
fi</pre><p>Save it in /usr/bin/show_desktop.sh and make it executable.<br> Install the package 'wmctrl'. And call the script in tint2rc config file. </p><pre class="prettyprint">time1_format = %H:%M
|
||||
time1_font = sans 8
|
||||
time2_format = %A %d %B
|
||||
time2_font = sans 6
|
||||
clock_font_color = #ffffff 76
|
||||
clock_padding = 4 4
|
||||
clock_background_id = 0
|
||||
clock_lclick_command = show_desktop.sh</pre><p>Then left click on the clock will do it. </p><h1><a name="Task_list_is_limited"></a>Task list is limited<a href="#Task_list_is_limited" class="section_anchor"></a></h1><ul><li>In your tint2rc file, check the value of <tt>taskbar_mode</tt>. If it's <tt>multi_desktop</tt>, tint2 show one taskbar per desktop. Change the value to <tt>single_desktop</tt> if you want just one taskbar. </li></ul><h1><a name="How_can_I_get_'pager_like_capability'_?"></a>How can I get 'pager like capability' ?<a href="#How_can_I_get_%27pager_like_capability%27_?" class="section_anchor"></a></h1><ul><li>In your tint2rc file, change the value of <tt>taskbar_mode</tt> to <tt>multi_desktop</tt>. This option will show one taskbar per desktop. So you can detect on witch desktop is an application and witch desktop is empty (or full). You can close an application whithout switching to the desktop. You can drag n drop application between desktop. </li></ul><h1><a name="I_want_to_hide_some_tasks_from_the_panel_?"></a>I want to hide some tasks from the panel ?<a href="#I_want_to_hide_some_tasks_from_the_panel_?" class="section_anchor"></a></h1><ul><li>In Openbox config file 'rc.xml' you can assign the property 'skip_taskbar' to your window </li></ul><h1><a name="The_tint2_panel_is_blank"></a>The tint2 panel is blank<a href="#The_tint2_panel_is_blank" class="section_anchor"></a></h1><ul><li>A new option, called <tt>panel_items</tt> has been added to the config file. This option defines the items tint2 will show and the order of those items(from left to right). Please define that in your tint2rc file. The format is shown below. The options are <tt>L</tt> for <tt>Launcher</tt>, <tt>S</tt> for the <tt>Systray</tt>, <tt>T</tt> for the <tt>taskbar</tt>, <tt>C</tt> for the <tt>clock</tt> and <tt>B</tt> for the <tt>battery</tt>. </li><pre class="prettyprint">panel_items = LTSBC </pre></ul><h1><a name="How_to_maximize_window_over_tint2"></a>How to maximize window over tint2<a href="#How_to_maximize_window_over_tint2" class="section_anchor"></a></h1><ul><li>You can manage interaction between tint2 and window with : </li><pre class="prettyprint">panel_layer = bottom,normal,top
|
||||
strut_policy = follow_size/minimum/none
|
||||
autohide_height = integer</pre></ul><blockquote>If you want maximized window never cover tint2:
|
||||
<pre class="prettyprint">panel_layer = top
|
||||
strut_policy = follow_size</pre>If you want maximized window behind tint2:
|
||||
<pre class="prettyprint">panel_layer = top
|
||||
strut_policy = none</pre>If you want maximized window behind tint2, but 2 pixels free so you can use desktop action (right click, ...):
|
||||
<pre class="prettyprint">panel_layer = top
|
||||
strut_policy = minimum
|
||||
autohide_height = 2</pre></blockquote><h1><a name="I_get_errors_when_I_try_to_compile_tint2_on_my_own"></a>I get errors when I try to compile tint2 on my own<a href="#I_get_errors_when_I_try_to_compile_tint2_on_my_own" class="section_anchor"></a></h1><ul><li>Do you have all the dependencies installed? Please check <a href="https://code.google.com/p/tint2/wiki/Install#Dependencies">here</a> </li></ul><h1><a name="I_upgraded_to_tint2_and_I_still_have_the_old_panel_with_its_bugs"></a>I upgraded to tint2 and I still have the old panel with its bugs<a href="#I_upgraded_to_tint2_and_I_still_have_the_old_panel_with_its_bugs" class="section_anchor"></a></h1><ul><li>The tint binary was renamed tint2 to avoid a conflict with another package.So your new tint2 startup command is <strong>tint2</strong> </li><li>Since a new stable release hasn't been released yet, both the old tint and the new tint2 binaries will be on your system when you upgrade just incase you run into some problems and want to fall back on the old binary. </li></ul><h1><a name="Tint2_doesn't_show_in_Pekwm"></a>Tint2 doesn't show in Pekwm<a href="#Tint2_doesn%27t_show_in_Pekwm" class="section_anchor"></a></h1><ul><li>The problem is that pekwm defines by default edge borders, and doesn't allow a panel to get inside these edge borders. The config option is in <tt>~/.pekwm/config</tt> under <tt>Screen/EdgeSize</tt>. You can either disable the edge borders or set tint2 to a size where it doesn't enter these borders (i.e. play with <tt>panel_size</tt> and <tt>panel_margin</tt>) </li><li>Setting the margin to one pixel made it appear on my screen. With horizontal panel: </li><pre class="prettyprint">panel_size = 95% height
|
||||
panel_margin = 0 1</pre><li>With vertical panel: </li><pre class="prettyprint">panel_size = width 95%
|
||||
panel_margin = 1 0</pre></ul><h1><a name="Is_there_an_IRC_channel?"></a>Is there an IRC channel?<a href="#Is_there_an_IRC_channel?" class="section_anchor"></a></h1><ul><li>Yes. There is now an irc channel, <strong>#tint2</strong> on <a href="irc://irc.freenode.net" rel="nofollow">irc.freenode.net</a>. </li><li>Just ask your question and stay there, because we are not always watching the channel ;) </li></ul>
|
||||
</div>
|
||||
</div>
|
||||
</td></tr><tr>
|
||||
</tr></tbody></table>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div id="wikicommentcol">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="collapse">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div id="commentform">
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="hostedBy" style="margin-top: -20px;">
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</body></html>
|
||||
@@ -153,11 +153,12 @@ void init_battery_panel(void *p)
|
||||
battery->area._draw_foreground = draw_battery;
|
||||
battery->area.size_mode = LAYOUT_FIXED;
|
||||
battery->area._resize = resize_battery;
|
||||
battery->area._is_under_mouse = full_width_area_is_under_mouse;
|
||||
battery->area.on_screen = TRUE;
|
||||
battery->area.resize_needed = 1;
|
||||
battery->area.has_mouse_over_effect = panel_config.mouse_effects &&
|
||||
(battery_lclick_command || battery_mclick_command || battery_rclick_command ||
|
||||
battery_uwheel_command || battery_dwheel_command);
|
||||
battery->area.has_mouse_over_effect =
|
||||
panel_config.mouse_effects && (battery_lclick_command || battery_mclick_command || battery_rclick_command ||
|
||||
battery_uwheel_command || battery_dwheel_command);
|
||||
battery->area.has_mouse_press_effect = battery->area.has_mouse_over_effect;
|
||||
if (battery_tooltip_enabled)
|
||||
battery->area._get_tooltip_text = battery_get_tooltip;
|
||||
@@ -167,13 +168,11 @@ void battery_init_fonts()
|
||||
{
|
||||
if (!bat1_font_desc) {
|
||||
bat1_font_desc = pango_font_description_from_string(get_default_font());
|
||||
pango_font_description_set_size(bat1_font_desc,
|
||||
pango_font_description_get_size(bat1_font_desc) - PANGO_SCALE);
|
||||
pango_font_description_set_size(bat1_font_desc, pango_font_description_get_size(bat1_font_desc) - PANGO_SCALE);
|
||||
}
|
||||
if (!bat2_font_desc) {
|
||||
bat2_font_desc = pango_font_description_from_string(get_default_font());
|
||||
pango_font_description_set_size(bat2_font_desc,
|
||||
pango_font_description_get_size(bat2_font_desc) - PANGO_SCALE);
|
||||
pango_font_description_set_size(bat2_font_desc, pango_font_description_get_size(bat2_font_desc) - PANGO_SCALE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
**************************************************************************/
|
||||
|
||||
#ifdef __linux
|
||||
#ifdef __linux__
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
@@ -180,9 +180,10 @@ void init_clock_panel(void *p)
|
||||
clock_init_fonts();
|
||||
clock->area.parent = p;
|
||||
clock->area.panel = p;
|
||||
clock->area._is_under_mouse = full_width_area_is_under_mouse;
|
||||
clock->area.has_mouse_press_effect = clock->area.has_mouse_over_effect =
|
||||
panel_config.mouse_effects && (clock_lclick_command || clock_mclick_command || clock_rclick_command || clock_uwheel_command ||
|
||||
clock_dwheel_command);
|
||||
panel_config.mouse_effects && (clock_lclick_command || clock_mclick_command || clock_rclick_command ||
|
||||
clock_uwheel_command || clock_dwheel_command);
|
||||
clock->area._draw_foreground = draw_clock;
|
||||
clock->area.size_mode = LAYOUT_FIXED;
|
||||
clock->area._resize = resize_clock;
|
||||
@@ -204,8 +205,7 @@ void clock_init_fonts()
|
||||
if (!time1_font_desc) {
|
||||
time1_font_desc = pango_font_description_from_string(get_default_font());
|
||||
pango_font_description_set_weight(time1_font_desc, PANGO_WEIGHT_BOLD);
|
||||
pango_font_description_set_size(time1_font_desc,
|
||||
pango_font_description_get_size(time1_font_desc));
|
||||
pango_font_description_set_size(time1_font_desc, pango_font_description_get_size(time1_font_desc));
|
||||
}
|
||||
if (!time2_font_desc) {
|
||||
time2_font_desc = pango_font_description_from_string(get_default_font());
|
||||
|
||||
@@ -304,13 +304,13 @@ void add_entry(char *key, char *value)
|
||||
char *b;
|
||||
if ((b = strchr(value1, '%'))) {
|
||||
b[0] = '\0';
|
||||
panel_config.fractional_width = 1;
|
||||
panel_config.fractional_width = TRUE;
|
||||
}
|
||||
panel_config.area.width = atoi(value1);
|
||||
if (panel_config.area.width == 0) {
|
||||
// full width mode
|
||||
panel_config.area.width = 100;
|
||||
panel_config.fractional_width = 1;
|
||||
panel_config.fractional_width = TRUE;
|
||||
}
|
||||
if (value2) {
|
||||
if ((b = strchr(value2, '%'))) {
|
||||
@@ -732,7 +732,7 @@ void add_entry(char *key, char *value)
|
||||
panel_config.g_taskbar.background_name[TASKBAR_NORMAL] = &g_array_index(backgrounds, Background, id);
|
||||
if (panel_config.g_taskbar.background_name[TASKBAR_ACTIVE] == 0)
|
||||
panel_config.g_taskbar.background_name[TASKBAR_ACTIVE] =
|
||||
panel_config.g_taskbar.background_name[TASKBAR_NORMAL];
|
||||
panel_config.g_taskbar.background_name[TASKBAR_NORMAL];
|
||||
} else if (strcmp(key, "taskbar_name_active_background_id") == 0) {
|
||||
int id = atoi(value);
|
||||
id = (id < backgrounds->len && id >= 0) ? id : 0;
|
||||
|
||||
@@ -162,9 +162,12 @@ void init_execp_panel(void *p)
|
||||
execp->area.size_mode = LAYOUT_FIXED;
|
||||
execp->area._resize = resize_execp;
|
||||
execp->area._get_tooltip_text = execp_get_tooltip;
|
||||
execp->area.has_mouse_press_effect = panel_config.mouse_effects && (execp->area.has_mouse_over_effect =
|
||||
execp->backend->lclick_command || execp->backend->mclick_command || execp->backend->rclick_command ||
|
||||
execp->backend->uwheel_command || execp->backend->dwheel_command);
|
||||
execp->area._is_under_mouse = full_width_area_is_under_mouse;
|
||||
execp->area.has_mouse_press_effect =
|
||||
panel_config.mouse_effects &&
|
||||
(execp->area.has_mouse_over_effect = execp->backend->lclick_command || execp->backend->mclick_command ||
|
||||
execp->backend->rclick_command || execp->backend->uwheel_command ||
|
||||
execp->backend->dwheel_command);
|
||||
|
||||
execp->area.resize_needed = TRUE;
|
||||
execp->area.on_screen = TRUE;
|
||||
@@ -670,11 +673,7 @@ const char *time_to_string(int seconds, char *buffer)
|
||||
int m = seconds / 60;
|
||||
seconds = seconds % 60;
|
||||
int s = seconds;
|
||||
sprintf(buffer,
|
||||
"%d:%d:%ds",
|
||||
h,
|
||||
m,
|
||||
s);
|
||||
sprintf(buffer, "%d:%d:%ds", h, m, s);
|
||||
}
|
||||
return buffer;
|
||||
}
|
||||
|
||||
@@ -90,7 +90,6 @@ typedef struct Execp {
|
||||
ExecpFrontend *frontend;
|
||||
} Execp;
|
||||
|
||||
|
||||
// Called before the config is read and panel_config/panels are created.
|
||||
// Afterwards, the config parsing code creates the array of Execp in panel_config and populates the configuration fields
|
||||
// in the backend.
|
||||
@@ -121,7 +120,6 @@ void init_execp_panel(void *panel);
|
||||
// GUI element tree cleanup function (remove_area).
|
||||
void cleanup_execp();
|
||||
|
||||
|
||||
// Called on draw, obj = pointer to the front-end Execp item.
|
||||
void draw_execp(void *obj, cairo_t *c);
|
||||
|
||||
|
||||
@@ -19,12 +19,19 @@
|
||||
/* http://standards.freedesktop.org/desktop-entry-spec/ */
|
||||
|
||||
#include "apps-common.h"
|
||||
#include "common.h"
|
||||
#include "strnatcmp.h"
|
||||
|
||||
#include <glib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
static gint compare_strings(gconstpointer a, gconstpointer b)
|
||||
{
|
||||
return strnatcasecmp((const char *)a, (const char *)b);
|
||||
}
|
||||
|
||||
int parse_dektop_line(char *line, char **key, char **value)
|
||||
{
|
||||
char *p;
|
||||
@@ -53,8 +60,8 @@ void expand_exec(DesktopEntry *entry, const char *path)
|
||||
// %k -> path
|
||||
if (entry->exec) {
|
||||
char *exec2 = calloc(strlen(entry->exec) + (entry->name ? strlen(entry->name) : 1) +
|
||||
(entry->icon ? strlen(entry->icon) : 1) + 100,
|
||||
1);
|
||||
(entry->icon ? strlen(entry->icon) : 1) + 100,
|
||||
1);
|
||||
char *p, *q;
|
||||
// p will never point to an escaped char
|
||||
for (p = entry->exec, q = exec2; *p; p++, q++) {
|
||||
@@ -101,61 +108,77 @@ void expand_exec(DesktopEntry *entry, const char *path)
|
||||
}
|
||||
}
|
||||
|
||||
int read_desktop_file(const char *path, DesktopEntry *entry)
|
||||
gboolean read_desktop_file_full_path(const char *path, DesktopEntry *entry)
|
||||
{
|
||||
FILE *fp;
|
||||
char *line = NULL;
|
||||
size_t line_size;
|
||||
char *key, *value;
|
||||
int i;
|
||||
entry->name = entry->generic_name = entry->icon = entry->exec = NULL;
|
||||
entry->hidden_from_menus = FALSE;
|
||||
|
||||
entry->path = strdup(path);
|
||||
entry->name = entry->icon = entry->exec = NULL;
|
||||
|
||||
if ((fp = fopen(path, "rt")) == NULL) {
|
||||
FILE *fp = fopen(path, "rt");
|
||||
if (fp == NULL) {
|
||||
fprintf(stderr, "Could not open file %s\n", path);
|
||||
return 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
const gchar **languages = (const gchar **)g_get_language_names();
|
||||
const gchar **languages = (const gchar **)g_get_language_names();
|
||||
// lang_index is the index of the language for the best Name key in the language vector
|
||||
// lang_index_default is a constant that encodes the Name key without a language
|
||||
int lang_index, lang_index_default;
|
||||
int lang_index_default = 1;
|
||||
#define LANG_DBG 0
|
||||
if (LANG_DBG)
|
||||
printf("Languages:");
|
||||
for (i = 0; languages[i]; i++) {
|
||||
for (int i = 0; languages[i]; i++) {
|
||||
lang_index_default = i + 1;
|
||||
if (LANG_DBG)
|
||||
printf(" %s", languages[i]);
|
||||
}
|
||||
if (LANG_DBG)
|
||||
printf("\n");
|
||||
lang_index_default = i;
|
||||
// we currently do not know about any Name key at all, so use an invalid index
|
||||
lang_index = lang_index_default + 1;
|
||||
int lang_index_name = lang_index_default + 1;
|
||||
int lang_index_generic_name = lang_index_default + 1;
|
||||
|
||||
int inside_desktop_entry = 0;
|
||||
gboolean inside_desktop_entry = 0;
|
||||
char *line = NULL;
|
||||
size_t line_size;
|
||||
while (getline(&line, &line_size, fp) >= 0) {
|
||||
int len = strlen(line);
|
||||
if (len == 0)
|
||||
continue;
|
||||
line[len - 1] = '\0';
|
||||
if (line[len - 1] == '\n')
|
||||
line[len - 1] = '\0';
|
||||
if (line[0] == '[') {
|
||||
inside_desktop_entry = (strcmp(line, "[Desktop Entry]") == 0);
|
||||
}
|
||||
char *key, *value;
|
||||
if (inside_desktop_entry && parse_dektop_line(line, &key, &value)) {
|
||||
if (strstr(key, "Name") == key) {
|
||||
if (strcmp(key, "Name") == 0 && lang_index > lang_index_default) {
|
||||
if (strcmp(key, "Name") == 0 && lang_index_name > lang_index_default) {
|
||||
entry->name = strdup(value);
|
||||
lang_index = lang_index_default;
|
||||
lang_index_name = lang_index_default;
|
||||
} else {
|
||||
for (i = 0; languages[i] && i < lang_index; i++) {
|
||||
for (int i = 0; languages[i] && i < lang_index_name; i++) {
|
||||
gchar *localized_key = g_strdup_printf("Name[%s]", languages[i]);
|
||||
if (strcmp(key, localized_key) == 0) {
|
||||
if (entry->name)
|
||||
free(entry->name);
|
||||
entry->name = strdup(value);
|
||||
lang_index = i;
|
||||
lang_index_name = i;
|
||||
}
|
||||
g_free(localized_key);
|
||||
}
|
||||
}
|
||||
} else if (strstr(key, "GenericName") == key) {
|
||||
if (strcmp(key, "GenericName") == 0 && lang_index_generic_name > lang_index_default) {
|
||||
entry->generic_name = strdup(value);
|
||||
lang_index_generic_name = lang_index_default;
|
||||
} else {
|
||||
for (int i = 0; languages[i] && i < lang_index_generic_name; i++) {
|
||||
gchar *localized_key = g_strdup_printf("GenericName[%s]", languages[i]);
|
||||
if (strcmp(key, localized_key) == 0) {
|
||||
if (entry->generic_name)
|
||||
free(entry->generic_name);
|
||||
entry->generic_name = strdup(value);
|
||||
lang_index_generic_name = i;
|
||||
}
|
||||
g_free(localized_key);
|
||||
}
|
||||
@@ -164,26 +187,90 @@ int read_desktop_file(const char *path, DesktopEntry *entry)
|
||||
entry->exec = strdup(value);
|
||||
} else if (!entry->icon && strcmp(key, "Icon") == 0) {
|
||||
entry->icon = strdup(value);
|
||||
} else if (strcmp(key, "NoDisplay") == 0) {
|
||||
entry->hidden_from_menus = strcasecmp(value, "true") == 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
// From this point:
|
||||
// entry->name, entry->icon, entry->exec will never be empty strings (can be NULL though)
|
||||
// entry->name, entry->generic_name, entry->icon, entry->exec will never be empty strings (can be NULL though)
|
||||
|
||||
expand_exec(entry, path);
|
||||
expand_exec(entry, entry->path);
|
||||
|
||||
free(line);
|
||||
return 1;
|
||||
return entry->exec != NULL;
|
||||
}
|
||||
|
||||
gboolean read_desktop_file_from_dir(const char *path, const char *file_name, DesktopEntry *entry)
|
||||
{
|
||||
gchar *full_path = g_build_filename(path, file_name, NULL);
|
||||
if (read_desktop_file_full_path(full_path, entry)) {
|
||||
g_free(full_path);
|
||||
return TRUE;
|
||||
}
|
||||
free(entry->name);
|
||||
free(entry->generic_name);
|
||||
free(entry->icon);
|
||||
free(entry->exec);
|
||||
entry->name = entry->generic_name = entry->icon = entry->exec = NULL;
|
||||
|
||||
GList *subdirs = NULL;
|
||||
|
||||
GDir *d = g_dir_open(path, 0, NULL);
|
||||
if (d) {
|
||||
const gchar *name;
|
||||
while ((name = g_dir_read_name(d))) {
|
||||
gchar *child = g_build_filename(path, name, NULL);
|
||||
if (g_file_test(child, G_FILE_TEST_IS_DIR)) {
|
||||
subdirs = g_list_append(subdirs, child);
|
||||
} else {
|
||||
g_free(child);
|
||||
}
|
||||
}
|
||||
g_dir_close(d);
|
||||
}
|
||||
|
||||
subdirs = g_list_sort(subdirs, compare_strings);
|
||||
gboolean found = FALSE;
|
||||
for (GList *l = subdirs; l; l = g_list_next(l)) {
|
||||
if (read_desktop_file_from_dir(l->data, file_name, entry)) {
|
||||
found = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (GList *l = subdirs; l; l = g_list_next(l)) {
|
||||
g_free(l->data);
|
||||
}
|
||||
g_list_free(subdirs);
|
||||
g_free(full_path);
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
gboolean read_desktop_file(const char *path, DesktopEntry *entry)
|
||||
{
|
||||
entry->path = strdup(path);
|
||||
entry->name = entry->generic_name = entry->icon = entry->exec = NULL;
|
||||
|
||||
if (strchr(path, '/'))
|
||||
return read_desktop_file_full_path(path, entry);
|
||||
for (const GSList *location = get_apps_locations(); location; location = g_slist_next(location)) {
|
||||
if (read_desktop_file_from_dir(location->data, path, entry))
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void free_desktop_entry(DesktopEntry *entry)
|
||||
{
|
||||
free(entry->name);
|
||||
free(entry->generic_name);
|
||||
free(entry->icon);
|
||||
free(entry->exec);
|
||||
free(entry->path);
|
||||
entry->name = entry->icon = entry->exec = entry->path = NULL;
|
||||
entry->name = entry->generic_name = entry->icon = entry->exec = entry->path = NULL;
|
||||
}
|
||||
|
||||
void test_read_desktop_file()
|
||||
@@ -191,6 +278,29 @@ void test_read_desktop_file()
|
||||
fprintf(stdout, "\033[1;33m");
|
||||
DesktopEntry entry;
|
||||
read_desktop_file("/usr/share/applications/firefox.desktop", &entry);
|
||||
printf("Name:%s Icon:%s Exec:%s\n", entry.name, entry.icon, entry.exec);
|
||||
printf("Name:%s GenericName:%s Icon:%s Exec:%s\n", entry.name, entry.generic_name, entry.icon, entry.exec);
|
||||
fprintf(stdout, "\033[0m");
|
||||
}
|
||||
|
||||
GSList *apps_locations = NULL;
|
||||
// Do not free the result.
|
||||
const GSList *get_apps_locations()
|
||||
{
|
||||
if (apps_locations)
|
||||
return apps_locations;
|
||||
|
||||
apps_locations = load_locations_from_env(apps_locations, "XDG_DATA_HOME", "applications", NULL);
|
||||
|
||||
apps_locations =
|
||||
g_slist_append(apps_locations, g_build_filename(g_get_home_dir(), ".local/share/applications", NULL));
|
||||
|
||||
apps_locations = load_locations_from_env(apps_locations, "XDG_DATA_DIRS", "applications", NULL);
|
||||
|
||||
apps_locations = g_slist_append(apps_locations, g_strdup("/usr/local/share/applications"));
|
||||
apps_locations = g_slist_append(apps_locations, g_strdup("/usr/share/applications"));
|
||||
apps_locations = g_slist_append(apps_locations, g_strdup("/opt/share/applications"));
|
||||
|
||||
apps_locations = slist_remove_duplicates(apps_locations, g_str_equal, g_free);
|
||||
|
||||
return apps_locations;
|
||||
}
|
||||
|
||||
@@ -7,11 +7,15 @@
|
||||
#ifndef APPS_COMMON_H
|
||||
#define APPS_COMMON_H
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
typedef struct DesktopEntry {
|
||||
char *name;
|
||||
char *generic_name;
|
||||
char *exec;
|
||||
char *icon;
|
||||
char *path;
|
||||
gboolean hidden_from_menus;
|
||||
} DesktopEntry;
|
||||
|
||||
// Parses a line of the form "key = value". Modifies the line.
|
||||
@@ -22,9 +26,13 @@ int parse_dektop_line(char *line, char **key, char **value);
|
||||
// Reads the .desktop file from the given path into the DesktopEntry entry.
|
||||
// The DesktopEntry object must be initially empty.
|
||||
// Returns 1 if successful.
|
||||
int read_desktop_file(const char *path, DesktopEntry *entry);
|
||||
gboolean read_desktop_file(const char *path, DesktopEntry *entry);
|
||||
|
||||
// Empties DesktopEntry: releases the memory of the *members* of entry.
|
||||
void free_desktop_entry(DesktopEntry *entry);
|
||||
|
||||
// Returns a list of the directories used to store desktop files.
|
||||
// Do not free the result, it is cached.
|
||||
const GSList *get_apps_locations();
|
||||
|
||||
#endif
|
||||
|
||||
@@ -20,11 +20,14 @@
|
||||
|
||||
#include "icon-theme-common.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "apps-common.h"
|
||||
#include "common.h"
|
||||
#include "cache.h"
|
||||
|
||||
#define ICON_DIR_TYPE_SCALABLE 0
|
||||
#define ICON_DIR_TYPE_FIXED 1
|
||||
@@ -50,19 +53,22 @@ const GSList *get_icon_locations()
|
||||
if (icon_locations)
|
||||
return icon_locations;
|
||||
|
||||
gchar *path;
|
||||
path = g_build_filename(g_get_home_dir(), ".icons", NULL);
|
||||
icon_locations = g_slist_append(icon_locations, g_strdup(path));
|
||||
g_free(path);
|
||||
path = g_build_filename(g_get_home_dir(), ".local/share/icons", NULL);
|
||||
icon_locations = g_slist_append(icon_locations, g_strdup(path));
|
||||
g_free(path);
|
||||
icon_locations = load_locations_from_env(icon_locations, "XDG_DATA_HOME", ".icons", NULL);
|
||||
|
||||
icon_locations = g_slist_append(icon_locations, g_build_filename(g_get_home_dir(), ".icons", NULL));
|
||||
icon_locations = g_slist_append(icon_locations, g_build_filename(g_get_home_dir(), ".local/share/icons", NULL));
|
||||
|
||||
icon_locations = load_locations_from_env(icon_locations, "XDG_DATA_DIRS", ".icons", ".pixmaps", NULL);
|
||||
|
||||
icon_locations = g_slist_append(icon_locations, g_strdup("/usr/local/share/icons"));
|
||||
icon_locations = g_slist_append(icon_locations, g_strdup("/usr/local/share/pixmaps"));
|
||||
icon_locations = g_slist_append(icon_locations, g_strdup("/usr/share/icons"));
|
||||
icon_locations = g_slist_append(icon_locations, g_strdup("/usr/share/pixmaps"));
|
||||
icon_locations = g_slist_append(icon_locations, g_strdup("/opt/share/icons"));
|
||||
icon_locations = g_slist_append(icon_locations, g_strdup("/opt/share/pixmaps"));
|
||||
|
||||
icon_locations = slist_remove_duplicates(icon_locations, g_str_equal, g_free);
|
||||
|
||||
return icon_locations;
|
||||
}
|
||||
|
||||
@@ -279,6 +285,8 @@ void free_icon_theme(IconTheme *theme)
|
||||
return;
|
||||
free(theme->name);
|
||||
theme->name = NULL;
|
||||
free(theme->description);
|
||||
theme->description = NULL;
|
||||
for (GSList *l_inherits = theme->list_inherits; l_inherits; l_inherits = l_inherits->next) {
|
||||
free(l_inherits->data);
|
||||
}
|
||||
@@ -293,23 +301,25 @@ void free_icon_theme(IconTheme *theme)
|
||||
theme->list_directories = NULL;
|
||||
}
|
||||
|
||||
void free_themes(IconThemeWrapper *themes)
|
||||
void free_themes(IconThemeWrapper *wrapper)
|
||||
{
|
||||
if (!themes)
|
||||
if (!wrapper)
|
||||
return;
|
||||
for (GSList *l = themes->themes; l; l = l->next) {
|
||||
for (GSList *l = wrapper->themes; l; l = l->next) {
|
||||
IconTheme *theme = (IconTheme *)l->data;
|
||||
free_icon_theme(theme);
|
||||
free(theme);
|
||||
}
|
||||
g_slist_free(themes->themes);
|
||||
for (GSList *l = themes->themes_fallback; l; l = l->next) {
|
||||
g_slist_free(wrapper->themes);
|
||||
for (GSList *l = wrapper->themes_fallback; l; l = l->next) {
|
||||
IconTheme *theme = (IconTheme *)l->data;
|
||||
free_icon_theme(theme);
|
||||
free(theme);
|
||||
}
|
||||
g_slist_free(themes->themes_fallback);
|
||||
free(themes);
|
||||
g_slist_free(wrapper->themes_fallback);
|
||||
g_slist_free_full(wrapper->_queued, free);
|
||||
free_cache(&wrapper->_cache);
|
||||
free(wrapper);
|
||||
}
|
||||
|
||||
void test_launcher_read_theme_file()
|
||||
@@ -336,9 +346,9 @@ void test_launcher_read_theme_file()
|
||||
dir->max_size,
|
||||
dir->threshold,
|
||||
dir->type == ICON_DIR_TYPE_FIXED ? "Fixed" : dir->type == ICON_DIR_TYPE_SCALABLE
|
||||
? "Scalable"
|
||||
: dir->type == ICON_DIR_TYPE_THRESHOLD ? "Threshold"
|
||||
: "?????");
|
||||
? "Scalable"
|
||||
: dir->type == ICON_DIR_TYPE_THRESHOLD ? "Threshold"
|
||||
: "?????");
|
||||
item = g_slist_next(item);
|
||||
}
|
||||
fprintf(stdout, "\033[0m");
|
||||
@@ -397,20 +407,25 @@ void load_themes_helper(const char *name, GSList **themes, GSList **queued)
|
||||
g_slist_free(queue);
|
||||
}
|
||||
|
||||
IconThemeWrapper *load_themes(const char *icon_theme_name)
|
||||
void load_default_theme(IconThemeWrapper *wrapper)
|
||||
{
|
||||
IconThemeWrapper *wrapper = calloc(1, sizeof(IconThemeWrapper));
|
||||
if (wrapper->_themes_loaded)
|
||||
return;
|
||||
|
||||
if (!icon_theme_name) {
|
||||
fprintf(stderr, "Missing icon_theme_name theme, default to 'hicolor'.\n");
|
||||
icon_theme_name = "hicolor";
|
||||
} else {
|
||||
fprintf(stderr, "Loading %s. Icon theme :", icon_theme_name);
|
||||
}
|
||||
fprintf(stderr, GREEN "Loading icon theme %s:" RESET "\n", wrapper->icon_theme_name);
|
||||
|
||||
GSList *queued = NULL;
|
||||
load_themes_helper(icon_theme_name, &wrapper->themes, &queued);
|
||||
load_themes_helper("hicolor", &wrapper->themes, &queued);
|
||||
load_themes_helper(wrapper->icon_theme_name, &wrapper->themes, &wrapper->_queued);
|
||||
load_themes_helper("hicolor", &wrapper->themes, &wrapper->_queued);
|
||||
|
||||
wrapper->_themes_loaded = TRUE;
|
||||
}
|
||||
|
||||
void load_fallbacks(IconThemeWrapper *wrapper)
|
||||
{
|
||||
if (wrapper->_fallback_loaded)
|
||||
return;
|
||||
|
||||
fprintf(stderr, RED "Loading additional icon themes (this means your icon theme is incomplete)..." RESET "\n");
|
||||
|
||||
// Load wrapper->themes_fallback
|
||||
const GSList *location;
|
||||
@@ -422,7 +437,7 @@ IconThemeWrapper *load_themes(const char *icon_theme_name)
|
||||
while ((name = g_dir_read_name(d))) {
|
||||
gchar *file_name = g_build_filename(path, name, "index.theme", NULL);
|
||||
if (g_file_test(file_name, G_FILE_TEST_EXISTS) && !g_file_test(file_name, G_FILE_TEST_IS_DIR)) {
|
||||
load_themes_helper(name, &wrapper->themes_fallback, &queued);
|
||||
load_themes_helper(name, &wrapper->themes_fallback, &wrapper->_queued);
|
||||
}
|
||||
g_free(file_name);
|
||||
}
|
||||
@@ -430,11 +445,47 @@ IconThemeWrapper *load_themes(const char *icon_theme_name)
|
||||
}
|
||||
}
|
||||
|
||||
// Free the queued list
|
||||
GSList *l;
|
||||
for (l = queued; l; l = l->next)
|
||||
free(l->data);
|
||||
g_slist_free(queued);
|
||||
wrapper->_fallback_loaded = TRUE;
|
||||
}
|
||||
|
||||
gchar *get_icon_cache_path()
|
||||
{
|
||||
return g_build_filename(g_get_user_cache_dir(), "tint2", "icon.cache", NULL);
|
||||
}
|
||||
|
||||
void load_icon_cache(IconThemeWrapper *wrapper)
|
||||
{
|
||||
if (wrapper->_cache.loaded)
|
||||
return;
|
||||
|
||||
fprintf(stderr, GREEN "Loading icon theme cache..." RESET "\n");
|
||||
|
||||
gchar *cache_path = get_icon_cache_path();
|
||||
load_cache(&wrapper->_cache, cache_path);
|
||||
g_free(cache_path);
|
||||
}
|
||||
|
||||
void save_icon_cache(IconThemeWrapper *wrapper)
|
||||
{
|
||||
if (!wrapper || !wrapper->_cache.dirty)
|
||||
return;
|
||||
|
||||
fprintf(stderr, GREEN "Saving icon theme cache..." RESET "\n");
|
||||
gchar *cache_path = get_icon_cache_path();
|
||||
save_cache(&wrapper->_cache, cache_path);
|
||||
g_free(cache_path);
|
||||
}
|
||||
|
||||
IconThemeWrapper *load_themes(const char *icon_theme_name)
|
||||
{
|
||||
IconThemeWrapper *wrapper = calloc(1, sizeof(IconThemeWrapper));
|
||||
|
||||
if (!icon_theme_name) {
|
||||
fprintf(stderr, "Missing icon_theme_name theme, default to 'hicolor'.\n");
|
||||
icon_theme_name = "hicolor";
|
||||
}
|
||||
|
||||
wrapper->icon_theme_name = strdup(icon_theme_name);
|
||||
|
||||
return wrapper;
|
||||
}
|
||||
@@ -534,9 +585,9 @@ char *get_icon_path_helper(GSList *themes, const char *icon_name, int size)
|
||||
|
||||
for (theme = themes; theme; theme = g_slist_next(theme)) {
|
||||
((IconTheme *)theme->data)->list_directories =
|
||||
g_slist_sort_with_data(((IconTheme *)theme->data)->list_directories,
|
||||
compare_theme_directories,
|
||||
GINT_TO_POINTER(size));
|
||||
g_slist_sort_with_data(((IconTheme *)theme->data)->list_directories,
|
||||
compare_theme_directories,
|
||||
GINT_TO_POINTER(size));
|
||||
GSList *dir;
|
||||
for (dir = ((IconTheme *)theme->data)->list_directories; dir; dir = g_slist_next(dir)) {
|
||||
// Closest match
|
||||
@@ -556,7 +607,7 @@ char *get_icon_path_helper(GSList *themes, const char *icon_name, int size)
|
||||
char *dir_name = ((IconThemeDir *)dir->data)->name;
|
||||
char *extension = (char *)ext->data;
|
||||
if (strlen(base_name) + strlen(theme_name) + strlen(dir_name) + strlen(icon_name) +
|
||||
strlen(extension) + 100 >
|
||||
strlen(extension) + 100 >
|
||||
file_name_size) {
|
||||
file_name_size = strlen(base_name) + strlen(theme_name) + strlen(dir_name) + strlen(icon_name) +
|
||||
strlen(extension) + 100;
|
||||
@@ -640,21 +691,89 @@ char *get_icon_path_helper(GSList *themes, const char *icon_name, int size)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *get_icon_path(IconThemeWrapper *theme, const char *icon_name, int size)
|
||||
char *get_icon_path_from_cache(IconThemeWrapper *wrapper, const char *icon_name, int size)
|
||||
{
|
||||
if (!theme)
|
||||
if (!wrapper || !icon_name || strlen(icon_name) == 0)
|
||||
return NULL;
|
||||
|
||||
load_icon_cache(wrapper);
|
||||
|
||||
gchar *key = g_strdup_printf("%s\t%s\t%d", wrapper->icon_theme_name, icon_name, size);
|
||||
const gchar *value = get_from_cache(&wrapper->_cache, key);
|
||||
g_free(key);
|
||||
|
||||
if (!value) {
|
||||
fprintf(stderr,
|
||||
YELLOW "Icon path not found in cache: theme = %s, icon = %s, size = %d" RESET "\n",
|
||||
wrapper->icon_theme_name,
|
||||
icon_name,
|
||||
size);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!g_file_test(value, G_FILE_TEST_EXISTS))
|
||||
return NULL;
|
||||
|
||||
// fprintf(stderr, "Icon path found in cache: theme = %s, icon = %s, size = %d, path = %s\n",
|
||||
// wrapper->icon_theme_name, icon_name, size, value);
|
||||
|
||||
return strdup(value);
|
||||
}
|
||||
|
||||
void add_icon_path_to_cache(IconThemeWrapper *wrapper, const char *icon_name, int size, const char *path)
|
||||
{
|
||||
if (!wrapper || !icon_name || strlen(icon_name) == 0 || !path || strlen(path) == 0)
|
||||
return;
|
||||
|
||||
fprintf(stderr,
|
||||
"Adding icon path to cache: theme = %s, icon = %s, size = %d, path = %s\n",
|
||||
wrapper->icon_theme_name,
|
||||
icon_name,
|
||||
size,
|
||||
path);
|
||||
|
||||
load_icon_cache(wrapper);
|
||||
|
||||
gchar *key = g_strdup_printf("%s\t%s\t%d", wrapper->icon_theme_name, icon_name, size);
|
||||
add_to_cache(&wrapper->_cache, key, path);
|
||||
g_free(key);
|
||||
}
|
||||
|
||||
char *get_icon_path(IconThemeWrapper *wrapper, const char *icon_name, int size)
|
||||
{
|
||||
if (!wrapper)
|
||||
return NULL;
|
||||
|
||||
if (!icon_name || strlen(icon_name) == 0)
|
||||
goto notfound;
|
||||
|
||||
char *path = get_icon_path_from_cache(wrapper, icon_name, size);
|
||||
if (path)
|
||||
return path;
|
||||
|
||||
load_default_theme(wrapper);
|
||||
|
||||
icon_name = icon_name ? icon_name : DEFAULT_ICON;
|
||||
char *path = get_icon_path_helper(theme->themes, icon_name, size);
|
||||
if (!path) {
|
||||
path = get_icon_path_helper(theme->themes_fallback, icon_name, size);
|
||||
path = get_icon_path_helper(wrapper->themes, icon_name, size);
|
||||
if (path) {
|
||||
add_icon_path_to_cache(wrapper, icon_name, size, path);
|
||||
return path;
|
||||
}
|
||||
if (!path) {
|
||||
fprintf(stderr, "Could not find icon %s\n", icon_name);
|
||||
path = get_icon_path_helper(theme->themes, DEFAULT_ICON, size);
|
||||
}
|
||||
if (!path) {
|
||||
path = get_icon_path_helper(theme->themes_fallback, DEFAULT_ICON, size);
|
||||
|
||||
fprintf(stderr, YELLOW "Icon not found in default theme: %s" RESET "\n", icon_name);
|
||||
load_fallbacks(wrapper);
|
||||
|
||||
path = get_icon_path_helper(wrapper->themes_fallback, icon_name, size);
|
||||
if (path) {
|
||||
add_icon_path_to_cache(wrapper, icon_name, size, path);
|
||||
return path;
|
||||
}
|
||||
|
||||
notfound:
|
||||
fprintf(stderr, RED "Could not find icon '%s', using default." RESET "\n", icon_name);
|
||||
path = get_icon_path_helper(wrapper->themes, DEFAULT_ICON, size);
|
||||
if (path)
|
||||
return path;
|
||||
path = get_icon_path_helper(wrapper->themes_fallback, DEFAULT_ICON, size);
|
||||
return path;
|
||||
}
|
||||
|
||||
@@ -7,16 +7,28 @@
|
||||
#define ICON_THEME_COMMON_H
|
||||
|
||||
#include <glib.h>
|
||||
#include "cache.h"
|
||||
|
||||
typedef struct IconThemeWrapper {
|
||||
// The icon theme name for which this wrapper was created
|
||||
char *icon_theme_name;
|
||||
// List of IconTheme*
|
||||
GSList *themes;
|
||||
// Themes are loaded lazily when needed.
|
||||
gboolean _themes_loaded;
|
||||
// List of IconTheme*
|
||||
GSList *themes_fallback;
|
||||
// Fallback themes are loaded lazily when needed.
|
||||
gboolean _fallback_loaded;
|
||||
Cache _cache;
|
||||
// List of icon theme names that have been queued for loading.
|
||||
// Used to avoid loading the same theme twice, and to avoid cycles.
|
||||
GSList *_queued;
|
||||
} IconThemeWrapper;
|
||||
|
||||
typedef struct IconTheme {
|
||||
char *name;
|
||||
char *description;
|
||||
GSList *list_inherits; // each item is a char* (theme name)
|
||||
GSList *list_directories; // each item is an IconThemeDir*
|
||||
} IconTheme;
|
||||
@@ -30,13 +42,16 @@ int parse_theme_line(char *line, char **key, char **value);
|
||||
// inherited themes, the hicolor theme and possibly fallback themes.
|
||||
IconThemeWrapper *load_themes(const char *icon_theme_name);
|
||||
|
||||
void free_themes(IconThemeWrapper *themes);
|
||||
void save_icon_cache(IconThemeWrapper *wrapper);
|
||||
|
||||
void free_themes(IconThemeWrapper *wrapper);
|
||||
void free_icon_theme(IconTheme *theme);
|
||||
|
||||
#define DEFAULT_ICON "application-x-executable"
|
||||
|
||||
// Returns the full path to an icon file (or NULL) given the list of icon themes to search and the icon name
|
||||
// Note: needs to be released with free().
|
||||
char *get_icon_path(IconThemeWrapper *theme, const char *icon_name, int size);
|
||||
char *get_icon_path(IconThemeWrapper *wrapper, const char *icon_name, int size);
|
||||
|
||||
// Returns a list of the directories used to store icons.
|
||||
// Do not free the result, it is cached.
|
||||
|
||||
@@ -140,15 +140,15 @@ void cleanup_launcher_theme(Launcher *launcher)
|
||||
free(launcherIcon->icon_name);
|
||||
free(launcherIcon->icon_path);
|
||||
free(launcherIcon->cmd);
|
||||
free(launcherIcon->icon_tooltip);
|
||||
g_free(launcherIcon->icon_tooltip);
|
||||
}
|
||||
free(launcherIcon);
|
||||
}
|
||||
g_slist_free(launcher->list_icons);
|
||||
launcher->list_icons = NULL;
|
||||
|
||||
free_themes(launcher->list_themes);
|
||||
launcher->list_themes = NULL;
|
||||
free_themes(launcher->icon_theme_wrapper);
|
||||
launcher->icon_theme_wrapper = NULL;
|
||||
}
|
||||
|
||||
gboolean resize_launcher(void *obj)
|
||||
@@ -176,7 +176,7 @@ gboolean resize_launcher(void *obj)
|
||||
|
||||
// Get the path for an icon file with the new size
|
||||
char *new_icon_path =
|
||||
get_icon_path(launcher->list_themes, launcherIcon->icon_name, launcherIcon->icon_size);
|
||||
get_icon_path(launcher->icon_theme_wrapper, launcherIcon->icon_name, launcherIcon->icon_size);
|
||||
if (!new_icon_path) {
|
||||
// Draw a blank icon
|
||||
free_icon(launcherIcon->image);
|
||||
@@ -195,7 +195,7 @@ gboolean resize_launcher(void *obj)
|
||||
// On loading error, fallback to default
|
||||
if (!launcherIcon->image) {
|
||||
free(new_icon_path);
|
||||
new_icon_path = get_icon_path(launcher->list_themes, DEFAULT_ICON, launcherIcon->icon_size);
|
||||
new_icon_path = get_icon_path(launcher->icon_theme_wrapper, DEFAULT_ICON, launcherIcon->icon_size);
|
||||
if (new_icon_path)
|
||||
launcherIcon->image = imlib_load_image_immediately(new_icon_path);
|
||||
}
|
||||
@@ -225,6 +225,7 @@ gboolean resize_launcher(void *obj)
|
||||
panel_config.mouse_pressed_brightness);
|
||||
}
|
||||
}
|
||||
save_icon_cache(launcher->icon_theme_wrapper);
|
||||
|
||||
int count = g_slist_length(launcher->list_icons);
|
||||
|
||||
@@ -293,6 +294,16 @@ gboolean resize_launcher(void *obj)
|
||||
}
|
||||
}
|
||||
|
||||
if ((panel_horizontal && icons_per_column == 1) || (!panel_horizontal && icons_per_row == 1)) {
|
||||
launcher->area._is_under_mouse = full_width_area_is_under_mouse;
|
||||
for (GSList *l = launcher->list_icons; l; l = l->next)
|
||||
((LauncherIcon *)l->data)->area._is_under_mouse = full_width_area_is_under_mouse;
|
||||
} else {
|
||||
launcher->area._is_under_mouse = NULL;
|
||||
for (GSList *l = launcher->list_icons; l; l = l->next)
|
||||
((LauncherIcon *)l->data)->area._is_under_mouse = NULL;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -338,8 +349,12 @@ Imlib_Image scale_icon(Imlib_Image original, int icon_size)
|
||||
Imlib_Image icon_scaled;
|
||||
if (original) {
|
||||
imlib_context_set_image(original);
|
||||
icon_scaled =
|
||||
imlib_create_cropped_scaled_image(0, 0, imlib_image_get_width(), imlib_image_get_height(), icon_size, icon_size);
|
||||
icon_scaled = imlib_create_cropped_scaled_image(0,
|
||||
0,
|
||||
imlib_image_get_width(),
|
||||
imlib_image_get_height(),
|
||||
icon_size,
|
||||
icon_size);
|
||||
|
||||
imlib_context_set_image(icon_scaled);
|
||||
imlib_image_set_has_alpha(1);
|
||||
@@ -347,9 +362,9 @@ Imlib_Image scale_icon(Imlib_Image original, int icon_size)
|
||||
adjust_asb(data,
|
||||
icon_size,
|
||||
icon_size,
|
||||
launcher_alpha,
|
||||
(float)launcher_saturation / 100,
|
||||
(float)launcher_brightness / 100);
|
||||
launcher_alpha / 100.0,
|
||||
launcher_saturation / 100.0,
|
||||
launcher_brightness / 100.0);
|
||||
imlib_image_put_back_data(data);
|
||||
|
||||
imlib_context_set_image(icon_scaled);
|
||||
@@ -456,7 +471,19 @@ void launcher_load_icons(Launcher *launcher)
|
||||
launcherIcon->cmd = strdup(entry.exec);
|
||||
launcherIcon->icon_name = entry.icon ? strdup(entry.icon) : strdup(DEFAULT_ICON);
|
||||
launcherIcon->icon_size = 1;
|
||||
launcherIcon->icon_tooltip = entry.name ? strdup(entry.name) : strdup(entry.exec);
|
||||
if (entry.name) {
|
||||
if (entry.generic_name) {
|
||||
launcherIcon->icon_tooltip = g_strdup_printf("%s (%s)", entry.name, entry.generic_name);
|
||||
} else {
|
||||
launcherIcon->icon_tooltip = g_strdup_printf("%s", entry.name);
|
||||
}
|
||||
} else {
|
||||
if (entry.generic_name) {
|
||||
launcherIcon->icon_tooltip = g_strdup_printf("%s", entry.generic_name);
|
||||
} else if (entry.exec) {
|
||||
launcherIcon->icon_tooltip = g_strdup_printf("%s", entry.exec);
|
||||
}
|
||||
}
|
||||
launcher->list_icons = g_slist_append(launcher->list_icons, launcherIcon);
|
||||
add_area(&launcherIcon->area, (Area *)launcher);
|
||||
}
|
||||
@@ -465,10 +492,10 @@ void launcher_load_icons(Launcher *launcher)
|
||||
}
|
||||
}
|
||||
|
||||
// Populates the list_themes list
|
||||
// Populates the icon_theme_wrapper list
|
||||
void launcher_load_themes(Launcher *launcher)
|
||||
{
|
||||
launcher->list_themes =
|
||||
launcher->icon_theme_wrapper =
|
||||
load_themes(launcher_icon_theme_override
|
||||
? (icon_theme_name_config ? icon_theme_name_config
|
||||
: icon_theme_name_xsettings ? icon_theme_name_xsettings : "hicolor")
|
||||
|
||||
@@ -17,7 +17,7 @@ typedef struct Launcher {
|
||||
Area area;
|
||||
GSList *list_apps; // List of char*, each is a path to a app.desktop file
|
||||
GSList *list_icons; // List of LauncherIcon*
|
||||
IconThemeWrapper *list_themes;
|
||||
IconThemeWrapper *icon_theme_wrapper;
|
||||
} Launcher;
|
||||
|
||||
typedef struct LauncherIcon {
|
||||
|
||||
@@ -350,17 +350,17 @@ static void read_settings(XSettingsClient *client)
|
||||
|
||||
old_handler = XSetErrorHandler(ignore_errors);
|
||||
int result = XGetWindowProperty(client->display,
|
||||
client->manager_window,
|
||||
server.atom._XSETTINGS_SETTINGS,
|
||||
0,
|
||||
LONG_MAX,
|
||||
False,
|
||||
server.atom._XSETTINGS_SETTINGS,
|
||||
&type,
|
||||
&format,
|
||||
&n_items,
|
||||
&bytes_after,
|
||||
&data);
|
||||
client->manager_window,
|
||||
server.atom._XSETTINGS_SETTINGS,
|
||||
0,
|
||||
LONG_MAX,
|
||||
False,
|
||||
server.atom._XSETTINGS_SETTINGS,
|
||||
&type,
|
||||
&format,
|
||||
&n_items,
|
||||
&bytes_after,
|
||||
&data);
|
||||
XSetErrorHandler(old_handler);
|
||||
|
||||
if (result == Success && type == server.atom._XSETTINGS_SETTINGS) {
|
||||
|
||||
217
src/panel.c
217
src/panel.c
@@ -241,13 +241,16 @@ void init_panel()
|
||||
mask,
|
||||
&att);
|
||||
|
||||
long event_mask = ExposureMask | ButtonPressMask | ButtonReleaseMask | ButtonMotionMask;
|
||||
long event_mask = ExposureMask | ButtonPressMask | ButtonReleaseMask | ButtonMotionMask | PropertyChangeMask;
|
||||
if (p->mouse_effects || p->g_task.tooltip_enabled || p->clock.area._get_tooltip_text ||
|
||||
(launcher_enabled && launcher_tooltip_enabled))
|
||||
event_mask |= PointerMotionMask | LeaveWindowMask;
|
||||
if (panel_autohide)
|
||||
event_mask |= LeaveWindowMask | EnterWindowMask;
|
||||
XChangeWindowAttributes(server.display, p->main_win, CWEventMask, &(XSetWindowAttributes){.event_mask = event_mask});
|
||||
XChangeWindowAttributes(server.display,
|
||||
p->main_win,
|
||||
CWEventMask,
|
||||
&(XSetWindowAttributes){.event_mask = event_mask});
|
||||
|
||||
if (!server.gc) {
|
||||
XGCValues gcv;
|
||||
@@ -284,11 +287,9 @@ void init_panel_size_and_position(Panel *panel)
|
||||
panel->area.height = 32;
|
||||
}
|
||||
if (panel->fractional_width)
|
||||
panel->area.width = (float)server.monitors[panel->monitor].width * panel->area.width / 100;
|
||||
panel->area.width = (server.monitors[panel->monitor].width - panel->marginx) * panel->area.width / 100;
|
||||
if (panel->fractional_height)
|
||||
panel->area.height = (float)server.monitors[panel->monitor].height * panel->area.height / 100;
|
||||
if (panel->area.width + panel->marginx > server.monitors[panel->monitor].width)
|
||||
panel->area.width = server.monitors[panel->monitor].width - panel->marginx;
|
||||
panel->area.height = (server.monitors[panel->monitor].height - panel->marginy) * panel->area.height / 100;
|
||||
if (panel->area.bg->border.radius > panel->area.height / 2) {
|
||||
printf("panel_background_id rounded is too big... please fix your tint2rc\n");
|
||||
g_array_append_val(backgrounds, *panel->area.bg);
|
||||
@@ -306,18 +307,15 @@ void init_panel_size_and_position(Panel *panel)
|
||||
}
|
||||
int old_panel_height = panel->area.height;
|
||||
if (panel->fractional_width)
|
||||
panel->area.height = (float)server.monitors[panel->monitor].height * panel->area.width / 100;
|
||||
panel->area.height = (server.monitors[panel->monitor].height - panel->marginy) * panel->area.width / 100;
|
||||
else
|
||||
panel->area.height = panel->area.width;
|
||||
|
||||
if (panel->fractional_height)
|
||||
panel->area.width = (float)server.monitors[panel->monitor].width * old_panel_height / 100;
|
||||
panel->area.width = (server.monitors[panel->monitor].width - panel->marginx) * old_panel_height / 100;
|
||||
else
|
||||
panel->area.width = old_panel_height;
|
||||
|
||||
if (panel->area.height + panel->marginy > server.monitors[panel->monitor].height)
|
||||
panel->area.height = server.monitors[panel->monitor].height - panel->marginy;
|
||||
|
||||
if (panel->area.bg->border.radius > panel->area.width / 2) {
|
||||
printf("panel_background_id rounded is too big... please fix your tint2rc\n");
|
||||
g_array_append_val(backgrounds, *panel->area.bg);
|
||||
@@ -326,17 +324,22 @@ void init_panel_size_and_position(Panel *panel)
|
||||
}
|
||||
}
|
||||
|
||||
if (panel->area.width + panel->marginx > server.monitors[panel->monitor].width)
|
||||
panel->area.width = server.monitors[panel->monitor].width - panel->marginx;
|
||||
if (panel->area.height + panel->marginy > server.monitors[panel->monitor].height)
|
||||
panel->area.height = server.monitors[panel->monitor].height - panel->marginy;
|
||||
|
||||
// panel position determined here
|
||||
if (panel_position & LEFT) {
|
||||
panel->posx = server.monitors[panel->monitor].x + panel->marginx;
|
||||
} else {
|
||||
if (panel_position & RIGHT) {
|
||||
panel->posx = server.monitors[panel->monitor].x + server.monitors[panel->monitor].width - panel->area.width -
|
||||
panel->marginx;
|
||||
panel->posx = server.monitors[panel->monitor].x + server.monitors[panel->monitor].width -
|
||||
panel->area.width - panel->marginx;
|
||||
} else {
|
||||
if (panel_horizontal)
|
||||
panel->posx =
|
||||
server.monitors[panel->monitor].x + ((server.monitors[panel->monitor].width - panel->area.width) / 2);
|
||||
panel->posx = server.monitors[panel->monitor].x +
|
||||
((server.monitors[panel->monitor].width - panel->area.width) / 2);
|
||||
else
|
||||
panel->posx = server.monitors[panel->monitor].x + panel->marginx;
|
||||
}
|
||||
@@ -349,7 +352,7 @@ void init_panel_size_and_position(Panel *panel)
|
||||
panel->area.height - panel->marginy;
|
||||
} else {
|
||||
panel->posy =
|
||||
server.monitors[panel->monitor].y + ((server.monitors[panel->monitor].height - panel->area.height) / 2);
|
||||
server.monitors[panel->monitor].y + ((server.monitors[panel->monitor].height - panel->area.height) / 2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -564,12 +567,40 @@ void set_panel_items_order(Panel *p)
|
||||
GList *item = g_list_nth(p->execp_list, i_execp);
|
||||
i_execp++;
|
||||
if (item)
|
||||
p->area.children = g_list_append(p->area.children, (Area*)item->data);
|
||||
p->area.children = g_list_append(p->area.children, (Area *)item->data);
|
||||
}
|
||||
}
|
||||
initialize_positions(&p->area, 0);
|
||||
}
|
||||
|
||||
void place_panel_all_desktops(Panel *p)
|
||||
{
|
||||
long val = ALL_DESKTOPS;
|
||||
XChangeProperty(server.display,
|
||||
p->main_win,
|
||||
server.atom._NET_WM_DESKTOP,
|
||||
XA_CARDINAL,
|
||||
32,
|
||||
PropModeReplace,
|
||||
(unsigned char *)&val,
|
||||
1);
|
||||
|
||||
Atom state[4];
|
||||
state[0] = server.atom._NET_WM_STATE_SKIP_PAGER;
|
||||
state[1] = server.atom._NET_WM_STATE_SKIP_TASKBAR;
|
||||
state[2] = server.atom._NET_WM_STATE_STICKY;
|
||||
state[3] = panel_layer == BOTTOM_LAYER ? server.atom._NET_WM_STATE_BELOW : server.atom._NET_WM_STATE_ABOVE;
|
||||
int num_atoms = panel_layer == NORMAL_LAYER ? 3 : 4;
|
||||
XChangeProperty(server.display,
|
||||
p->main_win,
|
||||
server.atom._NET_WM_STATE,
|
||||
XA_ATOM,
|
||||
32,
|
||||
PropModeReplace,
|
||||
(unsigned char *)state,
|
||||
num_atoms);
|
||||
}
|
||||
|
||||
void set_panel_properties(Panel *p)
|
||||
{
|
||||
XStoreName(server.display, p->main_win, panel_window_name);
|
||||
@@ -608,30 +639,7 @@ void set_panel_properties(Panel *p)
|
||||
(unsigned char *)&val,
|
||||
1);
|
||||
|
||||
val = ALL_DESKTOPS;
|
||||
XChangeProperty(server.display,
|
||||
p->main_win,
|
||||
server.atom._NET_WM_DESKTOP,
|
||||
XA_CARDINAL,
|
||||
32,
|
||||
PropModeReplace,
|
||||
(unsigned char *)&val,
|
||||
1);
|
||||
|
||||
Atom state[4];
|
||||
state[0] = server.atom._NET_WM_STATE_SKIP_PAGER;
|
||||
state[1] = server.atom._NET_WM_STATE_SKIP_TASKBAR;
|
||||
state[2] = server.atom._NET_WM_STATE_STICKY;
|
||||
state[3] = panel_layer == BOTTOM_LAYER ? server.atom._NET_WM_STATE_BELOW : server.atom._NET_WM_STATE_ABOVE;
|
||||
int num_atoms = panel_layer == NORMAL_LAYER ? 3 : 4;
|
||||
XChangeProperty(server.display,
|
||||
p->main_win,
|
||||
server.atom._NET_WM_STATE,
|
||||
XA_ATOM,
|
||||
32,
|
||||
PropModeReplace,
|
||||
(unsigned char *)state,
|
||||
num_atoms);
|
||||
place_panel_all_desktops(p);
|
||||
|
||||
XWMHints wmhints;
|
||||
memset(&wmhints, 0, sizeof(wmhints));
|
||||
@@ -740,18 +748,10 @@ Panel *get_panel(Window win)
|
||||
|
||||
Taskbar *click_taskbar(Panel *panel, int x, int y)
|
||||
{
|
||||
if (panel_horizontal) {
|
||||
for (int i = 0; i < panel->num_desktops; i++) {
|
||||
Taskbar *taskbar = &panel->taskbar[i];
|
||||
if (taskbar->area.on_screen && x >= taskbar->area.posx && x <= (taskbar->area.posx + taskbar->area.width))
|
||||
return taskbar;
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < panel->num_desktops; i++) {
|
||||
Taskbar *taskbar = &panel->taskbar[i];
|
||||
if (taskbar->area.on_screen && y >= taskbar->area.posy && y <= (taskbar->area.posy + taskbar->area.height))
|
||||
return taskbar;
|
||||
}
|
||||
for (int i = 0; i < panel->num_desktops; i++) {
|
||||
Taskbar *taskbar = &panel->taskbar[i];
|
||||
if (area_is_under_mouse(taskbar, x, y))
|
||||
return taskbar;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -760,25 +760,13 @@ Task *click_task(Panel *panel, int x, int y)
|
||||
{
|
||||
Taskbar *taskbar = click_taskbar(panel, x, y);
|
||||
if (taskbar) {
|
||||
if (panel_horizontal) {
|
||||
GList *l = taskbar->area.children;
|
||||
if (taskbarname_enabled)
|
||||
l = l->next;
|
||||
for (; l; l = l->next) {
|
||||
Task *task = (Task *)l->data;
|
||||
if (task->area.on_screen && x >= task->area.posx && x <= (task->area.posx + task->area.width)) {
|
||||
return task;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
GList *l = taskbar->area.children;
|
||||
if (taskbarname_enabled)
|
||||
l = l->next;
|
||||
for (; l; l = l->next) {
|
||||
Task *task = (Task *)l->data;
|
||||
if (task->area.on_screen && y >= task->area.posy && y <= (task->area.posy + task->area.height)) {
|
||||
return task;
|
||||
}
|
||||
GList *l = taskbar->area.children;
|
||||
if (taskbarname_enabled)
|
||||
l = l->next;
|
||||
for (; l; l = l->next) {
|
||||
Task *task = (Task *)l->data;
|
||||
if (area_is_under_mouse(task, x, y)) {
|
||||
return task;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -789,108 +777,53 @@ Launcher *click_launcher(Panel *panel, int x, int y)
|
||||
{
|
||||
Launcher *launcher = &panel->launcher;
|
||||
|
||||
if (panel_horizontal) {
|
||||
if (launcher->area.on_screen && x >= launcher->area.posx && x <= (launcher->area.posx + launcher->area.width))
|
||||
return launcher;
|
||||
} else {
|
||||
if (launcher->area.on_screen && y >= launcher->area.posy && y <= (launcher->area.posy + launcher->area.height))
|
||||
return launcher;
|
||||
}
|
||||
if (area_is_under_mouse(launcher, x, y))
|
||||
return launcher;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
LauncherIcon *click_launcher_icon(Panel *panel, int x, int y)
|
||||
{
|
||||
Launcher *launcher = click_launcher(panel, x, y);
|
||||
|
||||
if (launcher) {
|
||||
for (GSList *l = launcher->list_icons; l; l = l->next) {
|
||||
LauncherIcon *icon = (LauncherIcon *)l->data;
|
||||
if (x >= (launcher->area.posx + icon->x) && x <= (launcher->area.posx + icon->x + icon->icon_size) &&
|
||||
y >= (launcher->area.posy + icon->y) && y <= (launcher->area.posy + icon->y + icon->icon_size)) {
|
||||
if (area_is_under_mouse(icon, x, y))
|
||||
return icon;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gboolean click_padding(Panel *panel, int x, int y)
|
||||
{
|
||||
if (panel_horizontal) {
|
||||
if (x < panel->area.paddingxlr || x > panel->area.width - panel->area.paddingxlr)
|
||||
return TRUE;
|
||||
} else {
|
||||
if (y < panel->area.paddingxlr || y > panel->area.height - panel->area.paddingxlr)
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int click_clock(Panel *panel, int x, int y)
|
||||
Clock *click_clock(Panel *panel, int x, int y)
|
||||
{
|
||||
Clock *clock = &panel->clock;
|
||||
if (panel_horizontal) {
|
||||
if (clock->area.on_screen && x >= clock->area.posx && x <= (clock->area.posx + clock->area.width))
|
||||
return TRUE;
|
||||
} else {
|
||||
if (clock->area.on_screen && y >= clock->area.posy && y <= (clock->area.posy + clock->area.height))
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
if (area_is_under_mouse(clock, x, y))
|
||||
return clock;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_BATTERY
|
||||
int click_battery(Panel *panel, int x, int y)
|
||||
Battery *click_battery(Panel *panel, int x, int y)
|
||||
{
|
||||
Battery *bat = &panel->battery;
|
||||
if (panel_horizontal) {
|
||||
if (bat->area.on_screen && x >= bat->area.posx && x <= (bat->area.posx + bat->area.width))
|
||||
return TRUE;
|
||||
} else {
|
||||
if (bat->area.on_screen && y >= bat->area.posy && y <= (bat->area.posy + bat->area.height))
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
if (area_is_under_mouse(bat, x, y))
|
||||
return bat;
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
Execp *click_execp(Panel *panel, int x, int y)
|
||||
{
|
||||
GList *l;
|
||||
for (l = panel->execp_list; l; l = l->next) {
|
||||
for (GList *l = panel->execp_list; l; l = l->next) {
|
||||
Execp *execp = (Execp *)l->data;
|
||||
if (panel_horizontal) {
|
||||
if (execp->area.on_screen && x >= execp->area.posx && x <= (execp->area.posx + execp->area.width))
|
||||
return execp;
|
||||
} else {
|
||||
if (execp->area.on_screen && y >= execp->area.posy && y <= (execp->area.posy + execp->area.height))
|
||||
return execp;
|
||||
}
|
||||
if (area_is_under_mouse(execp, x, y))
|
||||
return execp;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Area *click_area(Panel *panel, int x, int y)
|
||||
{
|
||||
Area *result = &panel->area;
|
||||
Area *new_result = result;
|
||||
do {
|
||||
result = new_result;
|
||||
GList *it = result->children;
|
||||
while (it) {
|
||||
Area *a = (Area *)it->data;
|
||||
if (a->on_screen && x >= a->posx && x <= (a->posx + a->width) && y >= a->posy &&
|
||||
y <= (a->posy + a->height)) {
|
||||
new_result = a;
|
||||
break;
|
||||
}
|
||||
it = it->next;
|
||||
}
|
||||
} while (new_result != result);
|
||||
return result;
|
||||
}
|
||||
|
||||
void stop_autohide_timeout(Panel *p)
|
||||
{
|
||||
stop_timeout(p->autohide_timeout);
|
||||
|
||||
@@ -96,7 +96,7 @@ typedef struct Panel {
|
||||
// position relative to root window
|
||||
int posx, posy;
|
||||
int marginx, marginy;
|
||||
int fractional_width, fractional_height;
|
||||
gboolean fractional_width, fractional_height;
|
||||
int monitor;
|
||||
int font_shadow;
|
||||
gboolean mouse_effects;
|
||||
@@ -154,6 +154,7 @@ gboolean resize_panel(void *obj);
|
||||
void render_panel(Panel *panel);
|
||||
|
||||
void set_panel_items_order(Panel *p);
|
||||
void place_panel_all_desktops(Panel *p);
|
||||
void set_panel_properties(Panel *p);
|
||||
|
||||
// draw background panel
|
||||
@@ -166,11 +167,10 @@ Taskbar *click_taskbar(Panel *panel, int x, int y);
|
||||
Task *click_task(Panel *panel, int x, int y);
|
||||
Launcher *click_launcher(Panel *panel, int x, int y);
|
||||
LauncherIcon *click_launcher_icon(Panel *panel, int x, int y);
|
||||
gboolean click_padding(Panel *panel, int x, int y);
|
||||
gboolean click_clock(Panel *panel, int x, int y);
|
||||
Clock *click_clock(Panel *panel, int x, int y);
|
||||
|
||||
#ifdef ENABLE_BATTERY
|
||||
gboolean click_battery(Panel *panel, int x, int y);
|
||||
Battery *click_battery(Panel *panel, int x, int y);
|
||||
#endif
|
||||
|
||||
Area *click_area(Panel *panel, int x, int y);
|
||||
|
||||
24
src/server.c
24
src/server.c
@@ -419,7 +419,8 @@ void server_get_number_of_desktops()
|
||||
int work_area_height = work_area_size[1] + work_area_size[3];
|
||||
XFree(work_area_size);
|
||||
|
||||
long *x_screen_size = server_get_property(server.root_win, server.atom._NET_DESKTOP_GEOMETRY, XA_CARDINAL, &num_results);
|
||||
long *x_screen_size =
|
||||
server_get_property(server.root_win, server.atom._NET_DESKTOP_GEOMETRY, XA_CARDINAL, &num_results);
|
||||
if (!x_screen_size)
|
||||
return;
|
||||
int x_screen_width = x_screen_size[0];
|
||||
@@ -459,7 +460,8 @@ GSList *get_desktop_names()
|
||||
|
||||
int count;
|
||||
GSList *list = NULL;
|
||||
gchar *data_ptr = server_get_property(server.root_win, server.atom._NET_DESKTOP_NAMES, server.atom.UTF8_STRING, &count);
|
||||
gchar *data_ptr =
|
||||
server_get_property(server.root_win, server.atom._NET_DESKTOP_NAMES, server.atom.UTF8_STRING, &count);
|
||||
if (data_ptr) {
|
||||
list = g_slist_append(list, g_strdup(data_ptr));
|
||||
for (int j = 0; j < count - 1; j++) {
|
||||
@@ -476,7 +478,9 @@ GSList *get_desktop_names()
|
||||
int get_current_desktop()
|
||||
{
|
||||
if (!server.viewports) {
|
||||
return MAX(0, MIN(server.num_desktops - 1, get_property32(server.root_win, server.atom._NET_CURRENT_DESKTOP, XA_CARDINAL)));
|
||||
return MAX(0,
|
||||
MIN(server.num_desktops - 1,
|
||||
get_property32(server.root_win, server.atom._NET_CURRENT_DESKTOP, XA_CARDINAL)));
|
||||
}
|
||||
|
||||
int num_results;
|
||||
@@ -497,7 +501,8 @@ int get_current_desktop()
|
||||
int viewport_y = viewport[1];
|
||||
XFree(viewport);
|
||||
|
||||
long *x_screen_size = server_get_property(server.root_win, server.atom._NET_DESKTOP_GEOMETRY, XA_CARDINAL, &num_results);
|
||||
long *x_screen_size =
|
||||
server_get_property(server.root_win, server.atom._NET_DESKTOP_GEOMETRY, XA_CARDINAL, &num_results);
|
||||
if (!x_screen_size)
|
||||
return 0;
|
||||
int x_screen_width = x_screen_size[0];
|
||||
@@ -505,10 +510,10 @@ int get_current_desktop()
|
||||
|
||||
int ncols = x_screen_width / work_area_width;
|
||||
|
||||
// fprintf(stderr, "\n");
|
||||
// fprintf(stderr, "Work area size: %d x %d\n", work_area_width, work_area_height);
|
||||
// fprintf(stderr, "Viewport pos: %d x %d\n", viewport_x, viewport_y);
|
||||
// fprintf(stderr, "Viewport i: %d\n", (viewport_y / work_area_height) * ncols + viewport_x / work_area_width);
|
||||
// fprintf(stderr, "\n");
|
||||
// fprintf(stderr, "Work area size: %d x %d\n", work_area_width, work_area_height);
|
||||
// fprintf(stderr, "Viewport pos: %d x %d\n", viewport_x, viewport_y);
|
||||
// fprintf(stderr, "Viewport i: %d\n", (viewport_y / work_area_height) * ncols + viewport_x / work_area_width);
|
||||
|
||||
int result = (viewport_y / work_area_height) * ncols + viewport_x / work_area_width;
|
||||
return MAX(0, MIN(server.num_desktops - 1, result));
|
||||
@@ -548,7 +553,8 @@ void server_init_visual()
|
||||
// inspired by freedesktops fdclock ;)
|
||||
XVisualInfo templ = {.screen = server.screen, .depth = 32, .class = TrueColor};
|
||||
int nvi;
|
||||
XVisualInfo *xvi = XGetVisualInfo(server.display, VisualScreenMask | VisualDepthMask | VisualClassMask, &templ, &nvi);
|
||||
XVisualInfo *xvi =
|
||||
XGetVisualInfo(server.display, VisualScreenMask | VisualDepthMask | VisualClassMask, &templ, &nvi);
|
||||
|
||||
Visual *visual = NULL;
|
||||
if (xvi) {
|
||||
|
||||
@@ -166,5 +166,4 @@ GSList *get_desktop_names();
|
||||
int get_current_desktop();
|
||||
void change_desktop(int desktop);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -45,9 +45,9 @@ GSList *icons;
|
||||
Window net_sel_win = None;
|
||||
|
||||
// freedesktop specification doesn't allow multi systray
|
||||
Systraybar systray;
|
||||
int refresh_systray;
|
||||
int systray_enabled;
|
||||
Systray systray;
|
||||
gboolean refresh_systray;
|
||||
gboolean systray_enabled;
|
||||
int systray_max_icon_size;
|
||||
int systray_monitor;
|
||||
int chrono;
|
||||
@@ -67,7 +67,7 @@ const int max_bad_resize_events = 10;
|
||||
void default_systray()
|
||||
{
|
||||
systray_enabled = 0;
|
||||
memset(&systray, 0, sizeof(Systraybar));
|
||||
memset(&systray, 0, sizeof(systray));
|
||||
render_background = 0;
|
||||
chrono = 0;
|
||||
systray.alpha = 100;
|
||||
@@ -116,26 +116,22 @@ void init_systray_panel(void *p)
|
||||
if (!systray.area.bg)
|
||||
systray.area.bg = &g_array_index(backgrounds, Background, 0);
|
||||
show(&systray.area);
|
||||
systray.area.resize_needed = 1;
|
||||
panel->area.resize_needed = 1;
|
||||
schedule_redraw(&systray.area);
|
||||
panel_refresh = TRUE;
|
||||
refresh_systray = 1;
|
||||
refresh_systray = TRUE;
|
||||
}
|
||||
|
||||
gboolean resize_systray(void *obj)
|
||||
{
|
||||
if (systray_profile)
|
||||
fprintf(stderr, "[%f] %s:%d\n", profiling_get_time(), __FUNCTION__, __LINE__);
|
||||
Systraybar *sysbar = obj;
|
||||
|
||||
if (panel_horizontal)
|
||||
sysbar->icon_size = sysbar->area.height;
|
||||
systray.icon_size = systray.area.height;
|
||||
else
|
||||
sysbar->icon_size = sysbar->area.width;
|
||||
sysbar->icon_size = sysbar->icon_size - (2 * sysbar->area.bg->border.width) - (2 * sysbar->area.paddingy);
|
||||
if (systray_max_icon_size > 0 && sysbar->icon_size > systray_max_icon_size)
|
||||
sysbar->icon_size = systray_max_icon_size;
|
||||
systray.icon_size = systray.area.width;
|
||||
systray.icon_size -= (2 * systray.area.bg->border.width) + (2 * systray.area.paddingy);
|
||||
if (systray_max_icon_size > 0)
|
||||
systray.icon_size = MIN(systray.icon_size, systray_max_icon_size);
|
||||
|
||||
if (systray.icon_size > 0) {
|
||||
long icon_size = systray.icon_size;
|
||||
@@ -151,33 +147,31 @@ gboolean resize_systray(void *obj)
|
||||
|
||||
int count = 0;
|
||||
for (GSList *l = systray.list_icons; l; l = l->next) {
|
||||
if (((TrayWindow *)l->data)->hide)
|
||||
continue;
|
||||
count++;
|
||||
}
|
||||
if (systray_profile)
|
||||
fprintf(stderr, BLUE "%s:%d number of icons = %d" RESET "\n", __FUNCTION__, __LINE__, count);
|
||||
|
||||
if (panel_horizontal) {
|
||||
int height = sysbar->area.height - 2 * sysbar->area.bg->border.width - 2 * sysbar->area.paddingy;
|
||||
int height = systray.area.height - 2 * systray.area.bg->border.width - 2 * systray.area.paddingy;
|
||||
// here icons_per_column always higher than 0
|
||||
sysbar->icons_per_column = (height + sysbar->area.paddingx) / (sysbar->icon_size + sysbar->area.paddingx);
|
||||
sysbar->margin =
|
||||
height - (sysbar->icons_per_column - 1) * (sysbar->icon_size + sysbar->area.paddingx) - sysbar->icon_size;
|
||||
sysbar->icons_per_row = count / sysbar->icons_per_column + (count % sysbar->icons_per_column != 0);
|
||||
systray.icons_per_column = (height + systray.area.paddingx) / (systray.icon_size + systray.area.paddingx);
|
||||
systray.margin =
|
||||
height - (systray.icons_per_column - 1) * (systray.icon_size + systray.area.paddingx) - systray.icon_size;
|
||||
systray.icons_per_row = count / systray.icons_per_column + (count % systray.icons_per_column != 0);
|
||||
systray.area.width = (2 * systray.area.bg->border.width) + (2 * systray.area.paddingxlr) +
|
||||
(sysbar->icon_size * sysbar->icons_per_row) +
|
||||
((sysbar->icons_per_row - 1) * systray.area.paddingx);
|
||||
(systray.icon_size * systray.icons_per_row) +
|
||||
((systray.icons_per_row - 1) * systray.area.paddingx);
|
||||
} else {
|
||||
int width = sysbar->area.width - 2 * sysbar->area.bg->border.width - 2 * sysbar->area.paddingy;
|
||||
int width = systray.area.width - 2 * systray.area.bg->border.width - 2 * systray.area.paddingy;
|
||||
// here icons_per_row always higher than 0
|
||||
sysbar->icons_per_row = (width + sysbar->area.paddingx) / (sysbar->icon_size + sysbar->area.paddingx);
|
||||
sysbar->margin =
|
||||
width - (sysbar->icons_per_row - 1) * (sysbar->icon_size + sysbar->area.paddingx) - sysbar->icon_size;
|
||||
sysbar->icons_per_column = count / sysbar->icons_per_row + (count % sysbar->icons_per_row != 0);
|
||||
systray.icons_per_row = (width + systray.area.paddingx) / (systray.icon_size + systray.area.paddingx);
|
||||
systray.margin =
|
||||
width - (systray.icons_per_row - 1) * (systray.icon_size + systray.area.paddingx) - systray.icon_size;
|
||||
systray.icons_per_column = count / systray.icons_per_row + (count % systray.icons_per_row != 0);
|
||||
systray.area.height = (2 * systray.area.bg->border.width) + (2 * systray.area.paddingxlr) +
|
||||
(sysbar->icon_size * sysbar->icons_per_column) +
|
||||
((sysbar->icons_per_column - 1) * systray.area.paddingx);
|
||||
(systray.icon_size * systray.icons_per_column) +
|
||||
((systray.icons_per_column - 1) * systray.area.paddingx);
|
||||
}
|
||||
|
||||
if (net_sel_win == None) {
|
||||
@@ -215,15 +209,15 @@ void on_change_systray(void *obj)
|
||||
{
|
||||
if (systray_profile)
|
||||
fprintf(stderr, "[%f] %s:%d\n", profiling_get_time(), __FUNCTION__, __LINE__);
|
||||
// here, systray.area.posx/posy are defined by rendering engine. so we can calculate position of tray icon.
|
||||
Systraybar *sysbar = obj;
|
||||
if (sysbar->icons_per_column == 0 || sysbar->icons_per_row == 0)
|
||||
if (systray.icons_per_column == 0 || systray.icons_per_row == 0)
|
||||
return;
|
||||
|
||||
Panel *panel = sysbar->area.panel;
|
||||
// systray.area.posx/posy are computed by rendering engine.
|
||||
// Based on this we calculate the positions of the tray icons.
|
||||
Panel *panel = systray.area.panel;
|
||||
int posx, posy;
|
||||
int start = panel->area.bg->border.width + panel->area.paddingy + systray.area.bg->border.width +
|
||||
systray.area.paddingy + sysbar->margin / 2;
|
||||
systray.area.paddingy + systray.margin / 2;
|
||||
if (panel_horizontal) {
|
||||
posy = start;
|
||||
posx = systray.area.posx + systray.area.bg->border.width + systray.area.paddingxlr;
|
||||
@@ -237,8 +231,6 @@ void on_change_systray(void *obj)
|
||||
int i;
|
||||
for (i = 1, l = systray.list_icons; l; i++, l = l->next) {
|
||||
traywin = (TrayWindow *)l->data;
|
||||
if (traywin->hide)
|
||||
continue;
|
||||
|
||||
traywin->y = posy;
|
||||
traywin->x = posx;
|
||||
@@ -252,21 +244,21 @@ void on_change_systray(void *obj)
|
||||
traywin->parent,
|
||||
posx,
|
||||
posy);
|
||||
traywin->width = sysbar->icon_size;
|
||||
traywin->height = sysbar->icon_size;
|
||||
traywin->width = systray.icon_size;
|
||||
traywin->height = systray.icon_size;
|
||||
if (panel_horizontal) {
|
||||
if (i % sysbar->icons_per_column) {
|
||||
posy += sysbar->icon_size + sysbar->area.paddingx;
|
||||
if (i % systray.icons_per_column) {
|
||||
posy += systray.icon_size + systray.area.paddingx;
|
||||
} else {
|
||||
posy = start;
|
||||
posx += (sysbar->icon_size + systray.area.paddingx);
|
||||
posx += (systray.icon_size + systray.area.paddingx);
|
||||
}
|
||||
} else {
|
||||
if (i % sysbar->icons_per_row) {
|
||||
posx += sysbar->icon_size + systray.area.paddingx;
|
||||
if (i % systray.icons_per_row) {
|
||||
posx += systray.icon_size + systray.area.paddingx;
|
||||
} else {
|
||||
posx = start;
|
||||
posy += (sysbar->icon_size + systray.area.paddingx);
|
||||
posy += (systray.icon_size + systray.area.paddingx);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -519,13 +511,28 @@ void print_icons()
|
||||
TrayWindow *t = l->data;
|
||||
TrayWindow *u = l->next->data;
|
||||
int cmp = compare_traywindows(t, u);
|
||||
fprintf(stderr, "%s %s %s\n", t->name, cmp < 0 ? "<" : cmp == 0 ? "=" : ">" , u->name);
|
||||
fprintf(stderr, "%s %s %s\n", t->name, cmp < 0 ? "<" : cmp == 0 ? "=" : ">", u->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gboolean add_icon(Window win)
|
||||
{
|
||||
// Avoid duplicates
|
||||
for (GSList *l = systray.list_icons; l; l = l->next) {
|
||||
TrayWindow *other = (TrayWindow *)l->data;
|
||||
if (other->win == win) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
// Dangerous actions begin
|
||||
XSync(server.display, False);
|
||||
error = FALSE;
|
||||
XErrorHandler old = XSetErrorHandler(window_error_handler);
|
||||
|
||||
XSelectInput(server.display, win, StructureNotifyMask | PropertyChangeMask | ResizeRedirectMask);
|
||||
|
||||
XTextProperty xname;
|
||||
char *name;
|
||||
if (XGetWMName(server.display, win, &xname)) {
|
||||
@@ -538,7 +545,6 @@ gboolean add_icon(Window win)
|
||||
if (systray_profile)
|
||||
fprintf(stderr, "[%f] %s:%d win = %lu (%s)\n", profiling_get_time(), __FUNCTION__, __LINE__, win, name);
|
||||
Panel *panel = systray.area.panel;
|
||||
int hide = 0;
|
||||
|
||||
// Get the process ID of the application that created the window
|
||||
int pid = 0;
|
||||
@@ -566,111 +572,33 @@ gboolean add_icon(Window win)
|
||||
}
|
||||
}
|
||||
|
||||
for (GSList *l = systray.list_icons; l; l = l->next) {
|
||||
TrayWindow *other = (TrayWindow *)l->data;
|
||||
if (other->win == win) {
|
||||
free(name);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if the application leaves behind empty icons
|
||||
int num_empty_same_pid = 0;
|
||||
#if 0
|
||||
for (GSList *l = systray.list_icons; l; l = l->next) {
|
||||
TrayWindow *other = (TrayWindow *)l->data;
|
||||
if (!systray_composited) {
|
||||
// Empty icon detection: we compare the contents of the icon with the contents of the panel pixmap.
|
||||
// If any pixel is different, the icon is not empty.
|
||||
imlib_context_set_visual(server.visual);
|
||||
imlib_context_set_colormap(server.colormap);
|
||||
imlib_context_set_drawable(other->win);
|
||||
Imlib_Image image = imlib_create_image_from_drawable(0, 0, 0, other->width, other->height, 1);
|
||||
if (image) {
|
||||
imlib_context_set_drawable(panel->temp_pmap);
|
||||
Imlib_Image bg =
|
||||
imlib_create_image_from_drawable(0, other->x, other->y, other->width, other->height, 1);
|
||||
imlib_context_set_image(bg);
|
||||
DATA32 *data_bg = imlib_image_get_data_for_reading_only();
|
||||
imlib_context_set_image(image);
|
||||
imlib_image_set_has_alpha(other->depth > 24);
|
||||
DATA32 *data = imlib_image_get_data_for_reading_only();
|
||||
int x, y;
|
||||
gboolean empty = TRUE;
|
||||
for (x = 0; x < other->width && empty; x++) {
|
||||
for (y = 0; y < other->height && empty; y++) {
|
||||
DATA32 pixel = data[y * other->width + x];
|
||||
DATA32 a = (pixel >> 24) & 0xff;
|
||||
if (a == 0)
|
||||
continue;
|
||||
|
||||
DATA32 rgb = pixel & 0xffFFff;
|
||||
DATA32 pixel_bg = data_bg[y * other->width + x];
|
||||
DATA32 rgb_bg = pixel_bg & 0xffFFff;
|
||||
if (rgb != rgb_bg) {
|
||||
if (systray_profile)
|
||||
fprintf(stderr, "Pixel: %x different from bg %x at pos %d %d\n", pixel, pixel_bg, x, y);
|
||||
empty = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
other->empty = empty;
|
||||
imlib_free_image_and_decache();
|
||||
imlib_context_set_image(bg);
|
||||
imlib_free_image_and_decache();
|
||||
if (systray_profile)
|
||||
fprintf(stderr,
|
||||
"[%f] %s:%d win = %lu (%s) empty = %d\n",
|
||||
profiling_get_time(),
|
||||
__FUNCTION__,
|
||||
__LINE__,
|
||||
other->win,
|
||||
other->name,
|
||||
other->empty);
|
||||
}
|
||||
}
|
||||
if (pid && other->pid == pid) {
|
||||
if (other->empty)
|
||||
num_empty_same_pid++;
|
||||
}
|
||||
}
|
||||
|
||||
// Remove empty icons if the application leaves behind more than 1
|
||||
const int max_num_empty_same_pid = 0;
|
||||
if (num_empty_same_pid > max_num_empty_same_pid) {
|
||||
for (GSList *l = systray.list_icons; l; l = l->next) {
|
||||
if (pid && ((TrayWindow *)l->data)->pid == pid && ((TrayWindow *)l->data)->empty) {
|
||||
num_empty_same_pid++;
|
||||
fprintf(stderr,
|
||||
RED
|
||||
"Removing tray icon %lu (%s) from misbehaving application with pid=%d (too many icons)" RESET "\n",
|
||||
((TrayWindow *)l->data)->win,
|
||||
((TrayWindow *)l->data)->name,
|
||||
pid);
|
||||
remove_icon((TrayWindow *)l->data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Create the parent window that will embed the icon
|
||||
XWindowAttributes attr;
|
||||
if (systray_profile)
|
||||
fprintf(stderr, "XGetWindowAttributes(server.display, win = %ld, &attr)\n", win);
|
||||
if (XGetWindowAttributes(server.display, win, &attr) == False) {
|
||||
free(name);
|
||||
XSelectInput(server.display, win, NoEventMask);
|
||||
|
||||
// Dangerous actions end
|
||||
XSync(server.display, False);
|
||||
XSetErrorHandler(old);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Dangerous actions end
|
||||
XSync(server.display, False);
|
||||
XSetErrorHandler(old);
|
||||
|
||||
unsigned long mask = 0;
|
||||
XSetWindowAttributes set_attr;
|
||||
Visual *visual = server.visual;
|
||||
fprintf(stderr,
|
||||
GREEN "add_icon: %lu (%s), pid %d, %d, visual %p, colormap %lu, depth %d, width %d, height %d" RESET "\n",
|
||||
GREEN "add_icon: %lu (%s), pid %d, visual %p, colormap %lu, depth %d, width %d, height %d" RESET "\n",
|
||||
win,
|
||||
name,
|
||||
pid,
|
||||
num_empty_same_pid,
|
||||
attr.visual,
|
||||
attr.colormap,
|
||||
attr.depth,
|
||||
@@ -696,6 +624,7 @@ gboolean add_icon(Window win)
|
||||
mask = CWBackPixmap;
|
||||
}
|
||||
}
|
||||
|
||||
if (systray_profile)
|
||||
fprintf(stderr, "XCreateWindow(...)\n");
|
||||
Window parent = XCreateWindow(server.display,
|
||||
@@ -715,7 +644,6 @@ gboolean add_icon(Window win)
|
||||
TrayWindow *traywin = g_new0(TrayWindow, 1);
|
||||
traywin->parent = parent;
|
||||
traywin->win = win;
|
||||
traywin->hide = hide;
|
||||
traywin->depth = attr.depth;
|
||||
// Reparenting is done at the first paint event when the window is positioned correctly over its empty background,
|
||||
// to prevent graphical corruptions in icons with fake transparency
|
||||
@@ -724,7 +652,7 @@ gboolean add_icon(Window win)
|
||||
traywin->chrono = chrono;
|
||||
chrono++;
|
||||
|
||||
if (systray.area.on_screen == 0)
|
||||
if (!systray.area.on_screen)
|
||||
show(&systray.area);
|
||||
|
||||
if (systray.sort == SYSTRAY_SORT_RIGHT2LEFT)
|
||||
@@ -734,7 +662,7 @@ gboolean add_icon(Window win)
|
||||
systray.list_icons = g_slist_sort(systray.list_icons, compare_traywindows);
|
||||
// print_icons();
|
||||
|
||||
if (!traywin->hide && !panel->is_hidden) {
|
||||
if (!panel->is_hidden) {
|
||||
if (systray_profile)
|
||||
fprintf(stderr, "XMapRaised(server.display, traywin->parent)\n");
|
||||
XMapRaised(server.display, traywin->parent);
|
||||
@@ -745,11 +673,14 @@ gboolean add_icon(Window win)
|
||||
|
||||
// Resize and redraw the systray
|
||||
if (systray_profile)
|
||||
fprintf(stderr, BLUE "[%f] %s:%d trigger resize & redraw" RESET "\n", profiling_get_time(), __FUNCTION__, __LINE__);
|
||||
fprintf(stderr,
|
||||
BLUE "[%f] %s:%d trigger resize & redraw" RESET "\n",
|
||||
profiling_get_time(),
|
||||
__FUNCTION__,
|
||||
__LINE__);
|
||||
systray.area.resize_needed = TRUE;
|
||||
schedule_redraw(&systray.area);
|
||||
panel->area.resize_needed = TRUE;
|
||||
panel_refresh = TRUE;
|
||||
schedule_redraw(&systray.area);
|
||||
refresh_systray = TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
@@ -771,15 +702,13 @@ gboolean reparent_icon(TrayWindow *traywin)
|
||||
XSync(server.display, False);
|
||||
error = FALSE;
|
||||
XErrorHandler old = XSetErrorHandler(window_error_handler);
|
||||
if (systray_profile)
|
||||
fprintf(stderr, "XSelectInput(server.display, traywin->win, ...)\n");
|
||||
XSelectInput(server.display, traywin->win, StructureNotifyMask | PropertyChangeMask | ResizeRedirectMask);
|
||||
XWithdrawWindow(server.display, traywin->win, server.screen);
|
||||
XReparentWindow(server.display, traywin->win, traywin->parent, 0, 0);
|
||||
|
||||
if (systray_profile)
|
||||
fprintf(stderr,
|
||||
"XMoveResizeWindow(server.display, traywin->win = %ld, 0, 0, traywin->width = %d, traywin->height = %d)\n",
|
||||
"XMoveResizeWindow(server.display, traywin->win = %ld, 0, 0, traywin->width = %d, traywin->height = "
|
||||
"%d)\n",
|
||||
traywin->win,
|
||||
traywin->width,
|
||||
traywin->height);
|
||||
@@ -881,12 +810,10 @@ gboolean embed_icon(TrayWindow *traywin)
|
||||
if (hide) {
|
||||
// In theory we have to check the embedding with this and remove icons that refuse embedding.
|
||||
// In practice we have no idea when the other application processes the event and accepts the
|
||||
// embed
|
||||
// so we cannot check now without a race.
|
||||
// embed so we cannot check now without a race.
|
||||
// Race can be triggered with PyGtk(2) apps.
|
||||
// We could defer this for later (if we set PropertyChangeMask in XSelectInput we get notified)
|
||||
// but
|
||||
// for some reason it breaks transparency for Qt icons. So we don't.
|
||||
// but for some reason it breaks transparency for Qt icons. So we don't.
|
||||
// fprintf(stderr, RED "tint2: window refused embedding" RESET "\n");
|
||||
// remove_icon(traywin);
|
||||
// XFree(data);
|
||||
@@ -915,12 +842,10 @@ gboolean embed_icon(TrayWindow *traywin)
|
||||
XRaiseWindow(server.display, traywin->win);
|
||||
|
||||
// Make the icon visible
|
||||
if (!traywin->hide) {
|
||||
if (systray_profile)
|
||||
fprintf(stderr, "XMapWindow(server.display, traywin->win)\n");
|
||||
XMapWindow(server.display, traywin->win);
|
||||
}
|
||||
if (!traywin->hide && !panel->is_hidden) {
|
||||
if (systray_profile)
|
||||
fprintf(stderr, "XMapWindow(server.display, traywin->win)\n");
|
||||
XMapWindow(server.display, traywin->win);
|
||||
if (!panel->is_hidden) {
|
||||
if (systray_profile)
|
||||
fprintf(stderr, "XMapRaised(server.display, traywin->parent)\n");
|
||||
XMapRaised(server.display, traywin->parent);
|
||||
@@ -958,8 +883,6 @@ gboolean embed_icon(TrayWindow *traywin)
|
||||
|
||||
void remove_icon(TrayWindow *traywin)
|
||||
{
|
||||
// This code causes an X11 I/O error
|
||||
// close(((_XPrivDisplay)server.display)->fd);
|
||||
if (systray_profile)
|
||||
fprintf(stderr,
|
||||
"[%f] %s:%d win = %lu (%s)\n",
|
||||
@@ -982,8 +905,7 @@ void remove_icon(TrayWindow *traywin)
|
||||
XSync(server.display, False);
|
||||
error = FALSE;
|
||||
XErrorHandler old = XSetErrorHandler(window_error_handler);
|
||||
if (!traywin->hide)
|
||||
XUnmapWindow(server.display, traywin->win);
|
||||
XUnmapWindow(server.display, traywin->win);
|
||||
XReparentWindow(server.display, traywin->win, server.root_win, 0, 0);
|
||||
XDestroyWindow(server.display, traywin->parent);
|
||||
XSync(server.display, False);
|
||||
@@ -1001,8 +923,6 @@ void remove_icon(TrayWindow *traywin)
|
||||
int count = 0;
|
||||
GSList *l;
|
||||
for (l = systray.list_icons; l; l = l->next) {
|
||||
if (((TrayWindow *)l->data)->hide)
|
||||
continue;
|
||||
count++;
|
||||
}
|
||||
if (count == 0)
|
||||
@@ -1010,18 +930,19 @@ void remove_icon(TrayWindow *traywin)
|
||||
|
||||
// Resize and redraw the systray
|
||||
if (systray_profile)
|
||||
fprintf(stderr, BLUE "[%f] %s:%d trigger resize & redraw" RESET "\n", profiling_get_time(), __FUNCTION__, __LINE__);
|
||||
fprintf(stderr,
|
||||
BLUE "[%f] %s:%d trigger resize & redraw" RESET "\n",
|
||||
profiling_get_time(),
|
||||
__FUNCTION__,
|
||||
__LINE__);
|
||||
systray.area.resize_needed = TRUE;
|
||||
schedule_redraw(&systray.area);
|
||||
panel->area.resize_needed = TRUE;
|
||||
panel_refresh = TRUE;
|
||||
schedule_redraw(&systray.area);
|
||||
refresh_systray = TRUE;
|
||||
}
|
||||
|
||||
void systray_resize_icon(void *t)
|
||||
{
|
||||
// we end up in this function only in real transparency mode or if systray_task_asb != 100 0 0
|
||||
// we made also sure, that we always have a 32 bit visual, i.e. we can safely create 32 bit pixmaps here
|
||||
TrayWindow *traywin = t;
|
||||
|
||||
unsigned int border_width;
|
||||
@@ -1031,42 +952,43 @@ void systray_resize_icon(void *t)
|
||||
if (!XGetGeometry(server.display, traywin->win, &root, &xpos, &ypos, &width, &height, &border_width, &depth)) {
|
||||
return;
|
||||
} else {
|
||||
if (1 || xpos != 0 || ypos != 0 || width != traywin->width || height != traywin->height) {
|
||||
if (systray_profile)
|
||||
fprintf(stderr,
|
||||
"XMoveResizeWindow(server.display, traywin->win = %ld, 0, 0, traywin->width = %d, traywin->height "
|
||||
"= %d)\n",
|
||||
traywin->win,
|
||||
traywin->width,
|
||||
traywin->height);
|
||||
if (0) {
|
||||
XMoveResizeWindow(server.display, traywin->win, 0, 0, traywin->width, traywin->height);
|
||||
}
|
||||
if (0) {
|
||||
XWindowChanges changes;
|
||||
changes.x = changes.y = 0;
|
||||
changes.width = traywin->width;
|
||||
changes.height = traywin->height;
|
||||
XConfigureWindow(server.display, traywin->win, CWX | CWY | CWWidth | CWHeight, &changes);
|
||||
}
|
||||
if (1) {
|
||||
XConfigureEvent ev;
|
||||
ev.type = ConfigureNotify;
|
||||
ev.serial = 0;
|
||||
ev.send_event = True;
|
||||
ev.event = traywin->win;
|
||||
ev.window = traywin->win;
|
||||
ev.x = 0;
|
||||
ev.y = 0;
|
||||
ev.width = traywin->width;
|
||||
ev.height = traywin->height;
|
||||
ev.border_width = 0;
|
||||
ev.above = None;
|
||||
ev.override_redirect = False;
|
||||
XSendEvent(server.display, traywin->win, False, StructureNotifyMask, (XEvent *)&ev);
|
||||
}
|
||||
XSync(server.display, False);
|
||||
if (systray_profile)
|
||||
fprintf(stderr,
|
||||
"systray_resize_icon win = %ld, w = %d, h = %d\n",
|
||||
traywin->win,
|
||||
traywin->width,
|
||||
traywin->height);
|
||||
// This is the obvious thing to do but GTK tray icons do not respect the new size
|
||||
if (0) {
|
||||
XMoveResizeWindow(server.display, traywin->win, 0, 0, traywin->width, traywin->height);
|
||||
}
|
||||
// This is similar but GTK tray icons still do not respect the new size
|
||||
if (0) {
|
||||
XWindowChanges changes;
|
||||
changes.x = changes.y = 0;
|
||||
changes.width = traywin->width;
|
||||
changes.height = traywin->height;
|
||||
XConfigureWindow(server.display, traywin->win, CWX | CWY | CWWidth | CWHeight, &changes);
|
||||
}
|
||||
// This is what WMs send to windows to resize them, the new size must not be ignored.
|
||||
// A bit brutal but works with GTK and everything else.
|
||||
if (1) {
|
||||
XConfigureEvent ev;
|
||||
ev.type = ConfigureNotify;
|
||||
ev.serial = 0;
|
||||
ev.send_event = True;
|
||||
ev.event = traywin->win;
|
||||
ev.window = traywin->win;
|
||||
ev.x = 0;
|
||||
ev.y = 0;
|
||||
ev.width = traywin->width;
|
||||
ev.height = traywin->height;
|
||||
ev.border_width = 0;
|
||||
ev.above = None;
|
||||
ev.override_redirect = False;
|
||||
XSendEvent(server.display, traywin->win, False, StructureNotifyMask, (XEvent *)&ev);
|
||||
}
|
||||
XSync(server.display, False);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1131,9 +1053,13 @@ void systray_reconfigure_event(TrayWindow *traywin, XEvent *e)
|
||||
|
||||
// Resize and redraw the systray
|
||||
if (systray_profile)
|
||||
fprintf(stderr, BLUE "[%f] %s:%d trigger resize & redraw" RESET "\n", profiling_get_time(), __FUNCTION__, __LINE__);
|
||||
fprintf(stderr,
|
||||
BLUE "[%f] %s:%d trigger resize & redraw" RESET "\n",
|
||||
profiling_get_time(),
|
||||
__FUNCTION__,
|
||||
__LINE__);
|
||||
panel_refresh = TRUE;
|
||||
refresh_systray = 1;
|
||||
refresh_systray = TRUE;
|
||||
}
|
||||
|
||||
void systray_property_notify(TrayWindow *traywin, XEvent *e)
|
||||
@@ -1150,8 +1076,7 @@ void systray_property_notify(TrayWindow *traywin, XEvent *e)
|
||||
traywin->name = strdup("");
|
||||
}
|
||||
|
||||
if (systray.sort == SYSTRAY_SORT_ASCENDING ||
|
||||
systray.sort == SYSTRAY_SORT_DESCENDING) {
|
||||
if (systray.sort == SYSTRAY_SORT_ASCENDING || systray.sort == SYSTRAY_SORT_DESCENDING) {
|
||||
systray.list_icons = g_slist_sort(systray.list_icons, compare_traywindows);
|
||||
// print_icons();
|
||||
}
|
||||
@@ -1201,9 +1126,8 @@ void systray_resize_request_event(TrayWindow *traywin, XEvent *e)
|
||||
traywin->name);
|
||||
}
|
||||
// Delayed resize
|
||||
// FIXME Normally we should force the icon to resize fill_color to the size we resized it to when we
|
||||
// embedded it.
|
||||
// However this triggers a resize loop in new versions of GTK, which we must avoid.
|
||||
// FIXME Normally we should force the icon to resize to the size we resized it to when we embedded it.
|
||||
// However this triggers a resize loop in some versions of GTK, which we must avoid.
|
||||
if (!traywin->resize_timeout)
|
||||
traywin->resize_timeout =
|
||||
add_timeout(slow_resize_period, 0, systray_resize_icon, traywin, &traywin->resize_timeout);
|
||||
@@ -1216,9 +1140,13 @@ void systray_resize_request_event(TrayWindow *traywin, XEvent *e)
|
||||
|
||||
// Resize and redraw the systray
|
||||
if (systray_profile)
|
||||
fprintf(stderr, BLUE "[%f] %s:%d trigger resize & redraw" RESET "\n", profiling_get_time(), __FUNCTION__, __LINE__);
|
||||
fprintf(stderr,
|
||||
BLUE "[%f] %s:%d trigger resize & redraw" RESET "\n",
|
||||
profiling_get_time(),
|
||||
__FUNCTION__,
|
||||
__LINE__);
|
||||
panel_refresh = TRUE;
|
||||
refresh_systray = 1;
|
||||
refresh_systray = TRUE;
|
||||
}
|
||||
|
||||
void systray_destroy_event(TrayWindow *traywin)
|
||||
@@ -1315,7 +1243,6 @@ void systray_render_icon_composited(void *t)
|
||||
// good systray icons support 32 bit depth, but some icons are still 24 bit.
|
||||
// We create a heuristic mask for these icons, i.e. we get the rgb value in the top left corner, and
|
||||
// mask out all pixel with the same rgb value
|
||||
Panel *panel = systray.area.panel;
|
||||
|
||||
// Very ugly hack, but somehow imlib2 is not able to get the image from the traywindow itself,
|
||||
// so we first render the tray window onto a pixmap, and then we tell imlib2 to use this pixmap as
|
||||
@@ -1407,14 +1334,13 @@ void systray_render_icon_composited(void *t)
|
||||
create_heuristic_mask(data, traywin->width, traywin->height);
|
||||
}
|
||||
|
||||
gboolean empty = FALSE; //image_empty(data, traywin->width, traywin->height);
|
||||
if (systray.alpha != 100 || systray.brightness != 0 || systray.saturation != 0)
|
||||
adjust_asb(data,
|
||||
traywin->width,
|
||||
traywin->height,
|
||||
systray.alpha,
|
||||
(float)systray.saturation / 100,
|
||||
(float)systray.brightness / 100);
|
||||
systray.alpha / 100.0,
|
||||
systray.saturation / 100.0,
|
||||
systray.brightness / 100.0);
|
||||
imlib_image_put_back_data(data);
|
||||
|
||||
systray_render_icon_from_image(traywin);
|
||||
@@ -1427,23 +1353,6 @@ void systray_render_icon_composited(void *t)
|
||||
if (error)
|
||||
goto on_error;
|
||||
|
||||
if (traywin->empty != empty) {
|
||||
traywin->empty = empty;
|
||||
systray.list_icons = g_slist_sort(systray.list_icons, compare_traywindows);
|
||||
// print_icons();
|
||||
// Resize and redraw the systray
|
||||
if (systray_profile)
|
||||
fprintf(stderr,
|
||||
BLUE "[%f] %s:%d trigger resize & redraw" RESET "\n",
|
||||
profiling_get_time(),
|
||||
__FUNCTION__,
|
||||
__LINE__);
|
||||
systray.area.resize_needed = 1;
|
||||
schedule_redraw(&systray.area);
|
||||
panel->area.resize_needed = 1;
|
||||
panel_refresh = TRUE;
|
||||
refresh_systray = 1;
|
||||
}
|
||||
panel_refresh = TRUE;
|
||||
|
||||
if (systray_profile)
|
||||
@@ -1573,16 +1482,13 @@ void refresh_systray_icons()
|
||||
GSList *l;
|
||||
for (l = systray.list_icons; l; l = l->next) {
|
||||
traywin = (TrayWindow *)l->data;
|
||||
if (traywin->hide)
|
||||
continue;
|
||||
systray_render_icon(traywin);
|
||||
}
|
||||
}
|
||||
|
||||
gboolean systray_on_monitor(int i_monitor, int num_panelss)
|
||||
gboolean systray_on_monitor(int i_monitor, int num_panels)
|
||||
{
|
||||
return (i_monitor == systray_monitor) ||
|
||||
(i_monitor == 0 && (systray_monitor >= num_panelss || systray_monitor < 0));
|
||||
return (i_monitor == systray_monitor) || (i_monitor == 0 && (systray_monitor >= num_panels || systray_monitor < 0));
|
||||
}
|
||||
|
||||
TrayWindow *systray_find_icon(Window win)
|
||||
|
||||
@@ -35,35 +35,41 @@ typedef struct {
|
||||
SystraySortMethod sort;
|
||||
int alpha, saturation, brightness;
|
||||
int icon_size, icons_per_column, icons_per_row, margin;
|
||||
} Systraybar;
|
||||
} Systray;
|
||||
|
||||
typedef struct {
|
||||
Window parent;
|
||||
// The actual tray icon window (created by the application)
|
||||
Window win;
|
||||
// The parent window created by tint2 to embed the icon
|
||||
Window parent;
|
||||
int x, y;
|
||||
int width, height;
|
||||
// TODO: manage icon's show/hide
|
||||
gboolean hide;
|
||||
int depth;
|
||||
Damage damage;
|
||||
timeout *render_timeout;
|
||||
gboolean empty;
|
||||
int pid;
|
||||
int chrono;
|
||||
struct timespec time_last_render;
|
||||
int num_fast_renders;
|
||||
gboolean reparented;
|
||||
gboolean embedded;
|
||||
int bad_size_counter;
|
||||
timeout *resize_timeout;
|
||||
struct timespec time_last_resize;
|
||||
// Process PID or zero.
|
||||
int pid;
|
||||
// A number that is incremented for each new icon, used to sort them by the order in which they were created.
|
||||
int chrono;
|
||||
// Name of the tray icon window.
|
||||
char *name;
|
||||
// Members used for rendering
|
||||
struct timespec time_last_render;
|
||||
int num_fast_renders;
|
||||
timeout *render_timeout;
|
||||
// Members used for resizing
|
||||
int bad_size_counter;
|
||||
struct timespec time_last_resize;
|
||||
timeout *resize_timeout;
|
||||
// Icon contents if we are compositing the icon, otherwise null
|
||||
Imlib_Image image;
|
||||
// XDamage
|
||||
Damage damage;
|
||||
} TrayWindow;
|
||||
|
||||
// net_sel_win != None when protocol started
|
||||
extern Window net_sel_win;
|
||||
extern Systraybar systray;
|
||||
extern Systray systray;
|
||||
extern gboolean refresh_systray;
|
||||
extern gboolean systray_enabled;
|
||||
extern int systray_max_icon_size;
|
||||
@@ -83,7 +89,7 @@ void init_systray_panel(void *p);
|
||||
void draw_systray(void *obj, cairo_t *c);
|
||||
gboolean resize_systray(void *obj);
|
||||
void on_change_systray(void *obj);
|
||||
gboolean systray_on_monitor(int i_monitor, int num_panelss);
|
||||
gboolean systray_on_monitor(int i_monitor, int num_panels);
|
||||
|
||||
// systray protocol
|
||||
// many tray icon doesn't manage stop/restart of the systray manager
|
||||
|
||||
@@ -67,6 +67,7 @@ Task *add_task(Window win)
|
||||
memset(&task_template, 0, sizeof(task_template));
|
||||
task_template.area.has_mouse_over_effect = panel_config.mouse_effects;
|
||||
task_template.area.has_mouse_press_effect = panel_config.mouse_effects;
|
||||
task_template.area._is_under_mouse = full_width_area_is_under_mouse;
|
||||
task_template.win = win;
|
||||
task_template.desktop = get_window_desktop(win);
|
||||
task_template.area.panel = &panels[monitor];
|
||||
@@ -82,7 +83,8 @@ Task *add_task(Window win)
|
||||
task_update_title(&task_template);
|
||||
task_update_icon(&task_template);
|
||||
|
||||
// fprintf(stderr, "%s %d: win = %ld, task = %s\n", __FUNCTION__, __LINE__, win, task_template.title ? task_template.title : "??");
|
||||
// fprintf(stderr, "%s %d: win = %ld, task = %s\n", __FUNCTION__, __LINE__, win, task_template.title ?
|
||||
// task_template.title : "??");
|
||||
// fprintf(stderr, "new task %s win %u: desktop %d, monitor %d\n", new_task.title, win, new_task.desktop, monitor);
|
||||
|
||||
GPtrArray *task_buttons = g_ptr_array_new();
|
||||
@@ -95,6 +97,7 @@ Task *add_task(Window win)
|
||||
memcpy(&task_instance->area, &panels[monitor].g_task.area, sizeof(Area));
|
||||
task_instance->area.has_mouse_over_effect = panel_config.mouse_effects;
|
||||
task_instance->area.has_mouse_press_effect = panel_config.mouse_effects;
|
||||
task_instance->area._is_under_mouse = full_width_area_is_under_mouse;
|
||||
task_instance->win = task_template.win;
|
||||
task_instance->desktop = task_template.desktop;
|
||||
task_instance->win_x = task_template.win_x;
|
||||
@@ -124,20 +127,20 @@ Task *add_task(Window win)
|
||||
*key = task_template.win;
|
||||
g_hash_table_insert(win_to_task, key, task_buttons);
|
||||
|
||||
set_task_state((Task*)g_ptr_array_index(task_buttons, 0), task_template.current_state);
|
||||
set_task_state((Task *)g_ptr_array_index(task_buttons, 0), task_template.current_state);
|
||||
|
||||
sort_taskbar_for_win(win);
|
||||
|
||||
if (taskbar_mode == MULTI_DESKTOP) {
|
||||
Panel *panel = (Panel*)task_template.area.panel;
|
||||
Panel *panel = (Panel *)task_template.area.panel;
|
||||
panel->area.resize_needed = TRUE;
|
||||
}
|
||||
|
||||
if (window_is_urgent(win)) {
|
||||
add_urgent((Task*)g_ptr_array_index(task_buttons, 0));
|
||||
add_urgent((Task *)g_ptr_array_index(task_buttons, 0));
|
||||
}
|
||||
|
||||
return (Task*)g_ptr_array_index(task_buttons, 0);
|
||||
return (Task *)g_ptr_array_index(task_buttons, 0);
|
||||
}
|
||||
|
||||
void remove_task(Task *task)
|
||||
@@ -145,7 +148,8 @@ void remove_task(Task *task)
|
||||
if (!task)
|
||||
return;
|
||||
|
||||
// fprintf(stderr, "%s %d: win = %ld, task = %s\n", __FUNCTION__, __LINE__, task->win, task->title ? task->title : "??");
|
||||
// fprintf(stderr, "%s %d: win = %ld, task = %s\n", __FUNCTION__, __LINE__, task->win, task->title ? task->title :
|
||||
// "??");
|
||||
|
||||
if (taskbar_mode == MULTI_DESKTOP) {
|
||||
Panel *panel = task->area.panel;
|
||||
@@ -297,7 +301,7 @@ void task_update_icon(Task *task)
|
||||
int w = imlib_image_get_width();
|
||||
int h = imlib_image_get_height();
|
||||
Imlib_Image orig_image =
|
||||
imlib_create_cropped_scaled_image(0, 0, w, h, panel->g_task.icon_size1, panel->g_task.icon_size1);
|
||||
imlib_create_cropped_scaled_image(0, 0, w, h, panel->g_task.icon_size1, panel->g_task.icon_size1);
|
||||
imlib_free_image();
|
||||
|
||||
imlib_context_set_image(orig_image);
|
||||
@@ -313,20 +317,20 @@ void task_update_icon(Task *task)
|
||||
adjust_asb(data32,
|
||||
task->icon_width,
|
||||
task->icon_height,
|
||||
panel->g_task.alpha[k],
|
||||
(float)panel->g_task.saturation[k] / 100,
|
||||
(float)panel->g_task.brightness[k] / 100);
|
||||
panel->g_task.alpha[k] / 100.0,
|
||||
panel->g_task.saturation[k] / 100.0,
|
||||
panel->g_task.brightness[k] / 100.0);
|
||||
imlib_image_put_back_data(data32);
|
||||
}
|
||||
if (panel_config.mouse_effects) {
|
||||
task->icon_hover[k] = adjust_icon(task->icon[k],
|
||||
panel_config.mouse_over_alpha,
|
||||
panel_config.mouse_over_saturation,
|
||||
panel_config.mouse_over_brightness);
|
||||
panel_config.mouse_over_alpha,
|
||||
panel_config.mouse_over_saturation,
|
||||
panel_config.mouse_over_brightness);
|
||||
task->icon_press[k] = adjust_icon(task->icon[k],
|
||||
panel_config.mouse_pressed_alpha,
|
||||
panel_config.mouse_pressed_saturation,
|
||||
panel_config.mouse_pressed_brightness);
|
||||
panel_config.mouse_pressed_alpha,
|
||||
panel_config.mouse_pressed_saturation,
|
||||
panel_config.mouse_pressed_brightness);
|
||||
}
|
||||
}
|
||||
imlib_context_set_image(orig_image);
|
||||
@@ -383,6 +387,13 @@ void draw_task_icon(Task *task, int text_width)
|
||||
|
||||
imlib_context_set_image(image);
|
||||
render_image(task->area.pix, pos_x, panel->g_task.icon_posy);
|
||||
if (0) {
|
||||
fprintf(stderr, "Task icon size: %d %d pos %d\n", imlib_image_get_width(), imlib_image_get_height(), pos_x);
|
||||
fprintf(stderr, "Task max size : %d %d\n", panel->g_task.maximum_width, panel->g_task.maximum_height);
|
||||
fprintf(stderr, "Task area size: %d %d\n", task->area.width, task->area.height);
|
||||
fprintf(stderr, "Task area bord: %d\n", task->area.bg->border.width);
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
void draw_task(void *obj, cairo_t *c)
|
||||
|
||||
@@ -149,6 +149,7 @@ void init_taskbar_panel(void *p)
|
||||
panel->g_taskbar.area_name.panel = panel;
|
||||
panel->g_taskbar.area_name.size_mode = LAYOUT_FIXED;
|
||||
panel->g_taskbar.area_name._resize = resize_taskbarname;
|
||||
panel->g_taskbar.area_name._is_under_mouse = full_width_area_is_under_mouse;
|
||||
panel->g_taskbar.area_name._draw_foreground = draw_taskbarname;
|
||||
panel->g_taskbar.area_name._on_change_layout = 0;
|
||||
panel->g_taskbar.area_name.resize_needed = 1;
|
||||
@@ -160,6 +161,7 @@ void init_taskbar_panel(void *p)
|
||||
panel->g_taskbar.area.size_mode = LAYOUT_DYNAMIC;
|
||||
panel->g_taskbar.area.alignment = taskbar_alignment;
|
||||
panel->g_taskbar.area._resize = resize_taskbar;
|
||||
panel->g_taskbar.area._is_under_mouse = full_width_area_is_under_mouse;
|
||||
panel->g_taskbar.area.resize_needed = 1;
|
||||
panel->g_taskbar.area.on_screen = TRUE;
|
||||
if (panel_horizontal) {
|
||||
@@ -263,7 +265,9 @@ void init_taskbar_panel(void *p)
|
||||
panel->g_task.text_posx = panel->g_task.background[0]->border.width + panel->g_task.area.paddingxlr;
|
||||
panel->g_task.text_height = panel->g_task.area.height - (2 * panel->g_task.area.paddingy);
|
||||
if (panel->g_task.has_icon) {
|
||||
panel->g_task.icon_size1 = panel->g_task.area.height - (2 * panel->g_task.area.paddingy);
|
||||
panel->g_task.icon_size1 =
|
||||
MIN(panel->g_task.maximum_width, MIN(panel->g_task.maximum_height, panel->g_task.area.height)) -
|
||||
(2 * panel->g_task.area.paddingy) - 2 * panel->g_task.area.bg->border.width;
|
||||
panel->g_task.text_posx += panel->g_task.icon_size1 + panel->g_task.area.paddingx;
|
||||
panel->g_task.icon_posy = (panel->g_task.area.height - panel->g_task.icon_size1) / 2;
|
||||
}
|
||||
|
||||
@@ -89,4 +89,6 @@ void sort_taskbar_for_win(Window win);
|
||||
|
||||
void sort_tasks(Taskbar *taskbar);
|
||||
|
||||
gboolean taskbar_is_under_mouse(void *obj, int x, int y);
|
||||
|
||||
#endif
|
||||
|
||||
193
src/tint.c
193
src/tint.c
@@ -135,37 +135,66 @@ void write_string(int fd, const char *s)
|
||||
const char *signal_name(int sig)
|
||||
{
|
||||
switch (sig) {
|
||||
case SIGHUP: return "SIGHUP: Hangup (POSIX).";
|
||||
case SIGINT: return "SIGINT: Interrupt (ANSI).";
|
||||
case SIGQUIT: return "SIGQUIT: Quit (POSIX).";
|
||||
case SIGILL: return "SIGILL: Illegal instruction (ANSI).";
|
||||
case SIGTRAP: return "SIGTRAP: Trace trap (POSIX).";
|
||||
case SIGABRT: return "SIGABRT/SIGIOT: Abort (ANSI) / IOT trap (4.2 BSD).";
|
||||
case SIGBUS: return "SIGBUS: BUS error (4.2 BSD).";
|
||||
case SIGFPE: return "SIGFPE: Floating-point exception (ANSI).";
|
||||
case SIGKILL: return "SIGKILL: Kill, unblockable (POSIX).";
|
||||
case SIGUSR1: return "SIGUSR1: User-defined signal 1 (POSIX).";
|
||||
case SIGSEGV: return "SIGSEGV: Segmentation violation (ANSI).";
|
||||
case SIGUSR2: return "SIGUSR2: User-defined signal 2 (POSIX).";
|
||||
case SIGPIPE: return "SIGPIPE: Broken pipe (POSIX).";
|
||||
case SIGALRM: return "SIGALRM: Alarm clock (POSIX).";
|
||||
case SIGTERM: return "SIGTERM: Termination (ANSI).";
|
||||
//case SIGSTKFLT: return "SIGSTKFLT: Stack fault.";
|
||||
case SIGCHLD: return "SIGCHLD: Child status has changed (POSIX).";
|
||||
case SIGCONT: return "SIGCONT: Continue (POSIX).";
|
||||
case SIGSTOP: return "SIGSTOP: Stop, unblockable (POSIX).";
|
||||
case SIGTSTP: return "SIGTSTP: Keyboard stop (POSIX).";
|
||||
case SIGTTIN: return "SIGTTIN: Background read from tty (POSIX).";
|
||||
case SIGTTOU: return "SIGTTOU: Background write to tty (POSIX).";
|
||||
case SIGURG: return "SIGURG: Urgent condition on socket (4.2 BSD).";
|
||||
case SIGXCPU: return "SIGXCPU: CPU limit exceeded (4.2 BSD).";
|
||||
case SIGXFSZ: return "SIGXFSZ: File size limit exceeded (4.2 BSD).";
|
||||
case SIGVTALRM: return "SIGVTALRM: Virtual alarm clock (4.2 BSD).";
|
||||
case SIGPROF: return "SIGPROF: Profiling alarm clock (4.2 BSD).";
|
||||
case SIGWINCH: return "SIGWINCH: Window size change (4.3 BSD, Sun).";
|
||||
case SIGIO: return "SIGIO: Pollable event occurred (System V) / I/O now possible (4.2 BSD).";
|
||||
//case SIGPWR: return "SIGPWR: Power failure restart (System V).";
|
||||
case SIGSYS: return "SIGSYS: Bad system call.";
|
||||
case SIGHUP:
|
||||
return "SIGHUP: Hangup (POSIX).";
|
||||
case SIGINT:
|
||||
return "SIGINT: Interrupt (ANSI).";
|
||||
case SIGQUIT:
|
||||
return "SIGQUIT: Quit (POSIX).";
|
||||
case SIGILL:
|
||||
return "SIGILL: Illegal instruction (ANSI).";
|
||||
case SIGTRAP:
|
||||
return "SIGTRAP: Trace trap (POSIX).";
|
||||
case SIGABRT:
|
||||
return "SIGABRT/SIGIOT: Abort (ANSI) / IOT trap (4.2 BSD).";
|
||||
case SIGBUS:
|
||||
return "SIGBUS: BUS error (4.2 BSD).";
|
||||
case SIGFPE:
|
||||
return "SIGFPE: Floating-point exception (ANSI).";
|
||||
case SIGKILL:
|
||||
return "SIGKILL: Kill, unblockable (POSIX).";
|
||||
case SIGUSR1:
|
||||
return "SIGUSR1: User-defined signal 1 (POSIX).";
|
||||
case SIGSEGV:
|
||||
return "SIGSEGV: Segmentation violation (ANSI).";
|
||||
case SIGUSR2:
|
||||
return "SIGUSR2: User-defined signal 2 (POSIX).";
|
||||
case SIGPIPE:
|
||||
return "SIGPIPE: Broken pipe (POSIX).";
|
||||
case SIGALRM:
|
||||
return "SIGALRM: Alarm clock (POSIX).";
|
||||
case SIGTERM:
|
||||
return "SIGTERM: Termination (ANSI).";
|
||||
// case SIGSTKFLT: return "SIGSTKFLT: Stack fault.";
|
||||
case SIGCHLD:
|
||||
return "SIGCHLD: Child status has changed (POSIX).";
|
||||
case SIGCONT:
|
||||
return "SIGCONT: Continue (POSIX).";
|
||||
case SIGSTOP:
|
||||
return "SIGSTOP: Stop, unblockable (POSIX).";
|
||||
case SIGTSTP:
|
||||
return "SIGTSTP: Keyboard stop (POSIX).";
|
||||
case SIGTTIN:
|
||||
return "SIGTTIN: Background read from tty (POSIX).";
|
||||
case SIGTTOU:
|
||||
return "SIGTTOU: Background write to tty (POSIX).";
|
||||
case SIGURG:
|
||||
return "SIGURG: Urgent condition on socket (4.2 BSD).";
|
||||
case SIGXCPU:
|
||||
return "SIGXCPU: CPU limit exceeded (4.2 BSD).";
|
||||
case SIGXFSZ:
|
||||
return "SIGXFSZ: File size limit exceeded (4.2 BSD).";
|
||||
case SIGVTALRM:
|
||||
return "SIGVTALRM: Virtual alarm clock (4.2 BSD).";
|
||||
case SIGPROF:
|
||||
return "SIGPROF: Profiling alarm clock (4.2 BSD).";
|
||||
case SIGWINCH:
|
||||
return "SIGWINCH: Window size change (4.3 BSD, Sun).";
|
||||
case SIGIO:
|
||||
return "SIGIO: Pollable event occurred (System V) / I/O now possible (4.2 BSD).";
|
||||
// case SIGPWR: return "SIGPWR: Power failure restart (System V).";
|
||||
case SIGSYS:
|
||||
return "SIGSYS: Bad system call.";
|
||||
}
|
||||
static char s[64];
|
||||
sprintf(s, "SIG=%d: Unknown", sig);
|
||||
@@ -191,6 +220,7 @@ const char *get_home_dir()
|
||||
|
||||
void dump_backtrace(int log_fd)
|
||||
{
|
||||
#ifndef DISABLE_BACKTRACE
|
||||
log_string(log_fd, "\n" YELLOW "Backtrace:" RESET "\n");
|
||||
|
||||
#ifdef ENABLE_LIBUNWIND
|
||||
@@ -203,7 +233,7 @@ void dump_backtrace(int log_fd)
|
||||
unw_word_t offset;
|
||||
char fname[128];
|
||||
fname[0] = '\0';
|
||||
(void) unw_get_proc_name(&cursor, fname, sizeof(fname), &offset);
|
||||
(void)unw_get_proc_name(&cursor, fname, sizeof(fname), &offset);
|
||||
log_string(log_fd, fname);
|
||||
log_string(log_fd, "\n");
|
||||
}
|
||||
@@ -220,12 +250,9 @@ void dump_backtrace(int log_fd)
|
||||
}
|
||||
|
||||
free(strings);
|
||||
#else
|
||||
#ifdef DISABLE_BACKTRACE
|
||||
log_string(log_fd, "Backtrace support disabled at compile time.\n");
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif // ENABLE_EXECINFO
|
||||
#endif // ENABLE_LIBUNWIND
|
||||
#endif // DISABLE_BACKTRACE
|
||||
}
|
||||
|
||||
// sleep() returns early when signals arrive. This function does not.
|
||||
@@ -242,16 +269,17 @@ void safe_sleep(int seconds)
|
||||
|
||||
void handle_crash(const char *reason)
|
||||
{
|
||||
// We are going to crash, so restart the panel
|
||||
#ifndef DISABLE_BACKTRACE
|
||||
char path[4096];
|
||||
sprintf(path, "%s/.tint2-crash.log", get_home_dir());
|
||||
int log_fd = open(path, O_WRONLY|O_CREAT|O_TRUNC, 0600);
|
||||
int log_fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0600);
|
||||
log_string(log_fd, RED "tint2 crashed, reason: ");
|
||||
log_string(log_fd, reason);
|
||||
log_string(log_fd, RESET "\n");
|
||||
dump_backtrace(log_fd);
|
||||
log_string(log_fd, RED "Please create a bug report with this log output." RESET "\n");
|
||||
close(log_fd);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef BACKTRACE_ON_SIGNAL
|
||||
@@ -528,7 +556,8 @@ void get_snapshot(const char *path)
|
||||
if (panel->area.width > server.monitors[0].width)
|
||||
panel->area.width = server.monitors[0].width;
|
||||
|
||||
panel->temp_pmap = XCreatePixmap(server.display, server.root_win, panel->area.width, panel->area.height, server.depth);
|
||||
panel->temp_pmap =
|
||||
XCreatePixmap(server.display, server.root_win, panel->area.width, panel->area.height, server.depth);
|
||||
render_panel(panel);
|
||||
|
||||
Imlib_Image img = NULL;
|
||||
@@ -842,7 +871,8 @@ void event_button_release(XEvent *e)
|
||||
// switch desktop
|
||||
if (taskbar_mode == MULTI_DESKTOP) {
|
||||
gboolean diff_desktop = FALSE;
|
||||
if (taskbar->desktop != server.desktop && action != CLOSE && action != DESKTOP_LEFT && action != DESKTOP_RIGHT) {
|
||||
if (taskbar->desktop != server.desktop && action != CLOSE && action != DESKTOP_LEFT &&
|
||||
action != DESKTOP_RIGHT) {
|
||||
diff_desktop = TRUE;
|
||||
change_desktop(taskbar->desktop);
|
||||
}
|
||||
@@ -919,6 +949,14 @@ void event_property_notify(XEvent *e)
|
||||
|
||||
if (xsettings_client)
|
||||
xsettings_client_process_event(xsettings_client, e);
|
||||
for (int i = 0; i < num_panels; i++) {
|
||||
Panel *p = &panels[i];
|
||||
if (win == p->main_win) {
|
||||
if (at == server.atom._NET_WM_DESKTOP && get_window_desktop(p->main_win) != ALL_DESKTOPS)
|
||||
place_panel_all_desktops(p);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (win == server.root_win) {
|
||||
if (!server.got_root_win) {
|
||||
XSelectInput(server.display, server.root_win, PropertyChangeMask | StructureNotifyMask);
|
||||
@@ -932,10 +970,8 @@ void event_property_notify(XEvent *e)
|
||||
update_desktop_names();
|
||||
}
|
||||
// Change desktops
|
||||
else if (at == server.atom._NET_NUMBER_OF_DESKTOPS ||
|
||||
at == server.atom._NET_DESKTOP_GEOMETRY ||
|
||||
at == server.atom._NET_DESKTOP_VIEWPORT ||
|
||||
at == server.atom._NET_WORKAREA ||
|
||||
else if (at == server.atom._NET_NUMBER_OF_DESKTOPS || at == server.atom._NET_DESKTOP_GEOMETRY ||
|
||||
at == server.atom._NET_DESKTOP_VIEWPORT || at == server.atom._NET_WORKAREA ||
|
||||
at == server.atom._NET_CURRENT_DESKTOP) {
|
||||
if (debug)
|
||||
fprintf(stderr, "%s %d: win = root, atom = ?? desktops changed\n", __FUNCTION__, __LINE__);
|
||||
@@ -1054,7 +1090,13 @@ void event_property_notify(XEvent *e)
|
||||
Task *task = get_task(win);
|
||||
if (debug) {
|
||||
char *atom_name = XGetAtomName(server.display, at);
|
||||
fprintf(stderr, "%s %d: win = %ld, task = %s, atom = %s\n", __FUNCTION__, __LINE__, win, task ? (task->title ? task->title : "??") : "null", atom_name);
|
||||
fprintf(stderr,
|
||||
"%s %d: win = %ld, task = %s, atom = %s\n",
|
||||
__FUNCTION__,
|
||||
__LINE__,
|
||||
win,
|
||||
task ? (task->title ? task->title : "??") : "null",
|
||||
atom_name);
|
||||
XFree(atom_name);
|
||||
}
|
||||
if (!task) {
|
||||
@@ -1155,12 +1197,20 @@ void event_configure_notify(XEvent *e)
|
||||
|
||||
if (0) {
|
||||
Task *task = get_task(win);
|
||||
fprintf(stderr, "%s %d: win = %ld, task = %s\n", __FUNCTION__, __LINE__, win, task ? (task->title ? task->title : "??") : "null");
|
||||
fprintf(stderr,
|
||||
"%s %d: win = %ld, task = %s\n",
|
||||
__FUNCTION__,
|
||||
__LINE__,
|
||||
win,
|
||||
task ? (task->title ? task->title : "??") : "null");
|
||||
}
|
||||
|
||||
// change in root window (xrandr)
|
||||
if (win == server.root_win) {
|
||||
fprintf(stderr, YELLOW "%s %d: triggering tint2 restart due to configuration change in the root window" RESET "\n", __FILE__, __LINE__);
|
||||
fprintf(stderr,
|
||||
YELLOW "%s %d: triggering tint2 restart due to configuration change in the root window" RESET "\n",
|
||||
__FILE__,
|
||||
__LINE__);
|
||||
signal_pending = SIGUSR1;
|
||||
return;
|
||||
}
|
||||
@@ -1439,8 +1489,9 @@ start:
|
||||
init_X11_pre_config();
|
||||
|
||||
if (!config_read()) {
|
||||
fprintf(stderr, "Could not read config file.\n"
|
||||
"Usage: tint2 [[-c] <config_file>]\n");
|
||||
fprintf(stderr,
|
||||
"Could not read config file.\n"
|
||||
"Usage: tint2 [[-c] <config_file>]\n");
|
||||
cleanup();
|
||||
exit(1);
|
||||
}
|
||||
@@ -1476,7 +1527,11 @@ start:
|
||||
while (1) {
|
||||
if (panel_refresh) {
|
||||
if (systray_profile)
|
||||
fprintf(stderr, BLUE "[%f] %s:%d redrawing panel" RESET "\n", profiling_get_time(), __FUNCTION__, __LINE__);
|
||||
fprintf(stderr,
|
||||
BLUE "[%f] %s:%d redrawing panel" RESET "\n",
|
||||
profiling_get_time(),
|
||||
__FUNCTION__,
|
||||
__LINE__);
|
||||
panel_refresh = FALSE;
|
||||
|
||||
for (int i = 0; i < num_panels; i++) {
|
||||
@@ -1484,7 +1539,11 @@ start:
|
||||
|
||||
if (panel->is_hidden) {
|
||||
if (!panel->hidden_pixmap) {
|
||||
panel->hidden_pixmap = XCreatePixmap(server.display, server.root_win, panel->hidden_width, panel->hidden_height, server.depth);
|
||||
panel->hidden_pixmap = XCreatePixmap(server.display,
|
||||
server.root_win,
|
||||
panel->hidden_width,
|
||||
panel->hidden_height,
|
||||
server.depth);
|
||||
int xoff = 0, yoff = 0;
|
||||
if (panel_horizontal && panel_position & BOTTOM)
|
||||
yoff = panel->area.height - panel->hidden_height;
|
||||
@@ -1515,8 +1574,11 @@ start:
|
||||
} else {
|
||||
if (panel->temp_pmap)
|
||||
XFreePixmap(server.display, panel->temp_pmap);
|
||||
panel->temp_pmap =
|
||||
XCreatePixmap(server.display, server.root_win, panel->area.width, panel->area.height, server.depth);
|
||||
panel->temp_pmap = XCreatePixmap(server.display,
|
||||
server.root_win,
|
||||
panel->area.width,
|
||||
panel->area.height,
|
||||
server.depth);
|
||||
render_panel(panel);
|
||||
if (panel == (Panel *)systray.area.panel) {
|
||||
if (refresh_systray && panel && !panel->is_hidden) {
|
||||
@@ -1616,7 +1678,7 @@ start:
|
||||
case ButtonPress: {
|
||||
tooltip_hide(0);
|
||||
event_button_press(&e);
|
||||
Area *area = click_area(panel, e.xbutton.x, e.xbutton.y);
|
||||
Area *area = find_area_under_mouse(panel, e.xbutton.x, e.xbutton.y);
|
||||
if (panel_config.mouse_effects)
|
||||
mouse_over(area, 1);
|
||||
break;
|
||||
@@ -1624,7 +1686,7 @@ start:
|
||||
|
||||
case ButtonRelease: {
|
||||
event_button_release(&e);
|
||||
Area *area = click_area(panel, e.xbutton.x, e.xbutton.y);
|
||||
Area *area = find_area_under_mouse(panel, e.xbutton.x, e.xbutton.y);
|
||||
if (panel_config.mouse_effects)
|
||||
mouse_over(area, 0);
|
||||
break;
|
||||
@@ -1635,7 +1697,7 @@ start:
|
||||
if (e.xmotion.state & button_mask)
|
||||
event_button_motion_notify(&e);
|
||||
|
||||
Area *area = click_area(panel, e.xmotion.x, e.xmotion.y);
|
||||
Area *area = find_area_under_mouse(panel, e.xmotion.x, e.xmotion.y);
|
||||
if (area->_get_tooltip_text)
|
||||
tooltip_trigger_show(area, panel, &e);
|
||||
else
|
||||
@@ -1703,7 +1765,10 @@ start:
|
||||
case DestroyNotify:
|
||||
if (e.xany.window == server.composite_manager) {
|
||||
// Stop real_transparency
|
||||
fprintf(stderr, YELLOW "%s %d: triggering tint2 restart due to compositor shutdown" RESET "\n", __FILE__, __LINE__);
|
||||
fprintf(stderr,
|
||||
YELLOW "%s %d: triggering tint2 restart due to compositor shutdown" RESET "\n",
|
||||
__FILE__,
|
||||
__LINE__);
|
||||
signal_pending = SIGUSR1;
|
||||
break;
|
||||
}
|
||||
@@ -1722,11 +1787,17 @@ start:
|
||||
if (ev->data.l[1] == server.atom._NET_WM_CM_S0) {
|
||||
if (ev->data.l[2] == None) {
|
||||
// Stop real_transparency
|
||||
fprintf(stderr, YELLOW "%s %d: triggering tint2 restart due to change in transparency" RESET "\n", __FILE__, __LINE__);
|
||||
fprintf(stderr,
|
||||
YELLOW "%s %d: triggering tint2 restart due to change in transparency" RESET "\n",
|
||||
__FILE__,
|
||||
__LINE__);
|
||||
signal_pending = SIGUSR1;
|
||||
} else {
|
||||
// Start real_transparency
|
||||
fprintf(stderr, YELLOW "%s %d: triggering tint2 restart due to change in transparency" RESET "\n", __FILE__, __LINE__);
|
||||
fprintf(stderr,
|
||||
YELLOW "%s %d: triggering tint2 restart due to change in transparency" RESET "\n",
|
||||
__FILE__,
|
||||
__LINE__);
|
||||
signal_pending = SIGUSR1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,8 +20,9 @@ include_directories( ../util
|
||||
${RSVG_INCLUDE_DIRS} )
|
||||
|
||||
set(SOURCES ../util/common.c
|
||||
../util/strnatcmp.c
|
||||
../config.c
|
||||
../util/strnatcmp.c
|
||||
../util/cache.c
|
||||
../config.c
|
||||
../server.c
|
||||
../launcher/apps-common.c
|
||||
../launcher/icon-theme-common.c
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -16,4 +16,5 @@
|
||||
|
||||
#define SNAPSHOT_TICK 190
|
||||
gboolean update_snapshot();
|
||||
void menuApply();
|
||||
void menuApply();
|
||||
void refresh_current_theme();
|
||||
|
||||
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
2388
src/tint2conf/po/ru.po
Normal file
2388
src/tint2conf/po/ru.po
Normal file
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
@@ -17,6 +17,9 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
**************************************************************************/
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "main.h"
|
||||
#include "properties.h"
|
||||
#include "properties_rw.h"
|
||||
@@ -161,7 +164,7 @@ void current_background_changed(GtkWidget *widget, gpointer data);
|
||||
void background_combo_changed(GtkWidget *widget, gpointer data);
|
||||
void create_panel(GtkWidget *parent);
|
||||
void create_panel_items(GtkWidget *parent);
|
||||
void create_launcher(GtkWidget *parent);
|
||||
void create_launcher(GtkWidget *parent, GtkWindow *window);
|
||||
gchar *get_default_theme_name();
|
||||
void icon_theme_changed();
|
||||
void load_icons(GtkListStore *apps);
|
||||
@@ -205,20 +208,20 @@ const gchar *get_default_font()
|
||||
|
||||
void applyClicked(GtkWidget *widget, gpointer data)
|
||||
{
|
||||
gchar *file = get_current_theme_file_name();
|
||||
if (file) {
|
||||
if (config_is_manual(file)) {
|
||||
gchar *backup_path = g_strdup_printf("%s.backup.%ld", file, time(NULL));
|
||||
copy_file(file, backup_path);
|
||||
gchar *filepath = get_current_theme_path();
|
||||
if (filepath) {
|
||||
if (config_is_manual(filepath)) {
|
||||
gchar *backup_path = g_strdup_printf("%s.backup.%ld", filepath, time(NULL));
|
||||
copy_file(filepath, backup_path);
|
||||
g_free(backup_path);
|
||||
}
|
||||
|
||||
config_save_file(file);
|
||||
config_save_file(filepath);
|
||||
}
|
||||
int unused = system("killall -SIGUSR1 tint2 || pkill -SIGUSR1 -x tint2");
|
||||
(void)unused;
|
||||
g_free(file);
|
||||
g_timeout_add(SNAPSHOT_TICK, (GSourceFunc)update_snapshot, NULL);
|
||||
g_free(filepath);
|
||||
refresh_current_theme();
|
||||
}
|
||||
|
||||
void cancelClicked(GtkWidget *widget, gpointer data)
|
||||
@@ -333,7 +336,7 @@ GtkWidget *create_properties()
|
||||
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);
|
||||
create_launcher(page_launcher, GTK_WINDOW(view));
|
||||
|
||||
label = gtk_label_new(_("Clock"));
|
||||
gtk_widget_show(label);
|
||||
@@ -2204,8 +2207,11 @@ void set_current_icon_theme(const char *theme)
|
||||
}
|
||||
}
|
||||
|
||||
void icon_theme_changed()
|
||||
void icon_theme_changed(gpointer data)
|
||||
{
|
||||
create_please_wait(GTK_WINDOW(data));
|
||||
process_events();
|
||||
|
||||
if (icon_theme)
|
||||
free_themes(icon_theme);
|
||||
|
||||
@@ -2219,15 +2225,20 @@ void icon_theme_changed()
|
||||
|
||||
load_icons(launcher_apps);
|
||||
load_icons(all_apps);
|
||||
save_icon_cache(icon_theme);
|
||||
|
||||
destroy_please_wait();
|
||||
}
|
||||
|
||||
void launcher_icon_theme_changed(GtkWidget *widget, gpointer data)
|
||||
{
|
||||
icon_theme_changed();
|
||||
icon_theme_changed(data);
|
||||
}
|
||||
|
||||
GdkPixbuf *load_icon(const gchar *name)
|
||||
{
|
||||
process_events();
|
||||
|
||||
int size = 22;
|
||||
char *path = get_icon_path(icon_theme, name, size);
|
||||
GdkPixbuf *pixbuf = path ? gdk_pixbuf_new_from_file_at_size(path, size, size, NULL) : NULL;
|
||||
@@ -2265,37 +2276,83 @@ void load_icons(GtkListStore *apps)
|
||||
|
||||
void load_desktop_file(const char *file, gboolean selected)
|
||||
{
|
||||
DesktopEntry entry;
|
||||
if (read_desktop_file(file, &entry)) {
|
||||
GdkPixbuf *pixbuf = load_icon(entry.icon);
|
||||
char *file_contracted = contract_tilde(file);
|
||||
|
||||
GtkListStore *store = selected ? launcher_apps : all_apps;
|
||||
gboolean duplicate = FALSE;
|
||||
for (int index = 0; ; index++) {
|
||||
GtkTreePath *path = gtk_tree_path_new_from_indices(index, -1);
|
||||
GtkTreeIter iter;
|
||||
gtk_list_store_append(selected ? launcher_apps : all_apps, &iter);
|
||||
gtk_list_store_set(selected ? launcher_apps :all_apps, &iter,
|
||||
appsColIcon, pixbuf,
|
||||
appsColText, g_strdup(entry.name),
|
||||
appsColPath, g_strdup(file),
|
||||
appsColIconName, g_strdup(entry.icon),
|
||||
-1);
|
||||
if (pixbuf)
|
||||
g_object_unref(pixbuf);
|
||||
} else {
|
||||
printf("Could not load %s\n", file);
|
||||
GtkTreeIter iter;
|
||||
gtk_list_store_append(selected ? launcher_apps : all_apps, &iter);
|
||||
gtk_list_store_set(selected ? launcher_apps :all_apps, &iter,
|
||||
appsColIcon, NULL,
|
||||
appsColText, g_strdup(file),
|
||||
appsColPath, g_strdup(file),
|
||||
appsColIconName, g_strdup(""),
|
||||
-1);
|
||||
gboolean found = gtk_tree_model_get_iter(GTK_TREE_MODEL(store), &iter, path);
|
||||
gtk_tree_path_free(path);
|
||||
if (!found)
|
||||
break;
|
||||
|
||||
gchar *app_path;
|
||||
gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, appsColPath, &app_path, -1);
|
||||
char *contracted = contract_tilde(app_path);
|
||||
if (strcmp(contracted, file_contracted) == 0) {
|
||||
duplicate = TRUE;
|
||||
break;
|
||||
}
|
||||
free(contracted);
|
||||
g_free(app_path);
|
||||
}
|
||||
free_desktop_entry(&entry);
|
||||
|
||||
if (!duplicate) {
|
||||
DesktopEntry entry;
|
||||
if (read_desktop_file(file, &entry)) {
|
||||
int index;
|
||||
gboolean stop = FALSE;
|
||||
for (index = 0; !stop || selected; index++) {
|
||||
GtkTreePath *path = gtk_tree_path_new_from_indices(index, -1);
|
||||
GtkTreeIter iter;
|
||||
gboolean found = gtk_tree_model_get_iter(GTK_TREE_MODEL(store), &iter, path);
|
||||
gtk_tree_path_free(path);
|
||||
if (!found)
|
||||
break;
|
||||
|
||||
gchar *app_name;
|
||||
gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, appsColText, &app_name, -1);
|
||||
if (strnatcasecmp(app_name, entry.name) >= 0)
|
||||
stop = TRUE;
|
||||
g_free(app_name);
|
||||
}
|
||||
|
||||
GdkPixbuf *pixbuf = load_icon(entry.icon);
|
||||
GtkTreeIter iter;
|
||||
gtk_list_store_insert(store, &iter, index);
|
||||
gtk_list_store_set(store, &iter,
|
||||
appsColIcon, pixbuf,
|
||||
appsColText, g_strdup(entry.name),
|
||||
appsColPath, g_strdup(file),
|
||||
appsColIconName, g_strdup(entry.icon),
|
||||
-1);
|
||||
if (pixbuf)
|
||||
g_object_unref(pixbuf);
|
||||
} else {
|
||||
printf("Could not load %s\n", file);
|
||||
GdkPixbuf *pixbuf = load_icon(DEFAULT_ICON);
|
||||
GtkTreeIter iter;
|
||||
gtk_list_store_append(store, &iter);
|
||||
gtk_list_store_set(store, &iter,
|
||||
appsColIcon, pixbuf,
|
||||
appsColText, g_strdup(file),
|
||||
appsColPath, g_strdup(file),
|
||||
appsColIconName, g_strdup(""),
|
||||
-1);
|
||||
if (pixbuf)
|
||||
g_object_unref(pixbuf);
|
||||
}
|
||||
free_desktop_entry(&entry);
|
||||
}
|
||||
|
||||
free(file_contracted);
|
||||
}
|
||||
|
||||
void populate_from_entries(GList *entries, gboolean selected)
|
||||
{
|
||||
GList *l;
|
||||
for (l = entries; l; l = l->next) {
|
||||
for (GList *l = entries; l; l = l->next) {
|
||||
DesktopEntry *entry = (DesktopEntry *)l->data;
|
||||
GdkPixbuf *pixbuf = load_icon(entry->icon);
|
||||
GtkTreeIter iter;
|
||||
@@ -2318,9 +2375,15 @@ static gint compare_entries(gconstpointer a, gconstpointer b)
|
||||
|
||||
void load_desktop_entry(const char *file, GList **entries)
|
||||
{
|
||||
process_events();
|
||||
|
||||
DesktopEntry *entry = calloc(1, sizeof(DesktopEntry));
|
||||
if (!read_desktop_file(file, entry))
|
||||
printf("Could not load %s\n", file);
|
||||
if (entry->hidden_from_menus) {
|
||||
free(entry);
|
||||
return;
|
||||
}
|
||||
if (!entry->name)
|
||||
entry->name = strdup(file);
|
||||
if (!entry->icon)
|
||||
@@ -2330,6 +2393,8 @@ void load_desktop_entry(const char *file, GList **entries)
|
||||
|
||||
void load_desktop_entries(const char *path, GList **entries)
|
||||
{
|
||||
process_events();
|
||||
|
||||
GList *subdirs = NULL;
|
||||
GList *files = NULL;
|
||||
|
||||
@@ -2367,9 +2432,19 @@ void load_desktop_entries(const char *path, GList **entries)
|
||||
g_list_free(files);
|
||||
}
|
||||
|
||||
void load_theme_file(const char *file_name, const char *theme)
|
||||
static gint compare_themes(gconstpointer a, gconstpointer b)
|
||||
{
|
||||
if (!file_name || !theme) {
|
||||
gint result = strnatcasecmp(((IconTheme*)a)->description, ((IconTheme*)b)->description);
|
||||
if (result)
|
||||
return result;
|
||||
return strnatcasecmp(((IconTheme*)a)->name, ((IconTheme*)b)->name);
|
||||
}
|
||||
|
||||
void load_theme_file(const char *file_name, const char *theme_name, GList **themes)
|
||||
{
|
||||
process_events();
|
||||
|
||||
if (!file_name || !theme_name) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2397,13 +2472,11 @@ void load_theme_file(const char *file_name, const char *theme)
|
||||
|
||||
if (parse_theme_line(line, &key, &value)) {
|
||||
if (strcmp(key, "Name") == 0) {
|
||||
// value is like Tango
|
||||
GtkTreeIter iter;
|
||||
gtk_list_store_append(icon_themes, &iter);
|
||||
gtk_list_store_set(icon_themes, &iter,
|
||||
iconsColName, g_strdup(theme),
|
||||
iconsColDescr, g_strdup(value),
|
||||
-1);
|
||||
IconTheme *theme = calloc(1, sizeof(IconTheme));
|
||||
theme->name = strdup(theme_name);
|
||||
theme->description = strdup(value);
|
||||
*themes = g_list_append(*themes, theme);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2415,8 +2488,10 @@ void load_theme_file(const char *file_name, const char *theme)
|
||||
free(line);
|
||||
}
|
||||
|
||||
void load_icon_themes(const gchar *path, const gchar *parent)
|
||||
void load_icon_themes(const gchar *path, const gchar *parent, GList **themes)
|
||||
{
|
||||
process_events();
|
||||
|
||||
GDir *d = g_dir_open(path, 0, NULL);
|
||||
if (!d)
|
||||
return;
|
||||
@@ -2426,9 +2501,22 @@ void load_icon_themes(const gchar *path, const gchar *parent)
|
||||
if (parent &&
|
||||
g_file_test(file, G_FILE_TEST_IS_REGULAR) &&
|
||||
g_str_equal(name, "index.theme")) {
|
||||
load_theme_file(file, parent);
|
||||
load_theme_file(file, parent, themes);
|
||||
} else if (g_file_test(file, G_FILE_TEST_IS_DIR)) {
|
||||
load_icon_themes(file, name);
|
||||
gboolean duplicate = FALSE;
|
||||
if (g_file_test(file, G_FILE_TEST_IS_SYMLINK)) {
|
||||
#ifdef PATH_MAX
|
||||
char real_path[PATH_MAX];
|
||||
#else
|
||||
char real_path[65536];
|
||||
#endif
|
||||
if (realpath(file, real_path)) {
|
||||
if (strstr(real_path, path) == real_path)
|
||||
duplicate = TRUE;
|
||||
}
|
||||
}
|
||||
if (!duplicate)
|
||||
load_icon_themes(file, name, themes);
|
||||
}
|
||||
g_free(file);
|
||||
}
|
||||
@@ -2465,7 +2553,7 @@ GtkWidget *addScrollBarToWidget(GtkWidget *widget)
|
||||
return scrolled_window;
|
||||
}
|
||||
|
||||
void create_launcher(GtkWidget *parent)
|
||||
void create_launcher(GtkWidget *parent, GtkWindow *window)
|
||||
{
|
||||
GtkWidget *image;
|
||||
GtkTooltips *tooltips = gtk_tooltips_new();
|
||||
@@ -2753,7 +2841,7 @@ void create_launcher(GtkWidget *parent)
|
||||
GtkCellRenderer *renderer = gtk_cell_renderer_text_new();
|
||||
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(launcher_icon_theme), renderer, FALSE);
|
||||
gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(launcher_icon_theme), renderer, "text", iconsColDescr, NULL);
|
||||
g_signal_connect(G_OBJECT(launcher_icon_theme), "changed", G_CALLBACK(launcher_icon_theme_changed), NULL);
|
||||
g_signal_connect(G_OBJECT(launcher_icon_theme), "changed", G_CALLBACK(launcher_icon_theme_changed), window);
|
||||
gtk_widget_show(launcher_icon_theme);
|
||||
gtk_table_attach(GTK_TABLE(table), launcher_icon_theme, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||
col++;
|
||||
@@ -2796,38 +2884,51 @@ void create_launcher(GtkWidget *parent)
|
||||
|
||||
change_paragraph(parent);
|
||||
|
||||
fprintf(stderr, "Loading icon themes\n");
|
||||
GList *themes = NULL;
|
||||
const GSList *location;
|
||||
for (location = get_icon_locations(); location; location = g_slist_next(location)) {
|
||||
const gchar *path = (gchar*) location->data;
|
||||
load_icon_themes(path, NULL, &themes);
|
||||
}
|
||||
themes = g_list_sort(themes, compare_themes);
|
||||
|
||||
GtkTreeIter iter;
|
||||
gtk_list_store_append(icon_themes, &iter);
|
||||
gtk_list_store_set(icon_themes, &iter,
|
||||
0, "",
|
||||
-1);
|
||||
|
||||
fprintf(stderr, "Loading icon themes\n");
|
||||
const GSList *location;
|
||||
for (location = get_icon_locations(); location; location = g_slist_next(location)) {
|
||||
const gchar *path = (gchar*) location->data;
|
||||
load_icon_themes(path, NULL);
|
||||
for (GList *l = themes; l; l = l->next) {
|
||||
IconTheme *theme = (IconTheme*)l->data;
|
||||
GtkTreeIter iter;
|
||||
gtk_list_store_append(icon_themes, &iter);
|
||||
gtk_list_store_set(icon_themes, &iter,
|
||||
iconsColName, g_strdup(theme->name),
|
||||
iconsColDescr, g_strdup(theme->description),
|
||||
-1);
|
||||
}
|
||||
|
||||
for (GList *l = themes; l; l = l->next) {
|
||||
free_icon_theme((IconTheme*)l->data);
|
||||
}
|
||||
g_list_free(themes);
|
||||
fprintf(stderr, "Icon themes loaded\n");
|
||||
|
||||
fprintf(stderr, "Loading .desktop files\n");
|
||||
GList *entries = NULL;
|
||||
load_desktop_entries("/usr/share/applications", &entries);
|
||||
load_desktop_entries("/usr/local/share/applications", &entries);
|
||||
gchar *path = g_build_filename(g_get_home_dir(), ".local/share/applications", NULL);
|
||||
load_desktop_entries(path, &entries);
|
||||
for (location = get_apps_locations(); location; location = g_slist_next(location)) {
|
||||
const gchar *path = (gchar*) location->data;
|
||||
load_desktop_entries(path, &entries);
|
||||
}
|
||||
entries = g_list_sort(entries, compare_entries);
|
||||
populate_from_entries(entries, FALSE);
|
||||
|
||||
GList *l;
|
||||
for (l = entries; l; l = l->next) {
|
||||
for (GList *l = entries; l; l = l->next) {
|
||||
free_desktop_entry((DesktopEntry*)l->data);
|
||||
}
|
||||
g_list_free(entries);
|
||||
|
||||
g_free(path);
|
||||
|
||||
icon_theme_changed();
|
||||
icon_theme_changed(window);
|
||||
load_icons(launcher_apps);
|
||||
load_icons(all_apps);
|
||||
fprintf(stderr, "Desktop files loaded\n");
|
||||
@@ -3839,7 +3940,7 @@ void create_clock(GtkWidget *parent)
|
||||
col++;
|
||||
gtk_tooltips_set_tip(tooltips, clock_format_line1,
|
||||
_("Specifies the format used to display the first line of the clock text. "
|
||||
"See 'man strftime' for all the available options."), NULL);
|
||||
"See 'man date' for all the available options."), NULL);
|
||||
|
||||
row++, col = 2;
|
||||
label = gtk_label_new(_("Second line format"));
|
||||
@@ -3855,7 +3956,7 @@ void create_clock(GtkWidget *parent)
|
||||
col++;
|
||||
gtk_tooltips_set_tip(tooltips, clock_format_line2,
|
||||
_("Specifies the format used to display the second line of the clock text. "
|
||||
"See 'man strftime' for all the available options."), NULL);
|
||||
"See 'man date' for all the available options."), NULL);
|
||||
|
||||
row++, col = 2;
|
||||
label = gtk_label_new(_("First line timezone"));
|
||||
@@ -4126,7 +4227,7 @@ void create_clock(GtkWidget *parent)
|
||||
gtk_table_attach(GTK_TABLE(table), clock_format_tooltip, col, col+1, row, row+1, GTK_FILL, 0, 0, 0);
|
||||
col++;
|
||||
gtk_tooltips_set_tip(tooltips, clock_format_tooltip, _("Specifies the format used to display the clock tooltip. "
|
||||
"See 'man strftime' for the available options."), NULL);
|
||||
"See 'man date' for the available options."), NULL);
|
||||
|
||||
row++, col = 2;
|
||||
label = gtk_label_new(_("Timezone"));
|
||||
@@ -5281,3 +5382,44 @@ void create_tooltip(GtkWidget *parent)
|
||||
|
||||
change_paragraph(parent);
|
||||
}
|
||||
|
||||
static GtkWidget *please_wait_dialog = NULL;
|
||||
void create_please_wait(GtkWindow *parent)
|
||||
{
|
||||
if (please_wait_dialog)
|
||||
return;
|
||||
|
||||
please_wait_dialog = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title(GTK_WINDOW(please_wait_dialog), "Center");
|
||||
gtk_window_set_default_size(GTK_WINDOW(please_wait_dialog), 300, 150);
|
||||
gtk_window_set_position(GTK_WINDOW(please_wait_dialog), GTK_WIN_POS_CENTER);
|
||||
gtk_container_set_border_width(GTK_CONTAINER(please_wait_dialog), 15);
|
||||
gtk_window_set_title(GTK_WINDOW(please_wait_dialog), _("Please wait..."));
|
||||
gtk_window_set_deletable(GTK_WINDOW(please_wait_dialog), FALSE);
|
||||
|
||||
GtkWidget *label = gtk_label_new(_("Loading..."));
|
||||
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
|
||||
|
||||
GtkWidget *halign = gtk_alignment_new(0.5, 0.5, 0, 0);
|
||||
gtk_container_add(GTK_CONTAINER(halign), label);
|
||||
gtk_container_add(GTK_CONTAINER(please_wait_dialog), halign);
|
||||
|
||||
gtk_widget_show_all(please_wait_dialog);
|
||||
gtk_window_set_modal(GTK_WINDOW(please_wait_dialog), TRUE);
|
||||
// gtk_window_set_keep_above(GTK_WINDOW(please_wait_dialog), TRUE);
|
||||
gtk_window_set_transient_for(GTK_WINDOW(please_wait_dialog), parent);
|
||||
}
|
||||
|
||||
void process_events()
|
||||
{
|
||||
while (gtk_events_pending())
|
||||
gtk_main_iteration_do(FALSE);
|
||||
}
|
||||
|
||||
void destroy_please_wait()
|
||||
{
|
||||
if (!please_wait_dialog)
|
||||
return;
|
||||
gtk_widget_destroy(please_wait_dialog);
|
||||
please_wait_dialog = NULL;
|
||||
}
|
||||
|
||||
@@ -204,4 +204,8 @@ Executor *execp_get_last();
|
||||
void execp_remove(int i);
|
||||
void execp_update_indices();
|
||||
|
||||
void create_please_wait(GtkWindow *parent);
|
||||
void process_events();
|
||||
void destroy_please_wait();
|
||||
|
||||
#endif
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
char *get_current_theme_file_name();
|
||||
char *get_current_theme_path();
|
||||
gboolean config_is_manual(const char *path);
|
||||
void config_read_file (const char *path);
|
||||
void config_save_file(const char *path);
|
||||
|
||||
@@ -17,14 +17,14 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
#include "main.h"
|
||||
#include "strnatcmp.h"
|
||||
#include "theme_view.h"
|
||||
#include "common.h"
|
||||
|
||||
// The data columns that we export via the tree model interface
|
||||
GtkWidget *g_theme_view;
|
||||
GtkListStore *g_store;
|
||||
GtkListStore *theme_list_store;
|
||||
int g_width_list, g_height_list;
|
||||
GtkCellRenderer *g_renderer;
|
||||
|
||||
@@ -37,15 +37,14 @@ GtkWidget *create_view()
|
||||
{
|
||||
GtkTreeViewColumn *col;
|
||||
GtkCellRenderer *renderer;
|
||||
GtkWidget *view;
|
||||
|
||||
g_store = gtk_list_store_new(NB_COL, G_TYPE_STRING, G_TYPE_STRING, GDK_TYPE_PIXBUF);
|
||||
theme_list_store = gtk_list_store_new(NB_COL, G_TYPE_STRING, G_TYPE_STRING, GDK_TYPE_PIXBUF);
|
||||
|
||||
view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(g_store));
|
||||
GtkWidget *view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(theme_list_store));
|
||||
gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(view), TRUE);
|
||||
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(view), FALSE);
|
||||
|
||||
g_object_unref(g_store); // destroy store automatically with view
|
||||
g_object_unref(theme_list_store); // destroy store automatically with view
|
||||
|
||||
renderer = gtk_cell_renderer_text_new();
|
||||
col = gtk_tree_view_column_new();
|
||||
@@ -66,14 +65,13 @@ GtkWidget *create_view()
|
||||
g_object_set(g_renderer, "xalign", 0.0, NULL);
|
||||
gtk_cell_renderer_set_fixed_size(g_renderer, g_width_list, g_height_list);
|
||||
// specific to gtk-2.18 or higher
|
||||
//gtk_cell_renderer_set_padding(g_renderer, 5, 5);
|
||||
// gtk_cell_renderer_set_padding(g_renderer, 5, 5);
|
||||
col = gtk_tree_view_column_new();
|
||||
gtk_tree_view_column_pack_start(col, g_renderer, TRUE);
|
||||
gtk_tree_view_column_add_attribute(col, g_renderer, "pixbuf", COL_SNAPSHOT);
|
||||
gtk_tree_view_append_column(GTK_TREE_VIEW(view),col);
|
||||
|
||||
GtkTreeSortable *sortable;
|
||||
sortable = GTK_TREE_SORTABLE(g_store);
|
||||
GtkTreeSortable *sortable = GTK_TREE_SORTABLE(theme_list_store);
|
||||
gtk_tree_sortable_set_sort_column_id(sortable, COL_THEME_FILE, GTK_SORT_ASCENDING);
|
||||
gtk_tree_sortable_set_sort_func(sortable, COL_THEME_FILE, theme_name_compare, NULL, NULL);
|
||||
return view;
|
||||
@@ -87,6 +85,15 @@ gint theme_name_compare(GtkTreeModel *model,
|
||||
gchar *path_a, *path_b;
|
||||
gtk_tree_model_get(model, a, COL_THEME_FILE, &path_a, -1);
|
||||
gtk_tree_model_get(model, b, COL_THEME_FILE, &path_b, -1);
|
||||
|
||||
gboolean home_a = strstr(path_a, g_get_user_config_dir()) == path_a;
|
||||
gboolean home_b = strstr(path_b, g_get_user_config_dir()) == path_b;
|
||||
|
||||
if (home_a && !home_b)
|
||||
return -1;
|
||||
if (!home_a && home_b)
|
||||
return 1;
|
||||
|
||||
gchar *name_a = path_a;
|
||||
gchar *p;
|
||||
for (p = name_a; *p; p++) {
|
||||
@@ -110,15 +117,45 @@ gint theme_name_compare(GtkTreeModel *model,
|
||||
return result;
|
||||
}
|
||||
|
||||
void custom_list_append(const gchar *path)
|
||||
gboolean theme_list_contains(const char *given_path)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(g_theme_view));
|
||||
GtkTreeIter iter;
|
||||
|
||||
gtk_list_store_append(g_store, &iter);
|
||||
gtk_list_store_set(g_store, &iter, COL_THEME_FILE, path, -1);
|
||||
gboolean have_iter = gtk_tree_model_get_iter_first(model, &iter);
|
||||
while (have_iter) {
|
||||
gchar *filepath;
|
||||
gtk_tree_model_get(model, &iter, COL_THEME_FILE, &filepath, -1);
|
||||
if (g_str_equal(filepath, given_path)) {
|
||||
gtk_list_store_set(theme_list_store, &iter, COL_SNAPSHOT, NULL, -1);
|
||||
g_free(filepath);
|
||||
return TRUE;
|
||||
}
|
||||
g_free(filepath);
|
||||
have_iter = gtk_tree_model_iter_next(model, &iter);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gchar *name = g_strdup(strrchr(path, '/') + 1);
|
||||
gtk_list_store_set(g_store, &iter, COL_THEME_NAME, name, -1);
|
||||
void theme_list_append(const gchar *path)
|
||||
{
|
||||
if (theme_list_contains(path))
|
||||
return;
|
||||
|
||||
GtkTreeIter iter;
|
||||
gtk_list_store_append(theme_list_store, &iter);
|
||||
|
||||
gchar *name = strrchr(path, '/') + 1;
|
||||
|
||||
gchar *dir = g_strdup(path);
|
||||
strrchr(dir, '/')[0] = 0;
|
||||
char *suffix = contract_tilde(dir);
|
||||
g_free(dir);
|
||||
|
||||
gchar *display_name = g_strdup_printf("%s\n(%s)", name, suffix);
|
||||
gtk_list_store_set(theme_list_store, &iter, COL_THEME_FILE, path, COL_THEME_NAME, display_name, -1);
|
||||
g_free(display_name);
|
||||
g_free(suffix);
|
||||
}
|
||||
|
||||
|
||||
@@ -126,7 +163,6 @@ gboolean update_snapshot()
|
||||
{
|
||||
GtkTreeModel *model;
|
||||
GtkTreeIter iter;
|
||||
GdkPixbuf *icon;
|
||||
gboolean have_iter;
|
||||
|
||||
gint pixWidth = 200, pixHeight = 30;
|
||||
@@ -134,20 +170,29 @@ gboolean update_snapshot()
|
||||
model = gtk_tree_view_get_model(GTK_TREE_VIEW(g_theme_view));
|
||||
have_iter = gtk_tree_model_get_iter_first(model, &iter);
|
||||
while (have_iter) {
|
||||
gtk_tree_model_get(model, &iter, COL_SNAPSHOT, &icon, -1);
|
||||
if (icon != NULL) {
|
||||
g_object_unref(icon);
|
||||
GdkPixbuf *pixbuf;
|
||||
gtk_tree_model_get(model, &iter, COL_SNAPSHOT, &pixbuf, -1);
|
||||
if (pixbuf) {
|
||||
pixWidth = MAX(pixWidth, gdk_pixbuf_get_width(pixbuf));
|
||||
pixHeight = MAX(pixHeight, gdk_pixbuf_get_height(pixbuf));
|
||||
g_object_unref(pixbuf);
|
||||
have_iter = gtk_tree_model_iter_next(model, &iter);
|
||||
continue;
|
||||
}
|
||||
|
||||
// build panel's snapshot
|
||||
GdkPixbuf *pixbuf = NULL;
|
||||
gchar *name, *snap, *cmd;
|
||||
gchar *path;
|
||||
gtk_tree_model_get(model, &iter,
|
||||
COL_THEME_FILE, &path,
|
||||
-1);
|
||||
|
||||
snap = g_build_filename(g_get_user_config_dir(), "tint2", "snap.jpg", NULL);
|
||||
char fname[128];
|
||||
sprintf(fname, "tint2-%d.jpg", (int)getpid());
|
||||
|
||||
gchar *snap = g_build_filename(g_get_tmp_dir(), fname, NULL);
|
||||
g_remove(snap);
|
||||
|
||||
gtk_tree_model_get(model, &iter, COL_THEME_FILE, &name, -1);
|
||||
cmd = g_strdup_printf("tint2 -c \'%s\' -s \'%s\'", name, snap);
|
||||
gchar *cmd = g_strdup_printf("tint2 -c \'%s\' -s \'%s\' 1>/dev/null 2>/dev/null", path, snap);
|
||||
if (system(cmd) == 0) {
|
||||
// load
|
||||
pixbuf = gdk_pixbuf_new_from_file(snap, NULL);
|
||||
@@ -155,18 +200,18 @@ gboolean update_snapshot()
|
||||
printf("snapshot NULL : %s\n", cmd);
|
||||
}
|
||||
}
|
||||
g_free(snap);
|
||||
g_free(cmd);
|
||||
g_free(name);
|
||||
|
||||
gint w, h;
|
||||
w = gdk_pixbuf_get_width(pixbuf);
|
||||
h = gdk_pixbuf_get_height(pixbuf);
|
||||
pixWidth = w > pixWidth ? w : pixWidth;
|
||||
pixHeight = h > pixHeight ? h : pixHeight;
|
||||
g_remove(snap);
|
||||
g_free(snap);
|
||||
g_free(path);
|
||||
|
||||
gtk_list_store_set(g_store, &iter, COL_SNAPSHOT, pixbuf, -1);
|
||||
pixWidth = MAX(pixWidth, gdk_pixbuf_get_width(pixbuf));
|
||||
pixHeight = MAX(pixHeight, gdk_pixbuf_get_height(pixbuf));
|
||||
|
||||
gtk_list_store_set(theme_list_store, &iter, COL_SNAPSHOT, pixbuf, -1);
|
||||
if (pixbuf)
|
||||
g_object_unref(pixbuf);
|
||||
have_iter = gtk_tree_model_iter_next(model, &iter);
|
||||
}
|
||||
|
||||
@@ -174,6 +219,3 @@ gboolean update_snapshot()
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,18 +1,14 @@
|
||||
|
||||
#ifndef THEME_VIEW
|
||||
#define THEME_VIEW
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
extern GtkWidget *g_theme_view;
|
||||
extern GtkListStore *g_store;
|
||||
extern GtkListStore *theme_list_store;
|
||||
enum { COL_THEME_FILE = 0, COL_THEME_NAME, COL_SNAPSHOT, NB_COL, };
|
||||
|
||||
GtkWidget *create_view();
|
||||
|
||||
void custom_list_append(const gchar *path);
|
||||
void theme_list_append(const gchar *path);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=Tint2 panel settings
|
||||
|
||||
Name=Tint2 Settings
|
||||
Name[am]=ፓነል አስተዳዳሪ
|
||||
Name[ar]=مدير الائحة :
|
||||
Name[ast]=Alministrador de panel
|
||||
@@ -17,7 +18,7 @@ Name[es]=Administrador de panel
|
||||
Name[et]=Paneelihaldur
|
||||
Name[eu]=Panel Kudeatzailea:
|
||||
Name[fi]=Paneelin hallinta
|
||||
Name[fr]=Gestionnaire de panneau
|
||||
Name[fr]=Gestionnaire du panneau tint2
|
||||
Name[gl]=Xestor de paneis
|
||||
Name[he]=מנהל הלוח
|
||||
Name[hu]=Panelkezelő
|
||||
@@ -37,7 +38,7 @@ Name[pl]=Ustawienia panelu
|
||||
Name[pt]=Gestor do Painel
|
||||
Name[pt_BR]=Gerenciador do painel
|
||||
Name[ro]=Manager de panouri
|
||||
Name[ru]=Диспетчер панелей
|
||||
Name[ru]=Настройки tint2
|
||||
Name[si]=පුවරු කළමණාකරු
|
||||
Name[sk]=Nastavenie panelu
|
||||
Name[sq]=Përgjegjës Panelesh
|
||||
@@ -45,14 +46,69 @@ Name[sv]=Panelhanterare
|
||||
Name[ta]=பலகை மேளாலர்:
|
||||
Name[tr]=Panel Yöneticisi
|
||||
Name[ug]=Panel باشقۇرغۇ
|
||||
Name[uk]=Менеджер панелей
|
||||
Name[uk]=Настройки tint2
|
||||
Name[ur]=پینل منیجر
|
||||
Name[ur_PK]=پینل منیجر
|
||||
Name[vi]=Quản lý panel
|
||||
Name[zh_CN]=面板管理器
|
||||
Name[zh_TW]=面板管理程式
|
||||
|
||||
GenericName=Panel configurator
|
||||
GenericName[am]=ፓነል አስተዳዳሪ
|
||||
GenericName[ar]=مدير الائحة :
|
||||
GenericName[ast]=Alministrador de panel
|
||||
GenericName[be]=Кіраўнік Панэляў
|
||||
GenericName[ca]=Gestor de quadres
|
||||
GenericName[cs]=Správce panelu
|
||||
GenericName[da]=Panelhåndtering
|
||||
GenericName[de]=Leistenverwaltung
|
||||
GenericName[dz]=པེ་ནཱལ་འཛིན་སྐྱོང་པ།
|
||||
GenericName[el]=Διαχειριστής ταμπλό
|
||||
GenericName[en_GB]=Panel Manager
|
||||
GenericName[eo]=Administrilo de Panelo
|
||||
GenericName[es]=Administrador de panel
|
||||
GenericName[et]=Paneelihaldur
|
||||
GenericName[eu]=Panel Kudeatzailea:
|
||||
GenericName[fi]=Paneelin hallinta
|
||||
GenericName[fr]=Gestionnaire de panneau
|
||||
GenericName[gl]=Xestor de paneis
|
||||
GenericName[he]=מנהל הלוח
|
||||
GenericName[hu]=Panelkezelő
|
||||
GenericName[id]=Manajer Panel
|
||||
GenericName[it]=Gestore dei pannelli
|
||||
GenericName[ja]=パネルマネージャ
|
||||
GenericName[kk]=Панель менеджері
|
||||
GenericName[ko]=패널 관리자
|
||||
GenericName[ku]=Gerinendeyê panelan
|
||||
GenericName[lv]=Paneļu pārvaldnieks
|
||||
GenericName[mk]=Менаџер за панели
|
||||
GenericName[nb]=Panelbehandler
|
||||
GenericName[nl]=Paneel Manager
|
||||
GenericName[nn]=Panelhandsamar
|
||||
GenericName[pa]=ਪੈਨਲ ਮੈਨੇਜਰ
|
||||
GenericName[pl]=Ustawienia panelu
|
||||
GenericName[pt]=Gestor do Painel
|
||||
GenericName[pt_BR]=Gerenciador do painel
|
||||
GenericName[ro]=Manager de panouri
|
||||
GenericName[ru]=Настройки панелей
|
||||
GenericName[si]=පුවරු කළමණාකරු
|
||||
GenericName[sk]=Nastavenie panelu
|
||||
GenericName[sq]=Përgjegjës Panelesh
|
||||
GenericName[sv]=Panelhanterare
|
||||
GenericName[ta]=பலகை மேளாலர்:
|
||||
GenericName[tr]=Panel Yöneticisi
|
||||
GenericName[ug]=Panel باشقۇرغۇ
|
||||
GenericName[uk]=Настройки панелi
|
||||
GenericName[ur]=پینل منیجر
|
||||
GenericName[ur_PK]=پینل منیجر
|
||||
GenericName[vi]=Quản lý panel
|
||||
GenericName[zh_CN]=面板管理器
|
||||
GenericName[zh_TW]=面板管理程式
|
||||
|
||||
Comment=Tool to configure the tint2 panel
|
||||
Comment[ru]=Инструмент конфигурирования панели tint2
|
||||
|
||||
Exec=tint2conf
|
||||
Icon=tint2conf
|
||||
Terminal=false
|
||||
Categories=Settings;DesktopSettings;
|
||||
|
||||
|
||||
@@ -110,7 +110,6 @@ void tooltip_default_font_changed()
|
||||
tooltip_update();
|
||||
}
|
||||
|
||||
|
||||
void tooltip_trigger_show(Area *area, Panel *p, XEvent *e)
|
||||
{
|
||||
// Position the tooltip in the center of the area
|
||||
@@ -132,7 +131,7 @@ void tooltip_show(void *arg)
|
||||
int mx, my;
|
||||
Window w;
|
||||
XTranslateCoordinates(server.display, server.root_win, g_tooltip.panel->main_win, x, y, &mx, &my, &w);
|
||||
Area *area = click_area(g_tooltip.panel, mx, my);
|
||||
Area *area = find_area_under_mouse(g_tooltip.panel, mx, my);
|
||||
if (!g_tooltip.mapped && area->_get_tooltip_text) {
|
||||
tooltip_copy_text(area);
|
||||
g_tooltip.mapped = True;
|
||||
|
||||
143
src/util/area.c
143
src/util/area.c
@@ -134,7 +134,8 @@ void relayout_dynamic(Area *a, int level)
|
||||
pos += panel_horizontal ? child->width + a->paddingx : child->height + a->paddingx;
|
||||
}
|
||||
} 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 (GList *l = g_list_last(a->children); l; l = l->prev) {
|
||||
Area *child = ((Area *)l->data);
|
||||
@@ -228,7 +229,16 @@ void draw_tree(Area *a)
|
||||
}
|
||||
|
||||
if (a->pix)
|
||||
XCopyArea(server.display, a->pix, ((Panel *)a->panel)->temp_pmap, server.gc, 0, 0, a->width, a->height, a->posx, a->posy);
|
||||
XCopyArea(server.display,
|
||||
a->pix,
|
||||
((Panel *)a->panel)->temp_pmap,
|
||||
server.gc,
|
||||
0,
|
||||
0,
|
||||
a->width,
|
||||
a->height,
|
||||
a->posx,
|
||||
a->posy);
|
||||
|
||||
for (GList *l = a->children; l; l = l->next)
|
||||
draw_tree((Area *)l->data);
|
||||
@@ -382,7 +392,16 @@ void draw(Area *a)
|
||||
// Add layer of root pixmap (or clear pixmap if real_transparency==true)
|
||||
if (server.real_transparency)
|
||||
clear_pixmap(a->pix, 0, 0, a->width, a->height);
|
||||
XCopyArea(server.display, ((Panel *)a->panel)->temp_pmap, a->pix, server.gc, a->posx, a->posy, a->width, a->height, 0, 0);
|
||||
XCopyArea(server.display,
|
||||
((Panel *)a->panel)->temp_pmap,
|
||||
a->pix,
|
||||
server.gc,
|
||||
a->posx,
|
||||
a->posy,
|
||||
a->width,
|
||||
a->height,
|
||||
0,
|
||||
0);
|
||||
} else {
|
||||
a->_clear(a);
|
||||
}
|
||||
@@ -531,11 +550,8 @@ void mouse_over(Area *area, int pressed)
|
||||
if (!pressed) {
|
||||
new_state = area->has_mouse_over_effect ? MOUSE_OVER : MOUSE_NORMAL;
|
||||
} else {
|
||||
new_state = area->has_mouse_press_effect
|
||||
? MOUSE_DOWN
|
||||
: area->has_mouse_over_effect
|
||||
? MOUSE_OVER
|
||||
: MOUSE_NORMAL;
|
||||
new_state =
|
||||
area->has_mouse_press_effect ? MOUSE_DOWN : area->has_mouse_over_effect ? MOUSE_OVER : MOUSE_NORMAL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -547,7 +563,8 @@ void mouse_over(Area *area, int pressed)
|
||||
mouse_over_area = area;
|
||||
|
||||
mouse_over_area->mouse_state = new_state;
|
||||
mouse_over_area->pix = mouse_over_area->pix_by_state[mouse_over_area->has_mouse_over_effect ? mouse_over_area->mouse_state : 0];
|
||||
mouse_over_area->pix =
|
||||
mouse_over_area->pix_by_state[mouse_over_area->has_mouse_over_effect ? mouse_over_area->mouse_state : 0];
|
||||
if (!mouse_over_area->pix)
|
||||
mouse_over_area->_redraw_needed = TRUE;
|
||||
panel_refresh = TRUE;
|
||||
@@ -558,9 +575,115 @@ void mouse_out()
|
||||
if (!mouse_over_area)
|
||||
return;
|
||||
mouse_over_area->mouse_state = MOUSE_NORMAL;
|
||||
mouse_over_area->pix = mouse_over_area->pix_by_state[mouse_over_area->has_mouse_over_effect ? mouse_over_area->mouse_state : 0];
|
||||
mouse_over_area->pix =
|
||||
mouse_over_area->pix_by_state[mouse_over_area->has_mouse_over_effect ? mouse_over_area->mouse_state : 0];
|
||||
if (!mouse_over_area->pix)
|
||||
mouse_over_area->_redraw_needed = TRUE;
|
||||
panel_refresh = TRUE;
|
||||
mouse_over_area = NULL;
|
||||
}
|
||||
|
||||
gboolean area_is_first(void *obj)
|
||||
{
|
||||
Area *a = obj;
|
||||
if (!a->on_screen)
|
||||
return FALSE;
|
||||
|
||||
Panel *panel = a->panel;
|
||||
|
||||
Area *node = &panel->area;
|
||||
|
||||
while (node) {
|
||||
if (!node->on_screen)
|
||||
return FALSE;
|
||||
if (node == a)
|
||||
return TRUE;
|
||||
|
||||
GList *l = node->children;
|
||||
node = NULL;
|
||||
for (; l; l = l->next) {
|
||||
Area *child = l->data;
|
||||
if (!child->on_screen)
|
||||
continue;
|
||||
node = child;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean area_is_last(void *obj)
|
||||
{
|
||||
Area *a = obj;
|
||||
if (!a->on_screen)
|
||||
return FALSE;
|
||||
|
||||
Panel *panel = a->panel;
|
||||
|
||||
Area *node = &panel->area;
|
||||
|
||||
while (node) {
|
||||
if (!node->on_screen)
|
||||
return FALSE;
|
||||
if (node == a)
|
||||
return TRUE;
|
||||
|
||||
GList *l = node->children;
|
||||
node = NULL;
|
||||
for (; l; l = l->next) {
|
||||
Area *child = l->data;
|
||||
if (!child->on_screen)
|
||||
continue;
|
||||
node = child;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean area_is_under_mouse(void *obj, int x, int y)
|
||||
{
|
||||
Area *a = obj;
|
||||
if (!a->on_screen)
|
||||
return FALSE;
|
||||
|
||||
if (a->_is_under_mouse)
|
||||
return a->_is_under_mouse(a, x, y);
|
||||
|
||||
return x >= a->posx && x <= (a->posx + a->width) && y >= a->posy && y <= (a->posy + a->height);
|
||||
}
|
||||
|
||||
gboolean full_width_area_is_under_mouse(void *obj, int x, int y)
|
||||
{
|
||||
Area *a = obj;
|
||||
if (!a->on_screen)
|
||||
return FALSE;
|
||||
|
||||
if (a->_is_under_mouse && a->_is_under_mouse != full_width_area_is_under_mouse)
|
||||
return a->_is_under_mouse(a, x, y);
|
||||
|
||||
if (panel_horizontal)
|
||||
return (x >= a->posx || area_is_first(a)) && (x <= a->posx + a->width || area_is_last(a));
|
||||
else
|
||||
return (y >= a->posy || area_is_first(a)) && (y <= a->posy + a->height || area_is_last(a));
|
||||
}
|
||||
|
||||
Area *find_area_under_mouse(void *root, int x, int y)
|
||||
{
|
||||
Area *result = root;
|
||||
Area *new_result = result;
|
||||
do {
|
||||
result = new_result;
|
||||
GList *it = result->children;
|
||||
while (it) {
|
||||
Area *a = (Area *)it->data;
|
||||
if (area_is_under_mouse(a, x, y)) {
|
||||
new_result = a;
|
||||
break;
|
||||
}
|
||||
it = it->next;
|
||||
}
|
||||
} while (new_result != result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -156,12 +156,7 @@ typedef enum Alignment {
|
||||
ALIGN_RIGHT = 2,
|
||||
} Alignment;
|
||||
|
||||
typedef enum MouseState {
|
||||
MOUSE_NORMAL = 0,
|
||||
MOUSE_OVER = 1,
|
||||
MOUSE_DOWN = 2,
|
||||
MOUSE_STATE_COUNT
|
||||
} MouseState;
|
||||
typedef enum MouseState { MOUSE_NORMAL = 0, MOUSE_OVER = 1, MOUSE_DOWN = 2, MOUSE_STATE_COUNT } MouseState;
|
||||
|
||||
struct Panel;
|
||||
|
||||
@@ -219,6 +214,10 @@ typedef struct Area {
|
||||
// Returns a copy of the tooltip to be displayed for this widget.
|
||||
// The caller takes ownership of the pointer.
|
||||
char *(*_get_tooltip_text)(void *obj);
|
||||
|
||||
// Returns true if the Area handles a mouse event at the given x, y coordinates relative to the window.
|
||||
// Leave this to NULL to use a default implementation.
|
||||
gboolean (*_is_under_mouse)(void *obj, int x, int y);
|
||||
} Area;
|
||||
|
||||
// Initializes the Background member to default values.
|
||||
@@ -266,7 +265,20 @@ void add_area(Area *a, Area *parent);
|
||||
void remove_area(Area *a);
|
||||
void free_area(Area *a);
|
||||
|
||||
// Mouse move events
|
||||
// Mouse events
|
||||
|
||||
// Returns the area under the mouse for the given x, y mouse coordinates relative to the window.
|
||||
// If no area is found, returns the root.
|
||||
Area *find_area_under_mouse(void *root, int x, int y);
|
||||
|
||||
// Returns true if the Area handles a mouse event at the given x, y coordinates relative to the window.
|
||||
gboolean area_is_under_mouse(void *obj, int x, int y);
|
||||
|
||||
// Returns true if the Area handles a mouse event at the given x, y coordinates relative to the window.
|
||||
// The Area will also handle clicks on the border of its ancestors, including the panel.
|
||||
// Useful so that a click at the edge of the screen is still handled by task buttons etc., even if technically
|
||||
// they are outside the drawing area of the button.
|
||||
gboolean full_width_area_is_under_mouse(void *obj, int x, int y);
|
||||
|
||||
void mouse_over(Area *area, int pressed);
|
||||
void mouse_out();
|
||||
|
||||
158
src/util/cache.c
Normal file
158
src/util/cache.c
Normal file
@@ -0,0 +1,158 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Tint2 : cache
|
||||
*
|
||||
* Copyright (C) 2016 @o9000
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License version 2
|
||||
* 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 "cache.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "common.h"
|
||||
|
||||
void init_cache(Cache *cache)
|
||||
{
|
||||
if (cache->_table)
|
||||
free_cache(cache);
|
||||
cache->_table = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
|
||||
cache->dirty = FALSE;
|
||||
cache->loaded = FALSE;
|
||||
}
|
||||
|
||||
void free_cache(Cache *cache)
|
||||
{
|
||||
if (cache->_table)
|
||||
g_hash_table_destroy(cache->_table);
|
||||
cache->_table = NULL;
|
||||
cache->dirty = FALSE;
|
||||
cache->loaded = FALSE;
|
||||
}
|
||||
|
||||
void load_cache(Cache *cache, const gchar *cache_path)
|
||||
{
|
||||
init_cache(cache);
|
||||
|
||||
cache->loaded = TRUE;
|
||||
|
||||
int fd = open(cache_path, O_RDONLY);
|
||||
if (fd == -1)
|
||||
return;
|
||||
flock(fd, LOCK_SH);
|
||||
|
||||
FILE *f = fopen(cache_path, "rt");
|
||||
if (!f)
|
||||
goto unlock;
|
||||
|
||||
char *line = NULL;
|
||||
size_t line_size;
|
||||
|
||||
while (getline(&line, &line_size, f) >= 0) {
|
||||
char *key, *value;
|
||||
|
||||
size_t line_len = strlen(line);
|
||||
gboolean has_newline = FALSE;
|
||||
if (line_len >= 1) {
|
||||
if (line[line_len - 1] == '\n') {
|
||||
line[line_len - 1] = '\0';
|
||||
line_len--;
|
||||
has_newline = TRUE;
|
||||
}
|
||||
}
|
||||
if (!has_newline)
|
||||
break;
|
||||
|
||||
if (line_len == 0)
|
||||
continue;
|
||||
|
||||
if (parse_line(line, &key, &value)) {
|
||||
g_hash_table_insert(cache->_table, g_strdup(key), g_strdup(value));
|
||||
}
|
||||
}
|
||||
free(line);
|
||||
fclose(f);
|
||||
|
||||
unlock:
|
||||
flock(fd, LOCK_UN);
|
||||
close(fd);
|
||||
}
|
||||
|
||||
void write_cache_line(gpointer key, gpointer value, gpointer user_data)
|
||||
{
|
||||
gchar *k = key;
|
||||
gchar *v = value;
|
||||
FILE *f = user_data;
|
||||
|
||||
fprintf(f, "%s=%s\n", k, v);
|
||||
}
|
||||
|
||||
void save_cache(Cache *cache, const gchar *cache_path)
|
||||
{
|
||||
int fd = open(cache_path, O_RDONLY | O_CREAT, 0600);
|
||||
if (fd == -1) {
|
||||
gchar *dir_path = g_path_get_dirname(cache_path);
|
||||
g_mkdir_with_parents(dir_path, 0700);
|
||||
g_free(dir_path);
|
||||
fd = open(cache_path, O_RDONLY | O_CREAT, 0600);
|
||||
}
|
||||
if (fd == -1) {
|
||||
fprintf(stderr, RED "Could not save icon theme cache!" RESET "\n");
|
||||
return;
|
||||
}
|
||||
flock(fd, LOCK_EX);
|
||||
|
||||
FILE *f = fopen(cache_path, "w");
|
||||
if (!f) {
|
||||
fprintf(stderr, RED "Could not save icon theme cache!" RESET "\n");
|
||||
goto unlock;
|
||||
}
|
||||
g_hash_table_foreach(cache->_table, write_cache_line, f);
|
||||
fclose(f);
|
||||
cache->dirty = FALSE;
|
||||
|
||||
unlock:
|
||||
flock(fd, LOCK_UN);
|
||||
close(fd);
|
||||
}
|
||||
|
||||
const gchar *get_from_cache(Cache *cache, const gchar *key)
|
||||
{
|
||||
if (!cache->_table)
|
||||
return NULL;
|
||||
return g_hash_table_lookup(cache->_table, key);
|
||||
}
|
||||
|
||||
void add_to_cache(Cache *cache, const gchar *key, const gchar *value)
|
||||
{
|
||||
if (!cache->_table)
|
||||
init_cache(cache);
|
||||
|
||||
if (!key || !value)
|
||||
return;
|
||||
|
||||
gchar *old_value = g_hash_table_lookup(cache->_table, key);
|
||||
if (old_value && g_str_equal(old_value, value))
|
||||
return;
|
||||
|
||||
g_hash_table_insert(cache->_table, g_strdup(key), g_strdup(value));
|
||||
cache->dirty = TRUE;
|
||||
}
|
||||
39
src/util/cache.h
Normal file
39
src/util/cache.h
Normal file
@@ -0,0 +1,39 @@
|
||||
#ifndef CACHE_H
|
||||
#define CACHE_H
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
// A cache with string keys and values, backed by a file.
|
||||
// The strings must not be NULL and are stripped of any whitespace at start and end.
|
||||
typedef struct Cache {
|
||||
gboolean dirty;
|
||||
gboolean loaded;
|
||||
GHashTable *_table;
|
||||
} Cache;
|
||||
|
||||
// Initializes the cache. You can also call load_cache directly if you set the memory contents to zero first.
|
||||
void init_cache(Cache *cache);
|
||||
|
||||
// Clears the cache contents and releases all memory, but not the object.
|
||||
// You can use init_cache or load_cache afterwards.
|
||||
void free_cache(Cache *cache);
|
||||
|
||||
// Clears the cache contents and loads new contents from a file.
|
||||
// Sets the loaded flag to TRUE.
|
||||
void load_cache(Cache *cache, const gchar *cache_path);
|
||||
|
||||
// Saves the cache contents to a file.
|
||||
// Clears the dirty flag.
|
||||
void save_cache(Cache *cache, const gchar *cache_path);
|
||||
|
||||
// Returns a pointer to the value in the cache, or NULL if not found.
|
||||
// Do not free the returned value!
|
||||
const gchar *get_from_cache(Cache *cache, const gchar *key);
|
||||
|
||||
// Adds a key-value pair to the cache. NULL keys or values are not allowed.
|
||||
// If the key already exists, the old value is and replaced with the new value.
|
||||
// Does not take ownership of the pointers (neither key, nor value); instead it makes copies.
|
||||
// Sets the dirty flag to TRUE.
|
||||
void add_to_cache(Cache *cache, const gchar *key, const gchar *value);
|
||||
|
||||
#endif
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/Xatom.h>
|
||||
#include <X11/extensions/Xrender.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -36,9 +37,7 @@
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
#include <errno.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <dirent.h>
|
||||
|
||||
#ifdef HAVE_RSVG
|
||||
@@ -114,7 +113,7 @@ void tint_exec(const char *command)
|
||||
}
|
||||
}
|
||||
|
||||
char *expand_tilde(char *s)
|
||||
char *expand_tilde(const char *s)
|
||||
{
|
||||
const gchar *home = g_get_home_dir();
|
||||
if (home && (strcmp(s, "~") == 0 || strstr(s, "~/") == s)) {
|
||||
@@ -127,7 +126,7 @@ char *expand_tilde(char *s)
|
||||
}
|
||||
}
|
||||
|
||||
char *contract_tilde(char *s)
|
||||
char *contract_tilde(const char *s)
|
||||
{
|
||||
const gchar *home = g_get_home_dir();
|
||||
if (!home)
|
||||
@@ -239,119 +238,110 @@ void extract_values(const char *value, char **value1, char **value2, char **valu
|
||||
}
|
||||
}
|
||||
|
||||
void adjust_asb(DATA32 *data, int w, int h, int alpha, float satur, float bright)
|
||||
void adjust_asb(DATA32 *data, int w, int h, float alpha_adjust, float satur_adjust, float bright_adjust)
|
||||
{
|
||||
unsigned int x, y;
|
||||
unsigned int a, r, g, b, argb;
|
||||
unsigned long id;
|
||||
int cmax, cmin;
|
||||
float h2, f, p, q, t;
|
||||
float hue, saturation, brightness;
|
||||
float redc, greenc, bluec;
|
||||
for (int id = 0; id < w * h; id++) {
|
||||
unsigned int argb = data[id];
|
||||
int a = (argb >> 24) & 0xff;
|
||||
// transparent => nothing to do.
|
||||
if (a == 0)
|
||||
continue;
|
||||
int r = (argb >> 16) & 0xff;
|
||||
int g = (argb >> 8) & 0xff;
|
||||
int b = (argb)&0xff;
|
||||
|
||||
for (y = 0; y < h; y++) {
|
||||
for (id = y * w, x = 0; x < w; x++, id++) {
|
||||
argb = data[id];
|
||||
a = (argb >> 24) & 0xff;
|
||||
// transparent => nothing to do.
|
||||
if (a == 0)
|
||||
continue;
|
||||
r = (argb >> 16) & 0xff;
|
||||
g = (argb >> 8) & 0xff;
|
||||
b = (argb)&0xff;
|
||||
|
||||
// convert RGB to HSB
|
||||
cmax = (r > g) ? r : g;
|
||||
if (b > cmax)
|
||||
cmax = b;
|
||||
cmin = (r < g) ? r : g;
|
||||
if (b < cmin)
|
||||
cmin = b;
|
||||
brightness = ((float)cmax) / 255.0f;
|
||||
if (cmax != 0)
|
||||
saturation = ((float)(cmax - cmin)) / ((float)cmax);
|
||||
// Convert RGB to HSV
|
||||
int cmax = MAX3(r, g, b);
|
||||
int cmin = MIN3(r, g, b);
|
||||
int delta = cmax - cmin;
|
||||
float brightness = cmax / 255.0f;
|
||||
float saturation;
|
||||
if (cmax != 0)
|
||||
saturation = delta / (float)cmax;
|
||||
else
|
||||
saturation = 0;
|
||||
float hue;
|
||||
if (saturation == 0) {
|
||||
hue = 0;
|
||||
} else {
|
||||
float redc = (cmax - r) / (float)delta;
|
||||
float greenc = (cmax - g) / (float)delta;
|
||||
float bluec = (cmax - b) / (float)delta;
|
||||
if (r == cmax)
|
||||
hue = bluec - greenc;
|
||||
else if (g == cmax)
|
||||
hue = 2.0f + redc - bluec;
|
||||
else
|
||||
saturation = 0;
|
||||
if (saturation == 0)
|
||||
hue = 0;
|
||||
else {
|
||||
redc = ((float)(cmax - r)) / ((float)(cmax - cmin));
|
||||
greenc = ((float)(cmax - g)) / ((float)(cmax - cmin));
|
||||
bluec = ((float)(cmax - b)) / ((float)(cmax - cmin));
|
||||
if (r == cmax)
|
||||
hue = bluec - greenc;
|
||||
else if (g == cmax)
|
||||
hue = 2.0f + redc - bluec;
|
||||
else
|
||||
hue = 4.0f + greenc - redc;
|
||||
hue = hue / 6.0f;
|
||||
if (hue < 0)
|
||||
hue = hue + 1.0f;
|
||||
}
|
||||
|
||||
// adjust
|
||||
saturation += satur;
|
||||
if (saturation < 0.0)
|
||||
saturation = 0.0;
|
||||
if (saturation > 1.0)
|
||||
saturation = 1.0;
|
||||
brightness += bright;
|
||||
if (brightness < 0.0)
|
||||
brightness = 0.0;
|
||||
if (brightness > 1.0)
|
||||
brightness = 1.0;
|
||||
if (alpha != 100)
|
||||
a = (a * alpha) / 100;
|
||||
|
||||
// convert HSB to RGB
|
||||
if (saturation == 0) {
|
||||
r = g = b = (int)(brightness * 255.0f + 0.5f);
|
||||
} else {
|
||||
h2 = (hue - (int)hue) * 6.0f;
|
||||
f = h2 - (int)(h2);
|
||||
p = brightness * (1.0f - saturation);
|
||||
q = brightness * (1.0f - saturation * f);
|
||||
t = brightness * (1.0f - (saturation * (1.0f - f)));
|
||||
switch ((int)h2) {
|
||||
case 0:
|
||||
r = (int)(brightness * 255.0f + 0.5f);
|
||||
g = (int)(t * 255.0f + 0.5f);
|
||||
b = (int)(p * 255.0f + 0.5f);
|
||||
break;
|
||||
case 1:
|
||||
r = (int)(q * 255.0f + 0.5f);
|
||||
g = (int)(brightness * 255.0f + 0.5f);
|
||||
b = (int)(p * 255.0f + 0.5f);
|
||||
break;
|
||||
case 2:
|
||||
r = (int)(p * 255.0f + 0.5f);
|
||||
g = (int)(brightness * 255.0f + 0.5f);
|
||||
b = (int)(t * 255.0f + 0.5f);
|
||||
break;
|
||||
case 3:
|
||||
r = (int)(p * 255.0f + 0.5f);
|
||||
g = (int)(q * 255.0f + 0.5f);
|
||||
b = (int)(brightness * 255.0f + 0.5f);
|
||||
break;
|
||||
case 4:
|
||||
r = (int)(t * 255.0f + 0.5f);
|
||||
g = (int)(p * 255.0f + 0.5f);
|
||||
b = (int)(brightness * 255.0f + 0.5f);
|
||||
break;
|
||||
case 5:
|
||||
r = (int)(brightness * 255.0f + 0.5f);
|
||||
g = (int)(p * 255.0f + 0.5f);
|
||||
b = (int)(q * 255.0f + 0.5f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
argb = a;
|
||||
argb = (argb << 8) + r;
|
||||
argb = (argb << 8) + g;
|
||||
argb = (argb << 8) + b;
|
||||
data[id] = argb;
|
||||
hue = 4.0f + greenc - redc;
|
||||
hue = hue / 6.0f;
|
||||
if (hue < 0)
|
||||
hue = hue + 1.0f;
|
||||
}
|
||||
|
||||
// Adjust H, S
|
||||
saturation += satur_adjust;
|
||||
saturation = CLAMP(saturation, 0.0, 1.0);
|
||||
|
||||
a *= alpha_adjust;
|
||||
a = CLAMP(a, 0, 255);
|
||||
|
||||
// Convert HSV to RGB
|
||||
if (saturation == 0) {
|
||||
r = g = b = (int)(brightness * 255.0f + 0.5f);
|
||||
} else {
|
||||
float h2 = (hue - (int)hue) * 6.0f;
|
||||
float f = h2 - (int)(h2);
|
||||
float p = brightness * (1.0f - saturation);
|
||||
float q = brightness * (1.0f - saturation * f);
|
||||
float t = brightness * (1.0f - (saturation * (1.0f - f)));
|
||||
|
||||
switch ((int)h2) {
|
||||
case 0:
|
||||
r = (int)(brightness * 255.0f + 0.5f);
|
||||
g = (int)(t * 255.0f + 0.5f);
|
||||
b = (int)(p * 255.0f + 0.5f);
|
||||
break;
|
||||
case 1:
|
||||
r = (int)(q * 255.0f + 0.5f);
|
||||
g = (int)(brightness * 255.0f + 0.5f);
|
||||
b = (int)(p * 255.0f + 0.5f);
|
||||
break;
|
||||
case 2:
|
||||
r = (int)(p * 255.0f + 0.5f);
|
||||
g = (int)(brightness * 255.0f + 0.5f);
|
||||
b = (int)(t * 255.0f + 0.5f);
|
||||
break;
|
||||
case 3:
|
||||
r = (int)(p * 255.0f + 0.5f);
|
||||
g = (int)(q * 255.0f + 0.5f);
|
||||
b = (int)(brightness * 255.0f + 0.5f);
|
||||
break;
|
||||
case 4:
|
||||
r = (int)(t * 255.0f + 0.5f);
|
||||
g = (int)(p * 255.0f + 0.5f);
|
||||
b = (int)(brightness * 255.0f + 0.5f);
|
||||
break;
|
||||
case 5:
|
||||
r = (int)(brightness * 255.0f + 0.5f);
|
||||
g = (int)(p * 255.0f + 0.5f);
|
||||
b = (int)(q * 255.0f + 0.5f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
r += bright_adjust * 255;
|
||||
g += bright_adjust * 255;
|
||||
b += bright_adjust * 255;
|
||||
|
||||
r = CLAMP(r, 0, 255);
|
||||
g = CLAMP(g, 0, 255);
|
||||
b = CLAMP(b, 0, 255);
|
||||
|
||||
argb = a;
|
||||
argb = (argb << 8) + r;
|
||||
argb = (argb << 8) + g;
|
||||
argb = (argb << 8) + b;
|
||||
data[id] = argb;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -381,41 +371,6 @@ void create_heuristic_mask(DATA32 *data, int w, int h)
|
||||
}
|
||||
}
|
||||
|
||||
int pixel_empty(DATA32 argb)
|
||||
{
|
||||
|
||||
DATA32 a = (argb >> 24) & 0xff;
|
||||
if (a == 0)
|
||||
return 1;
|
||||
|
||||
DATA32 rgb = argb & 0xffFFff;
|
||||
return rgb == 0;
|
||||
}
|
||||
|
||||
int image_empty(DATA32 *data, int w, int h)
|
||||
{
|
||||
if (w > 0 && h > 0) {
|
||||
int x = w / 2;
|
||||
int y = h / 2;
|
||||
if (!pixel_empty(data[y * w + x])) {
|
||||
// fprintf(stderr, "Non-empty pixel: [%u, %u] = %x\n", x, y, data[y * w + x]);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
for (int y = 0; y < h; y++) {
|
||||
for (int x = 0; x < w; x++) {
|
||||
if (!pixel_empty(data[y * w + x])) {
|
||||
// fprintf(stderr, "Non-empty pixel: [%u, %u] = %x\n", x, y, data[y * w + x]);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// fprintf(stderr, "All pixels are empty\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
void render_image(Drawable d, int x, int y)
|
||||
{
|
||||
if (!server.real_transparency) {
|
||||
@@ -437,9 +392,15 @@ void render_image(Drawable d, int x, int y)
|
||||
imlib_context_set_blend(0);
|
||||
imlib_render_image_on_drawable(0, 0);
|
||||
|
||||
Picture pict = XRenderCreatePicture(server.display, pixmap, XRenderFindStandardFormat(server.display, PictStandardARGB32), 0, 0);
|
||||
Picture pict_drawable = XRenderCreatePicture(server.display, d, XRenderFindVisualFormat(server.display, server.visual), 0, 0);
|
||||
Picture pict_mask = XRenderCreatePicture(server.display, mask, XRenderFindStandardFormat(server.display, PictStandardARGB32), 0, 0);
|
||||
Picture pict = XRenderCreatePicture(server.display,
|
||||
pixmap,
|
||||
XRenderFindStandardFormat(server.display, PictStandardARGB32),
|
||||
0,
|
||||
0);
|
||||
Picture pict_drawable =
|
||||
XRenderCreatePicture(server.display, d, XRenderFindVisualFormat(server.display, server.visual), 0, 0);
|
||||
Picture pict_mask =
|
||||
XRenderCreatePicture(server.display, mask, XRenderFindStandardFormat(server.display, PictStandardARGB32), 0, 0);
|
||||
XRenderComposite(server.display, PictOpOver, pict, pict_mask, pict_drawable, 0, 0, 0, 0, x, y, w, h);
|
||||
|
||||
XRenderFreePicture(server.display, pict_mask);
|
||||
@@ -462,8 +423,8 @@ void draw_text(PangoLayout *layout, cairo_t *c, int posx, int posy, Color *color
|
||||
0.0,
|
||||
0.0,
|
||||
1.0 -
|
||||
(1.0 - shadow_edge_alpha) *
|
||||
sqrt((i * i + j * j) / (double)(shadow_size * shadow_size)));
|
||||
(1.0 - shadow_edge_alpha) *
|
||||
sqrt((i * i + j * j) / (double)(shadow_size * shadow_size)));
|
||||
pango_cairo_update_layout(c, layout);
|
||||
cairo_move_to(c, posx + i, posy + j);
|
||||
pango_cairo_show_layout(c, layout);
|
||||
@@ -486,31 +447,31 @@ Imlib_Image load_image(const char *path, int cached)
|
||||
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);
|
||||
char tmp_filename[128];
|
||||
sprintf(tmp_filename, "/tmp/tint2-%d-XXXXXX.png", (int)getpid());
|
||||
int fd = mkstemps(tmp_filename, 4);
|
||||
if (fd) {
|
||||
// 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);
|
||||
if (err != NULL) {
|
||||
fprintf(stderr, "Could not load svg image!: %s", err->message);
|
||||
g_error_free(err);
|
||||
} else {
|
||||
GdkPixbuf *pixbuf = rsvg_handle_get_pixbuf(svg);
|
||||
gdk_pixbuf_save(pixbuf, tmp_filename, "png", NULL, NULL);
|
||||
}
|
||||
exit(0);
|
||||
} 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);
|
||||
// Parent
|
||||
waitpid(pid, 0, 0);
|
||||
image = imlib_load_image_immediately_without_cache(tmp_filename);
|
||||
unlink(tmp_filename);
|
||||
}
|
||||
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
|
||||
@@ -538,9 +499,9 @@ Imlib_Image adjust_icon(Imlib_Image original, int alpha, int saturation, int bri
|
||||
adjust_asb(data,
|
||||
imlib_image_get_width(),
|
||||
imlib_image_get_height(),
|
||||
alpha,
|
||||
(float)saturation / 100,
|
||||
(float)brightness / 100);
|
||||
alpha / 100.0,
|
||||
saturation / 100.0,
|
||||
brightness / 100.0);
|
||||
imlib_image_put_back_data(data);
|
||||
return copy;
|
||||
}
|
||||
@@ -565,7 +526,8 @@ void draw_rect(cairo_t *c, double x, double y, double w, double h, double r)
|
||||
|
||||
void clear_pixmap(Pixmap p, int x, int y, int w, int h)
|
||||
{
|
||||
Picture pict = XRenderCreatePicture(server.display, p, XRenderFindVisualFormat(server.display, server.visual), 0, 0);
|
||||
Picture pict =
|
||||
XRenderCreatePicture(server.display, p, XRenderFindVisualFormat(server.display, server.visual), 0, 0);
|
||||
XRenderColor col;
|
||||
col.red = col.green = col.blue = col.alpha = 0;
|
||||
XRenderFillRectangle(server.display, PictOpSrc, pict, &col, x, y, w, h);
|
||||
@@ -614,7 +576,7 @@ void get_text_size2(PangoFontDescription *font,
|
||||
XFreePixmap(server.display, pmap);
|
||||
}
|
||||
|
||||
#if !GLIB_CHECK_VERSION (2, 33, 4)
|
||||
#if !GLIB_CHECK_VERSION(2, 33, 4)
|
||||
GList *g_list_copy_deep(GList *list, GCopyFunc func, gpointer user_data)
|
||||
{
|
||||
list = g_list_copy(list);
|
||||
@@ -629,111 +591,44 @@ GList *g_list_copy_deep(GList *list, GCopyFunc func, gpointer user_data)
|
||||
}
|
||||
#endif
|
||||
|
||||
// Based loosely on close_allv from
|
||||
// https://git.gnome.org/browse/glib/tree/gio/libasyncns/asyncns.c?h=2.21.0#n205
|
||||
// license: LGPL version 2.1
|
||||
// but with all the junk removed
|
||||
// and
|
||||
// https://opensource.apple.com/source/sudo/sudo-46/src/closefrom.c
|
||||
// license: BSD
|
||||
void close_all_fds()
|
||||
GSList *load_locations_from_env(GSList *locations, const char *var, ...)
|
||||
{
|
||||
const int from_fd = 3;
|
||||
|
||||
#ifdef __linux__
|
||||
DIR *d = opendir("/proc/self/fd");
|
||||
if (d) {
|
||||
for (struct dirent *de = readdir(d); de; de = readdir(d)) {
|
||||
if (de->d_name[0] == '.')
|
||||
continue;
|
||||
int fd = atoi(de->d_name);
|
||||
if (fd < from_fd)
|
||||
continue;
|
||||
if (fd == dirfd(d))
|
||||
continue;
|
||||
close(fd);
|
||||
char *value = getenv(var);
|
||||
if (value) {
|
||||
value = strdup(value);
|
||||
char *p = value;
|
||||
for (char *token = strsep(&value, ":"); token; token = strsep(&value, ":")) {
|
||||
va_list ap;
|
||||
va_start(ap, var);
|
||||
for (const char *suffix = va_arg(ap, const char *); suffix; suffix = va_arg(ap, const char *)) {
|
||||
locations = g_slist_append(locations, g_build_filename(token, suffix, NULL));
|
||||
}
|
||||
va_end(ap);
|
||||
}
|
||||
closedir(d);
|
||||
return;
|
||||
free(p);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__OpenBSD__)
|
||||
closefrom(from_fd);
|
||||
return;
|
||||
#endif
|
||||
|
||||
#if defined(__NetBSD__)
|
||||
fcntl(from_fd, F_CLOSEM, 0);
|
||||
#endif
|
||||
|
||||
// Worst case scenario: iterate over all possible fds
|
||||
int max_fd = sysconf(_SC_OPEN_MAX);
|
||||
for (int fd = from_fd; fd < max_fd; fd++) {
|
||||
close(fd);
|
||||
}
|
||||
|
||||
return;
|
||||
return locations;
|
||||
}
|
||||
|
||||
char* get_own_path()
|
||||
GSList *slist_remove_duplicates(GSList *list, GCompareFunc eq, GDestroyNotify fr)
|
||||
{
|
||||
const int buf_size = 4096;
|
||||
char *buf = calloc(buf_size, 1);
|
||||
GSList *new_list = NULL;
|
||||
|
||||
#ifdef __linux__
|
||||
if (readlink("/proc/self/exe", buf, buf_size) > 0)
|
||||
return buf;
|
||||
#endif
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
int mib[4] = {
|
||||
CTL_KERN,
|
||||
KERN_PROC,
|
||||
KERN_PROC_PATHNAME,
|
||||
getpid()
|
||||
};
|
||||
|
||||
size_t max_len = buf_size;
|
||||
if (sysctl(mib, 4, buf, &max_len, NULL, 0) == 0)
|
||||
return buf;
|
||||
#endif
|
||||
|
||||
#if defined(__DragonFly__)
|
||||
if (readlink("/proc/curproc/file", buf, buf_size) > 0)
|
||||
return buf;
|
||||
#endif
|
||||
|
||||
#if defined(__NetBSD__)
|
||||
if (readlink("/proc/curproc/exe", buf, buf_size) > 0)
|
||||
return buf;
|
||||
#endif
|
||||
|
||||
#if defined(__OpenBSD__)
|
||||
int mib[4] = {
|
||||
CTL_KERN,
|
||||
KERN_PROC_ARGS,
|
||||
getpid(),
|
||||
KERN_PROC_ARGV
|
||||
};
|
||||
|
||||
char *path = NULL;
|
||||
size_t len;
|
||||
if (sysctl(mib, 4, NULL, &len, NULL, 0) == 0 && len > 0) {
|
||||
char **argv = malloc(len);
|
||||
if (argv) {
|
||||
if (sysctl(mib, 4, argv, &len, NULL, 0) == 0) {
|
||||
path = realpath(argv[0], NULL);
|
||||
for (GSList *l1 = list; l1; l1 = g_slist_next(l1)) {
|
||||
gboolean duplicate = FALSE;
|
||||
for (GSList *l2 = new_list; l2; l2 = g_slist_next(l2)) {
|
||||
if (eq(l1->data, l2->data)) {
|
||||
duplicate = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
free(argv);
|
||||
if (!duplicate) {
|
||||
new_list = g_slist_append(new_list, l1->data);
|
||||
l1->data = NULL;
|
||||
}
|
||||
}
|
||||
if (path) {
|
||||
free(buf);
|
||||
return path;
|
||||
}
|
||||
#endif
|
||||
|
||||
sprintf(buf, "tint2");
|
||||
return buf;
|
||||
g_slist_free_full(list, fr);
|
||||
|
||||
return new_list;
|
||||
}
|
||||
|
||||
@@ -8,15 +8,19 @@
|
||||
|
||||
#define WM_CLASS_TINT "panel"
|
||||
|
||||
#include <glib.h>
|
||||
#include <Imlib2.h>
|
||||
#include <pango/pangocairo.h>
|
||||
#include "area.h"
|
||||
|
||||
#define GREEN "\033[1;32m"
|
||||
#define GREEN "\033[1;32m"
|
||||
#define YELLOW "\033[1;33m"
|
||||
#define RED "\033[1;31m"
|
||||
#define BLUE "\033[1;34m"
|
||||
#define RESET "\033[0m"
|
||||
#define RED "\033[1;31m"
|
||||
#define BLUE "\033[1;34m"
|
||||
#define RESET "\033[0m"
|
||||
|
||||
#define MAX3(a, b, c) MAX(MAX(a, b), c)
|
||||
#define MIN3(a, b, c) MIN(MIN(a, b), c)
|
||||
|
||||
// mouse actions
|
||||
typedef enum MouseAction {
|
||||
@@ -35,7 +39,7 @@ typedef enum MouseAction {
|
||||
PREV_TASK
|
||||
} MouseAction;
|
||||
|
||||
#define ALL_DESKTOPS 0xFFFFFFFF
|
||||
#define ALL_DESKTOPS 0xFFFFFFFF
|
||||
|
||||
// Copies a file to another path
|
||||
void copy_file(const char *path_src, const char *path_dest);
|
||||
@@ -53,11 +57,11 @@ void tint_exec(const char *command);
|
||||
|
||||
// Returns a copy of s in which "~" is expanded to the path to the user's home directory.
|
||||
// The caller takes ownership of the string.
|
||||
char *expand_tilde(char *s);
|
||||
char *expand_tilde(const char *s);
|
||||
|
||||
// The opposite of expand_tilde: replaces the path to the user's home directory with "~".
|
||||
// The caller takes ownership of the string.
|
||||
char *contract_tilde(char *s);
|
||||
char *contract_tilde(const char *s);
|
||||
|
||||
// Color
|
||||
int hex_char_to_int(char c);
|
||||
@@ -67,14 +71,24 @@ void get_color(char *hex, double *rgb);
|
||||
Imlib_Image load_image(const char *path, int cached);
|
||||
|
||||
// Adjusts the alpha/saturation/brightness on an ARGB image.
|
||||
// Parameters: alpha from 0 to 100, satur from 0 to 1, bright from 0 to 1.
|
||||
void adjust_asb(DATA32 *data, int w, int h, int alpha, float satur, float bright);
|
||||
// Parameters:
|
||||
// * alpha_adjust: multiplicative:
|
||||
// * 0 = full transparency
|
||||
// * 1 = no adjustment
|
||||
// * 2 = twice the current opacity
|
||||
// * satur_adjust: additive:
|
||||
// * -1 = full grayscale
|
||||
// * 0 = no adjustment
|
||||
// * 1 = full color
|
||||
// * bright_adjust: additive:
|
||||
// * -1 = black
|
||||
// * 0 = no adjustment
|
||||
// * 1 = white
|
||||
void adjust_asb(DATA32 *data, int w, int h, float alpha_adjust, float satur_adjust, float bright_adjust);
|
||||
Imlib_Image adjust_icon(Imlib_Image original, int alpha, int saturation, int brightness);
|
||||
|
||||
void create_heuristic_mask(DATA32 *data, int w, int h);
|
||||
|
||||
int image_empty(DATA32 *data, int w, int h);
|
||||
|
||||
// Renders the current Imlib image to a drawable. Wrapper around imlib_render_image_on_drawable.
|
||||
void render_image(Drawable d, int x, int y);
|
||||
|
||||
@@ -98,18 +112,25 @@ void draw_rect(cairo_t *c, double x, double y, double w, double h, double r);
|
||||
// Clears the pixmap (with transparent color)
|
||||
void clear_pixmap(Pixmap p, int x, int y, int w, int h);
|
||||
|
||||
#define free_and_null(p) { free(p); p = NULL; }
|
||||
// Appends to the list locations all the directories contained in the environment variable var (split by ":").
|
||||
// Optional suffixes are added to each directory. The suffix arguments MUST end with NULL.
|
||||
// Returns the new value of the list.
|
||||
GSList *load_locations_from_env(GSList *locations, const char *var, ...);
|
||||
|
||||
#if !GLIB_CHECK_VERSION (2, 33, 4)
|
||||
GSList *slist_remove_duplicates(GSList *list, GCompareFunc eq, GDestroyNotify fr);
|
||||
|
||||
#define free_and_null(p) \
|
||||
{ \
|
||||
free(p); \
|
||||
p = NULL; \
|
||||
}
|
||||
|
||||
#if !GLIB_CHECK_VERSION(2, 33, 4)
|
||||
GList *g_list_copy_deep(GList *list, GCopyFunc func, gpointer user_data);
|
||||
#endif
|
||||
|
||||
#if !GLIB_CHECK_VERSION (2, 38, 0)
|
||||
#if !GLIB_CHECK_VERSION(2, 38, 0)
|
||||
#define g_assert_null(expr) g_assert((expr) == NULL)
|
||||
#endif
|
||||
|
||||
void close_all_fds();
|
||||
|
||||
char* get_own_path();
|
||||
|
||||
#endif
|
||||
|
||||
@@ -36,37 +36,21 @@
|
||||
|
||||
#include "strnatcmp.h"
|
||||
|
||||
/* These are defined as macros to make it easier to adapt this code to
|
||||
* different characters types or comparison functions. */
|
||||
static inline int nat_isdigit(nat_char a)
|
||||
{
|
||||
return isdigit((unsigned char)a);
|
||||
}
|
||||
|
||||
static inline int nat_isspace(nat_char a)
|
||||
{
|
||||
return isspace((unsigned char)a);
|
||||
}
|
||||
|
||||
static inline nat_char nat_toupper(nat_char a)
|
||||
{
|
||||
return toupper((unsigned char)a);
|
||||
}
|
||||
|
||||
static int compare_right(nat_char const *a, nat_char const *b)
|
||||
// Compare two right-aligned numbers:
|
||||
// The longest run of digits wins. That aside, the greatest
|
||||
// value wins, but we can't know that it will until we've scanned
|
||||
// both numbers to know that they have the same magnitude, so we
|
||||
// remember it in BIAS.
|
||||
static int compare_right(char const *a, char const *b)
|
||||
{
|
||||
int bias = 0;
|
||||
|
||||
/* The longest run of digits wins. That aside, the greatest
|
||||
* value wins, but we can't know that it will until we've scanned
|
||||
* both numbers to know that they have the same magnitude, so we
|
||||
* remember it in BIAS. */
|
||||
for (;; a++, b++) {
|
||||
if (!nat_isdigit(*a) && !nat_isdigit(*b))
|
||||
if (!isdigit(*a) && !isdigit(*b))
|
||||
return bias;
|
||||
else if (!nat_isdigit(*a))
|
||||
else if (!isdigit(*a))
|
||||
return -1;
|
||||
else if (!nat_isdigit(*b))
|
||||
else if (!isdigit(*b))
|
||||
return +1;
|
||||
else if (*a < *b) {
|
||||
if (!bias)
|
||||
@@ -81,15 +65,16 @@ static int compare_right(nat_char const *a, nat_char const *b)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int compare_left(nat_char const *a, nat_char const *b)
|
||||
// Compare two left-aligned numbers:
|
||||
// The first to have a different value wins.
|
||||
static int compare_left(char const *a, char const *b)
|
||||
{
|
||||
/* Compare two left-aligned numbers: the first to have a different value wins. */
|
||||
for (;; a++, b++) {
|
||||
if (!nat_isdigit(*a) && !nat_isdigit(*b))
|
||||
if (!isdigit(*a) && !isdigit(*b))
|
||||
return 0;
|
||||
else if (!nat_isdigit(*a))
|
||||
else if (!isdigit(*a))
|
||||
return -1;
|
||||
else if (!nat_isdigit(*b))
|
||||
else if (!isdigit(*b))
|
||||
return +1;
|
||||
else if (*a < *b)
|
||||
return -1;
|
||||
@@ -100,46 +85,50 @@ static int compare_left(nat_char const *a, nat_char const *b)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int strnatcmp0(nat_char const *a, nat_char const *b, int fold_case)
|
||||
static int strnatcmp0(char const *a, char const *b, int ignore_case)
|
||||
{
|
||||
int ai, bi;
|
||||
nat_char ca, cb;
|
||||
int fractional, result;
|
||||
|
||||
assert(a && b);
|
||||
|
||||
int ai, bi;
|
||||
ai = bi = 0;
|
||||
while (1) {
|
||||
ca = a[ai];
|
||||
cb = b[bi];
|
||||
char ca = a[ai];
|
||||
char cb = b[bi];
|
||||
|
||||
/* skip over leading spaces or zeros */
|
||||
while (nat_isspace(ca))
|
||||
ca = a[++ai];
|
||||
// Skip over leading spaces
|
||||
while (isspace(ca)) {
|
||||
ai++;
|
||||
ca = a[ai];
|
||||
}
|
||||
|
||||
while (nat_isspace(cb))
|
||||
cb = b[++bi];
|
||||
while (isspace(cb)) {
|
||||
bi++;
|
||||
cb = b[bi];
|
||||
}
|
||||
|
||||
/* process run of digits */
|
||||
if (nat_isdigit(ca) && nat_isdigit(cb)) {
|
||||
fractional = (ca == '0' || cb == '0');
|
||||
// Process run of digits
|
||||
if (isdigit(ca) && isdigit(cb)) {
|
||||
int fractional = (ca == '0' || cb == '0');
|
||||
|
||||
if (fractional) {
|
||||
if ((result = compare_left(a + ai, b + bi)) != 0)
|
||||
int result = compare_left(a + ai, b + bi);
|
||||
if (result)
|
||||
return result;
|
||||
} else {
|
||||
if ((result = compare_right(a + ai, b + bi)) != 0)
|
||||
int result = compare_right(a + ai, b + bi);
|
||||
if (result)
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ca && !cb) {
|
||||
/* The strings compare the same. Perhaps the caller will want to call strcmp to break the tie. */
|
||||
// The strings compare the same. Perhaps the caller will want to call strcmp to break the tie.
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (fold_case) {
|
||||
ca = nat_toupper(ca);
|
||||
cb = nat_toupper(cb);
|
||||
if (ignore_case) {
|
||||
ca = toupper(ca);
|
||||
cb = toupper(cb);
|
||||
}
|
||||
|
||||
if (ca < cb)
|
||||
@@ -147,18 +136,17 @@ static int strnatcmp0(nat_char const *a, nat_char const *b, int fold_case)
|
||||
else if (ca > cb)
|
||||
return +1;
|
||||
|
||||
++ai;
|
||||
++bi;
|
||||
ai++;
|
||||
bi++;
|
||||
}
|
||||
}
|
||||
|
||||
int strnatcmp(nat_char const *a, nat_char const *b)
|
||||
int strnatcmp(char const *a, char const *b)
|
||||
{
|
||||
return strnatcmp0(a, b, 0);
|
||||
}
|
||||
|
||||
/* Compare, recognizing numeric string and ignoring case. */
|
||||
int strnatcasecmp(nat_char const *a, nat_char const *b)
|
||||
int strnatcasecmp(char const *a, char const *b)
|
||||
{
|
||||
return strnatcmp0(a, b, 1);
|
||||
}
|
||||
|
||||
@@ -20,11 +20,8 @@
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/* CUSTOMIZATION SECTION
|
||||
*
|
||||
* You can change this typedef, but must then also change the inline
|
||||
* functions in strnatcmp.c */
|
||||
typedef char nat_char;
|
||||
// Compare, recognizing numeric strings. Case sensitive.
|
||||
int strnatcmp(char const *a, char const *b);
|
||||
|
||||
int strnatcmp(nat_char const *a, nat_char const *b);
|
||||
int strnatcasecmp(nat_char const *a, nat_char const *b);
|
||||
// Compare, recognizing numeric strings. Case insensitive.
|
||||
int strnatcasecmp(char const *a, char const *b);
|
||||
|
||||
@@ -199,7 +199,7 @@ void add_timeout_intern(int value_msec, int interval_msec, void (*_callback)(),
|
||||
|
||||
gint compare_timeouts(gconstpointer t1, gconstpointer t2)
|
||||
{
|
||||
return compare_timespecs(&((const timeout *)t1)->timeout_expires, &((const timeout *)t2)->timeout_expires);
|
||||
return compare_timespecs(&((const timeout *)t1)->timeout_expires, &((const timeout *)t2)->timeout_expires);
|
||||
}
|
||||
|
||||
gint compare_timespecs(const struct timespec *t1, const struct timespec *t2)
|
||||
@@ -257,7 +257,7 @@ int align_with_existing_timeouts(timeout *t)
|
||||
timeout *t2 = it->data;
|
||||
if (t2->interval_msec > 0) {
|
||||
if (t->interval_msec % t2->interval_msec == 0 || t2->interval_msec % t->interval_msec == 0) {
|
||||
if (!multi_timeouts)
|
||||
if (!multi_timeouts)
|
||||
multi_timeouts = g_hash_table_new(0, 0);
|
||||
if (!t->multi_timeout && !t2->multi_timeout) {
|
||||
// both timeouts can be aligned, but there is no multi timeout for them
|
||||
|
||||
@@ -22,9 +22,9 @@
|
||||
|
||||
enum uevent_action {
|
||||
UEVENT_UNKNOWN = 0x01,
|
||||
UEVENT_ADD = 0x02,
|
||||
UEVENT_REMOVE = 0x04,
|
||||
UEVENT_CHANGE = 0x08,
|
||||
UEVENT_ADD = 0x02,
|
||||
UEVENT_REMOVE = 0x04,
|
||||
UEVENT_CHANGE = 0x08,
|
||||
};
|
||||
|
||||
struct uevent_parameter {
|
||||
@@ -41,7 +41,7 @@ struct uevent {
|
||||
};
|
||||
|
||||
struct uevent_notify {
|
||||
int action; /* bitfield */
|
||||
int action; /* bitfield */
|
||||
char *subsystem; /* NULL => any */
|
||||
void *userdata;
|
||||
|
||||
@@ -56,15 +56,26 @@ 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() {
|
||||
static inline int uevent_init()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
static inline void uevent_cleanup() { }
|
||||
static inline void uevent_handler() { }
|
||||
static inline void uevent_cleanup()
|
||||
{
|
||||
}
|
||||
|
||||
static inline void uevent_register_notifier(struct uevent_notify *nb) { }
|
||||
static inline void uevent_unregister_notifier(struct uevent_notify *nb) { }
|
||||
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
|
||||
|
||||
@@ -108,24 +108,24 @@ gboolean window_is_hidden(Window win)
|
||||
|
||||
int get_window_desktop(Window win)
|
||||
{
|
||||
if (!server.viewports) {
|
||||
int desktop = get_property32(win, server.atom._NET_WM_DESKTOP, XA_CARDINAL);
|
||||
if (desktop != ALL_DESKTOPS)
|
||||
desktop = MAX(0, MIN(server.num_desktops - 1, desktop));
|
||||
int desktop = get_property32(win, server.atom._NET_WM_DESKTOP, XA_CARDINAL);
|
||||
if (desktop == ALL_DESKTOPS)
|
||||
return desktop;
|
||||
}
|
||||
if (!server.viewports)
|
||||
return CLAMP(desktop, 0, server.num_desktops - 1);
|
||||
|
||||
int x, y, w, h;
|
||||
get_window_coordinates(win, &x, &y, &w, &h);
|
||||
|
||||
int desktop = get_current_desktop();
|
||||
desktop = get_current_desktop();
|
||||
// Window coordinates are relative to the current viewport, make them absolute
|
||||
x += server.viewports[desktop].x;
|
||||
y += server.viewports[desktop].y;
|
||||
|
||||
if (x < 0 || y < 0) {
|
||||
int num_results;
|
||||
long *x_screen_size = server_get_property(server.root_win, server.atom._NET_DESKTOP_GEOMETRY, XA_CARDINAL, &num_results);
|
||||
long *x_screen_size =
|
||||
server_get_property(server.root_win, server.atom._NET_DESKTOP_GEOMETRY, XA_CARDINAL, &num_results);
|
||||
if (!x_screen_size)
|
||||
return 0;
|
||||
int x_screen_width = x_screen_size[0];
|
||||
@@ -157,7 +157,8 @@ int get_window_desktop(Window win)
|
||||
|
||||
if (best_match < 0)
|
||||
best_match = 0;
|
||||
//fprintf(stderr, "window %lx %s : viewport %d, (%d, %d)\n", win, get_task(win) ? get_task(win)->title : "??", best_match+1, x, y);
|
||||
// fprintf(stderr, "window %lx %s : viewport %d, (%d, %d)\n", win, get_task(win) ? get_task(win)->title : "??",
|
||||
// best_match+1, x, y);
|
||||
return best_match;
|
||||
}
|
||||
|
||||
@@ -184,7 +185,8 @@ int get_window_monitor(Window win)
|
||||
|
||||
if (best_match < 0)
|
||||
best_match = 0;
|
||||
//fprintf(stderr, "desktop %d, window %lx %s : monitor %d, (%d, %d)\n", 1 + get_current_desktop(), win, get_task(win) ? get_task(win)->title : "??", best_match+1, x, y);
|
||||
// fprintf(stderr, "desktop %d, window %lx %s : monitor %d, (%d, %d)\n", 1 + get_current_desktop(), win,
|
||||
// get_task(win) ? get_task(win)->title : "??", best_match+1, x, y);
|
||||
return best_match;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,8 +30,12 @@ do
|
||||
(gnome-calculator 1>/dev/null 2>/dev/null &)
|
||||
fi
|
||||
# change the current desktop to a random value
|
||||
desktop=$(shuf -n 1 -e $(seq 0 $max_desktop))
|
||||
xprop -root -f _NET_CURRENT_DESKTOP 32c -set _NET_CURRENT_DESKTOP $desktop
|
||||
for change in 1 2 3
|
||||
do
|
||||
desktop=$(shuf -n 1 -e $(seq 0 $max_desktop))
|
||||
xprop -root -f _NET_CURRENT_DESKTOP 32c -set _NET_CURRENT_DESKTOP $desktop
|
||||
sleep 0.1
|
||||
done
|
||||
# move windows around
|
||||
for win in $(wmctrl -l | awk '!/Terminal/ {if ($4 != "Desktop") print $1}')
|
||||
do
|
||||
|
||||
2
themes/CMakeLists.txt
Normal file
2
themes/CMakeLists.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
file( GLOB EXTRATHEMEFILES *.tint2rc )
|
||||
install( FILES ${EXTRATHEMEFILES} DESTINATION ${DATADIR}/tint2 )
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user