From c922ddd868e8a943caee4a6af8ba0ec38f4ec674 Mon Sep 17 00:00:00 2001 From: genofire Date: Fri, 8 Oct 2021 04:20:14 +0200 Subject: [PATCH] nix sway - WIP - usable --- sway.nix | 233 ++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 212 insertions(+), 21 deletions(-) diff --git a/sway.nix b/sway.nix index ea4135a..35ab00b 100644 --- a/sway.nix +++ b/sway.nix @@ -27,30 +27,189 @@ wayland.windowManager.sway = let - ws1="1💬"; - #ws2="2📝"; - ws2="2🌟"; - ws3="3🍁"; - ws4="4🍀"; - ws5="5🌈"; - ws6="6💎"; - ws7="7🎥"; - ws8="8🌍"; - ws9="9🔒"; - ws10="10🌀"; + ws1 = "1💬"; + #ws2 = "2📝"; + ws2 = "2🌟"; + ws3 = "3🍁"; + ws4 = "4🍀"; + ws5 = "5🌈"; + ws6 = "6💎"; + ws7 = "7🎥"; + ws8 = "8🌍"; + ws9 = "9🔒"; + ws10 = "10🌀"; - modifier = config.wayland.windowManager.sway.config.modifier; + white = "#ffffff"; + cyan = "#00afd7"; + acqua = "#00d787"; + violet = "#800080"; + wine = "#72003e"; + magenta = "#af005f"; + orange = "#ff8700"; + silver = "#e4e4e4"; + gray = "#353535"; + elegant = "#1b1d1e"; + # transparent = "#000000"; + transparent = "#000000b2"; + + modifier = "Mod4"; + menu = "bemenu-run -i -p 'Run:' --fn 'pango:monospace 7'"; + # config.wayland.windowManager.sway.config.modifier; in { - enable = false; + enable = true; xwayland = false; config = { + input = { + "*" = { + xkb_layout = "de"; + xkb_model = "chromebook"; + # no click needed + tap = "enabled"; + }; + "1452:544:Apple,_Inc_Apple_Keyboard" = { + xkb_layout = "us"; + }; + }; + output = { + "*".bg = "~/.config/wallpaper.png fill"; + # fireThink + "Unknown 0x226D 0x00000000" = { + enable = ""; + }; + # fireG0 + "Unknown 0x405C 0x00000000" = { + position = "0 0"; + # scale = "0.7"; + # resolution = "1920x1080"; + resolution = "1366x768@60Hz"; + }; + # fireEmerald + "Unknown 0x364C 0x00000000" = { + position = "0 0"; + scale = "1.25"; + }; + "Goldstar Company Ltd LG HDR 4K 0x0000655D" = { + position = "3000 0"; + enable = ""; + # disable = true; + # resolution = "3840x2160@30Hz"; + resolution = "3840x2160"; + }; + "HEADLESS-1" = { + resolution = "2560x1440"; + }; + "DP-1" = { + position = "3000 0"; + # resolution = "2560x1440"; + }; + # "DP-2" = { + # position = "1920 0"; + # # position = "4480 0"; + # # resolution = "1280x1024"; + # }; + }; + modifier = "${modifier}"; + menu = "${menu}"; terminal = "alacritty"; - menu = "bemenu-run -i -p 'Run:' --fn 'pango:monospace 7'"; + # fonts = { names = ["monospace"]; style = "monospace"; size = 7;}; + fonts = [ "pango:monospace 7" ]; + colors = { + focused = { background = "${cyan}"; border = "${cyan}"; childBorder = "${cyan}"; indicator = "${white}"; text = "${elegant}"; }; + focusedInactive = { background = "${gray}"; border = "${gray}"; childBorder = "${gray}"; indicator = "${magenta}"; text = "${cyan}"; }; + unfocused = { background = "${elegant}"; border = "${elegant}"; childBorder = "${elegant}"; indicator = "${white}"; text = "${orange}"; }; + urgent = { background = "${magenta}"; border = "${magenta}"; childBorder = "${magenta}"; indicator = "${magenta}"; text = "${silver}"; }; + placeholder = { background = "${magenta}"; border = "${magenta}"; childBorder = "${magenta}"; indicator = "${white}"; text = "${silver}"; }; + background = "${transparent}"; + }; bars = [{ position = "top"; + statusCommand = "i3blocks"; + colors = { + statusline = "${white}"; + # focusedStatusline = "${white}"; + background = "${elegant}"; + # focusedBackground = "${transparent}"; + activeWorkspace = { background = "${cyan}"; border = "${gray}"; text = "${white}"; }; + focusedWorkspace = { background = "${cyan}"; border = "${cyan}"; text = "${white}"; }; + inactiveWorkspace = { background = "${transparent}"; border = "${elegant}"; text = "${orange}"; }; + urgentWorkspace = { background = "${magenta}"; border = "${magenta}"; text = "${white}"; }; + bindingMode = { background = "${orange}"; border = "${orange}"; text = "${white}"; }; + }; }]; - #keybinding = [ - #]; + gaps = { + inner = 2; + outer = 0; + smartGaps = true; + smartBorders = "no_gaps"; + }; + modes.resize = { + 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"; + + 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"; + h = "resize shrink width 10 px or 10 ppt"; + + Return = "mode default"; + Escape = "mode default"; + "${modifier}+r" = "mode default"; + }; + workspaceAutoBackAndForth = true; + keybindings = { + "${modifier}+Return" = "exec alacritty"; + # "${modifier}+Return" = "exec ${config.wayland.windowManager.sway.config.terminal}"; + "${modifier}+Shift+c" = "reload"; + "${modifier}+Shift+r" = "restart"; + "${modifier}+c" = "kill"; + "${modifier}+Shift+e" = "exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway?' -b 'Yes, exit sway' 'swaymsg exit'"; + + "${modifier}+Shift+h" = "split h"; + "${modifier}+Shift+v" = "split v"; + + "${modifier}+z" = "fullscreen toggle"; + + "${modifier}+s" = "layout stacking"; + "${modifier}+w" = "layout tabbed"; + "${modifier}+e" = "layout toggle split"; + + "${modifier}+Shift+space" = "floating toggle"; + "${modifier}+space" = "focus mode_toggle"; + "${modifier}+a" = "focus parent"; + # "${modifier}+d" = "focus child"; + "${modifier}+d" = "exec ${menu}"; + + "${modifier}+x" = "sticky toggle"; + "${modifier}+Shift+x" = "move workspace to output left"; + + "${modifier}+r" = "mode resize"; + + # workspace + "${modifier}+1" = "workspace number ${ws1}"; + "${modifier}+2" = "workspace number ${ws2}"; + "${modifier}+3" = "workspace number ${ws3}"; + "${modifier}+4" = "workspace number ${ws4}"; + "${modifier}+5" = "workspace number ${ws5}"; + "${modifier}+6" = "workspace number ${ws6}"; + "${modifier}+7" = "workspace number ${ws7}"; + "${modifier}+8" = "workspace number ${ws8}"; + "${modifier}+9" = "workspace number ${ws9}"; + "${modifier}+0" = "workspace number ${ws10}"; + + "${modifier}+Shift+1" = "move container to workspace number ${ws1}"; + "${modifier}+Shift+2" = "move container to workspace number ${ws2}"; + "${modifier}+Shift+3" = "move container to workspace number ${ws3}"; + "${modifier}+Shift+4" = "move container to workspace number ${ws4}"; + "${modifier}+Shift+5" = "move container to workspace number ${ws5}"; + "${modifier}+Shift+6" = "move container to workspace number ${ws6}"; + "${modifier}+Shift+7" = "move container to workspace number ${ws7}"; + "${modifier}+Shift+8" = "move container to workspace number ${ws8}"; + "${modifier}+Shift+9" = "move container to workspace number ${ws9}"; + "${modifier}+Shift+0" = "move container to workspace number ${ws10}"; + + }; assigns = { "${ws1}" = [ { app_id = "(?i)empathy"; } @@ -74,11 +233,43 @@ { app_id = "(?i)firefoxdeveloperedition"; } ]; }; - window.commands = [ - { command = "move to scratchpad"; criteria = { title = "Firefox.* Sharing Indicator"; }; } - { command = "sticky enable"; criteria = { title = "Picture-in-Picture"; }; } - { command = "floating enable"; criteria = { title = "Picture-in-Picture"; }; } - { command = "floating enable"; criteria = { title = "Extension: \(Tree Style Tab\) - .*"; }; } + floating = { + modifier = modifier; + }; + window = { + border = 1; + # hideEdgeBorders = "smart_no_gaps"; + hideEdgeBorders = "smart"; + commands = [ + { command = "move to scratchpad"; criteria = { title = "Firefox.* Sharing Indicator"; }; } + { command = "sticky enable"; criteria = { title = "Picture-in-Picture"; }; } + { command = "floating enable"; criteria = { title = "Picture-in-Picture"; }; } + { command = "floating enable"; criteria = { title = "Extension: \(Tree Style Tab\) - .*"; }; } + ]; + }; + startup = [ + { command = "swayidle -w \\ + timeout 300 'swaylock -SeFfk --clock --effect-blur 7x5 --effect-vignette 0.5:0.5 --grace 2 --fade-in 0.2 --submit-on-touch' \\ + timeout 600 'swaymsg output * dpms off' \\ + resume 'swaymsg output * dpms on' \\ + before-sleep 'swaylock -SeFfk --clock --effect-blur 7x5 --effect-vignette 0.5:0.5 --grace 2 --fade-in 0.2 --submit-on-touch'"; } + { command = "mako"; } + #{ command = "kanshi"; } + # indicator + { command = "/usr/lib/kdeconnectd"; } + { command = "kdeconnect-indicator"; } + { command = "networkd-notify"; } + # needs x11 + #{ command = "udiskie -t"; } + #{ command = "modem-manager-gui -i"; } + #{ command = "nm-applet"; } + # apps + { command = "thunderbird"; } + { command = "firefox"; } + #{ command = "firefoxdeveloperedition"; } + { command = "nextcloud"; } + { command = "dino"; } + #{ command = "gajim"; } ]; }; };