]> git.friedersdorff.com Git - max/saltfiles.git/commitdiff
Configure all the things
authorMaximilian Friedersdorff <max@friedersdorff.com>
Mon, 3 Oct 2022 15:57:31 +0000 (16:57 +0100)
committerMaximilian Friedersdorff <max@friedersdorff.com>
Mon, 3 Oct 2022 15:57:31 +0000 (16:57 +0100)
states/setup-arch.sls
states/sway/arch.sls
states/sway/files/baryte
states/sway/files/config.jinja
states/sway/files/monitor_switch_sway [new file with mode: 0644]
states/sway/init.sls

index b2579ac0728600b5dc32d4f836db8d869c9e6632..fda05dd49ba9f8b679d09136c58085c7ffb7be18 100644 (file)
@@ -7,6 +7,8 @@ install pulseaudio:
       - pulseaudio
       - git
       - man-db
+      - vifm
+      - devtools
 
 archmirror:
   file.managed:
index e3a00fd0cce2be37b9bbb2316ea628d0b7511d81..44936af764751e2377af1333d5ea8bac3a466814 100644 (file)
@@ -9,6 +9,7 @@ install sway:
       - mako
       - libnotify
       - dmenu
+      - sov
 
 ensure dmenu-wl wrapper:
   file.managed:
index c5bc4d525c932e564cf72844f8a4be648b74f427..e2f7bc04aad2fc39bbae58c9dd6a4c84d983d150 100644 (file)
@@ -76,3 +76,5 @@ workspace 1 output DP-3
 workspace 3 output DP-3
 
 exec dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway
+exec mako&
+exec ~/.local/bin/monitor_switch_sway&
index ac0da0fc34a50897115e69bd0ff01de8f07ccdd2..30724ae742049f54a3c484a7371c6f84d2482c49 100644 (file)
@@ -183,29 +183,17 @@ input 9610:4102:Gaming_KB__Gaming_KB {
 # Workspaces:
 #
     # Switch to workspace
-    bindsym $mod+1 workspace number 1
-    bindsym $mod+2 workspace number 2
-    bindsym $mod+3 workspace number 3
-    bindsym $mod+4 workspace number 4
-    bindsym $mod+5 workspace number 5
-    bindsym $mod+6 workspace number 6
-    bindsym $mod+7 workspace number 7
-    bindsym $mod+8 workspace number 8
-    bindsym $mod+9 workspace number 9
-    bindsym $mod+0 workspace number 10
-    # Move focused container to workspace
-    bindsym $mod+Shift+1 move container to workspace number 1
-    bindsym $mod+Shift+2 move container to workspace number 2
-    bindsym $mod+Shift+3 move container to workspace number 3
-    bindsym $mod+Shift+4 move container to workspace number 4
-    bindsym $mod+Shift+5 move container to workspace number 5
-    bindsym $mod+Shift+6 move container to workspace number 6
-    bindsym $mod+Shift+7 move container to workspace number 7
-    bindsym $mod+Shift+8 move container to workspace number 8
-    bindsym $mod+Shift+9 move container to workspace number 9
-    bindsym $mod+Shift+0 move container to workspace number 10
-    # Note: workspaces can have any name you want, not just numbers.
-    # We just use 1-10 as the default.
+    {% for i in range(10) %}
+        bindsym --no-repeat $mod+{{ i }} workspace number {{ i }}; exec "echo 1 > /tmp/sovpipe"
+        bindsym --release $mod+{{ i }} exec "echo 0 > /tmp/sovpipe"
+
+        # Move focused container to workspace
+        bindsym $mod+Shift+{{ i }} move container to workspace number {{ i }}
+    {% endfor %}
+
+    bindsym --no-repeat $mod+Shift exec "echo 1 > /tmp/sovpipe"
+    bindsym --release $mod+Shift exec "echo 0 > /tmp/sovpipe"
+
 #
 # Layout stuff:
 #
@@ -275,3 +263,5 @@ include /etc/sway/config.d/*
 # host specific section
 {%- do salt.log.error('sway/files/' + host) -%}
 {% include 'sway/files/' + host %}
+
+exec rm -f /tmp/sovpipe && mkfifo /tmp/sovpipe && tail -f /tmp/sovpipe | sov
diff --git a/states/sway/files/monitor_switch_sway b/states/sway/files/monitor_switch_sway
new file mode 100644 (file)
index 0000000..6e198fc
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+{% if grains['host'] == 'baryte' %}
+{% set ext = "DP-3" %}
+{% else %}
+{% set ext = "DP-1" %}
+{% endif %}
+
+FILE="/proc/acpi/button/lid/LID*/state"
+last=-1
+while true; do
+        grep -q open ${FILE}
+        current="$?"
+        if [ $last -ne $current ]; then
+                if [ $current -eq 0 ]; then
+                        swaymsg output {{ ext }} disable
+                        swaymsg output eDP-1 enable
+                else
+                        swaymsg output eDP-1 disable
+                        swaymsg output {{ ext }} enable
+                fi
+        fi
+        last=$current
+        sleep 0.5
+done
index a134528fc72572e020dbe39b93e3c97d1686ba9e..8d5c3e5e42d511a95678e7e29bdfc8116beb92f5 100644 (file)
@@ -37,3 +37,14 @@ conky launch script:
     - user: {{ grains['user'] }}
     - group: {{ grains['user'] }}
     - mode: 750
+
+{% if grains['host'] in ['baryte', 'barium', 'rhenium'] %}
+monitor switch script:
+  file.managed:
+    - name: {{ grains['homedir'] }}/.local/bin/monitor_switch_sway
+    - source: salt://sway/files/monitor_switch_sway
+    - user: {{ grains['user'] }}
+    - group: {{ grains['user'] }}
+    - mode: 750
+    - template: jinja
+{% endif %}