fix(hypr): usage on helix-texta

This commit is contained in:
Malte Tammena 2023-07-03 11:20:50 +02:00
parent bac6287a99
commit 8407b3051b
2 changed files with 79 additions and 27 deletions

View file

@ -52,6 +52,15 @@ in {
services.flatpak.enable = true;
programs.hyprland = {
enable = true;
xwayland = {
enable = true;
hidpi = config.settings.hiDPI.enable;
};
nvidiaPatches = config.settings.nvidiaUsed;
};
sops.secrets = let
sopsFile = ../secrets/users/malte/secrets.yaml;
owner = "malte";

View file

@ -15,6 +15,67 @@
wallpaper = eDP-1,~/Downloads/wallpaper.jpg
'';
wobFifo = "~/.local/share/wob/fifo";
runWob = pkgs.writeShellApplication {
name = "run-wob";
runtimeInputs = [
pkgs.coreutils
pkgs.wob
];
text = ''
mkdir -p "$(dirname ${wobFifo})"
mkfifo ${wobFifo} || echo "Fifo already exists"
tail -f ${wobFifo} | wob
'';
};
wobConfig = ''
anchor = bottom center
height = 30
margin = 100
border_size = 2
border_offset = 0
bar_padding = 2
timeout = 1000
background_color = fbf1c7
overflow_background_color = fbf1c7
border_color = 282828
overflow_border_color = 282828
bar_color = d65d0e
overflow_bar_color = fb4934
'';
ponymixToggle = pkgs.writeShellApplication {
name = "ponymix-toggle";
runtimeInputs = [pkgs.coreutils pkgs.ponymix];
text = ''
if ponymix is-muted
then echo 0 > ${wobFifo}
else ponymix get-volume > ${wobFifo}
fi
ponymix toggle
if ponymix is-muted
then echo 0 > ${wobFifo}
else ponymix get-volume > ${wobFifo}
fi
'';
};
ponymixToggleInput = pkgs.writeShellApplication {
name = "ponymix-toggle-input";
runtimeInputs = [pkgs.coreutils pkgs.ponymix];
text = ''
if ponymix --input is-muted
then echo 0 > ${wobFifo}
else ponymix --input get-volume > ${wobFifo}
fi
ponymix --input toggle
if ponymix --input is-muted
then echo 0 > ${wobFifo}
else ponymix --input get-volume > ${wobFifo}
fi
'';
};
hyprlandConfig = ''
# See https://wiki.hyprland.org/Configuring/Monitors/
${
@ -32,9 +93,11 @@
$blue = 458588
$green = 98971a
exec=hyprctl set-cursor Adwaita 24
exec-once=dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
exec-once=${pkgs.waybar-hypr}/bin/waybar
exec-once=hyprpaper
exec-once=${runWob}/bin/run-wob
# For all categories, see https://wiki.hyprland.org/Configuring/Variables/
input {
@ -213,10 +276,10 @@
bind = $mainMod, N, exec, ${doNotDisturb}/bin/do-not-disturb toggle
# Sound control
# bind = XF86AudioRaiseVolume, exec, ${pkgs.ponymix}/bin/ponymix increase 5%
# bind = XF86AudioLowerVolume, exec, ${pkgs.ponymix}/bin/ponymix decrease 5%
# bind = XF86AudioMute, exec, ${pkgs.ponymix}/bin/ponymix toggle
# bind = XF86AudioMicMute, exec, ${pkgs.ponymix}/bin/ponymix --input toggle
bindel =, XF86AudioRaiseVolume, exec, ${pkgs.ponymix}/bin/ponymix increase 5% > ${wobFifo}
bindel =, XF86AudioLowerVolume, exec, ${pkgs.ponymix}/bin/ponymix decrease 5% > ${wobFifo}
bindl =, XF86AudioMute, exec, ${ponymixToggle}/bin/ponymix-toggle
bindl =, XF86AudioMicMute, exec, ${ponymixToggleInput}/bin/ponymix-toggle-input
'';
in {
imports = [
@ -233,24 +296,6 @@ in {
};
config = lib.mkIf cfg.enable {
home.packages = [
(pkgs.writeScriptBin "Hyprland-nvidia" ''
#!/bin/sh
export _JAVA_AWT_WM_NONREPARENTING=1
export XCURSOR_SIZE=48
export GDK_SCALE=2
export LIBVA_DRIVER_NAME=nvidia
export XDG_SESSION_TYPE=wayland
export GBM_BACKEND=nvidia-drm
export __GLX_VENDOR_LIBRARY_NAME=nvidia
export WLR_NO_HARDWARE_CURSORS=1
exec Hyprland
'')
];
wayland.windowManager.hyprland = {
enable = true;
xwayland.enable = true;
@ -260,16 +305,14 @@ in {
xdg.configFile."fish/conf.d/hyprland.fish".text = ''
set TTY1 (tty)
if test -z \"$DISPLAY\"; and test $TTY1 = '/dev/tty1'
systemd-cat -t Hyprland ${
if nixosConfig.settings.nvidiaUsed
then "Hyprland-nvidia"
else "Hyprland"
}
systemd-cat -t Hyprland Hyprland
end
'';
# Configure hyprpaper
xdg.configFile."hypr/hyprpaper.conf".text = hyprpaperConfig;
# Configure wob
xdg.configFile."wob/wob.ini".text = wobConfig;
# Main config
xdg.configFile."hypr/hyprland.conf".text = hyprlandConfig;
};