Add other fish functions

This commit adds fish support for the other functions I used to use in
zsh. Since my dotfiles are now separated by environment, it's easy to
see which environment depends on which dotfiles, instead of stowing them
one by one based on software name.
This commit is contained in:
Donovan Glover 2018-09-07 14:15:59 -04:00
parent cb4278514d
commit 70757528fc
No known key found for this signature in database
GPG Key ID: 8FC5F7D90A5D8F4D
3 changed files with 42 additions and 0 deletions

View File

@ -0,0 +1,7 @@
# Easily change the resolution to 1080p
# Note: Also changes DPI, but not for the programs you already have open.
function 1080p
xrandr --output VGA-1 --mode "1920x1080" # Change the resolution
sed -i '/Xft.dpi/c\Xft.dpi: 96' ~/.Xresources # Change the dpi line to 96
xrdb ~/.Xresources # Reload .Xresources
end

View File

@ -0,0 +1,24 @@
# Easily change the resolution to 4k
# Note: Also changes DPI, but not for the programs you already have open.
# TODO: Change this script to support fish
function 4k
# Get the display type (VGA-1, etc.)
local display=$(xrandr | grep -Eo ".{0,20} connected" | awk '{print $1}')
# Get the default mode name for 4k
local mode=$(cvt 3840 2160 | grep "Modeline" | awk '{print $2}')
# If the 4k mode hasn't been added yet
if not (xrandr | grep -q 3840x2160)
# Create the new mode with cvt settings
xrandr --newmode $(cvt 3840 2160 | grep -o '"3840x2160.*')
# Add the new mode to the display with xrandr
xrandr --addmode ${display} ${mode}
end
xrandr --output ${display} --mode ${mode} # Change the resolution to 4k
sed -i '/Xft.dpi/c\Xft.dpi: 180' ~/.Xresources # Change the dpi line to 180
xrdb ~/.Xresources # Reload .Xresources
end

View File

@ -0,0 +1,11 @@
# Easily clone and cd into GitLab repositories
# Usage: lab username/repository
function lab --argument-names "path"
if test -n "$path"
git clone git@gitlab.com:$path.git
cd (basename "$path")
else
echo "No repository was specified."
echo "Usage: lab username/repository"
end
end