devos/users/profiles/sway/default.nix

110 lines
3.3 KiB
Nix
Raw Permalink Normal View History

2022-02-22 22:01:49 +01:00
{ pkgs, lib, ... }@inputs:
2021-07-15 18:51:27 +02:00
let
2021-08-31 23:21:03 +02:00
rofi = pkgs.rofi.override { plugins = [ pkgs.rofi-emoji ]; };
scripts = ((import ./scripts.nix) inputs);
2021-07-15 18:51:27 +02:00
in
2021-04-15 01:06:10 +02:00
{
imports = [ ./swayidle.nix ];
2021-07-15 18:51:27 +02:00
wayland.windowManager.sway = rec {
2021-04-15 01:06:10 +02:00
enable = true;
config = {
2021-07-15 18:51:27 +02:00
terminal = "${pkgs.alacritty}/bin/alacritty";
menu = "${rofi}/bin/rofi -show combi";
2021-04-15 01:06:10 +02:00
modifier = "Mod4";
2022-05-12 20:41:01 +02:00
output = {
"*" = {
bg = "${./wallpaper.png} fill";
};
};
2021-04-15 01:06:10 +02:00
input = {
"*" = {
xkb_layout = "pl";
accel_profile = "flat";
2021-06-06 12:22:12 +02:00
dwt = "disabled";
2021-08-31 23:21:03 +02:00
pointer_accel = "0.0";
2021-04-15 01:06:10 +02:00
};
};
bars = [{
position = "top";
2022-06-29 13:52:31 +02:00
command = "${pkgs.waybar}/bin/waybar";
2021-04-15 01:06:10 +02:00
}];
floating.criteria = [{ title = "Steam - Update News"; }];
2021-08-31 23:20:46 +02:00
startup = [
2021-08-31 23:21:03 +02:00
# Copied from https://git.sr.ht/~sumner/home-manager-config/tree/master/item/modules/window-manager/wayland.nix#L64
# See https://github.com/nix-community/home-manager/issues/2028
# Make all the pinentry stuff work
# See: https://github.com/NixOS/nixpkgs/issues/119445#issuecomment-820507505
# and: https://github.com/NixOS/nixpkgs/issues/57602#issuecomment-820512097
{ command = "dbus-update-activation-environment WAYLAND_DISPLAY"; }
2021-08-31 23:20:46 +02:00
];
keybindings = lib.mkOptionDefault {
2022-08-02 18:54:41 +02:00
"XF86PowerOff" = "exec systemctl hibernate";
};
2021-04-15 01:06:10 +02:00
};
wrapperFeatures.gtk = true;
systemdIntegration = true;
2021-05-07 12:06:29 +02:00
extraSessionCommands = ''
#export SDL_VIDEODRIVER=wayland
2021-05-07 12:06:29 +02:00
# needs qt5.qtwayland in systemPackages
export QT_QPA_PLATFORM=wayland
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
'';
2021-04-15 01:06:10 +02:00
};
2022-06-29 13:52:31 +02:00
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";
2022-07-01 21:20:02 +02:00
exec = pkgs.writeShellScript "riley-gender" ''
2022-06-29 13:52:31 +02:00
set -euo pipefail
2022-07-01 21:20:02 +02:00
until ping -c1 google.com >/dev/null 2>&1; do :; done
2022-06-29 13:52:31 +02:00
gender="$(${pkgs.curl}/bin/curl 'https://rly.cx/api/gender')"
pronouns="$(${pkgs.curl}/bin/curl 'https://rly.cx/api/pronouns')"
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;
};
2021-08-31 23:21:03 +02:00
2021-07-15 18:51:27 +02:00
programs.rofi = {
2021-08-31 23:21:03 +02:00
enable = true;
package = rofi;
theme = "purple";
extraConfig = {
modi = "combi";
combi-modi = "drun,emoji";
};
2021-07-15 18:51:27 +02:00
};
2021-04-15 01:06:10 +02:00
2021-08-15 00:45:20 +02:00
programs.mako = {
2021-08-31 23:21:03 +02:00
enable = true;
defaultTimeout = 2000;
2021-08-15 00:45:20 +02:00
};
2022-02-22 22:01:49 +01:00
home.packages = [ scripts.lockscreen ];
2021-04-15 01:06:10 +02:00
}