Skip to content

smoorg/scripts

Repository files navigation

Scripts

This is repository of my Archlinux scripts I use on daily basis.

Installation

If you'd like to use this repository in your PATH keep in mind there are a few folders. In order to scrap all the script names from every folder I use find.

find $HOME/scripts -type d

This will generate bunch of weird folders we don't really need related to git, so we can ignore them like so

find $HOME/scripts -type d ! -iwholename "*git*" -printf %p:

This will scrap every folder and subfolder inside scripts directory and we can use it to add them as additional records in PATH. Directories in PATH are splited by colon sign hence addigional -printf flag.

scripts_dirs=$(find $HOME/scripts -type d ! -iwholename "*git*" -printf %p:)
export PATH=$PATH:/usr/local/games:/usr/local/bin:$HOME/.local/share/applications:$HOME/:$scripts_dirs

Dependencies

Most of my scripts use:

  • cdda2wav to rip CD Audio discs into wav files and flac to compress them to loseless format
  • dmenu for listing options
  • fzf although I think the only one using fzf is kcs right now and possibly I'll move to dmenu as well in future
  • gnutils such as gawk, grep, tr, tail, head, echo, read, file, find
  • xrandr for monitor scripts
  • xinput used in touchtog
  • dunst or another program for sending notifications via notify-send
  • either amixer or pactl depending on what you're using for sound
  • mpc and ncmpcpp for playing music
  • sxiv to pick a wallpaper
  • xrandr to manage monitors and resolutions
  • ffmpeg for webcam preview (webcam script) and screen recording (record script)
  • maim for screenshots and screen area picking for record
  • screenkey specificly in sctog to start and stop screenkey application in the background
  • udisks2 to manage usb drives

Variables

There are few scripts that expects you to have certain variables to be set in order to work.

var description used by
SCRIPTS_DIR self explainatory, your scripts directory -
WALLPAPER_DIR a file that supposed to be used as your wallpaper i.e. $HOME/wallpaper.png setwall, swapwall
WALLPAPERS_DIR directory with your wallpapers, i.e. $HOME/Pictures/wallpapers setwall, swapwall
SCREENSHOT_DIR directory with your screenshots, i.e. $HOME/Pictures/screenshots screenshot
KEEPASS_DIR directory with your keepass database, i.e. $HOME/Keepass/ kcs
DEFAULT_OUTPUT default output for screen manipulation like change resolution, i.e. DP-4` conmon
TOUCHPAD_ID touchpad device id to toggle it off touchtog, tpadstatus
OPEN_WEATHER_KEY api key to make weather widget on dwm statusbar work weather

Description

I try to group scripts into folders for maintenance but they also have functional reasons. Here's short description of some of them.

  • aliases - a group of scripts that could have been aliases but I find it easier to maintain it there
    • hibernate - systemd hibernation call
    • music - runs mpc update and ncmpcpp
    • pdf - application for pdf, usually xreader
    • firdef - firefox default profile
  • capture
    • record - records screen area
    • recordws - records whole screen in QHD resolution, can be modified to fHD easily
    • webcam - uses mpv to present webcam
  • cd
    • ripaudio - rips audio CD to splitted flac tracks
    • splitflac - splits flac file into pieces based on cue description
    • inftags - parses .inf cddb tags to id3v2 format to append it to audio file
  • cron - notify - simple wrapper for notify-send with timeout of 10s, safe to use with cronjobs
  • sound - everything related to sound management, volume, mute status, switching sinks and so on
    • currsink - returns default sink
    • mute - toggles mute status for sinkid or sink name
    • muted - returns mute status for sinkis or sink name
    • pl - lists sinks
    • sds - sets default sink
    • sound - increases and decreases volume
    • switchsink - changes default sink
    • volume - returns volume level
  • screen - monitors, wallpapers, brightness, screenshots
    • conmon - connect additional monitor (currently hardcoded to right-of so mostly for 2 monitors as of now)
    • light - increases and decreases brightness
    • night - runs redshift
    • screenshot - copies screenshots to $SCREENSHOT_DIR as well as to your xclip
    • setwall - sets wallpaper
    • showmonitors - lists monitors
    • swapres - changes resolution and refresh rate
    • swapwall - replaces wallpaper file or runs sxiv to pick one and then calls setwall
  • pacman - scripts related to pacman
    • pacinst - copied from archlinux wiki; fzf based application installer
    • pacupd - pacman update script which remembers to install archlinux-keyring first for me
  • keepassxc - scripts related to keepassxc
    • kcs - Keepass + rclone sync to update/merge database.
  • askpass - calls dmenu for password, if dmenu has -P flag (patch) it stars the input and sends it forward
  • statusbar - dwm bar status bar scripts to present cpu and ram usage, volume, date and time, nothing fancy there
  • emotes - dumb script to present emotes and its tags and copy over needed one to the xclip
  • marktime - sets timestamp and adds it to a file. Then substracts it from previous one to count time period. Can be used to track time
  • scan - uses plugged in scanner and tries to scan image
  • sshadd - picks ssh key from dmenu to use with ssh-agent, asks for password using askpass if possible
  • startdwm - while loop that reruns dwm every time it's binary has changed
  • subdate - subtracts two dates
  • touchtog - uses xinput to toggle provided device
  • usboff - kosher way of make usb drives off
  • ytrss - generates rss from youtube channel/playlist/user

About

Bash scripts I use in my archlinux machines

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages