bash-statemgr

2022-07-15 12:40 UTC
  • Xyne

Metadata

Description: A Bash module for creating generic state/profile managers.
Latest Version: 2018
Source Code: src/
Architecture:
  • any
Dependencies:
  • bash
Optional Dependencies:
  • zenity: new state creation in Openbox pipe menus generated by obstatemgr
Arch Repositories:
  • [xyne-any]
  • [xyne-i686]
  • [xyne-x86_64]
AUR Page: bash-statemgr
Arch Forum Thread: 166530
Tags:

About

This is a general state manager for writing custom scripts. It provides a common interface for saving and loading states along with commands for managing saved states. See the examples below for details.

Openbox Pipe Menu Generator

The package also provides an Openbox pipe menu generator named obstatemgr that can be used with these custom scripts. It cannot be used to create new files as Openbox menus provide no input field, but it can be used to load, overwrite and delete existing states.

Here is an example menu entry for menu.xml. obstatemgr accepts one argument, the name or path of the statemgr-based script to invoke.

<separator label="ObStateMgr"/>
<menu execute="obstatemgr xrandr-mgr" id="obsmxrandr" label="xrandr-mgr"/>

Examples

See the list of statemgr-tagged projects.

Screenshots

screenshot 

README

Usage

This is a general state manager for Bash scripts. To use it, you must define the following in a separate script and then source the statemgr file:

name_
A string variable with the name of your manager.
function save_state_()
A function that saves the current state/profile to a file. The function will receive the output path as its first and only argument.
function load_state_()
A function that loads a given state/profile from a file. The function will receive the same path used to create the file as its first and only argument.

Example

The following will manage desktop background images set with feh.

#!/bin/bash

name_=feh

function save_state_()
{
  cp ~/.fehbg "$1"
}

function load_state_()
{
  sh "$1"
}

See alsaequal-mgr and xrandr-mgr for other examples.

Contact
echo xyne.archlinux.org | sed 's/\./@/'
Validation
XHTML 1.0 Strict CSS level 3 Atom 1.0