Advertising
- Miscellany
- Thursday, July 19th, 2012 at 11:33:15pm MDT
- #!/bin/bash
- # toggle_conky
- # a script to change compiz overlapping_outputs option
- # which is used for example to reserve area of screen for conky
- # requires dbus-send, running compiz with dbus enabled, notify-send
- # adjust icon below to path to the one you want for the on-screen message
- # written by Robert Sohn (aka grepper)
- larger=false
- smaller=false
- force_fullscreen=false
- icon=/home/robert/.local/share/icons/conky-blue.png
- while getopts ":w" opt; do
- case $opt in
- w)
- force_fullscreen=:
- ;;
- \?)
- echo "Invalid option: -$OPTARG" >&2
- ;;
- esac
- done
- # find out current state of compiz overlapping_outputs option
- result=$(dbus-send --print-reply --type=method_call \
- --dest=org.freedesktop.compiz \
- /org/freedesktop/compiz/core/screen0/overlapping_outputs \
- org.freedesktop.compiz.get |awk '{ field = $NF }; END{ print field }')
- if [[ $result == 1 || $result == 2 ]]; then
- overlap=$result
- else # notify in case communication failed
- notify-send -t 8000 -i /home/robert/.local/share/icons/conky-red.png \
- "Compiz" "The was a problem with the dbus communication"
- exit
- fi
- # breakpoint
- # prefer larger is 1, perfer smaller is 2
- #if $force_fullscreen && ((result != 1)); then
- # overlap=1
- # screensize="whole screen"
- #elif $force_fullscreen && ((result==1))
- # # already set to fullscreen, just exit
- # exit
- if ((overlap==1)); then
- $force_fullscreen && exit # already set to desired int, just exit
- overlap=2
- screensize="partial screen"
- else
- overlap=1
- screensize="whole screen"
- fi
- # send the message
- dbus-send --print-reply --type=method_call \
- --dest=org.freedesktop.compiz \
- /org/freedesktop/compiz/core/screen0/overlapping_outputs \
- org.freedesktop.compiz.set int32:$overlap
- # on-screen info message with graceful timeout
- notify-send -t 4000 -i $icon \
- "Compiz" "Using $screensize for maximized windows"
advertising
Update the Post
Either update this post and resubmit it with changes, or make a new post.
You may also comment on this post.
Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.