diff --git a/private_dot_config/awesome/rc.lua b/private_dot_config/awesome/rc.lua index 3fb60f6..bc70073 100644 --- a/private_dot_config/awesome/rc.lua +++ b/private_dot_config/awesome/rc.lua @@ -257,11 +257,19 @@ globalkeys = gears.table.join( function() awful.spawn.with_shell('pactl set-sink-volume `pactl get-default-sink` -5%') end, { description = "decrease the volume", group = "volume" }), + -- Monitor change + awful.key({ modkey, "Control" }, "m", + function() + awful.spawn.spawn('/home/chips/.local/bin/chdp') + awesome.restart() + end, + { description = "change active monitor", group = "display" }), + -- Lock screen awful.key({ modkey }, "q", function() awful.spawn.with_shell('dm-tool lock') end, { description = "lock", group = "power" }), - -- Polybar + -- Polybar awful.key({ modkey }, "p", function() awful.spawn.with_shell('polybar-msg cmd toggle') end, { description = "toggle polybar", group = "system" }) ) diff --git a/private_dot_local/bin/executable_chdp b/private_dot_local/bin/executable_chdp new file mode 100644 index 0000000..c0da625 --- /dev/null +++ b/private_dot_local/bin/executable_chdp @@ -0,0 +1,16 @@ +#!/bin/bash +small=HDMI-0 +big=DP-1 + +small_used=`xrandr --listactivemonitors | grep "$small"` +small_used_len=${#small_used} +echo $small_used_len + +current=$small +next=$big +if [[ small_used_len -eq 0 ]]; then + current=$big + next=$small +fi + +xrandr --output "$current" --off --output "$next" --auto