Scripts
- Scripts to implement some basic computer (mainly linux) functionalities and a bit complex stuff using some some external programs.
- These are more handy when using a tiling window manager. As a raw build of most of the tiling window mangers lacks most of the basic bindings like to change volume, brightness, turn on/off mic etc.
Installation
All the dependencies are listed in the requirements.txt file. They can be installed at once with your package manager. For instance, with apt, install them with command:
cat requirements.txt | xargs sudo apt install -yHow to use these?
- Clone or download this repository.
git clone https://github.com/chhajedji/scripts.git ~/.scripts # To clone in $HOME/.scripts- Append your
PATHwith$HOME/.scripts. Do this by addingexport PATH="$PATH:$HOME/.scripts"in your shell's config file or$HOME/.profile.
echo "export PATH=\"\$PATH:\$HOME/.scripts\"" >> $HOME/.profile- If you use a tiling window manager then add bindings in it's config files or for others DE's like Gnome, KDE, XFCE etc, check how can you modify keyboard shortcuts and add bindings for these scripts like you would run any normal command (
cd,mkdir, etc).
Most scripts are having an extension like
.shto avoid conflicts if a default command exists by that name (mostly unlikely). Also so that I know that this a script (mostly written by me) and not a command.
Description
app_name
-
Functionality
- Display current window's title.
- If run from a terminal, will ask user to select which window's name to get.
-
Dependency
- None
autostart
-
Functionality
- Put all your applications which needed to run after startup in this script. Applications like wallpaper, notification manager, clipboard manager, network manager etc.
- Check if application is already running, if not then start it.
- It will also select if HDMI is connected and set monitors for dual display using disp_config.sh.
- Applications listed in Dependencies are one that I use. Most of them have a check that if they are installed.
-
Dependencies
parcellite: Clipboard manager.compton: Compositing manager.dunst: Notification manager.redshift: For adjusting screen temperature.picomdisp_config.new_wall.
blur_lock
-
Functionality
- Fork of i3lock-blur.
- Takes screenshot of current screen, take another image to display on top of it and locks system with output image.
- Sets screen timeout to a lower value when locked. After unlock, set to a higher value.
-
Dependency
xrandrffmpegi3lock
brightness_change
-
Functionality
- Change screen brightness.
-
Dependency
xbacklight
clickbar
-
Functionality
- Script triggered when
dwmstatus bar is clicked.
- Script triggered when
-
Dependency
gsimplecalvolume_change.shhtop
completion
-
Functionality
- Dependency for
fzfto enable completion. - See https://github.com/junegunn/fzf.
- Dependency for
-
Dependency
fzf
csb
-
Functionality
- Useful when working with big projects in C/C++.
- Build cscope databases and tags using ctags and organise properly in
$HOME/.cstags_dir/. For details see inside csb.
-
Dependency
ctagscscope
dmenu_input
-
Functionality
- This script includes many functionalities which can be used with
dmenu. - Run any executable or system application by name (Just like start menu).
- Open any file with
xdg-open. - Open file manager in desired directory.
- Search for words in dictionary.
- Search for manual pages.
- Do a web search or go to a URL.
- Go to git repos in your system. (This uses a file created by command
find $HOME/ -regex .*/\.git$ 2>/dev/null > $HOME/.tmp/gitfilesto search for path of all git directories. I run this command while updating system Also there should be a directory ".tmp" in your$HOMEdirectory. Checkup-to-datecommand here in dot-files repo). - Turn off notifications for specified time.
- Connect to a WiFi network present in vicinity.
- Quit system in multiple ways like power off, restart, suspend and logout. Not that it uses some options with
sudooption. So make sure to either run this withsudoor addpkillandshutdownto sudoers. - Kill any process owned by same user.
- Open terminal in desired directory.
- For more details see inside dmenu_input.sh.
- Copy the highlighted text to a temporary clipboard and paste from it.
- This script includes many functionalities which can be used with
-
Dependency
fdj4-dmenu-desktop(Optional, but helpful in opening direct applications.)dolphin(IfFILEMANAGERis not set globally).firefox(If globally environmental variableBROWSERis unset).dictanddictd: For command line dictionary.dmenuurxvt(If globally environmental variableTERMINALis unset).dunst/notify-sendnmclisuspend_lock.shxdotoolnotify-send
disp_config
-
Functionality
- Multiple screens setup for single, dual or duplicate screens.
- Default is single monitor. See autostart.sh which selects what to do.
-
Dependency
xrandr
dwmbar
-
Functionality
- Display status bar with
xsetrootwhen using dwm. - Find my dwm built here.
- Display status bar with
-
Dependency
amixer
editor
-
Functionality
- Shortcut to open editor.
- Prefered editor is
emacs. If not installed then open invi.
-
Dependency
emacs(optional).Vi.urxvt(If globallyTERMINALis not set).
filecopy
-
Functionality
- Copy a file to clipboard from terminal and paste it somewhere other than terminal with
Ctrl-v.
- Copy a file to clipboard from terminal and paste it somewhere other than terminal with
-
Dependency
xclip
fd
-
Functionality
- Linked to
/usr/bin/fdfind(only for Debian). - See https://github.com/sharkdp/fd.
- Linked to
-
Dependency
fdfind(https://github.com/sharkdp/fd)
focus_window
-
Functionality
- Change transparency of current widow a few times to generate visual effect to show current window being used.
-
Dependency
comptonxdotool
gadd
-
Functionality
- Add local files to github repos.
-
Dependency
git
git-open
-
Functionality
- My fork of original git-open.
- Used to open github links directly.
- Added functionality to open my github page.
-
Dependency
git
git-when-merged
-
Functionality
- Helps to detect merge commit (to know when and why a commit was merged into a branch).
- Original: git-when-merged.
-
Dependency
gitpython
i3blocks
-
Functionality
-
Dependency
- None
key-bindings
-
Functionality
- Dependency for
fzf. - Adds keybindings to change directory, reverse search and ctrl-t for completing files in current directory using
fzf. - See https://github.com/junegunn/fzf.
- Dependency for
-
Dependency
fzf
long-running
-
Functionality
- My fork of undistract-me.
- Used to send notifications when a long command finishes.
-
Dependency
- preexec
notify-send
netspeed
Not working now as Ookla changed their
speedtestscript implementation. Needs to be updated.
-
Functionality
- Check internet speed and save results in
$HOME/. - First argument: Number of tests to perform. Second argument is optional to do upload speedtest also. Give anything as second argument.
- This script will create file
downspeed(andupspeedif any argument is present) and log start time, results for every iteration and average speed in it.
- Check internet speed and save results in
-
Dependency
speedtest-cli
new_wall
-
Functionality
- Set a new wallpaper randomly from files stored in given directory (and its sub-directories) or set given argument file as wallpaper.
- See inside for usage.
- Demo video: https://youtu.be/11Dqat5XS9c
-
Dependency
fehdisp_config
notification_sound
-
Functionality
- Play notification sound.
-
Dependency
paplay- alert.ogg stored at
$HOME/.local/share/supplemets/alert.ogg.
notification_toggle
-
Functionality
- Pause, resume and toggle dunst notification display. Useful when focusing on work or doing a screenshare, to avoid notifications.
-
Dependency
dunst/notify-send
o
-
Functionality
- Compile given c program with
gccand run it. Could be helpful when running simple C programs for testing C functionalities, competitive programming etc. - Add this script in
PATHfor easy usage. - Just run this as
o(if added inPATH) and compile and run last edited C file or give name of C file to be compiled and run.
- Compile given c program with
-
Dependency
gcc
pic_lock_exec
-
Functionality
- Lock screen with
i3lock. Set a random background present anywhere in the given path. - Sets screen timeout to a lower value when locked. After unlock, set to a higher value.
- Lock screen with
-
Dependency
pic_lock: See this.
pic_lock
-
Functionality
- Locks the screen using
i3lockwith given input image. - A fork of this.
- Locks the screen using
-
Dependency
i3lockxrandr
power_alert
-
Functionality
- Sends a notification when battery goes below a certain level. This threshold level can be set inside.
-
Dependency
dunst/notify-send
preexec
-
Functionality
- Used for long-running.
-
Dependency
- None
remindme
-
Functionality
- Set, view and delete reminders!
- Demo video: https://youtu.be/5_5AoSFpOxQ
-
Dependency
perldmenuatnotify-send
restartbar
-
Functionality
- Checks if there is any instance of "dwmbar" running.
- If found exactly one, then kill
sleepinside it. - If any instance other than one (zero, two etc.) is running, kill all instances and start a new one.
-
Dependency
run
-
Functionality
- Used as a test script in
PATHfor testing commands/program/functionality etc. - Not used by system anywhere.
- Used as a test script in
-
Dependency
- Variable.
samedirnoob
-
Functionality
- Open new terminal in same directory as of previous terminal in a more naive way.
-
Dependency
- None
samedir
-
Functionality
- Same as samedirnoob but do it is an advanced way.
Note this is not always accurate but has some other benefits.
-
Dependency
- None
screenkey_toggle
-
Functionality
- Toggle screenkeys.
-
Dependency
screenkey
screenshot
-
Functionality
- Take screenshots of area, whole screen and current window.
- Save in given
$DESTINATIONand copy to clipboard.
-
Dependency
scrotxclip
startpy3
-
Functionality
- Start python3 in
$TERMINAL. - Mainly used for calculator.
- Start python3 in
-
Dependency
python3
suspend_lock
-
Functionality
- Lock screen and suspend to RAM.
- Sets screen timeout to a lower value when locked. After unlock, set to a higher value.
-
Dependency
i3lock
toggle_hw
-
Functionality
- Toggle some of the hardware functions like mouse, touchscreen, touchpad.
-
Dependency
- None
touchpad
-
Functionality
- Toggle touchpad with inbuilt keyboard button (if present).
-
Dependency
synclient
trans_change
-
Functionality
- Change transparency of current window using
compton.
- Change transparency of current window using
-
Dependency
compton
undistract-me
-
Functionality
- My fork of undistract-me.
- Used to send notifications when a long command finishes.
-
Dependency
unpasspdf
-
Functionality
- Remove passwords from protected PDF files. Whole functionality of this script can be destroyed with pdftk (which indeed is used in this script).
-
Dependency
pdftk
volume_change
-
Functionality
- Script to change system volume.
- Also controls mic mute/unmute.
-
Dependency
pactl- dwmbar
- volume_change.ogg stored at
$HOME/.local/share/supplemets/volume_change.ogg.
wifi_toggle
-
Functionality
- Toggles WiFi connection.
-
Dependency
nm-applet(Generally pre-installed withNetworkManagement)
Other dependencies
Not directly used in these scripts but indirectly used by other commands.
