Add tray indicator for email, upgrade to latest nixpkgs

This commit is contained in:
Konstantin Nazarov 2024-11-02 22:05:34 +00:00
parent 098cc3287c
commit b1c27d9541
Signed by: knazarov
GPG key ID: 4CFE0A42FA409C22
5 changed files with 98 additions and 28 deletions

View file

@ -97,7 +97,7 @@ in {
# Mainly to access SMB shares on local network
services.gvfs = {
enable = true;
package = lib.mkForce pkgs.gnome3.gvfs;
package = lib.mkForce pkgs.gnome.gvfs;
};
# Configure keymap in X11
@ -160,8 +160,9 @@ in {
gthumb
unzip
somafm-cli
yubikey-manager
yubikey-manager-qt
# these packages have some problem with installation now
#yubikey-manager
#yubikey-manager-qt
ripgrep
file
zoom-us
@ -172,7 +173,6 @@ in {
mullvad-vpn
mullvad
usbutils
wf-recorder
xournalpp
dnsutils
graphviz
@ -190,6 +190,7 @@ in {
solc
kdenlive
kooha # screen capture
inotify-tools
# ----------
# mainly needed for npm which decided to play hardball
@ -217,6 +218,8 @@ in {
nodejs
networkmanagerapplet
qpwgraph
];
services.blueman.enable = true;
@ -721,8 +724,14 @@ in {
height = 24;
modules-left = [ "sway/workspaces" "sway/mode" ];
modules-center = [ "sway/window" ];
modules-right = [ "idle_inhibitor" "battery" "clock" "tray" ];
modules-right = [ "custom/maildir" "idle_inhibitor" "battery" "clock" "tray" ];
clock.format = "{:%Y-%m-%d %H:%M}";
"custom/maildir" = {
exec = "${./waybar_maildir.sh} /home/knazarov/Maildir/personal/Inbox/new knazarov";
format = " {} ";
return-type = "json";
};
battery = {
states = {
# good = 95;

View file

@ -222,6 +222,7 @@
(set-face-attribute 'mode-line nil :box nil)
(set-face-attribute 'mode-line-inactive nil :box nil)
(setq mode-line-end-spaces nil)
;; -------- Font --------
@ -273,6 +274,7 @@ Intended for `after-make-frame-functions'."
(use-package which-key
:ensure t
:defer 2
:diminish which-key-mode
:config
(which-key-mode)
(which-key-setup-side-window-bottom)
@ -376,6 +378,7 @@ Intended for `after-make-frame-functions'."
(evil-set-undo-system 'undo-redo)
(evil-define-key 'normal 'global (kbd "<leader>f") 'find-file)
(evil-define-key 'normal 'global (kbd "<leader>d") 'dired-jump)
(evil-define-key 'normal 'global (kbd "<leader>b") 'switch-to-buffer)
(evil-define-key 'normal 'global (kbd "<leader>r") 'consult-ripgrep)
@ -562,6 +565,7 @@ Intended for `after-make-frame-functions'."
:ensure t
:config
(global-org-modern-mode)
(setq org-modern-star 'replace)
)
(setq org-modules '(org-w3m org-bbdb org-bibtex org-docview

View file

@ -11,11 +11,11 @@
]
},
"locked": {
"lastModified": 1725815541,
"narHash": "sha256-wcuqVnH4Y5UY25MX5Vc9HwBKLlD+wDjQjcqmTuBjx/w=",
"lastModified": 1730478096,
"narHash": "sha256-nTH9eT3FDq2BkB+RccSq2UHMWLHbeM6LZX+enhQXvdw=",
"owner": "nix-community",
"repo": "emacs-overlay",
"rev": "618b2f8393cc31d275d5373febf017dc38a0f72f",
"rev": "79547cb5e8968bd1540f01609c1273fe5fb9b53e",
"type": "github"
},
"original": {
@ -29,11 +29,11 @@
"systems": "systems"
},
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"lastModified": 1726560853,
"narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a",
"type": "github"
},
"original": {
@ -69,11 +69,11 @@
]
},
"locked": {
"lastModified": 1725781935,
"narHash": "sha256-o6LRtdpgBTzev9n243Ktu3rn0/qsv0frFyJwU6vJsdE=",
"lastModified": 1730490306,
"narHash": "sha256-AvCVDswOUM9D368HxYD25RsSKp+5o0L0/JHADjLoD38=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "ec4c6928bbacc89cf10e9c959a7a47cbaad95344",
"rev": "1743615b61c7285976f85b303a36cdf88a556503",
"type": "github"
},
"original": {
@ -89,11 +89,11 @@
]
},
"locked": {
"lastModified": 1730155921,
"narHash": "sha256-ZF/zP5CKPh4phvae7TUkd45iBvMomrhwwMfw6NOWHpA=",
"lastModified": 1730504112,
"narHash": "sha256-ruhlb3H98jYnOwxuMbjBFk1SGvHgzS1kbSLV7o6/ZK0=",
"owner": "~knazarov",
"repo": "knazarov.com",
"rev": "8eb740e7e36132fca7e29b14daad038155a7b3d3",
"rev": "340914d6f4416fc2c969c30f67060cb5d1d5cbeb",
"type": "sourcehut"
},
"original": {
@ -104,11 +104,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1725833752,
"narHash": "sha256-RjUtPX46yGjn90wMDtOjZGW+SF1RAbU6b06wWYxibXo=",
"lastModified": 1730501559,
"narHash": "sha256-htEfkJAMAD9eWH4jiPZBMS12W4OEukRsXOsdFSjITko=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "75e28367ac76ff2fa13608fddfc34484e3a7ace3",
"rev": "d0cea61ff94eeb08a8bf09c9cfde6a3529e30370",
"type": "github"
},
"original": {
@ -119,11 +119,11 @@
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1725693463,
"narHash": "sha256-ZPzhebbWBOr0zRWW10FfqfbJlan3G96/h3uqhiFqmwg=",
"lastModified": 1730327045,
"narHash": "sha256-xKel5kd1AbExymxoIfQ7pgcX6hjw9jCgbiBjiUfSVJ8=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "68e7dce0a6532e876980764167ad158174402c6f",
"rev": "080166c15633801df010977d9d7474b4a6c549d7",
"type": "github"
},
"original": {
@ -160,11 +160,11 @@
]
},
"locked": {
"lastModified": 1724107934,
"lastModified": 1725843843,
"narHash": "sha256-huE0MjfQeufYqHD/3DjytnaIPexQoHXVYnZKZetetk0=",
"owner": "~knazarov",
"repo": "q.sh",
"rev": "ec5583ef44f6f7678a99fc084ca5f1aca4183b15",
"rev": "e1b69b417b92e915fdb0d82326e2e9b0368fc59e",
"type": "sourcehut"
},
"original": {
@ -197,11 +197,11 @@
]
},
"locked": {
"lastModified": 1725765163,
"narHash": "sha256-rfd2c47iVSFI6bRYy5l8wRijRBaYDeU7dM8XCDUGqlA=",
"lastModified": 1729999681,
"narHash": "sha256-qm0uCtM9bg97LeJTKQ8dqV/FvqRN+ompyW4GIJruLuw=",
"owner": "Mic92",
"repo": "sops-nix",
"rev": "b68757cd2c3fa66d6ccaa0d046ce42a9324e0070",
"rev": "1666d16426abe79af5c47b7c0efa82fd31bf4c56",
"type": "github"
},
"original": {

View file

@ -5,6 +5,7 @@ if [ "$1" = "mira" ]; then
elif [ "$1" = "framework" ]; then
NIX_SSHOPTS="-t" nixos-rebuild switch --target-host framework --use-remote-sudo --flake `pwd`#framework
elif [ "$1" = "knazarovcom" ]; then
nix flake lock --update-input knazarovcom
nixos-rebuild switch --target-host knazarov.com --use-remote-sudo --flake `pwd`#knazarovcom
elif [ "$1" = "videos" ]; then
nixos-rebuild switch --target-host 107.189.7.30 --use-remote-sudo --flake `pwd`#videos

56
waybar_maildir.sh Executable file
View file

@ -0,0 +1,56 @@
#!/usr/bin/env bash
#
# waybar-maildir.sh - count messages in a maildr (or other) directory
#
# USAGE: waybar-maildir.sh DIRECTORY ACCOUNT_NAME [nonotify]
# "nonotify" is used to prevent multiple identical notification when this script is used in multi-monitor setups
#
# REQUIREMENTS: inotifywait
#
#
#
### Example (partial) ~/.config/waybar/config
#
# "custom/maildir": {
# "exec": "~/.config/waybar/waybar-maildir.sh ~/.maildir/INBOX/new mailaccountname",
# "format": " {}",
# "return-type": "json"
# },
#
### Example (partial) ~/.config/waybar/syles.css
#
# #custom-maildir {
# background-color: #875f00
# }
# mail_dir is the directory we are watching and within which, we are counting contents
# account_name can be used in notify_command as a label for the mail account being watched
mail_dir="${1}"
account_name="${2}"
old_count=0
while [[ -n "$(pgrep waybar)" ]]; do
if [[ ! -d "${mail_dir}" ]]; then
printf -- '{"text":"?"}\n'
sleep 60
fi
count="$(ls "${mail_dir}" | wc -l)"
if [[ "${count}" > 0 ]]; then
printf -- '{"text":"%s","class":"newmail","tooltip":"%s"}\n' "${count}" "${account_name}"
else
printf -- '{"text":"-","tooltip":"%s"}\n' "${account_name}"
fi
old_count="${count}"
# 60-second timeout keeps this from becoming a zombified process when waybar is no longer running
inotifywait -t 60 -qq -e 'create,delete,move' "${mail_dir}"
sleep 1 # Allow directory to settle after new messages
done
unset -v account_name count latest_file mail_dir nonotify notify_command old_count subject