uenv
uenv - as in useful environments - is a collection of scripts,
systemd service and timer units and configuration, that
go along with it.
It is meant to help organizing your workflow and hiding away user and system
services in neat little separate environments.
Arguably a couple of the units might only be useful, when using
window managers like awesome, that stem from a minimalistic approach.
Some of the functionalities implemented here can be found in desktop
environments like KDE or Gnome.
uenv and all of its components are licensed under the GPLv3.
Separate tmux environments
tmux is a very useful tool to multiplex your terminals. It offers tiling
and a high configurability.
Here it is used for a couple of services to start an environment in which
other cli programs can run.
In those services the following Environment is set:
Environment=TMUX_TMPDIR=%t
This will store the tmux server socket in the users' XDG_RUNTIME_DIR.
Therefore it will be necessary to set your TMUX_TMPDIR environment variable
for your bash or zsh (or whatever you run) to the following:
export TMUX_TMPDIR="$XDG_RUNTIME_DIR/"
Afterwards a simple
tmux -L <name-of-socket> attach
will attach you to that separate environment.
loginctl enable-linger
Services
compton --user
The compton user service needs a properly exported $DISPLAY variable to
work. You can set this in your /etc/systemd/user.conf:
DefaultEnvironment=DISPLAY=:0
The compton user service is anti-dependent on the realtime kernel (i.e. it will
not start, if /sys/kernel/realtime is present and not empty).
You can start and enable it like any other systemd user service:
systemctl --user start compton systemctl --user enable compton
conky@ --user
The conky user service needs a properly exported $DISPLAY variable to work.
You can set this in your /etc/systemd/user.conf:
DefaultEnvironment=DISPLAY=:0
The conky user service starts conky scripts by name. This means, the word
after the @ directly relates to configuration files in your conky
configuration directory (~/.config/conky/).
You can start and enable it like any other systemd user service, by supplying
it with a configuration file name:
systemctl --user start conky@my-configuration-name systemctl --user enable conky@my-configuration-name
cpupower-rt
The cpupower package on Arch Linux has been changed, to
allow easier appliance of CPU settings based on other profiles, than the
system's default.
This is very useful, when using a real-time kernel: cpupower-rt settings will
be applied after the general cpupower settings have been applied.
The cpupower-rt.service is dependant on a realtime kernel. It will only
start, if /sys/kernel/realtime is present and not empty.
You can start and enable it like any other systemd service:
systemctl start cpupower-rt systemctl enable cpupower-rt
irssi --user
The systemd user service irssi.service starts the IRC client Irssi in a
separate tmux environment for the current user.
To connect to it after starting the service, just do
tmux -L irssi attach
monitoring --user
The systemd user service monitoring.service is just a useful tool for
monitoring.
Currently it starts htop, glances and asks loginctl for the current user
processes in a separate tmux environment.
To connect to it after starting the service, just do
tmux -L mon attach
mpd@ --user
The specialized systemd user service mpd@.service starts MPD with a
separate configuration located in ~/.config/mpd/mpd-<name-of-server>.conf. It
will also use pax11publish to connect pulseaudio to that server, if the
configuration is not called localhost* or like your hostname*!
Start and enable it like any other systemd user service:
systemctl --user start mpd@myserver systemctl --user enable mpd@myserver
postpone-screensaver --user
With the systemd user service and timer postpone-screensaver.{service,timer}
one can - as the name implies - postpone one's screensaver from blanking the
screen. The script checks for programs set in ~/.config/postpone-screensaver
and can be started and activated like any other timer/service:
systemctl --user start postpone-screensaver.timer systemctl --user enable postpone-screensaver.timer
rtorrent --user
rtorrent doesn't really come with any systemd service. Here it is started
within a separate tmux environment. It will automatically create
~/Downloads/rtorrent/{tmp,session}, if non-existent and set its working
directory to ~/Downloads.
The systemd user service is started/ enabled like this:
systemctl --user start rtorrent systemctl --user enable rtorrent
rtorrent@
The systemd system service rtorrent@.service is quite similar to the user
service rtorrent.service in functionality, but on top offers the possibility of
dependency to a system service - like OpenVPN (the default being a profile
called secure).
Note: In a separate configuration file ("/etc/conf.d/rtorrent@.conf"),
the TMUX_TMPDIR should be set, as it otherwise defaults to using /tmp/!
The system service can be started and enabled like this:
systemctl start rtorrent@<your-user-name> systemctl enable rtorrent@<your-user-name>
To connect to the user and system service after starting the service, just do
tmux -L rt attach
ssh-agent --user
The systemd user service ssh-agent.service starts a ssh-agent for the
current user, which makes it independent from the current login session.
In its Environment SSH_AUTH_SOCK will be set to the user's
XDG_RUNTIME_DIR.
Therefore make sure to set your SSH_AUTH_SOCK environment variable for
your bash or zsh (or whatever you run) to the following:
export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket"
Otherwise you can start and stop the service like any other:
systemctl --user start ssh-agent systemctl --user enable ssh-agent
syndaemon --user
The xf86-input-synaptics package comes with /usr/bin/syndaemon. This tool
is used to disable the touchpad while typing. While desktop environments like
KDE and Gnome use it integrated, it can also be started as a systemd user
service:
systemctl --user start syndaemon systemctl --user enable syndaemon
systemd-analyze-plot
Systemd comes with a functionality to plot the system's boot up process in
svg and other file formats. This user service uses /usr/bin/systemd-analyze
to plot a svg to a predefined directory. Configuration takes place in
~/.config/systemd/plot.conf.
To start/enable the service afterwards just do:
systemctl --user start systemd-analyze-plot systemctl --user enable systemd-analyze-plot
tmux --user
The systemd user service tmux.service starts a separate tmux environment.
To start/enable it, just do:
systemctl --user start tmux systemctl --user enable tmux
To connect to the user service after starting it, just do
tmux attach
update-motd
The system service update-motd.service updates your MOTD (message of the day)
with your hostname, your currently running kernel version, available
package updates and needed security updates.
To be able to check pacman and security updates, the accompanying
update-motd.timer will start the service hourly.
If a /etc/motd.name is available, then that file will be used instead of
/etc/hostname to generate a banner.
For the security updates arch-audit is needed and if you want to have
colorful output of it all, install python-lolcat.
To start/enable the timer just do:
systemctl --system start update-motd systemctl --system enable update-motd
Thanks to XenGi for the inspiration!
weechat --user
The systemd user service weechat.service starts the IRC client weechat in
a separate tmux environment for the current user.
To start/enable it, just do:
systemctl --user start weechat systemctl --user enable weechat
To connect to it after starting the service, just do
tmux -L weechat attach