Merge branch 'i3blocks'

This commit is contained in:
thek4n 2025-10-23 20:00:23 +03:00
commit 7c763d62e3
5 changed files with 156 additions and 8 deletions

View File

@ -11,7 +11,8 @@ ssh:
git:.config/git .local/bin/ga
ranger:.config/ranger
gpg:
i3:.xinitrc .xprofile .Xresources .config/i3 .config/i3status .local/bin/i3status_wrapper .config/rofi .config/picom .local/bin/slm .local/bin/slm_rofi.sh .local/bin/power_rofi.sh .local/bin/i3_switch_workspace.sh .config/mimeapps.list .local/bin/screenshot .local/bin/i3_swap_workspaces
i3:.xinitrc .xprofile .Xresources .config/i3 .config/i3blocks .config/rofi .config/picom .local/bin/slm .local/bin/slm_rofi.sh .local/bin/power_rofi.sh .local/bin/i3_switch_workspace.sh .config/mimeapps.list .local/bin/screenshot .local/bin/i3_swap_workspaces .local/bin/i3blocks_helper %pomodoro
pomodoro:
bat:.config/bat
font:
termux:.termux

View File

@ -12,6 +12,7 @@ set $i3lock_cmd "i3lock -enf -c 1e1e1e"
exec --no-startup-id xset s off
exec --no-startup-id xset +dpms dpms 600 600 600
exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock -enf -c 1e1e1e
exec --no-startup-id pomodoro daemon
# Notifications
@ -35,10 +36,10 @@ set $font_size 11
font xft:FiraCode $font_size
# use pactl to adjust volume in PulseAudio.
set $refresh_i3status killall -SIGUSR1 i3status
bindsym XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +10% && $refresh_i3status
bindsym XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -10% && $refresh_i3status
bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status
set $refresh_i3blocks killall -10 i3blocks
bindsym XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +10% && $refresh_i3blocks
bindsym XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -10% && $refresh_i3blocks
bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3blocks
bindsym XF86AudioPlay exec playerctl play-pause
bindsym XF86AudioPause exec playerctl play-pause
@ -52,8 +53,8 @@ bindsym XF86MonBrightnessDown exec xbacklight -dec 20
bindsym $mod+z exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ 0 ## Hold to talk
bindsym --release $mod+z exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ 1 ## Release to mute
bindsym $mod+Shift+z exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3status
bindsym XF86AudioMicMute exec pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3status
bindsym $mod+Shift+z exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3blocks
bindsym XF86AudioMicMute exec pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3blocks
bindsym XF86PickupPhone exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ 0 ## Hold to talk
bindsym --release XF86PickupPhone exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ 1 ## Release to mute
@ -225,11 +226,11 @@ bar {
output primary
output nonprimary
tray_output primary
status_command exec ~/.local/bin/i3status_wrapper
# disable scroll
bindsym button4 nop
bindsym button5 nop
status_command i3blocks
}
bindsym Print exec --no-startup-id screenshot select copy

View File

@ -0,0 +1,56 @@
separator_block_width=15
markup=none
color=#FFFFFF
interval=5
[wireless]
command=i3blocks_helper wireless
interval=10
[ethernet]
command=i3blocks_helper ethernet
interval=10
[diskroot]
command=i3blocks_helper disk_root
interval=30
[diskhome]
command=i3blocks_helper disk_home
interval=30
[memory]
command=i3blocks_helper memory
interval=5
[cpu_usage]
command=i3blocks_helper cpu_usage
interval=5
[cpu_temp]
command=i3blocks_helper cpu_temp
interval=5
[bluetooth]
command=i3blocks_helper bluetooth_battery
interval=5
[battery]
command=i3blocks_helper battery
interval=5
[volume]
command=i3blocks_helper volume
interval=1
signal=10
[pomodoro]
command=pomodoro formatted
interval=1
signal=10
[time]
command=env LC_ALL=C date '+ %d.%m.%y %a  %H:%M'
interval=5

View File

@ -0,0 +1,87 @@
#!/bin/sh
set -ue
readonly EXIT_SUCCESS=0
readonly EXIT_FAILURE=1
cmd_wireless() {
return 0 # todo 
}
cmd_ethernet() {
return 0 # todo
echo "$(LANG=C nmcli -t -f active,ssid dev wifi | grep '^yes' | cut -d: -f2) $(ip -o -4 addr show | awk '{print $4}' | cut -d/ -f1 | head -1)"
}
cmd_battery() {
return 0 # todo
}
cmd_disk_root() {
df -h / | awk '/\// {print "/ "$2"/"$3}'
}
cmd_disk_home() {
res="$(df -h /home)"
if [ "$(echo "${res}" | awk '/\// {print $6}')" != "/home" ]; then
return 1
fi
df -h /home | awk '/\// {print " "$2"/"$3}'
}
cmd_memory() {
free -h | awk '/^Mem/ {print " "$3"/"$2}' | sed 's/i//g'
}
cmd_cpu_usage() {
top -bn1 | grep "Cpu(s)" | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | awk '{print " "100 - $1"%"}'
}
cmd_cpu_temp() {
temp_mC="$(cat /sys/class/thermal/thermal_zone0/temp)"
temp_C="$((temp_mC / 1000))"
if [ "${temp_C}" -gt 80 ]; then
echo " ${temp_C}°C"
exit 33 # bad
else
echo " ${temp_C}°C"
fi
}
cmd_time() {
LC_ALL=C date '+ %d.%m.%y %a  %H:%M'
}
cmd_volume() {
amixer get Master | awk -F'[][]' '/%/ {print " "$2}' | head -n 1
}
cmd_pomodoro() {
pomodoro formatted
}
cmd_bluetooth_battery() {
return 0
}
case "${1}" in
wireless) shift; cmd_wireless "$@" ;;
ethernet) shift; cmd_ethernet "$@" ;;
battery) shift; cmd_battery "$@" ;;
disk_root) shift; cmd_disk_root "$@" ;;
disk_home) shift; cmd_disk_home "$@" ;;
memory) shift; cmd_memory "$@" ;;
cpu_usage) shift; cmd_cpu_usage "$@" ;;
cpu_temp) shift; cmd_cpu_temp "$@" ;;
time) shift; cmd_time "$@" ;;
volume) shift; cmd_volume "$@" ;;
pomodoro) shift; cmd_pomodoro "$@" ;;
bluetooth_battery) shift; cmd_bluetooth_battery "$@" ;;
*) exit "${EXIT_FAILURE}" ;;
esac
exit "${EXIT_SUCCESS}"

View File

@ -0,0 +1,3 @@
#!/bin/sh
GOPROXY=direct go install github.com/thek4n/pomodoro/cmd/pomodoro@latest