diff --git a/config/battery.nix b/config/battery.nix index 2f67a61..bc71f68 100644 --- a/config/battery.nix +++ b/config/battery.nix @@ -1,5 +1,5 @@ { config, lib, ... }: -lib.mkIf (config.custom.platform == "laptop") { +lib.mkIf (config.platform == "laptop") { services.upower = { enable = true; diff --git a/config/login.nix b/config/login.nix index 865fe70..d941565 100644 --- a/config/login.nix +++ b/config/login.nix @@ -1,5 +1,5 @@ { config, lib, pkgs, tokyo-night-sddm-src, ... }: -lib.mkIf (config.custom.platform != "mobile") +lib.mkIf (config.platform != "mobile") (let tokyo-night-sddm = with pkgs.libsForQt5; pkgs.stdenv.mkDerivation { name = "tokyo-night-sddm"; diff --git a/config/packages.nix b/config/packages.nix index 25f0c3d..1b766e4 100644 --- a/config/packages.nix +++ b/config/packages.nix @@ -22,10 +22,6 @@ in { (aspellWithDicts (ps: with ps; [ en en-computers en-science ])) gcc - wob - grim - slurp - imv direnv nix-direnv-with-flakes diff --git a/flake.nix b/flake.nix index 333df13..ef0439a 100644 --- a/flake.nix +++ b/flake.nix @@ -32,14 +32,14 @@ outputs = { self, ./platform.nix ./hardware-configuration/desktop.nix { _module.args = moduleArgs; - custom.platform = "desktop"; } + platform = "desktop"; } home-manager.nixosModules.home-manager { home-manager.users.${username} = import ./home-manager; home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; - home-manager.sharedModules = [ ./platform.nix { custom.platform = "desktop"; } ]; + home-manager.sharedModules = [ ./platform.nix { platform = "desktop"; } ]; home-manager.extraSpecialArgs = moduleArgs; } ]; @@ -51,7 +51,7 @@ outputs = { self, ./config { _module.args = moduleArgs; - custom.platform = "laptop"; } + platform = "laptop"; } ./platform.nix ./hardware-configuration/laptop.nix home-manager.nixosModules.home-manager @@ -61,7 +61,7 @@ outputs = { self, home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; - home-manager.sharedModules = [ ./platform.nix { custom.platform = "laptop"; } ]; + home-manager.sharedModules = [ ./platform.nix { platform = "laptop"; } ]; home-manager.extraSpecialArgs = moduleArgs; } ]; diff --git a/home-manager/wayland/default.nix b/home-manager/wayland/default.nix index 40e6e15..6970296 100644 --- a/home-manager/wayland/default.nix +++ b/home-manager/wayland/default.nix @@ -11,5 +11,6 @@ ./mako.nix ./rofi.nix ./waybar.nix + ./wob.nix ]; } diff --git a/home-manager/wayland/sway.nix b/home-manager/wayland/sway.nix index bde8bb2..3d22626 100644 --- a/home-manager/wayland/sway.nix +++ b/home-manager/wayland/sway.nix @@ -3,7 +3,14 @@ let modifier = "Mod4"; terminal = "alacritty"; in { - home.packages = with pkgs; [ swayidle wl-clipboard wlroots ]; + home.packages = with pkgs; [ + swayidle + wl-clipboard + wlroots + grim + slurp + imv + ]; wayland.windowManager.sway = { enable = true; @@ -53,9 +60,10 @@ in { startup = map (x: { command = x; }) [ # Make wob channels - ''mkfifo $SWAYSOCK.volume.wob && tail -f $SWAYSOCK.volume.wob | wob'' - ''mkfifo $SWAYSOCK.brightness.wob && tail -f $SWAYSOCK.brightness.wob | wob \ - --border-color "#FFFF00FF" --bar-color "#FFFF00FF"'' + ''mkfifo $XDG_RUNTIME_DIR/wob_volume.sock && tail -f $XDG_RUNTIME_DIR/wob_volume.sock \ + | wob -c ~/.config/wob/volume.ini'' + ''mkfifo $XDG_RUNTIME_DIR/wob_brightness.sock && tail -f $XDG_RUNTIME_DIR/wob_brightness.sock \ + | wob -c ~/.config/wob/brightness.ini'' ''swayidle timeout 120 'swaylock -f --grace=180' \ timeout 600 'systemctl suspend' \ before-sleep 'swaylock -f' '' @@ -65,10 +73,10 @@ in { keybindings = let # Volume using pamixer and wob - audio-disp = ''pamixer --get-volume > $SWAYSOCK.volume.wob''; + audio-disp = ''pamixer --get-volume > $XDG_RUNTIME_DIR/wob_volume.sock''; audio = cmd: "exec pamixer ${cmd} && ${audio-disp}"; # Brightness using brightnessctl and wob - brightness-disp = ''brightnessctl -e -m | cut -d "," -f4 | tr -d "%" > $SWAYSOCK.brightness.wob''; + brightness-disp = ''brightnessctl -e -m | cut -d "," -f4 | tr -d "%" > $XDG_RUNTIME_DIR/wob_brightness.sock''; brightness = x: "exec brightnessctl -e set ${x} && ${brightness-disp}"; # Play controls using playerctl playerctl = cmd: "exec playerctl ${cmd}"; diff --git a/home-manager/wayland/waybar.nix b/home-manager/wayland/waybar.nix index 0d3d9a1..ddeca7d 100644 --- a/home-manager/wayland/waybar.nix +++ b/home-manager/wayland/waybar.nix @@ -14,7 +14,7 @@ modules-center = [ "sway/window" ]; modules-right = - if config.custom.platform == "laptop" then + if config.platform == "laptop" then [ "battery" "pulseaudio" "backlight" "network" "clock" "idle_inhibitor" ] else [ "pulseaudio" "network" "clock" "idle_inhibitor" ]; @@ -243,7 +243,7 @@ #pulseaudio { background-color: @altblend; ${ - if config.custom.platform == "laptop" then + if config.platform == "laptop" then '' margin: 3px 0px 3px 2px; padding-right: 5px; diff --git a/home-manager/wayland/wob.nix b/home-manager/wayland/wob.nix new file mode 100644 index 0000000..713422d --- /dev/null +++ b/home-manager/wayland/wob.nix @@ -0,0 +1,13 @@ +{ config, pkgs, ... }: +{ + home.packages = [ pkgs.wob ]; + + xdg.configFile = rec { + "wob/volume.ini".text = ""; + + "wob/brightness.ini".text = "wob/volume.ini".text + '' + border_color = #FFFF00FF + bar_color = #FFFF00FF + ''; + } +} diff --git a/platform.nix b/platform.nix index 1316d6d..72fbc7b 100644 --- a/platform.nix +++ b/platform.nix @@ -1,6 +1,6 @@ { lib, ... }: { - options.custom.platform = lib.mkOption { + options.platform = lib.mkOption { description = "The platform to configure for"; type = lib.types.enum [ "desktop" "laptop" "mobile" ]; };