Waybar config + use swaync on hyprland

This commit is contained in:
Filippo Berto 2024-02-17 11:17:51 +01:00
parent 9663614e3d
commit e0c1827b07
No known key found for this signature in database
GPG key ID: FE98AE5EC52B1056
7 changed files with 198 additions and 4 deletions

View file

@ -15,7 +15,6 @@
../../modules/hm/__basic.nix
../../modules/hm/cava.nix
../../modules/hm/dunst.nix
../../modules/hm/helix.nix
../../modules/hm/kitty.nix
../../modules/hm/syncthing.nix

View file

@ -102,7 +102,6 @@
../../modules/hm/blender.nix
# ../../modules/hm/bspwm.nix
../../modules/hm/cava.nix
../../modules/hm/dunst.nix
# ../../modules/hm/dwarf-fortress.nix
../../modules/hm/easyeffects.nix
../../modules/hm/firefox.nix

View file

@ -90,7 +90,6 @@
../../modules/hm/blender_nvidia.nix
# ../../modules/hm/bspwm.nix
../../modules/hm/cava.nix
../../modules/hm/dunst.nix
# ../../modules/hm/dwarf-fortress.nix
../../modules/hm/easyeffects.nix
../../modules/hm/firefox.nix

View file

@ -20,6 +20,7 @@ in
./sxhkd.nix
./update_background.nix
./xidlehook.nix
./dunst.nix
];
home.packages = builtins.attrValues {

View file

@ -5,6 +5,8 @@
./nautilus.nix
./nemo.nix
./waybar.nix
# ./dunst.nix
./swaynotificationcenter.nix
./wl_update_background.nix
];
@ -18,6 +20,10 @@
After = [ "graphical-session.target" ];
};
systemd.user.services."swaynotificationcenter".Unit = {
Description = "Run ";
};
xdg.configFile."hypr/hyprland.conf".text =
let
strPalette = pkgs.lib.nix-rice.palette.toRgbaShortHex pkgs.rice.colorPalette;

View file

@ -0,0 +1,92 @@
{ pkgs, ... }: {
systemd.user.services.swaynotificationcenter = {
Unit = {
After = [ "graphical-session-pre.target" ];
# Description = pkgs.swaynotificationcenter.meta.description;
PartOf = [ "graphical-session.target" ];
};
Install.WantedBy = [ "graphical-session.target" ];
Service = {
ExecStart = "${pkgs.swaynotificationcenter}/bin/swaync";
# ExecRestart = "${pkgs.swaynotificationcenter}/bin/swaync-client -R";
# KillMode = "mixed";
# Restart = "on-failure";
};
};
xdg.configFile."swaync/config.json".text = ''
{
"$schema": "/etc/xdg/swaync/configSchema.json",
"positionX": "right",
"positionY": "top",
"control-center-margin-top": 16,
"control-center-margin-bottom": 16,
"control-center-margin-right": 16,
"notification-icon-size": 64,
"notification-body-image-height": 100,
"notification-body-image-width": 200,
"timeout": 10,
"timeout-low": 5,
"timeout-critical": 0,
"fit-to-screen": true,
"control-center-width": 500,
"control-center-height": 1000,
"notification-window-width": 500,
"keyboard-shortcuts": true,
"image-visibility": "when-available",
"transition-time": 200,
"hide-on-clear": false,
"hide-on-action": true,
"script-fail-notify": true,
"widgets": ["buttons-grid", "mpris", "volume", "title", "notifications"],
"widget-config": {
"title": {
"text": "Notifications",
"clear-all-button": true,
"button-text": "󰆴 Clear"
},
"dnd": {
"text": "Do Not Disturb"
},
"label": {
"max-lines": 1,
"text": "Notification Center"
},
"mpris": {
"image-size": 96,
"image-radius": 7
},
"volume": {
"label": ""
},
"backlight": {
"label": "󰃟"
},
"buttons-grid": {
"actions": [
{
"label": "󰐥",
"command": "systemctl poweroff"
},
{
"label": "󰜉",
"command": "systemctl reboot"
},
{
"label": "󰍃",
"command": "hyprctl dispatch exit"
},
{
"label": "",
"command": "firefox bitwarden.serpentian.net"
},
{
"label": "󰖂",
"command": "firefox vpn.serpentian.net"
}
]
}
}
}
'';
}

View file

@ -1,3 +1,20 @@
{ pkgs, ... }:
let
inherit (pkgs.rice) colorPalette;
inherit (pkgs.lib) nix-rice;
alpha = 0.9;
custom = nix-rice.palette.toRGBHex {
inherit (colorPalette.primary) background foreground;
alpha_background = nix-rice.color.setAlphaRgba alpha colorPalette.primary.background;
primary_accent = colorPalette.normal.blue;
secondary_accent = colorPalette.normal.cyan;
tertiary_accent = colorPalette.primary.yellow;
palette = {
primary_background_rgba = colorPalette.primary.background;
tertiary_background_hex = nix-rice.color.setAlphaRgba alpha colorPalette.primary.background;
};
};
in
{
programs.waybar = {
enable = true;
@ -25,8 +42,26 @@
"battery#bat2"
"clock"
"tray"
"custom/notification"
];
"custom/notification" = {
tooltip = "false";
format = "{} {icon}";
format-icons = {
notification = "";
none = "";
dnd-notification = "";
dnd-none = "";
};
return-type = "json";
exec-if = "which swaync-client";
exec = "${pkgs.swaynotificationcenter}/bin/swaync-client -swb";
on-click = "sleep 0.1 && ${pkgs.swaynotificationcenter}/bin/swaync-client -t -sw";
on-click-right = "sleep 0.1 && ${pkgs.swaynotificationcenter}/bin/swaync-client -d -sw";
escape = true;
};
"keyboard-state" = {
"numlock" = true;
"capslock" = true;
@ -106,5 +141,68 @@
};
};
};
style = ''
* {
border: none;
border-radius: 0px;
font-family: ${pkgs.rice.font.monospace.name};
font-size: 10px;
min-height: 0;
}
window#waybar {
background: ${custom.alpha_background};
}
#workspaces {
background: ${custom.background};
margin: 0 5px;
padding: 0.5em;
border-radius: 0.5em;
color: ${custom.primary_accent}
}
#workspaces button {
padding: 0.5em;
margin: 0px 3px;
border-radius: 0.5em;
color: ${custom.primary_accent};
background: ${custom.background};
transition: all 0.3s ease-in-out;
}
#workspaces button.active {
background-color: ${custom.secondary_accent};
color: ${custom.background};
border-radius: 0.5em;
min-width: 3em;
background-size: 400% 400%;
transition: all 0.3s ease-in-out;
}
#workspaces button:hover {
background-color: ${custom.foreground};
color: ${custom.background};
border-radius: 0.5em;
min-width: 3em;
background-size: 400% 400%;
}
#tray, #pulseaudio, #network, #language, #custom-notification {
background: ${custom.background};
font-weight: bold;
font-size: 10px;
margin: 0px 5px;
}
#tray, #pulseaudio, #network, #language, #custom-notification, #cpu, #memory, #temperature, #keyboard-state, #backlight, #battery, #battery#bat2, #clock {
color: ${custom.foreground};
border-radius: 0.5em;
padding: 0.5em;
margin-left: 7px;
}
#clock {
background: ${custom.alpha_background};
}
#window{
background: ${custom.palette.tertiary_background_hex};
}
'';
};
}