icon for quake-terminal
This commit is contained in:
parent
927b5af4d8
commit
21f9ad9740
100
bin/cortilectl
100
bin/cortilectl
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
# Cortile config file
|
# Cortile config file
|
||||||
CONFFILE="$HOME/.config/cortile/config.toml"
|
CONFFILE="$HOME/.config/cortile/config.toml"
|
||||||
|
IMG_DIR="$HOME/.config/cortile/tint2-cortile"
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
echo "">/tmp/cortile.log
|
echo "">/tmp/cortile.log
|
||||||
@ -12,21 +13,108 @@ start() {
|
|||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
pkill cortile
|
pkill cortile
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
toggle() {
|
|
||||||
:
|
|
||||||
}
|
|
||||||
editconf() {
|
editconf() {
|
||||||
xdg-open ${CONFFILE}
|
xdg-open ${CONFFILE}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sendcmd(){
|
||||||
|
#notify-send.sh "$1" "aaa"
|
||||||
|
case "$1" in
|
||||||
|
proportion_increase) echo '{"Action":"proportion_increase"}' | nc -U /tmp/cortile.sock.in &2>/dev/null;;
|
||||||
|
proportion_decrease) echo '{"Action":"proportion_decrease"}' | nc -U /tmp/cortile.sock.in &2>/dev/null;;
|
||||||
|
window_next) echo '{"Action":"window_next"}' | nc -U /tmp/cortile.sock.in &2>/dev/null;;
|
||||||
|
window_previous) echo '{"Action":"window_previous"}' | nc -U /tmp/cortile.sock.in &2>/dev/null;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
is_tiled(){
|
||||||
|
grep workspace-$(xdotool get_desktop) /tmp/cortile.log |tail -n 1 |grep Tile >/dev/null
|
||||||
|
}
|
||||||
|
is_fullscreen(){
|
||||||
|
grep workspace-$(xdotool get_desktop) /tmp/cortile.log |tail -n 1 |grep fullscreen >/dev/null
|
||||||
|
}
|
||||||
|
get_current_layout(){
|
||||||
|
layout=$(grep workspace-$(xdotool get_desktop) /tmp/cortile.log |tail -n 1| cut -d' ' -f6)
|
||||||
|
case "$layout" in
|
||||||
|
vertical-right) echo ${IMG_DIR}/vertical-right.png;;
|
||||||
|
vertical-left) echo ${IMG_DIR}/vertical-left.png;;
|
||||||
|
horizontal-top) echo ${IMG_DIR}/horizontal-top.png;;
|
||||||
|
horizontal-bottom) echo ${IMG_DIR}/horizontal-bottom.png;;
|
||||||
|
fullscreen) echo ${IMG_DIR}/fullscreen.png;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
main(){
|
||||||
|
if ! pgrep -x cortile >/dev/null ;then exit 0;fi
|
||||||
|
if is_tiled ;then
|
||||||
|
get_current_layout
|
||||||
|
else
|
||||||
|
echo "${IMG_DIR}/untiled.png"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
left(){
|
||||||
|
if is_tiled ;then
|
||||||
|
if is_fullscreen ;then
|
||||||
|
#sendkey untile
|
||||||
|
echo "${IMG_DIR}/untiled.png"
|
||||||
|
echo '{"Action":"untile"}' | nc -U /tmp/cortile.sock.in &2>/dev/null
|
||||||
|
else
|
||||||
|
#sendkey layout_cycle
|
||||||
|
echo '{"Action":"cycle_next"}' | nc -U /tmp/cortile.sock.in &2>/dev/null
|
||||||
|
get_current_layout
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
#sendkey tile
|
||||||
|
echo '{"Action":"tile"}' | nc -U /tmp/cortile.sock.in
|
||||||
|
echo '{"Action":"layout_vertical_left"}' | nc -U /tmp/cortile.sock.in
|
||||||
|
get_current_layout
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
middle(){
|
||||||
|
echo '{"Action":"toggle"}' | nc -U /tmp/cortile.sock.in &2>/dev/null
|
||||||
|
|
||||||
|
if is_tiled ;then
|
||||||
|
get_current_layout
|
||||||
|
else
|
||||||
|
echo "${IMG_DIR}/untiled.png"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
right(){
|
||||||
|
: #menu
|
||||||
|
}
|
||||||
|
up(){
|
||||||
|
if is_tiled; then
|
||||||
|
if is_fullscreen ;then
|
||||||
|
sendcmd window_previous
|
||||||
|
else
|
||||||
|
sendcmd proportion_increase
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
xdotool set_desktop --relative 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
down(){
|
||||||
|
if is_tiled; then
|
||||||
|
if is_fullscreen ;then
|
||||||
|
sendcmd window_next
|
||||||
|
else
|
||||||
|
sendcmd proportion_decrease
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
xdotool set_desktop --relative -- -1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start) start;;
|
start) start;;
|
||||||
stop) stop;;
|
stop) stop;;
|
||||||
toggle) toggle;;
|
|
||||||
editconf) editconf;;
|
editconf) editconf;;
|
||||||
*):;;
|
left)left;;
|
||||||
|
right)right;;
|
||||||
|
middle)middle;;
|
||||||
|
up)up;;
|
||||||
|
down)down;;
|
||||||
|
*)main;;
|
||||||
esac
|
esac
|
||||||
|
@ -18,7 +18,7 @@ if [ -z "${ID}" ]; then
|
|||||||
LEFT=$[$(wmctrl -d|grep "*"|awk '{print $4}'|cut -d'x' -f1)/8]
|
LEFT=$[$(wmctrl -d|grep "*"|awk '{print $4}'|cut -d'x' -f1)/8]
|
||||||
HEIGHT=$[$(wmctrl -d|grep "*"|awk '{print $4}'|cut -d'x' -f2)/2]
|
HEIGHT=$[$(wmctrl -d|grep "*"|awk '{print $4}'|cut -d'x' -f2)/2]
|
||||||
WIDTH=$[${LEFT}*6]
|
WIDTH=$[${LEFT}*6]
|
||||||
terminator -T ${NAME} -b --geometry "${WIDTH}x${HEIGHT}+${LEFT}+${TOP}"
|
terminator -T ${NAME} -b --geometry "${WIDTH}x${HEIGHT}+${LEFT}+${TOP}" -i utilities-terminal
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
ID_DEC=$((${ID}))
|
ID_DEC=$((${ID}))
|
||||||
|
Loading…
Reference in New Issue
Block a user