System/home-manager/programs/sway.nix

246 lines
7.3 KiB
Nix
Raw Normal View History

2022-06-23 02:57:41 -04:00
{ config, lib, pkgs, inputs, ... }:
let
nathan = config.nathan;
in
with lib;
2021-12-20 13:37:26 -05:00
{
2022-06-23 02:57:41 -04:00
config = mkIf nathan.programs.swaywm.enable (
2022-04-19 18:01:39 -04:00
let
swaylock-command = "${pkgs.swaylock-effects}/bin/swaylock --screenshots --grace 30 --indicator --clock --timestr \"%-I:%M:%S %p\" --datestr \"%A %Y-%M-%d\" --effect-blur 20x3";
in
{
2022-07-02 22:59:13 -04:00
home.packages = with pkgs; [
# Locking and display management
wdisplays
swaylock-effects
swayidle
# Clipboard
wl-clipboard
# Notifications
mako
# Terminal
alacritty
# glib for sound stuff
glib
# Glpaper for the background
(glpaper.overrideAttrs (old: {
src = fetchFromSourcehut {
owner = "~scoopta";
repo = "glpaper";
vc = "hg";
rev = "f89e60b7941fb60f1069ed51af9c5bb4917aab35";
hash = "sha256-E7FKjt3NL0aAEibfaq+YS2IVvpjNjInA+Rs8SU63/3M=";
};
}))
# Screenshots
sway-contrib.grimshot
# fuzzel for launcher
fuzzel
];
2022-06-23 02:57:41 -04:00
#########################
## Sway
#########################
2022-04-19 18:01:39 -04:00
wayland.windowManager.sway = {
enable = true;
systemdIntegration = true;
wrapperFeatures = {
base = true;
gtk = true;
};
2022-05-02 21:47:42 -04:00
extraSessionCommands = ''
# Make qt theming work
export QT_QPA_PLATFORMTHEME="qt5ct"
'';
2022-04-19 18:01:39 -04:00
config = {
# Setup gaps
gaps = {
smartGaps = true;
inner = 9;
};
# disable borders
window = {
border = 0;
};
# Use windows key as modifier
modifier = "Mod4";
# Alacritty as default terminal
terminal = "alacritty";
# Use krunner (from kde) as our launcher
2022-07-02 22:59:13 -04:00
menu = ''
fuzzel -f Fira -b "103c48ff" -S "adbcbcff" -s "184956ff" -t "72898fff" -B 5 -r 5 -C "ed8649ff"
'';
2022-05-02 21:47:42 -04:00
# Use waybar, but through systemd
2022-05-16 00:54:46 -04:00
bars = [
2022-07-02 22:36:59 -04:00
# {
# command = "waybar";
# }
2022-05-16 00:54:46 -04:00
];
2022-07-02 22:59:13 -04:00
# Use fira
2022-04-19 18:01:39 -04:00
fonts = {
2022-07-02 22:59:13 -04:00
names = [ "Fira" ];
2022-04-19 18:01:39 -04:00
size = 10.0;
};
# Setup keybindings
keybindings =
let
modifer = "Mod4";
in
lib.mkOptionDefault {
"${modifer}+q" = "kill";
"${modifer}+z" = "exec ${swaylock-command}";
## Sreenshot keybinds
# Copy area to clipboard
"${modifer}+x" = "exec ${pkgs.sway-contrib.grimshot}/bin/grimshot copy area";
# Copy window to clipboard
"${modifer}+Ctrl+x" = "exec ${pkgs.sway-contrib.grimshot}/bin/grimshot copy window";
# Clpy entire output to clipboard
"${modifer}+Alt+x" = "exec ${pkgs.sway-contrib.grimshot}/bin/grimshot copy output";
};
2022-04-19 19:00:41 -04:00
# Startup applications
startup = [
# Mako, the notification daemon
{ command = "mako"; }
];
2022-05-15 22:39:20 -04:00
# Other stuff
};
2022-05-15 22:39:20 -04:00
# disable transparency for minecraft
extraConfig = ''
for_window [title=".*Minecraft.*"] opacity 1
'';
2022-04-19 18:01:39 -04:00
};
2022-06-23 02:57:41 -04:00
#########################
## Mako (notifications)
#########################
2022-04-19 18:01:39 -04:00
programs.mako = {
enable = true;
# Selenized color scheme
borderColor = "#f275be";
backgroundColor = "#184956";
textColor = "#adbcbc";
# Border configuration
borderSize = 3;
# Use Fira Code for font
2022-07-02 22:59:13 -04:00
font = "Fira 10";
2022-04-19 18:01:39 -04:00
# Group by application
groupBy = "app-name";
# Bottom right corner
anchor = "bottom-right";
2022-06-17 18:38:11 -04:00
# Maximum visible notifications
maxVisible = 10;
# Sort by time in descending order (newest first)
sort = "-time";
2022-07-02 21:32:06 -04:00
# Don't time out notifications , I want to have to dismiss them
defaultTimeout = 0;
ignoreTimeout = true;
2022-04-19 18:01:39 -04:00
};
2022-06-23 02:57:41 -04:00
#########################
## Swayidle
#########################
2022-04-19 18:01:39 -04:00
services.swayidle = {
enable = true;
timeouts = [
# Lock the screen after 5 minutes of inactivity
{
timeout = 300;
2022-04-19 19:14:58 -04:00
command = builtins.replaceStrings [ "%" ] [ "%%" ] swaylock-command;
2022-04-19 18:01:39 -04:00
}
# Turn off the displays after 10 minutes of inactivity
{
timeout = 600;
command = "swaymsg \"output * dpms off\"";
resumeCommand = "swaymsg \"output * dpms on\"";
}
];
};
2022-06-23 02:57:41 -04:00
#########################
## Waybar
#########################
2022-05-02 21:47:42 -04:00
programs.waybar = {
enable = true;
2022-06-23 02:57:41 -04:00
package = inputs.nixpkgs-unstable.legacyPackages."${pkgs.system}".waybar;
2022-07-02 21:32:06 -04:00
systemd = {
enable = false;
};
};
# Override the service to run during graphical-session-pre.target
systemd.user.services.waybar = {
Unit = {
Description =
"Highly customizable Wayland bar for Sway and Wlroots based compositors.";
Documentation = "https://github.com/Alexays/Waybar/wiki";
Before = [ "tray.target" ];
};
Service = {
ExecStart = "${config.programs.waybar.package}/bin/waybar";
ExecReload = "${pkgs.coreutils}/bin/kill -SIGUSR2 $MAINPID";
ExecstartPost = "${pkgs.coreutils}/bin/sleep 1";
Restart = "on-failure";
KillMode = "mixed";
};
Install = { WantedBy = [ "graphical-session-pre.target" ]; };
2022-06-23 02:57:41 -04:00
};
#########################
## Alacritty
#########################
programs.alacritty = {
enable = true;
settings = {
env = {
TERM = "xterm-256color";
ALACRITTY = "1";
};
font = {
normal.family = "FiraCode Nerd Font";
bold.family = "FiraCode Nerd Font";
italic.family = "FiraCode Nerd Font";
bold_italic.family = "FiraCode Nerd Font";
size = 9.0;
};
colors = {
primary = {
background = "0x103c48";
foreground = "0xadbcbc";
};
normal = {
black = "0x184956";
red = "0xfa5750";
green = "0x75b938";
yellow = "0xdbb32d";
blue = "0x4695f7";
magenta = "0xf275be";
cyan = "0x41c7b9";
white = "0x72898f";
};
bright = {
black = "0x2d5b69";
red = "0xff665c";
green = "0x84c747";
yellow = "0xebc13d";
blue = "0x58a3ff";
magenta = "0xff84cd";
cyan = "0x53d6c7";
white = "0xcad8d9";
};
};
};
2022-05-02 21:47:42 -04:00
};
2022-06-23 02:57:41 -04:00
#########################
## EasyEffects
#########################
services.easyeffects.enable = true;
2022-07-02 21:32:06 -04:00
#########################
## Create tray target to fix some things
#########################
systemd.user.targets.tray = {
Unit = {
Description = "Home Manager System Tray";
Requires = [ "graphical-session-pre.target" "waybar.service" ];
2022-07-02 22:36:59 -04:00
After = [ "waybar.service" ];
2022-07-02 21:32:06 -04:00
};
};
2022-06-23 02:57:41 -04:00
}
);
2021-12-20 13:37:26 -05:00
}