mirror of
https://github.com/oddlama/nix-config.git
synced 2025-10-10 14:50:40 +02:00
chore: switch to sway. finally my tearing works again.
This commit is contained in:
parent
7e32b6d4d9
commit
ca512e9375
9 changed files with 279 additions and 99 deletions
|
@ -28,7 +28,8 @@ lib.optionalAttrs (!minimal) {
|
|||
}
|
||||
];
|
||||
|
||||
services.nixseparatedebuginfod.enable = true;
|
||||
# NOTE: disabled temporarily. Spams my journal and uses a lot of CPU in the background at all times.
|
||||
# services.nixseparatedebuginfod.enable = true;
|
||||
|
||||
# For embedded development
|
||||
users.groups.plugdev = { };
|
||||
|
|
|
@ -63,8 +63,8 @@ lib.optionalAttrs (!minimal) {
|
|||
# Autostart hyprland if on tty1 (once, don't restart after logout)
|
||||
programs.zsh.initExtra = lib.mkOrder 9999 ''
|
||||
if [[ -t 0 && "$(tty || true)" == /dev/tty1 && -z "$DISPLAY" && -z "$WAYLAND_DISPLAY" ]] && uwsm check may-start; then
|
||||
echo "Login shell detected. Starting Hyprland..."
|
||||
uwsm start -S -F Hyprland
|
||||
echo "Login shell detected. Starting sway..."
|
||||
uwsm start -S -F sway
|
||||
fi
|
||||
'';
|
||||
};
|
||||
|
|
|
@ -23,9 +23,9 @@
|
|||
# Wayland
|
||||
./gpu-screen-recorder.nix
|
||||
./hyprland.nix
|
||||
./rofi.nix
|
||||
./fuzzel.nix
|
||||
./sway.nix
|
||||
./swaync.nix
|
||||
./swww.nix
|
||||
./waybar.nix
|
||||
./whisper-overlay.nix
|
||||
]
|
||||
|
|
13
users/myuser/graphical/fuzzel.nix
Normal file
13
users/myuser/graphical/fuzzel.nix
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
home.persistence."/state".files = [
|
||||
".cache/fuzzel"
|
||||
];
|
||||
|
||||
stylix.targets.fuzzel.enable = true;
|
||||
programs.fuzzel = {
|
||||
enable = true;
|
||||
settings.main = {
|
||||
launch-prefix = "uwsm app --";
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
programs.rofi = {
|
||||
enable = true;
|
||||
package = pkgs.rofi-wayland;
|
||||
extraConfig = {
|
||||
terminal = "kitty";
|
||||
};
|
||||
};
|
||||
|
||||
home.file =
|
||||
let
|
||||
rofi-themes = pkgs.fetchFromGitHub {
|
||||
owner = "adi1090x";
|
||||
repo = "rofi";
|
||||
rev = "3a28753b0a8fb666f4bd0394ac4b0e785577afa2";
|
||||
hash = "sha256-G3sAyIZbq1sOJxf+NBlXMOtTMiBCn6Sat8PHryxRS0w=";
|
||||
};
|
||||
in
|
||||
{
|
||||
".config/rofi/colors" = {
|
||||
source = "${rofi-themes}/files/colors";
|
||||
recursive = true;
|
||||
};
|
||||
".config/rofi/launchers/type-1/style-10.rasi".source = "${rofi-themes}/files/launchers/type-1/style-10.rasi";
|
||||
".config/rofi/launchers/type-1/shared/colors.rasi".text =
|
||||
# css
|
||||
''
|
||||
@import "~/.config/rofi/colors/onedark.rasi"
|
||||
'';
|
||||
".config/rofi/launchers/type-1/shared/fonts.rasi".text = "";
|
||||
};
|
||||
}
|
256
users/myuser/graphical/sway.nix
Normal file
256
users/myuser/graphical/sway.nix
Normal file
|
@ -0,0 +1,256 @@
|
|||
# - hyprland ctl dispatch rewrite
|
||||
# - software rendering used
|
||||
# - no wlr render env ok?
|
||||
|
||||
# TODO: screencast button with notification
|
||||
# TODO: better qr script: click button, freeze screen, highlight qrs, overlay preview detected text, click to copy.
|
||||
# TODO ai speech indicator / toggle
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
nixosConfig,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib)
|
||||
getExe
|
||||
mapAttrs'
|
||||
nameValuePair
|
||||
;
|
||||
|
||||
cfg = config.wayland.windowManager.sway.config;
|
||||
bindWithModifier = mapAttrs' (k: nameValuePair (cfg.modifier + "+" + k));
|
||||
in
|
||||
{
|
||||
wayland.windowManager.sway = {
|
||||
enable = true;
|
||||
systemd.enable = false; # Handeled by uwsm
|
||||
extraOptions = [
|
||||
"-Dlegacy-wl-drm" # Otherwise no app will run on the nvidia card for some reason and fall back to mesa libGL
|
||||
"--unsupported-gpu"
|
||||
];
|
||||
|
||||
config =
|
||||
{
|
||||
modifier = "Mod4";
|
||||
terminal = "kitty";
|
||||
menu = "fuzzel";
|
||||
|
||||
# Excuse me, le füque
|
||||
focus.followMouse = false;
|
||||
focus.mouseWarping = false;
|
||||
|
||||
keybindings =
|
||||
{
|
||||
"XF86AudioRaiseVolume" =
|
||||
"exec --no-startup-id ${getExe pkgs.scripts.volume} set-volume @DEFAULT_AUDIO_SINK@ 5%+";
|
||||
"XF86AudioLowerVolume" =
|
||||
"exec --no-startup-id ${getExe pkgs.scripts.volume} set-volume @DEFAULT_AUDIO_SINK@ 5%-";
|
||||
"XF86AudioMute" =
|
||||
"exec --no-startup-id ${getExe pkgs.scripts.volume} set-mute @DEFAULT_AUDIO_SINK@ toggle";
|
||||
"XF86AudioMicMute" =
|
||||
"exec --no-startup-id ${getExe pkgs.scripts.volume} set-mute @DEFAULT_AUDIO_SOURCE@ toggle";
|
||||
"XF86AudioPlay" = "exec --no-startup-id ${getExe pkgs.playerctl} play-pause";
|
||||
"XF86AudioNext" = "exec --no-startup-id ${getExe pkgs.playerctl} next";
|
||||
"XF86AudioPrev" = "exec --no-startup-id ${getExe pkgs.playerctl} previous";
|
||||
"XF86MonBrightnessUp" = "exec --no-startup-id ${getExe pkgs.scripts.brightness} set +5%";
|
||||
"XF86MonBrightnessDown" = "exec --no-startup-id ${getExe pkgs.scripts.brightness} set 5%-";
|
||||
}
|
||||
// {
|
||||
"Menu" = "exec ${cfg.menu}";
|
||||
}
|
||||
# General mappings that start with $modifier+...
|
||||
// bindWithModifier {
|
||||
"t" = "exec ${cfg.terminal}";
|
||||
"asciicircum" = "exec ${cfg.menu}";
|
||||
# TODO only open if not already open
|
||||
# TODO shortcut to open these from eww bar with 1 click
|
||||
"b" = "exec uwsm app firefox";
|
||||
"Shift+s" = "exec --no-startup-id ${getExe pkgs.scripts.screenshot-area}";
|
||||
"F11" = "exec --no-startup-id ${getExe pkgs.scripts.screenshot-area-scan-qr}";
|
||||
# Exlicitly without --no-startup-id to show the spinner
|
||||
"F12" = "exec ${getExe pkgs.scripts.screenshot-screen}";
|
||||
"Print" =
|
||||
"exec --no-startup-id env QT_AUTO_SCREEN_SCALE_FACTOR=0 QT_SCREEN_SCALE_FACTORS='' ${getExe pkgs.flameshot} gui";
|
||||
|
||||
"Shift+r" = "reload";
|
||||
"q" = "kill";
|
||||
|
||||
"Left" = "focus left";
|
||||
"Right" = "focus right";
|
||||
"Up" = "focus up";
|
||||
"Down" = "focus down";
|
||||
|
||||
"Shift+Left" = "move left";
|
||||
"Shift+Right" = "move right";
|
||||
"Shift+Up" = "move up";
|
||||
"Shift+Down" = "move down";
|
||||
|
||||
"space" = "layout toggle tabbed splitv splith";
|
||||
"s" = "splith";
|
||||
"v" = "splitv";
|
||||
"f" = "floating toggle";
|
||||
"Return" = "fullscreen toggle";
|
||||
"a" = "focus parent";
|
||||
|
||||
"Shift+Ctrl+q" = "exec uwsm stop";
|
||||
"r" = "mode resize";
|
||||
|
||||
"1" = "workspace number 1";
|
||||
"2" = "workspace number 2";
|
||||
"3" = "workspace number 3";
|
||||
"4" = "workspace number 4";
|
||||
"5" = "workspace number 5";
|
||||
"6" = "workspace number 6";
|
||||
"7" = "workspace number 7";
|
||||
"8" = "workspace number 8";
|
||||
"9" = "workspace number 9";
|
||||
"Comma" = "workspace prev";
|
||||
"Period" = "workspace next";
|
||||
|
||||
"Shift+1" = "move container to workspace number 1";
|
||||
"Shift+2" = "move container to workspace number 2";
|
||||
"Shift+3" = "move container to workspace number 3";
|
||||
"Shift+4" = "move container to workspace number 4";
|
||||
"Shift+5" = "move container to workspace number 5";
|
||||
"Shift+6" = "move container to workspace number 6";
|
||||
"Shift+7" = "move container to workspace number 7";
|
||||
"Shift+8" = "move container to workspace number 8";
|
||||
"Shift+9" = "move container to workspace number 9";
|
||||
"Shift+Comma" = "move container to workspace prev";
|
||||
"Shift+Period" = "move container to workspace next";
|
||||
};
|
||||
|
||||
window.titlebar = false;
|
||||
|
||||
input = {
|
||||
"type:keyboard" = {
|
||||
repeat_delay = "235";
|
||||
repeat_rate = "60";
|
||||
xkb_layout = "de";
|
||||
xkb_variant = "nodeadkeys";
|
||||
xkb_numlock = "enabled";
|
||||
};
|
||||
"type:pointer" = {
|
||||
accel_profile = "flat";
|
||||
pointer_accel = "0";
|
||||
};
|
||||
};
|
||||
|
||||
floating.criteria = [
|
||||
{ class = "^Pavucontrol$"; }
|
||||
#{class = "^awakened-poe-trade$";}
|
||||
];
|
||||
|
||||
assigns = {
|
||||
"1" = [
|
||||
{ class = "^firefox$"; }
|
||||
];
|
||||
"5" = [
|
||||
{ class = "^bottles$"; }
|
||||
{ class = "^steam$"; }
|
||||
{ class = "^prismlauncher$"; }
|
||||
];
|
||||
"7" = [
|
||||
{ class = "^discord$"; }
|
||||
{ class = "^WebCord$"; }
|
||||
{ class = "^obsidian$"; }
|
||||
{ class = "^signal$"; }
|
||||
{ class = "^TelegramDesktop$"; }
|
||||
];
|
||||
};
|
||||
|
||||
bars = [ ];
|
||||
|
||||
startup = [
|
||||
{ command = "uwsm finalize"; }
|
||||
];
|
||||
}
|
||||
# Extra configuration based on which system we are on. It's not ideal to
|
||||
# distinguish by node name here, but at least this way it can stay in the
|
||||
# sway related config file.
|
||||
// {
|
||||
kroma =
|
||||
let
|
||||
monitorMain = "LG Electronics 27GN950 111NTGYLB719";
|
||||
monitorLeft = "LG Electronics LG Ultra HD 0x00077939";
|
||||
in
|
||||
{
|
||||
output = {
|
||||
# TODO "*" = { background = background; };
|
||||
${monitorLeft} = {
|
||||
mode = "3840x2160@60Hz";
|
||||
pos = "0 0";
|
||||
adaptive_sync = "enable";
|
||||
subpixel = "rgb";
|
||||
allow_tearing = "yes";
|
||||
};
|
||||
${monitorMain} = {
|
||||
mode = "3840x2160@144Hz";
|
||||
pos = "3840 0";
|
||||
adaptive_sync = "enable";
|
||||
subpixel = "rgb";
|
||||
render_bit_depth = "10";
|
||||
allow_tearing = "yes";
|
||||
};
|
||||
};
|
||||
|
||||
workspaceOutputAssign = [
|
||||
{
|
||||
workspace = "1";
|
||||
output = monitorMain;
|
||||
}
|
||||
{
|
||||
workspace = "2";
|
||||
output = monitorMain;
|
||||
}
|
||||
{
|
||||
workspace = "3";
|
||||
output = monitorMain;
|
||||
}
|
||||
{
|
||||
workspace = "4";
|
||||
output = monitorMain;
|
||||
}
|
||||
{
|
||||
workspace = "5";
|
||||
output = monitorMain;
|
||||
}
|
||||
{
|
||||
workspace = "6";
|
||||
output = monitorMain;
|
||||
}
|
||||
{
|
||||
workspace = "7";
|
||||
output = monitorLeft;
|
||||
}
|
||||
{
|
||||
workspace = "8";
|
||||
output = monitorLeft;
|
||||
}
|
||||
{
|
||||
workspace = "9";
|
||||
output = monitorLeft;
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
.${nixosConfig.node.name} or { };
|
||||
|
||||
extraConfig = ''
|
||||
for_window [app_id="kitty"] allow_tearing yes
|
||||
for_window [class="^cs2$"] allow_tearing yes
|
||||
'';
|
||||
};
|
||||
|
||||
home.file.".config/uwsm/env-sway".text = ''
|
||||
# Let nixos electron wrappers enable wayland
|
||||
export NIXOS_OZONE_WL=1
|
||||
'';
|
||||
|
||||
home.packages = with pkgs; [
|
||||
wdisplays
|
||||
wl-clipboard
|
||||
];
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
{
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
swww-update-wallpaper = pkgs.writeShellApplication {
|
||||
name = "swww-update-wallpaper";
|
||||
runtimeInputs = [
|
||||
pkgs.swww
|
||||
];
|
||||
text = ''
|
||||
FILES=("$HOME/.local/share/wallpapers/"*)
|
||||
TYPES=("wipe" "any")
|
||||
ANGLES=(0 15 30 45 60 75 90 105 120 135 150 165 180 195 210 225 240 255 270 285 300 315 330 345)
|
||||
|
||||
swww img "''${FILES[RANDOM%''${#FILES[@]}]}" \
|
||||
--transition-type "''${TYPES[RANDOM%''${#TYPES[@]}]}" \
|
||||
--transition-angle "''${ANGLES[RANDOM%''${#ANGLES[@]}]}" \
|
||||
--transition-fps 144 \
|
||||
--transition-duration 1.5
|
||||
'';
|
||||
};
|
||||
in
|
||||
{
|
||||
systemd.user = {
|
||||
services = {
|
||||
swww = {
|
||||
Install.WantedBy = [ "graphical-session.target" ];
|
||||
Unit = {
|
||||
Description = "Wayland wallpaper daemon";
|
||||
PartOf = [ "graphical-session.target" ];
|
||||
After = [ "graphical-session.target" ];
|
||||
};
|
||||
Service = {
|
||||
ExecStart = "${pkgs.swww}/bin/swww-daemon";
|
||||
Restart = "on-failure";
|
||||
};
|
||||
};
|
||||
swww-update-wallpaper = {
|
||||
Install.WantedBy = [ "default.target" ];
|
||||
Unit.Description = "Update the wallpaper";
|
||||
Service = {
|
||||
Type = "oneshot";
|
||||
Restart = "on-failure";
|
||||
RestartSec = "2m";
|
||||
ExecStart = lib.getExe swww-update-wallpaper;
|
||||
};
|
||||
};
|
||||
};
|
||||
timers.swww-update-wallpaper = {
|
||||
Install.WantedBy = [ "timers.target" ];
|
||||
Unit.Description = "Periodically switch to a new wallpaper";
|
||||
Timer.OnCalendar = "*:0/5"; # Every 5 minutes
|
||||
};
|
||||
};
|
||||
}
|
|
@ -86,7 +86,7 @@ button:hover {
|
|||
margin-right: 0;
|
||||
}
|
||||
|
||||
#submap.resize {
|
||||
#mode {
|
||||
background-color: #ffa000;
|
||||
color: #000000;
|
||||
}
|
||||
|
|
|
@ -14,14 +14,14 @@
|
|||
height = 28;
|
||||
|
||||
modules-left = [
|
||||
"hyprland/workspaces"
|
||||
"sway/workspaces"
|
||||
"tray"
|
||||
"hyprland/submap"
|
||||
"sway/mode"
|
||||
"privacy"
|
||||
#"custom/whisper_overlay"
|
||||
];
|
||||
modules-center = [
|
||||
"hyprland/window"
|
||||
"sway/window"
|
||||
];
|
||||
modules-right = [
|
||||
"custom/scan_qr"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue