329 lines
8.7 KiB
Nix
329 lines
8.7 KiB
Nix
{ pkgs, lib, config, ... }:
|
|
|
|
let
|
|
|
|
darkenBorder = 0.4;
|
|
col = config.colors;
|
|
|
|
task-activity = with pkgs;
|
|
let
|
|
task = "${pkgs.taskwarrior}/bin/task";
|
|
jq = "${pkgs.jq}/bin/jq";
|
|
timew = "${pkgs.timewarrior}/bin/timew";
|
|
getTaskwarriorDesc = "${task} +ACTIVE export | ${jq} '.[0].description'";
|
|
getTimewarriorDesc =
|
|
"${timew} get dom.active.json | ${jq} '.tags|join(\", \")'";
|
|
in writeScriptBin "task-activity" ''
|
|
#!${stdenv.shell}
|
|
|
|
task +ACTIVE >/dev/null 2>/dev/null
|
|
if [[ $? -eq 0 ]]; then
|
|
# taskwarrior is running
|
|
echo "{ \"text\": \" \", \
|
|
\"tooltip\": $(${getTaskwarriorDesc}) \
|
|
}" | ${jq} --unbuffered --compact-output
|
|
exit 0
|
|
fi
|
|
|
|
if [[ $(${timew} get dom.active) -eq 1 ]]; then
|
|
# Timew is running but taskwarrior is not
|
|
echo "{ \"text\": \" \", \
|
|
\"tooltip\": $(${getTimewarriorDesc}) \
|
|
}" | ${jq} --unbuffered --compact-output
|
|
exit 0
|
|
fi
|
|
|
|
# Nothing is running
|
|
echo "{ \"text\": \"\", \
|
|
\"tooltip\": \"\" \
|
|
}" | ${jq} --unbuffered --compact-output
|
|
'';
|
|
|
|
in {
|
|
home.packages = [ pkgs.firaCodeNerd task-activity ];
|
|
|
|
programs.waybar = {
|
|
enable = true;
|
|
|
|
settings = [{
|
|
layer = "top";
|
|
position = "top";
|
|
|
|
modules-left = [ "sway/workspaces" "sway/mode" "sway/window" ];
|
|
modules-center = [ "clock#time" "clock#date" ];
|
|
modules-right = [ "custom/taskwarrior" "network" "battery" "tray" ];
|
|
|
|
modules = {
|
|
"sway/workspaces" = {
|
|
disable-scroll = true;
|
|
all-outputs = true;
|
|
};
|
|
"sway/mode" = {
|
|
format = "<span foreground='${col.background.hashRgb}'>{}</span>";
|
|
};
|
|
"sway/window" = { tooltip = false; };
|
|
|
|
"clock#time" = {
|
|
interval = 1;
|
|
format = "{:%T}";
|
|
tooltip = false;
|
|
};
|
|
"clock#date" = {
|
|
format = "{:%d.%m.%y}";
|
|
tooltip = false;
|
|
};
|
|
|
|
"custom/taskwarrior" = {
|
|
exec = "${task-activity}/bin/task-activity";
|
|
return-type = "json";
|
|
interval = 1;
|
|
};
|
|
"idle_inhibitor" = {
|
|
format = "{icon}";
|
|
format-icons = {
|
|
activated = " ";
|
|
deactivated = " ";
|
|
};
|
|
tooltip = false;
|
|
};
|
|
"battery" = {
|
|
states = {
|
|
good = 95;
|
|
warning = 30;
|
|
critical = 15;
|
|
};
|
|
format = "{icon} {capacity}%";
|
|
format-charging = " {capacity}%";
|
|
format-plugged = "";
|
|
design-capacity = true;
|
|
format-icons = [ "" "" "" "" "" ];
|
|
tooltip = false;
|
|
};
|
|
"network" = {
|
|
format-wifi = "{essid} ({signalStrength}%) ";
|
|
format-ethernet = "{ifname}: {ipaddr}/{cidr} ";
|
|
format-linked = "{ifname} (No IP) ";
|
|
format-disconnected = "睊 ";
|
|
tooltip = false;
|
|
interval = 5;
|
|
};
|
|
};
|
|
}];
|
|
|
|
style = ''
|
|
* {
|
|
border: none;
|
|
border-radius: 0;
|
|
font-family: FiraCode Nerd Font;
|
|
font-size: 11px;
|
|
min-height: 20px;
|
|
}
|
|
|
|
window#waybar {
|
|
background-color: ${col.background.hashRgb};
|
|
border-bottom: 3px solid ${
|
|
(col.background.darker darkenBorder).hashRgb
|
|
};
|
|
color: ${col.primary.hashRgb};
|
|
}
|
|
|
|
window#waybar.hidden {
|
|
opacity: 0.2;
|
|
}
|
|
|
|
tooltip {
|
|
margin: 0;
|
|
padding: 0;
|
|
background-color: ${col.background.hashRgb};
|
|
color: ${col.primary.hashRgb};
|
|
border: 1px solid ${(col.primary.darker darkenBorder).hashRgb}
|
|
}
|
|
|
|
tooltip label {
|
|
margin: 0;
|
|
padding: 0;
|
|
color: ${col.primary.hashRgb};
|
|
font-weight: bolder;
|
|
}
|
|
|
|
#workspaces button {
|
|
padding: 0 5px;
|
|
background-color: transparent;
|
|
color: #3c3836;
|
|
font-weight: bolder;
|
|
min-width: 20px;
|
|
border-bottom: 3px solid ${
|
|
(col.background.darker darkenBorder).hashRgb
|
|
};
|
|
}
|
|
|
|
#workspaces button.urgent {
|
|
background-color: #fb4934;
|
|
}
|
|
|
|
#workspaces button.current_output {
|
|
color: #928374;
|
|
}
|
|
|
|
#workspaces button.visible {
|
|
color: ${col.background.hashRgb};
|
|
background-color: ${col.backgroundDimmed.hashRgb};
|
|
}
|
|
|
|
#workspaces button.current_output.visible {
|
|
color: #282828;
|
|
background-color: #928374;
|
|
}
|
|
|
|
#workspaces button.current_output.focused {
|
|
background-color: ${col.primary.hashRgb};
|
|
color: ${col.background.hashRgb};
|
|
border-bottom: 3px solid ${(col.primary.darker darkenBorder).hashRgb};
|
|
}
|
|
|
|
#mode {
|
|
background-color: ${col.warn.hashRgb};
|
|
color: ${col.background.hashRgb};
|
|
border-bottom: 3px solid ${(col.warn.darker darkenBorder).hashRgb};
|
|
}
|
|
|
|
#workspaces button:hover {
|
|
background-color: ${col.primary.hashRgb};
|
|
color: ${col.background.hashRgb};
|
|
border-bottom: 3px solid ${(col.primary.darker darkenBorder).hashRgb};
|
|
}
|
|
|
|
#clock,
|
|
#battery,
|
|
#network,
|
|
#mode,
|
|
#custom-taskwarrior {
|
|
padding: 0 10px;
|
|
color: ${col.foregroundDimmed.hashRgb};
|
|
}
|
|
|
|
#custom-taskwarrior {
|
|
padding: 0px 10px 0px 13px;
|
|
margin-right: 10px;
|
|
font-weight: bolder;
|
|
background-color: ${col.yellow.hashRgb};
|
|
color: ${col.background.hashRgb};
|
|
border-bottom: 3px solid ${(col.yellow.darker darkenBorder).hashRgb};
|
|
}
|
|
|
|
#network {
|
|
margin-right: 10px;
|
|
background-color: ${col.foregroundDimmed.hashRgb};
|
|
color: ${col.background.hashRgb};
|
|
border-bottom: 3px solid ${
|
|
(col.foregroundDimmed.darker darkenBorder).hashRgb
|
|
};
|
|
}
|
|
|
|
#network.disconnected {
|
|
padding: 0px 10px 0px 13px;
|
|
background-color: ${col.warn.hashRgb};
|
|
color: ${col.background.hashRgb};
|
|
border-bottom: 3px solid ${(col.warn.darker darkenBorder).hashRgb};
|
|
}
|
|
|
|
#idle_inhibitor {
|
|
padding: 0px 10px 0px 13px;
|
|
margin-right: 10px;
|
|
font-weight: bolder;
|
|
background-color: ${col.foregroundDimmed.hashRgb};
|
|
color: ${col.background.hashRgb};
|
|
border-bottom: 3px solid ${
|
|
(col.foregroundDimmed.darker darkenBorder).hashRgb
|
|
};
|
|
}
|
|
|
|
#idle_inhibitor.activated {
|
|
background-color: ${col.primary.hashRgb};
|
|
border-bottom: 3px solid ${(col.primary.darker darkenBorder).hashRgb};
|
|
}
|
|
|
|
#clock {
|
|
color: ${col.foreground.hashRgb};
|
|
border-bottom: 3px solid transparent;
|
|
}
|
|
|
|
#clock.time {
|
|
font-weight: bolder;
|
|
padding-right: 2px;
|
|
}
|
|
|
|
#clock.date {
|
|
padding-left: 2px;
|
|
}
|
|
|
|
#window,
|
|
#workspaces {
|
|
margin: 0 4px;
|
|
}
|
|
|
|
#window {
|
|
border-bottom: 3px solid transparent;
|
|
}
|
|
|
|
/* If workspaces is the leftmost module, omit left margin */
|
|
.modules-left > widget:first-child > #workspaces {
|
|
margin-left: 0;
|
|
}
|
|
|
|
/* If workspaces is the rightmost module, omit right margin */
|
|
.modules-right > widget:last-child > #workspaces {
|
|
margin-right: 0;
|
|
}
|
|
|
|
#battery {
|
|
background-color: ${col.foregroundDimmed.hashRgb};
|
|
border-bottom: 3px solid ${
|
|
(col.foregroundDimmed.darker darkenBorder).hashRgb
|
|
};
|
|
color: ${col.background.hashRgb};
|
|
}
|
|
|
|
#battery.warning:not(.charging) {
|
|
background-color: ${col.warn.hashRgb};
|
|
border-bottom: 3px solid ${(col.warn.darker darkenBorder).hashRgb};
|
|
}
|
|
|
|
#battery.critical:not(.charging) {
|
|
background-color: ${col.error.hashRgb};
|
|
border-bottom: 3px solid ${(col.error.darker darkenBorder).hashRgb};
|
|
}
|
|
|
|
label:focus {
|
|
background-color: #000000;
|
|
}
|
|
|
|
#tray {
|
|
padding: 0 10px;
|
|
}
|
|
|
|
#tray menu {
|
|
background-color: ${col.background.hashRgb};
|
|
color: ${col.primary.hashRgb};
|
|
border: 1px solid ${col.primary.hashRgb};
|
|
padding: 0;
|
|
margin: 10px;
|
|
font-weight: bold;
|
|
}
|
|
|
|
#tray menu menuitem {
|
|
border-bottom: 1px solid #3c3836;
|
|
}
|
|
|
|
#tray menu menuitem:last-child {
|
|
border-bottom: none;
|
|
}
|
|
|
|
#tray menu menuitem:hover {
|
|
background-color: ${col.primary.hashRgb};
|
|
color: ${col.background.hashRgb};
|
|
}
|
|
'';
|
|
};
|
|
}
|