diff options
author | Amin Bandali <bandali@gnu.org> | 2020-04-11 22:45:06 -0400 |
---|---|---|
committer | Amin Bandali <bandali@gnu.org> | 2020-04-11 22:45:06 -0400 |
commit | 5d3bd4099ecff7b02454efcb6f6bb355a992aef8 (patch) | |
tree | 542fdedd6259e91cec7ada5fc3783b9476c29c33 /.local/bin | |
parent | e5e4450f889a82197d845cc06a63fcb3e740583d (diff) | |
download | configs-5d3bd4099ecff7b02454efcb6f6bb355a992aef8.tar.gz configs-5d3bd4099ecff7b02454efcb6f6bb355a992aef8.tar.xz configs-5d3bd4099ecff7b02454efcb6f6bb355a992aef8.zip |
move scripts from ~/.local/bin to rc.org
Diffstat (limited to '')
-rwxr-xr-x | .local/bin/battery-percentage-time | 22 | ||||
-rwxr-xr-x | .local/bin/emcl | 2 | ||||
-rwxr-xr-x | .local/bin/my-i3status | 70 | ||||
-rwxr-xr-x | .local/bin/rofi-light | 5 | ||||
-rwxr-xr-x | .local/bin/rofi-remmina | 31 | ||||
-rwxr-xr-x | .local/bin/toggle-presentation-mode | 3 | ||||
-rwxr-xr-x | .local/bin/toggle-tablet | 32 | ||||
-rwxr-xr-x | .local/bin/volume-info | 9 | ||||
-rwxr-xr-x | .local/bin/zathura-sync | 8 |
9 files changed, 0 insertions, 182 deletions
diff --git a/.local/bin/battery-percentage-time b/.local/bin/battery-percentage-time deleted file mode 100755 index b0122a8..0000000 --- a/.local/bin/battery-percentage-time +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh - -dbus_send() { - label=$1 - dbus-send --print-reply=literal --system \ - --dest=org.freedesktop.UPower \ - /org/freedesktop/UPower/devices/battery_BAT0 \ - org.freedesktop.DBus.Properties.Get \ - string:org.freedesktop.UPower.Device \ - string:"${label}" | awk '{print $3}' -} - -perc=$(dbus_send 'Percentage') -state=$(dbus_send 'State') - -if [ "$state" -eq 2 ]; then # Discharging - secs=$(dbus_send 'TimeToEmpty') -elif [ "$state" -eq 1 ]; then # Charging - secs=$(dbus_send 'TimeToFull') -fi - -printf '%s%%%%%2dh%02dm \n' "$perc" $((secs / 3600)) $((secs % 3600 / 60)) diff --git a/.local/bin/emcl b/.local/bin/emcl deleted file mode 100755 index b0f2de2..0000000 --- a/.local/bin/emcl +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exec emacsclient --alternate-editor="" -c "$@" diff --git a/.local/bin/my-i3status b/.local/bin/my-i3status deleted file mode 100755 index 2831c15..0000000 --- a/.local/bin/my-i3status +++ /dev/null @@ -1,70 +0,0 @@ -#!/usr/bin/env python2 -# -*- coding: utf-8 -*- - -# This script is a simple wrapper which prefixes each i3status line with custom -# information. It is based on: -# https://github.com/i3/i3status/blob/master/contrib/wrapper.py -# -# In ~/.i3status.conf, add the following line: -# output_format = "i3bar" -# in the 'general' section. -# Then, in ~/.config/i3/config or ~/.config/sway/config add: -# status_command i3status | my-i3status.py -# in the 'bar' section. Make sure my-i3status.py is in $PATH. -# -# © 2012 Valentin Haenel <valentin.haenel@gmx.de> -# © 2018 Amin Bandali <bandali@gnu.org> -# -# This program is free software. It comes without any warranty, to the extent -# permitted by applicable law. You can redistribute it and/or modify it under -# the terms of the Do What The Fuck You Want To Public License (WTFPL), Version -# 2, as published by Sam Hocevar. See http://sam.zoy.org/wtfpl/COPYING for more -# details. - -import sys -import json -import os - -def get_nosleep(): - """ Return true if ~/.nosleep exists. """ - return os.path.isfile(os.path.expanduser("~/.nosleep")) - -def print_line(message): - """ Non-buffered printing to stdout. """ - sys.stdout.write(message + '\n') - sys.stdout.flush() - -def read_line(): - """ Interrupted respecting reader for stdin. """ - # try reading a line, removing any extra whitespace - try: - line = sys.stdin.readline().strip() - # i3status sends EOF, or an empty line - if not line: - sys.exit(3) - return line - # exit on ctrl-c - except KeyboardInterrupt: - sys.exit() - -if __name__ == '__main__': - # Skip the first line which contains the version header. - print_line(read_line()) - - # The second line contains the start of the infinite array. - print_line(read_line()) - - while True: - line, prefix = read_line(), '' - # ignore comma at start of lines - if line.startswith(','): - line, prefix = line[1:], ',' - - if get_nosleep(): - j = json.loads(line) - # insert information into the start of the json, but could be anywhere - j.insert(0, {'full_text' : '•', 'name' : 'nosleep'}) - # and echo back new encoded json - print_line(prefix+json.dumps(j)) - else: - print_line(prefix+line) diff --git a/.local/bin/rofi-light b/.local/bin/rofi-light deleted file mode 100755 index f2a46af..0000000 --- a/.local/bin/rofi-light +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -cur=$(light -G) -val=$(rofi -dmenu -mesg "light $cur" -p "light -S " -l 0 -width 12) -[ -n "$val" ] && light -S "$val" diff --git a/.local/bin/rofi-remmina b/.local/bin/rofi-remmina deleted file mode 100755 index 153a5a6..0000000 --- a/.local/bin/rofi-remmina +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env python2 - -import ConfigParser -import os -from subprocess import Popen, PIPE - -remmina_dir = os.path.expanduser("~/.local/share/remmina") - -fdict = dict() - -for f in os.listdir(remmina_dir): - fp = os.path.join(remmina_dir, f) - c = ConfigParser.ConfigParser() - c.read(fp) - n = c.get('remmina', 'name') - fdict[n] = fp - -lines = max(min(15, len(fdict)), 1); -width = len(max(fdict.keys(), key=len)) -rofi = Popen(["rofi", "-i", "-dmenu", \ - "-l", str(lines), "-width", str(width), \ - "-p", "connection"], stdout=PIPE, stdin=PIPE) -selected = rofi.communicate("\n" \ - .join(fdict.keys()) \ - .encode("utf-8"))[0] \ - .decode("utf-8") \ - .strip() -rofi.wait() - -r = Popen(["remmina", "-c", fdict[selected]]) -r.wait() diff --git a/.local/bin/toggle-presentation-mode b/.local/bin/toggle-presentation-mode deleted file mode 100755 index 400084f..0000000 --- a/.local/bin/toggle-presentation-mode +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/presentation-mode -T diff --git a/.local/bin/toggle-tablet b/.local/bin/toggle-tablet deleted file mode 100755 index 819af42..0000000 --- a/.local/bin/toggle-tablet +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh - -# This script toggles between a 'normal' mode and a 'tablet' mode, doing -# a few things: - -# - rotates the screen using =xrandr=, so that rotating the physical -# display of my X220t would have the laptop's battery on the right -# hand side, -# - enables touch screen, -# - properly rotates the stylus pen and touch screen pointers, and -# - toggles between RGB and Vertical BGR sub-pixel order. - -case $(xfconf-query -c pointers -p /Wacom_ISDv4_E6_Pen_stylus/Properties/Wacom_Rotation) in - 0) # Screen is not rotated, we should rotate it right (90°) - xrandr -o 3 - xfconf-query -c pointers -p /Wacom_ISDv4_E6_Pen_stylus/Properties/Wacom_Rotation -s 1 - xfconf-query -c pointers -p /Wacom_ISDv4_E6_Finger_touch/Properties/Device_Enabled -s 1 - xfconf-query -c pointers -p /Wacom_ISDv4_E6_Finger_touch/Properties/Wacom_Rotation -s 1 - xfconf-query -c xsettings -p /Xft/RGBA -s vbgr - ;; - 1) # Currently top is rotated right, we should set it normal (0°) - xrandr -o 0 - xfconf-query -c pointers -p /Wacom_ISDv4_E6_Pen_stylus/Properties/Wacom_Rotation -s 0 - xfconf-query -c pointers -p /Wacom_ISDv4_E6_Finger_touch/Properties/Wacom_Rotation -s 0 - xfconf-query -c pointers -p /Wacom_ISDv4_E6_Finger_touch/Properties/Device_Enabled -s 0 - xfconf-query -c xsettings -p /Xft/RGBA -s rgb - ;; - *) - echo "Unknown result from 'xfconf-query -c pointers -p /Wacom_ISDv4_E6_Pen_stylus/Properties/Wacom_Rotation'" >&2 - exit 1 - ;; -esac diff --git a/.local/bin/volume-info b/.local/bin/volume-info deleted file mode 100755 index d87137e..0000000 --- a/.local/bin/volume-info +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -cur_vol=$(pamixer --get-volume) - -if [ $(pamixer --get-mute) = true ]; then - printf 'mt \n' "$cur_vol" -else - printf '%02d \n' "$cur_vol" -fi diff --git a/.local/bin/zathura-sync b/.local/bin/zathura-sync deleted file mode 100755 index 4384ffe..0000000 --- a/.local/bin/zathura-sync +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -pos="$1" -pdffile="$2" -zathura --synctex-forward "$pos" "$pdffile" || \ - ( - zathura -x "emacsclient --eval '(progn (switch-to-buffer (file-name-nondirectory \"%{input}\")) (goto-line %{line}))'" "$pdffile" & - sleep 1; zathura --synctex-forward "$pos" "$pdffile" ) |