Update for waybar

This commit is contained in:
2025-10-09 22:40:38 -07:00
parent d7fbed68bf
commit 5b551a4075
5 changed files with 31 additions and 7 deletions

View File

@ -38,6 +38,9 @@ PID can be a string or a number."
(setq args (nconc (list "-c" cfg-dir) args)))
(apply 'call-process "eww" nil 0 nil args)))
(defun update-waybar ()
(call-process "pkill" nil 0 nil "-RTMIN+1" "waybar"))
(cl-defun has-focused-window-p (&optional (server "server"))
"Return non-nil if SERVER has at least one focused window.
SERVER defaults to \"server\"."
@ -50,7 +53,8 @@ SERVER defaults to \"server\"."
"org.fcitx.Fcitx.Controller1" "Toggle")
(let ((state (dbus-call-method :session "org.fcitx.Fcitx5" "/controller"
"org.fcitx.Fcitx.Controller1" "State")))
(set-eww-fcitx-state state)))
(set-eww-fcitx-state state)
(update-waybar)))
;; Local Variables:
;; flycheck-disabled-checkers: (emacs-lisp-checkdoc)

View File

@ -1,4 +1,11 @@
#!/usr/bin/env zsh
let greather_than_zero=0
if [[ "${1}" == '-g' ]]; then
greather_than_zero=1
fi
lines=(${(f)"$(mu find '(maildir:/protonmail/Inbox or maildir:/ucsc-gmail/Inbox) AND flag:unread' 2>/dev/null)"})
printf '%d' "${#lines}"
if [[ ${#lines} > 0 ]] || ! (( greather_than_zero )); then
printf '%d' "${#lines}"
fi

View File

@ -1,5 +1,10 @@
#!/usr/bin/env zsh
let bluetooth=1
if [[ "${1}" == '--no-bluetooth' ]] || [[ "${1}" == '-n' ]]; then
bluetooth=0
fi
if [[ "$(uname)" = 'Linux' ]]; then
local active_networks="$(nmcli --fields type c s --active)"
local output=''
@ -7,7 +12,9 @@ if [[ "$(uname)" = 'Linux' ]]; then
[[ "${active_networks}" = *'ethernet'* ]] && output="${output}󰈁"
[[ "${active_networks}" = *'wireguard'* ]] && output="${output}󰖂 "
(( ${#output} == 0 )) && output='󰈂'
if (( bluetooth )); then
bluetoothctl show | grep 'Powered: yes' >/dev/null && output="${output}  "
fi
printf '%s\n' "${output}"
else
echo "${0}: error: unknown os: \"$(uname)\"" >&2

View File

@ -19,7 +19,9 @@ local entries=('Select system sound output' 'select-sound-output.sh' 'true'
'Configure USB device access' 'usbguard-menu.py' 'pgrep usbguard-daemon'
'Power settings (restart and shutdown)' 'system-power-menu.sh' 'true'
'Login to captive portal protected WiFi' 'login-to-wifi.sh' 'is-laptop-p'
'Restart top bar' 'river-restart-eww.sh' '[[ "${XDG_CURRENT_DESKTOP}" == river ]]')
# I'm not using eww right now
# 'Restart top bar' 'river-restart-eww.sh' '[[ "${XDG_CURRENT_DESKTOP}" == river ]]'
)
local entry_array=()
local enabled_entries=()

View File

@ -18,9 +18,12 @@ case "${choice}" in
0)
if [[ "${swayidle_state}" == 'Disabled' ]]; then
local cmd_cache=(${(0)"$(<"${CACHE_PATH}")"})
{
set -x
cd "${cmd_cache[1]}"
exec ${=${cmd_cache[2]}}
} &
disown
fi
;;
1)
@ -37,6 +40,7 @@ esac
if [[ "${XDG_CURRENT_DESKTOP}" == 'river' ]]; then
eww -c "${HOME}/.config/river/config/" update swayidle="$(( ! ${choice} ))"
pkill -RTMIN+3 waybar
elif [[ "${XDG_CURRENT_DESKTOP}" == 'Hyprland' ]]; then
pkill -SIGRTMIN+1 waybar
fi