master
Daniel Napora 2021-10-21 22:59:27 +02:00
parent 362906e4c7
commit bdf65c06e0
5 changed files with 24 additions and 75 deletions

67
bin/mbx
View File

@ -1,12 +1,10 @@
#!/bin/bash #!/bin/bash
# mbxutils: handy utilities for your X11 window manager. # mbxutils: handy utilities for your X11 window manager.
#
# Copyright (C) 2021 Daniel Napora <napcok@gmail.com> # Copyright (C) 2021 Daniel Napora <napcok@gmail.com>
# mbx #
# TODO Preferences standalone # TODO Preferences standalone
# TODO Logout Dialog postponed # TODO Logout Dialog postponed
# TODO Filebrowser standalone postponed # TODO Filebrowser standalone postponed
# FIXME Remove devel-helpers - move them to another tool
ME=$(basename "$0") ME=$(basename "$0")
@ -30,53 +28,12 @@ fg(){
rgb="$((r*299+g*587+b*114))" rgb="$((r*299+g*587+b*114))"
[ "$rgb" -gt 138000 ] && fgcolor="#222222" color_title_fg="#111111" color_sel_fg="#111111" color_sep_fg="#222222 20"|| fgcolor="#EEEEEE" color_title_fg="#FFFFFF" color_sel_fg="#FFFFFF" [ "$rgb" -gt 138000 ] && fgcolor="#222222" color_title_fg="#111111" color_sel_fg="#111111" color_sep_fg="#222222 20"|| fgcolor="#EEEEEE" color_title_fg="#FFFFFF" color_sel_fg="#FFFFFF"
[ "$rgb" -gt 200000 ] && color_sel_bg="#222222 8" color_sel_border="#222222 16" color_title_bg="#222222 8" [ "$rgb" -gt 200000 ] && color_sel_bg="#222222 8" color_sel_border="#222222 16" color_title_bg="#222222 8"
### [ "$((r*299+g*587+b*114))" -gt 149000 ] && echo "#111111" || echo "#EEEEEE"
} }
###fgcolor=$(fg $bgcolor) ###fgcolor=$(fg $bgcolor)
fg "$bgcolor" fg "$bgcolor"
#KOLOR FG #KOLOR FG
### DDEV ONLY
rgb() {
r=$(printf "%d" 0x${1:1:2}) g=$(printf "%d" 0x${1:3:2}) b=$(printf "%d" 0x${1:5:2})
echo "rgb($r, $g, $b)"
}
color=$(rgb $fgcolor)
background=$(rgb $bgcolor)
function luminance()
{
R=$( echo $1 | awk -F, '{print substr($1,5)}' )
G=$( echo $1 | awk -F, '{print $2}' )
B=$( echo $1 | awk -F, '{n=length($3); print substr($3,1,n-1)}' )
echo "scale=4
rsrgb=$R/255
gsrgb=$G/255
bsrgb=$B/255
if ( rsrgb <= 0.03928 ) r = rsrgb/12.92 else r = e( 2.4 * l((rsrgb+0.055)/1.055) )
if ( gsrgb <= 0.03928 ) g = gsrgb/12.92 else g = e( 2.4 * l((gsrgb+0.055)/1.055) )
if ( bsrgb <= 0.03928 ) b = bsrgb/12.92 else b = e( 2.4 * l((bsrgb+0.055)/1.055) )
0.2126 * r + 0.7152 * g + 0.0722 * b" | bc -l
}
lum1=$( luminance $color )
lum2=$( luminance $background )
# compute contrast
function contrast()
{
echo "scale=2
if ( $1 > $2 ) { l1=$1; l2=$2 } else { l1=$2; l2=$1 }
(l1 + 0.05) / (l2 + 0.05)" | bc
}
rel=$( contrast $lum1 $lum2 )
configure() { configure() {
if [ -f /usr/share/mbxutils/mbxutils.inc ];then if [ -f /usr/share/mbxutils/mbxutils.inc ];then
. /usr/share/mbxutils/mbxutils.inc . /usr/share/mbxutils/mbxutils.inc
@ -171,8 +128,6 @@ $APPS,^checkout(apps),applications-other
^sep() ^sep()
Logout dialog,mb-jgtools mblogout,system-shutdown Logout dialog,mb-jgtools mblogout,system-shutdown
Preferences,^pipe($ME preferences mmenu),firefox Preferences,^pipe($ME preferences mmenu),firefox
^sep(rgb: $rgb)
^sep(rel: $rel)
^tag(apps) ^tag(apps)
EOF EOF
else else
@ -191,8 +146,6 @@ Preferences,^pipe($ME preferences mmenu),firefox
About <b>mbxutils</b>,mbx About <b>mbxutils</b>,mbx
^sep() ^sep()
Logout dialog,mb-jgtools mblogout,system-shutdown Logout dialog,mb-jgtools mblogout,system-shutdown
^sep(rgb: $rgb)
^sep(rel: $rel)
EOF EOF
fi fi
@ -289,17 +242,15 @@ preferences() {
PAR="${ME} $1" PAR="${ME} $1"
out+=("^sep(mbxutils Global Settings)") out+=("^sep(mbxutils Global Settings)")
out+=("^sep(rgb: $rgb)")
out+=("^sep(rel: $rel)")
out+=("^sep(Appearance)") out+=("^sep(Appearance)")
out+=("<tt>$(printf "%-15s %20s" "Font:" "[<b>$font</b>]")</tt>,^pipe($ME fonts $1)") out+=("<tt>$(printf "%-15s %24s" "Font:" "[<b>$font</b>]")</tt>,^pipe($ME fonts $1)")
out+=("<tt>$(printf "%-15s %20s" "Font size (px):" "[<b>$font_size</b>]")</tt>,^checkout(fontsize)") out+=("<tt>$(printf "%-15s %24s" "Font size (px):" "[<b>$font_size</b>]")</tt>,^checkout(fontsize)")
out+=("<tt>$(printf "%-15s %20s" "Line height:" "[<b>$item_height_factor%</b>]")</tt>,^checkout(lineheight)") out+=("<tt>$(printf "%-15s %24s" "Line height:" "[<b>$item_height_factor%</b>]")</tt>,^checkout(lineheight)")
out+=("<tt>$(printf "%-15s %20s" "BGcolor:" "[<b>$bgcolor</b>]")</tt>,^checkout(bgcolor)") out+=("<tt>$(printf "%-15s %24s" "BGcolor:" "[<b>$bgcolor</b>]")</tt>,^checkout(bgcolor)")
out+=("^sep(Other)") out+=("^sep(Other)")
out+=("<tt>$(printf "%-15s %20s" "Terminal:" "[<b>$terminal</b>]")</tt>,^checkout(terminal),terminal") out+=("<tt>$(printf "%-15s %24s" "Terminal:" "[<b>$terminal</b>]")</tt>,^checkout(terminal),terminal")
out+=("<tt>$(printf "%-15s %20s" "File Manager:" "[<b>$filemanager</b>]")</tt>,^checkout(filemanager)") out+=("<tt>$(printf "%-15s %24s" "File Manager:" "[<b>$filemanager</b>]")</tt>,^checkout(filemanager)")
#out+=("<tt>$(printf "%-15s %20s" "Margin (px):" "[<b>$margin_xy</b>]")</tt>,^checkout(margin)") #out+=("<tt>$(printf "%-15s %20s" "Margin (px):" "[<b>$margin_xy</b>]")</tt>,^checkout(margin)")
out+=("^sep()") out+=("^sep()")
out+=("Edit config file,xdg-open $CNF_FILE") out+=("Edit config file,xdg-open $CNF_FILE")
@ -331,7 +282,6 @@ preferences() {
out2+=("$term,mbx setvar terminal=$term;$PAR fixed") out2+=("$term,mbx setvar terminal=$term;$PAR fixed")
done < "$terminals" done < "$terminals"
out2+=("^tag(filemanager)") out2+=("^tag(filemanager)")
out2+=("^sep(Select File Manager)") out2+=("^sep(Select File Manager)")
filemanagers="$CNF_DIR/inc/file_managers.inc" filemanagers="$CNF_DIR/inc/file_managers.inc"
@ -348,8 +298,8 @@ preferences() {
printf '%s\n' "${out[@]}" printf '%s\n' "${out[@]}"
printf '%s\n' "${out2[@]}" printf '%s\n' "${out2[@]}"
fi fi
} }
fonts(){ fonts(){
PAR="${ME} $1" PAR="${ME} $1"
echo "^sep(Font)" echo "^sep(Font)"
@ -368,5 +318,4 @@ case "$1" in
setvar) setvar "$2";; setvar) setvar "$2";;
*) about;; *) about;;
esac esac
exit 0 exit 0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 717 B

After

Width:  |  Height:  |  Size: 567 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 710 B

After

Width:  |  Height:  |  Size: 590 B

View File

@ -27,7 +27,7 @@
inkscape:guide-bbox="true" inkscape:guide-bbox="true"
inkscape:zoom="4" inkscape:zoom="4"
inkscape:cx="84.375" inkscape:cx="84.375"
inkscape:cy="71" inkscape:cy="70.875"
inkscape:window-width="1920" inkscape:window-width="1920"
inkscape:window-height="1145" inkscape:window-height="1145"
inkscape:window-x="0" inkscape:window-x="0"
@ -57,8 +57,8 @@
inkscape:groupmode="layer" inkscape:groupmode="layer"
id="layer1"> id="layer1">
<path <path
style="fill:#808000;stroke:#999999;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;opacity:0.99" style="opacity:0.99;fill:#34be5b;stroke:#999999;stroke-width:2.029;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none;fill-opacity:1"
d="M 115,5 C 5,59.910045 5,59.910045 5,59.910045 L 115,115 Z" d="M 100,19.916354 C 19.832387,59.934602 19.832387,59.934602 19.832387,59.934602 L 100,100.08397 Z"
id="path1416" id="path1416"
inkscape:export-filename="/home/napcok/GitLab/mbxutils/share/icons/hicolor/48x48/apps/mbx-lpanel.png" inkscape:export-filename="/home/napcok/GitLab/mbxutils/share/icons/hicolor/48x48/apps/mbx-lpanel.png"
inkscape:export-xdpi="41.279999" inkscape:export-xdpi="41.279999"

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -27,7 +27,7 @@
inkscape:guide-bbox="true" inkscape:guide-bbox="true"
inkscape:zoom="4" inkscape:zoom="4"
inkscape:cx="84.375" inkscape:cx="84.375"
inkscape:cy="71.375" inkscape:cy="70.875"
inkscape:window-width="1920" inkscape:window-width="1920"
inkscape:window-height="1145" inkscape:window-height="1145"
inkscape:window-x="0" inkscape:window-x="0"
@ -57,10 +57,10 @@
inkscape:groupmode="layer" inkscape:groupmode="layer"
id="layer1"> id="layer1">
<path <path
style="opacity:0.99;fill:#808000;stroke:#999999;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" style="opacity:0.99;fill:#34be5b;fill-opacity:1;stroke:#999999;stroke-width:2.029;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 4.3819658,5 C 114.38197,59.910045 114.38197,59.910045 114.38197,59.910045 L 4.3819658,115 Z" d="M 18.578396,19.916354 C 98.746009,59.934602 98.746009,59.934602 98.746009,59.934602 L 18.578396,100.08397 Z"
id="path1416" id="path1416"
inkscape:export-filename="/home/napcok/GitLab/mbxutils/share/icons/hicolor/48x48/apps/mbx-rpanel.png" inkscape:export-filename="/home/napcok/GitLab/mbxutils/share/icons/hicolor/48x48/apps/mbx-lpanel.png"
inkscape:export-xdpi="41.279999" inkscape:export-xdpi="41.279999"
inkscape:export-ydpi="41.279999" /> inkscape:export-ydpi="41.279999" />
</g> </g>

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB