Skip to content

Scripts

simonvic edited this page Jun 2, 2025 · 20 revisions

Scripts

Most scripts have some configurable variables, which you can find at the beginning of each one of them.

Each script will source a .sh file with its name, from the XDG_CONFIG_HOME/dotfiles directory (e.g. sBatteryctl will source ~/.config/dotfiles/sBatteryctl.sh), in which you can override the variables.

sBatteryctl

sBatteryctl offers some features related to your system battery. It has configurable notification about battery status (charging, discharging, low levels, etc.) and can act as a 'wakelock' to prevent screensavers to trigger.

- Usage
	sBatteryctl <options>

- Options
	help                        # Show this help
	monitor                     # Monitor the state of the battery
	                              Meant to be used in a crontab or timer
	plugin                      # Show notification about plugging AC
	unplug                      # Show notification about unplugging AC
	current                     # Show current information on the battery
	wakelock toggle [on|off]    # Toggle on/off the wakelock
	wakelock status             # Print current wakelock status
	power <auto|ac|bat>         # Set power mode to auto, AC or battery

- Abbreviations
	m = monitor
	p = plugin
	u = unplug
	c = current
	w = wakelock
	t = toggle
	s = status

The sBatteryctl monitor command can be used in a udev rule; in case your battery doesn't report discharging event, you can use the provided timer and service.

systemctl --user enable --now sBatteryctl.timer

sBluetoothctl

sBluetoothctl wraps the bluetoothctl utility and provides a more user-friendly CLI and GUI interface.

- Usage
	sBluetoothctl <options>

- Options
	help                    # Show this help
	power <toggle|on|off>   # Switch on or off the bluetooth, or
	                            toggle between the states
	connect <UUID|name>     # Power on bluetooth if necessary and
	                            connect to <device UUID> (xx:xx:xx:xx:xx:xx)
	                            or <name> (i.e. 'Galaxy buds')
	disconnect <UUID|name>  # Disconnect from <device UUID> (xx:xx:xx:xx:xx:xx)
	                            or <name> (i.e. 'Galaxy buds')
	menu                    # Show connect menu
	polybar update          # Update polybar modules

- Abbreviations
	p = power
	c = connect
	d = disconnect
	m = menu

sBrightnessctl

sBrightnessctl handles the screen brightness and the blue filter level, which (by default) can persists across reboot.

- Usage
	sBrightnessctl <options> [...]

- Options
	help                         # Show this help
	increase [amount]            # Increase the brightness by [amount] if specified or the default value otherwise
	decrease [amount]            # Decrease the brightness by [amount] if specified or the default value otherwise
	set <value>                  # Set the brightness to <value>
	screensaver                  # Lower the brightness to the minimum
	redshift toggle              # Toggle on/off redshift
	redshift increase [amount]   # Increase the redshift temperature by [amount] if specified or the default value otherwise
	redshift decrease [amount]   # Decrease the redshift temperature by [amount] if specified or the default value otherwise
	redshift restore             # Load previously saved redshift state
	redshift print               # Print the current redshift temperature (used in polybar)
	polybar update               # Update polybar modules

- Abbreviations
	i = increase
	d = decrease
	s = set
	r = redshift
	t = toggle
	

sLockscreenctl

- Usage
	sLockscreenctl <options>

- Options
	suspend   # Lock the screen and suspend
	lock      # Lock the screen

- Abbreviations
	s = suspend
	l = lock

sMicrophonectl

- Usage
	sMicrophonectl <options>
	
- Options
	help                     # Show this help
	set <amount>             # Set input volume to given percentage
	increase <amount>        # Increase input volume by amount
	decrease <amount>        # Decrease input volume by amount
	mute [true|false|toggle] # Set mute status for the microphone

- Abbreviations
	i = increase
	d = decrease
	m = mute

sPlayerctl

sPlayerctl wraps the playerctl utility to provide a more user-friendly CLI and GUI interface to control your media player.

By default, all actions are sent to the first available (or sometimes the last used) media player.

The controlled media player can be changed with the select-player menu

- Usage
	sPlayerctl <options>

- Options
	help                                       # Show this help
	play                                       # Start the player
	pause                                      # Pause the player
	play-pause                                 # Toggle between play and pause
	stop [all]                                 # Stop the player
	next                                       # Go to the next song
	previous                                   # Go to the previous song
	info [notification]                        # Show info of the playing song
	select-player [set {auto|<player-name>}]   # Select what controller you whish to control. Use 'auto' to automatic choose the first available player

- Abbreviations
	pp = play-pause
	s = stop
	n = next
	p = previous
	i = info
	sp = select-player
	a = all

sPolybarctl

sPolybarctl wraps the system status bar.

It handles the initialization of the status bars and can perform various actions on them, such as hiding/showing them.

- Usage
	sPolybarctl <options>

-Options
	help                           # Show this help
	launch                         # Launch all polybars defined
	show [bar name]                # Make the specified bar visible, or leave empty to show all bars
	hide [bar name]                # Make the specified bar invisible, or leave empty to hide all bars
	toggle [bar name]              # Show and hide the specified bar, or leave empty to toggle all
	status <bar name>              # Print status of the specified bar (useful to create a switch in a polybar itself)
	message <msg> [bar name]       # Send a message to the specified bar, or leave empty to send it to all bars
	                               #     Refer to man polybar-msg for the message format

- Abbreviations
	l = launch
	t = toggle
	s = show 
	h = hide
	m = message

sScreenshot

- Usage
	sScreenshot <options>

-Options
	help       # Show this help
	screen     # Capture the whole screen
	area       # Capture a selected area

- Abbreviations
	s = screen
	a = area

sTodo

sTodo it's a minimal to-do list manager

- Usage
	todo [options]

- Options
	help   show this help

	# Query commands
	list [done|todo|deleted] [name]    # List with filters
		done                              # List things done
		todo                              # List things still to do
		deleted                           # List things cancelled

	# Edit commands
	new <name>                         # Add a new thing to do with name <name>
	do <id>                            # Mark it done
	undo <id>                          # Mark it undone
	delete <id>                        # Mark it deleted
	edit                               # Edit manually the todo list

	# Other
	notification [done|todo|deleted]   # Show todo list in a notification

sVolumectl

- Usage
	sVolumectl <options>
	
- Options
	help                     # Show this help
	set <amount>             # Set speaker/headphone volume at the given percentage
	increase <amount>        # Increase speaker/headphone volume by amount
	decrease <amount>        # Decrease speaker/headphone volume by amount
	mute [true|false|toggle] # Set mute status for the speakers/headphones
	
- Abbreviations
	s = set
	i = increase
	d = decrease
	m = mute

sWifi

- Usage
	sWifi <options>
	
-Options
	help                   # Show this help
	rescan [auto|yes|no]   # Specify rescan behaviour (Default: yes)
	
- Abbreviations
	r = rescan

Other

DrawBar.sh

- Usage
	DrawBar.sh [options]
	
- Options
	-h, --help                  Show this help.
	-l, --length                Specify the length (in columns) of the bar.
	-v, --value                 Specify the value of the bar.
	-s, --step                  Specify the step for the bar value.
	                              A length of 20 with step of 5 will produce
	                              a bar 20 columns long, where each 5 unit of the
	                              specified value will be represented by one column.
	                              A character must be defined for each step. See
	                              the --bar-chars option.

	-c, --bar-chars             Specify a semicolon separated list of characters.
	                              to use as bar.
	                              A character must be specified for each step, plus
	                              another character for the \"empty part\" of the bar.

	                              Example: '#;-'
	                              with length=10, step=1 and value 6
	                              Will produce a bar like the following:
	                              ######----

	                              Example 2: '█;▆;▅;▃;▁;░'
	                              with length=10, step=5 and value=23
	                              Will produce a bar like the following:
	                              ████▅░░░░░
	                              NOTE: multiple characters for each step
	                              (spaces included) can be used.

	                              Some cool alternatives:
	                                '█;▆;▅;▃;▁;░'
	                                '█;▉;▋;▍;▏; '
	                                '█;▓;▒;░; ; '
	                                '⣿;⠗;⠕;⠆;⠂; '
	
	-b, --borders <chars>       Specify a semicolon separated list of characters
	                              to use as borders.

	                              Example: '┌;─;┐;│;│;└;─;┘'
	                              Will produce borders like the following:
	                              ┌───────────────────┐
	                              │                   │
	                              └───────────────────┘
	                              NOTE: none or multiple characters (spaces
	                              included) can be used.

	                              Some cool alternatives:
	                                '┌;─;┐;│;│;└;─;┘'
	                                '+;-;+;|;|;+;-;+'
	                                ';;;|;|;;;'
	                                '┌; ;┐; ; ;└; ;┘'
	                                '┌;─;┐;│;Some text after;└;─;┘'

Clone this wiki locally