From 6c56795c33de91e56a6569ed07e79ed3f52712a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Eug=C3=AAnio?= Date: Sat, 25 Feb 2023 19:29:33 -0300 Subject: [PATCH] sway: extract assigns --- user/sway/default.nix | 168 ++++++++++++++----------------------- user/sway/sway-assigns.nix | 58 +++++++++++++ 2 files changed, 122 insertions(+), 104 deletions(-) create mode 100644 user/sway/sway-assigns.nix diff --git a/user/sway/default.nix b/user/sway/default.nix index 5b0425a..c7e01fe 100644 --- a/user/sway/default.nix +++ b/user/sway/default.nix @@ -9,6 +9,7 @@ in ./mako.nix ./sway-binds.nix ./sway-modes.nix + ./sway-assigns.nix ./swayidle.nix ./swaylock.nix ./theme.nix @@ -18,118 +19,77 @@ in services.swayidle.enable = true; services.kanshi.enable = true; - wayland.windowManager.sway = - let - mod = "Mod4"; - # menu = "wlauncher"; - # terminal = "alacritty"; - in - { - enable = true; - config = { - bars = [ ]; - window.titlebar = false; - gaps = { - smartGaps = true; - smartBorders = "on"; - inner = 5; - }; - colors = - let - acc = accent.color; - fg_acc = accent.fg; - fg_color = color.txt; - bg_color = color.bg_dark; - alert = "#000000"; - client = border: background: text: indicator: childBorder: { - inherit border background text indicator childBorder; - }; - in - { - focused = client acc acc fg_acc acc acc; - focusedInactive = client bg_color bg_color fg_color bg_color bg_color; - unfocused = client bg_color bg_color fg_color bg_color bg_color; - urgent = client alert alert fg_color alert alert; - }; - output = { - "*" = { - adaptive_sync = "on"; - bg = "${theme.background} fill"; - }; - "DP-1" = { - mode = "1920x1080@144.000Hz"; + wayland.windowManager.sway = { + enable = true; + config = { + bars = [ ]; + + floating.modifier = "Mod4"; + terminal = pkgs.alacritty.executable; + + window.titlebar = false; + gaps = { + smartGaps = true; + smartBorders = "on"; + inner = 5; + }; + colors = + let + acc = accent.color; + fg_acc = accent.fg; + fg_color = color.txt; + bg_color = color.bg_dark; + alert = "#000000"; + client = border: background: text: indicator: childBorder: { + inherit border background text indicator childBorder; }; + in + { + focused = client acc acc fg_acc acc acc; + focusedInactive = client bg_color bg_color fg_color bg_color bg_color; + unfocused = client bg_color bg_color fg_color bg_color bg_color; + urgent = client alert alert fg_color alert alert; }; - fonts = { - names = [ font.interface ]; - size = font.size.medium * 1.0; + output = { + "*" = { + adaptive_sync = "on"; + bg = "${theme.background} fill"; }; - input."type:touchpad" = { - # Disable While Typing - dwt = "enabled"; - natural_scroll = "enabled"; - tap = "enabled"; + "DP-1" = { + mode = "1920x1080@144.000Hz"; }; - input."*" = { - xkb_layout = "us(colemak),br"; - xkb_options = "lv3:lsgt_switch,grp:shifts_toggle"; - xkb_numlock = "enabled"; - repeat_rate = "30"; - repeat_delay = "200"; - }; - # setup cursor based on home.pointerCursor - seat."*" = { - xcursor_theme = "${config.home.pointerCursor.name} ${ + }; + fonts = { + names = [ font.interface ]; + size = font.size.medium * 1.0; + }; + input."type:touchpad" = { + # Disable While Typing + dwt = "enabled"; + natural_scroll = "enabled"; + tap = "enabled"; + }; + input."*" = { + xkb_layout = "us(colemak),br"; + xkb_options = "lv3:lsgt_switch,grp:shifts_toggle"; + xkb_numlock = "enabled"; + repeat_rate = "30"; + repeat_delay = "200"; + }; + # setup cursor based on home.pointerCursor + seat."*" = { + xcursor_theme = "${config.home.pointerCursor.name} ${ toString config.home.pointerCursor.size }"; - hide_cursor = "when-typing enable"; - }; - assigns = { - "2" = [ - { class = "qutebrowser"; } - { app_id = "qutebrowser"; } - { class = "firefox"; } - { app_id = "firefox"; } - { class = "Chromium"; } - { app_id = "chromium"; } - ]; - "7" = [ - { app_id = "thunderbird"; } - { app_id = "astroid"; } - ]; - "9" = [ - { class = ".*[Ss]team.*"; } - { app_id = ".*[Ss]team.*"; } - { app_id = "[Ll]utris"; } - ]; - "10" = [ - { app_id = ".*[Tt]elegram.*"; } - { class = ".*[Tt]elegram.*"; } - { class = "Jitsi Meet"; } - { class = "discord"; } - { title = "Discord"; } - { class = "WebCord"; } - { app_id = "WebCord"; } - ]; - }; - floating = { - modifier = "Mod4"; - criteria = [ - { class = "file_picker"; } - { app_id = "file_picker"; } - { app_id = "wdisplays"; } - { app_id = "pavucontrol"; } - { app_id = ".*[Hh]elvum.*"; } - ]; - }; - terminal = pkgs.alacritty.executable; + hide_cursor = "when-typing enable"; }; - extraConfig = '' - for_window [title=.*] inhibit_idle fullscreen - exec ${pkgs.dbus-sway-environment}/bin/dbus-sway-environment - exec swaymsg workspace 2 - ''; }; + extraConfig = '' + for_window [title=.*] inhibit_idle fullscreen + exec ${pkgs.dbus-sway-environment}/bin/dbus-sway-environment + exec swaymsg workspace 2 + ''; + }; services.gammastep = { enable = true; provider = "geoclue2"; diff --git a/user/sway/sway-assigns.nix b/user/sway/sway-assigns.nix new file mode 100644 index 0000000..c0c5c0f --- /dev/null +++ b/user/sway/sway-assigns.nix @@ -0,0 +1,58 @@ +{ config, pkgs, ... }: +let + # inherit (pkgs.uservars) key accent font theme; + # inherit (theme) color; + # inherit (pkgs) lib; + + # mod = "Mod4"; + # menu = "wlauncher"; + # terminal = "alacritty"; + + # locked_binds = + # lib.mapAttrs' (k: v: lib.nameValuePair "--locked ${k}" v); + # code_binds = + # lib.mapAttrs' (k: v: lib.nameValuePair "--to-code ${k}" v); + # return_mode = lib.mapAttrs (k: v: "${v}; mode default"); + # playerctl = "exec ${pkgs.playerctl}/bin/playerctl"; +in +{ + wayland.windowManager.sway.config = { + assigns = { + "2" = [ + { class = "qutebrowser"; } + { app_id = "qutebrowser"; } + { class = "firefox"; } + { app_id = "firefox"; } + { class = "Chromium"; } + { app_id = "chromium"; } + ]; + "7" = [ + { app_id = "thunderbird"; } + { app_id = "astroid"; } + ]; + "9" = [ + { class = ".*[Ss]team.*"; } + { app_id = ".*[Ss]team.*"; } + { app_id = "[Ll]utris"; } + ]; + "10" = [ + { app_id = ".*[Tt]elegram.*"; } + { class = ".*[Tt]elegram.*"; } + { class = "Jitsi Meet"; } + { class = "discord"; } + { title = "Discord"; } + { class = "WebCord"; } + { app_id = "WebCord"; } + ]; + }; + floating = { + criteria = [ + { class = "file_picker"; } + { app_id = "file_picker"; } + { app_id = "wdisplays"; } + { app_id = "pavucontrol"; } + { app_id = ".*[Hh]elvum.*"; } + ]; + }; + }; +}