diff --git a/eww/eww-fcitx5-toggle b/eww/eww-fcitx5-toggle index 1d1bc5d..f1f74bd 100755 --- a/eww/eww-fcitx5-toggle +++ b/eww/eww-fcitx5-toggle @@ -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) diff --git a/eww/eww-mu4e-messages b/eww/eww-mu4e-messages index 21864c8..6cca648 100755 --- a/eww/eww-mu4e-messages +++ b/eww/eww-mu4e-messages @@ -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 diff --git a/eww/eww-network b/eww/eww-network index 834b63b..2ea8745 100755 --- a/eww/eww-network +++ b/eww/eww-network @@ -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='󰈂' - bluetoothctl show | grep 'Powered: yes' >/dev/null && output="${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 diff --git a/system-menu/system-menu.sh b/system-menu/system-menu.sh index f74d6a9..ecd8245 100755 --- a/system-menu/system-menu.sh +++ b/system-menu/system-menu.sh @@ -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=() diff --git a/system-menu/system-sleep-menu.sh b/system-menu/system-sleep-menu.sh index 607d5b2..7649e6e 100755 --- a/system-menu/system-sleep-menu.sh +++ b/system-menu/system-sleep-menu.sh @@ -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]}} + { + 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