This commit is contained in:
dusk 2022-02-19 18:05:45 +03:00
parent 98f3962767
commit 5649488360
Signed by: dusk
GPG Key ID: 1D8F8FAF2294D6EA

View File

@ -336,82 +336,86 @@ in {
]; ];
}; };
wayland.windowManager = { wayland.windowManager = {
sway = { sway =
enable = true; let
extraSessionCommands = extraEnv; mkRofiCmd = args: "${config.programs.rofi.finalPackage}/bin/rofi ${lib.concatStringsSep " " args} | ${pkgs.sway}/bin/swaymsg --";
wrapperFeatures.gtk = true; in {
extraConfig = enable = true;
'' extraSessionCommands = extraEnv;
exec dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway wrapperFeatures.gtk = true;
''; extraConfig =
config = { ''
fonts = { exec dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway
names = [font]; '';
size = fontSize + 0.0; config = {
}; fonts = {
bars = [{ command = "${pkgBin "waybar"}"; }]; names = [font];
colors = { size = fontSize + 0.0;
background = "#${bgColor}";
focused = addIndSway focusedWorkspace;
focusedInactive = addIndSway inactiveWorkspace;
unfocused = addIndSway activeWorkspace;
urgent = addIndSway urgentWorkspace;
};
gaps.smartBorders = "on";
menu = "${pkgs.rofi-wayland}/bin/rofi -show drun | ${pkgs.sway}/bin/swaymsg --";
modifier = "Mod4";
terminal = pkgBin "alacritty";
keybindings =
let
mod = config.wayland.windowManager.sway.config.modifier;
cat = pkgs.coreutils + "/bin/cat";
grim = pkgBin "grim";
slurp = pkgBin "slurp";
pactl = pkgs.pulseaudio + "/bin/pactl";
playerctl = pkgBin "playerctl";
wf-recorder = pkgBin "wf-recorder";
wl-copy = pkgs.wl-clipboard + "/bin/wl-copy";
wl-paste = pkgs.wl-clipboard + "/bin/wl-paste";
shotFile = config.home.homeDirectory + "/shots/shot_$(date '+%Y_%m_%d_%H_%M')";
in
lib.mkOptionDefault
{
"${mod}+q" = "kill";
"${mod}+Shift+e" = "exit";
"${mod}+Shift+r" = "reload";
# Screenshot and copy it to clipboard
"Mod1+s" =
''
exec export SFILE="${shotFile}.png" && ${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" && ${grim} -g "$(${slurp})" "$SFILE" && ${cat} "$SFILE" | ${wl-copy} -t image/png
'';
# Record screen
"Mod1+r" = ''exec ${wf-recorder} -f "${shotFile}.mp4"'';
# Record an area
"Mod1+Shift+r" = ''exec ${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";
};
input = {
"*" = {
xkb_layout = nixosConfig.services.xserver.layout;
accel_profile = "flat";
}; };
bars = [{ command = "${pkgBin "waybar"}"; }];
colors = {
background = "#${bgColor}";
focused = addIndSway focusedWorkspace;
focusedInactive = addIndSway inactiveWorkspace;
unfocused = addIndSway activeWorkspace;
urgent = addIndSway urgentWorkspace;
};
gaps.smartBorders = "on";
menu = mkRofiCmd ["-show" "drun"];
modifier = "Mod4";
terminal = pkgBin "alacritty";
keybindings =
let
mod = config.wayland.windowManager.sway.config.modifier;
cat = pkgs.coreutils + "/bin/cat";
grim = pkgBin "grim";
slurp = pkgBin "slurp";
pactl = pkgs.pulseaudio + "/bin/pactl";
playerctl = pkgBin "playerctl";
wf-recorder = pkgBin "wf-recorder";
wl-copy = pkgs.wl-clipboard + "/bin/wl-copy";
wl-paste = pkgs.wl-clipboard + "/bin/wl-paste";
shotFile = config.home.homeDirectory + "/shots/shot_$(date '+%Y_%m_%d_%H_%M')";
in
lib.mkOptionDefault
{
"${mod}+q" = "kill";
"${mod}+Shift+e" = "exit";
"${mod}+Shift+r" = "reload";
"${mod}+c" = mkRofiCmd ["-show" "calc"];
# Screenshot and copy it to clipboard
"Mod1+s" =
''
exec export SFILE="${shotFile}.png" && ${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" && ${grim} -g "$(${slurp})" "$SFILE" && ${cat} "$SFILE" | ${wl-copy} -t image/png
'';
# Record screen
"Mod1+r" = ''exec ${wf-recorder} -f "${shotFile}.mp4"'';
# Record an area
"Mod1+Shift+r" = ''exec ${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";
};
input = {
"*" = {
xkb_layout = nixosConfig.services.xserver.layout;
accel_profile = "flat";
};
};
output = { "*" = { bg = config.home.homeDirectory + "/wallpaper.png" + " fill"; }; };
}; };
output = { "*" = { bg = config.home.homeDirectory + "/wallpaper.png" + " fill"; }; };
}; };
};
}; };
programs = { programs = {
alacritty = { alacritty = {
@ -585,18 +589,22 @@ in {
}; };
}; };
fzf.enable = true; fzf.enable = true;
rofi = rofi = {
let enable = true;
bgc = "#${bgColor}"; package = pkgs.rofi-wayland;
fgc = "#${fgColor}"; cycle = true;
acc = "#${acColor}"; font = fontComb;
in { terminal = pkgBin "alacritty";
enable = true; plugins = with pkgs; [
package = pkgs.rofi-wayland; rofi-calc
cycle = true; rofi-systemd
font = fontComb; rofi-file-browser
terminal = pkgBin "alacritty"; rofi-power-menu
];
extraConfig = {
modi = "drun,calc,file-browser-extended,ssh,keys";
}; };
};
vscode = { vscode = {
enable = true; enable = true;
package = pkgs.vscodeWayland; package = pkgs.vscodeWayland;