no hypr folder + waybar cclock, nx_gcal_event
This commit is contained in:
240
home-modules/waybar.nix
Normal file
240
home-modules/waybar.nix
Normal file
@@ -0,0 +1,240 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
./nx-gcal-event.nix
|
||||
];
|
||||
|
||||
home.packages = with pkgs; [
|
||||
waybar
|
||||
|
||||
(pkgs.writeShellScriptBin "waybar_mode" ''
|
||||
#!/usr/bin/env bash
|
||||
print_help() {
|
||||
echo "Usage: waybar_mode {set <string>|unset}"
|
||||
}
|
||||
if [ $# -lt 1 ]; then
|
||||
print_help; exit 1;
|
||||
fi
|
||||
case "$1" in
|
||||
set)
|
||||
# Check if there is a second argument for the 'set' operation
|
||||
if [ $# -eq 2 ]; then
|
||||
echo "$2" > /tmp/waybar-mode
|
||||
pkill -RTMIN+8 waybar
|
||||
else
|
||||
echo "Error: 'set' operation requires exactly one string argument."
|
||||
print_help
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
unset)
|
||||
echo "" > /tmp/waybar-mode
|
||||
pkill -RTMIN+8 waybar
|
||||
;;
|
||||
*)
|
||||
echo "Error: Unknown command '$1'"
|
||||
print_help
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
exit 0
|
||||
'')
|
||||
(pkgs.writeShellScriptBin "cclock" ''
|
||||
#!/bin/bash
|
||||
#ord=$(date +"%e" | awk '{printf("%d%s\n", $1, substr("thstndrd", ($1%100-20)%10*2+1, 2))}')
|
||||
ord=$(date +"%e" | awk '{printf("%d%s\n", $1, ($1==11||$1==12||$1==13)?"th":((($1%10)==1)?"st":((($1%10)==2)?"nd":((($1%10)==3)?"rd":"th"))))}')
|
||||
if [ $# -eq 0 ]; then
|
||||
echo " $(date +'%A the')" "$ord" "of" "$(date +'%B')" " " "$(date +'%R')"
|
||||
elif [ "$1" = "--no-icons" ]; then
|
||||
echo "$(date +'%A the')" "$ord" "of" "$(date +'%B')" "$(date +'%R')"
|
||||
fi
|
||||
'')
|
||||
|
||||
];
|
||||
|
||||
programs.waybar = {
|
||||
enable = true;
|
||||
settings = {
|
||||
bar = {
|
||||
height = 20;
|
||||
layer = "top";
|
||||
position = "bottom";
|
||||
margin-top = 0;
|
||||
margin-left = 0;
|
||||
margin-bottom = 0;
|
||||
padding-bottom = 0;
|
||||
margin-right = 0;
|
||||
spacing = 10;
|
||||
modules-left = [
|
||||
"cpu"
|
||||
"memory"
|
||||
"wireplumber"
|
||||
"backlight"
|
||||
"battery"
|
||||
"network"
|
||||
"hyprland/window"
|
||||
];
|
||||
modules-center = [
|
||||
"hyprland/workspaces"
|
||||
];
|
||||
modules-right = [
|
||||
"custom/mode"
|
||||
"custom/ctimeremaining"
|
||||
"custom/cclock"
|
||||
"tray"
|
||||
];
|
||||
"hyprland/workspaces" = {
|
||||
on-click = "activate";
|
||||
format = "{name}";
|
||||
all-outputs = false;
|
||||
active-only = false;
|
||||
};
|
||||
"hyprland/window" = {
|
||||
format = "{}";
|
||||
separate-outputs = true;
|
||||
};
|
||||
"custom/cclock" = {
|
||||
exec = "cclock";
|
||||
restart-interval = 60;
|
||||
};
|
||||
"custom/ctimeremaining" = {
|
||||
exec = "nx_gcal_event lookup";
|
||||
restart-interval = 60;
|
||||
};
|
||||
"custom/mode" = {
|
||||
exec = "cat /tmp/waybar-mode";
|
||||
interval = "once";
|
||||
signal = 8;
|
||||
};
|
||||
|
||||
cpu = {
|
||||
interval = 1;
|
||||
format = " {}%";
|
||||
max-length = 10;
|
||||
};
|
||||
memory = {
|
||||
interval = 5;
|
||||
format = " {avail:.0f}G free";
|
||||
};
|
||||
battery = {
|
||||
interval = 60;
|
||||
tooltip = false;
|
||||
format = "{icon} {capacity}%";
|
||||
states = {
|
||||
warning = 25;
|
||||
critical = 10;
|
||||
};
|
||||
format-icons = [
|
||||
" "
|
||||
" "
|
||||
" "
|
||||
" "
|
||||
" "
|
||||
];
|
||||
format-charging = "{icon} +{capacity}%";
|
||||
format-plugged = "{icon} P{capacity}%";
|
||||
format-full = "{icon} F{capacity}%";
|
||||
};
|
||||
backlight = {
|
||||
device = "DP-1";
|
||||
format = "{icon} {percent}%";
|
||||
format-icons = [
|
||||
""
|
||||
""
|
||||
""
|
||||
""
|
||||
""
|
||||
""
|
||||
""
|
||||
""
|
||||
""
|
||||
];
|
||||
};
|
||||
network = {
|
||||
format-wifi = "直 {essid}";
|
||||
format-ethernet = " Wired";
|
||||
format-disconnected = "睊 Disconnected";
|
||||
};
|
||||
wireplumber = {
|
||||
format = " {volume}%";
|
||||
format-muted = "婢 Muted";
|
||||
};
|
||||
};
|
||||
};
|
||||
style = ''
|
||||
* {
|
||||
font-family: Atkinson Hyperlegible, Caskaydia Cove NF, Noto Sans;
|
||||
font-weight: bold;
|
||||
font-size: 1.01em;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
window#waybar {
|
||||
background-color: rgba(0, 0, 0, 0.85);
|
||||
transition-duration: 0.5s;
|
||||
padding: 0.1em 1em;
|
||||
padding-top: 0.1em;
|
||||
border: 0px solid transparent;
|
||||
}
|
||||
|
||||
#clock,
|
||||
#custom-cclock,
|
||||
#custom-ctimeremaining,
|
||||
#custom-mode,
|
||||
#battery,
|
||||
#cpu,
|
||||
#tray,
|
||||
#disk,
|
||||
#backlight,
|
||||
#network,
|
||||
#wireplumber,
|
||||
#memory,
|
||||
#window,
|
||||
#workspaces {
|
||||
padding: 0px 3px;
|
||||
margin-top: 0.3em;
|
||||
border-radius: 0.8em;
|
||||
color: white;
|
||||
}
|
||||
|
||||
#window {
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
#workspaces button {
|
||||
color: grey;
|
||||
padding: 0px 10px;
|
||||
margin: 1px;
|
||||
border-radius: 0.2em;
|
||||
border: 0px solid transparent;
|
||||
}
|
||||
|
||||
#workspaces button.focused {
|
||||
background-color: darkred;
|
||||
}
|
||||
|
||||
#workspaces button:hover {
|
||||
background-color: green;
|
||||
}
|
||||
|
||||
#workspaces button.active {
|
||||
color: white;
|
||||
}
|
||||
|
||||
#workspaces button.urgent {
|
||||
background-color: darkorchid;
|
||||
}
|
||||
|
||||
#custom-mode {
|
||||
color: crimson;
|
||||
}
|
||||
|
||||
#cpu {
|
||||
margin-left: 0.5em;
|
||||
}
|
||||
'';
|
||||
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user