From bf63458b2ee387aa1a10b8fd19d396d365a59bb0 Mon Sep 17 00:00:00 2001 From: Evie Litherland-Smith Date: Thu, 3 Aug 2023 10:37:36 +0100 Subject: [PATCH] Add playerctl and mpris module to waybar Fix hyprland binds for audio and brightness --- home/hyprland/default.nix | 5 +++++ home/hyprland/hyprland.conf | 10 +++++++++- home/hyprland/waybar/default.nix | 9 +++++---- home/hyprland/waybar/modules/mpris.nix | 18 ++++++++++++++++++ hosts/Ronin/home.nix | 2 +- hosts/hyprland.nix | 3 --- 6 files changed, 38 insertions(+), 9 deletions(-) create mode 100644 home/hyprland/waybar/modules/mpris.nix diff --git a/home/hyprland/default.nix b/home/hyprland/default.nix index b5c3b786..8f59e544 100644 --- a/home/hyprland/default.nix +++ b/home/hyprland/default.nix @@ -33,7 +33,12 @@ in { pipewire wireplumber wl-clipboard + grim + slurp swayimg + playerctl + pamixer + playerctl brightnessctl ]; programs = { diff --git a/home/hyprland/hyprland.conf b/home/hyprland/hyprland.conf index 4748eef5..e69d2645 100644 --- a/home/hyprland/hyprland.conf +++ b/home/hyprland/hyprland.conf @@ -84,12 +84,20 @@ bind = SUPER SHIFT, Q, killactive, bind = SUPER, M, fullscreen, 1 bind = SUPER SHIFT, M, fullscreen, 0 +# Misc useful binds bind=,Print,exec,grim -g "$(slurp)" +# Sound bind=,XF86AudioMute,exec,pamixer -t binde=,XF86AudioRaiseVolume,exec,pamixer -i 5 binde=,XF86AudioLowerVolume,exec,pamixer -d 5 +# Brightness binde=,XF86MonBrightnessUp,exec,brightnessctl s +5% -binde=,XF86MonBrightnessDown,exec,brightnessctl s -5% +binde=,XF86MonBrightnessDown,exec,brightnessctl s 5%- +# Playback +binde=,XF86AudioPlay,exec,playerctl play-pause +binde=,XF86AudioStop,exec,playerctl play-pause +binde=,XF86AudioPrev,exec,playerctl previous +binde=,XF86AudioNext,exec,playerctl next bind = SUPER, H, movefocus, l bind = SUPER, L, movefocus, r diff --git a/home/hyprland/waybar/default.nix b/home/hyprland/waybar/default.nix index 49c1fca0..d15004d1 100644 --- a/home/hyprland/waybar/default.nix +++ b/home/hyprland/waybar/default.nix @@ -1,6 +1,6 @@ -{pkgs, ...}: { +{ pkgs, ... }: { home.packages = with pkgs; [ - (nerdfonts.override {fonts = ["FiraCode"];}) + (nerdfonts.override { fonts = [ "FiraCode" ]; }) networkmanagerapplet bluez ]; @@ -10,8 +10,8 @@ settings.main = { layer = "top"; position = "top"; - "modules-left" = ["wlr/workspaces"]; - "modules-center" = []; + "modules-left" = [ "wlr/workspaces" ]; + "modules-center" = [ "mpris" ]; "modules-right" = [ "pulseaudio" "bluetooth" @@ -22,6 +22,7 @@ "clock" ]; "wlr/workspaces" = import ./modules/wlr_workspaces.nix; + mpris = import ./modules/mpris.nix; cpu = import ./modules/cpu.nix; memory = import ./modules/memory.nix; temperature = import ./modules/temperature.nix; diff --git a/home/hyprland/waybar/modules/mpris.nix b/home/hyprland/waybar/modules/mpris.nix new file mode 100644 index 00000000..e4e512b7 --- /dev/null +++ b/home/hyprland/waybar/modules/mpris.nix @@ -0,0 +1,18 @@ +{ + "format" = "{player_icon} {dynamic} {status_icon}"; + "format-paused" = "{player_icon} {title} {status_icon}"; + "format-stopped" = "{player_icon} {status_icon}"; + "interval" = 1; + "player-icons" = { + "default" = "󰝚"; + "mpv" = "󰝚"; + "spotify" = "󰓇"; + "ncspot" = "󰓇"; + }; + "status-icons" = { + "playing" = "󰐊"; + "paused" = "󰏤"; + "stopped" = "󰓛"; + }; + "ignored-players" = [ "firefox" ]; +} diff --git a/hosts/Ronin/home.nix b/hosts/Ronin/home.nix index a068d929..97983666 100644 --- a/hosts/Ronin/home.nix +++ b/hosts/Ronin/home.nix @@ -66,7 +66,7 @@ in { monitor=desc:Dell Inc. DELL U2417H 5K9YD872FY1L,${monitors.Dell} monitor=desc:Acer Technologies ED270R TJMEE0043W01,${monitors.Acer} - bindl=,switch:Lid Switch,exec,pkill -9 kanshi + bindl=,switch:Lid Switch,exec,pkill -HUP kanshi bindl=,switch:Lid Switch,exec,pkill -9 hyprpaper && hyprctl dispatch exec hyprpaper ''; } diff --git a/hosts/hyprland.nix b/hosts/hyprland.nix index 04b171f7..24846314 100644 --- a/hosts/hyprland.nix +++ b/hosts/hyprland.nix @@ -3,9 +3,6 @@ environment.systemPackages = with pkgs; [ xdg-utils gsettings-desktop-schemas - pavucontrol - grim - slurp ]; security.pam.services.swaylock = { }; services = {