WIP|Switch to wayland

This commit is contained in:
Daniel Siepmann 2024-04-15 08:28:45 +02:00
parent 5fe448b90a
commit bc58ac88ff
Signed by: Daniel Siepmann
GPG key ID: 33D6629915560EF4
6 changed files with 389 additions and 32 deletions

View file

@ -59,8 +59,11 @@ in {
fonts.fontconfig.enable = true;
xsession = import ./home/xsession.nix {
inherit config pkgs ownLib;
# xsession = import ./home/xsession.nix {
# inherit config pkgs ownLib;
# };
wayland = import ./home/wayland.nix {
};
xdg = import ./home/xdg.nix {

6
home/wayland.nix Normal file
View file

@ -0,0 +1,6 @@
{ _ }:
{
sway = import ./wayland/sway.nix {
};
}

368
home/wayland/sway.nix Normal file
View file

@ -0,0 +1,368 @@
{ _ }:
{
enable = true;
config = {
modifier = "Mod4";
workspaceLayout = "tabbed";
workspaceAutoBackAndForth = true;
defaultWorkspace = "workspace 1";
menu = "i3-dmenu-desktop";
fonts = {
names = [ "monospace" ];
style = "Bold";
size = 12.0;
};
colors = {
background = "#2E3436";
focused = {
border = "#000000";
background = "#000000";
text = "#72B3CC";
indicator = "#72B3CC";
childBorder = "#000000";
};
focusedInactive = {
border = "#000000";
background = "#000000";
text = "#B0B0B0";
indicator = "#5D5D5D";
childBorder = "#000000";
};
unfocused = {
border = "#000000";
background = "#000000";
text = "#B0B0B0";
indicator = "#5D5D5D";
childBorder = "#000000";
};
urgent = {
border = "#72B3CC";
background = "#72B3CC";
text = "#FFFFFF";
indicator = "#72B3CC";
childBorder = "#72B3CC";
};
placeholder = {
border = "#000000";
background = "#000000";
text = "#D3D7CF";
indicator = "#000000";
childBorder = "#000000";
};
};
bars = [{
mode = "hide";
position = "top";
workspaceButtons = true;
workspaceNumbers = true;
statusCommand = "i3blocks";
fonts = {
names = ["monospace"];
style = "Bold";
size = 12.0;
};
colors = {
background = "#000000";
statusline = "#72B3CC";
separator = "#72B3CC";
focusedWorkspace = {
border = "#72B3CC";
background = "#000000";
text = "#72B3CC";
};
activeWorkspace = {
border = "#000000";
background = "#000000";
text = "#72B3CC";
};
inactiveWorkspace = {
border = "#000000";
background = "#000000";
text = "#72B3CC";
};
urgentWorkspace = {
border = "#72B3CC";
background = "#72B3CC";
text = "#FFFFFF";
};
bindingMode = {
border = "#72B3CC";
background = "#72B3CC";
text = "#FFFFFF";
};
};
extraConfig = ''
separator_symbol " "
'';
}];
window = {
titlebar = true;
border = 0;
hideEdgeBorders = "both";
commands = [
{
command = ''title_format "<b>%title</b>"'';
criteria = { class = ".*"; };
}
{
command = "sticky enable";
criteria = { window_type = "dialog"; };
}
{
command = "sticky enable";
criteria = { class = "KeePassXC"; };
}
{
command = "border none";
criteria = { class = "^vlc$"; };
}
{
command = "floating disable";
criteria = { class = "^Pidgin$"; };
}
];
};
floating = {
titlebar = true;
border = 0;
criteria = [
{ "class" = "KeePassXC"; }
];
};
assigns = {
"2:💶" = [
{ class = "^time-tracking$"; }
{ class = "^mailhog$"; }
{ window_role = "^browser$"; }
];
"3:💬" = [
{ class = "^Pidgin$"; }
{ class = "^chat$"; }
{ class = "^phone$"; }
];
"4:📧" = [
{ class = "^thunderbird$"; }
{ class = "^mail$"; }
];
"5:🎵" = [
{ class = "^Pavucontrol$"; }
{ class = "^vlc$"; }
{ class = "^Audacity$"; }
];
};
startup = [
# Start programs / applets
{
command = "nm-applet";
notification = false;
}
{
command = "${pkgs.udiskie}/bin/udiskie --smart-tray";
notification = false;
}
];
keybindings = {
# kill focused window
"${modifier}+Shift+q" = "kill";
# start a terminal
"${modifier}+Return" = "exec st zsh";
"${modifier}+Shift+a" = "exec xrandr --auto";
# start dmenu (a program launcher)
# "${modifier}+d" = "exec dmenu_run";
# There also is the (new) i3-dmenu-desktop which only displays applications
# shipping a .desktop file. It is a wrapper around dmenu, so you need that
# installed.
# For docs, see: https://developer.gnome.org/integration-guide/stable/desktop-files.html.en
"${modifier}+a" = "exec --no-startup-id i3-dmenu-desktop --dmenu='dmenu -i -l 20'";
"${modifier}+space" = "exec --no-startup-id custom-dmenu-selection";
# change focus
"${modifier}+h" = "focus left";
"${modifier}+j" = "focus down";
"${modifier}+k" = "focus up";
"${modifier}+l" = "focus right";
# move focused window
"${modifier}+Shift+h" = "move left";
"${modifier}+Shift+j" = "move down";
"${modifier}+Shift+k" = "move up";
"${modifier}+Shift+l" = "move right";
# split in horizontal orientation
"${modifier}+Right" = "split h";
# split in vertical orientation
"${modifier}+Down" = "split v";
# enter fullscreen mode for the focused container
"${modifier}+f" = "fullscreen toggle";
# toggle tiling / floating
"${modifier}+Shift+f" = "floating toggle";
# toggle sticky
"${modifier}+Shift+s" = "sticky toggle";
# switch to workspace
"${modifier}+1" = "workspace 1";
"${modifier}+2" = "workspace 2:💶";
"${modifier}+3" = "workspace 3:💬";
"${modifier}+4" = "workspace 4:📧";
"${modifier}+5" = "workspace 5:🎵";
"${modifier}+6" = "workspace 6:T3";
"${modifier}+7" = "workspace 7";
"${modifier}+8" = "workspace 8";
"${modifier}+9" = "workspace 9:🖥";
"${modifier}+0" = "workspace 10:🌐";
# move focused container to workspace
"${modifier}+Shift+1" = "move container to workspace 1";
"${modifier}+Shift+2" = "move container to workspace 2:💶";
"${modifier}+Shift+3" = "move container to workspace 3:💬";
"${modifier}+Shift+4" = "move container to workspace 4:📧";
"${modifier}+Shift+5" = "move container to workspace 5:🎵";
"${modifier}+Shift+6" = "move container to workspace 6:T3";
"${modifier}+Shift+7" = "move container to workspace 7";
"${modifier}+Shift+8" = "move container to workspace 8";
"${modifier}+Shift+9" = "move container to workspace 9:🖥";
"${modifier}+Shift+0" = "move container to workspace 10:🌐";
# workspace 9:🖥️ output DP2
# Make the currently focused window a scratchpad
"${modifier}+Shift+minus" = "move scratchpad";
# Show the first scratchpad window
"${modifier}+minus" = "scratchpad show";
# Show Terminal
"${modifier}+t" = "[class=\"st-256color\"] scratchpad show";
# Show KeepassXC
"${modifier}+p" = "[class=\"KeePassXC\"] scratchpad show";
# reload the configuration file
"${modifier}+Shift+c" = "reload";
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
"${modifier}+Shift+r" = "restart";
# exit i3 (logs you out of your X session)
"${modifier}+Shift+e" = "exec \"i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'\"";
# Move workspace between displays
"${modifier}+Shift+Left" = "move workspace to output left";
"${modifier}+Shift+Right" = "move workspace to output right";
# Function Key Bindings (🎵)
"XF86AudioPause" = "exec cmus-remote --pause";
"XF86AudioPlay" = "exec cmus-remote --pause";
"XF86AudioPrev" = "exec cmus-remote --prev";
"XF86AudioNext" = "exec cmus-remote --next";
"XF86AudioMute" = "exec \"amixer ${soundSwitcherForHikari2} sset Master 0\"";
"XF86AudioRaiseVolume" = "exec \"amixer ${soundSwitcherForHikari2} sset Master 5%+\"";
"XF86AudioLowerVolume" = "exec \"amixer ${soundSwitcherForHikari2} sset Master 5%-\"";
# Switch sound device:
# https://askubuntu.com/a/72076/491377
#
# Detect current devices
# pulseaudio -k && pactl load-module module-detect
#
# Run Pulseaudio Volume Control and adjust
# Adjust also "default / fallback" device, in order to make volume control work.
#
# Alternativly via cli:
# ~ > pacmd list-sinks
# ~ > pacmd list-sink-inputs
# ~ > pacmd set-default-sink 8
# ~ > pacmd move-sink-input 3 8
# Function Key Bindings (💡)
"XF86MonBrightnessUp" = "exec ${pkgs.brightnessctl}/bin/brightnessctl ${displayBrightnessDevice} s +10";
"XF86MonBrightnessDown" = "exec ${pkgs.brightnessctl}/bin/brightnessctl ${displayBrightnessDevice} s 10-";
"SHIFT+XF86MonBrightnessUp" = "exec ${pkgs.brightnessctl}/bin/brightnessctl ${displayBrightnessDevice} s +1";
"SHIFT+XF86MonBrightnessDown" = "exec ${pkgs.brightnessctl}/bin/brightnessctl ${displayBrightnessDevice} s 1-";
"XF86KbdBrightnessUp" = "exec ${pkgs.brightnessctl}/bin/brightnessctl ${keyboardBrightnessDevice} s +1";
"XF86KbdBrightnessDown" = "exec ${pkgs.brightnessctl}/bin/brightnessctl ${keyboardBrightnessDevice} s 1-";
# Dunst Key Bindings
# See: man dunstctl.1
"Control+space" = "exec --no-startup-id dunstctl close-all";
"Control+grave" = "exec --no-startup-id dunstctl history-pop";
"${modifier}+d" = "mode displays";
"${modifier}+r" = "mode resize";
};
output = {
"eDP-1" = {
mode = "1366x768@60Hz";
};
};
modes = {
resize = {
"h" = "resize shrink width 10 px or 10 ppt";
"j" = "resize grow height 10 px or 10 ppt";
"k" = "resize shrink height 10 px or 10 ppt";
"l" = "resize grow width 10 px or 10 ppt";
"Shift+h" = "resize shrink width 50 px or 50 ppt";
"Shift+j" = "resize grow height 50 px or 50 ppt";
"Shift+k" = "resize shrink height 50 px or 50 ppt";
"Shift+l" = "resize grow width 50 px or 50 ppt";
# same bindings, but for the arrow keys
"Left" = "resize shrink width 10 px or 10 ppt";
"Down" = "resize grow height 10 px or 10 ppt";
"Up" = "resize shrink height 10 px or 10 ppt";
"Right" = "resize grow width 10 px or 10 ppt";
# back to normal: Enter or Escape
"Return" = "mode default";
"Escape" = "mode default";
};
# "display setup: [a]uto [e]extern only [h]ome [o]ffice" = {
# TODO: Replace xrandr
displays = {
"a" = "exec xrandr --auto ${displayDefaults} && ${pkgs.brightnessctl}/bin/brightnessctl --device ${displayBrightnessDevice} s 10;";
"e" = "exec xrandr --auto --output ${displayBuiltInOutput} --off";
"h" = "exec xrandr --output ${displayBuiltInOutput} --off --output DP1 --scale 1x1 --mode 2560x1440";
"o" = "exec xrandr --output DP2 --primary --mode 3840x2160 --scale 0.65x0.65 --output ${displayBuiltInOutput} --off";
# Mirror
# xrandr --output ${displayBuiltInOutput} --rate 60 --mode 1920x1080 --fb 1920x1080 --output DP1 --mode 1920x1080 --same-as ${displayBuiltInOutput}
# To turn off, use position, e.g.:
# xrandr --output DP1 --right-of ${displayBuiltInOutput}
# Hikari present
# xrandr --output eDP-1 --same-as HDMI-1 --scale 1.5x1.5 --output HDMI-1 --mode 1920x1080 --scale 1x1
# back to normal: Enter or Escape
"Return" = "mode default";
"Escape" = "mode default";
};
};
};
}

View file

@ -369,7 +369,7 @@ in {
# xrandr --output DP1 --right-of ${displayBuiltInOutput}
# Hikari present
# xrandr --output eDP-1 --same-as HDMI-1 --scale 1.5x1.5 --output HDMI-1 --mode 1920x1080
# xrandr --output eDP-1 --same-as HDMI-1 --scale 1.5x1.5 --output HDMI-1 --mode 1920x1080 --scale 1x1
# back to normal: Enter or Escape
"Return" = "mode default";

View file

@ -81,31 +81,8 @@
};
};
services = {
# Enable the X11 windowing system.
xserver = {
enable = true;
# Configure keymap in X11
xkb = {
layout = "us";
variant = "";
};
# Enable the LXQT Desktop Environment.
desktopManager.lxqt.enable = true;
displayManager = {
lightdm.enable = true;
# Enable automatic login for the user.
autoLogin = {
enable = true;
user = "daniels";
};
};
};
dnsmasq = {
enable = true;
settings = {
@ -117,10 +94,10 @@
printing.enable = false;
pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
};
};
@ -157,6 +134,9 @@
};
security = {
# For wayland policies
polkit.enable = true;
sudo.execWheelOnly = true;
};

View file

@ -2,7 +2,7 @@
let
php = pkgs.php82;
php = pkgs.php83;
in import ./../lib/create-typo3.nix {
inherit config lib pkgs php;