2022-04-19 23:36:11 +00:00
|
|
|
|
{ pkgs, lib, config, ... }:
|
|
|
|
|
with lib;
|
|
|
|
|
let
|
|
|
|
|
cfg = config.programs.my-sway;
|
2022-11-25 13:45:17 +00:00
|
|
|
|
swayCfg = config.wayland.windowManager.sway;
|
2022-04-19 23:36:11 +00:00
|
|
|
|
|
|
|
|
|
mod = "Mod4";
|
|
|
|
|
# List of workspaces
|
|
|
|
|
workspaces = [
|
2023-03-23 09:59:44 +00:00
|
|
|
|
"1:🌏 web"
|
|
|
|
|
"2:💬 chat"
|
|
|
|
|
"3:⚙️ code"
|
|
|
|
|
"4:🎶 music"
|
|
|
|
|
"5:🔧 extra"
|
|
|
|
|
"6:🧰 6"
|
|
|
|
|
"7:🔩 7"
|
|
|
|
|
"8:🛠️ 8"
|
|
|
|
|
"9:🔨 9"
|
|
|
|
|
"10:🎲 misc"
|
2022-04-19 23:36:11 +00:00
|
|
|
|
];
|
|
|
|
|
wsAttrs = builtins.listToAttrs (
|
|
|
|
|
map
|
|
|
|
|
(i: { name = toString (remainder i 10); value = builtins.elemAt workspaces (i - 1); })
|
|
|
|
|
(range 1 11)
|
|
|
|
|
);
|
|
|
|
|
remainder = x: y: x - (builtins.div x y) * y;
|
|
|
|
|
range = from: to:
|
|
|
|
|
let
|
|
|
|
|
f = cur: if cur == to then [ ] else [ cur ] ++ f (cur + 1);
|
|
|
|
|
in
|
|
|
|
|
f from;
|
|
|
|
|
|
2022-11-09 19:26:27 +00:00
|
|
|
|
screenshotScript = pkgs.writeScriptBin "screenshot" ''
|
|
|
|
|
#! ${pkgs.fish}/bin/fish
|
|
|
|
|
|
2023-03-04 10:13:16 +00:00
|
|
|
|
${pkgs.grim}/bin/grim -g (${pkgs.slurp}/bin/slurp) - | ${pkgs.wl-clipboard}/bin/wl-copy
|
2022-11-09 19:26:27 +00:00
|
|
|
|
'';
|
2022-05-31 15:23:55 +00:00
|
|
|
|
|
2022-10-31 11:05:14 +00:00
|
|
|
|
ignored-devices = [ "Surface_Headphones" ];
|
|
|
|
|
playerctl = "${pkgs.playerctl}/bin/playerctl --ignore-player=${strings.concatStringsSep "," ignored-devices}";
|
2022-05-31 15:23:55 +00:00
|
|
|
|
|
2022-04-19 23:36:11 +00:00
|
|
|
|
in
|
|
|
|
|
{
|
2023-01-25 14:43:11 +00:00
|
|
|
|
# imports = [ ./ibus.nix ];
|
2022-04-25 18:16:46 +00:00
|
|
|
|
|
2022-04-19 23:36:11 +00:00
|
|
|
|
options.programs.my-sway = {
|
|
|
|
|
enable = mkEnableOption "Enable the sway configuration";
|
|
|
|
|
fontSize = mkOption {
|
|
|
|
|
type = types.float;
|
|
|
|
|
description = "The default font size";
|
|
|
|
|
};
|
|
|
|
|
enableTouchpad = mkOption {
|
|
|
|
|
type = types.bool;
|
|
|
|
|
description = "Whether to enable the touchpad";
|
|
|
|
|
default = true;
|
|
|
|
|
};
|
|
|
|
|
wallpaper = mkOption {
|
|
|
|
|
type = types.oneOf [ types.path types.str ];
|
|
|
|
|
description = "Path to the wallpaper to be used";
|
|
|
|
|
default = "";
|
|
|
|
|
};
|
|
|
|
|
terminal = mkOption {
|
|
|
|
|
type = types.str;
|
|
|
|
|
description = "The command to the terminal emulator to be used";
|
2022-06-12 16:44:21 +00:00
|
|
|
|
default = "${config.programs.kitty.package}/bin/kitty";
|
2022-04-19 23:36:11 +00:00
|
|
|
|
};
|
2022-10-17 15:32:12 +00:00
|
|
|
|
browser = mkOption {
|
|
|
|
|
type = types.str;
|
|
|
|
|
description = "The command for the browser";
|
|
|
|
|
default = "${pkgs.firefox-wayland}/bin/firefox";
|
|
|
|
|
};
|
|
|
|
|
discord = mkOption {
|
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
|
description = "The command for discord";
|
2022-11-08 17:59:53 +00:00
|
|
|
|
default = "${config.nki.programs.discord.package}/bin/discord";
|
2022-10-17 15:32:12 +00:00
|
|
|
|
};
|
2022-05-03 14:30:53 +00:00
|
|
|
|
|
2022-11-08 14:35:13 +00:00
|
|
|
|
lockCmd = mkOption {
|
|
|
|
|
type = types.str;
|
|
|
|
|
description = "The screen lock command";
|
|
|
|
|
default = "${pkgs.swaylock}/bin/swaylock"
|
|
|
|
|
+ (if cfg.wallpaper == "" then "" else " -i ${cfg.wallpaper} -s fill")
|
|
|
|
|
+ " -l -k";
|
|
|
|
|
};
|
2022-05-03 14:30:53 +00:00
|
|
|
|
enableLaptopBars = mkOption {
|
|
|
|
|
type = types.bool;
|
|
|
|
|
description = "Whether to enable laptop-specific bars (battery)";
|
|
|
|
|
default = true;
|
|
|
|
|
};
|
2022-09-16 15:25:19 +00:00
|
|
|
|
enableMpd = mkOption {
|
|
|
|
|
type = types.bool;
|
|
|
|
|
description = "Whether to enable mpd on waybar";
|
|
|
|
|
default = false;
|
|
|
|
|
};
|
2023-03-23 09:59:44 +00:00
|
|
|
|
|
|
|
|
|
waybar = {
|
|
|
|
|
extraSettings = mkOption {
|
|
|
|
|
type = types.attrs;
|
|
|
|
|
description = "Additional settings for the default waybar";
|
|
|
|
|
default = { };
|
|
|
|
|
};
|
|
|
|
|
extraStyle = mkOption {
|
|
|
|
|
type = types.str;
|
|
|
|
|
description = "Additional style for the default waybar";
|
|
|
|
|
default = "";
|
|
|
|
|
};
|
|
|
|
|
};
|
2022-04-19 23:36:11 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
config.wayland.windowManager.sway = mkIf cfg.enable {
|
|
|
|
|
enable = true;
|
2023-03-23 10:17:12 +00:00
|
|
|
|
package = pkgs.swayfx;
|
2023-03-23 09:59:44 +00:00
|
|
|
|
systemdIntegration = true;
|
2022-04-19 23:36:11 +00:00
|
|
|
|
|
|
|
|
|
config = {
|
|
|
|
|
### Inputs
|
|
|
|
|
#
|
|
|
|
|
# Touchpad
|
|
|
|
|
input."type=touchpad" = {
|
|
|
|
|
events = if cfg.enableTouchpad then "enabled" else "disabled";
|
|
|
|
|
};
|
|
|
|
|
# TODO: Keyboard
|
|
|
|
|
|
|
|
|
|
### Outputs
|
|
|
|
|
#
|
|
|
|
|
# Wallpaper
|
|
|
|
|
output."*".bg = if cfg.wallpaper == "" then "#000000 solid_color" else "${cfg.wallpaper} fill";
|
|
|
|
|
|
2022-05-04 14:23:09 +00:00
|
|
|
|
### Seats
|
|
|
|
|
#
|
|
|
|
|
# Cursor
|
2022-05-28 16:35:20 +00:00
|
|
|
|
seat."*".xcursor_theme = "${config.home.pointerCursor.name} ${toString config.home.pointerCursor.size}";
|
2022-05-04 14:23:09 +00:00
|
|
|
|
|
2022-04-19 23:36:11 +00:00
|
|
|
|
### Programs
|
|
|
|
|
#
|
|
|
|
|
# Terminal
|
|
|
|
|
terminal = cfg.terminal;
|
2022-04-25 15:54:36 +00:00
|
|
|
|
menu = "${pkgs.dmenu}/bin/dmenu_path | ${pkgs.bemenu}/bin/bemenu | ${pkgs.findutils}/bin/xargs swaymsg exec --";
|
2022-04-19 23:36:11 +00:00
|
|
|
|
# Startup
|
|
|
|
|
startup = [
|
|
|
|
|
# Dex for autostart
|
|
|
|
|
{ command = "${pkgs.dex}/bin/dex -ae sway"; }
|
|
|
|
|
# Waybar
|
|
|
|
|
{ command = "systemctl --user restart waybar"; always = true; }
|
2022-04-25 15:54:36 +00:00
|
|
|
|
# Startup programs
|
2022-10-17 15:32:12 +00:00
|
|
|
|
{ command = "${cfg.browser}"; }
|
2023-04-04 18:27:00 +00:00
|
|
|
|
{ command = "evolution"; } # Rely on system package with plugins
|
2023-03-15 13:02:15 +00:00
|
|
|
|
{ command = "env PYTHONPATH=$(python -m site --user-site) ${pkgs.ulauncher}/bin/ulauncher --hide-window --no-window-shadow"; }
|
2022-10-17 15:32:12 +00:00
|
|
|
|
] ++ (if cfg.discord != null then [
|
|
|
|
|
{ command = "${cfg.discord}"; }
|
2023-02-25 20:43:29 +00:00
|
|
|
|
] ++ lib.lists.optional
|
|
|
|
|
(!pkgs.stdenv.isAarch64)
|
|
|
|
|
(
|
|
|
|
|
{ command = "${pkgs.premid}/bin/premid"; }
|
|
|
|
|
) else [ ]);
|
2022-04-19 23:36:11 +00:00
|
|
|
|
|
|
|
|
|
### Keybindings
|
|
|
|
|
#
|
|
|
|
|
# Main modifier
|
|
|
|
|
modifier = mod;
|
2022-11-25 13:45:17 +00:00
|
|
|
|
keybindings = {
|
|
|
|
|
### Default Bindings
|
|
|
|
|
#
|
|
|
|
|
## App management
|
|
|
|
|
"${mod}+Return" = "exec ${swayCfg.config.terminal}";
|
|
|
|
|
"${mod}+Shift+q" = "kill";
|
|
|
|
|
"${mod}+d" = "exec ${swayCfg.config.menu}";
|
|
|
|
|
## Windowing
|
|
|
|
|
# Focus
|
|
|
|
|
"${mod}+${swayCfg.config.left}" = "focus left";
|
|
|
|
|
"${mod}+${swayCfg.config.down}" = "focus down";
|
|
|
|
|
"${mod}+${swayCfg.config.up}" = "focus up";
|
|
|
|
|
"${mod}+${swayCfg.config.right}" = "focus right";
|
|
|
|
|
"${mod}+Left" = "focus left";
|
|
|
|
|
"${mod}+Down" = "focus down";
|
|
|
|
|
"${mod}+Up" = "focus up";
|
|
|
|
|
"${mod}+Right" = "focus right";
|
|
|
|
|
# Move
|
|
|
|
|
"${mod}+Shift+${swayCfg.config.left}" = "move left";
|
|
|
|
|
"${mod}+Shift+${swayCfg.config.down}" = "move down";
|
|
|
|
|
"${mod}+Shift+${swayCfg.config.up}" = "move up";
|
|
|
|
|
"${mod}+Shift+${swayCfg.config.right}" = "move right";
|
|
|
|
|
"${mod}+Shift+Left" = "move left";
|
|
|
|
|
"${mod}+Shift+Down" = "move down";
|
|
|
|
|
"${mod}+Shift+Up" = "move up";
|
|
|
|
|
"${mod}+Shift+Right" = "move right";
|
|
|
|
|
# Toggles
|
|
|
|
|
"${mod}+f" = "fullscreen toggle";
|
|
|
|
|
"${mod}+a" = "focus parent";
|
|
|
|
|
# Layouts
|
|
|
|
|
"${mod}+s" = "layout stacking";
|
|
|
|
|
"${mod}+w" = "layout tabbed";
|
|
|
|
|
"${mod}+e" = "layout toggle split";
|
|
|
|
|
# Floating
|
|
|
|
|
"${mod}+Shift+space" = "floating toggle";
|
|
|
|
|
# Scratchpad
|
|
|
|
|
"${mod}+Shift+minus" = "move scratchpad";
|
|
|
|
|
# Resize
|
|
|
|
|
"${mod}+r" = "mode resize";
|
|
|
|
|
"${mod}+minus" = "scratchpad show";
|
|
|
|
|
## Reload and exit
|
|
|
|
|
"${mod}+Shift+c" = "reload";
|
|
|
|
|
"${mod}+Shift+e" =
|
|
|
|
|
"exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'";
|
2023-03-15 13:02:15 +00:00
|
|
|
|
# Launcher
|
|
|
|
|
"${mod}+space" = "exec ${pkgs.ulauncher}/bin/ulauncher-toggle";
|
2022-11-25 13:45:17 +00:00
|
|
|
|
} // {
|
2022-10-31 11:05:14 +00:00
|
|
|
|
## Splits
|
|
|
|
|
"${mod}+v" = "split v";
|
|
|
|
|
"${mod}+Shift+v" = "split h";
|
|
|
|
|
## Run
|
|
|
|
|
"${mod}+r" = "exec ${config.wayland.windowManager.sway.config.menu}";
|
|
|
|
|
"${mod}+Shift+r" = "mode resize";
|
|
|
|
|
## Screenshot
|
2022-11-09 19:26:27 +00:00
|
|
|
|
"Print" = "exec ${screenshotScript}/bin/screenshot";
|
2022-10-31 11:05:14 +00:00
|
|
|
|
## Locking
|
2022-11-08 14:35:13 +00:00
|
|
|
|
"${mod}+semicolon" = "exec ${cfg.lockCmd}";
|
2022-10-31 11:05:14 +00:00
|
|
|
|
## Multimedia
|
|
|
|
|
"XF86AudioPrev" = "exec ${playerctl} previous";
|
|
|
|
|
"XF86AudioPlay" = "exec ${playerctl} play-pause";
|
|
|
|
|
"Shift+XF86AudioPlay" = "exec ${playerctl} stop";
|
|
|
|
|
"XF86AudioNext" = "exec ${playerctl} next";
|
|
|
|
|
"XF86AudioRecord" = "exec ${pkgs.alsa-utils}/bin/amixer -q set Capture toggle";
|
|
|
|
|
"XF86AudioMute" = "exec ${pkgs.alsa-utils}/bin/amixer -q set Master toggle";
|
|
|
|
|
"XF86AudioLowerVolume" = "exec ${pkgs.alsa-utils}/bin/amixer -q set Master 3%-";
|
|
|
|
|
"XF86AudioRaiseVolume" = "exec ${pkgs.alsa-utils}/bin/amixer -q set Master 3%+";
|
2022-11-25 13:45:17 +00:00
|
|
|
|
## Backlight
|
|
|
|
|
"XF86MonBrightnessDown" = "exec ${pkgs.brightnessctl}/bin/brightnessctl s 10%-";
|
|
|
|
|
"XF86MonBrightnessUp" = "exec ${pkgs.brightnessctl}/bin/brightnessctl s 10%+";
|
|
|
|
|
"Shift+XF86MonBrightnessDown" = "exec ${pkgs.brightnessctl}/bin/brightnessctl -d kbd_backlight s 25%-";
|
|
|
|
|
"Shift+XF86MonBrightnessUp" = "exec ${pkgs.brightnessctl}/bin/brightnessctl -d kbd_backlight s 25%+";
|
2022-10-31 11:05:14 +00:00
|
|
|
|
} //
|
|
|
|
|
# Map the workspaces
|
|
|
|
|
(builtins.listToAttrs (lib.flatten (map
|
|
|
|
|
(key: [
|
2022-09-29 07:55:05 +00:00
|
|
|
|
{
|
2022-10-31 11:05:14 +00:00
|
|
|
|
name = "${mod}+${key}";
|
|
|
|
|
value = "workspace ${builtins.getAttr key wsAttrs}";
|
|
|
|
|
}
|
2022-09-29 07:55:05 +00:00
|
|
|
|
{
|
2022-10-31 11:05:14 +00:00
|
|
|
|
name = "${mod}+Shift+${key}";
|
|
|
|
|
value = "move to workspace ${builtins.getAttr key wsAttrs}";
|
2022-09-29 07:55:05 +00:00
|
|
|
|
}
|
2022-10-31 11:05:14 +00:00
|
|
|
|
])
|
|
|
|
|
(builtins.attrNames wsAttrs))
|
|
|
|
|
)) //
|
|
|
|
|
# Move workspaces between outputs
|
|
|
|
|
{
|
|
|
|
|
"${mod}+ctrl+h" = "move workspace to output left";
|
|
|
|
|
"${mod}+ctrl+l" = "move workspace to output right";
|
2022-11-25 13:45:17 +00:00
|
|
|
|
};
|
2022-04-19 23:36:11 +00:00
|
|
|
|
|
|
|
|
|
### Fonts
|
|
|
|
|
#
|
|
|
|
|
fonts = {
|
|
|
|
|
names = [ "monospace" "FontAwesome5Free" ];
|
|
|
|
|
size = cfg.fontSize;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
### Workspaces
|
|
|
|
|
#
|
|
|
|
|
# Default workspace
|
|
|
|
|
defaultWorkspace = "workspace ${builtins.elemAt workspaces 0}";
|
|
|
|
|
# Back and Forth
|
|
|
|
|
workspaceAutoBackAndForth = true;
|
|
|
|
|
|
|
|
|
|
### Windows
|
|
|
|
|
#
|
|
|
|
|
# Border
|
2022-09-11 13:41:59 +00:00
|
|
|
|
window.border = 4;
|
2022-04-19 23:36:11 +00:00
|
|
|
|
# Assigning windows to workspaces
|
|
|
|
|
assigns = {
|
|
|
|
|
"${builtins.elemAt workspaces 0}" = [
|
|
|
|
|
{ class = "^firefox$"; }
|
|
|
|
|
];
|
|
|
|
|
"${builtins.elemAt workspaces 1}" = [
|
2023-04-11 09:54:24 +00:00
|
|
|
|
{ class = "^((d|D)iscord|((A|a)rm(c|C)ord))$"; }
|
2022-04-19 23:36:11 +00:00
|
|
|
|
];
|
2023-04-04 18:27:00 +00:00
|
|
|
|
"📧 Email" = [
|
|
|
|
|
{ app_id = "evolution"; }
|
2023-03-24 10:25:59 +00:00
|
|
|
|
];
|
2022-04-19 23:36:11 +00:00
|
|
|
|
};
|
2023-03-23 09:59:44 +00:00
|
|
|
|
# Commands
|
|
|
|
|
window.commands = [
|
|
|
|
|
{ criteria = { title = ".*"; }; command = "inhibit_idle fullscreen"; }
|
2023-04-04 18:27:00 +00:00
|
|
|
|
{ criteria = { app_id = ".*float.*"; }; command = "floating enable"; }
|
|
|
|
|
{ criteria = { class = ".*float.*"; }; command = "floating enable"; }
|
2023-03-23 09:59:44 +00:00
|
|
|
|
];
|
|
|
|
|
# Focus
|
2022-04-19 23:36:11 +00:00
|
|
|
|
focus.followMouse = true;
|
2022-04-25 15:54:36 +00:00
|
|
|
|
focus.mouseWarping = true;
|
2022-04-19 23:36:11 +00:00
|
|
|
|
focus.newWindow = "urgent";
|
|
|
|
|
# Gaps
|
2023-03-25 10:40:36 +00:00
|
|
|
|
gaps.outer = 4;
|
2022-04-19 23:36:11 +00:00
|
|
|
|
gaps.inner = 4;
|
2023-03-23 10:27:08 +00:00
|
|
|
|
gaps.smartBorders = "off"; # until swayfx fixes clipping bug
|
2023-03-25 10:40:36 +00:00
|
|
|
|
gaps.smartGaps = false;
|
2022-04-19 23:36:11 +00:00
|
|
|
|
|
|
|
|
|
### Bars
|
2023-03-23 09:59:44 +00:00
|
|
|
|
# Let systemd manage it
|
|
|
|
|
bars = [ ];
|
2022-04-19 23:36:11 +00:00
|
|
|
|
};
|
|
|
|
|
### Misc
|
|
|
|
|
#
|
|
|
|
|
# xwayland
|
|
|
|
|
xwayland = true;
|
|
|
|
|
# swaynag
|
|
|
|
|
swaynag.enable = true;
|
|
|
|
|
# Environment Variables
|
|
|
|
|
extraSessionCommands = ''
|
|
|
|
|
export MOZ_ENABLE_WAYLAND=1
|
|
|
|
|
export SDL_VIDEODRIVER=wayland
|
|
|
|
|
export QT_QPA_PLATFORM=wayland
|
|
|
|
|
export QT_WAYLAND_DISABLE_WINDOWDECORATION="1"
|
2023-04-02 08:39:30 +00:00
|
|
|
|
|
2022-09-12 18:31:15 +00:00
|
|
|
|
'' + (if config.services.gnome-keyring.enable then ''
|
|
|
|
|
# gnome-keyring
|
|
|
|
|
eval `${pkgs.gnome.gnome-keyring}/bin/gnome-keyring-daemon -r -d -c secrets,ssh,pkcs11`
|
|
|
|
|
export SSH_AUTH_SOCK
|
|
|
|
|
'' else "");
|
2022-04-19 23:36:11 +00:00
|
|
|
|
# Extra
|
|
|
|
|
wrapperFeatures.base = true;
|
|
|
|
|
wrapperFeatures.gtk = true;
|
2022-04-25 15:54:36 +00:00
|
|
|
|
|
2022-11-08 14:35:13 +00:00
|
|
|
|
extraConfig =
|
|
|
|
|
(if cfg.enableLaptopBars then ''
|
|
|
|
|
# Lock screen on lid close
|
2022-11-25 13:45:17 +00:00
|
|
|
|
bindswitch lid:off exec ${cfg.lockCmd}
|
2023-03-23 10:17:12 +00:00
|
|
|
|
'' else "") + ''
|
2023-03-23 10:27:08 +00:00
|
|
|
|
## swayfx stuff
|
|
|
|
|
# Rounded corners
|
2023-03-23 10:17:12 +00:00
|
|
|
|
corner_radius 5
|
2023-03-23 10:27:08 +00:00
|
|
|
|
smart_corner_radius off
|
|
|
|
|
# Shadows
|
2023-03-23 10:17:12 +00:00
|
|
|
|
shadows on
|
|
|
|
|
shadow_blur_radius 5
|
2023-03-23 10:27:08 +00:00
|
|
|
|
# Dimming
|
2023-03-23 10:17:12 +00:00
|
|
|
|
default_dim_inactive 0.0
|
|
|
|
|
for_window [app_id="kitty"] dim_inactive 0.05
|
|
|
|
|
titlebar_separator enable
|
2023-04-02 08:39:30 +00:00
|
|
|
|
'' + ''
|
|
|
|
|
# Enable portal stuff
|
|
|
|
|
exec ${pkgs.writeShellScript "start-portals.sh" ''
|
|
|
|
|
# Import the WAYLAND_DISPLAY env var from sway into the systemd user session.
|
|
|
|
|
dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway
|
|
|
|
|
|
|
|
|
|
# Stop any services that are running, so that they receive the new env var when they restart.
|
|
|
|
|
systemctl --user stop pipewire pipewire-media-session xdg-desktop-portal xdg-desktop-portal-wlr
|
|
|
|
|
systemctl --user start pipewire-media-session
|
|
|
|
|
''}
|
2023-03-23 10:17:12 +00:00
|
|
|
|
'';
|
2022-04-19 23:36:11 +00:00
|
|
|
|
};
|
|
|
|
|
|
2022-11-08 14:35:13 +00:00
|
|
|
|
config.services.swayidle = mkIf cfg.enable {
|
|
|
|
|
enable = true;
|
|
|
|
|
timeouts = [
|
|
|
|
|
# Lock after 15 minutes of idle
|
|
|
|
|
{ timeout = 15 * 60; command = cfg.lockCmd; }
|
|
|
|
|
];
|
|
|
|
|
};
|
|
|
|
|
|
2022-04-19 23:36:11 +00:00
|
|
|
|
config.programs.waybar = mkIf cfg.enable {
|
|
|
|
|
enable = true;
|
2023-03-23 09:59:44 +00:00
|
|
|
|
systemd.enable = true;
|
2022-04-19 23:36:11 +00:00
|
|
|
|
settings = [
|
|
|
|
|
# Top bar
|
2023-03-23 09:59:44 +00:00
|
|
|
|
(mkMerge [{
|
2022-04-19 23:36:11 +00:00
|
|
|
|
position = "top";
|
|
|
|
|
modules-left = [
|
|
|
|
|
"sway/workspaces"
|
|
|
|
|
"sway/mode"
|
2022-10-31 11:05:14 +00:00
|
|
|
|
"sway/window"
|
2022-04-20 17:21:08 +00:00
|
|
|
|
];
|
|
|
|
|
modules-center = [
|
2022-04-19 23:36:11 +00:00
|
|
|
|
];
|
2022-10-31 11:05:14 +00:00
|
|
|
|
modules-right = [
|
|
|
|
|
(if cfg.enableMpd then "mpd" else "custom/media")
|
|
|
|
|
"tray"
|
|
|
|
|
"pulseaudio"
|
2023-03-08 23:24:50 +00:00
|
|
|
|
"bluetooth"
|
2022-10-31 11:05:14 +00:00
|
|
|
|
"network"
|
|
|
|
|
"cpu"
|
|
|
|
|
"memory"
|
|
|
|
|
"temperature"
|
|
|
|
|
] ++ (
|
|
|
|
|
if cfg.enableLaptopBars
|
|
|
|
|
then [ "battery" "battery#bat2" ]
|
|
|
|
|
else [ ]
|
|
|
|
|
) ++ [
|
|
|
|
|
"clock"
|
|
|
|
|
];
|
2022-04-19 23:36:11 +00:00
|
|
|
|
|
|
|
|
|
modules = {
|
2023-03-23 09:59:44 +00:00
|
|
|
|
"sway/workspaces" = {
|
|
|
|
|
format = "{name}";
|
|
|
|
|
};
|
2022-04-19 23:36:11 +00:00
|
|
|
|
"sway/mode" = {
|
|
|
|
|
format = "<span style=\"italic\">{}</span>";
|
|
|
|
|
};
|
2022-10-31 11:05:14 +00:00
|
|
|
|
"sway/window" = {
|
|
|
|
|
max-length = 70;
|
|
|
|
|
format = "{title}";
|
|
|
|
|
"rewrite" = {
|
|
|
|
|
"(.*) — Mozilla Firefox" = "🌎 $1";
|
|
|
|
|
"(.*) - Kakoune" = "⌨️$1";
|
|
|
|
|
"(.*) - fish" = ">_ $1";
|
2022-11-01 10:38:34 +00:00
|
|
|
|
"(.*) - Discord" = "🗨️ $1";
|
|
|
|
|
# ArmCord thing
|
2022-10-31 11:05:14 +00:00
|
|
|
|
"• Discord \\| (.*)" = "🗨️ $1";
|
|
|
|
|
"\\((\\d+)\\) Discord \\| (.*)" = "🗨️ [$1] $2";
|
|
|
|
|
};
|
|
|
|
|
};
|
2022-04-19 23:36:11 +00:00
|
|
|
|
"tray" = {
|
|
|
|
|
icon-size = 21;
|
|
|
|
|
spacing = 10;
|
|
|
|
|
};
|
|
|
|
|
"clock" = {
|
|
|
|
|
tooltip-format = "{:%Y-%m-%d | %H:%M}";
|
|
|
|
|
format-alt = "{:%Y-%m-%d}";
|
|
|
|
|
};
|
|
|
|
|
"cpu" = {
|
|
|
|
|
format = "{usage}% ";
|
|
|
|
|
};
|
|
|
|
|
"memory" = {
|
|
|
|
|
format = "{}% ";
|
|
|
|
|
};
|
|
|
|
|
"temperature" = {
|
|
|
|
|
# thermal-zone = 2;
|
|
|
|
|
# hwmon-path" = "/sys/class/hwmon/hwmon2/temp1_input";
|
|
|
|
|
critical-threshold = 80;
|
|
|
|
|
# format-critical = "{temperatureC}°C ";
|
|
|
|
|
format = "{temperatureC}°C ";
|
|
|
|
|
};
|
|
|
|
|
"backlight" = {
|
|
|
|
|
# device = "acpi_video1";
|
|
|
|
|
format = "{percent}% {icon}";
|
|
|
|
|
states = [ 0 50 ];
|
|
|
|
|
format-icons = [ "" "" ];
|
|
|
|
|
};
|
2022-05-03 14:30:53 +00:00
|
|
|
|
"battery" = mkIf cfg.enableLaptopBars {
|
2022-04-19 23:36:11 +00:00
|
|
|
|
states = {
|
|
|
|
|
good = 95;
|
|
|
|
|
warning = 30;
|
|
|
|
|
critical = 15;
|
|
|
|
|
};
|
|
|
|
|
format = "{capacity}% {icon}";
|
|
|
|
|
# format-good = ""; # An empty format will hide the module
|
|
|
|
|
# format-full = "";
|
|
|
|
|
format-icons = [ "" "" "" "" "" ];
|
|
|
|
|
};
|
2022-05-03 14:30:53 +00:00
|
|
|
|
"battery#bat2" = mkIf cfg.enableLaptopBars {
|
2022-04-19 23:36:11 +00:00
|
|
|
|
bat = "BAT2";
|
|
|
|
|
};
|
|
|
|
|
"network" = {
|
|
|
|
|
# interface = wlp2s0 # (Optional) To force the use of this interface
|
|
|
|
|
format-wifi = "{essid} ({signalStrength}%) ";
|
|
|
|
|
format-ethernet = "{ifname}: {ipaddr}/{cidr} ";
|
|
|
|
|
format-disconnected = "Disconnected ⚠";
|
|
|
|
|
interval = 7;
|
|
|
|
|
};
|
2023-03-08 23:24:50 +00:00
|
|
|
|
"bluetooth" = {
|
|
|
|
|
format = " {status}";
|
|
|
|
|
format-connected = " {device_alias}";
|
|
|
|
|
format-connected-battery = " {device_alias} {device_battery_percentage}%";
|
|
|
|
|
# format-device-preference= [ "device1", "device2" ], // preference list deciding the displayed devic;
|
|
|
|
|
tooltip-format = "{controller_alias}\t{controller_address}\n\n{num_connections} connected";
|
|
|
|
|
tooltip-format-connected = "{controller_alias}\t{controller_address}\n\n{num_connections} connected\n\n{device_enumerate}";
|
|
|
|
|
tooltip-format-enumerate-connected = "{device_alias}\t{device_address}";
|
|
|
|
|
tooltip-format-enumerate-connected-battery = "{device_alias}\t{device_address}\t{device_battery_percentage}%";
|
2023-03-23 09:59:44 +00:00
|
|
|
|
on-click = "${pkgs.blueman}/bin/blueman-manager";
|
2023-03-08 23:24:50 +00:00
|
|
|
|
};
|
2022-04-19 23:36:11 +00:00
|
|
|
|
"pulseaudio" = {
|
|
|
|
|
# scroll-step = 1;
|
|
|
|
|
format = "{volume}% {icon}";
|
|
|
|
|
format-bluetooth = "{volume}% {icon}";
|
|
|
|
|
format-muted = "";
|
|
|
|
|
format-icons = {
|
|
|
|
|
headphones = "";
|
2023-03-08 23:24:50 +00:00
|
|
|
|
handsfree = "";
|
|
|
|
|
headset = "";
|
2022-04-19 23:36:11 +00:00
|
|
|
|
phone = "";
|
|
|
|
|
portable = "";
|
|
|
|
|
car = "";
|
|
|
|
|
default = [ "" "" ];
|
|
|
|
|
};
|
2023-03-24 10:25:59 +00:00
|
|
|
|
on-click = "${pkgs.pavucontrol}/bin/pavucontrol";
|
2022-04-19 23:36:11 +00:00
|
|
|
|
};
|
2022-09-16 15:25:19 +00:00
|
|
|
|
"mpd" = {
|
|
|
|
|
"format" = "{stateIcon} {consumeIcon}{randomIcon}{repeatIcon}{singleIcon}{artist} - {album} - {title} ({elapsedTime:%M:%S}/{totalTime:%M:%S}) 🎧";
|
|
|
|
|
"format-disconnected" = "Disconnected 🎧";
|
|
|
|
|
"format-stopped" = "{consumeIcon}{randomIcon}{repeatIcon}{singleIcon}Stopped 🎧";
|
|
|
|
|
"interval" = 2;
|
|
|
|
|
"consume-icons" = {
|
|
|
|
|
"on" = " "; # Icon shows only when "consume" is on
|
|
|
|
|
};
|
|
|
|
|
"random-icons" = {
|
|
|
|
|
"off" = "<span color=\"#f53c3c\"></span> "; # Icon grayed out when "random" is off;
|
|
|
|
|
"on" = " ";
|
|
|
|
|
};
|
|
|
|
|
"repeat-icons" = {
|
|
|
|
|
"on" = " ";
|
|
|
|
|
};
|
|
|
|
|
"single-icons" = {
|
|
|
|
|
"on" = "1 ";
|
|
|
|
|
};
|
|
|
|
|
"state-icons" = {
|
|
|
|
|
"paused" = "";
|
|
|
|
|
"playing" = "";
|
|
|
|
|
};
|
|
|
|
|
"tooltip-format" = "MPD (connected)";
|
|
|
|
|
"tooltip-format-disconnected" = "MPD (disconnected)";
|
2023-03-23 09:59:44 +00:00
|
|
|
|
"on-click" = "${pkgs.mpc_cli}/bin/mpc toggle";
|
|
|
|
|
"on-click-right" = "${pkgs.mpc_cli}/bin/mpc stop";
|
2023-03-24 10:25:59 +00:00
|
|
|
|
"on-click-middle" = "${cfg.terminal} --class=kitty_ncmpcpp ${pkgs.ncmpcpp}/bin/ncmpcpp";
|
2022-09-16 15:25:19 +00:00
|
|
|
|
};
|
2022-10-31 11:05:14 +00:00
|
|
|
|
"custom/media" = {
|
|
|
|
|
"format" = "{icon}{}";
|
|
|
|
|
"return-type" = "json";
|
|
|
|
|
"format-icons" = {
|
|
|
|
|
"Playing" = " ";
|
|
|
|
|
"Paused" = " ";
|
|
|
|
|
};
|
|
|
|
|
"max-length" = 80;
|
|
|
|
|
"exec" = "${playerctl} -a metadata --format '{\"text\": \"{{artist}} - {{markup_escape(title)}}\", \"tooltip\": \"{{playerName}} : {{markup_escape(title)}}\", \"alt\": \"{{status}}\", \"class\": \"{{status}}\"}' -F";
|
|
|
|
|
"on-click" = "${playerctl} play-pause";
|
|
|
|
|
};
|
2022-04-19 23:36:11 +00:00
|
|
|
|
};
|
|
|
|
|
}
|
2023-03-23 09:59:44 +00:00
|
|
|
|
cfg.waybar.extraSettings])
|
2022-04-19 23:36:11 +00:00
|
|
|
|
];
|
|
|
|
|
style = ''
|
|
|
|
|
* {
|
|
|
|
|
border: none;
|
|
|
|
|
border-radius: 0;
|
|
|
|
|
font-family: IBM Plex Mono,'Font Awesome 5', 'SFNS Display', Helvetica, Arial, sans-serif;
|
2022-07-14 02:15:30 +00:00
|
|
|
|
font-size: ${toString cfg.fontSize}px;
|
2022-04-19 23:36:11 +00:00
|
|
|
|
min-height: 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
window#waybar {
|
|
|
|
|
background: rgba(43, 48, 59, 0.5);
|
|
|
|
|
border-bottom: 3px solid rgba(100, 114, 125, 0.5);
|
|
|
|
|
color: #ffffff;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
window#waybar.hidden {
|
|
|
|
|
opacity: 0.0;
|
|
|
|
|
}
|
|
|
|
|
/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
|
|
|
|
|
#workspaces button {
|
|
|
|
|
padding: 0 5px;
|
|
|
|
|
background: transparent;
|
|
|
|
|
color: #ffffff;
|
|
|
|
|
border-bottom: 3px solid transparent;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#workspaces button.focused {
|
|
|
|
|
background: #64727D;
|
|
|
|
|
border-bottom: 3px solid #ffffff;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#workspaces button.urgent {
|
|
|
|
|
background-color: #eb4d4b;
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-31 11:05:14 +00:00
|
|
|
|
#window, #sway, #sway-window {
|
|
|
|
|
padding: 0 10px;
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-19 23:36:11 +00:00
|
|
|
|
#mode {
|
|
|
|
|
background: #64727D;
|
|
|
|
|
border-bottom: 3px solid #ffffff;
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-08 23:24:50 +00:00
|
|
|
|
#clock, #battery, #cpu, #memory, #temperature, #backlight, #network, #pulseaudio, #bluetooth, #custom-media, #tray, #mode, #idle_inhibitor, #mpd {
|
2022-04-19 23:36:11 +00:00
|
|
|
|
padding: 0 10px;
|
|
|
|
|
margin: 0 5px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#clock {
|
|
|
|
|
background-color: #64727D;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#battery {
|
|
|
|
|
background-color: #ffffff;
|
|
|
|
|
color: #000000;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#battery.charging {
|
|
|
|
|
color: #ffffff;
|
|
|
|
|
background-color: #26A65B;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@keyframes blink {
|
|
|
|
|
to {
|
|
|
|
|
background-color: #ffffff;
|
|
|
|
|
color: #000000;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#battery.critical:not(.charging) {
|
|
|
|
|
background: #f53c3c;
|
|
|
|
|
color: #ffffff;
|
|
|
|
|
animation-name: blink;
|
|
|
|
|
animation-duration: 0.5s;
|
|
|
|
|
animation-timing-function: linear;
|
|
|
|
|
animation-iteration-count: infinite;
|
|
|
|
|
animation-direction: alternate;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#cpu {
|
|
|
|
|
background: #2ecc71;
|
|
|
|
|
color: #000000;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#memory {
|
|
|
|
|
background: #9b59b6;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#backlight {
|
|
|
|
|
background: #90b1b1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#network {
|
|
|
|
|
background: #2980b9;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#network.disconnected {
|
|
|
|
|
background: #f53c3c;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#pulseaudio {
|
|
|
|
|
background: #f1c40f;
|
|
|
|
|
color: #000000;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#pulseaudio.muted {
|
|
|
|
|
background: #90b1b1;
|
2023-03-08 23:24:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#bluetooth {
|
|
|
|
|
background: DarkSlateBlue;
|
|
|
|
|
color: white;
|
2022-04-19 23:36:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#custom-media {
|
|
|
|
|
background: #66cc99;
|
|
|
|
|
color: #2a5c45;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.custom-spotify {
|
|
|
|
|
background: #66cc99;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.custom-vlc {
|
|
|
|
|
background: #ffa000;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#temperature {
|
|
|
|
|
background: #f0932b;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#temperature.critical {
|
|
|
|
|
background: #eb4d4b;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#tray {
|
|
|
|
|
background-color: #2980b9;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#idle_inhibitor {
|
|
|
|
|
background-color: #2d3436;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#idle_inhibitor.activated {
|
|
|
|
|
background-color: #ecf0f1;
|
|
|
|
|
color: #2d3436;
|
|
|
|
|
}
|
2022-09-16 15:25:19 +00:00
|
|
|
|
|
|
|
|
|
#mpd {
|
|
|
|
|
background-color: teal;
|
|
|
|
|
color: white;
|
|
|
|
|
}
|
2023-03-23 09:59:44 +00:00
|
|
|
|
'' + cfg.waybar.extraStyle;
|
2022-04-19 23:36:11 +00:00
|
|
|
|
};
|
|
|
|
|
config.home.packages = mkIf cfg.enable (with pkgs; [
|
|
|
|
|
# Needed for QT_QPA_PLATFORM
|
|
|
|
|
qt5.qtwayland
|
|
|
|
|
# For waybar
|
|
|
|
|
font-awesome
|
2023-03-15 13:02:15 +00:00
|
|
|
|
# For launcher
|
|
|
|
|
ulauncher
|
2022-04-19 23:36:11 +00:00
|
|
|
|
]);
|
|
|
|
|
}
|
2023-02-25 20:43:29 +00:00
|
|
|
|
|