2022-11-27 01:04:43 +03:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
nixosConfig,
|
|
|
|
pkgs,
|
|
|
|
lib,
|
|
|
|
tlib,
|
|
|
|
...
|
|
|
|
}: {
|
|
|
|
imports = [
|
|
|
|
../wayland
|
|
|
|
../swaylock
|
|
|
|
../wlsunset
|
|
|
|
../dunst
|
|
|
|
../rofi
|
|
|
|
# ./swayidle.nix
|
|
|
|
];
|
|
|
|
wayland.windowManager = {
|
|
|
|
sway = let
|
|
|
|
mkRofiCmd = args: "${config.programs.rofi.package}/bin/rofi ${lib.concatStringsSep " " args} | ${pkgs.sway}/bin/swaymsg --";
|
|
|
|
inherit (tlib) pkgBin;
|
|
|
|
in {
|
|
|
|
enable = true;
|
|
|
|
extraSessionCommands = ''
|
|
|
|
export SDL_VIDEODRIVER=wayland
|
|
|
|
export QT_QPA_PLATFORM=wayland
|
|
|
|
'';
|
|
|
|
wrapperFeatures.gtk = true;
|
|
|
|
extraConfig = ''
|
|
|
|
exec dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway
|
|
|
|
exec xprop -root -f _XWAYLAND_GLOBAL_OUTPUT_SCALE 32c -set _XWAYLAND_GLOBAL_OUTPUT_SCALE 2
|
|
|
|
'';
|
|
|
|
config = {
|
|
|
|
bars = [];
|
|
|
|
gaps.smartBorders = "on";
|
|
|
|
menu = mkRofiCmd ["-show" "drun"];
|
|
|
|
modifier = "Mod4";
|
|
|
|
terminal = config.settings.terminal.binary;
|
|
|
|
keybindings = let
|
|
|
|
mod = config.wayland.windowManager.sway.config.modifier;
|
|
|
|
|
|
|
|
cat = pkgs.coreutils + "/bin/cat";
|
|
|
|
grim = pkgBin pkgs.grim;
|
|
|
|
slurp = pkgBin pkgs.slurp;
|
|
|
|
pactl = pkgs.pulseaudio + "/bin/pactl";
|
|
|
|
playerctl = pkgBin pkgs.playerctl;
|
|
|
|
wf-recorder = pkgBin pkgs.wf-recorder;
|
|
|
|
wl-copy = pkgs.wl-clipboard + "/bin/wl-copy";
|
|
|
|
wlogout = pkgBin pkgs.wlogout;
|
|
|
|
light = pkgBin pkgs.light;
|
|
|
|
|
|
|
|
shotFile = config.home.homeDirectory + "/shots/shot_$(date '+%Y_%m_%d_%H_%M')";
|
|
|
|
shotDir = config.home.homeDirectory + "/shots";
|
|
|
|
in
|
|
|
|
lib.mkOptionDefault
|
|
|
|
{
|
|
|
|
"${mod}+Escape" = "exec ${wlogout} -p layer-shell";
|
|
|
|
"${mod}+q" = "kill";
|
|
|
|
"${mod}+Shift+e" = "exit";
|
|
|
|
"${mod}+Shift+r" = "reload";
|
|
|
|
# Screenshot and copy it to clipboard
|
|
|
|
"Mod1+s" = ''
|
|
|
|
exec export SFILE="${shotFile}.png" && mkdir -p ${shotDir} && ${grim} "$SFILE" && ${cat} "$SFILE" | ${wl-copy} -t image/png
|
|
|
|
'';
|
|
|
|
# Save selected area as a picture and copy it to clipboard
|
|
|
|
"Mod1+Shift+s" = ''
|
|
|
|
exec export SFILE="${shotFile}.png" && mkdir -p ${shotDir} && ${grim} -g "$(${slurp})" "$SFILE" && ${cat} "$SFILE" | ${wl-copy} -t image/png
|
|
|
|
'';
|
|
|
|
# Record screen
|
|
|
|
"Mod1+r" = ''exec mkdir -p ${shotDir} && ${wf-recorder} -f "${shotFile}.mp4"'';
|
|
|
|
# Record an area
|
|
|
|
"Mod1+Shift+r" = ''exec mkdir -p ${shotDir} && ${wf-recorder} -g "$(${slurp})" -f "${shotFile}.mp4"'';
|
|
|
|
# Stop recording
|
|
|
|
"Mod1+c" = "exec pkill -INT wf-recorder";
|
|
|
|
"XF86AudioRaiseVolume" = "exec ${pactl} set-sink-volume 0 +5%";
|
|
|
|
"XF86AudioLowerVolume" = "exec ${pactl} set-sink-volume 0 -5%";
|
|
|
|
"XF86AudioMute" = "exec ${pactl} set-sink-mute 0 toggle";
|
|
|
|
"XF86AudioPlay" = "exec ${playerctl} play-pause";
|
|
|
|
"XF86AudioPrev" = "exec ${playerctl} previous";
|
|
|
|
"XF86AudioNext" = "exec ${playerctl} next";
|
|
|
|
"XF86AudioStop" = "exec ${playerctl} stop";
|
|
|
|
"XF86MonBrightnessUp" = "exec ${light} -T 1.4";
|
|
|
|
"XF86MonBrightnessDown" = "exec ${light} -T 0.72";
|
|
|
|
};
|
|
|
|
input = {
|
2023-01-25 16:57:18 +03:00
|
|
|
"type:keyboard" = {
|
2022-11-27 01:04:43 +03:00
|
|
|
xkb_layout = nixosConfig.services.xserver.layout;
|
2023-01-25 16:57:18 +03:00
|
|
|
};
|
|
|
|
"type:pointer" = {
|
2022-11-27 01:04:43 +03:00
|
|
|
accel_profile = "flat";
|
|
|
|
};
|
2023-01-25 16:57:18 +03:00
|
|
|
"type:touchpad" = {
|
|
|
|
accel_profile = "adaptive";
|
|
|
|
tap = "enabled";
|
2023-02-25 00:44:31 +03:00
|
|
|
scroll_method = "two_finger";
|
2023-01-25 16:57:18 +03:00
|
|
|
dwt = "enabled";
|
|
|
|
events = "disabled_on_external_mouse";
|
|
|
|
};
|
2022-11-27 01:04:43 +03:00
|
|
|
};
|
|
|
|
output = {
|
|
|
|
"*" = {
|
2023-03-24 15:10:42 +03:00
|
|
|
bg = "${config.stylix.image} fill";
|
2023-03-16 17:59:13 +03:00
|
|
|
# adaptive_sync = "on";
|
2022-11-27 01:04:43 +03:00
|
|
|
};
|
|
|
|
"eDP-1" = {
|
|
|
|
scale = "2";
|
|
|
|
};
|
|
|
|
"HDMI-A-1" = {
|
2023-03-16 17:59:13 +03:00
|
|
|
mode = "1920x1080@60.000Hz";
|
2022-11-27 01:04:43 +03:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|