nixcfg/homeManagerModules/desktop/hyprland/scripts.nix
Aly Raffauf 3663469066
sway,hyprland: convert startup apps to systemd (#73)
* home: switch hyprland and sway to new swayidle systemd service

* home: add swayosd service

* home: move swayidle and swayosd to services

* home/services: add swayidle and swayosd services

* hyprland,sway: don't start swayosd

* user playerctld as systemd service

* home: run gammastep as service for redShift"

* cleanup

* home: set swayosd and swayidle as wanted by hyprland and sway

* nix fmt

* home/services/swayidle: fixed resume command

* home/swayidle: fix command syntax

* home: better systemd defaults for swayidle and swayosd

* home: convert mako to systemd service

* home: make wayland-ipewire-idle-inhibit a systemd service

* home/waybar: use as systemd service

* home: move waybar to services

* home/desktop: convert randomWallpaper to systemd service

* migrate home options
2024-08-02 17:58:08 -04:00

42 lines
1.3 KiB
Nix

{
config,
lib,
pkgs,
...
}: let
cfg = config.ar.home;
hyprctl = lib.getExe' config.wayland.windowManager.hyprland.package "hyprctl";
pkill = lib.getExe' pkgs.procps "pkill";
virtKeyboard = lib.getExe' pkgs.squeekboard "squeekboard";
in {
clamshell = pkgs.writeShellScript "hyprland-clamshell" ''
NUM_MONITORS=$(${hyprctl} monitors all | grep Monitor | wc --lines)
if [ "$1" == "on" ]; then
if [ $NUM_MONITORS -gt 1 ]; then
${hyprctl} keyword monitor "eDP-1, disable"
fi
elif [ "$1" == "off" ]; then
${
lib.strings.concatMapStringsSep "${hyprctl}\n"
(monitor: ''${hyprctl} keyword monitor "${monitor}"'')
cfg.desktop.hyprland.laptopMonitors
}
sleep 1
${pkill} -SIGUSR2 waybar
fi
'';
tablet = pkgs.writeShellScript "hyprland-tablet" ''
STATE=`${lib.getExe pkgs.dconf} read /org/gnome/desktop/a11y/applications/screen-keyboard-enabled`
if [ $STATE -z ] || [ $STATE == "false" ]; then
if ! [ `pgrep -f ${virtKeyboard}` ]; then
${virtKeyboard} &
fi
${lib.getExe pkgs.dconf} write /org/gnome/desktop/a11y/applications/screen-keyboard-enabled true
elif [ $STATE == "true" ]; then
${lib.getExe pkgs.dconf} write /org/gnome/desktop/a11y/applications/screen-keyboard-enabled false
fi
'';
}