From 0cdb05ecf1d677ea6b996fa406ea4317685fd9d8 Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Wed, 21 Apr 2021 02:11:48 +0200 Subject: [PATCH] home: i3: setup bluetooth mouse battery block --- .gitattributes | 1 + home/default.nix | 1 + home/secrets/bluetooth-mouse-mac-address.secret | Bin 0 -> 40 bytes home/secrets/default.nix | 13 +++++++++++++ home/x/i3bar.nix | 7 +++++++ 5 files changed, 22 insertions(+) create mode 100644 home/secrets/bluetooth-mouse-mac-address.secret create mode 100644 home/secrets/default.nix diff --git a/.gitattributes b/.gitattributes index 0fe79d9..62988e9 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,3 @@ secrets/*.secret filter=git-crypt diff=git-crypt secrets/wireguard.nix filter=git-crypt diff=git-crypt +home/secrets/*.secret filter=git-crypt diff=git-crypt diff --git a/home/default.nix b/home/default.nix index 0da2e12..cc7cb84 100644 --- a/home/default.nix +++ b/home/default.nix @@ -3,6 +3,7 @@ imports = [ ./emacs.nix ./flameshot.nix + ./secrets ./tmux.nix ./x ]; diff --git a/home/secrets/bluetooth-mouse-mac-address.secret b/home/secrets/bluetooth-mouse-mac-address.secret new file mode 100644 index 0000000000000000000000000000000000000000..cc6ff3c3207037ddb8d04186e57041211f35b93c GIT binary patch literal 40 ycmV+@0N4KjM@dveQdv+`0PJ~IZsglyd+66Vk)}Ho3lQhVTH$J^xX+x6eFFJesuJ@6 literal 0 HcmV?d00001 diff --git a/home/secrets/default.nix b/home/secrets/default.nix new file mode 100644 index 0000000..71b63a9 --- /dev/null +++ b/home/secrets/default.nix @@ -0,0 +1,13 @@ +{ lib, ... }: +with lib; +{ + options.my.secrets = mkOption { + type = types.attrs; + }; + + config.my.secrets = { + # I'm not sure hiding this is very important, but it *seems* like a bad idea + # to expose this + bluetooth-mouse-mac-address = fileContents ./bluetooth-mouse-mac-address.secret; + }; +} diff --git a/home/x/i3bar.nix b/home/x/i3bar.nix index bd6028d..4ebc301 100644 --- a/home/x/i3bar.nix +++ b/home/x/i3bar.nix @@ -60,6 +60,13 @@ in block = "networkmanager"; primary_only = true; } + { + block = "bluetooth"; + mac = config.my.secrets.bluetooth-mouse-mac-address; + hide_disconnected = true; + # TODO: use format when i3status-rust updates to v0.20 + # format = "{percentage}"; + } { block = "sound"; driver = "pulseaudio";