Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a default status bar script #98

Open
avahe-kellenberger opened this issue Sep 18, 2020 · 11 comments
Open

Create a default status bar script #98

avahe-kellenberger opened this issue Sep 18, 2020 · 11 comments
Assignees

Comments

@avahe-kellenberger
Copy link
Owner

It would be nice to have a default/example script.

@dakyskye will assist with a bash version, I should probably also write one in Nim.

@avahe-kellenberger avahe-kellenberger self-assigned this Sep 18, 2020
@PMunch
Copy link
Collaborator

PMunch commented Sep 18, 2020

I just put xsetroot -name "$(date)" in a script and then put watch -n1 -p settime.sh in my startup programs which just gives me a clock in the corner. This would also serve to let people know about the status bar output thing.

@dakyskye
Copy link
Contributor

What should the default status bar script show as a status, except time and date?

@avahe-kellenberger
Copy link
Owner Author

Time, date, volume, network name/status.

I think we could add additional script examples for mem and cpu, but it shouldn't be the default

@PMunch
Copy link
Collaborator

PMunch commented Sep 22, 2020

How about a folder of scriptlets in a folder named like eg. the xinitrc.d files, so prefixed with a two digit number determining the order to be run in. Then a simple script that just sorts all the scripts in the folder and runs them every N seconds separating their output with |. This way it would be easy for people to throw in new stuff or modify which things they don't want (could also do the whole available folder thing with symlinks into an enabled folder).

@avahe-kellenberger
Copy link
Owner Author

I think for now we'll just create an example or two so people can see how setting the status is done - In the future if we want to create a system like this to make setting the status simpler, we can

@avahe-kellenberger
Copy link
Owner Author

@dakyskye I'm still wanting this added if you have recommendations - if not I'll add something very simple.

Would be nice to have a whole guide to put on the wiki, as well.

@dakyskye
Copy link
Contributor

Sorry, I was assigned to this task, but I've had no free time. I am still very busy. To my mind the default status bar should show these info: date, time, keyboard layout, battery state (if present).

@lf-araujo
Copy link

This is an excellent window manager, however for a less competent linux user it is very hard to set the status bar with simple info like (date, time, keyboard layout, battery state). Could someone share their config so I can use it, until recommended instructions are up in the Wiki?

Many thanks

@dakyskye
Copy link
Contributor

dakyskye commented Jul 21, 2021

This is an excellent window manager, however for a less competent linux user it is very hard to set the status bar with simple info like (date, time, keyboard layout, battery state). Could someone share their config so I can use it, until recommended instructions are up in the Wiki?

Many thanks

I will show you two of my statusbars: this and that.

To put what you said on the statusbar the script would look like (totally untested):

#!/bin/bash

while true; do
	DATE="$(date '+%a %d.%m.%Y')"

	LAYOUT="$(xkblayout-state print %s)"
	
	BATTERY_INFO="$(upower -i /org/freedesktop/UPower/devices/DisplayDevice)"
	BATTERY_STATE="$(echo "$BATTERY_INFO" | grep state | awk '{ print $2; }')"
	BATTERY_LEVEL="$(echo "$BATTERY_INFO" | grep percentage | awk '{ print $2; }')"

	xsetroot -name "$DATE | $LAYOUT | $BATTERY_STATE ($BATTERY_LEVEL)"
	sleep 1s
done

@Ordained-SubGenii
Copy link

similar to script provided by @dakyskye, you could use a bash script like this to get statusbar as shown in pic. This will only show battery charging state if its not charging and uses command from pw-volume package (https://github.com/smasher164/pw-volume)

``#!/usr/bin/bash

red=$'\e[31m'
green=$'\e[32m'
blue=$'\e[34m'
magenta=$'\e[35m'
cyan=$'\e[36m'
white=$'\e[0m'
green_redbak=$'\e[32;41;'

while true; do

DATE="$(date '+%a %D %R')"	
BATCHRG_TEST="$(cat /sys/class/power_supply/BAT0/status)"
if [[ ! $BATCHRG_TEST =~ "NO" ]]; then
	BATTERY_STATE=$BATCHRGTEST
fi

BATTERY_LEVEL="$(cat /sys/class/power_supply/BAT0/capacity)"  
    WIFI_STATE="$(cat /sys/class/net/wlo1/operstate)" 
while read vol; do
	printf -v VOL "%sVol:%s$vol%%"  
done < <(pw-volume status | awk -F[:,] '{print$2}')

xsetroot -name ""wifi:" $WIFI_STATE | $VOL | "Batt:"$BATTERY_STATE${white}($BATTERY_LEVEL"%") | ${cyan}$DATE"
sleep 60s

done"

Screenshot-2022-10-10_20:55:13

You can also incorporate standlone statusbar programs like polybar, yabar, rsblocks, etc by adding the path to launch such bars in the exec section of nimdow's config.toml

@avahe-kellenberger
Copy link
Owner Author

We should test these scripts on desktop machines (that obviously don't have batteries) and make sure everything still looks decent. Also, using as little dependencies as possible, such as pw-volume etc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants