From e4dae72d77b88eb9248820dd10383359ffd9fc89 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Mon, 14 Oct 2019 13:31:53 +0100 Subject: [PATCH] Add menu to change screen layouts --- files/bin/rofi-screenlayout | 15 +++++++++++++++ files/i3.conf | 1 + files/screen-layouts/DabApps/desk.sh | 2 ++ files/screen-layouts/DabApps/macbook.sh | 2 ++ tasks/i3.yml | 8 ++++++++ 5 files changed, 28 insertions(+) create mode 100755 files/bin/rofi-screenlayout create mode 100755 files/screen-layouts/DabApps/desk.sh create mode 100755 files/screen-layouts/DabApps/macbook.sh diff --git a/files/bin/rofi-screenlayout b/files/bin/rofi-screenlayout new file mode 100755 index 0000000..798f0c2 --- /dev/null +++ b/files/bin/rofi-screenlayout @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +set -e + +LAYOUTS_DIR=$HOME/.config/screen-layouts +IFS= +layouts=$(find $LAYOUTS_DIR -name "*.sh" | xargs realpath --relative-to $LAYOUTS_DIR) + +chosen_layout=$(echo -e $layouts | rofi -dmenu -p "Select Layout" -no-custom -lines 5) +chosen_layout_file="${LAYOUTS_DIR}/${chosen_layout}" + +echo "Setting layout to ${chosen_layout}" +bash $chosen_layout_file + +i3-msg restart diff --git a/files/i3.conf b/files/i3.conf index d3d1d33..7077a8d 100644 --- a/files/i3.conf +++ b/files/i3.conf @@ -40,6 +40,7 @@ bindsym Control+Shift+Escape exec --no-startup-id gnome-system-monitor bindsym Control+Q exec --no-startup-id /bin/false bindsym $mod+Shift+Delete exec --no-startup-id rofi-powermenu bindcode 124 exec --no-startup-id rofi-powermenu +bindsym $mod+P exec --no-startup-id rofi-screenlayout # Screenshots diff --git a/files/screen-layouts/DabApps/desk.sh b/files/screen-layouts/DabApps/desk.sh new file mode 100755 index 0000000..cdc93a1 --- /dev/null +++ b/files/screen-layouts/DabApps/desk.sh @@ -0,0 +1,2 @@ +#!/bin/sh +xrandr --output eDP-1 --primary --mode 1920x1200 --pos 0x322 --rotate normal --output DP-1 --off --output HDMI-1 --mode 1920x1080 --pos 3839x0 --rotate normal --output DP-2 --off --output HDMI-2 --mode 1920x1080 --pos 1920x0 --rotate normal diff --git a/files/screen-layouts/DabApps/macbook.sh b/files/screen-layouts/DabApps/macbook.sh new file mode 100755 index 0000000..27c0d63 --- /dev/null +++ b/files/screen-layouts/DabApps/macbook.sh @@ -0,0 +1,2 @@ +#!/bin/sh +xrandr --output eDP-1 --primary --mode 1920x1200 --pos 0x322 --rotate normal --output DP-1 --off --output HDMI-1 --off --output DP-2 --off --output HDMI-2 --off diff --git a/tasks/i3.yml b/tasks/i3.yml index 63a11d1..b5f11ad 100644 --- a/tasks/i3.yml +++ b/tasks/i3.yml @@ -96,3 +96,11 @@ dest: /usr/bin/pranklock mode: 0755 force: true + +- name: Install Screen Layouts + copy: + src: ./files/screen-layouts + dest: "{{ home }}/.config" + mode: 0755 + directory_mode: 0755 + owner: "{{ user }}"