diff options
author | Aspen Smith <root@gws.fyi> | 2024-03-31T16·54-0400 |
---|---|---|
committer | aspen <root@gws.fyi> | 2024-03-31T19·32+0000 |
commit | 35a96b47d5f4decfd58c152fa69dd629d64e7c38 (patch) | |
tree | 411dd0187a4b41649e07ea5dde0988cc10abf4bc /users/aspen/system | |
parent | d706ebda657909211ca0089d575888a6ec94c426 (diff) |
feat(aspen/system): Weather in i3status bar r/7831
Change-Id: Ib2572fea5fc81d6b4d321a2e317a02398d0ae612 Reviewed-on: https://cl.tvl.fyi/c/depot/+/11292 Tested-by: BuildkiteCI Reviewed-by: aspen <root@gws.fyi> Autosubmit: aspen <root@gws.fyi>
Diffstat (limited to 'users/aspen/system')
-rw-r--r-- | users/aspen/system/home/modules/i3.nix | 218 | ||||
-rw-r--r-- | users/aspen/system/system/modules/fonts.nix | 1 |
2 files changed, 111 insertions, 108 deletions
diff --git a/users/aspen/system/home/modules/i3.nix b/users/aspen/system/home/modules/i3.nix index 58ec3d281460..f91527da44ea 100644 --- a/users/aspen/system/home/modules/i3.nix +++ b/users/aspen/system/home/modules/i3.nix @@ -1,5 +1,7 @@ { config, lib, pkgs, ... }: let + inherit (config.lib) depot; + mod = "Mod4"; solarized = import ../common/solarized.nix; # TODO pull this out into lib @@ -7,16 +9,112 @@ let msg=$(emacsclient --eval '${eval}' 2>&1) echo "''${msg:1:-1}" ''; - screenlayout = { - home = pkgs.writeShellScript "screenlayout_home.sh" '' - xrandr \ - --output eDP-1 --mode 1920x1200 --pos 0x960 --rotate normal \ - --output DP-3 --primary --mode 3840x2160 --pos 1920x0 --rotate normal \ - --output DP-1 --off \ - --output DP-2 --off \ - --output DP-4 --off - ''; - }; + + i3status-conf = pkgs.writeText "i3status.conf" '' + general { + output_format = i3bar + colors = true + color_good = "#859900" + + interval = 1 + } + + order += "external_script current_task" + order += "external_script inbox" + order += "spotify" + order += "weather_owm" + order += "volume_status" + order += "wireless ${config.system.machine.wirelessInterface}" + # order += "ethernet enp3s0f0" + order += "cpu_usage" + ${lib.optionalString (!isNull config.system.machine.battery) '' + order += "battery ${toString config.system.machine.battery}" + ''} + # order += "volume master" + order += "time" + order += "tztime utc" + + mpd { + format = "%artist - %album - %title" + } + + wireless ${config.system.machine.wirelessInterface} { + format_up = "W: (%quality - %essid - %bitrate) %ip" + format_down = "W: -" + } + + ethernet enp3s0f0 { + format_up = "E: %ip" + format_down = "E: -" + } + + battery ${toString config.system.machine.battery} { + format = "%status %percentage (%remaining)" + path = "/sys/class/power_supply/BAT%d/uevent" + low_threshold = 10 + } + + cpu_usage { + format = "CPU: %usage" + } + + load { + format = "%5min" + } + + time { + format = " %a %h %d ⌚ %I:%M " + } + + spotify { + color_playing = "#fdf6e3" + color_paused = "#93a1a1" + format_stopped = "" + format_down = "" + format = "{title} - {artist} ({album})" + } + + external_script inbox { + script_path = '${emacsclient "(aspen/num-inbox-items-message)"}' + format = 'Inbox: {output}' + cache_timeout = 120 + color = "#93a1a1" + } + + external_script current_task { + script_path = '${ + emacsclient "(aspen/org-current-clocked-in-task-message)" + }' + # format = '{output}' + cache_timeout = 60 + color = "#93a1a1" + } + + tztime utc { + timezone = "UTC" + format = " %H·%M " + } + + volume_status { + format = "☊ {percentage}" + format_muted = "☊ X" + # device = "default" + # mixer_idx = 0 + } + + weather_owm { + api_key = '@owmApiKey@' + unit_temperature = 'c' + format = '{icon} {temperature}[ {rain}]' + } + ''; + + i3status-command = pkgs.writeShellScript "i3status.sh" '' + sed -s "s/@owmApiKey@/$(pass owm-api-key)/" \ + < ${i3status-conf} \ + > /tmp/i3status.conf + py3status -c /tmp/i3status.conf + ''; inherit (builtins) map; inherit (lib) mkMerge range; @@ -60,7 +158,7 @@ in home.packages = with pkgs; [ rofi rofi-pass - python3Packages.py3status + depot.users.aspen.pkgs.py3status i3lock i3status dconf # for gtk @@ -179,10 +277,6 @@ in # Screen Layout "${mod}+Shift+t" = "exec xrandr --auto"; - "${mod}+t" = "exec ${screenlayout.home}"; - "${mod}+Ctrl+t" = "exec ${pkgs.writeShellScript "fix_term.sh" '' - xrandr --output eDP-1 --off && ${screenlayout.home} - ''}"; # Notifications "${mod}+Shift+n" = "exec killall -SIGUSR1 .dunst-wrapped"; @@ -224,99 +318,7 @@ in }; bars = [{ - statusCommand = - let - i3status-conf = pkgs.writeText "i3status.conf" '' - general { - output_format = i3bar - colors = true - color_good = "#859900" - - interval = 1 - } - - order += "external_script current_task" - order += "external_script inbox" - order += "spotify" - order += "volume_status" - order += "wireless ${config.system.machine.wirelessInterface}" - # order += "ethernet enp3s0f0" - order += "cpu_usage" - ${lib.optionalString (!isNull config.system.machine.battery) '' - order += "battery ${toString config.system.machine.battery}" - ''} - # order += "volume master" - order += "time" - order += "tztime utc" - - mpd { - format = "%artist - %album - %title" - } - - wireless ${config.system.machine.wirelessInterface} { - format_up = "W: (%quality - %essid - %bitrate) %ip" - format_down = "W: -" - } - - ethernet enp3s0f0 { - format_up = "E: %ip" - format_down = "E: -" - } - - battery ${toString config.system.machine.battery} { - format = "%status %percentage" - path = "/sys/class/power_supply/BAT%d/uevent" - low_threshold = 10 - } - - cpu_usage { - format = "CPU: %usage" - } - - load { - format = "%5min" - } - - time { - format = " %a %h %d ⌚ %I:%M " - } - - spotify { - color_playing = "#fdf6e3" - color_paused = "#93a1a1" - format_stopped = "" - format_down = "" - format = "{title} - {artist} ({album})" - } - - external_script inbox { - script_path = '${emacsclient "(aspen/num-inbox-items-message)"}' - format = 'Inbox: {output}' - cache_timeout = 120 - color = "#93a1a1" - } - - external_script current_task { - script_path = '${emacsclient "(aspen/org-current-clocked-in-task-message)"}' - # format = '{output}' - cache_timeout = 60 - color = "#93a1a1" - } - - tztime utc { - timezone = "UTC" - format = " %H·%M " - } - - volume_status { - format = "☊ {percentage}" - format_muted = "☊ X" - # device = "default" - # mixer_idx = 0 - } - ''; - in - "py3status -c ${i3status-conf}"; + statusCommand = "${i3status-command}"; inherit fonts; position = "top"; colors = with solarized; rec { diff --git a/users/aspen/system/system/modules/fonts.nix b/users/aspen/system/system/modules/fonts.nix index 46c7667538de..598336790a2d 100644 --- a/users/aspen/system/system/modules/fonts.nix +++ b/users/aspen/system/system/modules/fonts.nix @@ -5,6 +5,7 @@ nerdfonts noto-fonts-emoji twitter-color-emoji + weather-icons ]; fontconfig.defaultFonts.emoji = [ "Twitter Color Emoji" ]; |