Reset old config
This commit is contained in:
37
bin/scripts/backlight
Executable file
37
bin/scripts/backlight
Executable file
@ -0,0 +1,37 @@
|
||||
#!/usr/bin/fish
|
||||
#
|
||||
# Usage:
|
||||
# backlight get
|
||||
# backlight set [value]
|
||||
# backlight max
|
||||
#
|
||||
# Returns:
|
||||
# Set - nothing
|
||||
# Get, max - Number between 0 and 100 (eg: 0, 25.445283, 100)
|
||||
#
|
||||
|
||||
function backlight
|
||||
switch $argv[1]
|
||||
case "get"
|
||||
xbacklight -get
|
||||
case "max"
|
||||
echo 100
|
||||
case "set"
|
||||
xbacklight -set $argv[2]
|
||||
case "up"
|
||||
xbacklight -inc 10
|
||||
case "down"
|
||||
xbacklight -dec 10
|
||||
case "*"
|
||||
echo "Unknown function \"$argv[1]\""
|
||||
echo ""
|
||||
echo "Usage:"
|
||||
echo " backlight get"
|
||||
echo " backlight set [value]"
|
||||
echo " backlight max"
|
||||
return 0
|
||||
end
|
||||
return 1
|
||||
end
|
||||
|
||||
backlight $argv
|
8
bin/scripts/battery
Executable file
8
bin/scripts/battery
Executable file
@ -0,0 +1,8 @@
|
||||
#!/usr/bin/fish
|
||||
# returns battery percentage and status
|
||||
# 45%, discharging
|
||||
# second parameter returns "fully" when fully charged. Since awesome only checks for "discharging," fixing that isn't necessary.
|
||||
|
||||
echo \
|
||||
(upower --show-info /org/freedesktop/UPower/devices/battery_BAT1 | grep percentage | grep -Po "(\d\d?\d?)%"), \
|
||||
(upower --show-info /org/freedesktop/UPower/devices/battery_BAT1 | grep state | grep -Po "(?<=state:)\s*(\w*)" | xargs) \
|
74
bin/scripts/capture
Executable file
74
bin/scripts/capture
Executable file
@ -0,0 +1,74 @@
|
||||
#!/usr/bin/fish
|
||||
#
|
||||
# Screenshot wrapper
|
||||
#
|
||||
# Take a screenshot of a
|
||||
# region, window, or screen
|
||||
# and
|
||||
# save it to $dest
|
||||
# copy it to the clipboard
|
||||
# pipe it through tesseract and xclip the result
|
||||
|
||||
|
||||
function capture
|
||||
# Screenshot save location
|
||||
set dest $HOME/Screenshots/
|
||||
|
||||
#set tmp_file (mktemp --tmpdir "scrot-tmp-XXX.png")
|
||||
set tmp_file "/tmp/scrot-tmp.png"
|
||||
|
||||
# Capture the desired portion of the screen
|
||||
switch $argv[1]
|
||||
case window
|
||||
scrot --overwrite --silent --focused $tmp_file
|
||||
case screen
|
||||
scrot --overwrite --silent $tmp_file
|
||||
case region
|
||||
scrot --overwrite --silent --select --freeze --line style=dash,width=2 $tmp_file
|
||||
case "*"
|
||||
echo "Unknown source \"$argv[1]\""
|
||||
echo ""
|
||||
echo "Usage: capture [source] [target]"
|
||||
echo " Valid sources: window, screen, region"
|
||||
echo " Valid targets: save, copy, ocr"
|
||||
return 0
|
||||
end
|
||||
|
||||
# Output to the desired location
|
||||
switch $argv[2]
|
||||
case save
|
||||
set fname (md5sum $tmp_file | cut -c 1-32)
|
||||
mv $tmp_file "$dest$fname.png"
|
||||
|
||||
case copy
|
||||
# Don't use the mktmp file here, since we can't clean
|
||||
# it away immediately. Use the fixed /tmp/scrot-clip insead.
|
||||
# (Only applicable when a mktemp file is being used)
|
||||
#rm $tmp_file
|
||||
#set tmp_file /tmp/scrot-clip.png
|
||||
|
||||
xclip -i -selection clipboard -t "image/png" $tmp_file
|
||||
|
||||
case ocr
|
||||
# Recognize text
|
||||
set ocr (tesseract --dpi 96 -l eng $tmp_file stdout)
|
||||
|
||||
# Trim whitespace and copy to clipboard
|
||||
echo $ocr | sed -e "s/^[ \t]*//" | xclip -i -rmlastnl -selection clipboard
|
||||
rm $tmp_file
|
||||
|
||||
case "*"
|
||||
echo "Unknown target \"$argv[2]\""
|
||||
echo ""
|
||||
echo "Usage: capture [source] [target]"
|
||||
echo " Valid sources: window, screen, region"
|
||||
echo " Valid targets: save, copy, ocr"
|
||||
return 0
|
||||
end
|
||||
|
||||
return 1
|
||||
end
|
||||
|
||||
# Awesomewm refuses to execute this without a sleep.
|
||||
sleep 0.1
|
||||
capture $argv
|
Reference in New Issue
Block a user