mirror of
https://github.com/lightly-toasted/nix-config.git
synced 2025-10-04 19:45:40 +00:00
feat: add mouse actions
Refs: 302185f6a873209ea51a26b314faa24c45cd03ac
This commit is contained in:
parent
b88d00fe40
commit
45a49b1529
12 changed files with 186 additions and 6 deletions
27
home/toast/programs/mouse-actions/actions/sober-lag.nix
Normal file
27
home/toast/programs/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