waybar changes 1

This commit is contained in:
cnst
2024-12-27 16:46:50 +01:00
parent 542bac2fe7
commit 10716da678
22 changed files with 1007 additions and 159 deletions

View File

@@ -13,14 +13,13 @@ in {
wayland.windowManager.hyprland.settings = {
general = {
gaps_in = 2;
gaps_out = 4;
gaps_out = "4, 4, 4, 4";
border_size = 3;
#col.active_border = rgba(33ccffee) rgba(00ff99ee) 45deg
#col.inactive_border = rgba(595959aa)
"col.active_border" = "rgb(4c7a5d)"; # rgba(b16286ee) 45deg
"col.inactive_border" = "rgb(504945)";
layout = "dwindle";
allow_tearing = false;
resize_on_border = true;
};
decoration = {
@@ -32,13 +31,13 @@ in {
noise = 0.01;
vibrancy = 0.15;
vibrancy_darkness = 0.5;
passes = 2;
size = 7;
passes = 1;
size = 3;
popups = true;
popups_ignorealpha = 0.2;
};
shadow = {
enabled = true;
enabled = false;
color = "rgba(00000025)";
ignore_window = true;
offset = "0 5";

View File

@@ -63,13 +63,14 @@ in {
};
misc = {
vrr = 0;
mouse_move_enables_dpms = 1;
key_press_enables_dpms = 0;
force_default_wallpaper = 0;
disable_hyprland_logo = true;
disable_splash_rendering = true;
disable_autoreload = true;
disable_xdg_env_checks = true;
layers_hog_keyboard_focus = false;
};
xwayland = {
@@ -78,6 +79,40 @@ in {
};
}
(mkIf (host == "cnix") {
wayland.windowManager.hyprland.settings = {
render = {
explicit_sync = 2;
explicit_sync_kms = 2;
direct_scanout = false;
};
cursor = {
no_hardware_cursors = 2;
};
general = {
allow_tearing = false;
};
misc = {
vrr = 0;
};
};
})
(mkIf (host == "cnixpad") {
wayland.windowManager.hyprland.settings = {
input = {
kb_options = "ctrl:swapcaps";
};
general = {
allow_tearing = false;
};
misc = {
vrr = 0;
vfr = 1;
};
};
})
(mkIf (host == "toothpc") {
wayland.windowManager.hyprland.settings = {
render = {
@@ -88,26 +123,11 @@ in {
cursor = {
no_hardware_cursors = true;
};
};
})
(mkIf (host != "toothpc") {
wayland.windowManager.hyprland.settings = {
render = {
explicit_sync = 2;
explicit_sync_kms = 2;
direct_scanout = false;
general = {
allow_tearing = false;
};
cursor = {
no_hardware_cursors = 2;
};
};
})
(mkIf (host == "cnixpad") {
wayland.windowManager.hyprland.settings = {
input = {
kb_options = "ctrl:swapcaps";
misc = {
vrr = 0;
};
};
})

View File

@@ -24,26 +24,24 @@ in {
wayland.windowManager.hyprland.settings = {
# Common Keybind Variables
"$fileManager" = "thunar";
"$menu" = "pkill anyrun || anyrun | xargs hyprctl dispatch exec --";
"$menuw" = "pkill anyrun || anyrun | xargs hyprctl dispatch exec --";
"$yazi" = "foot -e yazi";
"$tuirun" = "tuirun-toggle.sh";
"$tuirun" = "uwsm app -- tuirun-toggle.sh";
bind = [
"$mod, L, exec, ${runOnce "hyprlock"}"
"$mod, SPACE, exec, $tuirun"
"$mod, R, exec, $tuirun"
"$mod, L, exec, ${toggle "nwg-bar"}"
"$mod SHIFT, B, exec, pkill -SIGUSR2 waybar"
"$mod, A, exec, pkill -SIGUSR1 waybar"
"$mod, T, exec, uwsm app $terminal"
"$mod, T, exec, uwsm app -- $terminal"
"$mod, W, exec, $browser"
"$mod, K, exec, keepassxc"
"$mod SHIFT, W, exec, $browserinc"
"$mod, Q, killactive,"
"$mod, E, exec, uwsm app -- $fileManager"
"$mod, R, exec, $tuirun"
"$mod SHIFT, E, exec, $yazi"
"$mod, F, fullscreen,"
"$mod SHIFT, F, togglefloating,"
"$mod, SPACE, exec, $tuirun"
"$mod, P, pseudo,"
"$mod, J, togglesplit,"
"$mod, C, exec, hyprctl dispatch exec copyq toggle"
@@ -71,17 +69,20 @@ in {
"$mod SHIFT, 8, movetoworkspace, 8"
"$mod SHIFT, 9, movetoworkspace, 9"
"$mod SHIFT, 0, movetoworkspace, 10"
",XF86AudioLowerVolume, exec, pamixer -d 5"
",XF86AudioRaiseVolume, exec, pamixer -i 5"
",XF86AudioMute, exec, pamixer -t"
",XF86AudioMicMute, exec, pactl -- set-source-mute 0 toggle"
",XF86AudioLowerVolume, exec, volume-control.sh --dec"
",XF86AudioRaiseVolume, exec, volume-control.sh --inc"
",XF86AudioMute, exec, volume-control.sh --toggle"
",XF86AudioMicMute, exec, volume-control.sh --toggle-mic"
",XF86MonBrightnessDown, exec, brightnessctl s 5%-"
",XF86MonBrightnessUp, exec, brightnessctl s +5%"
"$mod, XF86MonBrightnessUp, exec, hyprctl dispatch dpms on"
"$mod, XF86MonBrightnessDown, exec, hyprctl dispatch dpms off"
",Insert,exec,${lib.getExe pkgs.grimblast} --notify --freeze copysave area"
"SHIFT,Insert,exec,${lib.getExe pkgs.grimblast} --notify --freeze copysave output"
"ALT,Insert,exec,${lib.getExe pkgs.grimblast} --freeze save area - | ${lib.getExe pkgs.tesseract} - - | wl-copy && ${lib.getExe pkgs.libnotify}/bin/notify-send -t 3000 'OCR result copied to buffer'"
",Insert, exec, ${runOnce "grimblast"} --notify --freeze copysave area"
"SHIFT, Insert, exec, ${runOnce "grimblast"} --notify --freeze copysave output"
"ALT, Insert, exec, ${runOnce "grimblast"} --freeze save area - | ${runOnce "tesseract"} - - | wl-copy && ${runOnce "notify-send"} -t 3000 'OCR result copied to buffer'"
"$mod, S, togglespecialworkspace, magic"
"$mod SHIFT, S, movetoworkspace, special:magic"
];

View File

@@ -62,9 +62,22 @@ in {
"float, class:^(blueman-manager)$"
"float, class:^(floatranger)$"
"float, class:^(floatnnn)$"
"float, class:^(uwsm app -- tuirun)$"
];
windowrule = [];
layerrule = [
"animation fade,hyprpicker"
"animation fade,selection"
"noanim,waybar"
"ignorezero,waybar"
"ignorealpha 0.0,waybar"
"blur,notifications"
"ignorezero,notifications"
"noanim,wallpaper"
];
};
};
}

View File

@@ -0,0 +1,81 @@
{
config,
lib,
inputs,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.home.programs.hyprpanel;
in {
options = {
home.programs.hyprpanel.enable = mkEnableOption "Enables hyprpanel";
};
imports = [inputs.hyprpanel.homeManagerModules.hyprpanel];
config = mkIf cfg.enable {
programs.hyprpanel = {
# Enable the module.
# Default: false
enable = true;
# Automatically restart HyprPanel with systemd.
# Useful when updating your config so that you
# don't need to manually restart it.
# Default: false
systemd.enable = true;
# Add '/nix/store/.../hyprpanel' to the
# 'exec-once' in your Hyprland config.
# Default: false
hyprland.enable = false;
# Fix the overwrite issue with HyprPanel.
# See below for more information.
# Default: false
overwrite.enable = false;
# Import a specific theme from './themes/*.json'.
# Default: ""
theme = "gruvbox_split";
# Configure bar layouts for monitors.
# See 'https://hyprpanel.com/configuration/panel.html'.
# Default: null
layout = {
"bar.layouts" = {
"0" = {
left = ["dashboard"];
middle = ["workspaces"];
right = ["volume" "systray" "notifications"];
};
};
};
# Configure and theme *most* of the options from the GUI.
# See './nix/module.nix:103'.
# Default: <same as gui>
settings = {
bar.launcher.autoDetectIcon = true;
bar.workspaces.show_icons = true;
menus.clock = {
time = {
military = true;
hideSeconds = true;
};
weather.unit = "metric";
};
menus.dashboard.directories.enabled = false;
menus.dashboard.stats.enable_gpu = true;
theme.bar.transparent = true;
theme.font = {
name = "Input Mono Narrow Light";
size = "16px";
};
};
};
};
}

View File

@@ -0,0 +1,164 @@
{
pkgs,
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption singleton;
inherit (builtins) toJSON;
cfg = config.home.programs.ironbar;
in {
options = {
home.programs.ironbar.enable = mkEnableOption "Enables ironbar";
};
config = mkIf cfg.enable {
home.packages = with pkgs; [ironbar];
xdg.configFile = {
"ironbar/config.json".text = toJSON {
name = "main";
icon_theme = "Fluent-dark";
position = "bottom";
anchor_to_edges = true;
start = [
{
name = "startMenu";
type = "label";
label = "";
on_mouse_enter = "tuirun-toggle.sh";
}
];
center = singleton {
type = "launcher";
icon_size = 39;
favorites = [
"zen"
"alacritty"
"thunar"
];
};
end = [
{
type = "tray";
}
{
type = "upower";
show_if = "upower -e | grep BAT";
}
{
type = "clock";
format = "%x%a%R";
}
];
};
"ironbar/style.css".text =
# css
''
* {
font-family: "Input Sans Narrow", "Font Awesome 6 Free Solid";
font-size: 13px;
text-shadow: 2px 2px #3c3836;
border: none;
border-radius: 0;
outline: none;
font-weight: 500;
background: none;
color: #fbf1c7;
}
.background {
background: alpha(#3c3836, 0.925);
}
button:hover {
background: alpha(#504945, 0.8);
}
#bar {
border-top: 1px solid alpha(#504945, 0.925);
}
.label, .script, .tray {
padding-left: 0.5em;
padding-right: 0.5em;
}
.tray .item {
padding-left: 0.5em;
}
.upower {
padding-left: 0.2em;
padding-right: 0.2em;
}
.upower .label {
padding-left: 0;
padding-right: 0;
}
.popup {
border: 1px solid #504945;
padding: 1em;
}
.popup-clock .calendar-clock {
font-family: "Input Mono Narrow";
font-size: 2.5em;
padding-bottom: 0.1em;
}
.popup-clock .calendar .header {
padding-top: 1em;
border-top: 1px solid #504945;
font-size: 1.5em;
}
.popup-clock .calendar {
padding: 0.2em 0.4em;
}
.popup-clock .calendar:selected {
color: #32302f;
}
.launcher .item {
padding-left: 1em;
padding-right: 1em;
margin-right: 4px;
}
button:active {
background: alpha(#7c6f64, 0.8);
}
.launcher .open {
box-shadow: inset 0 -2px alpha(#7c6f64, 0.8);
}
.launcher .focused {
box-shadow: inset 0 -2px alpha(#32302f, 0.8);
background: alpha(#504945, 0.8);
}
.popup-launcher {
padding: 0;
}
.popup-launcher .popup-item:not(:first-child) {
border-top: 1px solid #504945;
}
#startMenu {
padding-left: 1em;
padding-right: 0.5em;
}
'';
};
};
}

View File

@@ -39,6 +39,8 @@ in {
qbittorrent
usbimager # write bootable usb images!
slurp # select region for screenshot
grimblast
tesseract
# misc.tui
xcur2png
cmatrix

View File

@@ -18,22 +18,22 @@ in {
{
label = "Lock";
exec = "hyprlock";
icon = "${config.gtk.iconTheme.package}/share/icons/Adwaita/symbolic/status/system-lock-screen-symbolic.svg";
icon = "${config.gtk.iconTheme.package}/share/icons/Papirus-Dark/symbolic/status/system-lock-screen-symbolic.svg";
}
{
label = "Logout";
exec = "hyprctl dispatch exit";
icon = "${config.gtk.iconTheme.package}/share/icons/Adwaita/symbolic/actions/system-log-out-symbolic.svg";
icon = "${config.gtk.iconTheme.package}/share/icons/Papirus-Dark/symbolic/actions/system-log-out-symbolic.svg";
}
{
label = "Reboot";
exec = "systemctl reboot";
icon = "${config.gtk.iconTheme.package}/share/icons/Adwaita/symbolic/actions/system-reboot-symbolic.svg";
icon = "${config.gtk.iconTheme.package}/share/icons/Papirus-Dark/symbolic/actions/system-reboot-symbolic.svg";
}
{
label = "Shutdown";
exec = "systemctl -i poweroff";
icon = "${config.gtk.iconTheme.package}/share/icons/Adwaita/symbolic/actions/system-shutdown-symbolic.svg";
icon = "${config.gtk.iconTheme.package}/share/icons/Papirus-Dark/symbolic/actions/system-shutdown-symbolic.svg";
}
];
xdg.configFile."nwg-bar/style.css".text = ''

View File

@@ -0,0 +1,21 @@
#!/bin/sh
output() {
if [ -f "$HOME/decrypted/.lock" ]; then
printf '{"text": ""}\n'
else
printf '{"text": ""}\n'
fi
}
check() {
[ ! -d "$HOME/decrypted" ] && return
output
inotifywait -q "$HOME/decrypted/.lock" > /dev/null 2>&1
output
inotifywait -q "$HOME/decrypted" > /dev/null
check
}
check

View File

@@ -0,0 +1,18 @@
#!/bin/sh
check() {
[ ! -d "$HOME/.mail" ] && return
notmuch new > /dev/null
count="$(notmuch count 'tag:unread')"
tooltip="There are $count new emails"
if [ "$count" = "0" ]; then
printf '{"text": ""}\n'
else
printf '{"text": "%s", "tooltip": "%s", "alt": "icon"}\n' "$count" "$tooltip"
fi
inotifywait -q -e move -e create -e delete "$HOME/.mail/cnst/INBOX/cur" > /dev/null
check
}
check

View File

@@ -0,0 +1,7 @@
#!/usr/bin/env bash
output="$(progress -q)"
text="$(printf "%s" "$output" | sed 's/\[[^]]*\] //g' | awk 'BEGIN { ORS=" " } NR%3==1 { op=$1 } NR%3==2 { pct=($1+0); if (op != "gpg" && op != "coreutils" && pct > 0 && pct < 100) { print op, $1 } }')"
tooltip="$(printf "%s" "$output" | perl -pe 's/\n/\\n/g' | perl -pe 's/(?:\\n)+$//')"
printf '{"text": "%s", "tooltip": "%s"}\n' "$text" "$tooltip"

View File

@@ -0,0 +1,7 @@
#!/usr/bin/env bash
if pgrep -x wf-recorder >/dev/null; then
printf '{"text": "  "}\n'
else
printf '{"text": ""}\n'
fi

View File

@@ -0,0 +1,37 @@
#!/bin/bash
socket="${XDG_RUNTIME_DIR:-/run/user/$UID}/yubikey-touch-detector.socket"
while true; do
touch_reasons=()
if [ ! -e "$socket" ]; then
printf '{"text": "Waiting for YubiKey socket"}\n'
while [ ! -e "$socket" ]; do sleep 1; done
fi
printf '{"text": ""}\n'
while read -n5 cmd; do
reason="${cmd:0:3}"
if [ "${cmd:4:1}" = "1" ]; then
touch_reasons+=("$reason")
else
for i in "${!touch_reasons[@]}"; do
if [ "${touch_reasons[i]}" = "$reason" ]; then
unset 'touch_reasons[i]'
break
fi
done
fi
if [ "${#touch_reasons[@]}" -eq 0 ]; then
printf '{"text": ""}\n'
else
tooltip="YubiKey is waiting for a touch, reasons: ${touch_reasons[@]}"
printf '{"text": "  ", "tooltip": "%s"}\n' "$tooltip"
fi
done < <(nc -U "$socket")
sleep 1
done

View File

@@ -11,17 +11,217 @@ in {
home.programs.waybar.enable = mkEnableOption "Enables waybar";
};
config = mkIf cfg.enable {
systemd.user.services.waybar = {
Unit.StartLimitBurst = 30;
};
programs.waybar = {
enable = true;
package = pkgs.waybar;
systemd.enable = true;
};
# style = ./style.css;
systemd.user.services.waybar = {
Unit = {
StartLimitBurst = 30;
After = lib.mkForce "graphical-session.target";
};
settings = [
{
height = 25;
modules-left = [
"group/system"
];
modules-center = [
"hyprland/workspaces"
];
modules-right = [
"custom/progress"
"custom/systemd"
# "custom/mail"
"group/tray"
"pulseaudio"
"backlight"
"battery"
"clock"
"custom/mako"
];
"hyprland/workspaces" = {
format = "{icon}";
format-icons = {
"default" = "";
"active" = "";
"empty" = "";
"persistent" = "";
};
disable-scroll = true;
rotate = 0;
all-outputs = true;
active-only = false;
on-click = "activate";
persistent-workspaces = {
"*" = 3;
};
};
"group/tray" = {
orientation = "inherit";
drawer = {
transition-left-to-right = false;
transistion-duration = 250;
click-to-reveal = true;
};
modules = [
"custom/trayicon"
"tray"
];
};
"group/system" = {
orientation = "inherit";
drawer = {
transistion-left-to-right = true;
transition-duration = 250;
click-to-reveal = true;
};
modules = [
"custom/logo"
"cpu"
"memory"
"disk"
"network"
];
};
"custom/trayicon" = {
format = "󰅁";
tooltip = false;
};
"custom/logo" = {
format = " ";
tooltip = false;
};
"custom/mako" = {
exec = "mako.sh";
on-click = "mako-toggle.sh";
restart-interval = 1;
tooltip = false;
};
"custom/progress" = {
exec = "waybar-progress.sh";
return-type = "json";
interval = 1;
};
"custom/systemd" = {
exec = "waybar-systemd.sh";
return-type = "json";
interval = 10;
};
# "custom/mail" = {
# format-icons = {
# icon = "<span foreground='#928374'> </span>";
# };
# format = "{icon}{}";
# exec = "${app}/bin/waybar-mail";
# return-type = "json";
# };
# "custom/recording" = {
# exec = "${app}/bin/waybar-recording";
# return-type = "json";
# signal = 3;
# interval = "once";
# };
tray = {
icon-size = 12;
rotate = 0;
spacing = 5;
};
clock = {
format = "<span foreground='#928374'></span> {:%a, %d %b <span foreground='#928374'></span> %H:%M}";
rotate = 0;
on-click = "calcurse-toggle.sh";
on-click-right = "calsync.sh";
tooltip = false;
};
cpu = {
format = "<span foreground='#928374'></span> {usage}%";
states = {
warning = 70;
critical = 90;
};
};
disk = {
format = "<span foreground='#928374'></span> {percentage_free}%";
states = {
warning = 70;
critical = 90;
};
};
memory = {
format = "<span foreground='#928374'></span> {}%";
states = {
warning = 70;
critical = 90;
};
};
backlight = {
format = "<span foreground='#928374'>{icon}</span> {percent}%";
format-icons = [""];
tooltip = false;
};
battery = {
states = {
warning = 30;
critical = 15;
};
format = "<span foreground='#928374'>{icon}</span> {capacity}%";
format-charging = "<span foreground='#928374'></span> {capacity}%";
format-icons = ["" "" "" "" ""];
};
network = {
interval = 2;
format-wifi = "<span foreground='#928374'></span> {essid}";
format-ethernet = "<span foreground='#928374'></span> {ifname}";
format-linked = "<span foreground='#928374'></span> {ifname}";
format-disconnected = " <span foreground='#928374'></span> ";
tooltip-format = "{ifname}: {ipaddr}/{cidr}\n {bandwidthDownBits}\n {bandwidthUpBits}";
};
pulseaudio = {
format = "<span foreground='#928374'>{icon}</span> {volume}% {format_source}";
on-scroll-up = "volume-control.sh --inc";
on-scroll-down = "volume-control.sh --dec";
format-bluetooth = "<span foreground='#928374'>{icon}</span> {volume}% {format_source}";
format-bluetooth-muted = "<span foreground='#928374'> {icon}</span> {format_source}";
format-muted = "<span foreground='#928374'></span> {format_source}";
format-source = "<span foreground='#928374'></span> {volume}%";
format-source-muted = "<span foreground='#928374'></span>";
format-icons = {
headphone = "";
hands-free = "";
headset = "";
phone = "";
portable = "";
car = "";
default = ["" "" ""];
};
on-click = lib.getExe pkgs.pavucontrol;
on-click-middle = lib.getExe pkgs.helvum;
};
}
];
};
};
}

View File

@@ -0,0 +1,167 @@
* {
all: unset;
background: #282828;
border: none;
border-radius: 0;
font-family:
Input Mono Narrow Light,
"Font Awesome 6 Free Solid";
font-size: 13px;
min-height: 0;
}
window#waybar {
background: transparent;
color: #fbf1c7;
/* transition-property: background-color; */
/* transition-duration: 0.5s; */
}
#workspaces button {
padding: 0 0px;
margin: 0 6px;
background-color: transparent;
color: #fbf1c7;
border-top: 3px solid transparent;
border-bottom: 3px solid transparent;
}
#workspaces button:hover {
background-color: #282828;
background: #282828;
color: #ebdbb2;
animation: ws_active 0s ease-in-out 1;
transition: all 0.2s cubic-bezier(0.55, -0.68, 0.48, 1.682);
}
#workspaces button.active {
color: #fbf1c7;
animation: ws_active 0s ease-in-out 1;
transition: all 0.2s cubic-bezier(0.55, -0.68, 0.48, 1.682);
}
#custom-logo {
font-size: 16px;
background-image: url("../waybar/images/button.svg");
background-position: center;
background-repeat: no-repeat;
background-size: 18px 15px;
}
#custom-trayicon {
color: #fbf1c7;
background: transparent;
opacity: 1;
margin: 1px 0px 0px 0px;
padding-left: 2px;
padding-right: 2px;
font-family: "Cantarell";
font-size: 14px;
}
#custom-usbguard,
#custom-decrypted,
#custom-mail,
#battery.warning,
#disk.warning,
#memory.warning,
#cpu.warning,
#custom-dnd.dnd-notification,
#custom-dnd.dnd-none {
border-top: 3px solid #282828;
border-bottom: 3px solid #c35e0a;
}
#custom-systemd,
#battery.critical,
#disk.critical,
#memory.critical,
#cpu.critical,
#custom-yubikey,
#custom-recording {
border-top: 3px solid #282828;
border-bottom: 3px solid #c14a4a;
}
#battery.charging {
border-top: 3px solid #282828;
border-bottom: 3px solid #4c7a5d;
}
#pulseaudio,
#custom-systemd,
#custom-mail,
#network,
#cpu,
#disk,
#memory,
#backlight,
#battery,
#clock {
padding: 0 3px;
margin: 0 3px;
}
#custom-dnd,
#custom-recording,
#language {
padding: 0;
margin: 0 6px;
}
#backlight,
#battery,
#clock,
#cpu,
#custom-mail,
#custom-progress,
#custom-recording,
#custom-systemd,
#custom-usbguard,
#custom-yubikey,
#disk,
#memory,
#mode,
#network,
#pulseaudio {
color: #fbf1c7;
}
#custom-mako {
color: #928374;
background: transparent;
opacity: 1;
margin: 1px 0px 0px 0px;
padding-right: 12px;
padding-left: 8px;
font-family: "Cantarell";
font-size: 16px;
}
#tray menu * {
color: #fbf1c7;
font-family: "Input Sans Compressed";
}
#tray {
padding: 0px 5px;
}
#tray > .passive {
-gtk-icon-effect: dim;
}
@keyframes needs-attention {
to {
background-color: rgba(235, 77, 75, 0.5);
}
}
#tray > .needs-attention {
-gtk-icon-effect: highlight;
animation-name: needs-attention;
animation-duration: 1s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
background-color: transparent;
}

View File

@@ -41,6 +41,9 @@ in {
tree
gnome-disk-utility
networkmanagerapplet
progress
wf-recorder
inotify-tools
]
(mkIf cfg.desktop.enable [