add output switching script

This commit is contained in:
Leonardo Eugênio 2022-07-20 22:14:36 -03:00
parent 64e13f5bc9
commit 5cedd306ec

View file

@ -1,5 +1,4 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }: let
let
key = { key = {
left = "n"; left = "n";
down = "e"; down = "e";
@ -51,12 +50,25 @@
}; };
}; };
}; };
# TODO: fix
papirus_red = (pkgs.unstable.papirus-icon-theme.override { color = "red"; }); papirus_red = (pkgs.unstable.papirus-icon-theme.override { color = "red"; });
orchis_theme_compact = (pkgs.orchis-theme.override { tweaks = [ "compact" "solid" ]; }); orchis_theme_compact = (pkgs.orchis-theme.override { tweaks = [ "compact" "solid" ]; });
accent = accents.red; accent = accents.red;
color = themes.dark.color; color = themes.dark.color;
in { pulse_sink = pkgs.writeShellScriptBin "pulse_sink" ''
#!/bin/sh
output=$(printf "HDMI\nHeadphones" | bemenu -b)
vol=$(${pkgs.pamixer}/bin/pamixer --get-volume)
case "$output" in
HDMI)
pactl set-default-sink alsa_output.pci-0000_07_00.1.hdmi-stereo-extra1
;;
Headphones)
pactl set-default-sink alsa_output.pci-0000_09_00.4.analog-stereo
;;
esac
${pkgs.pamixer}/bin/pamixer --set-volume "$vol"
'';
in {
# Home Manager needs a bit of information about you and the # Home Manager needs a bit of information about you and the
# paths it should manage. # paths it should manage.
home.username = "lelgenio"; home.username = "lelgenio";
@ -72,43 +84,40 @@
home.stateVersion = "22.05"; home.stateVersion = "22.05";
# Let Home Manager install and manage itself. # Let Home Manager install and manage itself.
programs.home-manager.enable = true; programs.home-manager.enable = true;
# nixpkgs.config.packageOverrides = pkgs: {
# nur = import (builtins.fetchTarball "https://github.com/nix-community/NUR/archive/master.tar.gz") {
# inherit pkgs;
# };
# };
home.packages = with pkgs; [ home.packages = with pkgs; [
pkgs.unstable.helix
kanshi
alacritty alacritty
exa exa
fd fd
# text manipulation
pkgs.unstable.helix
sd sd
ripgrep ripgrep
# desktop
kanshi
xfce.thunar
# media
yt-dlp yt-dlp
ffmpeg ffmpeg
imagemagick imagemagick
mpv mpv
xfce.thunar
# chat # chat
tdesktop tdesktop
discord discord
# Theming # Theming
orchis_theme_compact
papirus_red
## fonts
liberation_ttf liberation_ttf
hack-font hack-font
font-awesome_5 font-awesome_5
fira-code fira-code
(nerdfonts.override { fonts = [ "FiraCode" "Hack" ]; }) (nerdfonts.override { fonts = [ "FiraCode" "Hack" ]; })
orchis_theme_compact
papirus_red
# Programming # Programming
vscode vscode
cargo cargo
rust-analyzer rust-analyzer
gcc gcc
pulse_sink
]; ];
programs.fish.enable = true; programs.fish.enable = true;
programs.helix = { programs.helix = {
@ -387,6 +396,23 @@
repeat_rate = "30"; repeat_rate = "30";
repeat_delay = "200"; repeat_delay = "200";
}; };
assigns = {
"10" = [
{app_id=".*[Tt]elegram.*";}
{class=".*[Tt]elegram.*";}
{class="Jitsi Meet";}
{class="discord";}
{title="Discord";}
];
};
modes = let
return_mode = lib.mapAttrs (k: v: "${v}; mode default");
in {
audio = return_mode {
"escape" = "";
"s" = "exec ${pulse_sink}/bin/pulse_sink";
};
};
keybindings = keybindings =
let let
mod = "Mod4"; mod = "Mod4";
@ -501,6 +527,7 @@
"${mod}+Ctrl+Return" = "exec thunar"; "${mod}+Ctrl+Return" = "exec thunar";
"${mod}+x" = "kill"; "${mod}+x" = "kill";
"${mod}+s" = "exec ${menu}"; "${mod}+s" = "exec ${menu}";
"${mod}+m" = "mode audio";
"${mod}+b" = "splith"; "${mod}+b" = "splith";
"${mod}+v" = "splitv"; "${mod}+v" = "splitv";
"${mod}+f" = "fullscreen toggle"; "${mod}+f" = "fullscreen toggle";
@ -582,9 +609,7 @@
style.package = pkgs.libsForQt5.qtstyleplugins; style.package = pkgs.libsForQt5.qtstyleplugins;
style.name = "gtk2"; style.name = "gtk2";
}; };
programs.mangohud.enable = true; programs.mangohud.enable = true;
systemd.user.services = { systemd.user.services = {
firefox = { firefox = {
Unit = { Unit = {