split waybar into multiple files

This commit is contained in:
Lucy Hochkamp 2025-10-06 21:29:04 +02:00
parent 53c7532351
commit 7cff7f09c3
No known key found for this signature in database
29 changed files with 953 additions and 617 deletions

View file

@ -13,7 +13,7 @@ in
programs.bash = {
# auto spawn fish if interactive
interactiveShellInit = ''
if [[ $(${pkgs.procps}/bin/ps --no-header --pid=$PPID --format=comm) != "fish" && -z ''${BASH_EXECUTION_STRING} ]]
if [[ ($(${pkgs.procps}/bin/ps --no-header --pid=$PPID --format=comm) != "fish" && -z ''${BASH_EXECUTION_STRING}) || -n "$IN_NIX_SHELL" ]]
then
shopt -q login_shell && LOGIN_OPTION='--login' || LOGIN_OPTION=""
exec ${pkgs.fish}/bin/fish $LOGIN_OPTION
@ -26,8 +26,11 @@ in
fzf # needed for reverse history search
];
programs.direnv.enableFishIntegration = true;
programs.fish.generateCompletions = true;
programs.fish.interactiveShellInit = ''
set -g fish_key_bindings fish_vi_key_bindings
function fish_greeting
end
function y
set tmp (mktemp -t "yazi-cwd.XXXXXX")
yazi $argv --cwd-file="$tmp"

View file

@ -17,15 +17,17 @@ in
historyLimit = 10000;
plugins = with pkgs.tmuxPlugins; [
vim-tmux-navigator
gruvbox
];
escapeTime = 0;
terminal = "tmux-256color";
# newSession = true;
extraConfig = ''
set -sg escape-time 0 # makes vim esc usable
new-session -s main
bind-key -n C-e send-prefix
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
bind c new-window -c "#{pane_current_path}"
# set-option -g default-terminal "tmux-256color"
# set -as terminal-overrides ',xterm*:Tc:sitm=\E[3m'
'';
};

View file

@ -29,7 +29,8 @@ in
theme = "gruvbox-dark";
settings = {
main = {
font = "JetBrainsMono Nerd Font:size=11";
font = "JetBrainsMono Nerd Font:size=11, Noto Color Emoji:size=10";
term = "foot";
};
scrollback = {
lines = 100000;

View file

@ -102,8 +102,9 @@ in
binds {
Mod+D { spawn "${cfg.launcher}"; }
Mod+Alt+L { spawn "lock"; }
Mod+T { spawn "${cfg.term}"; }
Mod+Y { spawn "${cfg.term}" "--app-id" "floating-alacritty" "yazi"; }
Mod+T { spawn "${cfg.term}" "tmux" "new-session" "-t" "main"; }
Mod+Shift+T { spawn "${cfg.term}"; }
Mod+Y { spawn "${cfg.term}" "--app-id" "floating-alacritty" "-W" "120x37" "yazi"; }
Mod+P { spawn "keepassxc"; }
Mod+S { spawn "qalculate-qt"; }
Mod+Shift+N { spawn "makoctl" "dismiss" "-a"; }
@ -417,7 +418,7 @@ in
keyboard {
xkb {
layout "eu"
// options "compose:lalt"
options "compose:caps,mod_led:compose"
}
}
touchpad {

View file

@ -1,451 +0,0 @@
{
pkgs,
config,
lib,
...
}:
let
cfg = config.xyno.desktop.waybar;
json = pkgs.formats.json { };
waybarCfg = {
layer = "top";
position = "top";
height = 20;
modules-left =
(lib.optionals (cfg.mode == "river") [
"river/tags"
"river/layout"
"river/window"
])
++ (lib.optionals (cfg.mode == "niri") [
"niri/workspaces"
"niri/window"
]);
modules-right = [
"tray"
"idle_inhibitor"
"wireplumber"
"battery"
"power-profiles-daemon"
"backlight"
"temperature"
"cpu"
"memory"
"disk"
"network"
"clock"
];
"power-profiles-daemon" = {
format = "{icon} ";
tooltip-format = "Power profile: {profile}\nDriver: {driver}";
tooltip = true;
format-icons = {
"default" = "";
"performance" = "";
"balanced" = "";
"power-saver" = "";
};
};
"river/window" = {
max-length = 40;
};
"niri/window" = {
max-length = 80;
};
wireplumber = {
"format" = "{icon} {volume:.2f} dB";
"format-muted" = " -inf dB";
# "on-click" = "${pkgs.pwvucontrol}/bin/pwvucontrol";
"on-click" = "${pkgs.pavucontrol}/bin/pavucontrol";
"on-click-right" = "${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle";
"on-scroll-up" = "${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ -l 1 1%+";
"on-scroll-down" = "${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ -l 1 1%-";
"format-icons" = [
""
""
""
];
};
"backlight" = {
"device" = "amdgpu_bl1";
"format" = "{icon} {percent}%";
"format-icons" = [
"󰃚"
"󰃛"
"󰃜"
"󰃝"
"󰃞"
"󰃟"
"󰃠"
];
"on-scroll-up" = "${pkgs.light}/bin/light -A 5";
"on-scroll-down" = "${pkgs.light}/bin/light -U 5";
};
"idle_inhibitor" = {
format = "{icon} ";
format-icons = {
"activated" = "󰅶";
"deactivated" = "󰾪";
};
};
battery = {
"states" = {
"warning" = 30;
"critical" = 15;
};
"format" = "{icon} {capacity}%";
"format-icons" = [
""
""
""
""
""
];
"tooltip-format" = "Capacity: {capacity}%\nPower Draw: {power:0.2f}W\n{timeTo}\nCycles: {cycles}";
"max-length" = 25;
};
"cpu" = {
"interval" = 10;
"format" = " {:0.0f}%";
"max-length" = 10;
};
"temperature" = {
"format" = " {temperatureC}°C";
};
memory = {
interval = 30;
format = " {used:0.0f}/{total:0.0f}GB";
};
clock = {
interval = 1;
format = "{:%a %Y-%m-%dT%H:%M:%S%z}";
"tooltip-format" = "<tt><small>{calendar}</small></tt>";
"calendar" = {
"mode" = "year";
"mode-mon-col" = 3;
"weeks-pos" = "right";
"on-scroll" = 1;
"format" = {
"months" = "<span color='#ffead3'><b>{}</b></span>";
"days" = "<span color='#ecc6d9'><b>{}</b></span>";
"weeks" = "<span color='#99ffdd'><b>W{}</b></span>";
"weekdays" = "<span color='#ffcc66'><b>{}</b></span>";
"today" = "<span color='#ff6699'><b><u>{}</u></b></span>";
};
};
"actions" = {
"on-click-right" = "mode";
"on-scroll-up" = "shift_up";
"on-scroll-down" = "shift_down";
};
};
disk = {
format = "󰋊 {specific_used:0.1f}/{specific_total:0.1f}TB";
unit = "TB";
path = "/";
};
"network" = {
"on-click" =
"${pkgs.alacritty}/bin/alacritty --class floating-alacritty -e ${pkgs.impala}/bin/impala";
"format" = "{ifname}";
"format-wifi" = "󰖩 {essid}";
"format-ethernet" = "󰈀 {ifname}";
"format-disconnected" = "󰖪 ";
"tooltip-format" = "{ifname} via {gwaddr}\n{ipaddr}/{cidr}";
"tooltip-format-wifi" = "{essid} ({signaldBm} dBm) {frequency} GHz\n{ipaddr}/{cidr}";
"tooltip-format-ethernet" = "{ifname}\n{ipaddr}/{cidr}";
"tooltip-format-disconnected" = "Disconnected";
"max-length" = 50;
};
};
waybarCfgFile = json.generate "waybar-config.json" waybarCfg;
waybarStyleCss = ''
* {
/* `otf-font-awesome` is required to be installed for icons */
font-family: "Source Sans 3";
font-size: 11px;
}
window#waybar {
color: #a89984;
background-color: #1d2021;
}
window#waybar.hidden {
opacity: 0.2;
}
/*
window#waybar.empty {
background-color: transparent;
}
window#waybar.solo {
background-color: #FFFFFF;
}
*/
/*window#waybar.termite {
background-color: #3F3F3F;
}
window#waybar.chromium {
background-color: #000000;
border: none;
}*/
#workspaces button {
padding: 0 2px;
background-color: #1d2021;
color: #ebdbb2;
/* Use box-shadow instead of border so the text isn't offset */
box-shadow: inset 0 -3px transparent;
/* Avoid rounded borders under each workspace name */
border: none;
border-radius: 0;
}
/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
#workspaces button:hover {
background: rgba(0, 0, 0, 0.2);
/* box-shadow: inset 0 -3px #fbf1c7;
*/
background-color: #3c3836;
}
#workspaces button.focused {
/* box-shadow: inset 0 -3px #fbf1c7;
*/
background-color: #3c3836;
color: #ebdbb2;
}
#workspaces button.occupied {
color: #d3869b;
}
#workspaces button.urgent {
background-color: #cc241d;
color: #ebdbb2;
}
#mode {
background-color: #64727D;
border-bottom: 3px solid #fbf1c7;
}
#clock,
#battery,
#cpu,
#memory,
#disk,
#temperature,
#backlight,
#network,
#pulseaudio,
#custom-media,
#tray,
#mode,
#idle_inhibitor,
#custom-poweroff,
#custom-suspend,
#mpd {
padding: 0 2px;
background-color: #1d2021;
color: #ebdbb2;
}
#window,
#workspaces,
#tags {
margin: 0 2px;
}
/* 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 {
color: #d3869b;
}
#battery.charging, #battery.plugged {
color: #98971a;
}
@keyframes blink {
to {
background-color: #fbf1c7;
color: #df3f71;
}
}
#battery.critical:not(.charging) {
background-color: #1d2021;
color: #d3869b;
animation-name: blink;
animation-duration: 0.5s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
label:focus {
background-color: #000000;
}
#backlight {
color: #458588;
}
#temperature {
color: #fabd2f;
}
#temperature.critical {
background-color: #fbf1c7;
color: #b57614;
}
#memory {
color: #FCF434; /* enby yellow */
}
#disk {
color: #FFFFFF; /* enby white */
}
#network {
color: #b8bb26; /* enby green */
}
#clock {
color: #9C59D1; /* enby purple */
/*color: #2C2C2C; enby black */
}
#network.disconnected {
background-color: #fbf1c7;
color: #9d0006;
}
#wireplumber {
color: #fe8019;
}
#tray {
}
#tray > .needs-attention {
background-color: #fbf1c7;
color: #3c3836;
}
#idle_inhibitor {
background-color: #1d2021;
color: #ebdbb2;
}
#idle_inhibitor.activated {
background-color: #fbf1c7;
color: #3c3836;
}
#custom-media {
background-color: #66cc99;
color: #2a5c45;
min-width: 100px;
}
#custom-media.custom-spotify {
background-color: #66cc99;
}
#custom-media.custom-vlc {
background-color: #ffa000;
}
#mpd {
background-color: #66cc99;
color: #2a5c45;
}
#mpd.disconnected {
background-color: #f53c3c;
}
#mpd.stopped {
background-color: #90b1b1;
}
#mpd.paused {
background-color: #51a37a;
}
#language {
background: #00b093;
color: #740864;
padding: 0 5px;
margin: 0 5px;
min-width: 16px;
}
#keyboard-state {
background: #97e1ad;
color: #000000;
padding: 0 0px;
margin: 0 5px;
min-width: 16px;
}
#keyboard-state > label {
padding: 0 5px;
}
#keyboard-state > label.locked {
background: rgba(0, 0, 0, 0.2);
}
'';
waybarCssFile = pkgs.writeText "waybar.css" waybarStyleCss;
in
{
options.xyno.desktop.waybar.enable = lib.mkEnableOption "enable mako notification daemon";
options.xyno.desktop.waybar.wantedBy = lib.mkOption {
type = lib.types.str;
default = "niri.service";
};
options.xyno.desktop.waybar.package = lib.mkOption {
type = lib.types.package;
default = pkgs.unstable.waybar;
};
options.xyno.desktop.waybar.mode = lib.mkOption {
type = lib.types.str;
default = "niri";
};
config = lib.mkIf cfg.enable {
programs.waybar.enable = true;
programs.waybar.package = cfg.package.overrideAttrs (super: {
# version = super.version + "-patched";
patches = [
./waybar-wireplumber-db.patch
];
});
programs.light.enable = true;
systemd.user.services.waybar.wantedBy = lib.mkForce [ cfg.wantedBy ];
systemd.user.services.waybar.restartTriggers = [
waybarCfgFile
waybarCssFile
];
environment.etc."xdg/waybar/config".source = waybarCfgFile;
environment.etc."xdg/waybar/style.css".source = waybarCssFile;
};
}

View file

@ -0,0 +1,93 @@
{
pkgs,
config,
lib,
...
}:
with lib;
let
calwatcher =
(pkgs.writeShellApplication {
name = "calwatcher";
runtimeInputs = [
pkgs.inotify-tools
pkgs.khal
pkgs.jq
];
text = ''
# in parts ripped from https://git.sr.ht/~whynothugo/dotfiles/tree/3768ec57/item/home/.local/lib/waybar-khal
render() {
# Find events starting in two minutes.
# So if my current event ends in two minutes and another one starts, the
# widget is already updated with what's upcoming.
SINCE="$(date -d 'now +2 min' '+%FT%H:%M:%S')"
UNTIL="1d"
EVENT="$(
khal list "$SINCE" "$UNTIL" \
--day-format 'SKIPME' \
--format "{start-end-time-style} {title:.31}{repeat-symbol}" |
grep -v SKIPME | # filter out headers
grep -v -P '| |' | # filter out continuing all day events
grep -v '^ ' | # exclude full-day events
head -n 1 # show just the first
)"
if [ -z "$EVENT" ]; then
TEXT=" (nothing upcoming)"
CLASS="no-event"
else
TEXT=" $EVENT"
CLASS="event"
fi
jq --compact-output \
--null-input \
--arg text "$TEXT" \
--arg class "$CLASS" \
--arg tooltip "$(khal list today 7d --day-format '<span color="#ffead3"><b>{name} {date-long}</b></span>')" \
'{"text": $text, "class": $class, "tooltip": $tooltip}'
}
render # Render once for initial state.
# In order to make sure events are updated as time passes, this re-renderes
# every two minutes. That aside, whenever a calendar event changes, we alreays
# re-render immediately.
#
# It would be ideal to determine _when_ the current event ends, and set the
# timeout accordinly. That would require parsing khal's output a bit more.
while true; do
(inotifywait \
--event modify \
--event create \
--event delete \
--event close_write \
--event moved_to \
--event move \
--monitor \
--timeout 120 \
--recursive \
"$HOME/.calendars" 2> /dev/null) || true | \
while read -r _; do
render
timeout 3 cat || true # debounce for 3s, https://stackoverflow.com/a/69945839
done
done
'';
})
+ "/bin/calwatcher";
in
lib.mkIf (config.xyno.user-services.khal.enable) {
xyno.desktop.waybar.config = {
"custom/cal" = {
exec = calwatcher;
restart-interval = 5;
return-type = "json";
"on-click" = "${pkgs.foot}/bin/footclient --app-id floating-alacritty ${pkgs.khal}/bin/ikhal";
};
modules-right = mkOrder 1999 [ "custom/cal" ]; # left of clock, right of everything else
};
}

View file

@ -0,0 +1,250 @@
{
pkgs,
config,
lib,
...
}:
with lib;
let
cfg = config.xyno.desktop.waybar;
json = pkgs.formats.json { };
in
{
options.xyno.desktop.waybar.enable = mkEnableOption "enable mako notification daemon";
options.xyno.desktop.waybar.wantedBy = mkOption {
type = types.str;
default = "niri.service";
};
options.xyno.desktop.waybar.package = mkOption {
type = types.package;
default = pkgs.unstable.waybar;
};
options.xyno.desktop.waybar.config = mkOption {
type = json.type;
default = { modules-left = []; modules-right = []; };
};
options.xyno.desktop.waybar.style = mkOption {
type = types.lines;
default = "";
};
imports = [
./cal.nix
./kmonad.nix
./laptop.nix
./niri.nix
];
config = mkIf cfg.enable {
programs.waybar.enable = true;
programs.waybar.package = cfg.package.overrideAttrs (super: {
# version = super.version + "-patched";
patches = [
./waybar-wireplumber-db.patch
];
});
systemd.user.services.waybar.wantedBy = mkForce [ cfg.wantedBy ];
environment.etc."xdg/waybar/config".source = json.generate "waybar-config.json" cfg.config;
environment.etc."xdg/waybar/style.css".source = pkgs.writeText "waybar.css" cfg.style;
xyno.desktop.waybar.config = {
layer = "top";
position = "top";
height = 20;
modules-right = mkMerge [
(mkBefore [
"tray"
"idle_inhibitor"
"wireplumber"
])
(mkAfter [
"temperature"
"cpu"
"memory"
"disk"
"network"
])
(mkOrder 2000 [ "clock" ])
];
wireplumber = {
"format" = "{icon} {volume:.2f} dB";
"format-muted" = " -inf dB";
# "on-click" = "${pkgs.pwvucontrol}/bin/pwvucontrol";
"on-click" = "${pkgs.pavucontrol}/bin/pavucontrol";
"on-click-right" = "${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle";
"on-scroll-up" = "${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ -l 1 1%+";
"on-scroll-down" = "${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ -l 1 1%-";
"format-icons" = [
""
""
""
];
};
"idle_inhibitor" = {
format = "{icon} ";
format-icons = {
"activated" = "󰅶";
"deactivated" = "󰾪";
};
};
"cpu" = {
"interval" = 10;
"format" = " {:0.0f}%";
"max-length" = 10;
};
"temperature" = {
"format" = " {temperatureC}°C";
};
memory = {
interval = 30;
format = " {used:0.0f}/{total:0.0f}GB";
};
clock = {
interval = 1;
format = "{:%a %Y-%m-%dT%H:%M:%S%z}";
"tooltip-format" = "<tt><small>{calendar}</small></tt>";
"calendar" = {
"mode" = "year";
"mode-mon-col" = 3;
"weeks-pos" = "right";
"on-scroll" = 1;
"format" = {
"months" = "<span color='#ffead3'><b>{}</b></span>";
"days" = "<span color='#ecc6d9'><b>{}</b></span>";
"weeks" = "<span color='#99ffdd'><b>W{}</b></span>";
"weekdays" = "<span color='#ffcc66'><b>{}</b></span>";
"today" = "<span color='#ff6699'><b><u>{}</u></b></span>";
};
};
"actions" = {
"on-click-right" = "mode";
"on-scroll-up" = "shift_up";
"on-scroll-down" = "shift_down";
};
};
disk = {
format = "󰋊 {specific_used:0.1f}/{specific_total:0.1f}TB";
unit = "TB";
path = "/";
};
"network" = {
"on-click" = "${pkgs.foot}/bin/footclient --app-id floating-alacritty ${pkgs.impala}/bin/impala";
"format" = "{ifname}";
"format-wifi" = "󰖩 {essid}";
"format-ethernet" = "󰈀 {ifname}";
"format-disconnected" = "󰖪 ";
"tooltip-format" = "{ifname} via {gwaddr}\n{ipaddr}/{cidr}";
"tooltip-format-wifi" = "{essid} ({signaldBm} dBm) {frequency} GHz\n{ipaddr}/{cidr}";
"tooltip-format-ethernet" = "{ifname}\n{ipaddr}/{cidr}";
"tooltip-format-disconnected" = "Disconnected";
"max-length" = 50;
};
};
xyno.desktop.waybar.style = ''
* {
/* `otf-font-awesome` is required to be installed for icons */
font-family: "Source Sans 3";
font-size: 11px;
}
window#waybar {
color: #a89984;
background-color: #1d2021;
}
window#waybar.hidden {
opacity: 0.2;
}
/*
window#waybar.empty {
background-color: transparent;
}
window#waybar.solo {
background-color: #FFFFFF;
}
*/
/*window#waybar.termite {
background-color: #3F3F3F;
}
window#waybar.chromium {
background-color: #000000;
border: none;
}*/
#clock,
#battery,
#cpu,
#memory,
#disk,
#temperature,
#backlight,
#network,
#pulseaudio,
#tray,
#mode,
#idle_inhibitor,
#mpd {
padding: 0 2px;
background-color: #1d2021;
color: #ebdbb2;
}
label:focus {
background-color: #000000;
}
#temperature {
color: #fabd2f;
}
#temperature.critical {
background-color: #fbf1c7;
color: #b57614;
}
#memory {
color: #FCF434; /* enby yellow */
}
#disk {
color: #FFFFFF; /* enby white */
}
#network {
color: #b8bb26; /* enby green */
}
#clock {
color: #9C59D1; /* enby purple */
/*color: #2C2C2C; enby black */
}
#network.disconnected {
background-color: #fbf1c7;
color: #9d0006;
}
#wireplumber {
color: #fe8019;
}
#tray > .needs-attention {
background-color: #fbf1c7;
color: #3c3836;
}
#idle_inhibitor {
background-color: #1d2021;
color: #ebdbb2;
}
#idle_inhibitor.activated {
background-color: #fbf1c7;
color: #3c3836;
}
'';
};
}

View file

@ -0,0 +1,35 @@
{
pkgs,
config,
lib,
...
}:
with lib;
mkIf (config.xyno.hardware.kmonad.enable) {
xyno.desktop.waybar.config = {
"custom/kmonad" = {
exec =
(pkgs.writeShellApplication {
name = "kmonad-layer-watcher";
runtimeInputs = [ pkgs.inotify-tools ];
text = ''
cat /tmp/kmonad-layer;
while inotifywait -qq -e modify /tmp/kmonad-layer; do
cat /tmp/kmonad-layer;
done
'';
})
+ "/bin/kmonad-layer-watcher";
restart-interval = 5;
};
modules-left = mkBefore [ "custom/kmonad" ];
};
xyno.desktop.waybar.style = ''
#custom-kmonad {
color: #84929D;
margin-left: 4px;
border-bottom: 3px solid #fbf1c7;
}
'';
}

View file

@ -0,0 +1,87 @@
{
pkgs,
config,
lib,
...
}:
lib.mkIf (true) {
xyno.desktop.waybar.config = {
battery = {
"states" = {
"warning" = 30;
"critical" = 15;
};
"format" = "{icon} {capacity}%";
"format-icons" = [
""
""
""
""
""
];
"tooltip-format" = "Capacity: {capacity}%\nPower Draw: {power:0.2f}W\n{timeTo}\nCycles: {cycles}";
"max-length" = 25;
};
backlight = {
"device" = "amdgpu_bl1";
"format" = "{icon} {percent}%";
"format-icons" = [
"󰃚"
"󰃛"
"󰃜"
"󰃝"
"󰃞"
"󰃟"
"󰃠"
];
"on-scroll-up" = "${pkgs.light}/bin/light -A 5";
"on-scroll-down" = "${pkgs.light}/bin/light -U 5";
};
"power-profiles-daemon" = {
format = "{icon} ";
tooltip-format = "Power profile: {profile}\nDriver: {driver}";
tooltip = true;
format-icons = {
"default" = "";
"performance" = "";
"balanced" = "";
"power-saver" = "";
};
};
modules-right = [
"battery"
"power-profiles-daemon"
"backlight"
];
};
programs.light.enable = true;
xyno.desktop.waybar.style = ''
#battery {
color: #d3869b;
}
#battery.critical:not(.charging) {
background-color: #1d2021;
animation-name: blink;
animation-duration: 0.5s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
@keyframes blink {
to {
background-color: #fbf1c7;
color: #df3f71;
}
}
#battery.critical:not(.charging) {
background-color: #1d2021;
}
#battery.charging, #battery.plugged {
color: #98971a;
}
#backlight {
color: #458588;
}
'';
}

View file

@ -0,0 +1,71 @@
{
pkgs,
config,
lib,
...
}:
with lib;
mkIf (config.xyno.desktop.niri.enable) {
xyno.desktop.waybar.config = {
"niri/window" = {
max-length = 80;
};
modules-left = [
"niri/workspaces"
"niri/window"
];
};
xyno.desktop.waybar.style = ''
#window,
#workspaces,
#tags {
margin: 0 2px;
}
/* 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;
}
#workspaces button {
padding: 0 2px;
background-color: #1d2021;
color: #ebdbb2;
/* Use box-shadow instead of border so the text isn't offset */
box-shadow: inset 0 -3px transparent;
/* Avoid rounded borders under each workspace name */
border: none;
border-radius: 0;
}
/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
#workspaces button:hover {
background: rgba(0, 0, 0, 0.2);
/* box-shadow: inset 0 -3px #fbf1c7;
*/
background-color: #3c3836;
}
#workspaces button.focused {
/* box-shadow: inset 0 -3px #fbf1c7;
*/
background-color: #3c3836;
color: #ebdbb2;
}
#workspaces button.occupied {
color: #d3869b;
}
#workspaces button.urgent {
background-color: #cc241d;
color: #ebdbb2;
}
'';
}

View file

@ -10,8 +10,10 @@ in
{
options.xyno.hardware.kmonad.enable = lib.mkEnableOption "kmonad with xynos brain damage";
config = lib.mkIf cfg.enable {
services.kmonad = {
enable = true;
extraArgs = [ "-c" ];
keyboards = {
krane = {
device = "/dev/input/by-id/usb-Google_Inc._Hammer_440041001157415636313920-event-kbd";
@ -20,6 +22,7 @@ in
builtin = {
device = "/dev/input/by-path/platform-i8042-serio-0-event-kbd";
config = builtins.readFile ./kmonad/builtin.kbd;
};
k70-office = {
device = "/dev/input/by-id/usb-Corsair_CORSAIR_K70_CORE_RGB_TKL_Mechanical_Gaming_Keyboard_599A4D472DCAC05584072AFB922E3BFB-event-kbd";

View file

@ -23,67 +23,26 @@
lsft 102d z x c v b n m , . / rsft
lctl lmet lalt spc ralt rmet cmp rctl
)
(defalias
ext (layer-toggle extend) ;; Bind 'ext' to the Extend Layer
)
(defalias
cpy C-c
pst C-v
cut C-x
udo C-z
all C-a
fnd C-f
bk Back
fw Forward
)
(defalias
num (layer-toggle num)
qwerty-enter (tap-macro (cmd-button "echo qwerty > /tmp/kmonad-layer") (layer-switch qwerty))
qwerty-exit (tap-macro (cmd-button "echo colemak > /tmp/kmonad-layer") (layer-switch colemak-dh))
)
(deflayer colemak-dh
esc f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12
caps f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12
grv 1 2 3 4 5 6 7 8 9 0 - = bspc
tab q w f p b j l u y ; [ ]
esc (tap-hold-next-release 200 a lctrl) (tap-hold-next-release 200 r ralt) (tap-hold-next-release 200 s lmet) t g m n (tap-hold-next-release 200 e rmet) (tap-hold-next-release 200 i lalt) (tap-hold-next-release 200 o rctrl) ' \\ ret
lsft z x c d v 102d k h , . / rsft
lctl lmet lalt spc ralt rmet _ _
)
(deflayer num
esc f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12
grv 1 2 3 4 5 6 7 8 9 0 - = bspc
tab q w f p b j l u y ; [ ]
esc 1 2 3 4 5 6 7 8 9 0 ' \\ ret
lsft z x c d v 102d k h , . / rsft
lctl lmet lalt spc ralt rmet _ _
lctl lmet lalt spc ralt _ @qwerty-enter @qwerty-enter
)
(deflayer colemak-dhk
(deflayer qwerty
esc f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12
grv 1 2 3 4 5 6 7 8 9 0 - = bspc
tab q w f p b j l u y ; [ ]
@ext a r s t g k n e i o ' \\ ret
lsft z x c d v 102d m h , . / rsft
lctl lmet lalt spc ralt rmet _ _
grv 1 2 3 4 5 6 7 8 9 0 - = bspc
tab q w e r t y u i o p [ ]
caps a s d f g h j k l ; ' \ ret
lsft 102d z x c v b n m , . / rsft
lctl lmet lalt spc ralt rmet @qwerty-exit @qwerty-exit
)
(deflayer extend
_ play rewind previoussong nextsong ejectcd refresh brdn brup www mail prog1 prog2
_ f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 _
_ esc @bk @fnd @fw ins pgup home up end menu prnt slck
_ lalt lmet lsft lctl ralt pgdn lft down rght del caps _ _
_ @udo @cut @cpy tab @pst _ pgdn bks lsft lctl comp _
_ _ _ ret _ _ _ _
)
(deflayer empty
_ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _
)

View file

@ -0,0 +1,20 @@
{
pkgs,
lib,
config,
...
}:
let
cfg = config.xyno.hardware.smartcard;
in
{
options.xyno.hardware.smartcard.enable =
lib.mkEnableOption "enable stuff needed for smartcards to work right";
config = lib.mkIf cfg.enable {
services.vsmartcard-vpcd.enable = true;
hardware.gpgSmartcards.enable = true;
services.fido2-hid-bridge.enable = true;
services.pcscd.enable = true;
};
}

View file

@ -1,6 +1,7 @@
[
./cli/fish.nix
./cli/starship.nix
./cli/tmux.nix
./desktop/audio.nix
./desktop/common-programs.nix
./desktop/easyeffects.nix
@ -11,9 +12,10 @@
./desktop/niri.nix
./desktop/shikane.nix
./desktop/swayidle.nix
./desktop/waybar.nix
./desktop/waybar
./desktop/wpaperd.nix
./hardware/kmonad.nix
./hardware/smartcard.nix
./networking/networkd.nix
./presets/cli.nix
./presets/common.nix
@ -27,6 +29,7 @@
./services/wireguard.nix
./system/impermanence.nix
./system/user.nix
./user-services/khal.nix
./user-services/syncthing.nix
./to-upstream/fido2-hid-bridge.nix
]

View file

@ -24,6 +24,7 @@ in
xyno.cli.fish.enable = true;
xyno.cli.starship.enable = true;
xyno.cli.tmux.enable = true;
security.sudo.enable = false;
i18n.defaultLocale = "en_US.UTF-8";
@ -71,10 +72,32 @@ in
# https://github.com/NixOS/nixpkgs/issues/361592 needed for run0
security.pam.services.systemd-run0 = { };
programs.tmux.enable = true;
programs.yazi = {
enable = true;
initLua = pkgs.writeText "yazi-init.lua" ''
function Linemode:size_and_mtime()
local time = math.floor(self._file.cha.mtime or 0)
if time == 0 then
time = ""
elseif os.date("%Y", time) == os.date("%Y") then
time = os.date("%b %d %H:%M", time)
else
time = os.date("%b %d %Y", time)
end
local size = self._file:size()
return string.format("%s %s", size and ya.readable_size(size) or "-", time)
end
'';
settings.yazi = {
mgr = {
sort_by = "mtime";
linemode = "size_and_mtime";
sort_reverse = true;
sort_dir_first = true;
};
};
};
services.pcscd.enable = true;
@ -92,6 +115,7 @@ in
bottom
curl
croc
comma
dig
fd
ffmpeg
@ -110,7 +134,8 @@ in
pv
ripgrep
w3m
yt-dlp
unstable.yt-dlp
gallery-dl
p7zip
ncdu
];
@ -121,7 +146,7 @@ in
environment.shellAliases = {
l = "ls -alh";
n = "yazi";
n = "y";
gc = "git commit -v";
gpl = "git pull";
gd = "git diff";

View file

@ -25,7 +25,7 @@ in
virtualisation.podman.enable = true;
environment.systemPackages = with pkgs; [
unstable.jetbrains.rider
jetbrains.rider
# android-studio
nixpkgs-manual
nixpkgs-manual.lib-docs

View file

@ -22,6 +22,7 @@ in
];
xyno.desktop.niri.enable = true;
xyno.desktop.audio.enable = mkDefault true;
xyno.user-services.khal.enable = true;
boot.kernelPackages = mkDefault pkgs.linuxPackages_zen;
security.soteria.enable = true;
security.rtkit.enable = true;
@ -44,7 +45,7 @@ in
};
programs.yazi = {
settings.keymap.manager.prepend_keymap = [
settings.keymap.mgr.prepend_keymap = [
{
on = "y";
run = [

View file

@ -0,0 +1,63 @@
{
pkgs,
config,
lib,
...
}:
let
cfg = config.xyno.user-services.khal;
in
{
options.xyno.user-services.khal.enable = lib.mkEnableOption "enable khal and vdirsyncer";
options.xyno.user-services.khal.wantedBy = lib.mkOption {
type = lib.types.str;
default = "niri.service";
};
config = lib.mkIf cfg.enable {
environment.systemPackages = [
pkgs.khal
pkgs.vdirsyncer
];
systemd.packages = [ pkgs.vdirsyncer ];
environment.etc."xdg/khal/config".text = ''
[locale]
weeknumbers = right
timeformat = "%H:%M"
longdatetimeformat = "%Y-%m-%dT%H:%M:%S"
datetimeformat = "%Y-%m-%dT%H:%M:%S"
dateformat = "%Y-%m-%d"
longdateformat = "%Y-%m-%d"
[calendars]
[[calendars]]
path = ~/.calendars/*
type = discover
'';
systemd.user.services.vdirsyncer = {
environment.VDIRSYNCER_CONFIG = config.sops.secrets."vdirsyncer".path;
unitConfig = {
After = "network-online.target";
Wants = "network-online.target";
};
serviceConfig = {
Type = "oneshot";
};
script = ''
${pkgs.vdirsyncer}/bin/vdirsyncer metasync
${pkgs.vdirsyncer}/bin/vdirsyncer sync
'';
};
systemd.user.timers.vdirsyncer = {
wantedBy = [ cfg.wantedBy "timers.target" ];
timerConfig = {
OnCalendar = "*:0/15:00";
Unit = "vdirsyncer.service";
};
};
environment.sessionVariables.VDIRSYNCER_CONFIG = config.sops.secrets."vdirsyncer".path;
sops.secrets."vdirsyncer" = {
sopsFile = ../../secrets/desktop/calendar.yaml;
group = "users";
owner = config.xyno.system.user.name;
};
};
}