#!/bin/bash
# vim: set fileencoding=utf-8 ts=4 sts=4 sw=4 tw=80 expandtab :
# Copyright (C) 2012 Florian Bruhin <me@the-compiler.org>
# onboardctl is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# onboardctl 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 onboardctl If not, see <http://www.gnu.org/licenses/>.
# Sets the hlwm-padding and launches onboard
launch() {
currot=$(xrandr --verbose -q -o normal --dryrun | \
sed -n 's/^Current rotation - //p')
case $currot in
normal|reverse) x=0; y=368; w=1366; h=400 ;;
left|right) x=0; y=1066; w=768; h=300 ;;
esac
[[ $1 == onlypad ]] || onboard -x "$x" -y "$y" -s "${w}x${h}" &
pad "$h" &
}
# Gets the current onboard-state
isrunning() { pgrep '^onboard$' &>/dev/null ;}
# Toggles the onboard-state (shown/hidden)
toggle() { isrunning && hide || launch ;}
# Kills onboard if it is running
hide() { isrunning && killall onboard && herbstclient pad 0 "" "" 0 "" ;}
# Sets the herbstluftwm padding
pad() { herbstclient pad 0 "" "" "$1" "" ;}
# Handles screen rotation
rotate() { isrunning && launch onlypad ;}
case $1 in
hide|kill) hide ;;
launch|show|launchshow) launch ;;
state) isrunning ;;
toggle) toggle ;;
rotate) rotate ;;
esac
{"text":"text","html5":"html","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"lua","bash":"sh","erlang":"erlang","go":"golang","c":"c_cpp","cpp":"c_cpp","diff":"diff","latex":"latex","sql":"sql","xml":"xml","0":"text","abap":"abap","actionscript":"actionscript","actionscript3":"actionscript","ada":"ada","apache":"apache_conf","applescript":"applescript","asm":"assembly_x86","autohotkey":"autohotkey","closure":"closure","cobol":"cobol","coffeescript":"coffee","cpp-winapi":"c_cpp","c_loadrunner":"c_cpp","c_mac":"c_cpp","c_winapi":"c_cpp","csharp":"csharp","d":"d","dart":"dart","dot":"dot","eiffel":"eiffel","fortran":"fortran","groovy":"groovy","haskell":"haskell","haxe":"haxe","ini":"ini","io":"io","java":"java","java5":"java","make":"makefile","matlab":"matlab","mysql":"mysql","objc":"objectivec","ocaml":"ocaml","pascal":"pascal","perl":"perl","perl6":"perl","postgresql":"pgsql","powershell":"powershell","prolog":"prolog","properties":"properties","rails":"ruby","rust":"rust","scala":"scala","scheme":"scheme","smarty":"smarty","tcl":"tcl","vala":"vala","vb":"vbscript","verilog":"verilog","vhdl":"vhdl","yaml":"yaml"}