mirror of
https://github.com/yshui/picom.git
synced 2024-11-11 13:51:02 -05:00
6d36ef2d0f
- Add advanced window matching system, capable of matching against arbitrary window properties as well as a series of internal properties, with 4 additional operators (>, <, >=, <=) useful for integer targets, and support of logical operators. The old matching system is removed, but compatibility with the format is retained. - As the new matching system is pretty complicated, and I have no past experience in writing a parser, it's pretty possible that bugs are present. It also has inferior performance, but I hope it doesn't matter on modern CPUs. - It's possible to disable matching system at compile time with NO_C2=1 now. - Add ps->o.config_file to track which config file we have actually read. Queryable via D-Bus. - Parse -d in first pass in get_cfg() as c2 needs to query X to get atoms during condition parsing. - Fix a bug in wid_get_prop_adv() that 0 == rformat is not handled correctly. - Fix incompatibility with FreeBSD sed in dbus-examples/cdbus-driver.sh . - Add recipe to generate .clang_complete in Makefile, used by Vim clang_complete plugin. - Add DEBUG_C2 for debugging condition string parsing. DEBUG_WINMATCH is still used for match debugging. - Rename win_on_wdata_change() to win_on_factor_change(). - Extra malloc() failure checks. Add const to matching cache members in session_t. Code clean-up. Documentation update.
50 lines
1.6 KiB
Bash
Executable file
50 lines
1.6 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
if [ -z "$SED" ]; then
|
|
SED="sed"
|
|
command -v gsed > /dev/null && SED="gsed"
|
|
fi
|
|
|
|
# === Get connection parameters ===
|
|
|
|
dpy=$(echo -n "$DISPLAY" | tr -c '[:alnum:]' _)
|
|
|
|
if [ -z "$dpy" ]; then
|
|
echo "Cannot find display."
|
|
exit 1
|
|
fi
|
|
|
|
service="com.github.chjj.compton.${dpy}"
|
|
interface='com.github.chjj.compton'
|
|
object='/com/github/chjj/compton'
|
|
type_win='uint32'
|
|
type_enum='uint16'
|
|
|
|
# === DBus methods ===
|
|
|
|
# List all window ID compton manages (except destroyed ones)
|
|
dbus-send --print-reply --dest="$service" "$object" "${interface}.list_win"
|
|
|
|
# Get window ID of currently focused window
|
|
focused=$(dbus-send --print-reply --dest="$service" "$object" "${interface}.find_win" string:focused | $SED -n 's/^[[:space:]]*'${type_win}'[[:space:]]*\([[:digit:]]*\).*/\1/p')
|
|
|
|
if [ -n "$focused" ]; then
|
|
# Get invert_color_force property of the window
|
|
dbus-send --print-reply --dest="$service" "$object" "${interface}.win_get" "${type_win}:${focused}" string:invert_color_force
|
|
|
|
# Set the window to have inverted color
|
|
dbus-send --print-reply --dest="$service" "$object" "${interface}.win_set" "${type_win}:${focused}" string:invert_color_force "${type_enum}:1"
|
|
else
|
|
echo "Cannot find focused window."
|
|
fi
|
|
|
|
# Set the clear_shadow setting to true
|
|
dbus-send --print-reply --dest="$service" "$object" "${interface}.opts_set" string:clear_shadow boolean:true
|
|
|
|
# Get the clear_shadow setting
|
|
dbus-send --print-reply --dest="$service" "$object" "${interface}.opts_get" string:clear_shadow
|
|
|
|
# Reset compton
|
|
sleep 3
|
|
dbus-send --print-reply --dest="$service" "$object" "${interface}.reset"
|
|
|