From b851d85fda926cdda4cdbd18c73ce213ac597f5b Mon Sep 17 00:00:00 2001 From: "Alexander \"PapaTutuWawa" Date: Tue, 26 Oct 2021 17:30:05 +0200 Subject: [PATCH] miku: Theme waybar --- hosts/miku.nix | 4 +- modules/host.nix | 2 + modules/programs/sway/default.nix | 6 +- modules/programs/waybar/default.nix | 69 +++++++++------ modules/programs/waybar/style.css | 133 ++++++++++++++++++++++++++++ 5 files changed, 185 insertions(+), 29 deletions(-) create mode 100644 modules/programs/waybar/style.css diff --git a/hosts/miku.nix b/hosts/miku.nix index 6cc11b6..48a3fd0 100644 --- a/hosts/miku.nix +++ b/hosts/miku.nix @@ -10,7 +10,7 @@ in mkHost config { hardwareImports = [ "amdgpu" "amd" ]; programImports = [ "zsh" "git" "mpv" "tmux" "emacs" "firefox" "i18n" "gamemode" "gnome" #"gnome-terminal" - "alacritty" "sway" "waybar" "kanshi" + "alacritty" "sway" "waybar" "swaync" "kanshi" "distributed-build/builder.nix" "music" ]; @@ -31,7 +31,7 @@ in mkHost config { }; extraPackages = pkgs: with pkgs; [ emacsPgtkGcc - gajim + gajim-mainwindow virt-manager unstable.qemu scream #gamemode # Custom package key-mapper # Custom package diff --git a/modules/host.nix b/modules/host.nix index a781154..f452c37 100644 --- a/modules/host.nix +++ b/modules/host.nix @@ -133,6 +133,8 @@ let source-han-sans source-han-serif # Coding fonts source-code-pro + # Icon fonts + nerdfonts ]; # We don't tolerate non-free software, except for Steam and Linux firmware diff --git a/modules/programs/sway/default.nix b/modules/programs/sway/default.nix index 8263e19..a01ab5c 100644 --- a/modules/programs/sway/default.nix +++ b/modules/programs/sway/default.nix @@ -24,9 +24,10 @@ let ${binary} ${args} ''; - makoWrapper = mkWrapperScript "${pkgs.mako}/bin/mako" "--default-timeout=3000"; + swayncWrapper = mkWrapperScript "${pkgs.swaync}/bin/swaync" ""; waybarWrapper = mkWrapperScript "${pkgs.waybar}/bin/waybar" ""; kanshiWrapper = mkWrapperScript "${pkgs.kanshi}/bin/kanshi" ""; + nwggridWrapper = mkWrapperScript "${pkgs.nwg-launchers}/bin/nwggrid-server" ""; # TODO: Fuse this with kanshi swayIdleWrapper = mkWrapperScript "${pkgs.swayidle}/bin/swayidle" "-w before-sleep '${pkgs.swaylock}/bin/swaylock -f --image $(find ~/Data/Wallpaper/horizontal/ -maxdepth 1 -type f | shuf -n 1)'"; in { @@ -36,7 +37,8 @@ in { config = { bars = [ ]; startup = [ - { command = "${makoWrapper}"; always = true; } + { command = "${nwggridWrapper}"; always = true; } + { command = "${swayncWrapper}"; always = true; } { command = "${waybarWrapper}"; always = true; } { command = "${kanshiWrapper}"; always = true; } { command = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"; always = true; } diff --git a/modules/programs/waybar/default.nix b/modules/programs/waybar/default.nix index aaa2c21..7db0ccd 100644 --- a/modules/programs/waybar/default.nix +++ b/modules/programs/waybar/default.nix @@ -1,33 +1,52 @@ { config, pkgs, ... }: { - home-manager.users."${config.system.singleUser}".programs.waybar = { - enable = true; - settings = [ - { - layer = "bottom"; - position = "top"; - gtk-layer-shell = true; + home-manager.users."${config.system.singleUser}" = { + xdg.configFile."waybar/style.css".source = ./style.css; + programs.waybar = { + enable = true; + style = builtins.readFile ./style.css; + settings = [ + { + output = [ "DP-2" ]; + layer = "bottom"; + position = "left"; + gtk-layer-shell = true; - modules-left = [ "custom/grid" "sway/workspaces" "sway/mode" ]; - modules-center = [ "clock" ]; - modules-right = [ "tray" "idle_inhibitor" "pulseaudio" "custom/menu" ]; + modules-left = [ "custom/applauncher" "sway/workspaces" "sway/mode" ]; + modules-center = [ "clock" ]; + modules-right = [ "tray" "idle_inhibitor" "pulseaudio" "custom/notifications" "custom/menu" ]; - modules = { - "sway/workspaces" = { - disable-scroll = true; - all-outputs = true; + modules = { + "idle_inhibitor" = { + format = "{icon}"; + format-icons = { + activated = ""; + deactivated = ""; + }; + }; + "sway/workspaces" = { + disable-scroll = true; + all-outputs = true; + }; + "custom/applauncher" = { + format = "  "; + on-click = "${pkgs.nwg-launchers}/bin/nwggrid -client"; + tooltip = "false"; + }; + "custom/notifications" = { + format = "  "; + on-click = "${pkgs.swaync}/bin/swaync-client --toggle-panel"; + tooltip = "false"; + }; + "custom/menu" = { + format = "  "; + on-click = "${pkgs.wlogout}/bin/wlogout"; + tooltip = "false"; + }; }; - "custom/grid" = { - format = "Start"; - on-click = "${pkgs.nwg-launchers}/bin/nwggrid"; - }; - "custom/menu" = { - format = "Menu"; - on-click = "${pkgs.nwg-menu}/bin/nwg-menu -ha right -va top -d -fm ${pkgs.gnome.nautilus}"; - }; - }; - } - ]; + } + ]; + }; }; } diff --git a/modules/programs/waybar/style.css b/modules/programs/waybar/style.css new file mode 100644 index 0000000..b7d1b9c --- /dev/null +++ b/modules/programs/waybar/style.css @@ -0,0 +1,133 @@ +/* + Based on https://github.com/indicozy/wmtm/blob/main/configs/Flower/config/waybar/style.css +*/ +@define-color background #323732; +@define-color foreground #deddda; +@define-color selection #44475a; +@define-color unfocused #6272a4; +@define-color cyan #5d7380; +@define-color green #fff6f6; +@define-color orange #d65d0e; +@define-color pink #ff5370; +@define-color purple #b16286; +@define-color red #bf6374; +@define-color yellow #d79921; +@define-color fore #d1c29d; + + +* { + font-size: 14px; + font-family: "Hack"; + padding: 0px; + margin: 0px; +/* text-shadow:1px 1px 2px rgba(0,0,0,.6); */ +} + +window#waybar { + color: @foreground; + border-radius: 0; +} + +window#waybar.left { + background: rgba(43, 48, 59, .85); + border-top-left-radius: 0px; + border-top-right-radius: 0px; + border-top: none; + margin: 0; +} + +window#waybar.bottom { + padding-top: 0px; + background: @green; + border-bottom-left-radius: 0px; + margin: 0; +} + +.modules-left, +.modules-center, +.modules-right { + margin: 0; + padding: 0; +} + +/* Base styling for modules */ +#workspaces, +#mode, +#window, +#idle_inhibitor, +#pulseaudio, +#taskbar, +#tray, +#custom-menu { + padding: 1px 0px 1px 0px; + margin: 0px; +} + +#pulseaudio, #idle_inhibitor { + font-size: 30px; + margin: 0px 2px; +} + +#pulseaudio { + font-size: 16px; +} + +#taskbar, +#tray, +#window { + padding: 0; + margin: 0 0px 0 0px; +} +#taskbar { + margin-top: 0px; +} +#taskbar button { + color: @foreground; + border-radius: 0px; + padding: 3px 0px 3px 0px; +} +#taskbar button.active { + icon-shadow: 0px 0px 3px alpha(#111131, .9); + border-style: dashed; + border-width: 0 0 0 0; + border-color: @foreground; + border-radius: 0; +} + +#tray { + color: black; + icon-shadow: 0px 1px 2px alpha(#020000, .9); + padding: 2px 0px 2px 0px; +} + +#custom-menu, +#custom-applauncher, +#custom-notifications { + font-size: 30px; +} + +#clock { + font-size: 16px; + margin-left: 2px; + margin-right: 2px; +} + +#workspaces { + padding: 0px 0px 0px 0px; + margin-left: 0px; +} +#workspaces button { + margin: 0; + padding: 0px 0px 0px 0px; + border-radius: 0px; + color: @foreground; +} + +#workspaces button.focused { + color: @foreground; + background-color: @purple; + border-style: solid; + border-width: 0 0 0 0; + border-color: @foreground; + border-radius: 0; +}