devos/users/profiles/sway/default.nix
2023-04-28 13:00:59 +02:00

107 lines
3 KiB
Nix

{ pkgs, lib, config, ... }@inputs:
let
rofi = pkgs.rofi.override { plugins = [ pkgs.rofi-emoji ]; };
scripts = ((import ./scripts.nix) inputs);
in
{
imports = [ ./swayidle.nix ];
wayland.windowManager.sway = rec {
enable = true;
config = {
terminal = "alacritty";
menu = "${rofi}/bin/rofi -show combi";
modifier = "Mod4";
output = {
"*" = {
bg = "${./wallpaper.png} fill";
};
};
input = {
"*" = {
xkb_layout = "pl";
accel_profile = "flat";
dwt = "disabled";
pointer_accel = "0.0";
xkb_options = "caps:escape";
};
};
bars = [{
position = "top";
command = "${pkgs.waybar}/bin/waybar";
}];
floating.criteria = [{ title = "Steam - Update News"; }];
startup = [
# Support for old style xembed tray icons, mostly used by wine
{ command = "${pkgs.plasma-workspace}/bin/xembedsniproxy"; }
];
keybindings = lib.mkOptionDefault {
"XF86PowerOff" = "exec systemctl suspend";
};
};
wrapperFeatures.gtk = true;
systemdIntegration = true;
extraSessionCommands = ''
#export SDL_VIDEODRIVER=wayland
export QT_WAYLAND_FORCE_DPI=physical
export QT_WAYLAND_DISABLE_WINDOWDECORATION=1
# Fix for some Java AWT applications (e.g. Android Studio),
# use this if they aren't displayed properly:
export _JAVA_AWT_WM_NONREPARENTING=1
'';
};
programs.waybar = {
enable = true;
settings = {
mainBar = {
layer = "top";
position = "top";
modules-left = [ "sway/workspaces" "sway/mode" ];
modules-center = [ ];
modules-right = [ "custom/riley-gender" "disk" "battery" "backlight" "pulseaudio" "clock" "tray" ];
"custom/riley-gender" = {
interval = "360";
exec = pkgs.writeShellScript "riley-gender" ''
set -euo pipefail
until ping -c1 google.com >/dev/null 2>&1; do :; done
summary="$(${pkgs.curl}/bin/curl 'https://riley.lgbt/api/summary')"
pronouns="$(echo $summary | jq -r '.pronouns')"
gender="$(echo $summary | jq -r '.gender')"
echo -n "Riley: $gender ($pronouns)"
'';
};
backlight = {
on-scroll-up = "${pkgs.brightnessctl}/bin/brightnessctl s +1%";
on-scroll-down = "${pkgs.brightnessctl}/bin/brightnessctl s 1%- -n 1";
};
clock = {
format = "{:%a %d %b %H:%M}";
};
disk = {
format = "{percentage_free}%({free})";
};
pulseaudio = {
on-click-right = "${pkgs.pulseaudio}/bin/pactl set-sink-mute @DEFAULT_SINK@ toggle";
};
};
};
style = ./waybar.css;
};
programs.rofi = {
enable = true;
package = rofi;
theme = "purple";
extraConfig = {
modi = "combi";
combi-modi = "drun,emoji";
};
};
services.mako = {
enable = true;
defaultTimeout = 2000;
};
home.packages = [ scripts.lockscreen ];
}