Binary instead of definition

This commit is contained in:
Thomas Forgione 2024-03-31 14:01:16 +02:00
parent 52255410e3
commit 1d95300a22
3 changed files with 25 additions and 3 deletions

26
config/xrandr.nu → bin/x Normal file → Executable file
View File

@ -1,5 +1,27 @@
# xrandr wrapper for nushell
def xrandr [] {
#!/usr/bin/env nu
# default view: only main screen
def "main d" [] {
^xrandr --output $env.PRIMARY_SCREEN --mode 2560x1440 --primary --output $env.SECONDARY_SCREEN --off --output HDMI-0 --off
}
# bureau view: both screens side to side
def "main b" [] {
^xrandr --output $env.PRIMARY_SCREEN --mode 2560x1440 --primary --output $env.SECONDARY_SCREEN --mode 1920x1080 --right-of $env.PRIMARY_SCREEN --output HDMI-0 --off
}
# television view: only TV on (720p so that menus are readable)
def "main t" [] {
^xrandr --output $env.PRIMARY_SCREEN --off --output $env.SECONDARY_SCREEN --off --output HDMI-0 --mode 1280x720 --primary
}
# stream view: only secondary screen
def "main s" [] {
^xrandr --output $env.SECONDARY_SCREEN --mode 1920x1080 --primary --output $env.PRIMARY_SCREEN --off
}
def main [] {
mut output = []
mut current_screen = {
name: ""

View File

@ -9,6 +9,5 @@ source ~/.config/nushell/config/update.nu
source ~/.config/nushell/config/gclone.nu
source ~/.config/nushell/config/pass.nu
source ~/.config/nushell/config/docker.nu
source ~/.config/nushell/config/xrandr.nu
source ~/.config/nushell/config/tfetch.nu

1
env.nu
View File

@ -261,6 +261,7 @@ $env.PATH = ($env.PATH
| split row (char esep)
| prepend ('/opt/cuda/bin')
| prepend ($env.HOME + '/.config/polymny/bin')
| prepend ($env.HOME + '/.config/nushell/bin')
| prepend ($env.HOME + '/.config/dotfiles/bin')
| prepend ($env.HOME + '/.config/dotfiles/bin-extra')
| prepend ($env.HOME + '/.cargo/bin')