-
Notifications
You must be signed in to change notification settings - Fork 6
/
mxfb-top
executable file
·110 lines (85 loc) · 2.8 KB
/
mxfb-top
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/bin/bash
##This app uses information in the Fluxbox Wiki: http://fluxbox-wiki.org/Make_windows_only_show_a_border.html
##and presents the operations in graphical form
##It was developed by MX Devs July 2021 and released as a beta under GPLv3
# version="210929-01" # fehlix adjusted
# version="210929-02" # jerry adjusted
# version="210930-01" # fehlix: add window icon
TEXTDOMAINDIR=/usr/share/locale
export TEXTDOMAIN="mxfb-accessories"
HELPFILE=/usr/share/mxflux/HELP_Windowoverlay
WINDOW_ICON=/usr/share/icons/mxflux.png
TITLE=$(gettext "CONFIGURE TOP")
SUBTITLE=$(gettext "Select titlebar mode")
TITLEBAR="show,hide,tab"
LABEL_BORDER_SIZE=$(gettext "Size")
LABEL_COLOR_FOCUSED=$(gettext "Color Focused")
LABEL_COLOR_UNFOCUSED=$(gettext "Color Unfocused")
. /usr/bin/gettext.sh
OK=$(TEXTDOMAIN=gtk30 eval_pgettext "Stock label" "_OK" )
CANCEL=$(TEXTDOMAIN=gtk30 eval_pgettext "Stock label" "_Cancel")
APPLY=$(TEXTDOMAIN=gtk30 eval_pgettext "Stock label" "_Apply")
REVERT=$(TEXTDOMAIN=gtk30 eval_pgettext "Stock label" "_Revert" )
HELP=$(TEXTDOMAIN=gtk30 eval_pgettext "Stock label" "_Help" )
BUTTON_OK="$OK"'!gtk-ok:0'
BUTTON_CANCEL="$CANCEL"'!gtk-cancel:1'
BUTTON_APPLY="$APPLY"'!gtk-apply:2'
BUTTON_REVERT="$REVERT"'!undo:3'
BUTTON_HELP="$HELP"'!gtk-help:'"featherpad $HELPFILE"
YAD_TEXT="
<b>$TITLE</b>
<b><i>$SUBTITLE</i></b>
"
FLUXBOX_INIT="$HOME/.fluxbox/init"
TITLEBAR='show!hide!tab'
declare -A MODE
MODE[NORMAL]=show
MODE[BORDER]=hide
MODE[TAB]=tab
declare -A DECO
DECO[show]=NORMAL
DECO[hide]=BORDER
DECO[tab]=TAB
while true; do
deco=$(grep -w -m1 -oE 'NORMAL|TAB|BORDER' $FLUXBOX_INIT)
: ${deco:=NORMAL}
# mark current in selection list
CB=${TITLEBAR/${MODE[$deco]}/^${MODE[$deco]}}
YAD=(yad
--title="$TITLE"
--window-icon="$WINDOW_ICON"
--text="$YAD_TEXT"
--text-align=center
--form
--width=20
--separator=","
--buttons-layout=center
--button="$BUTTON_HELP"
--button="$BUTTON_REVERT"
--button="$BUTTON_CANCEL"
--button="$BUTTON_OK"
--field=" ""$LABEL_MODE":CB "$CB"
)
RES=$("${YAD[@]}")
ret=$?
# read selection
IFS=, read -r mode _<<<"$RES"
case $ret in
0|2) # OK or Apply
sed -i -r "s/(NORMAL|TAB|BORDER)/${DECO[$mode]}/" $FLUXBOX_INIT
#killall -SIGUSR2 fluxbox
fluxbox-remote restart
killall -SIGUSR1 conky 2>/dev/null
((ret==0)) && exit # on Ok
;;
1|252) # cancel or Esc
exit
;;
3) # reset
sed -i -r "s/(NORMAL|TAB|BORDER)/${DECO[show]}/" $FLUXBOX_INIT
#killall -SIGUSR2 fluxbox
fluxbox-remote restart
killall -SIGUSR1 conky 2>/dev/null
;;
esac
done