mirror of
https://github.com/bvanroll/_dotfiles.git
synced 2025-08-30 04:22:47 +00:00
initial commit
This commit is contained in:
28
.config/i3blocks/systemctl/Readme.md
Normal file
28
.config/i3blocks/systemctl/Readme.md
Normal file
@@ -0,0 +1,28 @@
|
||||
# systemctl
|
||||
|
||||
Show systemctl service status, allows to toggle status with left click.
|
||||
Accepts the same service names as systemctl eg. "redis" or "docker".
|
||||
|
||||

|
||||
|
||||
# Config
|
||||
|
||||
```
|
||||
[systemctl]
|
||||
command=$SCRIPT_DIR/systemctl
|
||||
interval=once
|
||||
markup=pango
|
||||
instance=docker
|
||||
|
||||
[systemctl]
|
||||
command=$SCRIPT_DIR/systemctl
|
||||
interval=once
|
||||
markup=pango
|
||||
instance=redis
|
||||
|
||||
[systemctl]
|
||||
command=$SCRIPT_DIR/systemctl
|
||||
interval=once
|
||||
markup=pango
|
||||
instance=postgresql
|
||||
```
|
17
.config/i3blocks/systemctl/i3blocks.conf
Normal file
17
.config/i3blocks/systemctl/i3blocks.conf
Normal file
@@ -0,0 +1,17 @@
|
||||
[systemctl]
|
||||
command=$SCRIPT_DIR/systemctl
|
||||
interval=once
|
||||
markup=pango
|
||||
instance=docker
|
||||
|
||||
[systemctl]
|
||||
command=$SCRIPT_DIR/systemctl
|
||||
interval=once
|
||||
markup=pango
|
||||
instance=redis
|
||||
|
||||
[systemctl]
|
||||
command=$SCRIPT_DIR/systemctl
|
||||
interval=once
|
||||
markup=pango
|
||||
instance=postgresql
|
31
.config/i3blocks/systemctl/systemctl
Executable file
31
.config/i3blocks/systemctl/systemctl
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
|
||||
# The service we want to check or toggle (according to systemctl)
|
||||
SERVICE=$BLOCK_INSTANCE
|
||||
# Colors to display
|
||||
INACTIVE_COLOR=#888888
|
||||
ACTIVE_COLOR=#22BB22
|
||||
# Exact string to display
|
||||
ACTIVE="<span foreground=\"$ACTIVE_COLOR\">$SERVICE</span>"
|
||||
INACTIVE="<span foreground=\"$INACTIVE_COLOR\"><s>$SERVICE</s></span>"
|
||||
|
||||
if [ "$( systemctl is-active "$SERVICE" )" != "active" ]
|
||||
then
|
||||
if [ "$BLOCK_BUTTON" == '1' ]
|
||||
then
|
||||
if systemctl start "$SERVICE"
|
||||
then
|
||||
echo "$ACTIVE"
|
||||
fi
|
||||
fi
|
||||
echo "$INACTIVE"
|
||||
else
|
||||
if [ "$BLOCK_BUTTON" == '1' ]
|
||||
then
|
||||
if systemctl stop "$SERVICE"
|
||||
then
|
||||
echo "$INACTIVE"
|
||||
fi
|
||||
fi
|
||||
echo "$ACTIVE"
|
||||
fi
|
BIN
.config/i3blocks/systemctl/systemctl.png
Normal file
BIN
.config/i3blocks/systemctl/systemctl.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.3 KiB |
Reference in New Issue
Block a user