1

Topic: Need help fixing (creating) a script for Dwmblocks

Hi all .

Please tell me how to correctly connect the scripts (each of them works correctly, attached below)
so that I have one script that shows this information in the bar:


[ 60%  192.168.0.1   ]

# Shows wifi  and percent strength as well as local ip and vpn is not active 

[  192.168.0.1   ]

# Same thing but with ethernet

[ 60%  10.10.0.1   ]

# Shows wifi and percent strength, as well as public ip and vpn is active 

 [  192.168.0.1  ]

  # Same thing but with ethernet

[睊  ]

  # When there is no wifi or ethernet connection, the bar should display these icons.


I hope the icons are displayed correctly. I used "awesome" icons

 


ip_local
#=============#

ip="$(ip a | grep .255 | grep -v wlp | cut -d' ' -f6 | sed 's/\/24//')"

echo $ip

ip_public
#=============#

#PREFIX=' '

get_pub_ip()
{
#    echo "$PREFIX$(curl -s ifconfig.co)"
echo "$PREFIX$(wget -qO - ident.me)"
}

get_pub_ip


network_status
#=============#

network() {
wire="$(ip a | grep 'eth0\|enp' | grep inet | wc -l)"
wifi="$(ip a | grep wl  | grep inet | wc -l)"

if [ $wire = 1 ]; then
    echo " "
elif [ $wifi = 1 ]; then
    echo " "
else
    echo "睊"
fi
}

echo "$(network)"


wifi_signal_indicator
#=====================#

# Show wifi   and percent strength or   if none.
# Show   if connected to ethernet or   if none.
# Show   if a vpn connection is active

case $BLOCK_BUTTON in
        1) "$TERMINAL" -e nmtui; pkill -RTMIN+4 dwmblocks ;;
        3) notify-send "🌐 Internet module" "\- Click to connect
睊: wifi disabled
 : no wifi connection
 : wifi connection with quality
 : no ethernet
 : ethernet working
 : vpn is active
" ;;
        6) "$TERMINAL" -e "$EDITOR" "$0" ;;
esac

if grep -xq 'up' /sys/class/net/w*/operstate 2>/dev/null ; then
        wifiicon="$(awk '/^\s*w/ { print " ", int($3 * 100 / 70) "% " }' /proc/net/wireless)"
elif grep -xq 'down' /sys/class/net/w*/operstate 2>/dev/null ; then
        grep -xq '0x1003' /sys/class/net/w*/flags && wifiicon="睊"|| wifiicon="睊"
fi

printf "[%s%s%s]\n" "$wifiicon" "$(sed "s/down/  /;s/up/  /" /sys/class/net/e*/operstate 2>/dev/null)" "$(sed "s/.*/  /" /sys/class/net/tun*/operstate 2>/dev/null)"

2

Re: Need help fixing (creating) a script for Dwmblocks

Sorry, but you have not provided anything more so someone could check that. We do not provide dwmblocks. As far from my understanding and information there is not even a stable tarball available for dwmblocks, so we are here at some git-version. Am I right?

Human being in favor with clear principles and so also for freedom in soft- and hardware!

Certainly anyone who has the power to make you believe absurdities has the power to make you commit injustices: For a life of every being full with peace and kindness, including diversity and freedom. Capitalism is destroying our minds, the planet itself and the universe in the end!

3

Re: Need help fixing (creating) a script for Dwmblocks

Hello . Thank you for your answer . Do you mean you didn't provide a complete build of my config?
I'm setting up dwmblocks myself and I need a script

4

Re: Need help fixing (creating) a script for Dwmblocks

I was interested how you setup dwmblocks, especially if you did an own PKGBUILD. smile
Please remember that if people help you, they need also your testing- and setup-grounds. If you do not provide the sources, nobody here is able to help or replicate the issues and solve them. So that's a nice meant point: Please share all back. Thanks!

Hyperbola is not meant to only grant a free and libre system, it is meant as community-work.

Human being in favor with clear principles and so also for freedom in soft- and hardware!

Certainly anyone who has the power to make you believe absurdities has the power to make you commit injustices: For a life of every being full with peace and kindness, including diversity and freedom. Capitalism is destroying our minds, the planet itself and the universe in the end!

5

Re: Need help fixing (creating) a script for Dwmblocks

Hello . Yes, now I'm setting it up, but for now I'm in the process of setting it up and as soon as I finish it I'll definitely show it. Let users use it.

I have not conducted comparative tests, but it seems to me that HyperbolaGNU and DWM  are an excellent option in terms of minimalism and RAM usage.

If someone knows better, write)

I would like to make an adjustment to the script.

I think this option would be better (example below)

I'm looking for a solution, if anyone can help, I'll be grateful since I'm doing this for us.


Show wifi  ,networks name and percent strength or 睊 if none ,local ip,
status vpn connection (  vpn is no active , vpn is active )

[ 65% DWM 192.168.0.1  ]

[ 65% DWM  Budapest ]

Show  if connected to ethernet or  if none, public ip,
status vpn connection (  vpn is no active , vpn is active )

[ DWM 192.168.0.1  ]

[ DWM  Budapest ]

no ethernet,no wifi connection

[ 睊  ]

6

Re: Need help fixing (creating) a script for Dwmblocks

Please take into perspective that no one can help you within this, when you don't provide all sources in usage. Beginning with: Which version of dwmblocks did you use? Which repository? Which build-flags? Patches for that corresponding project? Exactly out of this reasoning I have asked and said before: We do not provide a package for dwmblocks as there is no stable tarball-download towards my knowledge and exactly therefore we have now this point in the thread as you asked for help, but personal I don't see myself able as I have not more than those scripts and some notes. But the essential information is missing, as noted.

If someone else reading and having clues, that's fine. smile
But as said: You would need to provide more data aside your personal scripts.

Human being in favor with clear principles and so also for freedom in soft- and hardware!

Certainly anyone who has the power to make you believe absurdities has the power to make you commit injustices: For a life of every being full with peace and kindness, including diversity and freedom. Capitalism is destroying our minds, the planet itself and the universe in the end!

7

Re: Need help fixing (creating) a script for Dwmblocks

Hello . Thank you for your answer . Got you, ok.
I downloaded dwmblocks from github and installed it with the command (I wrote below )

To set up a bar there are many different sources, there are ready-made solutions https://github.com/joestandring/dwm-bar, https://github.com/UtkarshVerma/dwmblocks-async https://github.com/ronniedroid/.dotfiles  or the user can independently set up his bar using different options or scripts, etc.

Since HyperbolaGNU lacks a large number of programs, it is impossible to take someone else’s build and copy it; it simply will not work correctly, despite the fact that Arch Linux may have the largest community on this topic.

git clone https://git.suckless.org/dwm

git clone https://git.suckless.org/st

git clone https://git.suckless.org/dmenu
cd .suckless

cd dwm
make
doas make clean install
cd
сd st
make
doas make clean install
cd ..
cd dmenu
make
doas make clean install

git clone https://github.com/torrinfail/dwmblocks.git #then cd into the dwmblocks
cd dwmblocks

make
doas make install

I also find it very useful to use ROFI https://www.hyperbola.info/packages/extra/i686/rofi/, it will add to the graphics))

Some configuration examples https://github.com/dctxmei/rofi-themes

dwm - dynamic window manager
============================
dwm is an extremely fast, small, and dynamic window manager for X.

8

Re: Need help fixing (creating) a script for Dwmblocks

Thanks, much appreciated. With those information people will have better insights into. And I find it a pity that we are not able to include dwmblocks as I had thought more than once about its inclusion. Thanks also for pointing on rofi: I need to rework the PKGBUILD a bit, so this will come next for sure. smile

Human being in favor with clear principles and so also for freedom in soft- and hardware!

Certainly anyone who has the power to make you believe absurdities has the power to make you commit injustices: For a life of every being full with peace and kindness, including diversity and freedom. Capitalism is destroying our minds, the planet itself and the universe in the end!