feat(hyprland): Replace sway
This commit is contained in:
parent
404d4a7de8
commit
74b95e35ef
|
@ -98,8 +98,6 @@
|
|||
# TODO: Update once my PR lands
|
||||
services.login.yubicoAuth = true;
|
||||
services.login.fprintAuth = true;
|
||||
services.swaylock.yubicoAuth = true;
|
||||
services.swaylock.fprintAuth = true;
|
||||
services.sshd.fprintAuth = false;
|
||||
};
|
||||
# TODO: This is not good
|
||||
|
@ -142,7 +140,6 @@
|
|||
steam = pkgs.steam.override {extraPkgs = pkgs: [pkgs.openssl];};
|
||||
};
|
||||
|
||||
programs.sway.enable = true;
|
||||
services.udev.packages = with pkgs; [yubikey-personalization chrysalis];
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
|
|
|
@ -100,7 +100,6 @@
|
|||
control = "sufficient";
|
||||
};
|
||||
services.login.yubicoAuth = true;
|
||||
services.swaylock.yubicoAuth = true;
|
||||
};
|
||||
|
||||
# TODO: Remove/Move
|
||||
|
@ -148,8 +147,6 @@
|
|||
vial
|
||||
];
|
||||
|
||||
programs.sway.enable = true;
|
||||
|
||||
sops.defaultSopsFile = ../secrets/hosts/murex-pecten/secrets.yaml;
|
||||
sops.age.sshKeyPaths = ["/etc/ssh/ssh_host_ed25519_key"];
|
||||
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
{
|
||||
lib,
|
||||
rustPlatform,
|
||||
fetchFromGitHub,
|
||||
}: let
|
||||
pname = "persway";
|
||||
version = "2aa947a954574b5a10fe45301fb2ace3718134ae";
|
||||
sha256 = "JMi8k82L9CmM6aKjyGfYIjHIfIv7KPihGdcKJUZOmJU=";
|
||||
cargoSha256 = "27RX1CoCFANG7UqrtthmhG09tokxNPVBLUoWXX+wdwU=";
|
||||
in
|
||||
rustPlatform.buildRustPackage {
|
||||
inherit pname version cargoSha256;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
inherit sha256;
|
||||
owner = "johnae";
|
||||
repo = "persway";
|
||||
rev = version;
|
||||
};
|
||||
|
||||
meta = {
|
||||
description = " Small Sway IPC Daemon";
|
||||
homepage = "https://github.com/johnae/persway";
|
||||
license = lib.licenses.mit;
|
||||
maintainers = [];
|
||||
};
|
||||
}
|
|
@ -44,7 +44,6 @@ in {
|
|||
./git.nix
|
||||
./shell.nix
|
||||
./kitty.nix
|
||||
./sway.nix
|
||||
./gpg.nix
|
||||
./mail.nix
|
||||
./pass.nix
|
||||
|
@ -59,14 +58,12 @@ in {
|
|||
./hypr.nix
|
||||
../modules/restic-backup.nix
|
||||
../modules/synchronize-calendars.nix
|
||||
../modules/persway.nix
|
||||
../modules/protonmail-bridge.nix
|
||||
../modules/darkman.nix
|
||||
../modules/colors.nix
|
||||
];
|
||||
|
||||
config = {
|
||||
settings.sway.enable = notDeck;
|
||||
settings.hyprland.enable = notDeck;
|
||||
settings.mail.enable = notDeck;
|
||||
settings.taskwarrior.enable = notDeck;
|
||||
|
|
|
@ -246,9 +246,13 @@ in {
|
|||
|
||||
# If running from tty2 start hyprland
|
||||
xdg.configFile."fish/conf.d/hyprland.fish".text = ''
|
||||
set TTY2 (tty)
|
||||
if test -z \"$DISPLAY\"; and test $TTY2 = '/dev/tty2'
|
||||
systemd-cat -t Hyprland Hyprland-nvidia
|
||||
set TTY1 (tty)
|
||||
if test -z \"$DISPLAY\"; and test $TTY1 = '/dev/tty1'
|
||||
systemd-cat -t Hyprland ${
|
||||
if nixosConfig.settings.nvidiaUsed
|
||||
then "Hyprland-nvidia"
|
||||
else "Hyprland"
|
||||
}
|
||||
end
|
||||
'';
|
||||
|
||||
|
|
|
@ -1,332 +0,0 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
nixosConfig,
|
||||
...
|
||||
}: let
|
||||
colDark = config.colorsDark.colors;
|
||||
|
||||
backgrounds = pkgs.fetchFromGitHub {
|
||||
owner = "vctrblck";
|
||||
repo = "gruvbox-wallpapers";
|
||||
rev = "ff9ade4c49299e08c11bd8ce2f17cdae7f9b706d";
|
||||
sha256 = "d28r/s+m32hqzF/S/ebyBCd5XLKJTFSaQXmMdHFUH64=";
|
||||
};
|
||||
|
||||
# === Dark/Light mode ===
|
||||
lightThemeConfig = config.myLib.mkSwayTheme config.colorsLight;
|
||||
darkThemeConfig = config.myLib.mkSwayTheme config.colorsDark;
|
||||
currentThemeConfig = "~/.config/sway/current-theme";
|
||||
installTheme = theme: ''
|
||||
ln -sf ${theme} ~/.config/sway/current-theme
|
||||
'';
|
||||
|
||||
# === Helper programs ===
|
||||
bemenu = pkgs.callPackage ../../pkgs/bemenu-configured.nix {inherit config;};
|
||||
grim = "${pkgs.grim}/bin/grim";
|
||||
wl-copy = "${pkgs.wl-clipboard}/bin/wl-copy";
|
||||
slurp = "${pkgs.slurp}/bin/slurp -db '#000000AA' -c '#${colDark.base0D}' -w1";
|
||||
doNotDisturb = pkgs.callPackage ../../pkgs/do-not-disturb.nix {};
|
||||
|
||||
screenshot-path = "/home/malte/Pictures/screenshots/screenshot.png";
|
||||
screenshot-all = "${grim} ${screenshot-path} && ${wl-copy} < ${screenshot-path}";
|
||||
screenshot-region = ''
|
||||
${grim} -g "$(${slurp})" ${screenshot-path} && ${wl-copy} < ${screenshot-path}'';
|
||||
|
||||
cfg = config.settings.sway;
|
||||
inherit (nixosConfig.settings) nvidiaUsed;
|
||||
hiDPI = nixosConfig.settings.hiDPI.enable;
|
||||
in {
|
||||
imports = [./waybar.nix ./gtk.nix ./qt.nix ./pass.nix ./mako.nix ./kanshi.nix];
|
||||
|
||||
options.settings.sway = with lib; {
|
||||
enable = mkEnableOption "Enable sway config";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
home.packages = [
|
||||
pkgs.grim
|
||||
pkgs.libappindicator
|
||||
pkgs.libappindicator-gtk3
|
||||
pkgs.numix-cursor-theme
|
||||
pkgs.psmisc
|
||||
pkgs.slurp
|
||||
pkgs.swaylock-effects
|
||||
pkgs.wf-recorder
|
||||
pkgs.wl-clipboard
|
||||
];
|
||||
|
||||
wayland.windowManager.sway = {
|
||||
enable = true;
|
||||
extraOptions = lib.optional nvidiaUsed "--unsupported-gpu";
|
||||
systemdIntegration = true;
|
||||
wrapperFeatures = {
|
||||
base = true;
|
||||
gtk = true;
|
||||
};
|
||||
|
||||
extraSessionCommands =
|
||||
''
|
||||
# needs qt5.qtwayland in systemPackages
|
||||
export QT_QPA_PLATFORM=wayland
|
||||
export QT_WAYLAND_DISABLE_WINDOWDECORATION="1"
|
||||
export MOZ_ENABLE_WAYLAND=1
|
||||
export GDK_BACKEND=wayland
|
||||
# Fix for some Java AWT applications (e.g. Android Studio),
|
||||
# use this if they aren't displayed properly:
|
||||
export _JAVA_AWT_WM_NONREPARENTING=1
|
||||
export XDG_CURRENT_DESKTOP=Sway
|
||||
export XDG_SESSION_TYPE=wayland
|
||||
''
|
||||
+
|
||||
# TODO: See what actually is required here!
|
||||
(lib.optionalString nvidiaUsed ''
|
||||
# Set DRM devices and fix cursor
|
||||
# nvidia=$(readlink -f /dev/dri/by-path/pci-0000\:01\:00.0-card)
|
||||
# intel=$(readlink -f /dev/dri/by-path/pci-0000:00:02.0-card)
|
||||
# export WLR_DRM_DEVICES=$nvidia:$intel
|
||||
# __GLX_VENDOR_LIBRARY=nvidia
|
||||
# GBM_BACKEND=nvidia-drm
|
||||
# GBM_BACKEND_PATH=/etc/gbm
|
||||
'');
|
||||
|
||||
config = {
|
||||
modifier = "Mod4";
|
||||
terminal = "kitty";
|
||||
menu = "${bemenu}/bin/bemenu-run-configured -p 'Program:'";
|
||||
|
||||
window = {
|
||||
border = 2;
|
||||
titlebar = false;
|
||||
|
||||
commands = [
|
||||
{
|
||||
command = ''title_format "[<b>X</b>] %title"'';
|
||||
criteria = {shell = "xwayland";};
|
||||
}
|
||||
{
|
||||
command = "floating enable; kill";
|
||||
criteria = {
|
||||
app_id = "firefox";
|
||||
title = "Firefox — Sharing Indicator";
|
||||
};
|
||||
}
|
||||
{
|
||||
command = "floating enable";
|
||||
criteria = {app_id = "org.gnome.Nautilus";};
|
||||
}
|
||||
{
|
||||
command = "floating enable";
|
||||
criteria = {class = "Mojosetup";};
|
||||
}
|
||||
# FIXME: GPG windows don't seem to float by default anymore
|
||||
{
|
||||
command = "floating enable";
|
||||
criteria = {
|
||||
title = "\[[0-9]+\]@${nixosConfig.networking.hostName}";
|
||||
app_id = "";
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
bars = [
|
||||
{
|
||||
command = "${pkgs.waybar}/bin/waybar";
|
||||
position = "top";
|
||||
}
|
||||
];
|
||||
|
||||
seat."*".xcursor_theme =
|
||||
if hiDPI
|
||||
then "Numix-Cursor-Light 48"
|
||||
else "Numix-Cursor-Light 32";
|
||||
|
||||
keybindings = let
|
||||
mod = config.wayland.windowManager.sway.config.modifier;
|
||||
move_follow = workspace: "move container to workspace ${workspace}; workspace ${workspace}";
|
||||
in
|
||||
lib.mkOptionDefault {
|
||||
"${mod}+Shift+e" = "exit";
|
||||
# Move focused container to workspace and follow
|
||||
"${mod}+Ctrl+Shift+1" = move_follow "1";
|
||||
"${mod}+Ctrl+Shift+2" = move_follow "2";
|
||||
"${mod}+Ctrl+Shift+3" = move_follow "3";
|
||||
"${mod}+Ctrl+Shift+4" = move_follow "4";
|
||||
"${mod}+Ctrl+Shift+5" = move_follow "5";
|
||||
"${mod}+Ctrl+Shift+6" = move_follow "6";
|
||||
"${mod}+Ctrl+Shift+7" = move_follow "7";
|
||||
"${mod}+Ctrl+Shift+8" = move_follow "8";
|
||||
"${mod}+Ctrl+Shift+9" = move_follow "9";
|
||||
# Move workspaces between displays
|
||||
"${mod}+Ctrl+Shift+l" = "move workspace to output right";
|
||||
"${mod}+Ctrl+Shift+k" = "move workspace to output up";
|
||||
"${mod}+Ctrl+Shift+j" = "move workspace to output down";
|
||||
"${mod}+Ctrl+Shift+h" = "move workspace to output left";
|
||||
# Sound control
|
||||
"XF86AudioRaiseVolume" = "exec ${pkgs.ponymix}/bin/ponymix increase 5%";
|
||||
"XF86AudioLowerVolume" = "exec ${pkgs.ponymix}/bin/ponymix decrease 5%";
|
||||
"XF86AudioMute" = "exec ${pkgs.ponymix}/bin/ponymix toggle";
|
||||
"XF86AudioMicMute" = "exec ${pkgs.ponymix}/bin/ponymix --input toggle";
|
||||
# Additional menus
|
||||
"${mod}+p" = "exec passmenu-bemenu";
|
||||
# Screenshots
|
||||
"${mod}+Ctrl+s" = "exec ${screenshot-all}";
|
||||
"${mod}+Ctrl+Shift+s" = "exec ${screenshot-region}";
|
||||
# Special window actions
|
||||
"${mod}+Ctrl+Shift+w" = "mode window";
|
||||
# Screenlocking
|
||||
"XF86Favorites" = "exec swaylock";
|
||||
# Toggle DO-NOT-DISTURB mode
|
||||
"${mod}+n" = "exec ${doNotDisturb}/bin/do-not-disturb toggle";
|
||||
};
|
||||
|
||||
gaps = let
|
||||
size = 4;
|
||||
in {
|
||||
smartBorders = "on";
|
||||
smartGaps = true;
|
||||
inner = size;
|
||||
#outer = size;
|
||||
};
|
||||
|
||||
workspaceOutputAssign = [
|
||||
{
|
||||
output = "HDMI-A-2";
|
||||
workspace = "1";
|
||||
}
|
||||
{
|
||||
output = "DP-2";
|
||||
workspace = "2";
|
||||
}
|
||||
];
|
||||
|
||||
assigns = {
|
||||
"2" = [{app_id = "firefox";}];
|
||||
"5" = [
|
||||
{title = "Korrektur.pdf(.xopp)? . Xournal++";}
|
||||
{title = ".*HWP Betreuung/Skript.pdf";}
|
||||
];
|
||||
"6" = [{class = "com-cburch-logisim-Main";}];
|
||||
"7" = [{app_id = "Element";}];
|
||||
"8" = [{app_id = "telegramdesktop";} {class = "discord";}];
|
||||
"9" = [{app_id = "pavucontrol";}];
|
||||
};
|
||||
|
||||
fonts = {
|
||||
names = ["Hack NF FC Ligatured"];
|
||||
size = 8.0;
|
||||
};
|
||||
|
||||
modes = lib.mkOptionDefault {
|
||||
window = {
|
||||
"Escape" = "mode default";
|
||||
"1" = let
|
||||
win_width = 500;
|
||||
win_height = 500 * 9 / 16;
|
||||
str = builtins.toString;
|
||||
in "floating enable; sticky enable; resize set width ${
|
||||
str win_width
|
||||
}px height ${str win_height}px; move position ${
|
||||
str (1920 - win_width)
|
||||
}px 0px";
|
||||
};
|
||||
};
|
||||
|
||||
input = {
|
||||
# Build into the Thinkpad
|
||||
"1:1:AT_Translated_Set_2_keyboard" = {
|
||||
xkb_layout = "us,us";
|
||||
xkb_variant = ",workman";
|
||||
xkb_options = "compose:rctrl,grp:alt_space_toggle,grp_led:caps";
|
||||
};
|
||||
# Ducky One 2 TKL
|
||||
"1241:661:USB-HID_Keyboard" = {
|
||||
xkb_layout = "us,us";
|
||||
xkb_variant = ",workman";
|
||||
xkb_options = "compose:rwin,grp:alt_space_toggle,grp_led:caps";
|
||||
};
|
||||
# Fancy Keyboardio Atreus
|
||||
"4617:8963:Keyboardio_Atreus_Keyboard" = {
|
||||
xkb_layout = "us";
|
||||
xkb_options = "compose:rctrl";
|
||||
};
|
||||
# Shabby Logitech keyboard
|
||||
"1133:49947:Logitech_Logitech_USB_Keyboard" = {
|
||||
xkb_layout = "us";
|
||||
xkb_variant = "workman";
|
||||
xkb_options = "compose:rctrl";
|
||||
};
|
||||
# Build into the Thinkpad
|
||||
"2:7:SynPS/2_Synaptics_TouchPad" = {
|
||||
natural_scroll = "enabled";
|
||||
scroll_method = "two_finger";
|
||||
pointer_accel = "0";
|
||||
accel_profile = "flat";
|
||||
tap = "enabled";
|
||||
drag = "enabled";
|
||||
};
|
||||
# G502
|
||||
"1133:49291:Logitech_G502_HERO_Gaming_Mouse" = {
|
||||
pointer_accel = "0";
|
||||
accel_profile = "flat";
|
||||
};
|
||||
};
|
||||
|
||||
output = {
|
||||
"eDP-1".bg = "${backgrounds}/leaves3.jpg fill";
|
||||
"LG Electronics IPS226 SerialNumber".bg = "${backgrounds}/future-town.jpg fill";
|
||||
"BenQ Corporation BenQ GW2270 P9J02423SL0".bg = "${backgrounds}/leaves3.jpg fill";
|
||||
};
|
||||
};
|
||||
extraConfig = ''
|
||||
# Make sure to source this, as it fixes gnome stuff
|
||||
include /etc/sway/config.d/*
|
||||
include ${currentThemeConfig}
|
||||
'';
|
||||
};
|
||||
|
||||
services.gammastep = {
|
||||
# We need geoclue2 globally for this to work!
|
||||
enable = true;
|
||||
provider = "manual";
|
||||
temperature.night = 3500;
|
||||
latitude = "51.3";
|
||||
longitude = "12.4";
|
||||
tray = true;
|
||||
};
|
||||
|
||||
services.persway = {
|
||||
enable = true;
|
||||
autolayout.enable = true;
|
||||
};
|
||||
|
||||
# If running from tty1 start sway
|
||||
xdg.configFile."fish/conf.d/sway.fish".text = ''
|
||||
set TTY1 (tty)
|
||||
if test -z \"$DISPLAY\"; and test $TTY1 = '/dev/tty1'
|
||||
systemd-cat -t sway sway
|
||||
end
|
||||
'';
|
||||
|
||||
services.darkman.scripts."sway.sh" = let
|
||||
swaymsgBin = "${pkgs.sway}/bin/swaymsg";
|
||||
in {
|
||||
onLight = pkgs.writeScript "sway-light" ''
|
||||
#!${pkgs.runtimeShell}
|
||||
${installTheme lightThemeConfig}
|
||||
while read LINE; do
|
||||
${swaymsgBin} $LINE
|
||||
done < ${currentThemeConfig}
|
||||
'';
|
||||
onDark = pkgs.writeScript "sway-dark" ''
|
||||
#!${pkgs.runtimeShell}
|
||||
${installTheme darkThemeConfig}
|
||||
while read LINE; do
|
||||
${swaymsgBin} $LINE
|
||||
done < ${currentThemeConfig}
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
|
@ -223,19 +223,6 @@ in {
|
|||
face global MatchingChar ${color "base06"},${color "base02"}+b
|
||||
face global BufferPadding ${color "base03"},${color "base00"}
|
||||
'';
|
||||
# https://github.com/rkubosz/base16-sway
|
||||
# Property Name Border BG Text Indicator Child Border
|
||||
mkSwayTheme = colorscheme: let
|
||||
color = name: "#${colorscheme.colors.${name}}";
|
||||
in
|
||||
pkgs.writeText "sway-theme-${colorscheme.slug}" ''
|
||||
client.focused ${color "base05"} ${color "base0D"} ${color "base00"} ${color "base0D"} ${color "base0D"}
|
||||
client.focused_inactive ${color "base01"} ${color "base01"} ${color "base05"} ${color "base03"} ${color "base01"}
|
||||
client.unfocused ${color "base01"} ${color "base00"} ${color "base05"} ${color "base01"} ${color "base01"}
|
||||
client.urgent ${color "base08"} ${color "base08"} ${color "base00"} ${color "base08"} ${color "base08"}
|
||||
client.placeholder ${color "base00"} ${color "base00"} ${color "base05"} ${color "base00"} ${color "base00"}
|
||||
client.background ${color "base07"}
|
||||
'';
|
||||
# https://github.com/mnussbaum/base16-waybar
|
||||
mkCSSVariables = colorscheme: let
|
||||
color = name: "#${colorscheme.colors.${name}}";
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
cfg = config.services.persway;
|
||||
pkg = pkgs.callPackage ../../pkgs/persway.nix {};
|
||||
in {
|
||||
options.services.persway = with lib; {
|
||||
enable = mkEnableOption "persway, the friendly sway IPC daemon";
|
||||
autolayout.enable = mkEnableOption "the autolayout feature";
|
||||
workspaceRenaming.enable = mkEnableOption "the workspace renaming feature";
|
||||
# TODO: -e -f
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
warnings = lib.optional (builtins.elem "persway" (builtins.attrNames pkgs)) "Persway has been packaged upstream!";
|
||||
systemd.user.services."persway" = {
|
||||
Unit = {
|
||||
Description = "Persway Sway IPC daemon";
|
||||
PartOf = "graphical-session.target";
|
||||
After = "graphical-session.target";
|
||||
};
|
||||
Service = {
|
||||
ExecStart = ''
|
||||
${pkg}/bin/persway ${
|
||||
lib.optionalString cfg.autolayout.enable "--autolayout"
|
||||
} ${
|
||||
lib.optionalString cfg.workspaceRenaming.enable "--workspace-renaming"
|
||||
}
|
||||
'';
|
||||
};
|
||||
Install.WantedBy = ["graphical-session.target"];
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue