Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CDBus cleanup #353

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions dbus-examples/cdbus-driver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type_enum='uint16'
dbus-send --print-reply --dest="$service" "$object" "${interface}.list_win"

# Ensure we are tracking focus
dbus-send --print-reply --dest="$service" "$object" "${interface}.opts_set" string:track_focus boolean:true
dbus-send --print-reply --dest="$service" "$object" "${interface}.opts_set" string:track_focus variant:boolean:true

# 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')
Expand All @@ -36,13 +36,13 @@ if [ -n "$focused" ]; then
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"
dbus-send --print-reply --dest="$service" "$object" "${interface}.win_set" "${type_win}:${focused}" string:invert_color_force variant:"${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
dbus-send --print-reply --dest="$service" "$object" "${interface}.opts_set" string:clear_shadow variant:boolean:true

# Get the clear_shadow setting
dbus-send --print-reply --dest="$service" "$object" "${interface}.opts_get" string:clear_shadow
Expand All @@ -53,11 +53,11 @@ dbus-send --print-reply --dest="$service" "$object" "${interface}.reset"

# Undirect window
sleep 3
dbus-send --print-reply --dest="$service" "$object" "${interface}.opts_set" string:redirected_force uint16:0
dbus-send --print-reply --dest="$service" "$object" "${interface}.opts_set" string:redirected_force variant:uint16:0

# Revert back to auto
sleep 3
dbus-send --print-reply --dest="$service" "$object" "${interface}.opts_set" string:redirected_force uint16:2
dbus-send --print-reply --dest="$service" "$object" "${interface}.opts_set" string:redirected_force variant:uint16:2

# Force repaint
dbus-send --print-reply --dest="$service" "$object" "${interface}.repaint"
6 changes: 3 additions & 3 deletions dbus-examples/inverter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ if [ -z "$1" -o "$1" = "selected" ]; then
window=$(xwininfo -frame | sed -n 's/^xwininfo: Window id: \(0x[[:xdigit:]][[:xdigit:]]*\).*/\1/p') # Select window by mouse
elif [ "$1" = "focused" ]; then
# Ensure we are tracking focus
${compton_dbus}opts_set string:track_focus boolean:true &
${compton_dbus}opts_set string:track_focus variant:boolean:true &
window=$(${compton_dbus}find_win string:focused | $SED -n 's/^[[:space:]]*'${type_win}'[[:space:]]*\([[:digit:]]*\).*/\1/p') # Query compton for the active window
elif echo "$1" | grep -Eiq '^([[:digit:]][[:digit:]]*|0x[[:xdigit:]][[:xdigit:]]*)$'; then
window="$1" # Accept user-specified window-id if the format is correct
Expand All @@ -53,13 +53,13 @@ fi

# Color invert the selected or focused window
if [ -n "$window" ]; then
invert_status="$(${compton_dbus}win_get "${type_win}:${window}" string:invert_color | $SED -n 's/^[[:space:]]*boolean[[:space:]]*\([[:alpha:]]*\).*/\1/p')"
invert_status="$(${compton_dbus}win_get "${type_win}:${window}" string:invert_color | $SED -n 's/^[[:space:]]*variant[[:space:]]*boolean[[:space:]]*\([[:alpha:]]*\).*/\1/p')"
if [ "$invert_status" = true ]; then
invert=0 # Set the window to have normal color
else
invert=1 # Set the window to have inverted color
fi
${compton_dbus}win_set "${type_win}:${window}" string:invert_color_force "${type_enum}:${invert}" &
${compton_dbus}win_set "${type_win}:${window}" string:invert_color_force "variant:${type_enum}:${invert}" &
else
echo "Cannot find $1 window."
exit 1;
Expand Down
Loading