mirror of
https://github.com/lightly-toasted/nix-config.git
synced 2025-10-04 15:45:39 +00:00
feat: refactor home-manager configuration for multi-host support
This commit is contained in:
parent
f20c875a48
commit
6d1fd47bea
47 changed files with 51 additions and 14 deletions
40
home/modules/graphical/mouse-actions/actions/autoclick.nix
Normal file
40
home/modules/graphical/mouse-actions/actions/autoclick.nix
Normal file
|
@ -0,0 +1,40 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
let
|
||||
script = pkgs.writeShellScriptBin "autoclick-action" ''
|
||||
if ! command -v ydotool >/dev/null 2>&1; then
|
||||
notify-send -r 120000 "Autoclicker" "This tool requires ydotool to be installed on your system."
|
||||
fi
|
||||
|
||||
AUTOCLICK_FILE="/run/user/$(id -u)/autoclick"
|
||||
|
||||
if [ ! -f "$AUTOCLICK_FILE" ]; then
|
||||
echo "1" > "$AUTOCLICK_FILE"
|
||||
fi
|
||||
|
||||
current=$(cat "$AUTOCLICK_FILE")
|
||||
if [ "$current" = "0" ]; then
|
||||
echo "1" > "$AUTOCLICK_FILE"
|
||||
notify-send -r 120000 "Autoclicker" "Stopped"
|
||||
exit 0
|
||||
else
|
||||
echo "0" > "$AUTOCLICK_FILE"
|
||||
notify-send -r 120000 "Autoclicker" "Started"
|
||||
fi
|
||||
|
||||
while :; do
|
||||
line=$(cat "$AUTOCLICK_FILE")
|
||||
if [ "$line" = "0" ]; then
|
||||
ydotool click --next-delay 25 0xC0 > /dev/null 2>&1
|
||||
else
|
||||
break
|
||||
fi
|
||||
done
|
||||
'';
|
||||
in
|
||||
{
|
||||
package = pkgs.symlinkJoin {
|
||||
name = "autoclick-action";
|
||||
paths = [ script pkgs.libnotify ];
|
||||
};
|
||||
}
|
13
home/modules/graphical/mouse-actions/actions/deafen.nix
Normal file
13
home/modules/graphical/mouse-actions/actions/deafen.nix
Normal file
|
@ -0,0 +1,13 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
let
|
||||
script = pkgs.writeShellScriptBin "deafen-action" ''
|
||||
hyprctl dispatch sendshortcut CTRL+SHIFT, D, 'class:^(vesktop)$'
|
||||
'';
|
||||
in
|
||||
{
|
||||
package = pkgs.symlinkJoin {
|
||||
name = "deafen-action";
|
||||
paths = [ script pkgs.hyprland ];
|
||||
};
|
||||
}
|
7
home/modules/graphical/mouse-actions/actions/default.nix
Normal file
7
home/modules/graphical/mouse-actions/actions/default.nix
Normal file
|
@ -0,0 +1,7 @@
|
|||
{ pkgs }:
|
||||
|
||||
{
|
||||
autoclick = import ./autoclick.nix { inherit pkgs; };
|
||||
deafen = import ./deafen.nix { inherit pkgs; };
|
||||
sober-lag = import ./sober-lag.nix { inherit pkgs; };
|
||||
}
|
27
home/modules/graphical/mouse-actions/actions/sober-lag.nix
Normal file
27
home/modules/graphical/mouse-actions/actions/sober-lag.nix
Normal file
|
@ -0,0 +1,27 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
let
|
||||
script = pkgs.writeShellScriptBin "sober-lag-action" ''
|
||||
roblox_pid=$(ps aux | grep "[s]ober --" | sort -k3 -nr | head -n 1 | awk '{print $2}')
|
||||
if [ -z "$roblox_pid" ]; then
|
||||
notify-send "sober-lag.sh" "Sober is not running."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
pgid=$(ps -o pgid= -p "$roblox_pid" | xargs)
|
||||
if [ -z "$pgid" ]; then
|
||||
notify-send "sober-lag.sh" "Could not find PGID for PID $roblox_pid."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
kill -STOP -- "-$pgid"
|
||||
sleep 0.2
|
||||
kill -CONT -- "-$pgid"
|
||||
'';
|
||||
in
|
||||
{
|
||||
package = pkgs.symlinkJoin {
|
||||
name = "sober-lag-action";
|
||||
paths = [ script pkgs.procps pkgs.gawk pkgs.gnugrep pkgs.gnused pkgs.coreutils pkgs.libnotify ];
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue