After the installation of Arch Linux I decided to use WMFS Windows Manager as windows manager. In the wiki you can find a statusbar configuration section but for me it doesn’t work.
So I tried to write a configuration status.sh file, you can find it in /home/user/.config/wmfs/ directory otherwise you can create it.
- To setup time and date:The date and time is simply determinated with the command date that you can set using the follow syntax ( for a more complete command syntax see this post or type man date on the terminal ):
> %y – to print the abbreviated year (%Y for full year);
> %b – to print the abbreviated month name (%B for full month name);
> %m – to print the current month number;
> %d – to print the current day number;
> %a – to print the current day of the week;
> %H – to print the hour in 24h format;
> %I – to print the hour in 12h format (use %p to print AM or PM);
> %M – to print the minutes;
> %S – to print the seconds;
To use it in the configuration script is necessary to create a function to print, an example is mine here:
- To setup power status:
The power status is determinable by two different ways: the first is using acpi command and the second is through the informations on power and energy located in /sys/class/power_supply/BAT0/.
- USING ACPI
Installing the package acpi and using the namesake command. It will give to you all the information as in the example here:
I have two batteries but for only one is the same. So if you want, for example, to select only the percentage or the time remaining to complete charge (or complete discharge) you need just to use grep and awk commands as follow:
So to use in the script I wrote a function for each battery that look like follow:
- ALTERNATIVE METHOD If you don't want to use acpi for some reasons I wrote a script that do the same thing but it can be simply setting by the user. It take power data from the directory /sys/class/power_supply/BAT0/ and through simple physics consideration it will print current capacity, time to full charge/discharge. The script for the "Battery 0" is the follow:
- USING ACPI
- To setup capslock flag:
The caps lock in the windows manager bar is very useful if you don't have a led on keyboard that indicates the status of it (like Lenovo T440s as mine). To do that we will use the command xset with the option 'q' that print out status information about all I/O hardwares. So if you type xset -q the result will be almost the follow:
where in the 3rd line there is a flag with value "00000000", when the capslock is disable and equal to "00000001" when it is enable. So using this command and with grep and awk is possible to select the flag and easy to print a string ('ON' or 'OFF') in the statusbar. My script to do that is:
Now you need to edit the file ~/.config/wmfs/status.sh (or create it if do not exist) and use all the below stuff. To print out in the WMFS (as indicates the wiki) the command is:
So to use the functions below:
where the TIMING is to set the frequency to execute script in the while. You are free to setup wmfs command following the wiki and just change the part under quotes (like "Nibble" in my case).