conky context menu - initial
This commit is contained in:
parent
52141e5c80
commit
4d6499568a
147
bin/conkyctl
147
bin/conkyctl
@ -243,12 +243,21 @@ makemovableall () {
|
|||||||
echo "dupa"
|
echo "dupa"
|
||||||
}
|
}
|
||||||
|
|
||||||
single () {
|
languages () {
|
||||||
case "$LANG" in
|
case "$LANG" in
|
||||||
pl*)
|
pl*)
|
||||||
POSITION="Pozycja"
|
POSITION="Pozycja"
|
||||||
MARKNEWPOS="Nowa pozycja (<i>zaznacz na ekranie</i>)..."
|
MARKNEWPOS="Nowa pozycja (<i>zaznacz na ekranie</i>)..."
|
||||||
ALIGNMENT="Wyrównanie"
|
ALIGNMENT="Wyrównanie"
|
||||||
|
TOPLEFT="Góra po lewej"
|
||||||
|
TOP="Góra"
|
||||||
|
TOPRIGHT="Góra po prawej"
|
||||||
|
LEFT="Lewa"
|
||||||
|
CENTER="Po środku"
|
||||||
|
RIGHT="Prawa"
|
||||||
|
BOTTOMLEFT="Dół po lewej"
|
||||||
|
BOTTOM="Dół"
|
||||||
|
BOTTOMRIGHT="Dół po prawej"
|
||||||
HORIZONTAL_GAP="Odstęp poziomy"
|
HORIZONTAL_GAP="Odstęp poziomy"
|
||||||
VERTICAL_GAP="Odstęp pionowy"
|
VERTICAL_GAP="Odstęp pionowy"
|
||||||
COLORS="Kolory"
|
COLORS="Kolory"
|
||||||
@ -281,6 +290,15 @@ single () {
|
|||||||
POSITION="Position"
|
POSITION="Position"
|
||||||
MARKNEWPOS="New position (<i>mark on the screen</i>)..."
|
MARKNEWPOS="New position (<i>mark on the screen</i>)..."
|
||||||
ALIGNMENT="Alignment"
|
ALIGNMENT="Alignment"
|
||||||
|
TOPLEFT="TopLeft"
|
||||||
|
TOP="Top"
|
||||||
|
TOPRIGHT="TopRight"
|
||||||
|
LEFT="Left"
|
||||||
|
CENTER="Center"
|
||||||
|
RIGHT="Right"
|
||||||
|
BOTTOMLEFT="BottomLeft"
|
||||||
|
BOTTOM="Bottom"
|
||||||
|
BOTTOMRIGHT="BottomRight"
|
||||||
HORIZONTAL_GAP="Horizontal Gap"
|
HORIZONTAL_GAP="Horizontal Gap"
|
||||||
VERTICAL_GAP="Vertical Gap"
|
VERTICAL_GAP="Vertical Gap"
|
||||||
COLORS="Colors"
|
COLORS="Colors"
|
||||||
@ -310,10 +328,18 @@ single () {
|
|||||||
SOLID_LINE="solid line"
|
SOLID_LINE="solid line"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
single () {
|
||||||
|
languages
|
||||||
filename=${1##*/}
|
filename=${1##*/}
|
||||||
name=${filename%%_mb*}
|
name=${filename%%_mb*}
|
||||||
title=${name//_/ }
|
title=${name//_/ }
|
||||||
|
if [[ "$2" == "s" ]];then
|
||||||
|
me=""
|
||||||
|
else
|
||||||
me="colorizer-conky -s"
|
me="colorizer-conky -s"
|
||||||
|
fi
|
||||||
read POS <<< "$(grep alignment ${1} | cut -d'=' -f2 | cut -d"'" -f2)"
|
read POS <<< "$(grep alignment ${1} | cut -d'=' -f2 | cut -d"'" -f2)"
|
||||||
read GAPX <<< "$(grep gap_x ${1} | cut -d'=' -f2 | cut -d"," -f1)"
|
read GAPX <<< "$(grep gap_x ${1} | cut -d'=' -f2 | cut -d"," -f1)"
|
||||||
read GAPY <<< "$(grep gap_y ${1} | cut -d'=' -f2 | cut -d"," -f1)"
|
read GAPY <<< "$(grep gap_y ${1} | cut -d'=' -f2 | cut -d"," -f1)"
|
||||||
@ -323,7 +349,7 @@ single () {
|
|||||||
FONT=${FONTDEF%:*}
|
FONT=${FONTDEF%:*}
|
||||||
FONTSIZE=${FONTDEF#*=}
|
FONTSIZE=${FONTDEF#*=}
|
||||||
read WINCLR <<< "$(grep own_window_colour ${1} | cut -d'=' -f2 | cut -d"'" -f2)"
|
read WINCLR <<< "$(grep own_window_colour ${1} | cut -d'=' -f2 | cut -d"'" -f2)"
|
||||||
[[ $WINCLR =~ ^#.* ]] && : || WINCLR="#${1}"
|
[[ $WINCLR =~ ^#.* ]] && : || WINCLR="#${WINCLR}"
|
||||||
|
|
||||||
read CLR <<< "$(grep default_color ${1} | cut -d'=' -f2 | cut -d"'" -f2)"
|
read CLR <<< "$(grep default_color ${1} | cut -d'=' -f2 | cut -d"'" -f2)"
|
||||||
[[ $CLR =~ ^#.* ]] && : || CLR="#${CLR}"
|
[[ $CLR =~ ^#.* ]] && : || CLR="#${CLR}"
|
||||||
@ -352,15 +378,15 @@ single () {
|
|||||||
out+=("$ALIGNMENT [ <b>$POS</b> ],^checkout(pos)")
|
out+=("$ALIGNMENT [ <b>$POS</b> ],^checkout(pos)")
|
||||||
out2+=("^tag(pos)")
|
out2+=("^tag(pos)")
|
||||||
out2+=("^sep($POSITION)")
|
out2+=("^sep($POSITION)")
|
||||||
out2+=("TopLeft,conkyctl pos top_left ${1};$me")
|
out2+=(" $TOPLEFT,conkyctl pos top_left ${1};$me")
|
||||||
out2+=("Top,conkyctl pos top_middle ${1};$me")
|
out2+=(" $TOP,conkyctl pos top_middle ${1};$me")
|
||||||
out2+=("TopRight,conkyctl pos top_right ${1};$me")
|
out2+=(" $TOPRIGHT,conkyctl pos top_right ${1};$me")
|
||||||
out2+=("Left,conkyctl pos middle_left ${1};$me")
|
out2+=(" $LEFT,conkyctl pos middle_left ${1};$me")
|
||||||
out2+=("Center,conkyctl pos middle_middle ${1};$me")
|
out2+=("$CENTER,conkyctl pos middle_middle ${1};$me")
|
||||||
out2+=("Right,conkyctl pos middle_right ${1};$me")
|
out2+=(" $RIGHT,conkyctl pos middle_right ${1};$me")
|
||||||
out2+=("BottomLeft,conkyctl pos bottom_left ${1};$me")
|
out2+=(" $BOTTOMLEFT,conkyctl pos bottom_left ${1};$me")
|
||||||
out2+=("Bottom,conkyctl pos bottom_middle ${1};$me")
|
out2+=(" $BOTTOM,conkyctl pos bottom_middle ${1};$me")
|
||||||
out2+=("BottomRight,conkyctl pos bottom_right ${1};$me")
|
out2+=(" $BOTTOMRIGHT,conkyctl pos bottom_right ${1};$me")
|
||||||
out+=("$HORIZONTAL_GAP [ <b>$GAPX</b> ],^checkout(gapx)")
|
out+=("$HORIZONTAL_GAP [ <b>$GAPX</b> ],^checkout(gapx)")
|
||||||
out2+=("^tag(gapx)")
|
out2+=("^tag(gapx)")
|
||||||
out2+=("^sep($HORIZONTAL_GAP)")
|
out2+=("^sep($HORIZONTAL_GAP)")
|
||||||
@ -480,13 +506,105 @@ single () {
|
|||||||
out+=(" $EDIT ${title^},xdg-open ${1}")
|
out+=(" $EDIT ${title^},xdg-open ${1}")
|
||||||
out+=("^sep()")
|
out+=("^sep()")
|
||||||
out+=(" $KILL ${title^},conkyctl kill ${1##*/};${me}")
|
out+=(" $KILL ${title^},conkyctl kill ${1##*/};${me}")
|
||||||
|
}
|
||||||
|
pipemenu () {
|
||||||
|
single "$1"
|
||||||
printf '%s\n' "${out[@]}"
|
printf '%s\n' "${out[@]}"
|
||||||
printf '%s\n' "${out2[@]}"
|
printf '%s\n' "${out2[@]}"
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
contextmenu () {
|
||||||
|
# get conky config path from clicked "conky window"
|
||||||
|
# maybe split this to separate function?
|
||||||
|
eval $(xdotool getmouselocation --shell)
|
||||||
|
eval $(xdotool getwindowgeometry --shell ${WINDOW})
|
||||||
|
hexid=$(wmctrl -lpG | grep ${X} |grep ${Y}|cut -d' ' -f1)
|
||||||
|
CONKYCFG=$(xprop -id ${hexid}|grep WM_COMMAND|cut -d'"' -f6)
|
||||||
|
|
||||||
|
languages
|
||||||
|
filename=${CONKYCFG##*/}
|
||||||
|
name=${filename%%_mb*}
|
||||||
|
title=${name//_/ }
|
||||||
|
read POS <<< "$(grep alignment ${CONKYCFG} | cut -d'=' -f2 | cut -d"'" -f2)"
|
||||||
|
read GAPX <<< "$(grep gap_x ${CONKYCFG} | cut -d'=' -f2 | cut -d"," -f1)"
|
||||||
|
read GAPY <<< "$(grep gap_y ${CONKYCFG} | cut -d'=' -f2 | cut -d"," -f1)"
|
||||||
|
|
||||||
|
read WINTRANS <<< "$(grep own_window_transparent ${CONKYCFG} | cut -d'=' -f2 | cut -d"," -f1)"
|
||||||
|
read FONTDEF <<< "$(grep "font .*=.*,$" ${CONKYCFG} | cut -d'=' -f2,3 |cut -d"'" -f2)"
|
||||||
|
FONT=${FONTDEF%:*}
|
||||||
|
FONTSIZE=${FONTDEF#*=}
|
||||||
|
read WINCLR <<< "$(grep own_window_colour ${CONKYCFG} | cut -d'=' -f2 | cut -d"'" -f2)"
|
||||||
|
[[ $WINCLR =~ ^#.* ]] && : || WINCLR="#${WINCLR}"
|
||||||
|
|
||||||
|
read CLR <<< "$(grep default_color ${CONKYCFG} | cut -d'=' -f2 | cut -d"'" -f2)"
|
||||||
|
[[ $CLR =~ ^#.* ]] && : || CLR="#${CLR}"
|
||||||
|
read CLR0 <<< "$(grep color0 ${CONKYCFG} | cut -d'=' -f2 | cut -d"'" -f2)"
|
||||||
|
[[ $CLR0 =~ ^#.* ]] && : || CLR0="#${CLR0}"
|
||||||
|
read CLR1 <<< "$(grep color1 ${CONKYCFG} | cut -d'=' -f2 | cut -d"'" -f2)"
|
||||||
|
[[ $CLR1 =~ ^#.* ]] && : || CLR1="#${CLR1}"
|
||||||
|
read CLR2 <<< "$(grep color2 ${CONKYCFG} | cut -d'=' -f2 | cut -d"'" -f2)"
|
||||||
|
[[ $CLR2 =~ ^#.* ]] && : || CLR2="#${CLR2}"
|
||||||
|
read OUTLINE <<< "$(grep draw_outline ${CONKYCFG} | cut -d'=' -f2 | cut -d"," -f1)"
|
||||||
|
read SHADES <<< "$(grep draw_shades ${CONKYCFG} | cut -d'=' -f2 | cut -d"," -f1)"
|
||||||
|
SHADOWS="no"
|
||||||
|
[[ "$OUTLINE" == "true" ]] && SHADOWS="outline"
|
||||||
|
[[ "$SHADES" == "true" ]] && SHADOWS="shadow"
|
||||||
|
|
||||||
|
|
||||||
|
read BORD <<< "$(grep draw_borders ${CONKYCFG} | cut -d'=' -f2 | cut -d"," -f1)"
|
||||||
|
read STIP <<< "$(grep stippled_borders ${CONKYCFG} | cut -d'=' -f2 | cut -d"," -f1)"
|
||||||
|
|
||||||
|
[[ "$WINTRANS" == false ]] && BG="bgcolor='$WINCLR'" || BG=""
|
||||||
|
|
||||||
|
|
||||||
|
#notify-send.sh -t 0 "Window" "z xdotool: ${WINDOW} \n X $X \n Y $Y \n hexid: $hexid \n $CONKYCFG \n ${WINCLR}\n ${name}\n $HOME/.config/mabox/${name}.csv"
|
||||||
|
|
||||||
|
if [ ! -f $HOME/.config/mabox/${name}.csv ]; then
|
||||||
|
#touch $HOME/.config/mabox/${name}.csv
|
||||||
|
CUSTOMCOMMANDS=""
|
||||||
|
else
|
||||||
|
CUSTOMCOMMANDS=". $HOME/.config/mabox/${name}.csv"
|
||||||
|
fi
|
||||||
|
|
||||||
|
. /usr/share/mb-jgtools/pipemenu-standalone.cfg
|
||||||
|
. $HOME/.config/mabox/mabox.conf
|
||||||
|
CONFIG_FILE=$(mktemp)
|
||||||
|
MENU_ITEMS=$(mktemp)
|
||||||
|
trap "rm -f ${CONFIG_FILE} ${MENU_ITEMS}" EXIT
|
||||||
|
POSITION_MODE=${1:-pointer}
|
||||||
|
HIDE_BACK_ITEMS=1
|
||||||
|
MENU_PADDING_TOP=${jgtools_padding:-0}
|
||||||
|
|
||||||
|
TABS="90"
|
||||||
|
jgmenu_icon_size=0
|
||||||
|
mkconfigfile
|
||||||
|
|
||||||
|
single "$CONKYCFG" "s"
|
||||||
|
|
||||||
|
case "$LANG" in
|
||||||
|
pl*)
|
||||||
|
CUSTOM_COMMANDS_SEP="Własne polecenia"
|
||||||
|
EDIT_CUSTOMCOMMANDS=" Edytuj własne polecenia"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
CUSTOM_COMMANDS_SEP="Custom commands"
|
||||||
|
EDIT_CUSTOMCOMMANDS=" Edit custom commands"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
cat <<EOF > ${MENU_ITEMS}
|
||||||
|
$(printf '%s\n' "${out[@]}")
|
||||||
|
^sep()
|
||||||
|
⮜⮜⮜ Colorizer Conky,colorizer-conky -s
|
||||||
|
^sep($CUSTOM_COMMANDS_SEP)
|
||||||
|
${CUSTOMCOMMANDS}
|
||||||
|
<small>$EDIT_CUSTOMCOMMANDS</small>,touch ~/.config/mabox/${name}.csv;sleep 1;xdg-open ~/.config/mabox/${name}.csv
|
||||||
|
$(printf '%s\n' "${out2[@]}")
|
||||||
|
EOF
|
||||||
|
jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null
|
||||||
|
|
||||||
|
}
|
||||||
case "$1" in
|
case "$1" in
|
||||||
transparent_all) transparent_all "$2";;
|
transparent_all) transparent_all "$2";;
|
||||||
transparent) transparent "$2" "$3";;
|
transparent) transparent "$2" "$3";;
|
||||||
@ -513,7 +631,7 @@ case "$1" in
|
|||||||
shades_all) shades_all "$2";;
|
shades_all) shades_all "$2";;
|
||||||
shades) shades "$2" "$3";;
|
shades) shades "$2" "$3";;
|
||||||
logosize) logosize "$2";;
|
logosize) logosize "$2";;
|
||||||
single) single "$2";;
|
single) pipemenu "$2";;
|
||||||
pos) pos "$2" "$3";;
|
pos) pos "$2" "$3";;
|
||||||
gap_x) gap_x "$2" "$3";;
|
gap_x) gap_x "$2" "$3";;
|
||||||
gap_y) gap_y "$2" "$3";;
|
gap_y) gap_y "$2" "$3";;
|
||||||
@ -522,6 +640,7 @@ case "$1" in
|
|||||||
startall) startall;;
|
startall) startall;;
|
||||||
kill) kill "$2";;
|
kill) kill "$2";;
|
||||||
restartone) restartone "$2";;
|
restartone) restartone "$2";;
|
||||||
|
contextmenu) contextmenu;;
|
||||||
makemovableall) makemovableall;;
|
makemovableall) makemovableall;;
|
||||||
saveposall) saveposall;;
|
saveposall) saveposall;;
|
||||||
reset) reset ;;
|
reset) reset ;;
|
||||||
|
Loading…
Reference in New Issue
Block a user