scripts sorted

This commit is contained in:
Luke Smith 2018-11-05 17:51:24 -05:00
parent cd667e6aa1
commit 2f4c2a68a1
64 changed files with 273 additions and 331 deletions

View file

@ -56,7 +56,7 @@ exec --no-startup-id dunst
# Composite manager:
exec --no-startup-id compton
# Runs the key remapping scripts
exec --no-startup-id ~/.scripts/remaps
exec --no-startup-id remaps
# Unclutter makes the mouse invisible after a brief period
exec --no-startup-id unclutter
# Run the script to update the mpd i3block on change.
@ -137,7 +137,7 @@ bindsym $mod+Shift+Insert exec --no-startup-id showclip
bindsym $mod+q [con_id="__focused__" instance="^(?!dropdowncalc|tmuxdd).*$"] kill
bindsym $mod+Shift+q [con_id="__focused__" instance="^(?!dropdowncalc|tmuxdd).*$"] kill
bindsym $mod+w exec --no-startup-id $BROWSER
bindsym $mod+w exec $term -e nmtui
bindsym $mod+Shift+w exec --no-startup-id $BROWSER
bindsym $mod+e exec $term -e neomutt
@ -201,8 +201,8 @@ bindsym $mod+Shift+z gaps outer current minus 5
bindsym $mod+x exec --no-startup-id lockscreen
bindsym $mod+Shift+x exec --no-startup-id prompt "Shutdown computer?" "$shutdown"
bindsym $mod+c exec --no-startup-id camtoggle
##bindsym $mod+Shift+c
bindsym $mod+c exec --no-startup-id freealf
bindsym $mod+Shift+c exec --no-startup-id camtoggle
bindsym $mod+v exec $term -e ncmpcpp -s visualizer
bindsym $mod+Shift+v exec --no-startup-id projectM-pulseaudio
@ -410,8 +410,8 @@ bindsym XF86MonBrightnessUp exec --no-startup-id xbacklight -inc 15
bindsym XF86AudioMedia exec --no-startup-id $term -e ncmpcpp
bindsym XF86Display exec --no-startup-id arandr
#bindsym XF86KbdLightOnOff exec
bindsym XF86KbdBrightnessDown exec --no-startup-id python3.6 ~/.scripts/kb-lights.py -
bindsym XF86KbdBrightnessUp exec --no-startup-id python3.6 ~/.scripts/kb-lights.py +
#bindsym XF86KbdBrightnessDown exec
#bindsym XF86KbdBrightnessUp exec
##bindsym XF86Reply exec
##bindsym XF86MailForward exec
##bindsym XF86Save exec

View file

@ -114,40 +114,40 @@ system will grow on you quick.
## Basic Programs
*Note:* LARBS will install nearly all of these programs by default, but some
only come if you chose an extra option. Naturally, you can use `packer` to look
only come if you chose an extra option. Naturally, you can use `yay` to look
for and install any you want to add.
+ `Mod+r` -- ranger (file browser/manager)
+ `Mod+e` -- mutt (email)
+ `Mod+m` -- ncmpcpp (music player)
+ `Mod+a` -- R/Python calculator (be sure to close with Mod+a for reusability)
+ `Mod+w` -- nmtui (for connecting to wireless internet)
+ `Mod+a` -- R/Python calculator (hide with `mod+a`)
+ `Mod+i` -- htop (system info)
+ `Mod+n` -- newsboat (RSS feed reader)
+ `Mod+y` -- calcurse (calendar and schedule)
+ `Mod+u` -- "Dropdown" terminal (close with Mod+u for reusability)
+ `Mod+u` -- "Dropdown" terminal (hide with `mod+u`)
+ `Mod+A` -- pulsemixer (audio system control)
+ `Mod+w/W` -- Web Browser
+ `Mod+W` -- Web Browser
+ `Mod+G` -- GIMP (for general image manipulation)
## System
+ `Mod+R` -- ranger as root user
+ `Mod+x` -- i3lock (Enter password to return)
+ `Mod+X` -- shutdown (will give a dmenu confirm prompt)
+ `Mod+Shift+Backspace` -- reboot (will give a dmenu confirm prompt)
+ `Mod+Shift+Escape` -- exit i3 (will give a dmenu confirm prompt)
+ `Mod+X` -- shutdown (will ask to confirm)
+ `Mod+Shift+Backspace` -- reboot (will ask to confirm)
+ `Mod+Shift+Escape` -- exit i3 (will ask to confirm)
+ `Mod+F1` -- Shows this document
+ `Mod+F2` -- Refresh i3
+ `Mod+F3` -- Select screen/display to use
+ `Mod+F4` -- Hibernate
+ `Mod+F4` -- Hibernate (will ask to confirm)
+ `Mod+F5` -- Reset Network Manager, search for new networks
+ `Mod+F6` -- transmission torrent client (cli)
+ `Mod+F7` -- Toggle on/off transmission client via dmenu
+ `Mod+F8` -- Check mail, if
[mutt-wizard](https://github.com/lukesmithxyz/mutt-wizard) is installed
+ `Mod+F9` -- Mount a drive/partition
+ `Mod+F10` -- Unmount a drive/partition (does not umount `/`, `/home` or
`/boot`)
+ `Mod+F9` -- Mount a USB drive/hard drive or Android
+ `Mod+F10` -- Unmount a non-essential drive or Android
+ `Mod+F11` -- Search term on DuckDuckGo
+ `Mod+F12` -- Wifi-menu for selecting the wireless internet source.
@ -188,43 +188,42 @@ additions.
I use scrot and ffmpeg to make different recordings of the desktop and audio.
All of these recording shortcuts will output into `~`, and will not overwrite
previous recordings.
previous recordings as their names are based on their exact times.
+ `PrintScreen` -- Take a scrot screenshot
+ `Shift+PrintScreen` -- Take a scrot screenshot of only selected window
+ `Mod+PrintScreen` -- Opens dmenu menu to select kind of audio/video recording
+ `Mod+Delete` -- Kills any recording started in the above way.
+ `Mod+ScrollLock` -- Turn on and off screenkey (if installed) for visual typing display
+ `Mod+Delete` -- kills ffmpeg, thus ending recordings
Each of the recording scripts are located in `~/.scripts`. You can check them
out or modify them if needed.
+ `Mod+Shift+c` -- Toggles a webcam in the bottom right for screencasting.
## Other buttons
I've mapped those extra buttons that some keyboards have (play and pause
buttons, email, webbrowsing buttons, etc.) to what you would expect.
buttons, screen brightness, email, web browsing buttons, etc.) to what you
would expect.
# Special traits of this system
## Easy config access
Open a terminal and type `cfc`. This will open a file where you will see
customizable pairs of key shortcuts and config files. Enter any of these
shortcuts in bash or ranger to immediately open the file in vim.
Open a terminal and type `bf`. This will open a file where you will see
customizable pairs of key shortcuts and config files and other important text
files. Enter any of these shortcuts in bash or ranger to immediately open the
file in vim.
You may add new entries here and they will be refreshed when you save the file
in vim. This will take effect immediately once you start a new instance of bash
or ranger.
or ranger or reload your previous sessions.
## Folder and config shortcuts
Open a terminal and type `cff`. This opens a file when you can keep and create
folder shortcuts. There are only a few here now, because I don't know what your
folder structure is going to look like, but on my machine, I have 109 and
growing.
Open a terminal and type `bd`. This opens a file when you can keep and create
directory/folder shortcuts. There are only a few here now, because I don't know
what your folder structure is going to look like, but on my machine, I have 109
and growing.
Each line has a shortcut key/keys and its target. These can be used in serveral
Each line has a shortcut key/keys and its target. These can be used in several
applications. In bash, simply press `d`, the shortcut for `~/Documents` and you
will cd there (and automatically `ls -a`).

View file

@ -2,7 +2,7 @@
# Profile file. Runs on login.
export PATH="$PATH:$HOME/.scripts"
export PATH="$(du $HOME/.scripts/ | cut -f2 | tr '\n' ':')$PATH"
export EDITOR="vim"
export TERMINAL="st"
export BROWSER="linkhandler"

View file

@ -1,146 +1,136 @@
# Directory of Scripts
## `audio`
I keep all my user-created scripts here in `~/.scripts/`. Scripts are sorted
into sub-directories for easy management, and all are seamlessly added to
`$PATH` with the command below in `~/.profile`:
The audio recording script run by `dmenurecord` (bound to `mod+Print`).
```
export PATH="$(du $HOME/.scripts/ | cut -f2 | tr '\n' ':')$PATH"
```
## `bottomleft`
## `statusbar/`
Makes the currently selected window float in the bottom left of screen. Bound
to `mod+B`.
For modules used in i3blocks.
## `camtoggle`
### `i3battery`
Starts/kills /dev/video0 webcam. Placed in bottom right by default.
i3blocks module. Shows available power remaining with icon indicating battery
status. Colors indicate different levels of charge.
## `compiler`
### `i3mail`
i3blocks module for use with mutt-wizard. Shows unread mail and if
`mailsync.sh` is running.
### `i3mpd`
i3blocks module. Shows current song; if paused, name will be grayed and italic.
### `i3mpdupdate`
A daemon running by default that will update the i3mpd block on mpd change.
### `i3pacman`
i3blocks module. Detects new installable upgrades. Only works if you use
cronjobs to automatically sync repositories.
### `i3torrent`
i3blocks module. Shows torrents idle (⌛️), downloading (⬇️) or
finished (🌱).
### `i3volume`
i3blocks module. Shows volume percentage or mute notification.
### `i3weather`
i3blocks module. Gets weather forcast from wttr.in and returns today's
precipitation chance (☔), daily low (❄️) and daily high (☀️).
### `i3wifi`
A modified version of the i3blocks wifi module. Clicked, it brings up wifi-menu
and also appears when there is no wifi connection.
### `popupdate`
Called by clicking on the update icon if there are new packages. Spawns a `yay`
upgrade of the main Arch repos and AUR packages, updates the i3blocks module
once complete.
### `popweather`
The script called by clicking on the i3 weather module. Brings up the forecast
from `http://wttr.in` and will close on <Enter>.
## `cron/`
For scripts meant to be cronjobs. None are active by default on LARBS.
### `checkup`
If connected to internet, syncs package repositories and downloads (but does
not install) any potential updates. Gives `notify-send` notifications of when
it is active since other `pacman` install commands cannot be run
simultaneously.
You may need to grant your user the ability to run `pacman -Syyuw --noconfirm`
without a password (done in `/etc/sudoers`).
### `cronbat`
Gives a dunst notification if the battery is less than 25%.
### `crontog`
Not actually a cronjob, but just turns off/on all user cronjobs.
### `newsup`
Updates newsboat RSS feeds if connected to internet. Will also display a
newspaper update icon on i3blocks if it has not be user disabled.
## `tools/`
Scripts intended to be run either manually by the user or linked to a shortcut
in vim or another program.
### `compiler`
Compiles a markdown, R markdown or LaTeX document with the approriate command.
Will also run `make && sudo make install` if in a `config.h` file. Otherwise
it will create a sent presentation. This can be thought of a general output
handler. I have it bound to `<leader>c` in vim.
## `crontog`
Turns off/on all user cronjobs.
## `displayselect`
Select which displays to use. Bound to `mod+F3`.
## `dmenuarchwiki`
Bind this script to a key and it will give you a prompt to search for a term in
the Arch Wiki. Used to be binded to `mod+F11`, but has been replaced by
`ducksearch` there.
## `dmenuhandler`
### `dmenuhandler`
Give this script a url and it will offer dmenu options for opening it. Used by
`newsboat` and some other programs as a link handler.
## `dmenumount`
Detect available partitions with `lsblk` and offer to mount them. Bound to
`mod+F9`. Will do nothing if none are available.
## `dmenurecord`
Gives a list of recording commands: `audio`, `video` and `screencast` (both) in
dmenu for selection.
## `dmenuumount`
Unmount a mounted non-essential partition. Bound to `mod+F10`. Will do nothing
if none are mounted.
## `dropdowncalc`
The command initially run in the `math` window (toggeable with `mod+a`). Runs
`r` if available, else `python`.
## `ducksearch`
Show a dmenu prompt and search for the inputed text in DuckDuckGo. Can take
bangtags as expected, i.e. typing in `!aw Arch Linux` will search the Arch Wiki
for "Arch Linux" or `!yt Luke Smith` will search YouTube for "Luke Smith", etc.
## `extract`
### `extract`
Will detect file type of archive and run appropriate extraction command.
## `getbib`
### `getbib`
Use crossref.org to automatically detect bibtex entry of a .pdf. Attempts to
search for the .pdf's DOI. Returns nothing if none detected.
## `getkeys`
### `getkeys`
Get the LARBS documentation on what bindings exist for main programs.
## `i3battery`
i3blocks module. Shows available power remaining with icon indicating battery
status. Colors indicate different levels of charge.
## `i3mail`
i3blocks module for use with mutt-wizard. Shows unread mail and if
`mailsync.sh` is running.
## `i3mpd`
i3blocks module. Shows current song; if paused, name will be grayed and italic.
## `i3mpdupdate`
A daemon running by default that will update the i3mpd block on mpd change.
## `i3pacman`
i3blocks module. Detects new installable upgrades. Only works if you use
cronjobs to automatically sync repositories.
## `i3resize`
A script that allows intuitive resizing of windows. Mapped to `mod+Y/U/I/O`.
## `i3torrent`
i3blocks module. Shows torrents idle (⌛️), downloading (⬇️) or
finished (🌱).
## `i3volume`
i3blocks module. Shows volume percentage or mute notification.
## `i3weather`
i3blocks module. Gets weather forcast from wttr.in and returns today's
precipitation chance (☔), daily low (❄️) and daily high (☀️).
## `i3wifi`
A modified version of the i3blocks wifi module. Clicked, it brings up wifi-menu
and also appears when there is no wifi connection.
## `kb-lights.py`
A Python 3 script which will increase or decrease keyboard lights when given
either a `+` or `-` argument.
## `killrecording`
End a recording started by `dmenurecord` the proper way.
## `linkhandler`
### `linkhandler`
The automatic link handler used by `newsboat` and other programs. Urls of video
sites or of video files are opened in `mpv`, images are downloaded/opened in
`feh`, music files are downloaded with `wget` and all other urls are opened in
the default browser.
## `lmc`
### `lmc`
A music controller that simplifies music/audio management and improves the
interface with i3blocks. Check inside to see what it does. This is what i3
@ -148,96 +138,166 @@ audio/music commands run by default. If you use a difference music system or
ALSA, you can change this script rather than changing all the shortcuts in
different places.
## `lockscreen`
The screen locker. Gives a confirm prompt and if user says yes, all audio will
be paused and the screen will be distorted and locked and screen will soon time
out. User must insert password to unlock.
## `musstuff`
Some old notes and commands on deleted music shortcuts.
## `note`
### `note`
Give this script some text/a message as an argument. It will print it to the
terminal, and if `dunst` is running, display a notification.
## `opout`
### `opout`
"Open output", opens the corresponding `.pdf` file if run on a `.md`, `.tex` or
`.rmd` file, or if given an `.html` file, will open it in the browser. Bound
to `<leader>p` in my vim config to reveal typical output.
## `pauseallmpv`
### `pauseallmpv`
Pauses all mpv instances by sending the `,` key to each. Used by several
scripts, but can be used alone as well.
scripts, but can be used alone as well. It will not pause an audio only mpv
instance. If you know how to add a hack to do this, feel free to PR it or email
me an addition.
## `polybar_launch`
For `polybar` users. Launches `polybar` on every screen. Should be run in the
i3 config.
## `popweather`
The script called by clicking on the i3 weather module. Brings up the forecast
from `http://wttr.in` and waits for input to prevent immediate closing of
spawned window.
## `prompt`
Gives a Yes/No prompt to a question given as an argument. Used by numerous
bindings like `mod+shift+x`, `mod+shift+backspace` and `mod+shift+escape`.
## `remaps`
### `remaps`
Remaps capslock to escape when pressed and super/mod when held. Maps the menu
key to super as well. Runs the US international keyboard setup. If you want
another keyboard setup, edit this fine.
## `samedir`
### `shortcuts`
Opens a terminal window in the same directory as the window currently
selection. Bound to `mod+shift+enter`.
For updating bash and ranger shortcuts. Reads `~/.key_directories` and
`~/.key_files` for pairs of keypresses and directories and files, then
autoproduces bash aliases and ranger shortcuts for them which output to
`~/.shortcuts` and `~/.config/ranger/shortcuts.conf` respectively. These are
read automatically by my bash and ranger configs. You don't have to run this
script manually though, as it's run by vim whenever you edit one of the
`~/.key_*` files.
## `screencast`
### `speedvid`
A script for `dmenurecord`. Records default audio and the screen.
Speed up a given video file (`$1`) by a given ammount (`$2`).
## `shortcuts.sh`
### `tpb`
For updating bash and ranger shortcuts. Reads `~/.scripts/folders` and
`~/.scripts/configs` for pairs of keypresses and directories and configfiles,
then autoproduces bash aliases and ranger shortcuts for them. See the
`README.md` at
[https://github.com/LukeSmithxyz/shortcu-sync](https://github.com/LukeSmithxyz/shortcu-sync)
for the specifics.
Search Pirate Bay for the certain search terms given as arguments.
## `texclear`
### `texclear`
Remove all `.tex` related build files. This is run by my vim when I stop
editing any `.tex` file.
## `tmuxinit`
### `transadd`
The mimeapp default script for handling torrent magnet links. Starts
`transmission-daemon` if not running and adds the link.
## `i3cmds`
These are scripts linked to bindings in i3. They typically perform
user-interface actions or involve dmenu.
### `bottomleft` and `bottomright`
Makes the currently selected window float in one of the bottom corners of the
screen. `bottomleft` is bound to `mod+B` by default.
### `camtoggle`
Starts/kills /dev/video0 webcam. Placed in bottom right by default.
### `ddspawn`
This is the script called to create, show and hide the dropdown tmux terminal
mapped to `mod+u`, but also the dropdown calculator mapped to `mod+a`. Give the
script an argument that is a script the window will run. If a window does not
already exist, `ddspawn` creates it, if it does, `ddspawn` will toggle its
visibility. The the script itself for usage.
### `displayselect`
Select which displays to use. Bound to `mod+F3`.
### `dmenumount`
Gives a dmenu prompt for mounting USB drives or Android devices. Bound to
`mod+F9`. Will do nothing if none are available.
### `dmenurecord`
Gives a list of recording commands: `audio`, `video` and `screencast` (both) in
dmenu for selection. Bound to `mod+Print Screen` by default. Should be kill by
`killrecording`.
### `dmenuumount`
Unmount a mounted non-essential partition. Bound to `mod+F10`. Will do nothing
if none are mounted. It will not try to unmount essential system partitions.
### `dmenuunicode`
Shows a searchable dmenu prompt of emoji characters. The selected emoji is
copied to the system clipboard, while its character code is copied to primary
selection (middle mouse button).
### `dropdowncalc`
The dropdown calculator script called by `ddspawn` and bound to `mod+a` by
default. Will run an R calculator if installed, otherwise python.
### `ducksearch`
Show a dmenu prompt and search for the inputed text in DuckDuckGo. Can take
bangtags as expected, i.e. typing in `!aw Arch Linux` will search the Arch Wiki
for "Arch Linux" or `!yt Luke Smith` will search YouTube for "Luke Smith", etc.
### `i3resize`
A script that allows intuitive resizing of windows. Mapped to `mod+Y/U/I/O`.
### `killrecording`
End a recording started by `dmenurecord` the proper way without file trucation
or lingering background processes, mapped to `mod+Delete` by default.
### `lockscreen`
The screen locker. Gives a confirm prompt and if user says yes, all audio will
be paused and the screen will be distorted and locked and screen will soon time
out. User must insert password to unlock. Mapped to `mod+x` by default.
### `newspod`
A silly line that has a script all to itself due to i3's idiosyncracies. Starts
`newsboat`, if `newsboat` cannot open because of another instance being open,
opens `podboat`.
### `prompt`
Gives a Yes/No prompt to a question given as an argument. Used by numerous
bindings like `mod+shift+x`, `mod+shift+backspace` and `mod+shift+escape`.
### `samedir`
Opens a terminal window in the same directory as the window currently
selection. Bound to `mod+shift+enter`.
### `td-toggle`
Gives a dmenu prompt to start `transmission-daemon` if not running, or the kill
it if it is. Obviously you need `transmission-cli` installed for this to work.
Mapped to `mod+F7` by default.
### `tmuxdd`
The startup script for the dropdown terminal (toggleable with `mod+u`). Either
attaches to an existing tmux session or begins a new one.
## `toggletouchpad`
### `toggletouchpad`
As the name suggests, turns off TouchPad if on, and turns it on if off.
Requires `xf86-input-synaptics`.
Requires `xf86-input-synaptics`. If your laptop has a special button for this,
it will be mapped by default.
## `tpb`
Search Pirate Bay for the certain search terms given as arguments.
## `tutorialvids`
### `tutorialvids`
A dmenu prompt that gives some options of tutorial videos to watch. Bound to
`mod+shift+e`.
## `video`
A script for `dmenurecord`. Records the screen with no audio.

5
.scripts/cron/crontog Executable file
View file

@ -0,0 +1,5 @@
#!/bin/sh
# Toggles all cronjobs off/on.
# Stores disabled crontabs in ~/.consaved until restored.
([ -f ~/.cronsaved ] && crontab - < ~/.cronsaved && rm ~/.cronsaved && notify-send "Cronjobs have been re-enabled." && echo cronjobs re-enabled.) || ( crontab -l > ~/.cronsaved && crontab -r && echo cronjobs saved and disabled.;notify-send "Cronjobs have been saved and disabled.")

View file

@ -1,5 +1,9 @@
#!/bin/sh
# Set as a cron job to check for new RSS entries for newsboat.
# Note that newsbot cannot be opened during the sync and this
# sync cannot run while another instance of newsboat is open.
ping -q -t 1 -c 1 `ip r | grep -m 1 default | cut -d ' ' -f 3` >/dev/null || exit
echo "📰 🔃" > ~/.newsup
pkill -RTMIN+6 i3blocks

View file

@ -1,5 +0,0 @@
#!/bin/bash
# Toggles all cronjobs off/on.
# Stores disabled crontabs in ~/.consaved until restored.
([[ -f ~/.cronsaved ]] && cat ~/.cronsaved | crontab - && rm ~/.cronsaved && notify-send "Cronjobs have been re-enabled." && echo cronjobs re-enabled.) || ( crontab -l > ~/.cronsaved && crontab -r && echo cronjobs saved and disabled.;notify-send "Cronjobs have been saved and disabled.")

View file

@ -1,17 +0,0 @@
#!/bin/sh
# Gives a dmenu prompt to search the Arch Wiki in your preferred web browser
# Home goes to the home page of the Arch Wiki
# Anything else, it search it
# Original idea/script by Github user @Caedis. Minor changes by Luke.
pgrep -x dmenu && exit
choice=$(echo "📖" | dmenu -i -p "Type ArchWiki page or search term:") || exit 1
if [ "$choice" = "📖" ]; then
$BROWSER "https://wiki.archlinux.org"
else
$BROWSER "https://wiki.archlinux.org/index.php?search=$choice"
fi

View file

@ -5,7 +5,7 @@ rm -f /tmp/locked.png
# If `imagemagick` is not installed, use a blank screen.
[ -f /usr/bin/convert ] &&
scrot -m -z /tmp/base.png &&
pgrep -x dunst && notify-send -i ~/.scripts/lock.png "Locking computer..." &&
pgrep -x dunst && notify-send -i ~/.scripts/pix/lock.png "Locking computer..." &&
convert /tmp/base.png -blur 0x8 /tmp/locked.png
# Pause music (mocp, mpd and send the pause key to all mpv videos):

View file

@ -2,10 +2,12 @@
# If transmission-daemon is running, will ask to kill, else will ask to start.
if pgrep -x transmission-da ;
[ ! -f /usr/bin/transmission-daemon ] && echo "Transmission not installed." && exit
if pgrep -x transmission-da >/dev/null ;
then
yn=$(printf "No\\nYes" | dmenu -i -p "Kill transmission-daemon?")
[ "$yn" = "Yes" ] && killall transmission-daemon
[ "$yn" = "Yes" ] && killall transmission-da
else
yn=$(printf "No\\nYes" | dmenu -i -p "Start transmission daemon?")
[ "$yn" = "Yes" ] && transmission-daemon

View file

@ -1,35 +0,0 @@
#!/usr/bin/env python3
# coding: utf-8
from sys import argv
import dbus
def kb_light_set(delta):
bus = dbus.SystemBus()
kbd_backlight_proxy = bus.get_object('org.freedesktop.UPower', '/org/freedesktop/UPower/KbdBacklight')
kbd_backlight = dbus.Interface(kbd_backlight_proxy, 'org.freedesktop.UPower.KbdBacklight')
current = kbd_backlight.GetBrightness()
maximum = kbd_backlight.GetMaxBrightness()
new = max(0, current + delta)
if 0 <= new <= maximum:
current = new
kbd_backlight.SetBrightness(current)
# Return current backlight level percentage
return 100 * current / maximum
if __name__ == '__main__':
if len(argv[1:]) == 1:
if argv[1] == "--up" or argv[1] == "+":
# ./kb-light.py (+|--up) to increment
print(kb_light_set(1))
elif argv[1] == "--down" or argv[1] == "-":
# ./kb-light.py (-|--down) to decrement
print(kb_light_set(-1))
else:
print("Unknown argument:", argv[1])
else:
print("Script takes exactly one argument.", len(argv[1:]), "arguments provided.")

View file

@ -1,49 +0,0 @@
These are some old lines from the i3 config.
I now use the lmc script to change volume and music tracks, which makes i3blocks integration better.
I deleted the alternative lines for audio commands from the i3 config.
Still, since they're a good reference for people who use ALSA, or people who use music players besides mpd, I've kept them in this file.
You can replace the commands in the lmc script to get the setup you want. I might have the script autodecide the command later on.
#FOR ALSA/AMIXER
#set $inc --no-startup-id amixer sset Master 2%+
#set $biginc --no-startup-id amixer sset Master 5%+
#set $dec --no-startup-id amixer sset Master 2%-
#set $bigdec --no-startup-id amixer sset Master 5%-
#set $mute --no-startup-id amixer sset Master toggle
#set $truemute --no-startup-id amixer sset Master mute
##For spotify
#set $music spotify
#set $pause dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause
#set $trupause dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Pause
#set $play dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Play
#set $next dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next
#set $prev dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous
#set $lilfor dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Seek
#set $bigfor dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Seek(
# For moc:
#set $music --no-startup-id st -e mocp
#set $pause --no-startup-id mocp -G
#set $truepause --no-startup-id mocp -P
#set $next --no-startup-id mocp -f
#set $prev --no-startup-id mocp -r
#set $lilfor --no-startup-id mocp -k 10
#set $bigfor --no-startup-id mocp -k 120
#set $lilbak --no-startup-id mocp -k -10
#set $bigbak --no-startup-id mocp -k -120
#set $beg --no-startup-id mocp -j 0%
# For cmus:
#set $music --no-startup-id st -e cmus
#set $pause --no-startup-id cmus-remote -u
#set $next --no-startup-id cmus-remote -n
#set $prev --no-startup-id cmus-remote -r
#set $lilfor --no-startup-id cmus-remote -k +10
#set $bigfor --no-startup-id cmus-remote -k +120
#set $lilbak --no-startup-id cmus-remote -k -10
#set $bigbak --no-startup-id cmus-remote -k -120
#set $beg --no-startup-id cmus-remote -k 00:00:00

View file

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 7.7 KiB

View file

@ -1,16 +0,0 @@
#!/bin/sh
#!/usr/bin/env sh
# Terminate already running bar instances
killall -q polybar
# Wait until the processes have been shut down
while pgrep -x polybar >/dev/null; do sleep 1; done
# Launch bar1 and bar2
#polybar example &
for i in $(polybar -m | awk -F: '{print $1}'); do MONITOR=$i polybar example -c ~/.config/polybar/config & done
feh --bg-scale ~/.config/wall.png
echo "Bars launched..."

View file

@ -1,6 +0,0 @@
#!/bin/sh
# Display contents of selection via dunst if running.
# Separate script for i3.
pgrep -x dunst >/dev/null && notify-send "$(xclip -o -selection clipboard)"

2
.vimrc
View file

@ -110,7 +110,7 @@ let mapleader =" "
autocmd BufWritePre * %s/\s\+$//e
" When shortcut files are updated, renew bash and ranger configs with new material:
autocmd BufWritePost ~/.scripts/folders,~/.scripts/configs !bash ~/.scripts/shortcuts.sh
autocmd BufWritePost ~/.key_directories,~/.key_files !bash ~/.scripts/tools/shortcuts
" Runs a script that cleans out tex build files whenever I close out of a .tex file.
autocmd VimLeave *.tex !texclear %