summaryrefslogtreecommitdiffstats
path: root/.local/bin/dmkill
diff options
context:
space:
mode:
authorJoe <rbo@gmx.us>2024-12-27 12:00:06 +0100
committerJoe <rbo@gmx.us>2024-12-27 12:00:06 +0100
commita5be58007cb5639d9060ae4dbb54327d1e8dc0d5 (patch)
tree60116c8c8170d24850784299a4baa339f9b8af00 /.local/bin/dmkill
parentup (diff)
downloaddotfiles-bsd-a5be58007cb5639d9060ae4dbb54327d1e8dc0d5.tar.gz
dotfiles-bsd-a5be58007cb5639d9060ae4dbb54327d1e8dc0d5.tar.bz2
dotfiles-bsd-a5be58007cb5639d9060ae4dbb54327d1e8dc0d5.tar.xz
dotfiles-bsd-a5be58007cb5639d9060ae4dbb54327d1e8dc0d5.tar.zst
dotfiles-bsd-a5be58007cb5639d9060ae4dbb54327d1e8dc0d5.zip
good
Diffstat (limited to '.local/bin/dmkill')
-rwxr-xr-x.local/bin/dmkill17
1 files changed, 11 insertions, 6 deletions
diff --git a/.local/bin/dmkill b/.local/bin/dmkill
index 0ff1257..a156af8 100755
--- a/.local/bin/dmkill
+++ b/.local/bin/dmkill
@@ -11,14 +11,14 @@ use constant CONFIRM => [
sub confirm
{
- my ($pid, $proc) = @_;
+ my ($pid, $proc, $color) = @_;
my $list;
my $choice;
for (@{+CONFIRM}) {
$list .= $_ . "\n";
}
- $choice = `printf "%s" "$list" | dmenu -i -p "kill $proc ($pid)?"`;
+ $choice = `printf "%s" "$list" | dmenu -i -p "kill $proc ($pid)?" -sb '$color' -shb '$color'`;
chomp $choice;
if ($choice eq ${+CONFIRM}[1]) {
return (1);
@@ -28,7 +28,7 @@ sub confirm
sub action
{
- my ($var, $user) = @_;
+ my ($var, $user, $color) = @_;
my $pid;
my $proc;
@@ -42,7 +42,7 @@ sub action
if ($var =~ /^\s*\S+\s+\S+\s+(\S+)/) {
$proc = $1;
}
- if (confirm($pid, $proc) == 1) {
+ if (confirm($pid, $proc, $color) == 1) {
exec(KILL_PATH, '-9', $pid);
}
return;
@@ -53,10 +53,15 @@ sub main
my $choice;
my $ps;
my $user;
+ my $color;
+ $color = '#cc241d';
+ if (@ARGV == 1) {
+ $color = $ARGV[0];
+ }
$user = getpwuid($<);
- $choice = `ps -U "$user" -o pid,user,comm,time,%cpu,%mem | dmenu -i -l 100`;
- action($choice, $user);
+ $choice = `ps -U "$user" -o pid,user,comm,time,%cpu,%mem | dmenu -i -l 100 -sb '$color' -shb '$color'`;
+ action($choice, $user, $color);
return (0);
}