From 1cc83940d7c28ea4adcd921b8bd5d346cca4c99e Mon Sep 17 00:00:00 2001 From: Pim Kunis Date: Mon, 6 Mar 2023 23:33:29 +0100 Subject: [PATCH] easier screen configuration --- README.md | 3 +-- roles/i3/files/autorandr/home/config | 14 ++++++++++++++ roles/i3/files/autorandr/home/setup | 2 ++ roles/i3/files/autorandr/mobile/config | 14 ++++++++++++++ roles/i3/files/autorandr/mobile/setup | 1 + roles/i3/files/config | 13 ++----------- roles/i3/files/scripts/home.sh | 2 -- roles/i3/files/scripts/load.sh | 3 +++ roles/i3/files/scripts/mobile.sh | 2 -- roles/i3/tasks/main.yml | 4 ++++ 10 files changed, 41 insertions(+), 17 deletions(-) create mode 100644 roles/i3/files/autorandr/home/config create mode 100644 roles/i3/files/autorandr/home/setup create mode 100644 roles/i3/files/autorandr/mobile/config create mode 100644 roles/i3/files/autorandr/mobile/setup delete mode 100755 roles/i3/files/scripts/home.sh create mode 100755 roles/i3/files/scripts/load.sh delete mode 100755 roles/i3/files/scripts/mobile.sh diff --git a/README.md b/README.md index 7414c95..1e0b57d 100644 --- a/README.md +++ b/README.md @@ -12,8 +12,7 @@ My current setup is [Debian Bullseye](https://www.debian.org/releases/bullseye/) - thunderbird config (pretty hard to do, should just capture steps taken somewhere) - firefox config? extensions? host own synchronizer? -- fix suspend -- Better randr profiles using autorandr: https://github.com/phillipberndt/autorandr +- Daemon to restore wallpaper? #### Neovim diff --git a/roles/i3/files/autorandr/home/config b/roles/i3/files/autorandr/home/config new file mode 100644 index 0000000..2e22e14 --- /dev/null +++ b/roles/i3/files/autorandr/home/config @@ -0,0 +1,14 @@ +output HDMI-1 +off +output DP-2 +off +output HDMI-2 +off +output eDP-1 +off +output DP-1 +crtc 0 +mode 1920x1200 +pos 0x0 +primary +rate 59.95 diff --git a/roles/i3/files/autorandr/home/setup b/roles/i3/files/autorandr/home/setup new file mode 100644 index 0000000..cd146ab --- /dev/null +++ b/roles/i3/files/autorandr/home/setup @@ -0,0 +1,2 @@ +DP-1 00ffffffffffff0010ac7ba05333593219180104a53420783aee95a3544c99260f5054a1080081408180a940b300d1c0010101010101283c80a070b023403020360006442100001a000000ff003046465844343649325933530a000000fc0044454c4c2055323431324d0a20000000fd00323d1e5311000a20202020202000a6 +eDP-1 00ffffffffffff000dae39120000000006190104a51c1078025d45965852982726505400000001010101010101010101010101010101363680a0703820402e1e2400149b1000001a000000fe004e3132354843452d474e310a20000000fe00434d4e0a202020202020202020000000fe004e3132354843452d474e310a200091 diff --git a/roles/i3/files/autorandr/mobile/config b/roles/i3/files/autorandr/mobile/config new file mode 100644 index 0000000..09ed68a --- /dev/null +++ b/roles/i3/files/autorandr/mobile/config @@ -0,0 +1,14 @@ +output DP-1 +off +output HDMI-1 +off +output DP-2 +off +output HDMI-2 +off +output eDP-1 +crtc 0 +mode 1920x1080 +pos 0x0 +primary +rate 60.00 diff --git a/roles/i3/files/autorandr/mobile/setup b/roles/i3/files/autorandr/mobile/setup new file mode 100644 index 0000000..0283598 --- /dev/null +++ b/roles/i3/files/autorandr/mobile/setup @@ -0,0 +1 @@ +eDP-1 00ffffffffffff000dae39120000000006190104a51c1078025d45965852982726505400000001010101010101010101010101010101363680a0703820402e1e2400149b1000001a000000fe004e3132354843452d474e310a20000000fe00434d4e0a202020202020202020000000fe004e3132354843452d474e310a200091 diff --git a/roles/i3/files/config b/roles/i3/files/config index 8360f96..643cf08 100644 --- a/roles/i3/files/config +++ b/roles/i3/files/config @@ -23,7 +23,7 @@ exec --no-startup-id xss-lock --transfer-sleep-lock -- ~/.config/i3/scripts/lock # and nm-applet is a desktop environment-independent system tray GUI for it. exec --no-startup-id nm-applet -exec --no-startup-id nitrogen --restore +exec --no-startup-id ~/.config/i3/scripts/load.sh exec --no-startup-id keepassxc @@ -138,16 +138,7 @@ bar { focus_follows_mouse no -# Screen picker -set $mode_screen Screen layout: [h]ome [m]obile -bindsym $mod+s mode "$mode_screen" -mode "$mode_screen" { - bindsym h exec --no-startup-id ~/.config/i3/scripts/home.sh, mode "default" - bindsym m exec --no-startup-id ~/.config/i3/scripts/mobile.sh, mode "default" - - bindsym Escape mode "default" - bindsym Return mode "default" -} +bindsym $mod+s exec --no-startup-id ~/.config/i3/scripts/load.sh # Session options set $mode_session Session option: [l]ock [r]eboot [s]uspend [p]oweroff [e]xit diff --git a/roles/i3/files/scripts/home.sh b/roles/i3/files/scripts/home.sh deleted file mode 100755 index 9575c28..0000000 --- a/roles/i3/files/scripts/home.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -xrandr --output eDP-1 --off --output DP-1 --primary --mode 1920x1200 --pos 0x0 --rotate normal --output HDMI-1 --off --output DP-2 --off --output HDMI-2 --off && nitrogen --restore diff --git a/roles/i3/files/scripts/load.sh b/roles/i3/files/scripts/load.sh new file mode 100755 index 0000000..90e3e57 --- /dev/null +++ b/roles/i3/files/scripts/load.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +autorandr --change && nitrogen --restore diff --git a/roles/i3/files/scripts/mobile.sh b/roles/i3/files/scripts/mobile.sh deleted file mode 100755 index 1cd8508..0000000 --- a/roles/i3/files/scripts/mobile.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -xrandr --output eDP-1 --primary --mode 1920x1080 --pos 0x0 --rotate normal --output DP-1 --off --output HDMI-1 --off --output DP-2 --off --output HDMI-2 --off && nitrogen --restore diff --git a/roles/i3/tasks/main.yml b/roles/i3/tasks/main.yml index 263bad5..5882624 100644 --- a/roles/i3/tasks/main.yml +++ b/roles/i3/tasks/main.yml @@ -47,3 +47,7 @@ option: HandleLidSwitch value: suspend no_extra_spaces: true +- name: Copy autorandr configuration + copy: + src: "{{ role_path }}/files/autorandr/" + dest: ~/.config