2023-01-24 02:24:40 +07:00
|
|
|
{ options, config, pkgs, lib, ... }:
|
|
|
|
let
|
2023-12-24 14:27:43 +07:00
|
|
|
modifier = if config.phone.enable then "Mod1" else "Mod4";
|
2023-02-20 06:59:00 +07:00
|
|
|
rofiSway = config.programs.rofi.finalPackage;
|
|
|
|
rofiI3 = pkgs.rofi.override { plugins = config.programs.rofi.plugins; };
|
2023-12-22 19:22:17 +07:00
|
|
|
audioNext = pkgs.writeShellScript "playerctl-next" ''
|
|
|
|
${pkgs.playerctl}/bin/playerctl next
|
2023-12-24 21:08:49 +07:00
|
|
|
PLAYER=$(${pkgs.playerctl}/bin/playerctl -l | ${pkgs.coreutils}/bin/head -n 1)
|
2023-02-26 17:41:58 +07:00
|
|
|
# mpdris2 bug: audio wont play after a seek/skip, you have to pause-unpause
|
|
|
|
if [[ "$PLAYER" == "mpd" ]]; then
|
2023-12-22 19:22:17 +07:00
|
|
|
${pkgs.playerctl}/bin/playerctl pause
|
|
|
|
${pkgs.playerctl}/bin/playerctl position 0
|
|
|
|
${pkgs.playerctl}/bin/playerctl play
|
2023-02-26 17:41:58 +07:00
|
|
|
fi
|
|
|
|
'';
|
2023-12-22 19:22:17 +07:00
|
|
|
audioPrev = pkgs.writeShellScript "playerctl-prev" ''
|
2023-02-26 17:41:58 +07:00
|
|
|
# just seek if over 5 seconds into the track
|
2023-12-22 19:22:17 +07:00
|
|
|
POS=$(${pkgs.playerctl}/bin/playerctl position)
|
2023-12-24 21:08:49 +07:00
|
|
|
PLAYER=$(${pkgs.playerctl}/bin/playerctl -l | ${pkgs.coreutils}/bin/head -n 1)
|
2023-02-26 17:41:58 +07:00
|
|
|
if [ -n "$POS" ]; then
|
2023-12-22 19:22:17 +07:00
|
|
|
if (( $(echo "$POS > 5.01" | ${pkgs.bc}/bin/bc -l) )); then
|
2023-02-26 17:41:58 +07:00
|
|
|
SEEK=1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if [ -z "$SEEK" ]; then
|
2023-12-22 19:22:17 +07:00
|
|
|
${pkgs.playerctl}/bin/playerctl previous
|
2023-02-26 17:41:58 +07:00
|
|
|
else
|
2023-12-22 19:22:17 +07:00
|
|
|
${pkgs.playerctl}/bin/playerctl position 0
|
2023-02-26 17:41:58 +07:00
|
|
|
fi
|
|
|
|
# mpdris2 bug: audio wont play after a seek/skip, you have to pause-unpause
|
|
|
|
if [[ "$PLAYER" == "mpd" ]]; then
|
2023-12-22 19:22:17 +07:00
|
|
|
${pkgs.playerctl}/bin/playerctl pause
|
|
|
|
${pkgs.playerctl}/bin/playerctl position 0
|
|
|
|
${pkgs.playerctl}/bin/playerctl play
|
2023-02-26 17:41:58 +07:00
|
|
|
fi
|
|
|
|
'';
|
2023-12-24 16:28:34 +07:00
|
|
|
swaylock =
|
|
|
|
if config.phone.enable
|
|
|
|
then "${pkgs.schlock}/bin/schlock -fp /secrets/schlock.pin"
|
|
|
|
else "${pkgs.swaylock}/bin/swaylock -f";
|
|
|
|
swaylock-start = pkgs.writeShellScript "swaylock-start" ''
|
|
|
|
${pkgs.procps}/bin/pgrep -fx "${swaylock}" || ${swaylock}
|
|
|
|
'';
|
|
|
|
dpms-off = pkgs.writeShellScript "sway-dpms-off" ''
|
|
|
|
${config.wayland.windowManager.sway.package}/bin/swaymsg output "*" power off
|
|
|
|
${config.wayland.windowManager.sway.package}/bin/swaymsg input type:touch events disabled
|
|
|
|
'';
|
|
|
|
dpms-on = pkgs.writeShellScript "sway-dpms-on" ''
|
|
|
|
${config.wayland.windowManager.sway.package}/bin/swaymsg output "*" power on
|
|
|
|
${config.wayland.windowManager.sway.package}/bin/swaymsg input type:touch events enabled
|
|
|
|
'';
|
2023-12-24 21:08:49 +07:00
|
|
|
lock-script = pkgs.writeShellScript "lock-start" ''
|
|
|
|
${swaylock-start}
|
|
|
|
${lib.optionalString config.phone.enable
|
|
|
|
# suspend if nothing is playing
|
|
|
|
''
|
|
|
|
${pkgs.playerctl}/bin/playerctl -a status | ${pkgs.gnugrep}/bin/grep Playing >/dev/null || /run/current-system/sw/bin/systemctl suspend
|
|
|
|
''}
|
|
|
|
'';
|
2023-01-27 04:05:30 +07:00
|
|
|
barConfig = {
|
2023-12-24 14:27:43 +07:00
|
|
|
mode = "overlay";
|
2023-01-27 04:05:30 +07:00
|
|
|
hiddenState = "hide";
|
|
|
|
position = "bottom";
|
|
|
|
workspaceButtons = true;
|
|
|
|
workspaceNumbers = true;
|
|
|
|
fonts = {
|
|
|
|
names = [ "Noto Sans Mono" "Symbols Nerd Font Mono" ];
|
|
|
|
size = 16.0;
|
|
|
|
};
|
|
|
|
trayOutput = "*";
|
|
|
|
colors = {
|
2023-02-26 17:41:58 +07:00
|
|
|
background = "#${config.colors.background}";
|
|
|
|
statusline = "#${config.colors.foreground}";
|
|
|
|
separator = "#${config.colors.brBlack}";
|
2023-01-27 04:05:30 +07:00
|
|
|
focusedWorkspace = {
|
|
|
|
border = "#782a2a";
|
|
|
|
background = "#782a2a";
|
2023-02-26 17:41:58 +07:00
|
|
|
text = "#${config.colors.foreground}";
|
2023-01-24 02:24:40 +07:00
|
|
|
};
|
2023-01-27 04:05:30 +07:00
|
|
|
activeWorkspace = {
|
|
|
|
border = "#913131";
|
|
|
|
background = "#913131";
|
2023-02-26 17:41:58 +07:00
|
|
|
text = "#${config.colors.foreground}";
|
2023-01-27 04:05:30 +07:00
|
|
|
};
|
|
|
|
inactiveWorkspace = {
|
|
|
|
border = "#472222";
|
|
|
|
background = "#4d2525";
|
|
|
|
text = "#8c8284";
|
|
|
|
};
|
|
|
|
urgentWorkspace = {
|
|
|
|
border = "#734545";
|
|
|
|
background = "#993d3d";
|
2023-02-26 17:41:58 +07:00
|
|
|
text = "#${config.colors.foreground}";
|
2023-01-27 04:05:30 +07:00
|
|
|
};
|
|
|
|
bindingMode = {
|
|
|
|
border = "#734545";
|
|
|
|
background = "#993d3d";
|
2023-02-26 17:41:58 +07:00
|
|
|
text = "#${config.colors.foreground}";
|
2023-01-24 02:24:40 +07:00
|
|
|
};
|
2023-01-27 04:05:30 +07:00
|
|
|
};
|
|
|
|
};
|
|
|
|
commonConfig = {
|
2023-02-20 00:49:39 +07:00
|
|
|
inherit modifier;
|
2023-01-24 02:24:40 +07:00
|
|
|
startup = [
|
2023-12-22 19:22:17 +07:00
|
|
|
{ command = toString (pkgs.writeShellScript "init-wm" ''
|
2023-12-24 14:27:43 +07:00
|
|
|
${lib.optionalString config.phone.enable ''
|
2023-12-25 08:17:39 +07:00
|
|
|
${pkgs.procps}/bin/pkill -x wvkbd-mobintl
|
2023-12-24 14:27:43 +07:00
|
|
|
${pkgs.wvkbd}/bin/wvkbd-mobintl --hidden -l full,special,cyrillic,emoji&
|
2023-12-25 08:17:39 +07:00
|
|
|
${pkgs.procps}/bin/pkill -x squeekboard
|
|
|
|
${pkgs.squeekboard}/bin/squeekboard&
|
2023-12-24 21:08:49 +07:00
|
|
|
/run/current-system/sw/bin/busctl call --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 SetVisible b true
|
2023-12-24 14:27:43 +07:00
|
|
|
''}
|
2023-12-25 08:17:39 +07:00
|
|
|
${pkgs.procps}/bin/pkill -x home-daemon
|
2024-03-19 15:30:38 +07:00
|
|
|
${pkgs.home-daemon}/bin/home-daemon system76-scheduler ${lib.optionalString (!config.phone.enable) "empty-sound"}&
|
2023-12-25 08:17:39 +07:00
|
|
|
${pkgs.procps}/bin/pkill -x keepassxc
|
|
|
|
${pkgs.gnome.zenity}/bin/zenity --password | (${pkgs.keepassxc}/bin/keepassxc --pw-stdin ~/var/local.kdbx &)
|
|
|
|
# sleep to give keepassxc time to take the input
|
|
|
|
sleep 1
|
2023-02-20 00:49:39 +07:00
|
|
|
# nextcloud and nheko need secret service access
|
2023-12-25 08:17:39 +07:00
|
|
|
${pkgs.procps}/bin/pkill -x nextcloud
|
2023-12-22 19:22:17 +07:00
|
|
|
${pkgs.nextcloud-client}/bin/nextcloud --background&
|
2023-12-25 08:17:39 +07:00
|
|
|
${pkgs.procps}/bin/pkill -x nheko
|
2023-12-22 19:22:17 +07:00
|
|
|
${pkgs.nheko}/bin/nheko&
|
2023-12-25 08:17:39 +07:00
|
|
|
${pkgs.procps}/bin/pkill -x telegram-desktop
|
2023-12-22 19:22:17 +07:00
|
|
|
${pkgs.tdesktop}/bin/telegram-desktop -startintray&
|
2023-12-25 08:17:39 +07:00
|
|
|
# and final sleep just in case
|
|
|
|
sleep 1
|
2023-02-20 00:49:39 +07:00
|
|
|
''); }
|
2023-01-24 02:24:40 +07:00
|
|
|
];
|
|
|
|
colors = {
|
|
|
|
focused = {
|
2023-02-26 17:41:58 +07:00
|
|
|
childBorder = "#b0a3a5${config.colors.hexAlpha}";
|
|
|
|
# background = "#${config.colors.background}${config.colors.hexAlpha}";
|
2023-02-03 13:07:57 +07:00
|
|
|
background = "#4c4042e0";
|
2023-02-26 17:41:58 +07:00
|
|
|
# border = "#${config.colors.background}${config.colors.hexAlpha}";
|
2023-02-03 13:07:57 +07:00
|
|
|
border = "#4c4042e0";
|
2023-01-24 02:24:40 +07:00
|
|
|
indicator = "#b35656";
|
2023-02-26 17:41:58 +07:00
|
|
|
text = "#${config.colors.foreground}";
|
2023-01-24 02:24:40 +07:00
|
|
|
};
|
|
|
|
focusedInactive = {
|
2023-02-26 17:41:58 +07:00
|
|
|
# background = "#${config.colors.background}${config.colors.hexAlpha}";
|
2023-02-03 13:07:57 +07:00
|
|
|
background = "#4c4042e0";
|
2023-02-26 17:41:58 +07:00
|
|
|
# border = "#${config.colors.background}${config.colors.hexAlpha}";
|
2023-02-03 13:07:57 +07:00
|
|
|
border = "#4c4042e0";
|
2023-02-26 17:41:58 +07:00
|
|
|
childBorder = "#${config.colors.background}${config.colors.hexAlpha}";
|
2023-01-24 02:24:40 +07:00
|
|
|
indicator = "#b32d2d";
|
2023-02-26 17:41:58 +07:00
|
|
|
text = "#${config.colors.foreground}";
|
2023-01-24 02:24:40 +07:00
|
|
|
};
|
|
|
|
unfocused = {
|
2023-02-26 17:41:58 +07:00
|
|
|
background = "#${config.colors.background}${config.colors.hexAlpha}";
|
|
|
|
# border = "#${config.colors.background}${config.colors.hexAlpha}";
|
2023-02-03 13:07:57 +07:00
|
|
|
border = "#4c4042e0";
|
2023-02-26 17:41:58 +07:00
|
|
|
childBorder = "#${config.colors.background}${config.colors.hexAlpha}";
|
2023-01-24 02:24:40 +07:00
|
|
|
indicator = "#661a1a";
|
2023-02-26 17:41:58 +07:00
|
|
|
text = "#${config.colors.foreground}";
|
2023-01-24 02:24:40 +07:00
|
|
|
};
|
|
|
|
urgent = {
|
|
|
|
background = "#993d3d";
|
|
|
|
border = "#734545";
|
2023-01-27 04:05:30 +07:00
|
|
|
childBorder = "#734545";
|
2023-01-24 02:24:40 +07:00
|
|
|
indicator = "#993d3d";
|
2023-02-26 17:41:58 +07:00
|
|
|
text = "#${config.colors.foreground}";
|
2023-01-24 02:24:40 +07:00
|
|
|
};
|
|
|
|
};
|
2023-02-19 19:09:38 +07:00
|
|
|
floating.criteria = [
|
|
|
|
{ class = "Anki"; title = "Add"; }
|
|
|
|
{ class = "Anki"; title = "Statistics"; }
|
|
|
|
{ class = "Anki"; title = "Preferences"; }
|
|
|
|
];
|
2023-01-24 02:24:40 +07:00
|
|
|
floating.titlebar = true;
|
|
|
|
fonts = {
|
2023-01-27 04:05:30 +07:00
|
|
|
names = [ "Noto Sans Mono" "Symbols Nerd Font Mono" ];
|
2023-01-24 02:24:40 +07:00
|
|
|
size = 16.0;
|
|
|
|
};
|
2024-08-05 05:52:19 +07:00
|
|
|
# gaps = {
|
|
|
|
# smartBorders = "on";
|
|
|
|
# smartGaps = true;
|
|
|
|
# inner = 10;
|
|
|
|
# };
|
2023-01-25 01:33:07 +07:00
|
|
|
window.hideEdgeBorders = "smart";
|
2023-01-24 02:24:40 +07:00
|
|
|
workspaceAutoBackAndForth = true;
|
|
|
|
};
|
|
|
|
genKeybindings = (default_options: kb:
|
|
|
|
kb // {
|
|
|
|
"${modifier}+Shift+g" = "floating toggle";
|
|
|
|
"${modifier}+g" = "focus mode_toggle";
|
2023-01-26 22:56:32 +07:00
|
|
|
XF86AudioMicMute = "exec ${pkgs.pamixer}/bin/pamixer --default-source --toggle-mute";
|
|
|
|
XF86MonBrightnessDown = "exec ${pkgs.brightnessctl}/bin/brightnessctl set 5%-";
|
|
|
|
XF86MonBrightnessUp = "exec ${pkgs.brightnessctl}/bin/brightnessctl set 5%+";
|
2023-01-24 02:24:40 +07:00
|
|
|
}
|
2023-12-22 19:22:17 +07:00
|
|
|
// (lib.filterAttrs
|
2023-01-24 02:24:40 +07:00
|
|
|
(k: v:
|
|
|
|
!(builtins.elem
|
|
|
|
k
|
2023-12-22 19:22:17 +07:00
|
|
|
[ "${modifier}+space" "${modifier}+Shift+space" ]))
|
|
|
|
(builtins.head
|
|
|
|
(builtins.head
|
2023-01-24 02:24:40 +07:00
|
|
|
default_options.config.type.getSubModules)
|
|
|
|
.imports)
|
|
|
|
.options.keybindings.default)
|
|
|
|
);
|
|
|
|
in
|
|
|
|
{
|
2023-02-20 00:49:39 +07:00
|
|
|
# TODO merge with colors in gui.nix and terminal.nix
|
2023-02-19 19:09:38 +07:00
|
|
|
imports = [ ./options.nix ./gui.nix ./waybar.nix ];
|
2023-01-25 01:33:07 +07:00
|
|
|
home.sessionVariables = {
|
|
|
|
_JAVA_AWT_WM_NONREPARENTING = "1";
|
|
|
|
};
|
|
|
|
xdg.configFile."xdg-desktop-portal-wlr/config".source = (pkgs.formats.ini {}).generate "xdg-desktop-portal-wlr.ini" {
|
|
|
|
screencast = {
|
|
|
|
max_fps = 60;
|
|
|
|
chooser_type = "simple";
|
|
|
|
chooser-cmd = "''${pkgs.slurp}/bin/slurp -f %o -or";
|
|
|
|
# exec_before
|
|
|
|
# exec_after
|
|
|
|
};
|
|
|
|
};
|
|
|
|
systemd.user.services = lib.mkIf config.wayland.windowManager.sway.enable {
|
|
|
|
gammastep.Unit.ConditionEnvironment = "WAYLAND_DISPLAY";
|
|
|
|
};
|
2023-03-07 18:20:08 +07:00
|
|
|
services.mako = {
|
2023-01-24 02:24:40 +07:00
|
|
|
enable = lib.mkDefault config.wayland.windowManager.sway.enable;
|
|
|
|
# ms
|
|
|
|
defaultTimeout = 7500;
|
|
|
|
font = "Noto Sans Mono 12";
|
|
|
|
};
|
|
|
|
xsession.windowManager.i3 = {
|
2023-01-25 01:33:07 +07:00
|
|
|
config = let i3Config = {
|
2023-01-27 04:05:30 +07:00
|
|
|
bars = [
|
|
|
|
(barConfig // {
|
|
|
|
statusCommand = "${pkgs.i3status}/bin/i3status";
|
|
|
|
})
|
|
|
|
];
|
2023-02-20 06:59:00 +07:00
|
|
|
menu = "${rofiI3}/bin/rofi -show drun";
|
2023-01-26 22:56:32 +07:00
|
|
|
keybindings = genKeybindings options.xsession.windowManager.i3 {
|
2023-02-20 06:59:00 +07:00
|
|
|
"${modifier}+c" = "exec ${rofiI3}/bin/rofi -show calc -no-show-match -no-sort -no-persist-history";
|
2023-01-26 22:56:32 +07:00
|
|
|
XF86AudioRaiseVolume = "exec ${pkgs.pamixer}/bin/pamixer --increase 5";
|
|
|
|
XF86AudioLowerVolume = "exec ${pkgs.pamixer}/bin/pamixer --decrease 5";
|
|
|
|
XF86AudioMute = "exec ${pkgs.pamixer}/bin/pamixer --toggle-mute";
|
|
|
|
XF86AudioPlay = "exec ${pkgs.playerctl}/bin/playerctl play-pause";
|
2023-02-26 17:41:58 +07:00
|
|
|
XF86AudioNext = "exec ${audioNext}";
|
|
|
|
XF86AudioPrev = "exec ${audioPrev}";
|
2023-01-26 22:56:32 +07:00
|
|
|
};
|
2023-01-26 03:41:45 +07:00
|
|
|
terminal = config.terminalBinX;
|
2023-02-20 00:49:39 +07:00
|
|
|
}; in commonConfig // i3Config;
|
2023-01-24 02:24:40 +07:00
|
|
|
};
|
|
|
|
home.file.".xinitrc".text = ''
|
|
|
|
if test -z "$DBUS_SESSION_BUS_ADDRESS"; then
|
|
|
|
eval $(dbus-launch --exit-with-session --sh-syntax)
|
|
|
|
fi
|
|
|
|
systemctl --user import-environment DISPLAY XAUTHORITY
|
|
|
|
if command -v dbus-update-activation-environment >/dev/null 2>&1; then
|
|
|
|
dbus-update-activation-environment DISPLAY XAUTHORITY
|
|
|
|
fi
|
|
|
|
exec i3
|
|
|
|
'';
|
|
|
|
xsession.initExtra = ''
|
2023-02-13 21:56:34 +07:00
|
|
|
setxkbmap -layout jp,ru -option compose:ralt,grp:win_space_toggle
|
2023-01-24 02:24:40 +07:00
|
|
|
'';
|
|
|
|
wayland.windowManager.sway = {
|
|
|
|
wrapperFeatures.gtk = true;
|
2023-05-23 11:33:32 +07:00
|
|
|
package = pkgs.sway-unwrapped.overrideAttrs (old: {
|
|
|
|
patches = old.patches or [] ++ [
|
|
|
|
./sway.patch
|
|
|
|
/*(pkgs.fetchpatch {
|
|
|
|
url = "https://patch-diff.githubusercontent.com/raw/swaywm/sway/pull/6920.patch";
|
|
|
|
sha256 = "sha256-XgkysduhHbmprE334yeL65txpK0HNXeCmgCZMxpwsgU=";
|
|
|
|
})*/
|
|
|
|
];
|
|
|
|
});
|
2023-02-21 16:36:44 +07:00
|
|
|
extraConfig = ''
|
|
|
|
title_align center
|
|
|
|
'';
|
2024-03-19 15:30:38 +07:00
|
|
|
checkConfig = false;
|
2023-12-24 14:27:43 +07:00
|
|
|
config = commonConfig // {
|
2023-01-27 04:05:30 +07:00
|
|
|
bars = [
|
|
|
|
{
|
|
|
|
command = "${config.programs.waybar.package}/bin/waybar";
|
|
|
|
mode = "dock";
|
2023-02-03 13:07:57 +07:00
|
|
|
position = "top";
|
2023-01-27 04:05:30 +07:00
|
|
|
hiddenState = "hide";
|
|
|
|
}
|
|
|
|
];
|
2023-01-26 03:41:45 +07:00
|
|
|
terminal = config.terminalBin;
|
2023-12-24 16:28:34 +07:00
|
|
|
window = commonConfig.window // { commands = lib.optionals config.phone.enable [
|
|
|
|
{ command = "floating off; fullscreen off";
|
|
|
|
criteria = {
|
|
|
|
floating = true;
|
|
|
|
}; }
|
|
|
|
{ command = "fullscreen off";
|
|
|
|
criteria = {
|
|
|
|
tiling = true;
|
|
|
|
}; }
|
|
|
|
] ++ [
|
|
|
|
{ command = "floating on; move workspace current";
|
2023-01-25 01:33:07 +07:00
|
|
|
criteria = {
|
|
|
|
app_id = "^org.keepassxc.KeePassXC$";
|
|
|
|
title = "^KeePassXC - (?:Browser |ブラウザーの)?(?:Access Request|アクセス要求)$";
|
|
|
|
}; }
|
2024-08-05 05:52:19 +07:00
|
|
|
{ command = "floating on; border normal";
|
|
|
|
criteria = {
|
|
|
|
class = "ghidra-Ghidra";
|
|
|
|
title = "\\[CodeBrowser.*\\]$";
|
|
|
|
}; }
|
2023-02-20 00:49:39 +07:00
|
|
|
]; };
|
2023-01-24 02:24:40 +07:00
|
|
|
assigns = {
|
2023-02-03 13:07:57 +07:00
|
|
|
"2" = [
|
|
|
|
{ app_id = "org.telegram.desktop"; }
|
|
|
|
{ app_id = "nheko"; }
|
|
|
|
];
|
2023-01-24 02:24:40 +07:00
|
|
|
"3" = [{ app_id = "org.keepassxc.KeePassXC"; }];
|
2023-07-12 03:26:50 +07:00
|
|
|
"4" = [
|
|
|
|
{ class = "Steam"; }
|
|
|
|
{ class = "steam"; }
|
|
|
|
];
|
2023-01-24 02:24:40 +07:00
|
|
|
};
|
2023-01-26 22:56:32 +07:00
|
|
|
keybindings = genKeybindings options.wayland.windowManager.sway (with pkgs.sway-contrib;
|
2023-05-23 11:33:32 +07:00
|
|
|
/*let
|
2023-01-26 22:56:32 +07:00
|
|
|
modifiers = [
|
|
|
|
"shift"
|
|
|
|
"lock" # caps lock
|
|
|
|
"control"
|
|
|
|
"mod1" # alt
|
|
|
|
"mod2" # num lock
|
|
|
|
# "mod3" # no keys are here by default
|
|
|
|
"mod4" # super/hyper
|
|
|
|
"mod5" # alt gr?
|
|
|
|
];
|
|
|
|
modifierPairs =
|
|
|
|
builtins.filter
|
|
|
|
(x: x != null)
|
|
|
|
(builtins.map
|
|
|
|
({a, b}: if a >= b then null else "${a}+${b}")
|
|
|
|
(lib.attrsets.cartesianProductOfSets {
|
|
|
|
a = modifiers;
|
2023-01-27 04:05:30 +07:00
|
|
|
b = modifiers;
|
2023-01-26 22:56:32 +07:00
|
|
|
}));
|
|
|
|
modifierTriples = ["control+shift+mod1" "control+shift+mod4" "control+mod1+mod4" "control+shift+mod5"];
|
|
|
|
modifierCombos = modifiers ++ modifierPairs ++ modifierTriples;
|
|
|
|
# god this is so annoying... sway doesn't provide the option to ignore
|
|
|
|
# modifiers in a binding because i3 doesn't have it, and I'm not about
|
|
|
|
# to ask i3 to add it just so I can ask sway to add it.. this will do
|
|
|
|
forAllModifiers = (prefix: key: cmd:
|
|
|
|
lib.attrsets.genAttrs
|
|
|
|
((builtins.map
|
|
|
|
(mod: "${prefix}${mod}+${key}")
|
|
|
|
modifierCombos)
|
|
|
|
++ ["${prefix}${key}"])
|
|
|
|
(name: cmd));
|
|
|
|
in (forAllModifiers
|
|
|
|
"--inhibited --no-repeat "
|
|
|
|
"Scroll_Lock"
|
|
|
|
"exec ${pkgs.mumble}/bin/mumble rpc starttalking")
|
|
|
|
// (forAllModifiers
|
|
|
|
"--inhibited --no-repeat --release "
|
|
|
|
"Scroll_Lock"
|
2023-05-17 03:23:56 +07:00
|
|
|
# mumble remembers the amount of times starttalking has been called,
|
|
|
|
# and if stoptalking isn't called for some reason, calling it one time stops being enough
|
|
|
|
"exec ${pkgs.mumble}/bin/mumble rpc stoptalking && ${pkgs.mumble}/bin/mumble rpc stoptalking")
|
2023-05-23 11:33:32 +07:00
|
|
|
//*/ {
|
|
|
|
"--inhibited --no-repeat --allow-other Scroll_Lock" = "exec ${pkgs.mumble}/bin/mumble rpc starttalking";
|
|
|
|
"--inhibited --no-repeat --allow-other --release Scroll_Lock" = "exec ${pkgs.mumble}/bin/mumble rpc stoptalking";
|
2023-02-20 06:59:00 +07:00
|
|
|
"${modifier}+c" = "exec ${rofiSway}/bin/rofi -show calc -no-show-match -no-sort -no-persist-history";
|
2023-01-24 02:24:40 +07:00
|
|
|
"${modifier}+Print" = "exec ${grimshot}/bin/grimshot copy area";
|
2023-12-24 14:27:43 +07:00
|
|
|
"${modifier}+${if modifier == "Mod1" then "Mod4" else "Mod1"}+Print" = "exec ${grimshot}/bin/grimshot copy window";
|
2023-01-26 22:56:32 +07:00
|
|
|
"--locked XF86AudioRaiseVolume" = "exec ${pkgs.pamixer}/bin/pamixer --increase 5";
|
|
|
|
"--locked XF86AudioLowerVolume" = "exec ${pkgs.pamixer}/bin/pamixer --decrease 5";
|
|
|
|
"--locked XF86AudioMute" = "exec ${pkgs.pamixer}/bin/pamixer --toggle-mute";
|
2023-01-27 04:05:30 +07:00
|
|
|
"--locked --inhibited XF86AudioPlay" = "exec ${pkgs.playerctl}/bin/playerctl play-pause";
|
2023-02-26 17:41:58 +07:00
|
|
|
"--locked --inhibited XF86AudioNext" = "exec ${audioNext}";
|
|
|
|
"--locked --inhibited XF86AudioPrev" = "exec ${audioPrev}";
|
2023-12-24 16:28:34 +07:00
|
|
|
"--locked --inhibited --release XF86PowerOff" = lib.mkIf config.phone.enable "exec ${pkgs.writeShellScript "power-key" ''
|
|
|
|
if ${config.wayland.windowManager.sway.package}/bin/swaymsg -rt get_outputs | ${pkgs.jq}/bin/jq ".[].power" | ${pkgs.gnugrep}/bin/grep true; then
|
|
|
|
${dpms-off}
|
|
|
|
else
|
|
|
|
${dpms-on}
|
|
|
|
fi
|
|
|
|
''}";
|
2023-01-24 02:24:40 +07:00
|
|
|
});
|
2023-12-25 08:17:39 +07:00
|
|
|
startup = [
|
2023-01-25 01:33:07 +07:00
|
|
|
{
|
|
|
|
always = true;
|
|
|
|
command = "systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP";
|
|
|
|
}
|
2023-01-24 02:24:40 +07:00
|
|
|
{
|
|
|
|
command = "${pkgs.wl-clipboard}/bin/wl-paste -t text --watch ${pkgs.clipman}/bin/clipman store --no-persist";
|
|
|
|
}
|
2023-12-25 08:17:39 +07:00
|
|
|
] ++ commonConfig.startup;
|
2023-01-24 02:24:40 +07:00
|
|
|
output = {
|
|
|
|
"*" = {
|
|
|
|
bg = "~/var/wallpaper.jpg fill";
|
|
|
|
# improved screen latency, apparently
|
|
|
|
max_render_time = "2";
|
2023-02-21 16:36:44 +07:00
|
|
|
adaptive_sync = "on";
|
2023-01-24 02:24:40 +07:00
|
|
|
};
|
|
|
|
};
|
|
|
|
input = {
|
|
|
|
"*" = {
|
|
|
|
xkb_layout = "jp,ru";
|
2023-02-13 21:56:34 +07:00
|
|
|
xkb_options = "compose:ralt,grp:win_space_toggle";
|
2023-01-24 02:24:40 +07:00
|
|
|
};
|
|
|
|
};
|
2023-02-20 06:59:00 +07:00
|
|
|
menu = "${rofiSway}/bin/rofi -show drun";
|
2023-12-24 14:27:43 +07:00
|
|
|
workspaceLayout = "tabbed";
|
|
|
|
};
|
2023-05-10 16:42:56 +07:00
|
|
|
# export WLR_RENDERER=vulkan
|
2023-12-22 19:22:17 +07:00
|
|
|
extraSessionCommands = lib.optionalString config.wayland.windowManager.sway.vulkan ''
|
2023-02-21 16:36:44 +07:00
|
|
|
export WLR_RENDERER=vulkan
|
2023-12-22 19:22:17 +07:00
|
|
|
'' + ''
|
2023-03-07 18:20:08 +07:00
|
|
|
export SDL_VIDEODRIVER=wayland,x11,kmsdrm,windows,directx
|
|
|
|
# SDL3
|
|
|
|
export SDL_VIDEO_DRIVER=wayland,x11,kmsdrm,windows
|
2023-01-24 02:24:40 +07:00
|
|
|
export QT_QPA_PLATFORM=wayland
|
|
|
|
export QT_WAYLAND_DISABLE_WINDOWDECORATION=1
|
|
|
|
export QT_QPA_PLATFORMTHEME=gnome
|
|
|
|
export MOZ_ENABLE_WAYLAND=1
|
2023-02-13 21:56:34 +07:00
|
|
|
export GDK_BACKEND=wayland,x11
|
2023-01-25 01:33:07 +07:00
|
|
|
export GTK_USE_PORTAL=1
|
|
|
|
export XDG_CURRENT_DESKTOP=sway
|
2023-02-19 19:09:38 +07:00
|
|
|
export XDG_SESSION_DESKTOP=sway
|
2023-01-24 02:24:40 +07:00
|
|
|
'';
|
|
|
|
};
|
2023-12-24 21:08:49 +07:00
|
|
|
services.swayidle = {
|
|
|
|
enable = config.wayland.windowManager.sway.enable && !config.phone.enable;
|
2023-02-03 13:07:57 +07:00
|
|
|
events = [
|
2023-12-24 16:28:34 +07:00
|
|
|
{ event = "before-sleep"; command = toString swaylock-start; }
|
2023-02-03 13:07:57 +07:00
|
|
|
# after-resume, lock, unlock
|
|
|
|
];
|
|
|
|
timeouts = [
|
2023-12-24 16:28:34 +07:00
|
|
|
{ timeout = if config.phone.enable then 30 else 300;
|
|
|
|
command = toString dpms-off;
|
|
|
|
resumeCommand = toString dpms-on; }
|
|
|
|
{ timeout = if config.phone.enable then 60 else 600;
|
2023-12-24 21:08:49 +07:00
|
|
|
command = toString lock-script; }
|
2023-02-03 13:07:57 +07:00
|
|
|
];
|
|
|
|
};
|
2023-02-19 19:09:38 +07:00
|
|
|
programs.swaylock.settings = rec {
|
2023-02-03 13:07:57 +07:00
|
|
|
image = "${config.home.homeDirectory}/var/wallpaper.jpg";
|
|
|
|
font = "Unifont";
|
|
|
|
font-size = 64;
|
|
|
|
|
|
|
|
indicator-caps-lock = true;
|
|
|
|
indicator-radius = 256;
|
|
|
|
indicator-thickness = 32;
|
|
|
|
separator-color = "#00000000";
|
|
|
|
|
2023-02-19 19:09:38 +07:00
|
|
|
layout-text-color = text-color;
|
|
|
|
layout-bg-color = inside-color;
|
2023-02-03 13:07:57 +07:00
|
|
|
layout-border-color = "#00000000";
|
|
|
|
|
|
|
|
line-uses-inside = true;
|
|
|
|
|
2023-02-26 17:41:58 +07:00
|
|
|
inside-color = "#${config.colors.background}${config.colors.hexAlpha}";
|
|
|
|
text-color = "#${config.colors.foreground}";
|
|
|
|
ring-color = "#${config.colors.green}";
|
2023-02-03 13:07:57 +07:00
|
|
|
key-hl-color = "#6398bf"; # blue
|
2023-02-26 17:41:58 +07:00
|
|
|
bs-hl-color = "#${config.colors.red}";
|
2023-02-03 13:07:57 +07:00
|
|
|
|
2023-02-19 19:09:38 +07:00
|
|
|
inside-caps-lock-color = inside-color;
|
|
|
|
text-caps-lock-color = text-color;
|
2023-02-26 17:41:58 +07:00
|
|
|
ring-caps-lock-color = "#${config.colors.yellow}";
|
2023-02-19 19:09:38 +07:00
|
|
|
caps-lock-key-hl-color = key-hl-color;
|
|
|
|
caps-lock-bs-hl-color = bs-hl-color;
|
2023-02-03 13:07:57 +07:00
|
|
|
|
2023-02-19 19:09:38 +07:00
|
|
|
inside-clear-color = inside-color;
|
|
|
|
text-clear-color = text-color;
|
2023-02-26 17:41:58 +07:00
|
|
|
ring-clear-color = ring-color;
|
2023-02-03 13:07:57 +07:00
|
|
|
|
2023-02-19 19:09:38 +07:00
|
|
|
inside-ver-color = inside-color;
|
|
|
|
text-ver-color = text-color;
|
2023-02-26 17:41:58 +07:00
|
|
|
ring-ver-color = "#${config.colors.magenta}";
|
2023-02-03 13:07:57 +07:00
|
|
|
|
2023-02-19 19:09:38 +07:00
|
|
|
inside-wrong-color = inside-color;
|
|
|
|
text-wrong-color = text-color;
|
2023-02-03 13:07:57 +07:00
|
|
|
ring-wrong-color = "#e64e4e"; # deep-ish red
|
|
|
|
};
|
2023-12-22 19:22:17 +07:00
|
|
|
home.packages = lib.mkIf config.wayland.windowManager.sway.enable (with pkgs; [
|
2023-02-20 00:49:39 +07:00
|
|
|
wl-clipboard
|
|
|
|
xdg-desktop-portal
|
|
|
|
xdg-desktop-portal-wlr
|
|
|
|
xdg-desktop-portal-gtk
|
2023-12-22 19:22:17 +07:00
|
|
|
]);
|
2023-02-20 00:49:39 +07:00
|
|
|
programs.rofi = {
|
|
|
|
enable = true;
|
2023-02-20 06:59:00 +07:00
|
|
|
font = "Noto Sans Mono 16";
|
2023-02-20 00:49:39 +07:00
|
|
|
package = lib.mkIf config.wayland.windowManager.sway.enable pkgs.rofi-wayland;
|
|
|
|
plugins = with pkgs; [
|
|
|
|
rofi-calc
|
|
|
|
];
|
|
|
|
theme = with config.lib.formats.rasi; let transparent = mkLiteral "transparent"; in {
|
|
|
|
"*" = rec {
|
|
|
|
highlight = mkLiteral "bold italic";
|
|
|
|
scrollbar = true;
|
|
|
|
|
|
|
|
background = transparent;
|
2023-02-26 17:41:58 +07:00
|
|
|
background-color =
|
|
|
|
# this somehow uses different opacity
|
|
|
|
mkLiteral "#${config.colors.background}c0";
|
|
|
|
foreground = mkLiteral "#${config.colors.foreground}";
|
2023-02-20 00:49:39 +07:00
|
|
|
border-color = foreground;
|
|
|
|
separatorcolor = border-color;
|
|
|
|
scrollbar-handle = border-color;
|
|
|
|
|
|
|
|
normal-background = transparent;
|
|
|
|
normal-foreground = foreground;
|
|
|
|
alternate-normal-background = transparent;
|
|
|
|
alternate-normal-foreground = normal-foreground;
|
|
|
|
selected-normal-background = mkLiteral "#394893";
|
2023-02-26 17:41:58 +07:00
|
|
|
selected-normal-foreground = mkLiteral "#${config.colors.red}";
|
2023-02-20 00:49:39 +07:00
|
|
|
|
|
|
|
active-background = foreground;
|
2023-02-26 17:41:58 +07:00
|
|
|
active-foreground = mkLiteral "#${config.colors.background}";
|
2023-02-20 00:49:39 +07:00
|
|
|
alternate-active-background = active-background;
|
|
|
|
alternate-active-foreground = active-foreground;
|
2023-02-26 17:41:58 +07:00
|
|
|
selected-active-background = mkLiteral "#${config.colors.red}";
|
2023-02-20 00:49:39 +07:00
|
|
|
selected-active-foreground = mkLiteral "#394893";
|
|
|
|
|
2023-02-26 17:41:58 +07:00
|
|
|
urgent-background = mkLiteral "#${config.colors.red}";
|
2023-02-20 00:49:39 +07:00
|
|
|
urgent-foreground = foreground;
|
|
|
|
alternate-urgent-background = urgent-background;
|
|
|
|
alternate-urgent-foreground = urgent-foreground;
|
|
|
|
selected-urgent-background = mkLiteral "#394893";
|
2023-02-26 17:41:58 +07:00
|
|
|
selected-urgent-foreground = mkLiteral "#${config.colors.yellow}";
|
2023-02-20 00:49:39 +07:00
|
|
|
};
|
2024-03-19 15:30:38 +07:00
|
|
|
"@import" = "${./gruvbox-common.rasi}";
|
2023-02-20 00:49:39 +07:00
|
|
|
};
|
|
|
|
terminal = config.terminalBin;
|
|
|
|
extraConfig = {
|
2023-12-24 14:27:43 +07:00
|
|
|
modi = lib.optionals (!config.phone.enable) [
|
|
|
|
"steam:${pkgs.rofi-steam-game-list}/bin/rofi-steam-game-list"
|
|
|
|
] ++ [
|
|
|
|
"drun"
|
|
|
|
"run"
|
|
|
|
"ssh"
|
|
|
|
];
|
2023-02-20 00:49:39 +07:00
|
|
|
icon-theme = "hicolor";
|
2023-02-20 06:59:00 +07:00
|
|
|
drun-match-fields = [ "name" "generic" "exec" "keywords" ];
|
2023-02-20 00:49:39 +07:00
|
|
|
show-icons = true;
|
2023-02-20 06:59:00 +07:00
|
|
|
matching = "fuzzy";
|
2023-02-20 00:49:39 +07:00
|
|
|
sort = true;
|
|
|
|
sorting-method = "fzf";
|
|
|
|
steal-focus = true;
|
|
|
|
};
|
|
|
|
};
|
2023-01-24 02:24:40 +07:00
|
|
|
}
|