moving from i3block to i3status-rust

This commit is contained in:
Dmitriy Holkin 2020-02-07 03:09:25 +04:00
parent 54eb40c7f5
commit 8e60e31b34
6 changed files with 128 additions and 1 deletions

View File

@ -22,7 +22,8 @@
./workspace/fonts.nix
./workspace/gtk.nix
./workspace/i3
./workspace/i3blocks
# ./workspace/i3blocks
./workspace/i3status-rust
./workspace/kde
./workspace/light.nix
./workspace/locale.nix

View File

@ -0,0 +1,88 @@
{ pkgs, config, lib, ... }:
with rec {
inherit (config) device deviceSpecific;
};
with deviceSpecific;
with import ../../../support.nix { inherit pkgs config lib; };
let scripts = import ./scripts pkgs config;
in {
home-manager.users.alukard.xsession.windowManager.i3.extraConfig = ''
bar {
id top
font pango:Roboto Mono 11, FontAwesome 11
mode dock
hidden_state hide
position top
status_command ${pkgs.i3status-rust}/bin/i3status-rs $HOME/.config/i3status-rust/config.toml
workspace_buttons yes
strip_workspace_numbers no
tray_output primary
colors {
background ${config.themes.colors.bg}
statusline ${config.themes.colors.fg}
separator ${config.themes.colors.alt}
focused_workspace ${config.themes.colors.bg} ${config.themes.colors.bg} ${config.themes.colors.blue}
active_workspace ${config.themes.colors.bg} ${config.themes.colors.bg} ${config.themes.colors.green}
inactive_workspace ${config.themes.colors.bg} ${config.themes.colors.bg} ${config.themes.colors.fg}
urgent_workspace ${config.themes.colors.bg} ${config.themes.colors.bg} ${config.themes.colors.orange}
binding_mode ${config.themes.colors.bg} ${config.themes.colors.bg} ${config.themes.colors.yellow}
}
}
'';
home-manager.users.alukard.xdg.configFile."i3status-rust/config.toml".text = ''
theme = "slick"
icons = "awesome"
[[block]]
block = "net"
'' + lib.optionals (device == "Dell-Laptop") ''
device = "wlo1"
'' + lib.optionals (isLaptop) ''
[[block]]
block = "battery"
interval = 10
format = "{percentage}% {time}"
[[block]]
block = "backlight"
'' + ''
[[block]]
block = "custom"
command = "${scripts.weather}"
interval = 600
[[block]]
block = "music"
buttons = ["play", "next"]
[[block]]
block = "sound"
[[block]]
block = "cpu"
interval = 1
format = "{utilization}% {frequency}GHz"
[[block]]
block = "memory"
display_type = "memory"
format_mem = "{MAg}GiB"
format_swap = "{SFg}GiB"
[[block]]
block = "custom"
command = "${scripts.df}"
interval = 60
[[block]]
block = "custom"
command = "${scripts.vpn-status}"
interval = 600
[[block]]
block = "time"
interval = 60
format = "%a %Y/%m/%d %T"
'';
}

View File

@ -0,0 +1,17 @@
p: c:
with p;
builtins.mapAttrs (name: value:
writeTextFile {
inherit name;
text = callPackage value {
iconfont = "FontAwesome 11";
config = c;
};
executable = true;
checkPhase =
"${bash}/bin/bash -n $src";
}) {
weather = ./weather.nix;
df = ./df.nix;
vpn-status = ./vpn-status.nix;
}

View File

@ -0,0 +1,4 @@
{ ... }: ''
#!/usr/bin/env bash
echo $(sudo btrfs fi usage / | grep "Free" | awk '{print $3}')
''

View File

@ -0,0 +1,9 @@
{ curl, ... }: ''
#!/usr/bin/env bash
API="$(${curl}/bin/curl https://am.i.mullvad.net/connected)"
if [[ $(echo "$API" | awk -F'[ ()]+' '{print $6}') = 'server' ]]; then
echo $(echo "$API" | awk -F'[ ()]+' '{print $7}')
else
echo 'Not connected'
fi
''

View File

@ -0,0 +1,8 @@
{ bash, config, curl, ... }: ''
#!/usr/bin/env bash
${curl}/bin/curl wttr.in/Volzhskiy\?format=3 | awk -F": " '{print $2}'
if [[ $BLOCK_BUTTON == 1 ]]
then
${config.defaultApplications.term.cmd} --hold -e "${curl}/bin/curl wttr.in"
fi
''