Some changes
This commit is contained in:
parent
f40f9f5277
commit
ee1321e857
@ -1,6 +1,57 @@
|
||||
#!/bin/sh
|
||||
if [ "${#}" -gt 0 ]; then
|
||||
config_flags="-c ${1}"
|
||||
fi
|
||||
fcitx5-remote -t
|
||||
eww ${config_flags} update fcitx5-state="$(fcitx5-remote)"
|
||||
#!/usr/bin/env -S emacs -x
|
||||
;; -*- mode: emacs-lisp; lexical-binding: t -*-
|
||||
(require 'cl-lib)
|
||||
(require 'server)
|
||||
(require 'dbus)
|
||||
|
||||
(defun cmdline-for-pid (pid)
|
||||
"Return the command line arguments passed to PID.
|
||||
PID can be a string or a number."
|
||||
(butlast (string-split
|
||||
(with-temp-buffer
|
||||
(insert-file-contents-literally
|
||||
(format "/proc/%s/cmdline" pid))
|
||||
(buffer-substring-no-properties (point-min)
|
||||
(point-max)))
|
||||
"\0")))
|
||||
(defun current-eww-config-dir ()
|
||||
"Return the configuration directory for a currently running eww process."
|
||||
;; This probably only works on Linux
|
||||
(catch 'found
|
||||
(dolist (subdir (directory-files "/proc"))
|
||||
(when (string-match-p (rx bos (+ num) eos) subdir)
|
||||
(ignore-error permission-denied
|
||||
(let* ((attrs (file-attributes (format "/proc/%s/exe" subdir)))
|
||||
(type (file-attribute-type attrs)))
|
||||
(when (and (stringp type)
|
||||
(string-match-p (rx (or bos "/") "eww") type))
|
||||
(cl-maplist (lambda (tail)
|
||||
(when (equal (car tail) "-c")
|
||||
(throw 'found (cl-second tail))))
|
||||
(cmdline-for-pid subdir)))))))))
|
||||
|
||||
(defun set-eww-fcitx-state (state)
|
||||
"Set the Fcitx state for Eww to STATE."
|
||||
(let ((args (list "update" (format "fcitx5-state=%s" state)))
|
||||
(cfg-dir (current-eww-config-dir)))
|
||||
(when cfg-dir
|
||||
(setq args (nconc (list "-c" cfg-dir) args)))
|
||||
(apply 'call-process "eww" nil 0 nil args)))
|
||||
|
||||
(cl-defun has-focused-window-p (&optional (server "server"))
|
||||
"Return non-nil if SERVER has at least one focused window.
|
||||
SERVER defaults to \"server\"."
|
||||
(server-eval-at
|
||||
server '(cl-some 'frame-focus-state (frame-list))))
|
||||
|
||||
(if (has-focused-window-p)
|
||||
(server-eval-at "server" '(my/global-toggle-mozc))
|
||||
(dbus-call-method :session "org.fcitx.Fcitx5" "/controller"
|
||||
"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)))
|
||||
|
||||
;; Local Variables:
|
||||
;; flycheck-disabled-checkers: (emacs-lisp-checkdoc)
|
||||
;; End:
|
||||
|
@ -1,17 +1,4 @@
|
||||
#!/usr/bin/env -S emacs -x
|
||||
;;; -*- mode: emacs-lisp; lexical-binding: t -*-
|
||||
(require 'server)
|
||||
(princ
|
||||
(condition-case _
|
||||
(if-let ((modeline-string (server-eval-at "server" '(mu4e--modeline-string)))
|
||||
((string-match "\\([0-9]+\\)\\((\\+[0-9]+)\\)?/[0-9]+ $" modeline-string))
|
||||
(matched-string (match-string 1 modeline-string)))
|
||||
(progn
|
||||
(set-text-properties 0 (length matched-string)
|
||||
nil
|
||||
matched-string)
|
||||
matched-string)
|
||||
"0")
|
||||
(error
|
||||
"0")))
|
||||
(terpri)
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
lines="${(f)$(mu find 'maildir:/protonmail/Inbox AND flag:unread' 2>/dev/null)}"
|
||||
printf '%d' "${#lines}"
|
||||
|
@ -24,10 +24,12 @@ function notify_vol {
|
||||
local icon
|
||||
if [[ "$(pamixer --get-mute)" == 'true' ]]; then
|
||||
icon=''
|
||||
elif (( ${vol} > 50 )); then
|
||||
elif (( ${vol} >= 50 )); then
|
||||
icon=''
|
||||
elif (( ${vol} >= 0 )); then
|
||||
elif ((${vol} > 0)); then
|
||||
icon=''
|
||||
elif ((${vol} == 0)); then
|
||||
icon=''
|
||||
else
|
||||
icon='?'
|
||||
fi
|
||||
|
@ -14,11 +14,11 @@ function has-rootful-xwayland-p {
|
||||
|
||||
function run {
|
||||
# ensure multiple instances do not run
|
||||
mkdir -p "$(dirname "${LOCKFILE}")"
|
||||
mkdir -p "${LOCKFILE:h}"
|
||||
exec 4<>"${LOCKFILE}"
|
||||
flock -n 4 || exit 0
|
||||
dunstctl set-paused true
|
||||
if has-rootful-xwayland-p; then
|
||||
if [[ "${XDG_CURRENT_DESKTOP}" == 'river' ]] && has-rootful-xwayland-p; then
|
||||
swaylock ${empty_flag} --color '#000000'
|
||||
else
|
||||
swayidle -w -C /dev/null \
|
||||
|
@ -2,4 +2,13 @@
|
||||
|
||||
local resp="$(printf 'No\nYes\n' | fuzzel --dmenu --prompt 'Really Logout> ')"
|
||||
|
||||
[[ "${resp}" == 'Yes' ]] && riverctl exit
|
||||
if [[ "${resp}" == 'Yes' ]]; then
|
||||
case "${XDG_CURRENT_DESKTOP}" in
|
||||
Hyprland)
|
||||
hyprctl dispatch exit
|
||||
;;
|
||||
river)
|
||||
riverctl exit
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
@ -36,3 +36,9 @@ case "${choice}" in
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ "${XDG_CURRENT_DESKTOP}" == 'river' ]]; then
|
||||
eww -c "${HOME}/.config/river/config/" update swayidle="$(( ! ${choice} ))"
|
||||
elif [[ "${XDG_CURRENT_DESKTOP}" == 'Hyprland' ]]; then
|
||||
pkill -SIGRTMIN+1 waybar
|
||||
fi
|
||||
|
Loading…
x
Reference in New Issue
Block a user