From 9625169175ccfbf1194ef43f5b121a7cfb2da74f Mon Sep 17 00:00:00 2001 From: lelgenio Date: Fri, 21 May 2021 01:27:05 -0300 Subject: [PATCH] sway: add displays and shutdown bind --- dotfiles/scripts/sway-displays | 24 ++++++++++++++++++++++++ dotfiles/sway/keys-run | 6 ++++++ 2 files changed, 30 insertions(+) create mode 100755 dotfiles/scripts/sway-displays diff --git a/dotfiles/scripts/sway-displays b/dotfiles/scripts/sway-displays new file mode 100755 index 0000000..36304c4 --- /dev/null +++ b/dotfiles/scripts/sway-displays @@ -0,0 +1,24 @@ +#!/bin/sh + +get_displays(){ + swaymsg -t get_outputs | + jq -r 'map(.name)|join("\n")' +} + +actions=( + enable + disable + brightness +) + +action=$(printf "%s\n" "${actions[@]}" | wdmenu) +case "$action" in + enable|disable) + output=$(get_displays | wdmenu -p "output") + swaymsg output "$output" "$action" + ;; + brightness) + brightness=$(seq 0 5 100 | wdmenu -p "Brightness") + light -S "$brightness" + ;; +esac diff --git a/dotfiles/sway/keys-run b/dotfiles/sway/keys-run index 2939767..236ec69 100644 --- a/dotfiles/sway/keys-run +++ b/dotfiles/sway/keys-run @@ -19,6 +19,9 @@ $mod+Control+Return exec {{@@ file_manager @@}} # Insert special characters $mod+g exec emoji +# Insert special characters +$mod+d exec sway-displays + # Kill focused window $mod+x kill @@ -37,6 +40,9 @@ $mod+Shift+c reload # Exit sway Control+Alt+delete exit +# Shutdown +$mod+Alt+delete exec loginctl poweroff || systemctl poweroff + } # vim: ft=i3