From 87578211ba299a132b573595d8d711c5be3f6458 Mon Sep 17 00:00:00 2001 From: Sense T Date: Wed, 21 Jun 2023 16:11:21 +0800 Subject: [PATCH] =?UTF-8?q?waybar=20=E7=AD=89=E6=A1=8C=E9=9D=A2=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- global/software-configuration.nix | 8 +- global/system-configuration.nix | 1 - global/user-configuration.nix | 1 + home/user/config/waybar-style.nix | 252 ++++++++++++++++++++++++++++++ home/user/config/waybar.nix | 107 +++++++++++++ home/user/default.nix | 3 +- home/user/home.nix | 12 +- home/user/programs.nix | 17 +- home/user/services.nix | 19 ++- home/user/systemd.nix | 4 + 10 files changed, 412 insertions(+), 12 deletions(-) create mode 100644 home/user/config/waybar-style.nix create mode 100644 home/user/config/waybar.nix create mode 100644 home/user/systemd.nix diff --git a/global/software-configuration.nix b/global/software-configuration.nix index d388a41..2443f3c 100644 --- a/global/software-configuration.nix +++ b/global/software-configuration.nix @@ -27,13 +27,17 @@ }; }; }; + + pipewire = { + enable = true; + alsa.enable = true; + pulse.enable = true; + }; }; # List packages installed in system profile. To search, run: # $ nix search wget environment.systemPackages = with pkgs; [ - kitty - rofi hyprland-protocols hyprland-share-picker xdg-desktop-portal-hyprland diff --git a/global/system-configuration.nix b/global/system-configuration.nix index 89a2e3f..888c6a9 100644 --- a/global/system-configuration.nix +++ b/global/system-configuration.nix @@ -5,7 +5,6 @@ security.sudo.wheelNeedsPassword = false; hardware = { - pulseaudio.enable = true; opengl.enable = true; }; diff --git a/global/user-configuration.nix b/global/user-configuration.nix index 1e70a7b..e1f7688 100644 --- a/global/user-configuration.nix +++ b/global/user-configuration.nix @@ -10,6 +10,7 @@ "wheel" "input" ]; + hashedPassword = ""; # Login directly }; }; }; diff --git a/home/user/config/waybar-style.nix b/home/user/config/waybar-style.nix new file mode 100644 index 0000000..c4a3c94 --- /dev/null +++ b/home/user/config/waybar-style.nix @@ -0,0 +1,252 @@ +'' +* { + border: none; + border-radius: 10; + font-family: "nerdfonts" ; + font-size: 15px; + min-height: 10px; +} + +window#waybar { + background: transparent; +} + +window#waybar.hidden { + opacity: 0.2; +} + +#window { + margin-top: 6px; + padding-left: 10px; + padding-right: 10px; + border-radius: 10px; + transition: none; + color: transparent; + background: transparent; +} + +#workspaces { + margin-top: 6px; + margin-left: 12px; + font-size: 4px; + margin-bottom: 0px; + border-radius: 10px; + background: #161320; + transition: none; +} + +#workspaces button { + transition: none; + color: #B5E8E0; + background: transparent; + font-size: 16px; + border-radius: 2px; +} + +#workspaces button.occupied { + transition: none; + color: #F28FAD; + background: transparent; + font-size: 4px; +} + +#workspaces button.focused { + color: #ABE9B3; + border-top: 2px solid #ABE9B3; + border-bottom: 2px solid #ABE9B3; +} + +#workspaces button:hover { + transition: none; + box-shadow: inherit; + text-shadow: inherit; + color: #FAE3B0; + border-color: #E8A2AF; + color: #E8A2AF; +} + +#workspaces button.focused:hover { + color: #E8A2AF; +} + +#network { + margin-top: 6px; + margin-left: 8px; + padding-left: 10px; + padding-right: 10px; + margin-bottom: 0px; + border-radius: 10px; + transition: none; + color: #161320; + background: #bd93f9; +} + +#pulseaudio { + margin-top: 6px; + margin-left: 8px; + padding-left: 10px; + padding-right: 10px; + margin-bottom: 0px; + border-radius: 10px; + transition: none; + color: #1A1826; + background: #FAE3B0; +} + +#battery { + margin-top: 6px; + margin-left: 8px; + padding-left: 10px; + padding-right: 10px; + margin-bottom: 0px; + border-radius: 10px; + transition: none; + color: #161320; + background: #B5E8E0; +} + +#battery.charging, #battery.plugged { + color: #161320; + background-color: #B5E8E0; +} + +#battery.critical:not(.charging) { + background-color: #B5E8E0; + color: #161320; + animation-name: blink; + animation-duration: 0.5s; + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; +} + +@keyframes blink { + to { + background-color: #BF616A; + color: #B5E8E0; + } +} + +#backlight { + margin-top: 6px; + margin-left: 8px; + padding-left: 10px; + padding-right: 10px; + margin-bottom: 0px; + border-radius: 10px; + transition: none; + color: #161320; + background: #F8BD96; +} + +#clock { + margin-top: 6px; + margin-left: 8px; + padding-left: 10px; + padding-right: 10px; + margin-bottom: 0px; + border-radius: 10px; + transition: none; + color: #161320; + background: #ABE9B3; + /*background: #1A1826;*/ +} + +#memory { + margin-top: 6px; + margin-left: 8px; + padding-left: 10px; + margin-bottom: 0px; + padding-right: 10px; + border-radius: 10px; + transition: none; + color: #161320; + background: #DDB6F2; +} + +#cpu { + margin-top: 6px; + margin-left: 8px; + padding-left: 10px; + margin-bottom: 0px; + padding-right: 10px; + border-radius: 10px; + transition: none; + color: #161320; + background: #96CDFB; +} + +#tray { + margin-top: 6px; + margin-left: 8px; + padding-left: 10px; + margin-bottom: 0px; + padding-right: 10px; + border-radius: 10px; + transition: none; + color: #B5E8E0; + background: #161320; +} + +#custom-launcher { + font-size: 24px; + margin-top: 6px; + margin-left: 8px; + padding-left: 10px; + padding-right: 5px; + border-radius: 10px; + transition: none; + color: #89DCEB; + background: #161320; +} + +#custom-power { + font-size: 20px; + margin-top: 6px; + margin-left: 8px; + margin-right: 8px; + padding-left: 10px; + padding-right: 5px; + margin-bottom: 0px; + border-radius: 10px; + transition: none; + color: #161320; + background: #F28FAD; +} + +#custom-wallpaper { + margin-top: 6px; + margin-left: 8px; + padding-left: 10px; + padding-right: 10px; + margin-bottom: 0px; + border-radius: 10px; + transition: none; + color: #161320; + background: #C9CBFF; +} + +#custom-updates { + margin-top: 6px; + margin-left: 8px; + padding-left: 10px; + padding-right: 10px; + margin-bottom: 0px; + border-radius: 10px; + transition: none; + color: #161320; + background: #E8A2AF; +} + +#custom-media { + margin-top: 6px; + margin-left: 8px; + padding-left: 10px; + padding-right: 10px; + margin-bottom: 0px; + border-radius: 10px; + transition: none; + color: #161320; + background: #F2CDCD; +} +'' \ No newline at end of file diff --git a/home/user/config/waybar.nix b/home/user/config/waybar.nix new file mode 100644 index 0000000..2a9b457 --- /dev/null +++ b/home/user/config/waybar.nix @@ -0,0 +1,107 @@ +{ + layer = "top"; + position = "top"; + height = 32; + + modules-left = [ + "custom/launcher" + "hyprland/window" + ]; + modules-center = [ "wlr/workspaces" ]; + modules-right = [ + backlight + pulseaudio # use pipewire, test needed. + battery + cpu + memory + tray + clock + "custom/power" + ]; + + pulseaudio = { + tooltip = false; + scroll-step = 5; + format = "{icon} {volume}%"; + format-muted = "{icon} {volume}%"; + on-click ="pactl set-sink-mute @DEFAULT_SINK@ toggle"; + format-icons = { + default = [""; ""; ""] + } + }; + + "wlr/workspaces" = { + format = "{icon}"; + on-click = "activate"; + format-icons = { + "1" = ""; + "2" = ""; + "3" = ""; + "4" = ""; + "5" = ""; + urgent = ""; + active = ""; + default = ""; + }; + sort-by-number = true; + }; + + network = { + tooltip = false; + format-wifi = " {essid}"; + format-ethernet = "" + }; + + backlight = { + tooltip = false; + format = " {}%"; + interval = 1; + on-scroll-up = "light -A 5"; + on-scroll-down = "light -U 5"; + }; + + battery = { + states = { + good = 95; + warning = 30; + critical = 20 + }; + format = "{icon} {capacity}%"; + format-charging = " {capacity}%"; + format-plugged = " {capacity}%"; + format-alt = "{time} {icon}"; + format-icons = [""; ""; ""; ""; ""]; + }; + + tray = { + icon-size = 16; + spacing = 10; + }; + + clock = { + format = "{ = %I =%M %p  %d/%m/%Y}"; + }; + + cpu = { + interval = 15; + format = " {}%"; + max-length = 10; + }; + + memory = { + interval = 30; + format = " {}%"; + max-length = 10; + }; + + "custom/launcher" ={ + format = " "; + on-click = "rofi -show drun"; + on-click-right = "killall rofi"; + }; + + "custom/power" ={ + format = " "; + on-click = "bash ~/.config/rofi/leave/leave.sh"; + }; +} \ No newline at end of file diff --git a/home/user/default.nix b/home/user/default.nix index ea2f5d3..b94ccda 100644 --- a/home/user/default.nix +++ b/home/user/default.nix @@ -1,7 +1,8 @@ {pkgs, ...}: { home = import ./home.nix; programs = import ./programs.nix; - systemd.user.services = import ./sevices.nix; + services = import ./services.nix; + systemd.user.services = import ./systemd.nix; i18n.inputMethod.enabled = "fcitx5"; i18n.inputMethod.fcitx5.addons = with pkgs; [ diff --git a/home/user/home.nix b/home/user/home.nix index aa61de1..7f18156 100644 --- a/home/user/home.nix +++ b/home/user/home.nix @@ -11,6 +11,8 @@ icdiff podman jdk17 + rofi + rofi-rbw ]; sessionPath = { @@ -30,8 +32,12 @@ # TODO: hyprland # Use flatseal to change permissions. - ".local/share/fonts" = { - source = /run/current-system/sw/share/X11/fonts - }; + ".local/share/fonts".source = /run/current-system/sw/share/X11/fonts + + # Fix flatpak fonts + ".local/share/flatpak/overrides/global".text = '' + [Context] + filesystems=~/.local/share/fonts:ro;~/.icons; + ''; }; } \ No newline at end of file diff --git a/home/user/programs.nix b/home/user/programs.nix index a84cb11..b84b0ff 100644 --- a/home/user/programs.nix +++ b/home/user/programs.nix @@ -20,12 +20,13 @@ waybar = { enable = true; systemd.enable = true; + # see https://github.com/theCode-Breaker/riverwm/blob/main/waybar/river/config-river + # https://blog.cascade.moe/posts/hyprland-configure/ settings = { - + mainBar = import ./config/waybar.nix; }; - style = '' - ''; + style = import ./config/waybar-style.nix; }; kitty = { @@ -36,4 +37,14 @@ enableZshIntegration = true; }; }; + + rbw = { + enable = true; + settings = { + base_url = "https://pass.sense-t.eu.org"; + email = "sense-t@sense-t.eu.org"; + lock_timeout = 300; + pinentry = "gnome3"; + }; + }; } \ No newline at end of file diff --git a/home/user/services.nix b/home/user/services.nix index 5daf766..da37970 100644 --- a/home/user/services.nix +++ b/home/user/services.nix @@ -1,4 +1,19 @@ -# Will used for podman { - + dunst = { + enable = true; + settings = { + global = { + width = 300; + height = 300; + offset = "30x50"; + origin = "top-right"; + notification_limit = 10; + progress_bar = true; + transparency = 20; + corner_radius = 8; + }; + }; + }; + + network-manager-applet.enable = true; } \ No newline at end of file diff --git a/home/user/systemd.nix b/home/user/systemd.nix new file mode 100644 index 0000000..5daf766 --- /dev/null +++ b/home/user/systemd.nix @@ -0,0 +1,4 @@ +# Will used for podman +{ + +} \ No newline at end of file