Update wob config

This commit is contained in:
Kiana Sheibani 2023-01-07 20:52:23 -05:00
parent 84c8f5097d
commit 5c30019fc3
9 changed files with 37 additions and 19 deletions

View file

@ -1,5 +1,5 @@
{ config, lib, ... }: { config, lib, ... }:
lib.mkIf (config.custom.platform == "laptop") { lib.mkIf (config.platform == "laptop") {
services.upower = { services.upower = {
enable = true; enable = true;

View file

@ -1,5 +1,5 @@
{ config, lib, pkgs, tokyo-night-sddm-src, ... }: { config, lib, pkgs, tokyo-night-sddm-src, ... }:
lib.mkIf (config.custom.platform != "mobile") lib.mkIf (config.platform != "mobile")
(let (let
tokyo-night-sddm = with pkgs.libsForQt5; pkgs.stdenv.mkDerivation { tokyo-night-sddm = with pkgs.libsForQt5; pkgs.stdenv.mkDerivation {
name = "tokyo-night-sddm"; name = "tokyo-night-sddm";

View file

@ -22,10 +22,6 @@ in {
(aspellWithDicts (ps: with ps; [ en en-computers en-science ])) (aspellWithDicts (ps: with ps; [ en en-computers en-science ]))
gcc gcc
wob
grim
slurp
imv
direnv direnv
nix-direnv-with-flakes nix-direnv-with-flakes

View file

@ -32,14 +32,14 @@ outputs = { self,
./platform.nix ./platform.nix
./hardware-configuration/desktop.nix ./hardware-configuration/desktop.nix
{ _module.args = moduleArgs; { _module.args = moduleArgs;
custom.platform = "desktop"; } platform = "desktop"; }
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
{ {
home-manager.users.${username} = import ./home-manager; home-manager.users.${username} = import ./home-manager;
home-manager.useGlobalPkgs = true; home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true; home-manager.useUserPackages = true;
home-manager.sharedModules = [ ./platform.nix { custom.platform = "desktop"; } ]; home-manager.sharedModules = [ ./platform.nix { platform = "desktop"; } ];
home-manager.extraSpecialArgs = moduleArgs; home-manager.extraSpecialArgs = moduleArgs;
} }
]; ];
@ -51,7 +51,7 @@ outputs = { self,
./config ./config
{ _module.args = moduleArgs; { _module.args = moduleArgs;
custom.platform = "laptop"; } platform = "laptop"; }
./platform.nix ./platform.nix
./hardware-configuration/laptop.nix ./hardware-configuration/laptop.nix
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
@ -61,7 +61,7 @@ outputs = { self,
home-manager.useGlobalPkgs = true; home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true; home-manager.useUserPackages = true;
home-manager.sharedModules = [ ./platform.nix { custom.platform = "laptop"; } ]; home-manager.sharedModules = [ ./platform.nix { platform = "laptop"; } ];
home-manager.extraSpecialArgs = moduleArgs; home-manager.extraSpecialArgs = moduleArgs;
} }
]; ];

View file

@ -11,5 +11,6 @@
./mako.nix ./mako.nix
./rofi.nix ./rofi.nix
./waybar.nix ./waybar.nix
./wob.nix
]; ];
} }

View file

@ -3,7 +3,14 @@ let
modifier = "Mod4"; modifier = "Mod4";
terminal = "alacritty"; terminal = "alacritty";
in { in {
home.packages = with pkgs; [ swayidle wl-clipboard wlroots ]; home.packages = with pkgs; [
swayidle
wl-clipboard
wlroots
grim
slurp
imv
];
wayland.windowManager.sway = { wayland.windowManager.sway = {
enable = true; enable = true;
@ -53,9 +60,10 @@ in {
startup = map (x: { command = x; }) [ startup = map (x: { command = x; }) [
# Make wob channels # Make wob channels
''mkfifo $SWAYSOCK.volume.wob && tail -f $SWAYSOCK.volume.wob | wob'' ''mkfifo $XDG_RUNTIME_DIR/wob_volume.sock && tail -f $XDG_RUNTIME_DIR/wob_volume.sock \
''mkfifo $SWAYSOCK.brightness.wob && tail -f $SWAYSOCK.brightness.wob | wob \ | wob -c ~/.config/wob/volume.ini''
--border-color "#FFFF00FF" --bar-color "#FFFF00FF"'' ''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' \ ''swayidle timeout 120 'swaylock -f --grace=180' \
timeout 600 'systemctl suspend' \ timeout 600 'systemctl suspend' \
before-sleep 'swaylock -f' '' before-sleep 'swaylock -f' ''
@ -65,10 +73,10 @@ in {
keybindings = let keybindings = let
# Volume using pamixer and wob # 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}"; audio = cmd: "exec pamixer ${cmd} && ${audio-disp}";
# Brightness using brightnessctl and wob # 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}"; brightness = x: "exec brightnessctl -e set ${x} && ${brightness-disp}";
# Play controls using playerctl # Play controls using playerctl
playerctl = cmd: "exec playerctl ${cmd}"; playerctl = cmd: "exec playerctl ${cmd}";

View file

@ -14,7 +14,7 @@
modules-center = [ "sway/window" ]; modules-center = [ "sway/window" ];
modules-right = modules-right =
if config.custom.platform == "laptop" then if config.platform == "laptop" then
[ "battery" "pulseaudio" "backlight" "network" "clock" "idle_inhibitor" ] [ "battery" "pulseaudio" "backlight" "network" "clock" "idle_inhibitor" ]
else else
[ "pulseaudio" "network" "clock" "idle_inhibitor" ]; [ "pulseaudio" "network" "clock" "idle_inhibitor" ];
@ -243,7 +243,7 @@
#pulseaudio { #pulseaudio {
background-color: @altblend; background-color: @altblend;
${ ${
if config.custom.platform == "laptop" then if config.platform == "laptop" then
'' ''
margin: 3px 0px 3px 2px; margin: 3px 0px 3px 2px;
padding-right: 5px; padding-right: 5px;

View file

@ -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
'';
}
}

View file

@ -1,6 +1,6 @@
{ lib, ... }: { lib, ... }:
{ {
options.custom.platform = lib.mkOption { options.platform = lib.mkOption {
description = "The platform to configure for"; description = "The platform to configure for";
type = lib.types.enum [ "desktop" "laptop" "mobile" ]; type = lib.types.enum [ "desktop" "laptop" "mobile" ];
}; };