Swayscript : Toggle monitor under cursor instead.
This commit is contained in:
parent
4be21ab783
commit
edca25ead8
|
@ -1,44 +0,0 @@
|
|||
{ ... }: {
|
||||
text = ''
|
||||
# Enable Gaming.
|
||||
function gamingon() {
|
||||
on() {
|
||||
swaymsg "output \"Huawei Technologies Co., Inc. ZQE-CBA 0xC080F622\" adaptive_sync on"
|
||||
# swaymsg "output \"Huawei Technologies Co., Inc. ZQE-CBA 0xC080F622\" mode 3440x1440@164.999Hz"
|
||||
swaymsg "output \"AOC 24G2W1G4 ATNL61A129625\" adaptive_sync on"
|
||||
# swaymsg "output \"AOC 24G2W1G4 ATNL61A129625\" mode 1920x1080@144.000Hz"
|
||||
_gamingstate on
|
||||
}
|
||||
_sway_iterate_sockets on
|
||||
}
|
||||
|
||||
# Disable Gaming.
|
||||
function gamingoff() {
|
||||
off() {
|
||||
swaymsg "output \"Huawei Technologies Co., Inc. ZQE-CBA 0xC080F622\" adaptive_sync off"
|
||||
# swaymsg "output \"Huawei Technologies Co., Inc. ZQE-CBA 0xC080F622\" mode 3440x1440@59.973Hz"
|
||||
swaymsg "output \"AOC 24G2W1G4 ATNL61A129625\" adaptive_sync off"
|
||||
# swaymsg "output \"AOC 24G2W1G4 ATNL61A129625\" mode 1920x1080@60.000Hz"
|
||||
_gamingstate off
|
||||
}
|
||||
_sway_iterate_sockets off
|
||||
}
|
||||
|
||||
# Toggle gaming.
|
||||
function gamingtoggle() {
|
||||
if [[ "$(_gamingstate)" = "on" ]]; then
|
||||
gamingoff
|
||||
else
|
||||
gamingon
|
||||
fi
|
||||
}
|
||||
|
||||
function _gamingstate() {
|
||||
if [[ "''${1}" = "" ]]; then
|
||||
cat /tmp/.gamingstate 2> /dev/null || echo off
|
||||
else
|
||||
echo "''${*}" > /tmp/.gamingstate
|
||||
fi
|
||||
}
|
||||
'';
|
||||
}
|
|
@ -3,11 +3,8 @@
|
|||
# Enable monitors.
|
||||
function monon() {
|
||||
on() {
|
||||
swaymsg "output \"ASUSTek COMPUTER INC ASUS VA24E R2LMTF127165\" power on" # Desktop monitor.
|
||||
swaymsg "output \"AU Optronics 0x418D Unknown\" power on" # Work monitor.
|
||||
swaymsg "output \"AOC 24G2W1G4 ATNL61A129625\" power on" # Dasha monitor.
|
||||
swaymsg "output \"Chimei Innolux Corporation 0x1521 Unknown\" power on" # Laptop monitor.
|
||||
_monstate on
|
||||
local output=$(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .name')
|
||||
swaymsg "output \"''${output}\" power on"
|
||||
}
|
||||
_sway_iterate_sockets on
|
||||
}
|
||||
|
@ -15,11 +12,8 @@
|
|||
# Disable monitors.
|
||||
function monoff() {
|
||||
off() {
|
||||
swaymsg "output \"ASUSTek COMPUTER INC ASUS VA24E R2LMTF127165\" power off" # Desktop monitor.
|
||||
swaymsg "output \"AU Optronics 0x418D Unknown\" power off" # Work monitor.
|
||||
swaymsg "output \"AOC 24G2W1G4 ATNL61A129625\" power off" # Dasha monitor.
|
||||
swaymsg "output \"Chimei Innolux Corporation 0x1521 Unknown\" power off" # Laptop monitor.
|
||||
_monstate off
|
||||
local output=$(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .name')
|
||||
swaymsg "output \"''${output}\" power off"
|
||||
}
|
||||
_sway_iterate_sockets off
|
||||
}
|
||||
|
@ -47,15 +41,62 @@
|
|||
}
|
||||
|
||||
function _monstate() {
|
||||
if [[ "''${1}" = "" ]]; then
|
||||
cat /tmp/.monstate 2> /dev/null || echo on
|
||||
else
|
||||
echo "''${*}" > /tmp/.monstate
|
||||
fi
|
||||
local outputs=($(swaymsg -t get_outputs | jq -r '.[] | .power'))
|
||||
|
||||
for state in "''${outputs[@]}"; do
|
||||
''${state} || {
|
||||
echo off
|
||||
return 1
|
||||
}
|
||||
done
|
||||
|
||||
echo on
|
||||
return 0
|
||||
}
|
||||
|
||||
function _recording() {
|
||||
[[ "$(ps cax | rg wf-recorder)" = "" ]] && echo off || echo on
|
||||
}
|
||||
|
||||
# Enable Gaming.
|
||||
function gamingon() {
|
||||
on() {
|
||||
swaymsg "output \"Huawei Technologies Co., Inc. ZQE-CBA 0xC080F622\" adaptive_sync on"
|
||||
# swaymsg "output \"Huawei Technologies Co., Inc. ZQE-CBA 0xC080F622\" mode 3440x1440@164.999Hz"
|
||||
swaymsg "output \"AOC 24G2W1G4 ATNL61A129625\" adaptive_sync on"
|
||||
# swaymsg "output \"AOC 24G2W1G4 ATNL61A129625\" mode 1920x1080@144.000Hz"
|
||||
_gamingstate on
|
||||
}
|
||||
_sway_iterate_sockets on
|
||||
}
|
||||
|
||||
# Disable Gaming.
|
||||
function gamingoff() {
|
||||
off() {
|
||||
swaymsg "output \"Huawei Technologies Co., Inc. ZQE-CBA 0xC080F622\" adaptive_sync off"
|
||||
# swaymsg "output \"Huawei Technologies Co., Inc. ZQE-CBA 0xC080F622\" mode 3440x1440@59.973Hz"
|
||||
swaymsg "output \"AOC 24G2W1G4 ATNL61A129625\" adaptive_sync off"
|
||||
# swaymsg "output \"AOC 24G2W1G4 ATNL61A129625\" mode 1920x1080@60.000Hz"
|
||||
_gamingstate off
|
||||
}
|
||||
_sway_iterate_sockets off
|
||||
}
|
||||
|
||||
# Toggle gaming.
|
||||
function gamingtoggle() {
|
||||
if [[ "$(_gamingstate)" = "on" ]]; then
|
||||
gamingoff
|
||||
else
|
||||
gamingon
|
||||
fi
|
||||
}
|
||||
|
||||
function _gamingstate() {
|
||||
if [[ "''${1}" = "" ]]; then
|
||||
cat /tmp/.gamingstate 2> /dev/null || echo off
|
||||
else
|
||||
echo "''${*}" > /tmp/.gamingstate
|
||||
fi
|
||||
}
|
||||
'';
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue