termux / termux-packages

A package build system for Termux.
https://termux.dev
Other
13.34k stars 3.07k forks source link

[Bug]: my custom config of Polybar. Reverted into the example config of Polybar. After receive upgrading Polybar (Pacman). #22276

Closed ReeaoX closed 6 days ago

ReeaoX commented 6 days ago

Problem description

After pacman -Syyu --noconfirm. They're aim "${PREFIX}/etc/polybar/config.ini" to it's fool:

While running vim, as the aliases of nvim. I unfortunately saw these line, as the brutal replacement of tmnt bar:

[bar/example]
width = 100%
height = 24pt
radius = 6

; dpi = 96

background = ${colors.background}
foreground = ${colors.foreground}

line-size = 3pt

border-size = 4pt
border-color = #00000000

padding-left = 0
padding-right = 1

module-margin = 1

separator = |
separator-foreground = ${colors.disabled}

font-0 = monospace;2

modules-left = xworkspaces xwindow
modules-right = filesystem pulseaudio xkeyboard memory cpu wlan eth date

cursor-click = pointer
cursor-scroll = ns-resize

enable-ipc = true

; wm-restack = generic
; wm-restack = bspwm
; wm-restack = i3

; override-redirect = true

; This module is not active by default (to enable it, add it to one of the
; modules-* list above).
; Please note that only a single tray can exist at any time. If you launch
; multiple bars with this module, only a single one will show it, the others
; will produce a warning. Which bar gets the module is timing dependent and can
; be quite random.
; For more information, see the documentation page for this module:
; https://polybar.readthedocs.io/en/stable/user/modules/tray.html

And in running polybar inside "bspwmrc" (bspwm). He preserve the run of tmnt bar. And the output suggested me using example bar instead:

error: Uncaught exception, shutting down: Undefined bar: tmnt. Available bars: example

eww continued pending for polybar runs, that i executed for combined eww and polybar yet 👀😭💀.

I decided to create the recommend prospect backup function yet, for build.sh of Termux-ported polybar.

The propect backup of build.sh that i recommended.

termux_step_extra() {
  local PREFIX_LOCAL="/data/data/com.termux/files/usr/"
  local HOME_LOCAL="$(find /data/data/com.termux/files -type d -iname 'home*')"
  local HOME_CACHE="${HOME_LOCAL}/.cache"
  local POLYBAR_BACKUP_DIR="${HOME_LOCAL}/.backup/polybar"

  if [[ ! -f ${HOME_CACHE}/termux ]]; then
       $(printf "${SHELL}\n" | sed -E "s|${PREFIX_LOCAL}/bin/||") -c "mkdir --parent --verbose --mode=755 $HOME/.cache/termux"
  fi

  if [[ ! -f ${POLYBAR_BACKUP_DIR} ]]; then
       $(printf "${SHELL}\n" | sed -E "s|${PREFIX_LOCAL}/bin/||") -c "mkdir --parent --verbose --mode=755 $HOME/.backup/polybar" | tee -a ${HOME_CACHE}/termux/polyCreate.log
  fi

  if [[ -f ${PREFIX_LOCAL}/etc/polybar/config.ini ]]; then
       if [[ -f ${POLYBAR_BACKUP_DIR} ]]; then
            rm --recursive --force --preserve-root --verbose ${POLYBAR_BACKUP_DIR} | tee -a ${HOME_CACHE}/termux/polybar-config-remove.log
       fi

       mv --verbose ${PREFIX_LOCAL}/etc/polybar/config.ini ${POLYBAR_BACKUP_DIR} | sed -E "s|renamed|moved and renamed|g"
       rm --recursive --force --preserve-root --verbose ${PREFIX_LOCAL}/etc/config.ini
       cp --recursive --force --verbose ${POLYBAR_BACKUP_DIR} ${PREFIX_LOCAL}/etc/polybar/config.ini
  fi
}
  1. mkdir would create the "${HOME}/.backup/polybar" directory locally. With it's output resulting their parody of user's dreamed. But without printf or echo, by passing --verbose option/argument.

  2. mv would rename and move your custom config from "${PREFIX}/etc/polybar", into "${HOME}/.backup/polybar". With it's output resulting their parody of user's dreamed. But without printf or echo, by passing --verbose option/argument and executing sed.

  3. rm would recursively remove the example config of Polybar, from "${PREFIX}/etc/polybar". With it's output resulting their parody of user's dreamed. But without printf or echo, by passing --verbose option/argument.

  4. cp would recursively copy your custom config from "${HOME}/.backup/polybar", into "${PREFIX}/etc/polybar". With it's output resulting their parody of user's dreamed. But without printf or echo, by passing --verbose option/argument.

My "bspwmrc" config.

#!/data/data/com.termux/files/usr/bin/bash

# Functions.
function bspwmCommand_check(){
  for bspwmCommand in bspwm; do
    if [[ ! `command -v ${bspwmCommand}` ]]; then
      trap 'echo -ne "Your bspwmRC require installing 'bspwmrc' command.\r\nBecause this is 'rc'-named config that hinted for BSPWM.\r\n \nrun 'pacman -Syy bspwm --noconfirm', to install BSPWM.\r\nAnd run bspwmRC by executing BSPWM ('bspwm').\r\n \nReport your proper issues at https://github.com/baskerville/bspwm.\r\nIf this message respond into you after installing BSPWM\r\n \nExit code: 1.\r\n" && exit 1' EXIT ERR
    fi
  done
}

function bsprun {
  local pinput="${@}"
  local pinput1="${1}"

  if ! pgrep ${pinput1} ;
  then
    ${pinput}&
  fi
}

# System variable.
APP_STARTUP="false"
FIREFOX_STARTUP="false"
GTKCORD_STARTUP="false"
NEOVIM_STARTUP="false"
KITTY_STARTUP="false"
bspUID="$(whoami | sed -E 's|/||')"

# Verify if "bspwm" command is properly exist.
bspwmCommand_check

# BSPWM's proper config.
pgrep -u ${bspUID} -x sxhkd > /dev/null || sxhkd >/dev/null &
pgrep -u ${bspUID} -x picom > /dev/null || picom --backend glx --config ${HOME}/.config/piconfig/piconfig.conf >/dev/null &

bspc monitor -d I II III IV V VI VII VIII IX X
pgrep -u ${bspUID} -x eww > /dev/null || eww -c ${PREFIX}/etc/eww daemon >/dev/null &
${HOME}/.config/polylaunch/polylaunch.sh

pgrep -u ${bspUID} -x cairo-dock > /dev/null || cairo-dock >/dev/null &
FEH_DISPLAY=":0" feh --bg-fill ${HOME}/Downloads/tmnt.jpeg

bspc config border_width         2
bspc config window_gap          12

bspc config top_padding 50
bspc config bottom_padding 10
bspc config left_padding 10
bspc config right_padding 10

bspc config split_ratio          0.52
bspc config borderless_monocle   true
bspc config gapless_monocle      false
bspc config focus_follows_pointer true

bspc config remove_disabled_monitors true
bspc config remove_unplugged_monitors true

if [[ ${APP_STARTUP} == "true" ]]; then
     if [[ ${FIREFOX_STARTUP} == "true" ]]; then
          bspc rule -a Firefox desktop='^1' state=fullscreen follow=on
          sleep 1 && pgrep -x firefox > /dev/null | firefox >/dev/null
     fi

     if [[ ${KITTY_STARTUP} == "true"]]
          bspc rule -a kitty desktop='^1' state=fullscreen follow=on
          sleep 1 && pgrep -x kitty > /dev/null | kitty >/dev/null &
     fi

     if [[ ${NEOVIM_STARTUP} == "true" ]]; then
          bspc rule -a Neovim desktop='^1' follow=on
          sleep 1
     fi

     if [[ ${GTKCORD_STARTUP} == "true" ]]; then
          bsprun gtkcord4 >/dev/null &
          # sleep 1 | uncomment them if you need expanding the application for the trust.
     fi
fi

My "polylaunch.sh".

#!/data/data/com.termux/files/usr/bin/bash
barName="tmnt"
barConfig="${PREFIX}/etc/polybar/config.ini"
polyUID="$(whoami | sed -E 's|/||g')"
# polyRuby_enable="true"
# polyPython_enable="false"

for polyKillall_name in polybar; do
  killall -q ${polyKillall_name}
done

for polyName in polybar; do
  while pgrep -u ${polyUID} -x ${polyName} >/dev/null; do
    #/if [[ ${polyRuby_enable} == "true" ]]; then
    #   ruby <<EndOfRuby
    #      sleep(1)
    #   EndOfRuby
    # elif [[ ${polyPython_enable} == "true" ]]; then
    #  python <<END_OF_PYTHON
    #      #!/data/data/com.termux/files/usr/bin/python
    #      try:
    #        from subprocess import Popen as pyexec, PIPE
    #        from pathlib import Path as gemdir
    #      except ImportError:
    #        from os import system as pyexec
    #        pyversion = "2"
    #      else:
    #        pyversion = "3

    #      def polyrun(pinput):
    #          if pyversion == "3":
    #             pinputTarget = pinput
    #             pathCwd = gemdir.pwd()
    #             pinputBash = f"env --chdir={pathCwd} bash -c '{pinputTarget}'"
    #             runbash = pyexec(pinputBash, stdin=PIPE, stdout=PIPE, stderr=STDOUT, universal_newlines=True)
    #             output, error = runbash.communicate()
    #             print("{0}".format(output))
    #          elif pyversion == "2":
    #             pinputTarget = pinput
    #             pyexec(pinputTarget)

    #       polyCommand = "sleep"
    #       polyCommand += " 1"

    #       polyrun(polyCommand)
    #   END_OF_PYTHON
    # else
      sleep 1
    # fi
 done
 ${polyName} ${barName} --config=${barConfig} >/dev/null &
done 

Major/minor issues. Discussion. And PR, that i stated/cited.

github-colored-logo-FDDF6EB1F0-seeklogo com

What steps will reproduce the bug?

  1. pacman -Syyu --noconfirm.
  2. vim $PREFIX/etc/polybar/config.ini (redirected into nvim through the aliases).
  3. polybar --config=${PREFIX}/etc/polybar/config.ini tmnt >/dev/null & (to check if tmnt bar is recursively exist).

What is the expected behavior?

  1. Run vim command as the determination of "${PREFIX}/etc/polybar/config.ini".
  2. Run polybar command with my prospective argument (received from PID).

Screenshot.

Screenshot_2024-11-16-12-07-45-23_84d3000e3f4017145260f7618db1d683

Screenshot_2024-11-16-12-10-47-92_84d3000e3f4017145260f7618db1d683

Screenshot_2024-11-16-12-14-09-97_84d3000e3f4017145260f7618db1d683

System information

TERMUX_APP_PACKAGE_MANAGER=pacman
TERMUX_APP__APK_FILE=/data/app/~~hjeH8Re2n3RAwEDNs2mSWg==/com.termux-f8fQJHKEh4n36A9wb0udfw==/base.apk
TERMUX_APP__APK_RELEASE=UNKNOWN
TERMUX_APP__APP_VERSION_CODE=1020
TERMUX_APP__APP_VERSION_NAME=0.119.0-b1+monet36+apktool1
TERMUX_APP__DATA_DIR=/data/user/0/com.termux
TERMUX_APP__IS_DEBUGGABLE_BUILD=true
TERMUX_APP__IS_INSTALLED_ON_EXTERNAL_STORAGE=false
TERMUX_APP__PACKAGE_NAME=com.termux
TERMUX_APP__PID=19117
TERMUX_APP__TARGET_SDK=28
TERMUX_VERSION=0.119.0-b1+monet36+apktool1
TERMUX__SE_FILE_CONTEXT=u:object_r:app_data_file:s0:c217,c257,c512,c768
TERMUX__SE_INFO=default:targetSdkVersion=28:complete
TERMUX__SE_PROCESS_CONTEXT=u:r:untrusted_app_27:s0:c217,c257,c512,c768
TERMUX__UID=10473
TERMUX__USER_ID=0
Packages CPU architecture:
aarch64
Subscribed repositories:
# /data/data/com.termux/files/usr/etc/pacman.conf
[main]
Usage = All
Server = https://service.termux-pacman.dev/main/aarch64
Server = https://s3.amazonaws.com/termux-pacman.us/main/aarch64
[x11]
Usage = All
Server = https://service.termux-pacman.dev/x11/aarch64
Server = https://s3.amazonaws.com/termux-pacman.us/x11/aarch64
[root]
Usage = All
Server = https://service.termux-pacman.dev/root/aarch64
Server = https://s3.amazonaws.com/termux-pacman.us/root/aarch64
[tur]
Usage = All
Server = https://service.termux-pacman.dev/tur/aarch64
Server = https://s3.amazonaws.com/termux-pacman.us/tur/aarch64
[tur-continuous]
Usage = All
Server = https://service.termux-pacman.dev/tur-continuous/aarch64
Server = https://s3.amazonaws.com/termux-pacman.us/tur-continuous/aarch64
[tur-multilib]
Usage = All
Server = https://service.termux-pacman.dev/tur-multilib/aarch64
Server = https://s3.amazonaws.com/termux-pacman.us/tur-multilib/aarch64
[gpkg]
Usage = All
Server = https://service.termux-pacman.dev/gpkg/aarch64
Server = https://s3.amazonaws.com/termux-pacman.us/gpkg/aarch64
Updatable packages:
All packages up to date
termux-tools version:
1.44.3
Android version:
14
Kernel build information:
Linux localhost 5.4.254-qgki-gf16166a2f2c5 #1 SMP PREEMPT Thu Sep 5 13:18:55 CST 2024 aarch64 Android
Device manufacturer:
OPPO
Device model:
CPH2529
LD Variables:
LD_LIBRARY_PATH=
LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so
Installed termux plugins:
com.termux.x11 versionCode:14
com.termux.nix versionCode:188036
com.termux.gui versionCode:7
com.termux.styling versionCode:1000
thunder-coding commented 6 days ago

This seems like an AI generated PR/issue. We dont have time to deal with this nuisance. Kindly do some work yourself before submitting AI generated garbage

Maxython commented 6 days ago

Although this issue was most likely generated by AI, the problem described is understandable and can be considered an issue that should be fixed.