add waybar config

This commit is contained in:
Astreaprtcl 2025-12-23 15:43:07 +01:00
parent 012bbb717c
commit f31c27bfe7
6 changed files with 338 additions and 35 deletions

9
programs/bluetooth.nix Normal file
View file

@ -0,0 +1,9 @@
{ pkgs, ... }:
{
hardware.bluetooth.enable = true;
services.blueman.enable = true;
environment.systemPackages = with pkgs; [
bluetui
];
}

View file

@ -7,6 +7,7 @@
environment.systemPackages = with pkgs; [
brightnessctl
nixfmt-rfc-style
nixfmt-tree
treefmt
wget
];
}

View file

@ -0,0 +1,5 @@
{ ... }:
{
services.blueman-applet.enable = true;
}

View file

@ -5,20 +5,10 @@
...
}:
let
inherit (lib)
concatMapStringsSep
getExe
getExe'
mkOption
types
;
in
{
options.custom.screenShotDir = mkOption {
options.custom.screenShotDir = lib.mkOption {
default = config.home.homeDirectory + "/Pictures/Screenshots";
type = with types; uniq str;
type = with lib.types; uniq str;
description = "Folder for all screenshots";
};
@ -40,7 +30,10 @@ in
shadows enable
shadow_blur_radius 16
layer_effects "waybar" blur enable
layer_effects "waybar" {
blur enable
blur_ignore_transparent enabled
}
layer_effects "launcher" blur enable
layer_effects "notifications" blur enable
@ -48,9 +41,15 @@ in
bindgesture swipe:left workspace next
'';
config = rec {
bars = [
{
command = "''";
mode = "hide";
}
];
modifier = "Mod1";
terminal = getExe pkgs.kitty;
menu = getExe pkgs.fuzzel;
terminal = lib.getExe pkgs.kitty;
menu = lib.getExe pkgs.fuzzel;
input = {
"type:touchpad" = {
@ -70,7 +69,7 @@ in
seat = {
"*".hide_cursor = "when-typing enable";
seat0.fallback = "true";
seat1."\r" = concatMapStringsSep "\n " (s: " attach ${s}") [
seat1."\r" = lib.concatMapStringsSep "\n " (s: " attach ${s}") [
"9390:4610:Rapoo_Rapoo_Gaming_Device"
"9390:4610:Rapoo_Rapoo_Gaming_Device_Keyboard"
];
@ -80,7 +79,7 @@ in
# Computer Control
"${modifier}+Escape" = "exit";
"${modifier}+Shift+Escape" =
"exec ${getExe' pkgs.coreutils "printf"} 'poweroff\\nreboot\\nhibernate\\n' | ${menu} -d | ${getExe' pkgs.findutils "xargs"} ${getExe' pkgs.systemd "systemctl"}";
"exec ${lib.getExe' pkgs.coreutils "printf"} 'poweroff\\nreboot\\nhibernate\\n' | ${menu} -d | ${lib.getExe' pkgs.findutils "xargs"} ${lib.getExe' pkgs.systemd "systemctl"}";
# Focus
"${modifier}+Down" = "focus down";
@ -131,44 +130,44 @@ in
"${modifier}+Tab" = "scratchpad show";
# Programs
"${modifier}+a" = "exec ${getExe pkgs.nemo}";
"${modifier}+a" = "exec ${lib.getExe pkgs.nemo}";
"${modifier}+Return" = "exec ${terminal}";
# dmenu
"${modifier}+d" = "exec ${menu}";
"${modifier}+s" =
"exec ${getExe pkgs.bash} -c \"${terminal} ssh $(grep -P '^Host (?!\\*)' ${config.home.homeDirectory}/.ssh/config | ${getExe' pkgs.coreutils "cut"} -d ' ' -f2 | ${menu} -d)\"";
"exec ${lib.getExe pkgs.bash} -c \"${terminal} ssh $(grep -P '^Host (?!\\*)' ${config.home.homeDirectory}/.ssh/config | ${lib.getExe' pkgs.coreutils "cut"} -d ' ' -f2 | ${menu} -d)\"";
"${modifier}+e" =
"exec ${getExe pkgs.bash} -c \"${getExe pkgs.uni} emoji all -f '%(emoji h) %(cldr_full h Q:[:])' | ${getExe pkgs.gnused} '/^$/d' | ${menu} -d | ${getExe' pkgs.coreutils "cut"} -d ' ' -f1 | ${getExe' pkgs.coreutils "tr"} -d '\\n' | ${getExe' pkgs.wl-clipboard-rs "wl-copy"}\"";
"exec ${lib.getExe pkgs.bash} -c \"${lib.getExe pkgs.uni} emoji all -f '%(emoji h) %(cldr_full h Q:[:])' | ${lib.getExe pkgs.gnused} '/^$/d' | ${menu} -d | ${lib.getExe' pkgs.coreutils "cut"} -d ' ' -f1 | ${lib.getExe' pkgs.coreutils "tr"} -d '\\n' | ${lib.getExe' pkgs.wl-clipboard-rs "wl-copy"}\"";
# Wallpaper
"${modifier}+b" = "exec ${getExe' pkgs.systemd "systemctl"} --user start swww-randomize";
"${modifier}+b" = "exec ${lib.getExe' pkgs.systemd "systemctl"} --user start swww-randomize";
# Notifications
"${modifier}+n" = "exec ${getExe' pkgs.dunst "dunstctl"} history-pop";
"${modifier}+n" = "exec ${lib.getExe' pkgs.dunst "dunstctl"} history-pop";
# Screenshot
"${modifier}+Shift+s" =
"exec ${getExe pkgs.bash} -c \"${getExe' pkgs.coreutils "mkdir"} -p ${config.custom.screenShotDir}; ${getExe pkgs.wayfreeze} --hide-cursor --after-freeze-cmd '${getExe pkgs.sway-contrib.grimshot} savecopy area ${config.custom.screenShotDir}/$(${getExe' pkgs.coreutils "date"} -Iseconds).png; ${getExe pkgs.killall} wayfreeze'\"";
"exec ${lib.getExe pkgs.bash} -c \"${lib.getExe' pkgs.coreutils "mkdir"} -p ${config.custom.screenShotDir}; ${lib.getExe pkgs.wayfreeze} --hide-cursor --after-freeze-cmd '${lib.getExe pkgs.sway-contrib.grimshot} savecopy area ${config.custom.screenShotDir}/$(${lib.getExe' pkgs.coreutils "date"} -Iseconds).png; ${lib.getExe pkgs.killall} wayfreeze'\"";
# Screenlock
"${modifier}+l" = "exec --no-startup-id ${getExe pkgs.swaylock}";
"${modifier}+l" = "exec --no-startup-id ${lib.getExe pkgs.swaylock}";
# Audio
"--locked XF86AudioLowerVolume" =
"exec ${getExe pkgs.pulsemixer} --change-volume -5 --max-volume 100";
"exec ${lib.getExe pkgs.pulsemixer} --change-volume -5 --max-volume 100";
"--locked XF86AudioRaiseVolume" =
"exec ${getExe pkgs.pulsemixer} --change-volume +5 --max-volume 100";
"--locked XF86AudioNext" = "exec ${getExe pkgs.playerctl} next";
"--locked XF86AudioPrev" = "exec ${getExe pkgs.playerctl} previous";
"--locked XF86AudioPause" = "exec ${getExe pkgs.playerctl} play-pause";
"--locked XF86AudioPlay" = "exec ${getExe pkgs.playerctl} play-pause";
"--locked XF86AudioMute" = "exec ${getExe pkgs.pulsemixer} --toggle-mute";
"exec ${lib.getExe pkgs.pulsemixer} --change-volume +5 --max-volume 100";
"--locked XF86AudioNext" = "exec ${lib.getExe pkgs.playerctl} next";
"--locked XF86AudioPrev" = "exec ${lib.getExe pkgs.playerctl} previous";
"--locked XF86AudioPause" = "exec ${lib.getExe pkgs.playerctl} play-pause";
"--locked XF86AudioPlay" = "exec ${lib.getExe pkgs.playerctl} play-pause";
"--locked XF86AudioMute" = "exec ${lib.getExe pkgs.pulsemixer} --toggle-mute";
"--locked XF86AudioMicMute" =
"exec ${getExe pkgs.pulsemixer} --toggle-mute --id $(${getExe pkgs.pulsemixer} --list-sources | grep -Po 'source-\\d{2}(?=.*Default$)')";
"exec ${lib.getExe pkgs.pulsemixer} --toggle-mute --id $(${lib.getExe pkgs.pulsemixer} --list-sources | grep -Po 'source-\\d{2}(?=.*Default$)')";
# Brightness
"--locked XF86MonBrightnessDown" = "exec ${getExe pkgs.brightnessctl} set 5%-";
"--locked XF86MonBrightnessUp" = "exec ${getExe pkgs.brightnessctl} set 5%+";
"--locked XF86MonBrightnessDown" = "exec ${lib.getExe pkgs.brightnessctl} set 5%-";
"--locked XF86MonBrightnessUp" = "exec ${lib.getExe pkgs.brightnessctl} set 5%+";
};
colors = {

View file

@ -0,0 +1,114 @@
/*
* Variant: Rosé Pine Moon
* Maintainer: DankChoir
*/
@define-color base #232136;
@define-color surface #2a273f;
@define-color overlay #393552;
@define-color muted #6e6a86;
@define-color subtle #908caa;
@define-color text #e0def4;
@define-color love #eb6f92;
@define-color gold #f6c177;
@define-color rose #ea9a97;
@define-color pine #3e8fb0;
@define-color foam #9ccfd8;
@define-color iris #856cd9;
@define-color highlightLow #2a283e;
@define-color highlightMed #44415a;
@define-color highlightHigh #56526e;
* {
font-family: Maple Mono NF;
font-size: 14px;
min-height: 0;
border: none;
background: none;
margin: 0;
padding: 0;
}
#waybar.bottom_bar {
border: 2px solid shade(@iris, 1);
}
#waybar.top_bar {
border-bottom: 2px solid shade(@iris, 1);
}
#waybar,
tooltip,
#tray menu,
#tray menu menuitem {
background-color: alpha(@surface, 0.75);
padding: 0.5rem 0;
margin-bottom: 0;
color: @text;
border-radius: 0;
}
.modules-right,
.modules-left,
.modules-center {
margin: 2px;
padding: 0 2px;
}
#waybar.top_bar .modules-right,
#waybar.top_bar .modules-left,
#waybar.top_bar .modules-center {
margin-bottom: 6px;
}
tooltip,
#tray menu {
border: 2px solid shade(@iris, 1);
}
#tray menu menuitem {
border-radius: 0;
border-top: none;
border-bottom: none;
background: none;
margin: 0;
padding: 0;
}
#tray menu menuitem:hover {
color: @text;
background: alpha(@iris, 0.2);
}
#battery.charging {
color: @pine;
}
#battery.warning:not(.charging) {
color: @rose;
}
#workspaces button {
color: @text;
border-radius: 0;
}
#workspaces button:hover {
color: @text;
box-shadow: inset 0 2px @iris;
text-shadow: none;
}
#workspaces button.active,
#workspaces button.focused {
box-shadow: inset 0 1px @text;
}
#custom-bat-sep,
#custom-back-sep,
#custom-sep {
padding: 0 6px;
}

View file

@ -0,0 +1,175 @@
{ lib, pkgs, ... }:
{
programs.waybar = {
enable = true;
systemd.enable = true;
style = ./waybar.css;
settings = {
topBar = {
position = "top";
name = "top_bar";
reload_style_on_change = true;
modules-left = [
"clock"
"custom/sep"
"battery"
"custom/bat-sep"
"network"
];
modules-center = [
"mpris"
];
modules-right = [
"memory"
"custom/sep"
"cpu"
"custom/sep"
"temperature"
"custom/sep"
"disk"
];
"custom/sep" = {
format = "|";
tooltip = false;
};
"custom/bat-sep" = {
exec = "${lib.getExe' pkgs.coreutils "ls"} /sys/class/power_supply/* >/dev/null 2>&1 && ${lib.getExe' pkgs.coreutils "printf"} '|'";
interval = "once";
tooltip = false;
};
clock = {
format = "{:%Y-%m-%d %H:%M}";
tooltip = false;
};
battery = {
format = "{capacity}% - {timeTo}";
tooltip = false;
};
network = {
format-ethernet = "{ifname} - {bandwidthUpBytes} {bandwidthDownBytes}";
format-wifi = "{ifname} ({signalStrength}%) - {bandwidthUpBytes} {bandwidthDownBytes}";
format-disconnected = "";
tooltip-format = "{ipaddr}/{cidr} - [{gwaddr}]";
tooltip-wifi-format = "{ipaddr}/{cidr} - [{gwaddr}] \n{essid} - {freqency}GHz ({signaldBm}dBm)";
interval = 1;
tooltip = true;
};
mpris = {
format = " | {dynamic} | ";
dynamic-seperator = " | ";
dynamic-len = 32;
dynamic-order = [
"title"
"artist"
];
tooltip = false;
};
memory = {
format = "{used}GiB/{total}GiB";
tooltip = false;
interval = 1;
};
cpu = {
format = "{usage}% {avg_frequency}GHz";
tooltip = false;
interval = 1;
};
temperature = {
format = "{temperatureC}°C";
tooltip = false;
interval = 5;
};
disk = {
format = "{free}";
tooltip = false;
interval = 60;
};
};
bottomBar = {
margin = "5";
ipc = true;
position = "bottom";
name = "bottom_bar";
reload-style-on-change = true;
modules-left = [
"sway/workspaces"
"custom/sep"
"backlight"
"custom/back-sep"
"idle_inhibitor"
"custom/sep"
"bluetooth"
];
modules-center = [
"sway/mode"
"tray"
];
modules-right = [
"wireplumber"
"wireplumber#mic"
];
"custom/sep" = {
format = "|";
tooltip = false;
};
"custom/back-sep" = {
exec = "${lib.getExe' pkgs.coreutils "ls"} /sys/class/backlight/* >/dev/null 2>&1 && ${lib.getExe' pkgs.coreutils "printf"} '|'";
interval = "once";
tooltip = false;
};
"sway/workspaces" = {
format = " {name}·{icon} ";
format-icons = {
"1" = "dev";
"2" = "web";
"3" = "com";
"4" = "mus";
default = "ext";
};
persistent-workspaces = {
"1" = [];
"2" = [];
"3" = [];
"4" = [];
};
all-outputs = true;
};
backlight = {
format = "{percent}%";
tooltip = false;
on-scroll-up = "${lib.getExe pkgs.brightnessctl} s 1%+ >/dev/null";
on-scroll-down = "${lib.getExe pkgs.brightnessctl} s 1%- >/dev/null";
};
idle_inhibitor = {
format = "{icon}";
format-icons = {
activated = "on";
deactivated = "off";
};
tooltip = false;
};
bluetooth = {
format = "off";
format-on = "on: {num_connections}";
format-connected = "on: {num_connections}";
format-connected-battery = "on: {num_connections} - {device_battery_percentage}%";
format-off = "off";
format-disabled = "off";
on-click = "(${lib.getExe' pkgs.bluez "bluetoothctl"} show | ${lib.getExe' pkgs.findutils "grep"} 'Powered: no' && ${lib.getExe' pkgs.bluez "bluetoothctl"} power on) || ${lib.getExe' pkgs.bluez "bluetoothctl"} power off";
on-click-middle = "${lib.getExe pkgs.kitty} ${lib.getExe pkgs.bluetui}";
tooltip = false;
};
"sway/mode" = {
format = "{} |";
tooltip = false;
};
};
};
};
}