2020-02-17 17:00:59 +04:00
|
|
|
{ pkgs, lib, config, ... }:
|
|
|
|
let
|
2021-12-23 22:23:03 +04:00
|
|
|
thm = pkgs.my-lib.thmHash config.themes.colors;
|
2020-02-17 17:00:59 +04:00
|
|
|
apps = config.defaultApplications;
|
2023-02-07 13:51:46 +04:00
|
|
|
lock_fork = pkgs.writeShellScript "lock_fork"
|
|
|
|
"sudo /run/current-system/sw/bin/lock all &";
|
2020-11-09 23:43:06 +04:00
|
|
|
lock = pkgs.writeShellScript "lock"
|
2022-03-23 11:35:23 +04:00
|
|
|
"swaymsg 'output * dpms off'; sudo /run/current-system/sw/bin/lock all; swaymsg 'output * dpms on'";
|
2022-06-12 00:30:51 +04:00
|
|
|
htmlify = pkgs.writeShellScript "htmlify" ''
|
|
|
|
${pkgs.wl-clipboard}/bin/wl-paste -p | ${pkgs.pandoc}/bin/pandoc -t html | ${pkgs.wl-clipboard}/bin/wl-copy -t text/html
|
|
|
|
'';
|
2020-02-17 17:00:59 +04:00
|
|
|
in {
|
2021-01-21 22:13:53 +04:00
|
|
|
environment.sessionVariables = {
|
|
|
|
_JAVA_AWT_WM_NONREPARENTING = "1";
|
|
|
|
XDG_SESSION_TYPE = "wayland";
|
|
|
|
QT_QPA_PLATFORM = "wayland";
|
|
|
|
QT_WAYLAND_DISABLE_WINDOWDECORATION = "1";
|
|
|
|
};
|
|
|
|
|
|
|
|
programs.sway.enable = true;
|
2020-02-17 17:00:59 +04:00
|
|
|
|
2020-05-13 00:35:29 +04:00
|
|
|
programs.sway.wrapperFeatures.gtk = true;
|
|
|
|
|
2021-03-27 13:33:01 +04:00
|
|
|
programs.sway.extraPackages = lib.mkForce (with pkgs; [ swayidle xwayland ]);
|
2020-06-12 18:34:18 +04:00
|
|
|
|
2021-01-21 22:13:53 +04:00
|
|
|
users.users.balsoft.extraGroups = [ "sway" ];
|
|
|
|
|
2021-10-23 20:48:36 +04:00
|
|
|
environment.loginShellInit = lib.mkAfter ''
|
|
|
|
[[ "$(tty)" == /dev/tty1 ]] && {
|
|
|
|
pass unlock
|
|
|
|
sway
|
|
|
|
}
|
|
|
|
'';
|
2021-06-14 12:09:26 +04:00
|
|
|
|
2020-05-12 21:59:15 +04:00
|
|
|
home-manager.users.balsoft.wayland.windowManager.sway = {
|
2020-02-17 17:00:59 +04:00
|
|
|
enable = true;
|
|
|
|
config = rec {
|
|
|
|
assigns = {
|
2020-11-09 23:43:06 +04:00
|
|
|
"" = [
|
|
|
|
{ class = "Chromium"; }
|
|
|
|
{ app_id = "firefox"; }
|
|
|
|
{ class = "Firefox"; }
|
|
|
|
];
|
2021-11-12 16:23:49 +04:00
|
|
|
"" =
|
|
|
|
[ { app_id = "geary"; } { title = "nheko"; } { title = "Slack.*"; } ];
|
2020-02-17 17:00:59 +04:00
|
|
|
};
|
2021-05-10 04:04:18 +04:00
|
|
|
fonts = {
|
2021-06-10 19:58:51 +04:00
|
|
|
names = [ config.themes.fonts.main.family ];
|
2021-05-10 04:04:18 +04:00
|
|
|
style = "Regular";
|
|
|
|
size = 9.0;
|
|
|
|
};
|
2020-02-17 17:00:59 +04:00
|
|
|
|
|
|
|
colors = rec {
|
2021-06-10 19:58:51 +04:00
|
|
|
background = thm.base00;
|
2020-02-17 17:00:59 +04:00
|
|
|
unfocused = {
|
2023-01-24 17:51:04 +04:00
|
|
|
text = thm.base03;
|
2021-06-10 19:58:51 +04:00
|
|
|
border = thm.base01;
|
|
|
|
background = thm.base00;
|
|
|
|
childBorder = thm.base01;
|
|
|
|
indicator = thm.base07;
|
2020-02-17 17:00:59 +04:00
|
|
|
};
|
|
|
|
focusedInactive = unfocused;
|
|
|
|
urgent = unfocused // {
|
2021-06-10 19:58:51 +04:00
|
|
|
text = thm.base05;
|
|
|
|
border = thm.base09;
|
|
|
|
childBorder = thm.base09;
|
2020-02-17 17:00:59 +04:00
|
|
|
};
|
|
|
|
focused = unfocused // {
|
2021-06-10 19:58:51 +04:00
|
|
|
childBorder = thm.base03;
|
|
|
|
border = thm.base03;
|
|
|
|
background = thm.base01;
|
|
|
|
text = thm.base05;
|
2020-02-17 17:00:59 +04:00
|
|
|
};
|
|
|
|
};
|
|
|
|
gaps = {
|
|
|
|
inner = 6;
|
|
|
|
smartGaps = true;
|
|
|
|
smartBorders = "on";
|
|
|
|
};
|
|
|
|
focus.followMouse = false;
|
2020-05-12 23:38:45 +04:00
|
|
|
focus.forceWrapping = true;
|
2020-02-17 17:00:59 +04:00
|
|
|
modifier = "Mod4";
|
|
|
|
window = {
|
|
|
|
border = 1;
|
|
|
|
titlebar = true;
|
|
|
|
commands = [
|
|
|
|
{
|
|
|
|
command = "border pixel 2px";
|
|
|
|
criteria = { window_role = "popup"; };
|
|
|
|
}
|
|
|
|
{
|
|
|
|
command = "sticky enable";
|
|
|
|
criteria = { floating = ""; };
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
2021-11-12 16:23:49 +04:00
|
|
|
startup = (map (command: { inherit command; }) config.startupApplications)
|
|
|
|
++ [
|
2021-11-24 01:17:20 +04:00
|
|
|
{
|
2021-11-24 22:05:33 +04:00
|
|
|
command =
|
|
|
|
"dbus-update-activation-environment --systemd WAYLAND_DISPLAY GDK_BACKEND";
|
2021-11-24 01:17:20 +04:00
|
|
|
}
|
2021-11-12 16:23:49 +04:00
|
|
|
];
|
2023-02-07 13:51:46 +04:00
|
|
|
modes = {
|
2020-02-17 17:00:59 +04:00
|
|
|
|
2023-02-07 13:51:46 +04:00
|
|
|
normal = let
|
|
|
|
script = name: content: "exec ${pkgs.writeScript name content}";
|
|
|
|
workspaces = (builtins.genList (x: [ (toString x) (toString x) ]) 10)
|
|
|
|
++ [ [ "c" "" ] [ "t" "" ] [ "m" "ﱘ" ] ];
|
|
|
|
in ({
|
|
|
|
"Escape" = "mode default";
|
|
|
|
"Return" = "mode default";
|
|
|
|
"i" = "mode default";
|
|
|
|
"r" = "mode resize";
|
2020-02-17 17:00:59 +04:00
|
|
|
|
2023-02-07 13:51:46 +04:00
|
|
|
"q" = "kill";
|
|
|
|
"Shift+q" =
|
|
|
|
"move container to workspace temp; [workspace=__focused__] kill; workspace temp; move container to workspace temp; workspace temp";
|
|
|
|
"o" = "layout toggle all";
|
2020-02-17 17:00:59 +04:00
|
|
|
|
2023-02-07 13:51:46 +04:00
|
|
|
"Left" = "focus child; focus left";
|
|
|
|
"Right" = "focus child; focus right";
|
|
|
|
"Up" = "focus child; focus up";
|
|
|
|
"Down" = "focus child; focus down";
|
|
|
|
"Control+Left" = "focus parent; focus left";
|
|
|
|
"Control+Right" = "focus parent; focus right";
|
|
|
|
"Control+Up" = "focus parent; focus up";
|
|
|
|
"Control+Down" = "focus parent; focus down";
|
|
|
|
"Shift+Up" = "move up";
|
|
|
|
"Shift+Down" = "move down";
|
|
|
|
"Shift+Right" = "move right";
|
|
|
|
"Shift+Left" = "move left";
|
2020-08-25 11:54:05 +04:00
|
|
|
|
2023-02-07 13:51:46 +04:00
|
|
|
"Comma" = "workspace prev";
|
|
|
|
"Period" = "workspace next";
|
2020-02-17 17:00:59 +04:00
|
|
|
|
2023-02-07 13:51:46 +04:00
|
|
|
"h" = "focus child; focus left";
|
|
|
|
"l" = "focus child; focus right";
|
|
|
|
"k" = "focus child; focus up";
|
|
|
|
"j" = "focus child; focus down";
|
|
|
|
"Control+h" = "focus parent; focus left";
|
|
|
|
"Control+l" = "focus parent; focus right";
|
|
|
|
"Control+k" = "focus parent; focus up";
|
|
|
|
"Control+j" = "focus parent; focus down";
|
|
|
|
"Shift+k" = "move up";
|
|
|
|
"Shift+j" = "move down";
|
|
|
|
"Shift+l" = "move right";
|
|
|
|
"Shift+h" = "move left";
|
2020-02-17 17:00:59 +04:00
|
|
|
|
2023-02-07 13:51:46 +04:00
|
|
|
"f" = "fullscreen toggle; floating toggle";
|
|
|
|
"Shift+f" = "floating toggle";
|
2020-02-17 17:00:59 +04:00
|
|
|
|
2023-02-07 13:51:46 +04:00
|
|
|
"Shift+Escape" =
|
|
|
|
''exec ${apps.monitor.cmd}; [app_id="gnome-system-monitor"] focus'';
|
|
|
|
"F1" = ''
|
|
|
|
exec ${pkgs.pavucontrol}/bin/pavucontrol; [app_id="pavucontrol"] focus'';
|
|
|
|
"Shift+F1" = ''
|
2023-02-16 18:51:34 +04:00
|
|
|
exec ${pkgs.qpwgraph}/bin/qpwgraph; [app_id="org.freedesktop.ryuukyu.Helvum"] focus'';
|
2023-02-07 13:51:46 +04:00
|
|
|
"F3" = "exec ${pkgs.alsa-utils}/bin/amixer set Capture cap";
|
|
|
|
"Shift+F3" = "exec ${pkgs.alsa-utils}/bin/amixer set Capture nocap";
|
|
|
|
"F5" = "reload";
|
|
|
|
"Shift+F5" = "exit";
|
|
|
|
"z" = "exec ${pkgs.mako}/bin/makoctl dismiss";
|
|
|
|
"Shift+z" = "exec ${pkgs.mako}/bin/makoctl restore";
|
|
|
|
"Control+z" = "exec ${pkgs.mako}/bin/makoctl dismiss -a";
|
|
|
|
"F9" = ''
|
|
|
|
exec ${pkgs.libnotify}/bin/notify-send "Do not disturb: on"; exec ${pkgs.mako}/bin/makoctl set-mode do-not-disturb'';
|
|
|
|
"Shift+F9" = ''
|
|
|
|
exec ${pkgs.libnotify}/bin/notify-send "Do not disturb: off"; exec ${pkgs.mako}/bin/makoctl set-mode default'';
|
|
|
|
"F11" = "output * dpms off";
|
|
|
|
"F12" = "output * dpms on";
|
|
|
|
"End" = "exec ${lock}";
|
2020-05-25 16:44:06 +04:00
|
|
|
|
2023-02-07 13:51:46 +04:00
|
|
|
"Slash" = "exec ${pkgs.copyq}/bin/copyq menu";
|
|
|
|
"Shift+Slash" = "exec ${htmlify}";
|
2022-05-30 11:20:34 +04:00
|
|
|
|
2023-02-07 13:51:46 +04:00
|
|
|
"Print" = script "screenshot"
|
|
|
|
"${pkgs.grim}/bin/grim Pictures/$(date +'%Y-%m-%d+%H:%M:%S').png";
|
2020-02-17 17:00:59 +04:00
|
|
|
|
2023-02-07 13:51:46 +04:00
|
|
|
"Control+Print" = script "screenshot-copy"
|
|
|
|
"${pkgs.grim}/bin/grim - | ${pkgs.wl-clipboard}/bin/wl-copy";
|
2020-02-17 17:00:59 +04:00
|
|
|
|
2023-02-07 13:51:46 +04:00
|
|
|
"--release Shift+Print" = script "screenshot-area" ''
|
|
|
|
${pkgs.grim}/bin/grim -g "$(${pkgs.slurp}/bin/slurp)" Pictures/$(date +'%Y-%m-%d+%H:%M:%S').png'';
|
2020-02-17 17:00:59 +04:00
|
|
|
|
2023-02-07 13:51:46 +04:00
|
|
|
"--release Control+Shift+Print" = script "screenshot-area-copy" ''
|
2020-02-17 17:00:59 +04:00
|
|
|
${pkgs.grim}/bin/grim -g "$(${pkgs.slurp}/bin/slurp)" - | ${pkgs.wl-clipboard}/bin/wl-copy'';
|
|
|
|
|
2023-02-07 13:51:46 +04:00
|
|
|
"--release Insert" = script "screenshot-ocr" ''
|
|
|
|
${pkgs.grim}/bin/grim -g "$(${pkgs.slurp}/bin/slurp)" - | ${pkgs.tesseract5}/bin/tesseract -l eng - - | ${pkgs.wl-clipboard}/bin/wl-copy'';
|
|
|
|
|
|
|
|
"x" = "focus output right";
|
|
|
|
"Shift+x" = "move workspace to output right";
|
|
|
|
"quotedbl" = "layout splith";
|
|
|
|
"apostrophe" = "layout splitv";
|
|
|
|
"minus" = "move to scratchpad";
|
|
|
|
"underscore" = "scratchpad show";
|
|
|
|
"p" = "sticky toggle";
|
|
|
|
"b" = "focus mode_toggle";
|
|
|
|
"Space" = script "lambda-launcher"
|
|
|
|
"${pkgs.lambda-launcher}/bin/lambda-launcher";
|
|
|
|
"XF86AudioPlay" = "exec ${pkgs.playerctl}/bin/playerctl play-pause";
|
|
|
|
"XF86AudioPause" = "exec ${pkgs.playerctl}/bin/playerctl play-pause";
|
|
|
|
"XF86AudioNext" = "exec ${pkgs.playerctl}/bin/playerctl next";
|
|
|
|
"XF86AudioPrev" = "exec ${pkgs.playerctl}/bin/playerctl previous";
|
|
|
|
"XF86AudioLowerVolume" = "exec ${pkgs.pamixer}/bin/pamixer -d 2";
|
|
|
|
"XF86AudioRaiseVolume" = "exec ${pkgs.pamixer}/bin/pamixer -i 2";
|
|
|
|
"XF86AudioMute" = "exec ${pkgs.pamixer}/bin/pamixer -t";
|
|
|
|
"button2" = "kill";
|
|
|
|
} // builtins.listToAttrs (builtins.map (x: {
|
|
|
|
name = "${builtins.elemAt x 0}";
|
|
|
|
value = "workspace ${builtins.elemAt x 1}";
|
|
|
|
}) workspaces) // builtins.listToAttrs (builtins.map (x: {
|
|
|
|
name = "Shift+${builtins.elemAt x 0}";
|
|
|
|
value = "move container to workspace ${builtins.elemAt x 1}";
|
|
|
|
}) workspaces));
|
|
|
|
|
|
|
|
resize = {
|
|
|
|
Down = "resize grow height 50 px";
|
|
|
|
Escape = "mode default";
|
|
|
|
Left = "resize shrink width 50 px";
|
|
|
|
Return = "mode default";
|
|
|
|
Right = "resize grow width 50 px";
|
|
|
|
Up = "resize shrink height 50 px";
|
|
|
|
h = "resize shrink width 50 px";
|
|
|
|
j = "resize grow height 50 px";
|
|
|
|
k = "resize shrink height 50 px";
|
|
|
|
l = "resize grow width 50 px";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
keybindings = lib.mapAttrs' (name:
|
|
|
|
let
|
|
|
|
s = lib.splitString " " name;
|
|
|
|
flags = lib.init s;
|
|
|
|
in lib.nameValuePair "${builtins.concatStringsSep " " flags}${
|
|
|
|
lib.optionalString (builtins.length flags != 0) " "
|
|
|
|
}${modifier}+${lib.last s}") modes.normal // {
|
|
|
|
"${modifier}+Escape" = "mode normal";
|
|
|
|
"${modifier}+Return" = "exec ${apps.term.cmd}";
|
|
|
|
"XF86AudioPlay" = "exec ${pkgs.playerctl}/bin/playerctl play-pause";
|
|
|
|
"XF86AudioPause" = "exec ${pkgs.playerctl}/bin/playerctl play-pause";
|
|
|
|
"XF86AudioNext" = "exec ${pkgs.playerctl}/bin/playerctl next";
|
|
|
|
"XF86AudioPrev" = "exec ${pkgs.playerctl}/bin/playerctl previous";
|
|
|
|
"XF86AudioLowerVolume" = "exec ${pkgs.pamixer}/bin/pamixer -d 2";
|
|
|
|
"XF86AudioRaiseVolume" = "exec ${pkgs.pamixer}/bin/pamixer -i 2";
|
|
|
|
"XF86AudioMute" = "exec ${pkgs.pamixer}/bin/pamixer -t";
|
2023-02-07 18:03:27 +04:00
|
|
|
"button2" = "kill";
|
2023-02-16 18:51:34 +04:00
|
|
|
"--whole-window ${modifier}+button2" = "kill";
|
2023-02-07 13:51:46 +04:00
|
|
|
};
|
2022-08-26 12:11:36 +04:00
|
|
|
|
2020-11-09 23:43:06 +04:00
|
|
|
keycodebindings = { };
|
2020-02-17 17:00:59 +04:00
|
|
|
workspaceLayout = "tabbed";
|
2020-05-12 21:59:15 +04:00
|
|
|
workspaceAutoBackAndForth = true;
|
2020-05-12 23:38:45 +04:00
|
|
|
input = {
|
|
|
|
"2:14:ETPS/2_Elantech_Touchpad" = {
|
|
|
|
tap = "enabled";
|
|
|
|
natural_scroll = "enabled";
|
|
|
|
dwt = "enabled";
|
|
|
|
};
|
2020-11-09 23:43:06 +04:00
|
|
|
"2:14:ETPS/2_Elantech_TrackPoint" = { pointer_accel = "-0.7"; };
|
|
|
|
"2:10:TPPS/2_IBM_TrackPoint" = {
|
|
|
|
pointer_accel = "0.4";
|
|
|
|
accel_profile = "adaptive";
|
2020-05-12 23:38:45 +04:00
|
|
|
};
|
|
|
|
};
|
|
|
|
output = {
|
2021-06-10 19:58:51 +04:00
|
|
|
"*".bg = "${thm.base00} solid_color";
|
2020-06-24 10:39:24 +04:00
|
|
|
} // lib.optionalAttrs (config.device == "AMD-Workstation") {
|
2023-02-27 20:41:57 +04:00
|
|
|
DP-1 = {transform = "270"; position = "0 0"; };
|
|
|
|
HDMI-A-1 = {
|
|
|
|
position = "1440 1280";
|
|
|
|
};
|
2020-11-10 15:24:32 +04:00
|
|
|
} // lib.optionalAttrs (config.device == "X2100-Laptop") {
|
2020-11-09 23:43:06 +04:00
|
|
|
"Unknown 0x0000 0x00000000".scale = "2";
|
2022-05-03 23:50:04 +04:00
|
|
|
} // lib.optionalAttrs (config.device == "T490s-Laptop") {
|
|
|
|
DP-2.position = "0 0";
|
2020-05-12 23:38:45 +04:00
|
|
|
};
|
2020-05-12 21:59:15 +04:00
|
|
|
};
|
2020-11-09 23:43:06 +04:00
|
|
|
wrapperFeatures = { gtk = true; };
|
2020-02-17 17:00:59 +04:00
|
|
|
extraConfig = ''
|
|
|
|
default_border pixel 1
|
|
|
|
mouse_warping container
|
|
|
|
hide_edge_borders --i3 smart
|
|
|
|
exec pkill swaynag
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
}
|