Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate
Sign In | Create Account

Advertising

Miscellany
Thursday, July 19th, 2012 at 11:33:15pm MDT 

  1. #!/bin/bash
  2.  
  3. # toggle_conky
  4. # a script to change compiz overlapping_outputs option
  5. # which is used for example to reserve area of screen for conky
  6. # requires dbus-send, running compiz with dbus enabled, notify-send
  7. # adjust icon below to path to the one you want for the on-screen message
  8. # written by Robert Sohn (aka grepper)
  9.  
  10. larger=false
  11. smaller=false
  12. force_fullscreen=false
  13. icon=/home/robert/.local/share/icons/conky-blue.png
  14.  
  15. while getopts ":w" opt; do
  16.   case $opt in
  17.     w)
  18.       force_fullscreen=:
  19.       ;;
  20.     \?)
  21.       echo "Invalid option: -$OPTARG" >&2
  22.       ;;
  23.   esac
  24. done
  25.  
  26. # find out current state of compiz overlapping_outputs option
  27. result=$(dbus-send --print-reply --type=method_call \
  28.   --dest=org.freedesktop.compiz \
  29.   /org/freedesktop/compiz/core/screen0/overlapping_outputs \
  30.   org.freedesktop.compiz.get |awk '{ field = $NF }; END{ print field }')
  31.  
  32.    
  33. if [[ $result == 1 || $result == 2 ]]; then
  34.     overlap=$result
  35. else # notify in case communication failed
  36.     notify-send -t 8000 -i /home/robert/.local/share/icons/conky-red.png \
  37.       "Compiz" "The was a problem with the dbus communication"
  38.     exit
  39. fi
  40.  
  41. # breakpoint
  42. # prefer larger is 1, perfer smaller is 2
  43. #if $force_fullscreen && ((result != 1)); then
  44. #    overlap=1
  45. #    screensize="whole screen"
  46. #elif $force_fullscreen && ((result==1))
  47. #    # already set to fullscreen, just exit
  48. #    exit
  49. if ((overlap==1)); then
  50.     $force_fullscreen && exit # already set to desired int, just exit
  51.     overlap=2
  52.     screensize="partial screen"
  53. else
  54.     overlap=1
  55.     screensize="whole screen"
  56. fi
  57.  
  58. # send the message
  59. dbus-send --print-reply --type=method_call \
  60.   --dest=org.freedesktop.compiz \
  61.   /org/freedesktop/compiz/core/screen0/overlapping_outputs \
  62.   org.freedesktop.compiz.set int32:$overlap
  63.  
  64. # on-screen info message with graceful timeout
  65. notify-send -t 4000 -i $icon \
  66.   "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.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



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.

worth-right
worth-right