t2ctl
parent
62d472a79b
commit
fc52f05130
|
@ -0,0 +1,77 @@
|
|||
#!/bin/bash
|
||||
# t2ctl - basic tint2 panel config actions
|
||||
# t2ctl variable value config_file
|
||||
#
|
||||
|
||||
# panel_position = vertical_position horizontal_position orientation
|
||||
# panel_size = width height
|
||||
# panel_shrink = boolean (0 or 1)
|
||||
# panel_margin = horizontal_margin vertical_margin
|
||||
|
||||
T2CONFFILE="${3}"
|
||||
#T2CONFFILE="$HOME/.config/tint2/mabox2111.tint2rc"
|
||||
|
||||
restartt2 () {
|
||||
killall -SIGUSR1 tint2
|
||||
}
|
||||
|
||||
pos () {
|
||||
echo "$1"
|
||||
sd "^panel_position.*$" "panel_position = ${1} center horizontal" ${T2CONFFILE}
|
||||
restartt2
|
||||
}
|
||||
width () {
|
||||
read WIDTH HEIGHT <<< "$(grep panel_size ${T2CONFFILE} | cut -d'=' -f2)"
|
||||
sd "^panel_size.*$" "panel_size = ${1} ${HEIGHT}" ${T2CONFFILE}
|
||||
restartt2
|
||||
}
|
||||
|
||||
height () {
|
||||
read WIDTH HEIGHT <<< "$(grep panel_size ${T2CONFFILE} | cut -d'=' -f2)"
|
||||
sd "^panel_size.*$" "panel_size = ${WIDTH} ${1}" ${T2CONFFILE}
|
||||
restartt2
|
||||
}
|
||||
|
||||
marginhor () {
|
||||
read HOR VERT <<< "$(grep panel_margin ${T2CONFFILE} | cut -d'=' -f2)"
|
||||
sd "^panel_margin.*$" "panel_margin = ${1} ${VERT}" ${T2CONFFILE}
|
||||
restartt2
|
||||
}
|
||||
marginver () {
|
||||
read HOR VERT <<< "$(grep panel_margin ${T2CONFFILE} | cut -d'=' -f2)"
|
||||
sd "^panel_margin.*$" "panel_margin = ${HOR} ${1}" ${T2CONFFILE}
|
||||
restartt2
|
||||
}
|
||||
paddinghor () {
|
||||
read PHOR PVERT SPACING <<< "$(grep panel_padding ${T2CONFFILE} | cut -d'=' -f2)"
|
||||
sd "^panel_padding.*$" "panel_padding = ${1} ${PVERT} ${SPACING}" ${T2CONFFILE}
|
||||
restartt2
|
||||
}
|
||||
paddingver () {
|
||||
read PHOR PVERT SPACING <<< "$(grep panel_padding ${T2CONFFILE} | cut -d'=' -f2)"
|
||||
sd "^panel_padding.*$" "panel_padding = ${PHOR} ${1} ${SPACING}" ${T2CONFFILE}
|
||||
restartt2
|
||||
}
|
||||
spacing () {
|
||||
read PHOR PVERT SPACING <<< "$(grep panel_padding ${T2CONFFILE} | cut -d'=' -f2)"
|
||||
sd "^panel_padding.*$" "panel_padding = ${PHOR} ${PVERT} ${1}" ${T2CONFFILE}
|
||||
restartt2
|
||||
}
|
||||
shrink () {
|
||||
sd "^panel_shrink.*$" "panel_shrink = ${1}" ${T2CONFFILE}
|
||||
restartt2
|
||||
}
|
||||
|
||||
|
||||
case "$1" in
|
||||
position) pos "$2";;
|
||||
width) width "$2" ;;
|
||||
height) height "$2" ;;
|
||||
shrink) shrink "$2" ;;
|
||||
marginh) marginhor "$2" ;;
|
||||
marginv) marginver "$2" ;;
|
||||
paddingh) paddinghor "$2" ;;
|
||||
paddingv) paddingver "$2" ;;
|
||||
spacing) spacing "$2" ;;
|
||||
*) : ;;
|
||||
esac
|
Loading…
Reference in New Issue