Skip to main content

sway status

 old 

 #DATE=$(date "+ %a-%b-%d-%Y  %I:%M %S%p")                                                                                                                                                  
#date=$(date "+%I:%M%p")                                                                                                                                                                     
                                                                                                                                                                                             
#bstat=$(head -c 1 /sys/class/power_supply/BAT0/status)                                                                                                                                      
#bper=$(cat  /sys/class/power_supply/BAT0/capacity)                                                                                                                                          
                                                                                                                                                                                             
                                                                                                                                                                                             
#vol=$( wpctl get-volume @DEFAULT_AUDIO_SINK@ | cut -d : -f 2)                                                                                                                               
#vol=${vol##*0.}%                                                                                                                                                                            
                                                                                                                                                                                             
#wifi="$(awk '/^\s*w/ { print "wifi", int($3 * 100 / 70) "% " }' /proc/net/wireless)"                                                                                                        
                                                                                                                                                                                             
                                                                                                                                                                                             
#kblay=$(swaymsg -t get_inputs | grep -m1 'xkb_active_layout_name' |  awk -F '"' '{print $4}'| head -c 3)                                                                                    
                                                                                                                                                                                             
#bness="$(brightnessctl get)"                                                                                                                                                                
#max="$(brightnessctl max)"                                                                                                                                                                  
#bperc="$((bness*100/max))"                                                                                                                                                                  
                                                                                                                                                                                             
#echo  $kblay $bperc $vol  $bstat$bper%  $date

 

json bar

 -----------------------------

#!/bin/sh

bg_bar_color="#282A36"

separator() {
  echo -n "{"
  echo -n "\"full_text\"\"\":," # CTRL+Ue0b2
  echo -n "\"separator\":false,"
  echo -n "\"separator_block_width\":0,"
  echo -n "\"border\":\"$bg_bar_color\","
  echo -n "\"border_left\":0,"
  echo -n "\"border_right\":0,"
  echo -n "\"border_top\":2,"
  echo -n "\"border_bottom\":2,"
  echo -n "\"color\":\"$1\","
  echo -n "\"background\":\"$2\""
  echo -n "}"
}



common() {
  echo -n "\"border\": \"$bg_bar_color\","
  echo -n "\"separator\":false,"
  echo -n "\"separator_block_width\":0,"
  echo -n "\"border_top\":2,"
  echo -n "\"border_bottom\":2,"
  echo -n "\"border_left\":0,"
  echo -n "\"border_right\":0"
}

battery0() {
  if [ -f /sys/class/power_supply/BAT0/uevent ]; then
    local bg="#D69E2E"
1
    bg_separator_previous=$bg
    prct=$(cat /sys/class/power_supply/BAT0/capacity)
    charging=$(cat /sys/class/power_supply/BAT0/status)
    icon=""   
    if [ "$charging" == "Charging" ]; then
      icon=""
    fi
    echo -n ",{"
    echo -n "\"name\":\"battery0\","
    echo -n "\"full_text\":\" ${icon} ${prct}% \","
    echo -n "\"color\":\"#000000\","
    echo -n "\"background\":\"$bg\","
    common
    echo -n "},"
  else
    bg_separator_previous="#E0E0E0"
  fi
}

mydate() {
  local bg="#E0E0E0"
  separator $bg "#546E7A"
  echo -n ",{"
  echo -n "\"name\":\"id_time\","
  echo -n "\"full_text\":\"  $(date "+%a %d/%m %H:%M") \","
  echo -n "\"color\":\"#000000\","
  echo -n "\"background\":\"$bg\","
  common
  echo -n "},"
}


volume() {
  local bg="#673AB7"
  separator $bg $bg_separator_previous  
  vol=$(wpctl get-volume @DEFAULT_AUDIO_SINK@ | cut -d : -f 2)
  echo -n ",{"
  echo -n "\"name\":\"id_volume\","
  if [ $vol -le 0 ]; then
    echo -n "\"full_text\":\"  ${vol}% \","
  else
    echo -n "\"full_text\":\"  ${vol}% \","
  fi
  echo -n "\"background\":\"$bg\","
  common
  echo -n "},"
  separator $bg_bar_color $bg
}

logout() {
  echo -n ",{"
  echo -n "\"name\":\"id_logout\","
  echo -n "\"full_text\":\"  \""
  echo -n "}"
}


# Send the header so that i3bar knows we want to use JSON:
echo '{ "version": 1 , "click_events":true,"cont_signal": 18,"stop_signal": 19}'

# Begin the endless array.
echo '['

# We send an empty first array of blocks to make the loop simpler:
echo '[]'

# launched in a background process
while :;
do
echo -n ",["
  mydate
  battery0
  volume
  logout
echo "]"
    sleep 10

done

# click events
while read line;
do
   echo $line > /tmp/tmp.txt
  # on click, we get from STDIN :
   {"name":"id_time","button":1,"modifiers":["Mod2"],"x":2982,"y":9,"relative_x":67,"relative_y":9,"width":95,"height":22}

  # DATE click
  if [[ $line == *"name"*"id_time"* ]]; then
    foot /home/kai/.config/sway/click_time.sh &
  fi  

  # VOLUME
  elif [[ $line == *"name"*"id_volume"* ]]; then
    foot  alsamixer &

elif [[ $line == *"name"*"id_logout"* ]]; then
    swaynag -t warning -m 'Log out ?' -b 'yes' 'i3-msg exit' > /dev/null &

fi
done 

--------------------------------- 


for alsa

vol=$(amixer get Master | sed -En 's/.*\[([0-9]+)%\].*/\1/p')

for debian pipewire

 vol=$(pulsemixer --get-volume | cut -d ' ' -f 1)

 

https://github.com/i3/i3/blob/next/contrib/trivial-bar-script.sh

https://en.jeffprod.com/blog/2020/create-your-own-i3-sway-status-bar/

https://github.com/Tazeg/i3status/blob/master/i3status/mybar.sh

 

 

for mouse press 

cat /tmp/tmp.txt
,{ "name": "id_volume", "button": 1, "event": 272, "x": 1878, "y": 0, "relative_x": 57, "relative_y": 0, "width": 79, "height": 23, "scale": 1 }

 

{
	"name": "clock",
	"instance": "edt",
	"x": 1900,
	"y": 10,
	"button": 1,
	"event": 274,
	"relative_x": 100,
	"relative_y": 8,
	"width": 120,
	"height": 18
}
 
left click = event 272 , button 1 
middle click= event274, button 2  
right click = event 273, button 3
scroll up = event 768 , button 4
scroll down = event 769 , button 5
scroll left = event 770 , button 6
scroll right = event 771 , button 7
 
button  
 
 
 new status.sh 
 
 #!/bin/bash

bg_bar_color="#000000"

common() {
echo -n "\"border\": \"$bg_bar_color\","
echo -n "\"separator_block_width\":0,"
}

battery0() {
local bg="#D69E2E"
prct=$(cat /sys/class/power_supply/BAT0/capacity)
chrg=$(cat /sys/class/power_supply/BAT0/status)
icon=""
case $chrg in
"Charging") icon="";bg="#0000ff"; ;;
"Not charging") icon="";bg="#ff0000" ;;
"Unknown") icon="";bg="ff00ff" ;;
"Full") icon="⚡"; bg="ffff00" ;;
esac
echo -n "{"
echo -n "\"name\":\"battery0\","
echo -n "\"full_text\":\" ${icon}${prct}\","
echo -n "\"color\":\"#000000\","
echo -n "\"background\":\"$bg\","
common
echo -n "},"
}

mydate() {
local bg="#E0E0E0"
echo -n "{"
echo -n "\"name\":\"id_time\","
echo -n "\"full_text\":\"  $(date "+%a %d/%m %H:%M") \","
echo -n "\"color\":\"#000000\","
echo -n "\"background\":\"$bg\","
common
echo -n "},"
}

volume() {
local bg="#673AB7"
vol=$(wpctl get-volume @DEFAULT_AUDIO_SINK@ | cut -d : -f 2)
echo -n "{"
echo -n "\"name\":\"id_volume\","
echo -n "\"background\":\"$bg\","
echo -n "\"full_text\":\"  ${vol}% \","
common
echo -n "},"
}

logout() {
echo -n "{"
echo -n "\"name\":\"id_logout\","
echo -n "\"full_text\":\"  \","
echo -n '"align": "left"'
echo -n "}"
}

echo '{ "version": 1 , "click_events":true}'
echo '[[],'
while :;
do
echo -n "["
mydate
battery0
volume
echo -n "],"

sleep 1

read line
echo $line >/tmp/tmp.txt
done


 status.sh

DATE=$(date "+%a-%b-%d-%Y %I:%M%p")

BATSTAT=$(cat /sys/class/power_supply/BAT0/status)
BATPERC=$(cat /sys/class/power_supply/BAT0/capacity)

VSTAT="$(amixer get Master)"
VMUTE=" "
echo "$VSTAT" | grep "\[off\]" >/dev/null && VMUTE="muted"
VOLUME=$(echo "$VSTAT" | grep -o "\[[0-9]\+%\]" | sed "s/[^0-9]*//g;1q")

WIFI="$(awk '/^\s*w/ { print "", int($3 * 100 / 70) "% " }' /proc/net/wireless)"

KBLAYOUT=$(swaymsg -t get_inputs | grep -m1 'xkb_active_layout_name' |  awk -F '"' '{print $4}')

BNESS="$(brightnessctl get)"
MAX="$(brightnessctl max)"
BLPERC="$((BNESS*100/MAX))"
NIGHT=
pgrep wlsunset && NIGHT=

echo  $KBLAYOUT $NIGHT $BLPERC  $VMUTE $VOLUME  $WIFI   $BATPERC% $BATSTAT $DATE
 

 

bar {
      position top
 #swaybar_command waybar
 status_command while ~/.config/sway/status.sh; do sleep 1; done
       
}



.......
#!/bin/sh

printf "{\"version\":1}\n"
printf "[\n"
while true
do
	printf "["
	printf "{\"full_text\":\"%s\"}," "$(makoctl list | jq -r '.data[0][0].summary.data | select(type == "string")')"
	printf "{\"full_text\":\"%s\"}," "$(swaymsg -t get_inputs | jq -r '[.[] | select(.type == "keyboard")][0].xkb_active_layout_name')"
	printf "{\"full_text\":\"%s\"}," "$(cat /sys/class/power_supply/BAT0/capacity)"
	printf "{\"full_text\":\"%s\"}," "$(date +%c)"
	printf "],"
	timeout 1 swaymsg -t subscribe '["input","binding"]' >/dev/null
done
 
 
 
The range of available signal numbers is 1 to N, where SIGRTMIN+N = SIGRTMAX.
(Note: there are 31 real-time signals in Linux.) 


Comments

Popular posts from this blog

sxhkd volume andbrightness config for dwm on void

xbps-install  sxhkd ------------ mkdir .config/sxhkd cd .config/sxhkd nano/vim sxhkdrc -------------------------------- XF86AudioRaiseVolume         amixer -c 1 -- sset Master 2db+ XF86AudioLowerVolume         amixer -c 1 -- sset Master 2db- XF86AudioMute         amixer -c 1 -- sset Master toggle alt + shift + Escape         pkill -USR1 -x sxhkd XF86MonBrightnessUp          xbacklight -inc 20 XF86MonBrightnessDown          xbacklight -dec 20 ------------------------------------------------------------- amixer -c card_no -- sset Interface volume run alsamixer to find card no and interface names xbps-install -S git git clone https://git.suckless.org/dwm xbps-install -S base-devel libX11-devel libXft-devel libXinerama-devel  vim config.mk # FREETYPEINC = ${X11INC}/freetype2 #comment for non-bsd make clean install   cp config.def.h config.h vim config.h xbps-install -S font-symbola #for emoji on statusbar support     void audio config xbps-i

Hidden Wiki

Welcome to The Hidden Wiki New hidden wiki url 2015 http://zqktlwi4fecvo6ri.onion Add it to bookmarks and spread it!!! Editor's picks Bored? Pick a random page from the article index and replace one of these slots with it. The Matrix - Very nice to read. How to Exit the Matrix - Learn how to Protect yourself and your rights, online and off. Verifying PGP signatures - A short and simple how-to guide. In Praise Of Hawala - Anonymous informal value transfer system. Volunteer Here are five different things that you can help us out with. Plunder other hidden service lists for links and place them here! File the SnapBBSIndex links wherever they go. Set external links to HTTPS where available, good certificate, and same content. Care to start recording onionland's history? Check out Onionland's Museum Perform Dead Services Duties. Introduction Points Ahmia.fi - Clearnet search engine for Tor Hidden Services (allows you

download office 2021 and activate

get office from here  https://tb.rg-adguard.net/public.php open powershell as admin (win+x and a ) type cmd  goto insall dir 1.         cd /d %ProgramFiles(x86)%\Microsoft Office\Office16 2.           cd /d %ProgramFiles%\Microsoft Office\Office16 try 1 or 2 depending on installation  install volume license  for /f %x in ('dir /b ..\root\Licenses16\ProPlus2021VL_KMS*.xrm-ms') do cscript ospp.vbs /inslic:"..\root\Licenses16\%x" activate using kms cscript ospp.vbs /setprt:1688 cscript ospp.vbs /unpkey:6F7TH >nul cscript ospp.vbs /inpkey:FXYTK-NJJ8C-GB6DW-3DYQT-6F7TH cscript ospp.vbs /sethst:s8.uk.to cscript ospp.vbs /act Automatic script (windefender may block it) ------------------------------------------------------------------------------------------------------------------- @echo off title Activate Microsoft Office 2021 (ALL versions) for FREE - MSGuides.com&cls&echo =====================================================================================&