Waybar : Add basic config.
This commit is contained in:
parent
c3caeb7abf
commit
42c8679067
|
@ -12,6 +12,7 @@ in {
|
|||
./desktop/Portal.nix
|
||||
./desktop/Realtime.nix
|
||||
./desktop/Sound.nix
|
||||
./desktop/Waybar.nix
|
||||
];
|
||||
|
||||
services.gnome.gnome-keyring.enable = lib.mkForce false;
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
applications = 12;
|
||||
terminal = 12;
|
||||
popups = 12;
|
||||
desktop = 12;
|
||||
desktop = 14;
|
||||
};
|
||||
serif = {
|
||||
package = (pkgs.callPackage ./applefont {});
|
||||
|
|
7
module/desktop/Waybar.nix
Normal file
7
module/desktop/Waybar.nix
Normal file
|
@ -0,0 +1,7 @@
|
|||
{ pkgs, ... } @args: let
|
||||
waybar = import ./waybar args;
|
||||
in {
|
||||
programs.waybar.enable = true;
|
||||
environment.variables.WAYBAR_CONFIG = pkgs.writeText "waybarConfig" waybar.config;
|
||||
environment.variables.WAYBAR_STYLE = pkgs.writeText "waybarStyle" waybar.style;
|
||||
}
|
62
module/desktop/waybar/config/default.nix
Normal file
62
module/desktop/waybar/config/default.nix
Normal file
|
@ -0,0 +1,62 @@
|
|||
{ ... }: {
|
||||
text = ''
|
||||
// -*- mode: jsonc -*-
|
||||
{
|
||||
"layer": "top", // Waybar at top layer
|
||||
"position": "top", // Waybar position (top|bottom|left|right)
|
||||
"height": 30, // Waybar height (to be removed for auto height)
|
||||
"spacing": 4, // Gaps between modules (4px)
|
||||
"mode": "dock",
|
||||
"start_hidden": true,
|
||||
"modules-left": [
|
||||
"sway/workspaces",
|
||||
"sway/mode",
|
||||
"sway/scratchpad",
|
||||
],
|
||||
"modules-right": [
|
||||
"sway/language",
|
||||
"pulseaudio",
|
||||
"battery",
|
||||
"clock",
|
||||
"tray"
|
||||
],
|
||||
"sway/scratchpad": {
|
||||
"format": "{icon} {count}",
|
||||
"show-empty": false,
|
||||
"format-icons": ["", ""],
|
||||
"tooltip": true,
|
||||
"tooltip-format": "{app}: {title}"
|
||||
},
|
||||
"tray": {
|
||||
// "icon-size": 21,
|
||||
"spacing": 10
|
||||
},
|
||||
"clock": {
|
||||
// "timezone": "America/New_York",
|
||||
"tooltip-format": "<big><tt>{calendar}</tt></big>",
|
||||
"format-alt": "{:%d %a %H:%M}"
|
||||
},
|
||||
"battery": {
|
||||
"states": {
|
||||
"good": 60,
|
||||
"warning": 40,
|
||||
"critical": 20
|
||||
},
|
||||
"format": "{capacity}% {icon}",
|
||||
"format-charging": "{capacity}% ",
|
||||
"format-plugged": "{capacity}% ",
|
||||
"format-alt": "{time} {icon}",
|
||||
"format-icons": ["", "", "", "", ""]
|
||||
},
|
||||
"pulseaudio": {
|
||||
"scroll-step": 0,
|
||||
"format": "{volume}% {icon}",
|
||||
"format-muted": "",
|
||||
"format-icons": {
|
||||
"default": ["", "", ""]
|
||||
},
|
||||
"on-click": "pavucontrol"
|
||||
}
|
||||
}
|
||||
'';
|
||||
}
|
4
module/desktop/waybar/default.nix
Normal file
4
module/desktop/waybar/default.nix
Normal file
|
@ -0,0 +1,4 @@
|
|||
{ util, ... } @args: {
|
||||
config = (import ./config args).text;
|
||||
style = util.catAllText ./style args;
|
||||
}
|
17
module/desktop/waybar/style/Button.nix
Normal file
17
module/desktop/waybar/style/Button.nix
Normal file
|
@ -0,0 +1,17 @@
|
|||
{ ... }: {
|
||||
text = ''
|
||||
button {
|
||||
/* Use box-shadow instead of border so the text isn't offset */
|
||||
box-shadow: inset 0 -3px transparent;
|
||||
/* Avoid rounded borders under each button name */
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
|
||||
button:hover {
|
||||
background: inherit;
|
||||
box-shadow: inset 0 -3px #ffffff;
|
||||
}
|
||||
'';
|
||||
}
|
9
module/desktop/waybar/style/Default.nix
Normal file
9
module/desktop/waybar/style/Default.nix
Normal file
|
@ -0,0 +1,9 @@
|
|||
{ style, ... }: {
|
||||
text = ''
|
||||
* {
|
||||
/* `otf-font-awesome` is required to be installed for icons */
|
||||
font-family: "${style.font.serif.name}", FontAwesome, Roboto, Helvetica, Arial, sans-serif;
|
||||
font-size: ${toString(style.font.size.desktop)}px;
|
||||
}
|
||||
'';
|
||||
}
|
18
module/desktop/waybar/style/Margin.nix
Normal file
18
module/desktop/waybar/style/Margin.nix
Normal file
|
@ -0,0 +1,18 @@
|
|||
{ ... }: {
|
||||
text = ''
|
||||
#window,
|
||||
#workspaces {
|
||||
margin: 0 4px;
|
||||
}
|
||||
|
||||
/* If workspaces is the leftmost module, omit left margin */
|
||||
.modules-left > widget:first-child > #workspaces {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
/* If workspaces is the rightmost module, omit right margin */
|
||||
.modules-right > widget:last-child > #workspaces {
|
||||
margin-right: 0;
|
||||
}
|
||||
'';
|
||||
}
|
28
module/desktop/waybar/style/Plugin.nix
Normal file
28
module/desktop/waybar/style/Plugin.nix
Normal file
|
@ -0,0 +1,28 @@
|
|||
{ style, ... }: {
|
||||
text = ''
|
||||
#clock,
|
||||
#battery,
|
||||
#cpu,
|
||||
#memory,
|
||||
#disk,
|
||||
#temperature,
|
||||
#backlight,
|
||||
#network,
|
||||
#pulseaudio,
|
||||
#wireplumber,
|
||||
#custom-media,
|
||||
#tray,
|
||||
#mode,
|
||||
#idle_inhibitor,
|
||||
#scratchpad,
|
||||
#mpd {
|
||||
margin: 2px;
|
||||
padding-left: 4px;
|
||||
padding-right: 4px;
|
||||
}
|
||||
|
||||
#clock {
|
||||
font-weight: bold;
|
||||
}
|
||||
'';
|
||||
}
|
33
module/desktop/waybar/style/Power.nix
Normal file
33
module/desktop/waybar/style/Power.nix
Normal file
|
@ -0,0 +1,33 @@
|
|||
{ ... }: {
|
||||
text = ''
|
||||
/* Using steps() instead of linear as a timing function to limit cpu usage */
|
||||
#battery.critical:not(.charging) {
|
||||
background-color: #f53c3c;
|
||||
color: #ffffff;
|
||||
animation-name: blink;
|
||||
animation-duration: 0.5s;
|
||||
animation-timing-function: steps(12);
|
||||
animation-iteration-count: infinite;
|
||||
animation-direction: alternate;
|
||||
}
|
||||
|
||||
#power-profiles-daemon {
|
||||
padding-right: 15px;
|
||||
}
|
||||
|
||||
#power-profiles-daemon.performance {
|
||||
background-color: #f53c3c;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
#power-profiles-daemon.balanced {
|
||||
background-color: #2980b9;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
#power-profiles-daemon.power-saver {
|
||||
background-color: #2ecc71;
|
||||
color: #000000;
|
||||
}
|
||||
'';
|
||||
}
|
12
module/desktop/waybar/style/Tray.nix
Normal file
12
module/desktop/waybar/style/Tray.nix
Normal file
|
@ -0,0 +1,12 @@
|
|||
{ ... }: {
|
||||
text = ''
|
||||
#tray > .passive {
|
||||
-gtk-icon-effect: dim;
|
||||
}
|
||||
|
||||
#tray > .needs-attention {
|
||||
-gtk-icon-effect: highlight;
|
||||
background-color: #eb4d4b;
|
||||
}
|
||||
'';
|
||||
}
|
8
module/desktop/waybar/style/Window.nix
Normal file
8
module/desktop/waybar/style/Window.nix
Normal file
|
@ -0,0 +1,8 @@
|
|||
{ style, ... }: {
|
||||
text = ''
|
||||
window#waybar {
|
||||
background-color: rgba(${style.color.bg-r},${style.color.bg-g},${style.color.bg-b},${toString(style.opacity.desktop)});
|
||||
color: #${style.color.fg.light}
|
||||
}
|
||||
'';
|
||||
}
|
14
module/desktop/waybar/style/Workspace.nix
Normal file
14
module/desktop/waybar/style/Workspace.nix
Normal file
|
@ -0,0 +1,14 @@
|
|||
{ style, ... }: {
|
||||
text = ''
|
||||
#workspaces button {
|
||||
padding: 0 5px;
|
||||
color: #${style.color.fg.light};
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
#workspaces button.focused {
|
||||
background-color: rgba(${style.color.bg-r},${style.color.bg-g},${style.color.bg-b},${toString(style.opacity.desktop)});
|
||||
border-top: 2px solid #${style.color.accent};
|
||||
}
|
||||
'';
|
||||
}
|
|
@ -24,6 +24,7 @@
|
|||
./module/Workspace.nix
|
||||
./module/Session.nix
|
||||
./module/Keyd.nix
|
||||
./module/Waybar.nix
|
||||
];
|
||||
};
|
||||
in {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{ style, key, ... }: let
|
||||
fontName = style.font.serif.name;
|
||||
fontSize = toString(style.font.size.popup);
|
||||
fontSize = toString(style.font.size.desktop);
|
||||
|
||||
accent = style.color.accent;
|
||||
bg = style.color.bg.dark;
|
||||
|
@ -10,7 +10,7 @@ in {
|
|||
# Application launcher.
|
||||
# Note: pass the final command to swaymsg so that the resulting window can be opened
|
||||
# on the original workspace that the command was run on.
|
||||
set $menu _dmenu_path_wrapped | wmenu -b -p 'Run:' -i -f "${fontName} ${fontSize}" -M ${bg} -S ${bg} -N ${bg} -m ${accent} -s ${accent} -n ${fg} | xargs swaymsg exec --
|
||||
set $menu _dmenu_path_wrapped | wmenu -b -p 'Run:' -i -f "${fontName} ${fontSize}" -M ${bg}D9 -S ${bg}D9 -N ${bg}D9 -m ${accent} -s ${accent} -n ${fg} | xargs swaymsg exec --
|
||||
|
||||
bindsym $mod+${key.action.launch} exec $menu
|
||||
'';
|
||||
|
|
6
module/sway/module/Waybar.nix
Normal file
6
module/sway/module/Waybar.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{ key, ... }: {
|
||||
text = ''
|
||||
bindsym $mod+${key.sway.bar} exec pkill -SIGUSR1 waybar
|
||||
exec waybar -c ''${WAYBAR_CONFIG} -s ''${WAYBAR_STYLE}
|
||||
'';
|
||||
}
|
|
@ -104,6 +104,7 @@
|
|||
sway = {
|
||||
launch.terminal = "Escape";
|
||||
mod = "Mod4";
|
||||
bar = "r";
|
||||
notification = {
|
||||
dismiss = "shift+N";
|
||||
restore = "n";
|
||||
|
|
|
@ -34,6 +34,12 @@
|
|||
positive-b = config.lib.stylix.colors.base0B-rgb-b;
|
||||
positive-g = config.lib.stylix.colors.base0B-rgb-g;
|
||||
positive-r = config.lib.stylix.colors.base0B-rgb-r;
|
||||
bg-b = config.lib.stylix.colors.base00-rgb-b;
|
||||
bg-g = config.lib.stylix.colors.base00-rgb-g;
|
||||
bg-r = config.lib.stylix.colors.base00-rgb-r;
|
||||
fg-b = config.lib.stylix.colors.base06-rgb-b;
|
||||
fg-g = config.lib.stylix.colors.base06-rgb-g;
|
||||
fg-r = config.lib.stylix.colors.base06-rgb-r;
|
||||
};
|
||||
|
||||
font = {
|
||||
|
|
|
@ -29,6 +29,12 @@
|
|||
base0B-rgb-b = "135";
|
||||
base0B-rgb-g = "175";
|
||||
base0B-rgb-r = "135";
|
||||
base00-rgb-b = "33";
|
||||
base00-rgb-g = "32";
|
||||
base00-rgb-r = "29";
|
||||
base06-rgb-b = "199";
|
||||
base06-rgb-g = "241";
|
||||
base06-rgb-r = "251";
|
||||
};
|
||||
stylix = {
|
||||
fonts = {
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
"keyd"
|
||||
"networkmanager"
|
||||
"video"
|
||||
"input"
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue