diff --git a/machines/latitude/hardware-configuration.nix b/machines/latitude/hardware-configuration.nix index 39c1877..7569dd3 100755 --- a/machines/latitude/hardware-configuration.nix +++ b/machines/latitude/hardware-configuration.nix @@ -51,7 +51,7 @@ services.power-profiles-daemon.enable = true; # Suspend first then hibernate when closing the lid - services.logind.settings.Login.LidSwitch = "suspend-then-hibernate"; + services.logind.settings.Login.LidSwitch = "ignore"; # Hibernate on power button pressed services.logind.settings.Login.PowerKey = "hibernate"; services.logind.settings.Login.PowerKeyLongPress = "poweroff"; @@ -74,7 +74,7 @@ security.pam.howdy.control = "sufficient"; services.howdy.settings = { core = { - workaround = "native"; + workaround = "off"; }; video = { timeout = "20"; diff --git a/machines/latitude/home.nix b/machines/latitude/home.nix index 7bbb816..0c05993 100755 --- a/machines/latitude/home.nix +++ b/machines/latitude/home.nix @@ -13,7 +13,7 @@ imports = [ ../../home/default.nix - ../../modules/kde/home.nix + ../../modules/sway/home.nix # ../../modules/kde/home.nix ]; diff --git a/modules/sway/default.nix b/modules/sway/default.nix index de3add1..21adeff 100644 --- a/modules/sway/default.nix +++ b/modules/sway/default.nix @@ -2,6 +2,7 @@ config, pkgs, lib, + inputs, ... }: { @@ -28,6 +29,10 @@ pkgs.kdePackages.kate pkgs.kdePackages.filelight inputs.glide.packages.${pkgs.stdenv.hostPlatform.system}.default + pkgs.swaybg + pkgs.pulseaudioFull + pkgs.waybar + pkgs.twitter-color-emoji ]; }; @@ -35,8 +40,8 @@ enable = true; settings = { default_session = { - command = "${pkgs.tuigreet}/bin/tuigreet --time --cmd sway"; - user = "laythe"; + command = "${pkgs.tuigreet}/bin/tuigreet --remember --time --cmd sway"; + user = "greeter"; }; }; }; diff --git a/modules/sway/home.nix b/modules/sway/home.nix index b058b97..6e9c00d 100644 --- a/modules/sway/home.nix +++ b/modules/sway/home.nix @@ -16,6 +16,85 @@ "XF86AudioRaiseVolume" = "exec pactl set-sink-volume @DEFAULT_SINK@ +1%"; "XF86AudioLowerVolume" = "exec pactl set-sink-volume @DEFAULT_SINK@ -1%"; "XF86AudioMute" = "exec pactl set-sink-mute @DEFAULT_SINK@ toggle"; + + "Mod4+q" = "kill"; + "Mod4+Return" = "exec foot"; + "Mod4+Shift+q" = "kill"; + "Mod4+d" = "exec wmenu-run"; + + "Mod4+Left" = "focus left"; + "Mod4+Down" = "focus down"; + "Mod4+Up" = "focus up"; + "Mod4+Right" = "focus right"; + + "Mod4+Shift+Left" = "move left"; + "Mod4+Shift+Down" = "move down"; + "Mod4+Shift+Up" = "move up"; + "Mod4+Shift+Right" = "move right"; + + "Mod4+b" = "splith"; + "Mod4+v" = "splitv"; + "Mod4+f" = "fullscreen toggle"; + "Mod4+a" = "focus parent"; + + "Mod4+s" = "layout stacking"; + "Mod4+w" = "layout tabbed"; + "Mod4+e" = "layout toggle split"; + + "Mod4+Shift+space" = "floating toggle"; + "Mod4+space" = "focus mode_toggle"; + + "Mod4+1" = "workspace number 1"; + "Mod4+2" = "workspace number 2"; + "Mod4+3" = "workspace number 3"; + "Mod4+4" = "workspace number 4"; + "Mod4+5" = "workspace number 5"; + "Mod4+6" = "workspace number 6"; + "Mod4+7" = "workspace number 7"; + "Mod4+8" = "workspace number 8"; + "Mod4+9" = "workspace number 9"; + "Mod4+0" = "workspace number 10"; + + "Mod4+Shift+1" = "move container to workspace number 1"; + "Mod4+Shift+2" = "move container to workspace number 2"; + "Mod4+Shift+3" = "move container to workspace number 3"; + "Mod4+Shift+4" = "move container to workspace number 4"; + "Mod4+Shift+5" = "move container to workspace number 5"; + "Mod4+Shift+6" = "move container to workspace number 6"; + "Mod4+Shift+7" = "move container to workspace number 7"; + "Mod4+Shift+8" = "move container to workspace number 8"; + "Mod4+Shift+9" = "move container to workspace number 9"; + "Mod4+Shift+0" = "move container to workspace number 10"; + + "Mod4+Shift+minus" = "move scratchpad"; + "Mod4+minus" = "scratchpad show"; + + "Mod4+p" = "[app_id=\"trilium\"] scratchpad show, resize set 90 ppt 90 ppt, move position center"; + "Mod4+g" = "exec glide-browser"; + + "Mod4+Shift+i" = "exec makoctl invoke && makoctl dismiss"; + "Mod4+i" = "exec makoctl dismiss"; + + "Mod4+Shift+c" = "reload"; + "Mod4+Shift+e" = + "exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'"; + + "Mod4+r" = "mode resize"; + + "Mod4+c" = "[app_id=\"discord\"] scratchpad show, resize set 90 ppt 90 ppt, move position center"; + + "Mod4+j" = "[class=\"Jami\"] scratchpad show, resize set 90 ppt 90 ppt, move position center"; + + }; + bars = [ + { + command = "${pkgs.waybar}/bin/waybar"; + } + ]; + output = { + eDP-1 = { + scale = "1.25"; + }; }; input = { "type:touchpad" = { @@ -24,9 +103,117 @@ # Enables or disables natural (inverted) scrolling for the specified input device. natural_scroll = "enabled"; # Enables or disables disable-while-typing for the specified input device. - dwt = "enabled"; + dwt = "disabled"; + }; + }; + bindswitches = { + "lid:on" = { + reload = true; + locked = true; + action = "exec systemctl suspend-then-hibernate"; + }; + }; + startup = [ + { command = "swaybg -i ~/.background-image -m fill"; } + { command = "discord --enable-features=UseOzonePlatform --ozone-platform=wayland"; } + { command = "trilium"; } + { command = "jami"; } + ]; + window.commands = [ + { + criteria = { + app_id = "discord"; + }; + command = "move scratchpad"; + } + { + criteria = { + app_id = "trilium"; + }; + command = "move scratchpad"; + } + { + criteria = { + class = "Jami"; + }; + command = "move scratchpad"; + } + ]; + }; + }; + + programs.waybar = { + enable = true; + style = ./waybar.css; + settings = { + mainBar = { + layer = "top"; + position = "bottom"; # Puts the bar at the bottom + height = 30; + + # Define what goes where on the bar + modules-left = [ + "sway/workspaces" + "sway/mode" + ]; + modules-center = [ "sway/window" ]; + modules-right = [ + "backlight" + "pulseaudio" + "battery" + "clock" + "tray" + ]; + backlight = { + format = "{icon} {percent}%"; + format-icons = [ + "🌑" + "🌘" + "🌗" + "🌖" + "🌕" + ]; + }; + pulseaudio = { + format = "{icon} {volume}%"; + format-muted = "🔇 Muted"; + format-icons = { + default = [ + "🔈" + "🔉" + "🔊" + ]; + }; + scroll-step = 1; + on-click = "pactl set-sink-mute @DEFAULT_SINK@ toggle"; + }; + + clock = { + format = "{:%Y-%m-%d %H:%M}"; + tooltip-format = "{:%Y %B}\n{calendar}"; + }; + battery = { + states = { + warning = 30; + critical = 15; + }; + format = "{icon} {capacity}% ({time})"; + format-charging = "⚡ {capacity}% ({time})"; + format-plugged = "🔌 {capacity}% ({time})"; + format-icons = [ + "đŸĒĢ" + "🔋" + "🔋" + "🔋" + "🔋" + ]; }; }; }; }; + + services.swayidle.events = { + "before-sleep" = "${pkgs.swaylock}/bin/swaylock -fF"; + }; + services.swayidle.enable = true; } diff --git a/modules/sway/waybar.css b/modules/sway/waybar.css new file mode 100644 index 0000000..c9bcd8b --- /dev/null +++ b/modules/sway/waybar.css @@ -0,0 +1,330 @@ +* { + /* Prioritize Twemoji for icons, fallback to sans-serif for text */ + font-family: "Twitter Color Emoji", sans-serif; + font-size: 14px; +} + + +window#waybar { + background-color: rgba(43, 48, 59, 0.5); + border-bottom: 3px solid rgba(100, 114, 125, 0.5); + color: #ffffff; + transition-property: background-color; + transition-duration: .5s; +} + +window#waybar.hidden { + opacity: 0.2; +} + +/* +window#waybar.empty { + background-color: transparent; +} +window#waybar.solo { + background-color: #FFFFFF; +} +*/ + +window#waybar.termite { + background-color: #3F3F3F; +} + +window#waybar.chromium { + background-color: #000000; + border: none; +} + +button { + /* Use box-shadow instead of border so the text isn't offset */ + box-shadow: inset 0 -3px transparent; + /* Avoid rounded borders under each button name */ + border: none; + border-radius: 0; +} + +/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */ +button:hover { + background: inherit; + box-shadow: inset 0 -3px #ffffff; +} + +/* you can set a style on hover for any module like this */ +#pulseaudio:hover { + background-color: #a37800; +} + +#workspaces button { + padding: 0 5px; + background-color: transparent; + color: #ffffff; +} + +#workspaces button:hover { + background: rgba(0, 0, 0, 0.2); +} + +#workspaces button.focused, +#workspaces button.active { + background-color: #64727D; + box-shadow: inset 0 -3px #ffffff; +} + +#workspaces button.urgent { + background-color: #eb4d4b; +} + +#mode { + background-color: #64727D; + box-shadow: inset 0 -3px #ffffff; +} + +#clock, +#battery, +#cpu, +#memory, +#disk, +#temperature, +#backlight, +#network, +#pulseaudio, +#wireplumber, +#custom-media, +#tray, +#mode, +#idle_inhibitor, +#scratchpad, +#power-profiles-daemon, +#mpd { + padding: 0 10px; + color: #ffffff; +} + +#window, +#workspaces { + margin: 0 4px; +} + +/* If workspaces is the leftmost module, omit left margin */ +.modules-left>widget:first-child>#workspaces { + margin-left: 0; +} + +/* If workspaces is the rightmost module, omit right margin */ +.modules-right>widget:last-child>#workspaces { + margin-right: 0; +} + +#clock { + background-color: #64727D; +} + +#battery { + background-color: #ffffff; + color: #000000; +} + +#battery.charging, +#battery.plugged { + color: #ffffff; + background-color: #26A65B; +} + +@keyframes blink { + to { + background-color: #ffffff; + color: #000000; + } +} + +/* Using steps() instead of linear as a timing function to limit cpu usage */ +#battery.critical:not(.charging) { + background-color: #f53c3c; + color: #ffffff; + animation-name: blink; + animation-duration: 0.5s; + animation-timing-function: steps(12); + animation-iteration-count: infinite; + animation-direction: alternate; +} + +#power-profiles-daemon { + padding-right: 15px; +} + +#power-profiles-daemon.performance { + background-color: #f53c3c; + color: #ffffff; +} + +#power-profiles-daemon.balanced { + background-color: #2980b9; + color: #ffffff; +} + +#power-profiles-daemon.power-saver { + background-color: #2ecc71; + color: #000000; +} + +label:focus { + background-color: #000000; +} + +#cpu { + background-color: #2ecc71; + color: #000000; +} + +#memory { + background-color: #9b59b6; +} + +#disk { + background-color: #964B00; +} + +#backlight { + background-color: #90b1b1; +} + +#network { + background-color: #2980b9; +} + +#network.disconnected { + background-color: #f53c3c; +} + +#pulseaudio { + background-color: #f1c40f; + color: #000000; +} + +#pulseaudio.muted { + background-color: #90b1b1; + color: #2a5c45; +} + +#wireplumber { + background-color: #fff0f5; + color: #000000; +} + +#wireplumber.muted { + background-color: #f53c3c; +} + +#custom-media { + background-color: #66cc99; + color: #2a5c45; + min-width: 100px; +} + +#custom-media.custom-spotify { + background-color: #66cc99; +} + +#custom-media.custom-vlc { + background-color: #ffa000; +} + +#temperature { + background-color: #f0932b; +} + +#temperature.critical { + background-color: #eb4d4b; +} + +#tray { + background-color: #2980b9; +} + +#tray>.passive { + -gtk-icon-effect: dim; +} + +#tray>.needs-attention { + -gtk-icon-effect: highlight; + background-color: #eb4d4b; +} + +#idle_inhibitor { + background-color: #2d3436; +} + +#idle_inhibitor.activated { + background-color: #ecf0f1; + color: #2d3436; +} + +#mpd { + background-color: #66cc99; + color: #2a5c45; +} + +#mpd.disconnected { + background-color: #f53c3c; +} + +#mpd.stopped { + background-color: #90b1b1; +} + +#mpd.paused { + background-color: #51a37a; +} + +#language { + background: #00b093; + color: #740864; + padding: 0 5px; + margin: 0 5px; + min-width: 16px; +} + +#keyboard-state { + background: #97e1ad; + color: #000000; + padding: 0 0px; + margin: 0 5px; + min-width: 16px; +} + +#keyboard-state>label { + padding: 0 5px; +} + +#keyboard-state>label.locked { + background: rgba(0, 0, 0, 0.2); +} + +#scratchpad { + background: rgba(0, 0, 0, 0.2); +} + +#scratchpad.empty { + background-color: transparent; +} + +#privacy { + padding: 0; +} + +#privacy-item { + padding: 0 5px; + color: white; +} + +#privacy-item.screenshare { + background-color: #cf5700; +} + +#privacy-item.audio-in { + background-color: #1ca000; +} + +#privacy-item.audio-out { + background-color: #0069d4; +} \ No newline at end of file