diff --git a/home/dwm.nix b/home/dwm.nix index d23f8b91..04372db6 100644 --- a/home/dwm.nix +++ b/home/dwm.nix @@ -21,8 +21,10 @@ in static const unsigned int borderpx = 0; static const unsigned int snap = 32; - static const int user_bh = 10; - static const int showbar = 1; + static const int usealtbar = 1; + static const char *altbarclass = "yambar"; + static const char *altbarcmd = "yambar"; + static const int showbar = 0; static const int topbar = 1; static const char *fonts[] = { "Maple Mono:size=10", @@ -50,13 +52,6 @@ in NULL }; - static const unsigned int baralpha = 243; - - static const unsigned int alphas[][3] = { - [SchemeNorm] = { OPAQUE, baralpha, baralpha }, - [SchemeSel] = { OPAQUE, baralpha, baralpha }, - }; - static const char *tags[] = { "⬤", "⬤", "⬤", "⬤", "⬤", "⬤" }; static const Rule rules[] = { @@ -132,26 +127,11 @@ in ../assets/dwm-remove-floating-indicator.patch ../assets/dwm-savefloats-alwayscenter.patch - (fetchpatch { - url = "https://dwm.suckless.org/patches/hide_vacant_tags/dwm-hide_vacant_tags-6.4.diff"; - hash = "sha256-GIbRW0Inwbp99rsKLfIDGvPwZ3pqihROMBp5vFlHx5Q="; - }) - - (fetchpatch { - url = "https://dwm.suckless.org/patches/alpha/dwm-alpha-20230401-348f655.diff"; - hash = "sha256-ZhuqyDpY+nQQgrjniQ9DNheUgE9o/MUXKaJYRU3Uyl4="; - }) - (fetchpatch { url = "https://dwm.suckless.org/patches/reorganizetags/dwm-reorganizetags-6.2.diff"; hash = "sha256-Fj+cfw+5d7i6UrakMbebhZsfmu8ZfooduQA08STovK4="; }) - (fetchpatch { - url = "https://dwm.suckless.org/patches/bar_height/dwm-bar-height-spacing-6.3.diff"; - hash = "sha256-usMIMmloUG4NrX10AVbgr8kFs9ZG6Krn1NxXTVcLq70="; - }) - (fetchpatch { url = "https://raw.githubusercontent.com/bakkeby/patches/c5eae9d/dwm/dwm-desktop_icons-6.5.diff"; hash = "sha256-oIgeph9pmIWKBepnQhc+aNWU7ZHxsJbhJr5LVNTtuHc="; @@ -161,6 +141,11 @@ in url = "https://dwm.suckless.org/patches/cool_autostart/dwm-cool-autostart-20240312-9f88553.diff"; hash = "sha256-pgXbgoAAewCjZP16smKkTVh5p7P/FK+Rue0F6gjmGVo="; }) + + (fetchpatch { + url = "https://github.com/mihirlad55/dwm-anybar/releases/download/v1.1.2/dwm-anybar-20210926-a786211.diff"; + hash = "sha256-6Pj58Y0gYz25Eba5EsAUc/GZFTSvtyhgPqfo3jlgvPA="; + }) ]; }) ]; diff --git a/home/yambar.nix b/home/yambar.nix new file mode 100644 index 00000000..c63d0551 --- /dev/null +++ b/home/yambar.nix @@ -0,0 +1,312 @@ +{ config, ... }: + +let + inherit (config.home) homeDirectory; + + discharging = [ + { + ramp = { + tag = "capacity"; + items = [ + { + string = { + text = ""; + }; + } + { + string = { + text = ""; + }; + } + { + string = { + text = ""; + }; + } + { + string = { + text = ""; + }; + } + { + string = { + text = ""; + }; + } + { + string = { + text = ""; + }; + } + { + string = { + text = ""; + }; + } + { + string = { + text = ""; + }; + } + { + string = { + text = ""; + }; + } + { + string = { + text = ""; + }; + } + ]; + }; + } + + { + string = { + text = "{capacity}% {estimate}"; + left-margin = margin; + }; + } + ]; + + margin = 10; +in +{ + programs.yambar = { + enable = true; + settings = { + + bar = { + height = 30; + location = "top"; + background = "282a36e6"; + foreground = "ffffffbb"; + font = "Noto Sans CJK JP:Bold:size=13,Font Awesome 6 Free:style=solid:size=13"; + right-margin = margin; + layer = "bottom"; + left = [ + { + script = { + path = "${homeDirectory}/.config/yambar/hyprland.sh"; + args = [ ]; + content = { + string = { + on-click = { + left = "sh -c 'hyprctl dispatch workspace e+1'"; + right = "sh -c 'hyprctl dispatch workspace e-1'"; + middle = "sh -c 'hyprctl dispatch workspace empty'"; + }; + + text = "{hypr_ws}"; + left-margin = margin; + }; + }; + }; + } + ]; + + center = [ + { + script = { + path = "${homeDirectory}/.config/yambar/title.sh"; + args = [ ]; + content = { + string = { + on-click = { + left = "sh -c '~/.config/hypr/swapmaster.sh'"; + right = "sh -c 'hyprctl dispatch movetoworkspace special'"; + middle = "sh -c 'hyprctl dispatch killactive'"; + }; + + text = "{title}"; + max = 90; + }; + }; + }; + } + ]; + + right = [ + { + battery = { + name = "BAT0"; + + content = { + map = { + conditions = { + "state == unknown" = discharging; + "state == discharging" = discharging; + + "state == charging" = [ + { + string = { + text = ""; + }; + } + + { + string = { + text = "{capacity}% {estimate}"; + }; + } + + ]; + "state == full" = [ + { + string = { + text = ""; + }; + } + + { + string = { + text = " {capacity}%"; + }; + } + ]; + "state == \"not charging\"" = [ + { + ramp = { + tag = "capacity"; + items = [ + { + string = { + text = ""; + }; + } + { + string = { + text = ""; + }; + } + { + string = { + text = ""; + }; + } + { + string = { + text = ""; + }; + } + { + string = { + text = ""; + }; + } + { + string = { + text = ""; + }; + } + { + string = { + text = ""; + }; + } + { + string = { + text = ""; + }; + } + { + string = { + text = ""; + }; + } + { + string = { + text = ""; + }; + } + ]; + }; + } + + { + string = { + text = "{capacity}%"; + }; + } + ]; + }; + }; + }; + }; + } + + { + backlight = { + name = "amdgpu_bl0"; + content = { + string = { + text = " {brightness}/255"; + left-margin = margin; + }; + }; + }; + } + + { + script = { + path = "${homeDirectory}/.config/yambar/pipewire.sh"; + args = [ ]; + content = { + string = { + text = "{pipewire}"; + left-margin = margin; + }; + }; + }; + } + + { + clock = { + time-format = "%H:%M %Z"; + content = [ + { + string = { + text = ""; + right-margin = 5; + left-margin = margin; + }; + } + { + string = { + text = "{date}"; + on-click = "yad --calendar --title '今日は何の日'"; + }; + } + { + string = { + text = ""; + right-margin = 5; + left-margin = margin; + }; + } + { + string = { + text = "{time}"; + }; + } + ]; + }; + } + + { + label = { + content = { + string = { + on-click = "sh -c 'rofi -show'"; + text = ""; + left-margin = margin; + }; + }; + }; + } + ]; + }; + }; + }; +}