t2ctl
This commit is contained in:
parent
d2c03b5388
commit
533defce44
126
bin/t2ctl
126
bin/t2ctl
@ -3,10 +3,7 @@
|
|||||||
# t2ctl variable value config_file
|
# 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="${3}"
|
||||||
#T2CONFFILE="$HOME/.config/tint2/mabox2111.tint2rc"
|
#T2CONFFILE="$HOME/.config/tint2/mabox2111.tint2rc"
|
||||||
@ -42,64 +39,52 @@ pos () {
|
|||||||
brv)
|
brv)
|
||||||
sd "^panel_position.*$" "panel_position = bottom right vertical" ${T2CONFFILE};;
|
sd "^panel_position.*$" "panel_position = bottom right vertical" ${T2CONFFILE};;
|
||||||
esac
|
esac
|
||||||
restartt2
|
|
||||||
}
|
}
|
||||||
width () {
|
width () {
|
||||||
read WIDTH HEIGHT <<< "$(grep panel_size ${T2CONFFILE} | cut -d'=' -f2)"
|
read WIDTH HEIGHT <<< "$(grep panel_size ${T2CONFFILE} | cut -d'=' -f2)"
|
||||||
sd "^panel_size.*$" "panel_size = ${1} ${HEIGHT}" ${T2CONFFILE}
|
sd "^panel_size.*$" "panel_size = ${1} ${HEIGHT}" ${T2CONFFILE}
|
||||||
sd "^panel_shrink.*$" "panel_shrink = 0" ${T2CONFFILE}
|
sd "^panel_shrink.*$" "panel_shrink = 0" ${T2CONFFILE}
|
||||||
restartt2
|
|
||||||
}
|
}
|
||||||
|
|
||||||
height () {
|
height () {
|
||||||
read WIDTH HEIGHT <<< "$(grep panel_size ${T2CONFFILE} | cut -d'=' -f2)"
|
read WIDTH HEIGHT <<< "$(grep panel_size ${T2CONFFILE} | cut -d'=' -f2)"
|
||||||
sd "^panel_size.*$" "panel_size = ${WIDTH} ${1}" ${T2CONFFILE}
|
sd "^panel_size.*$" "panel_size = ${WIDTH} ${1}" ${T2CONFFILE}
|
||||||
restartt2
|
|
||||||
}
|
}
|
||||||
|
|
||||||
marginhor () {
|
marginhor () {
|
||||||
read HOR VERT <<< "$(grep panel_margin ${T2CONFFILE} | cut -d'=' -f2)"
|
read HOR VERT <<< "$(grep panel_margin ${T2CONFFILE} | cut -d'=' -f2)"
|
||||||
sd "^panel_margin.*$" "panel_margin = ${1} ${VERT}" ${T2CONFFILE}
|
sd "^panel_margin.*$" "panel_margin = ${1} ${VERT}" ${T2CONFFILE}
|
||||||
restartt2
|
|
||||||
}
|
}
|
||||||
marginver () {
|
marginver () {
|
||||||
read HOR VERT <<< "$(grep panel_margin ${T2CONFFILE} | cut -d'=' -f2)"
|
read HOR VERT <<< "$(grep panel_margin ${T2CONFFILE} | cut -d'=' -f2)"
|
||||||
sd "^panel_margin.*$" "panel_margin = ${HOR} ${1}" ${T2CONFFILE}
|
sd "^panel_margin.*$" "panel_margin = ${HOR} ${1}" ${T2CONFFILE}
|
||||||
restartt2
|
|
||||||
}
|
}
|
||||||
paddinghor () {
|
paddinghor () {
|
||||||
read PHOR PVERT SPACING <<< "$(grep panel_padding ${T2CONFFILE} | cut -d'=' -f2)"
|
read PHOR PVERT SPACING <<< "$(grep panel_padding ${T2CONFFILE} | cut -d'=' -f2)"
|
||||||
sd "^panel_padding.*$" "panel_padding = ${1} ${PVERT} ${SPACING}" ${T2CONFFILE}
|
sd "^panel_padding.*$" "panel_padding = ${1} ${PVERT} ${SPACING}" ${T2CONFFILE}
|
||||||
restartt2
|
|
||||||
}
|
}
|
||||||
paddingver () {
|
paddingver () {
|
||||||
read PHOR PVERT SPACING <<< "$(grep panel_padding ${T2CONFFILE} | cut -d'=' -f2)"
|
read PHOR PVERT SPACING <<< "$(grep panel_padding ${T2CONFFILE} | cut -d'=' -f2)"
|
||||||
sd "^panel_padding.*$" "panel_padding = ${PHOR} ${1} ${SPACING}" ${T2CONFFILE}
|
sd "^panel_padding.*$" "panel_padding = ${PHOR} ${1} ${SPACING}" ${T2CONFFILE}
|
||||||
restartt2
|
|
||||||
}
|
}
|
||||||
spacing () {
|
spacing () {
|
||||||
read PHOR PVERT SPACING <<< "$(grep panel_padding ${T2CONFFILE} | cut -d'=' -f2)"
|
read PHOR PVERT SPACING <<< "$(grep panel_padding ${T2CONFFILE} | cut -d'=' -f2)"
|
||||||
sd "^panel_padding.*$" "panel_padding = ${PHOR} ${PVERT} ${1}" ${T2CONFFILE}
|
sd "^panel_padding.*$" "panel_padding = ${PHOR} ${PVERT} ${1}" ${T2CONFFILE}
|
||||||
restartt2
|
|
||||||
}
|
}
|
||||||
shrink () {
|
shrink () {
|
||||||
sd "^panel_shrink.*$" "panel_shrink = ${1}" ${T2CONFFILE}
|
sd "^panel_shrink.*$" "panel_shrink = ${1}" ${T2CONFFILE}
|
||||||
restartt2
|
|
||||||
}
|
}
|
||||||
autohide () {
|
autohide () {
|
||||||
sd "^autohide .*$" "autohide = ${1}" ${T2CONFFILE}
|
sd "^autohide .*$" "autohide = ${1}" ${T2CONFFILE}
|
||||||
sd "^panel_margin.*$" "panel_margin = 0 0" ${T2CONFFILE}
|
sd "^panel_margin.*$" "panel_margin = 0 0" ${T2CONFFILE}
|
||||||
restartt2
|
|
||||||
}
|
}
|
||||||
hideheight () {
|
hideheight () {
|
||||||
sd "^autohide_height.*$" "autohide_height = ${1}" ${T2CONFFILE}
|
sd "^autohide_height.*$" "autohide_height = ${1}" ${T2CONFFILE}
|
||||||
sd "^panel_margin.*$" "panel_margin = 0 0" ${T2CONFFILE}
|
sd "^panel_margin.*$" "panel_margin = 0 0" ${T2CONFFILE}
|
||||||
sd "^autohide .*$" "autohide = 1" ${T2CONFFILE}
|
sd "^autohide .*$" "autohide = 1" ${T2CONFFILE}
|
||||||
restartt2
|
|
||||||
}
|
}
|
||||||
icontheme () {
|
icontheme () {
|
||||||
sd "^launcher_icon_theme.*$" "launcher_icon_theme = ${1}" ${T2CONFFILE}
|
sd "^launcher_icon_theme.*$" "launcher_icon_theme = ${1}" ${T2CONFFILE}
|
||||||
restartt2
|
|
||||||
}
|
}
|
||||||
|
|
||||||
reset () {
|
reset () {
|
||||||
@ -108,11 +93,9 @@ reset () {
|
|||||||
*) LNG=en ;;
|
*) LNG=en ;;
|
||||||
esac
|
esac
|
||||||
cp "/usr/share/mabox/lang/${LNG}/.config/tint2/${1}" "$HOME/.config/tint2/"
|
cp "/usr/share/mabox/lang/${LNG}/.config/tint2/${1}" "$HOME/.config/tint2/"
|
||||||
restartt2
|
|
||||||
}
|
}
|
||||||
clockline1 () {
|
clockline1 () {
|
||||||
sd "^time1_format.*$" "time1_format = ${1}" ${T2CONFFILE}
|
sd "^time1_format.*$" "time1_format = ${1}" ${T2CONFFILE}
|
||||||
restartt2
|
|
||||||
}
|
}
|
||||||
clockline2 () {
|
clockline2 () {
|
||||||
if [[ "$1" == "none" ]];then
|
if [[ "$1" == "none" ]];then
|
||||||
@ -120,9 +103,97 @@ clockline2 () {
|
|||||||
else
|
else
|
||||||
sd "^time2_format.*$" "time2_format = ${1}" ${T2CONFFILE}
|
sd "^time2_format.*$" "time2_format = ${1}" ${T2CONFFILE}
|
||||||
fi
|
fi
|
||||||
restartt2
|
|
||||||
}
|
}
|
||||||
|
tb_icon(){
|
||||||
|
sd "^task_icon .*$" "task_icon = 1" ${T2CONFFILE}
|
||||||
|
sd "^task_text.*$" "task_text = 0" ${T2CONFFILE}
|
||||||
|
read W H <<< "$(grep panel_size ${T2CONFFILE} | cut -d'=' -f2)"
|
||||||
|
sd "^task_maximum_size.*$" "task_maximum_size = ${H} ${H}" ${T2CONFFILE}
|
||||||
|
}
|
||||||
|
tb_text(){
|
||||||
|
sd "^task_text.*$" "task_text = 1" ${T2CONFFILE}
|
||||||
|
sd "^task_icon .*$" "task_icon = 0" ${T2CONFFILE}
|
||||||
|
read TB_WIDTH TB_HEIGHT <<< "$(grep 'task_maximum_size' ${TINT} | cut -d'=' -f2)"
|
||||||
|
if [[ "$TB_WIDTH" < 100 ]];then
|
||||||
|
sd "^task_maximum_size.*$" "task_maximum_size = 100 100" ${T2CONFFILE}
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
tb_both(){
|
||||||
|
sd "^task_icon .*$" "task_icon = 1" ${T2CONFFILE}
|
||||||
|
sd "^task_text.*$" "task_text = 1" ${T2CONFFILE}
|
||||||
|
read TB_WIDTH TB_HEIGHT <<< "$(grep 'task_maximum_size' ${TINT} | cut -d'=' -f2)"
|
||||||
|
if [[ "$TB_WIDTH" < 100 ]];then
|
||||||
|
sd "^task_maximum_size.*$" "task_maximum_size = 100 100" ${T2CONFFILE}
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
tb_centered(){
|
||||||
|
sd "^task_centered.*$" "task_centered = ${1}" ${T2CONFFILE}
|
||||||
|
}
|
||||||
|
tb_width(){
|
||||||
|
case "$1" in
|
||||||
|
icon)
|
||||||
|
read W H <<< "$(grep panel_size ${T2CONFFILE} | cut -d'=' -f2)"
|
||||||
|
sd "^task_maximum_size.*$" "task_maximum_size = ${H} ${H}" ${T2CONFFILE};;
|
||||||
|
*)sd "^task_maximum_size.*$" "task_maximum_size = ${1} ${1}" ${T2CONFFILE};;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
tb_tooltip_none(){
|
||||||
|
case "$1" in
|
||||||
|
1)
|
||||||
|
sd "^task_tooltip.*$" "task_tooltip = 0" ${T2CONFFILE}
|
||||||
|
sd "^task_thumbnail.*$" "task_thumbnail = 0" ${T2CONFFILE}
|
||||||
|
;;
|
||||||
|
0)
|
||||||
|
sd "^task_tooltip.*$" "task_tooltip = 1" ${T2CONFFILE}
|
||||||
|
sd "^task_thumbnail.*$" "task_thumbnail = 0" ${T2CONFFILE}
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
tb_tooltip(){
|
||||||
|
case "$1" in
|
||||||
|
1)
|
||||||
|
sd "^task_tooltip.*$" "task_tooltip = 1" ${T2CONFFILE}
|
||||||
|
sd "^task_thumbnail.*$" "task_thumbnail = 0" ${T2CONFFILE}
|
||||||
|
;;
|
||||||
|
0)
|
||||||
|
sd "^task_tooltip.*$" "task_tooltip = 0" ${T2CONFFILE}
|
||||||
|
sd "^task_thumbnail.*$" "task_thumbnail = 0" ${T2CONFFILE}
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
tb_thumbnail(){
|
||||||
|
case "$1" in
|
||||||
|
1)
|
||||||
|
sd "^task_thumbnail.*$" "task_thumbnail = 1" ${T2CONFFILE}
|
||||||
|
sd "^task_tooltip.*$" "task_tooltip = 1" ${T2CONFFILE}
|
||||||
|
;;
|
||||||
|
0)
|
||||||
|
sd "^task_thumbnail.*$" "task_thumbnail = 1" ${T2CONFFILE}
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
mleft(){
|
||||||
|
sd "^mouse_left.*$" "mouse_left = ${1}" ${T2CONFFILE}
|
||||||
|
}
|
||||||
|
mright(){
|
||||||
|
sd "^mouse_right.*$" "mouse_right = ${1}" ${T2CONFFILE}
|
||||||
|
}
|
||||||
|
mmiddle(){
|
||||||
|
sd "^mouse_middle.*$" "mouse_middle = ${1}" ${T2CONFFILE}
|
||||||
|
}
|
||||||
|
mup(){
|
||||||
|
sd "^mouse_scroll_up.*$" "mouse_scroll_up = ${1}" ${T2CONFFILE}
|
||||||
|
}
|
||||||
|
mdown(){
|
||||||
|
sd "^mouse_scroll_down.*$" "mouse_scroll_down = ${1}" ${T2CONFFILE}
|
||||||
|
}
|
||||||
|
mousereset(){
|
||||||
|
sd "^mouse_left.*$" "mouse_left = toggle_iconify" ${T2CONFFILE}
|
||||||
|
sd "^mouse_right.*$" "mouse_right = toggle" ${T2CONFFILE}
|
||||||
|
sd "^mouse_middle.*$" "mouse_middle = close" ${T2CONFFILE}
|
||||||
|
sd "^mouse_scroll_up.*$" "mouse_scroll_up = iconify" ${T2CONFFILE}
|
||||||
|
sd "^mouse_scroll_down.*$" "mouse_scroll_down = toggle_iconify" ${T2CONFFILE}
|
||||||
|
}
|
||||||
case "$1" in
|
case "$1" in
|
||||||
position) pos "$2";;
|
position) pos "$2";;
|
||||||
width) width "$2" ;;
|
width) width "$2" ;;
|
||||||
@ -138,6 +209,21 @@ case "$1" in
|
|||||||
icontheme) icontheme "$2" ;;
|
icontheme) icontheme "$2" ;;
|
||||||
clockline1) clockline1 "$2";;
|
clockline1) clockline1 "$2";;
|
||||||
clockline2) clockline2 "$2";;
|
clockline2) clockline2 "$2";;
|
||||||
|
tb_icon)tb_icon "$2";;
|
||||||
|
tb_text)tb_text "$2";;
|
||||||
|
tb_both)tb_both "$2";;
|
||||||
|
tb_centered)tb_centered "$2";;
|
||||||
|
tb_width)tb_width "$2";;
|
||||||
|
tb_tooltip_none)tb_tooltip_none "$2";;
|
||||||
|
tb_tooltip)tb_tooltip "$2";;
|
||||||
|
tb_thumbnail)tb_thumbnail "$2";;
|
||||||
|
mleft)mleft "$2";;
|
||||||
|
mright)mright "$2";;
|
||||||
|
mmiddle)mmiddle "$2";;
|
||||||
|
mup)mup "$2";;
|
||||||
|
mdown)mdown "$2";;
|
||||||
|
mousereset)mousereset;;
|
||||||
reset) reset "$2" ;;
|
reset) reset "$2" ;;
|
||||||
*) : ;;
|
*) : ;;
|
||||||
esac
|
esac
|
||||||
|
restartt2
|
||||||
|
Loading…
Reference in New Issue
Block a user