diff --git a/bin/mbx b/bin/mbx index 459d7e6..6cc2e4b 100755 --- a/bin/mbx +++ b/bin/mbx @@ -1,12 +1,10 @@ #!/bin/bash -# mbxutils: handy utilities for your X11 window manager. -# -# Copyright (C) 2021 Daniel Napora -# mbx +# mbxutils: handy utilities for your X11 window manager. +# Copyright (C) 2021 Daniel Napora +# # TODO Preferences standalone # TODO Logout Dialog postponed # TODO Filebrowser standalone postponed -# FIXME Remove devel-helpers - move them to another tool ME=$(basename "$0") @@ -29,54 +27,13 @@ fg(){ r=$(printf "%d" 0x${1:1:2}) g=$(printf "%d" 0x${1:3:2}) b=$(printf "%d" 0x${1:5:2}) 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 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" + [ "$rgb" -gt 200000 ] && color_sel_bg="#222222 8" color_sel_border="#222222 16" color_title_bg="#222222 8" } ###fgcolor=$(fg $bgcolor) fg "$bgcolor" #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() { if [ -f /usr/share/mbxutils/mbxutils.inc ];then . /usr/share/mbxutils/mbxutils.inc @@ -171,8 +128,6 @@ $APPS,^checkout(apps),applications-other ^sep() Logout dialog,mb-jgtools mblogout,system-shutdown Preferences,^pipe($ME preferences mmenu),firefox -^sep(rgb: $rgb) -^sep(rel: $rel) ^tag(apps) EOF else @@ -191,8 +146,6 @@ Preferences,^pipe($ME preferences mmenu),firefox About mbxutils,mbx ^sep() Logout dialog,mb-jgtools mblogout,system-shutdown -^sep(rgb: $rgb) -^sep(rel: $rel) EOF fi @@ -289,17 +242,15 @@ preferences() { PAR="${ME} $1" out+=("^sep(mbxutils Global Settings)") - out+=("^sep(rgb: $rgb)") - out+=("^sep(rel: $rel)") out+=("^sep(Appearance)") - out+=("$(printf "%-15s %20s" "Font:" "[$font]"),^pipe($ME fonts $1)") - out+=("$(printf "%-15s %20s" "Font size (px):" "[$font_size]"),^checkout(fontsize)") - out+=("$(printf "%-15s %20s" "Line height:" "[$item_height_factor%]"),^checkout(lineheight)") - out+=("$(printf "%-15s %20s" "BGcolor:" "[$bgcolor]"),^checkout(bgcolor)") + out+=("$(printf "%-15s %24s" "Font:" "[$font]"),^pipe($ME fonts $1)") + out+=("$(printf "%-15s %24s" "Font size (px):" "[$font_size]"),^checkout(fontsize)") + out+=("$(printf "%-15s %24s" "Line height:" "[$item_height_factor%]"),^checkout(lineheight)") + out+=("$(printf "%-15s %24s" "BGcolor:" "[$bgcolor]"),^checkout(bgcolor)") out+=("^sep(Other)") - out+=("$(printf "%-15s %20s" "Terminal:" "[$terminal]"),^checkout(terminal),terminal") - out+=("$(printf "%-15s %20s" "File Manager:" "[$filemanager]"),^checkout(filemanager)") + out+=("$(printf "%-15s %24s" "Terminal:" "[$terminal]"),^checkout(terminal),terminal") + out+=("$(printf "%-15s %24s" "File Manager:" "[$filemanager]"),^checkout(filemanager)") #out+=("$(printf "%-15s %20s" "Margin (px):" "[$margin_xy]"),^checkout(margin)") out+=("^sep()") out+=("Edit config file,xdg-open $CNF_FILE") @@ -331,7 +282,6 @@ preferences() { out2+=("$term,mbx setvar terminal=$term;$PAR fixed") done < "$terminals" - out2+=("^tag(filemanager)") out2+=("^sep(Select File Manager)") filemanagers="$CNF_DIR/inc/file_managers.inc" @@ -348,15 +298,15 @@ preferences() { printf '%s\n' "${out[@]}" printf '%s\n' "${out2[@]}" fi - } + fonts(){ - PAR="${ME} $1" -echo "^sep(Font)" -while read -r x -do -echo "$x,$ME setvar \"font=\'${x}\'\";$PAR fixed" -done < "$CNF_DIR"/inc/fonts.inc + PAR="${ME} $1" + echo "^sep(Font)" + while read -r x + do + echo "$x,$ME setvar \"font=\'${x}\'\";$PAR fixed" + done < "$CNF_DIR"/inc/fonts.inc } case "$1" in @@ -368,5 +318,4 @@ case "$1" in setvar) setvar "$2";; *) about;; esac - exit 0 diff --git a/share/icons/hicolor/48x48/apps/mbx-lpanel.png b/share/icons/hicolor/48x48/apps/mbx-lpanel.png index f775851..f95c2f1 100644 Binary files a/share/icons/hicolor/48x48/apps/mbx-lpanel.png and b/share/icons/hicolor/48x48/apps/mbx-lpanel.png differ diff --git a/share/icons/hicolor/48x48/apps/mbx-rpanel.png b/share/icons/hicolor/48x48/apps/mbx-rpanel.png index b01c726..8e6e395 100644 Binary files a/share/icons/hicolor/48x48/apps/mbx-rpanel.png and b/share/icons/hicolor/48x48/apps/mbx-rpanel.png differ diff --git a/share/icons/hicolor/scalable/apps/mbx-lpanel.svg b/share/icons/hicolor/scalable/apps/mbx-lpanel.svg index 4ad15ad..1382cb3 100644 --- a/share/icons/hicolor/scalable/apps/mbx-lpanel.svg +++ b/share/icons/hicolor/scalable/apps/mbx-lpanel.svg @@ -27,7 +27,7 @@ inkscape:guide-bbox="true" inkscape:zoom="4" inkscape:cx="84.375" - inkscape:cy="71" + inkscape:cy="70.875" inkscape:window-width="1920" inkscape:window-height="1145" inkscape:window-x="0" @@ -57,8 +57,8 @@ inkscape:groupmode="layer" id="layer1">