diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b2be92b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +result diff --git a/common/sway.nix b/common/sway.nix index 7e8fcf9..903f35d 100644 --- a/common/sway.nix +++ b/common/sway.nix @@ -5,12 +5,23 @@ in { build_definition_lines = lib.mapAttrsToList (name: value: "set \$${name} ${value}"); build_keybind_lines = lib.mapAttrsToList (key: value: "bindsym ${key} ${value}"); build_exec_lines = map (item: "exec " + item); + waybar_full = pkgs.writeShellScriptBin "waybar-full" ( + "${config.programs.waybar.package}/bin/waybar" + + (if isNull cfg.sway.barConfig then "" else " -c ${cfg.sway.barConfig}") + + (if isNull cfg.sway.barStyle then "" else " -s ${cfg.sway.barStyle}") + ); + bar_config = '' +bar { + swaybar_command ${waybar_full}/bin/waybar-full +} +''; text = lib.strings.concatLines [ (lib.strings.concatLines (build_definition_lines cfg.sway.definitions)) (lib.strings.concatLines (build_keybind_lines cfg.sway.keybinds)) (lib.strings.concatLines (build_exec_lines cfg.sway.autolaunch)) cfg.sway.extraConfig + bar_config ]; sway_conf = pkgs.writeText "sway.conf" text; @@ -19,11 +30,13 @@ in { source = sway_conf; }; - environment.systemPackages = with pkgs; [ + environment.systemPackages = [ + waybar_full + ] ++ (with pkgs; [ procps slurp libnotify - ]; + ]); systemd.services.reload-sway = { description = "Reload all running sway instances"; @@ -60,6 +73,7 @@ done wf-recorder dmenu wmenu + waybar-mpris ]; extraOptions = [ "--unsupported-gpu" diff --git a/configuration.nix b/configuration.nix index da8e8b6..f62694c 100644 --- a/configuration.nix +++ b/configuration.nix @@ -8,6 +8,7 @@ [ # Include the results of the hardware scan. ./modules/fonts.nix ./modules/tabletdriver.nix + ./sway/sway-conf.nix ]; # Bootloader. @@ -50,11 +51,6 @@ "{1526fba1-ac33-4dfc-99d8-163e6129f7b9}" = "reveye-ris"; }; }; - sway = { - enable = true; - populateDefaultConfig = true; - }; - cloudSync = { enable = true; username = "Grimmauld"; diff --git a/flake.lock b/flake.lock index a2dbdc0..2d7d657 100644 --- a/flake.lock +++ b/flake.lock @@ -78,11 +78,11 @@ "yafas": "yafas" }, "locked": { - "lastModified": 1711229481, - "narHash": "sha256-mugLPd8wlCx1s1PDv/sIFJq5xK3sycf+fROFHvE8boE=", + "lastModified": 1711410101, + "narHash": "sha256-HEOyOUg+rRelnhsmXJ9ht0cUok94s2oCw6TtHhMPC+8=", "owner": "chaotic-cx", "repo": "nyx", - "rev": "1520b69fa40d96c5e95b6e0da65831d3c7130fb0", + "rev": "0d2b028bcf1a9c8d0d8bb987edec8d56a2075922", "type": "github" }, "original": { @@ -138,11 +138,11 @@ ] }, "locked": { - "lastModified": 1710821861, - "narHash": "sha256-Y+x3q7VkPpRok7Om2bwB2v1JDK/OCZmiFaBrIOJRojY=", + "lastModified": 1711172967, + "narHash": "sha256-HBkYzSfFM0oMnRSjquI1CJ7a4jtIv9eRbAeJZDE8H3M=", "owner": "girlbossceo", "repo": "conduwuit", - "rev": "7809f0a6aee6900de59b720bf966d4a0315276bc", + "rev": "101cb34f9a1b94b91717af3581f35386f20d4601", "type": "github" }, "original": { @@ -331,11 +331,11 @@ ] }, "locked": { - "lastModified": 1710915975, - "narHash": "sha256-yOc0AD6ba7mbialNciZGzuSQLMo4CopoZGEfcUugA4I=", + "lastModified": 1711231487, + "narHash": "sha256-dRdFjStMA7GeuD/V4vzKblzuHwxMPgzEboRleVdZlUM=", "owner": "Jovian-Experiments", "repo": "Jovian-NixOS", - "rev": "179d73fbe14c5bdb835d10bcc1c783466112bfa6", + "rev": "1171169117f63f1de9ef2ea36efd8dcf377c6d5a", "type": "github" }, "original": { @@ -357,11 +357,11 @@ "rust-overlay": "rust-overlay" }, "locked": { - "lastModified": 1710898409, - "narHash": "sha256-vk+NUeKBb8pyTkZvHVq7+or25fpnSeaaSBGHSGKXL44=", + "lastModified": 1711332928, + "narHash": "sha256-VSqMvQR22wn0ySB4mvDqNnrOl43cBJc4vkPAk9YEPoQ=", "owner": "martinvonz", "repo": "jj", - "rev": "4fbe6aecc95152eda44cb4b185ab369e23e1393f", + "rev": "15ff7dfd4836d1d6d9fad0a91e06dea2b3dea58d", "type": "github" }, "original": { @@ -394,11 +394,11 @@ ] }, "locked": { - "lastModified": 1710858553, - "narHash": "sha256-CHSkAhNaWIMXlJX7skC2t5wr/qaNlMgWQsezNqr15mw=", + "lastModified": 1711266147, + "narHash": "sha256-oNAcVJ0oNwq0JTw9ZmopJREiT4NZ+1VMs5vY85eidnQ=", "owner": "YaLTeR", "repo": "niri", - "rev": "db49deb7fd2fbe805ceec060aa4dec65009ad7a7", + "rev": "e5bd1113ba293bed1b80f04e8683d1aa847a5dc8", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 79d746f..84e4524 100644 --- a/flake.nix +++ b/flake.nix @@ -37,7 +37,6 @@ ./load_common.nix ./specific/grimm-nixos-laptop.nix -# ./kernel.nix ./configuration.nix ./modules/users.nix # ./modules/tlp.nix diff --git a/load_common.nix b/load_common.nix index 2d0e221..9ccb129 100644 --- a/load_common.nix +++ b/load_common.nix @@ -113,10 +113,16 @@ in { description = "additional sway config to be included"; }; - populateDefaultConfig = mkOption { - type = types.bool; - default = false; - description = "puts my personal config in place using above methods"; + barStyle = mkOption { + type = types.nullOr types.path; + default = null; + description = "waybar style sheet to use"; + }; + + barConfig = mkOption { + type = types.nullOr types.path; + default = null; + description = "waybar config to use"; }; }; @@ -173,7 +179,6 @@ in { ./common/firefox.nix ./common/pass.nix ./common/sway.nix - ./common/sway-defaults.nix ./common/cloudsync.nix ]; } diff --git a/modules/users.nix b/modules/users.nix index 8d98a78..a786beb 100644 --- a/modules/users.nix +++ b/modules/users.nix @@ -18,6 +18,7 @@ prusa-slicer freecad openscad + jetbrains.clion # blender ]; }; diff --git a/sway/bar/config b/sway/bar/config new file mode 100644 index 0000000..18e3419 --- /dev/null +++ b/sway/bar/config @@ -0,0 +1,121 @@ +{ + // "layer": "top", // Waybar at top layer + "position": "top", + "height": 30, // Waybar height (to be removed for auto height) + // "width": 1280, // Waybar width + "spacing": 4, // Gaps between modules (4px) + // Choose the order of the modules + "modules-left": ["sway/workspaces", "sway/mode", "sway/scratchpad"], + "modules-center": [], // "sway/window"], + "modules-right": ["custom/media", "idle_inhibitor", "pulseaudio", "network", "cpu", "memory", "temperature", "backlight", "keyboard-state", "battery", "clock", "tray"], + "keyboard-state": { + "numlock": true, + "capslock": true, + "format": "{name} {icon}", + "format-icons": { + "locked": "", + "unlocked": "" + } + }, + "sway/mode": { + "format": "{}" + }, + "sway/scratchpad": { + "format": "{icon} {count}", + "show-empty": false, + "format-icons": ["", ""], + "tooltip": true, + "tooltip-format": "{app}: {title}" + }, + "idle_inhibitor": { + "format": "{icon}", + "format-icons": { + "activated": "", + "deactivated": "" + } + }, + "tray": { + // "icon-size": 21, + "spacing": 10 + }, + "clock": { + // "timezone": "America/New_York", + "tooltip-format": "{:%Y %B}\n{calendar}", + "format-alt": "{:%d.%m.%Y}" + }, + "cpu": { + "format": "{usage}% ", + "tooltip": false + }, + "memory": { + "format": "{}% " + }, + "temperature": { + // "thermal-zone": 2, + // "hwmon-path": "/sys/class/hwmon/hwmon2/temp1_input", + "critical-threshold": 80, + // "format-critical": "{temperatureC}°C {icon}", + "format": "{temperatureC}°C {icon}", + "format-icons": ["", "", ""] + }, + "backlight": { + // "device": "acpi_video1", + "format": "{percent}%", + "format-icons": ["", "", "", "", "", "", "", "", ""] + }, + "battery": { + "states": { + // "good": 95, + "warning": 30, + "critical": 15 + }, + "format": "{capacity}% {icon}", + "format-charging": "{capacity}% ", + "format-plugged": "{capacity}% ", + "format-alt": "{time} {icon}", + // "format-good": "", // An empty format will hide the module + // "format-full": "", + "format-icons": ["", "", "", "", ""] + }, + "battery#bat2": { + "bat": "BAT2" + }, + "network": { + // "interface": "wlp2*", // (Optional) To force the use of this interface + "format-wifi": "{essid} ({signalStrength}%) ", + "format-ethernet": "{ipaddr}/{cidr} ", + "tooltip-format": "{ifname} via {gwaddr} ", + "format-linked": "{ifname} (No IP) ", + "format-disconnected": "Disconnected ⚠", + "format-alt": "{ifname}: {ipaddr}/{cidr}" + }, + "pulseaudio": { + // "scroll-step": 1, // %, can be a float + "format": "{volume}% {icon} {format_source}", + "format-bluetooth": "{volume}% {icon} {format_source}", + "format-bluetooth-muted": " {icon} {format_source}", + "format-muted": " {format_source}", + "format-source": "{volume}% ", + "format-source-muted": "", + "format-icons": { + "headphone": "", + "hands-free": "", + "headset": "", + "phone": "", + "portable": "", + "car": "", + "default": ["", "", ""] + }, + "on-click": "pavucontrol" + }, + "custom/media": { + "return-type": "json", + "on-click": "waybar-mpris --send toggle", + "exec": "waybar-mpris --position --autofocus --pause ⏵ --play ⏸ --order SYMBOL:TITLE:ARTIST:ALBUM:POSITION ", + "on-scroll-up": "waybar-mpris --send next", + "on-scroll-down": "waybar-mpris --send prev", + "max-length": 40, + "escape": true + } +} + diff --git a/sway/bar/style.css b/sway/bar/style.css new file mode 100644 index 0000000..89156df --- /dev/null +++ b/sway/bar/style.css @@ -0,0 +1,296 @@ +* { + /* `otf-font-awesome` is required to be installed for icons */ + font-family: FontAwesome, Roboto, Helvetica, Arial, sans-serif; + font-size: 14px; + border-radius: 5px; + margin: 1px 0; +} + +window#waybar { + background-color: rgba(35,38,41, 0); + /* border-bottom: 3px solid rgba(100, 114, 125, 0.5); */ + color: #ffffff; + transition-property: background-color; + transition-duration: .5s; + margin: 2px 0; + padding: 1px 1px; +} + + +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; +} + +/* 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; +} + +#workspaces button { + padding: 0 2px; + margin: 0 3px; + background-color: #3F3F3F; +} + +#workspaces button:hover { + background: rgba(0, 0, 0, 0.2); +} + +#workspaces button.focused { + background-color: #232629; + /* box-shadow: inset 0 -3px #ffffff; */ +} + +#workspaces button.urgent { + background-color: #eb4d4b; +} + +#mode { + background-color: #3F3F3F; + border-bottom: 3px solid #ffffff; +} + +#clock, +#battery, +#cpu, +#memory, +#disk, +#temperature, +#backlight, +#network, +#pulseaudio, +#wireplumber, +#custom-media, +#tray, +#mode, +#idle_inhibitor, +#scratchpad, +#mpd { + padding: 0 10px; + color: #ffffff; +} + +#window, +#workspaces { + margin: 0 4px; +} + + +/* +.modules-left > widget:first-child > #workspaces { + margin-left: 0; +} + +.modules-right > widget:last-child > #workspaces { + margin-right: 0; +} +*/ + +@keyframes blink { + to { + background-color: #ffffff; + color: #000000; + } +} + +#battery.critical:not(.charging) { + background-color: #f53c3c; + color: #ffffff; + animation-name: blink; + animation-duration: 0.5s; + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; +} + +label:focus { + background-color: #31363b; +} + +#clock { + background-color: #31363b; +} + +#battery { + background-color: #31363b; +} + +#battery.charging, #battery.plugged { + background-color: #31363b; +} + +#cpu { + background-color: #31363b; +} + +#memory { + background-color: #31363b; +} + +#disk { + background-color: #31363b; +} + +#backlight { + background-color: #31363b; +} + +#network { + background-color: #31363b; +} + +#network.disconnected { + background-color: #31363b; +} + +#pulseaudio { + background-color: #31363b; +} + +#pulseaudio.muted { + background-color: #31363b; +} + +#wireplumber { + background-color: #31363b; +} + +#wireplumber.muted { + background-color: #31363b; +} + +#custom-media { + background-color: #31363b; + min-width: 100px; +} + +#custom-media.custom-spotify { + background-color: #31363b; +} + +#custom-media.custom-vlc { + background-color: #31363b; +} + +#temperature { + background-color: #31363b; +} + +#temperature.critical { + background-color: #31363b; +} + +#tray { + background-color: #31363b; +} + +#idle_inhibitor { + background-color: #31363b; +} + +#idle_inhibitor.activated { + background-color: #31363b; +} + + +#mpd { + background-color: #31363b; +} + +#mpd.disconnected { + background-color: #31363b; +} + +#mpd.stopped { + background-color: #31363b; +} + +#mpd.paused { + background-color: #31363b; +} + +#privacy-item { + color: white; +} + +#privacy-item.screenshare { + background-color: #31363b; +} + +#privacy-item.audio-in { + background-color: #31363b; +} + +#privacy-item.audio-out { + background-color: #31363b; +} + + +#tray > .passive { + -gtk-icon-effect: dim; +} + +#tray > .needs-attention { + -gtk-icon-effect: highlight; + background-color: #31363b; +} + + +#language { + min-width: 16px; +} + + +#keyboard-state { + background: #31363b; + padding: 0 0px; + min-width: 16px; +} + +#keyboard-state > label { + padding: 0 5px; +} + +#keyboard-state > label.locked { + background: #232629; +} + + +#scratchpad { + background: rgba(0, 0, 0, 0.2); +} + +#scratchpad.empty { + background-color: transparent; +} + +#privacy { + padding: 0; +} + diff --git a/common/sway-defaults.nix b/sway/sway-conf.nix similarity index 97% rename from common/sway-defaults.nix rename to sway/sway-conf.nix index ebc243c..eee5e5b 100644 --- a/common/sway-defaults.nix +++ b/sway/sway-conf.nix @@ -1,8 +1,6 @@ { inputs, system, pkgs, config, lib, ... }: let - cfg = config.grimmShared; swaymux_pkg = inputs.swaymux.packages."${system}".default; in { - config = with cfg; lib.mkIf (enable && sway.enable && sway.populateDefaultConfig ) { environment.systemPackages = (with pkgs; [ alacritty wmenu @@ -13,6 +11,11 @@ in { ++ [ swaymux_pkg ]; grimmShared.sway = { + enable = true; + + barConfig = ./bar/config; + barStyle = ./bar/style.css; + definitions = { mod = "Mod4"; left = "h"; @@ -139,9 +142,6 @@ output HDMI-A-1 mode 1920x1080@60Hz position 0,0 for_window [app_id="lxqt-policykit-agent"] floating enable; floating_modifier $mod normal -bar { - swaybar_command waybar -} input type:keyboard xkb_numlock enabled include /etc/sway/config.d/* @@ -182,9 +182,7 @@ mode "resize" { bindsym Return mode "default" bindsym Escape mode "default" } -# test ''; - }; }; } diff --git a/common/wallpapers/spain.jpg b/sway/wallpapers/spain.jpg similarity index 100% rename from common/wallpapers/spain.jpg rename to sway/wallpapers/spain.jpg diff --git a/common/wallpapers/switzerland.jpg b/sway/wallpapers/switzerland.jpg similarity index 100% rename from common/wallpapers/switzerland.jpg rename to sway/wallpapers/switzerland.jpg