summary refs log tree commit diff
diff options
context:
space:
mode:
authorRobert Günzler <r@gnzler.io>2022-02-09 00:14:31 +0100
committerRobert Günzler <r@gnzler.io>2022-02-09 00:16:55 +0100
commit79349095c7b8e6b159d1ecce0f5fa298b3392a09 (patch)
tree5a791ac6b73988c3b857188db5df1f86b27cc590
parentfcd381b368c1498034f8d0170268dc5613ba23f8 (diff)
add river init and make some scripts work
-rwxr-xr-x.config/river/init176
-rw-r--r--.config/waybar/config.jsonc14
-rw-r--r--.config/waybar/style.css12
-rw-r--r--.config/waybar/style.css.in12
-rwxr-xr-xbin/firefox7
-rwxr-xr-xbin/sway-run23
6 files changed, 229 insertions, 15 deletions
diff --git a/.config/river/init b/.config/river/init
new file mode 100755
index 0000000..40d0b13
--- /dev/null
+++ b/.config/river/init
@@ -0,0 +1,176 @@
+#!/bin/sh
+
+# Note: the "Mod4" modifier is also known as Logo, GUI, Windows, Mod4, etc.
+riverctl input "1739:0:Synaptics_TM3289-021" natural-scroll enabled
+riverctl input "1739:0:Synaptics_TM3289-021" pointer-accel 0
+riverctl input "1739:0:Synaptics_TM3289-021" tap enabled
+riverctl input "1739:0:Synaptics_TM3289-021" accel-profile adaptive
+
+# run application launcher
+riverctl map normal Mod4 D spawn 'menu -run'
+
+# start an instance of foot (https://codeberg.org/dnkl/foot)
+riverctl map normal Mod4 Return spawn footclient
+
+# Mod4+Q to close the focused view
+riverctl map normal Mod4+Shift Q close
+
+# Mod4+Shift+E to exit river
+riverctl map normal Mod4+Shift E exit
+
+# Mod4+J and Mod4+K to focus the next/previous view in the layout stack
+riverctl map normal Mod4 J focus-view next
+riverctl map normal Mod4 K focus-view previous
+
+# Mod4+Shift+J and Mod4+Shift+K to swap the focused view with the next/previous
+# view in the layout stack
+riverctl map normal Mod4+Shift J swap next
+riverctl map normal Mod4+Shift K swap previous
+
+# Mod4+Period and Mod4+Comma to focus the next/previous output
+riverctl map normal Mod4 Period focus-output next
+riverctl map normal Mod4 Comma focus-output previous
+
+# Mod4+Shift+{Period,Comma} to send the focused view to the next/previous output
+riverctl map normal Mod4+Shift Period send-to-output next
+riverctl map normal Mod4+Shift Comma send-to-output previous
+
+# bump the focused view to the top of the layout stack
+riverctl map normal Mod4+Shift Return zoom
+
+# Mod4+H and Mod4+L to decrease/increase the main ratio of rivertile(1)
+riverctl map normal Mod4 H send-layout-cmd rivertile "main-ratio -0.05"
+riverctl map normal Mod4 L send-layout-cmd rivertile "main-ratio +0.05"
+
+# Mod4+Shift+H and Mod4+Shift+L to increment/decrement the main count of rivertile(1)
+riverctl map normal Mod4+Shift H send-layout-cmd rivertile "main-count +1"
+riverctl map normal Mod4+Shift L send-layout-cmd rivertile "main-count -1"
+
+# Mod4+Alt+{H,J,K,L} to move views
+# riverctl map normal Mod4+Alt H move left 100
+# riverctl map normal Mod4+Alt J move down 100
+# riverctl map normal Mod4+Alt K move up 100
+# riverctl map normal Mod4+Alt L move right 100
+
+# snap views to screen edges
+riverctl map normal Mod4+Control H snap left
+riverctl map normal Mod4+Control J snap down
+riverctl map normal Mod4+Control K snap up
+riverctl map normal Mod4+Control L snap right
+
+# Mod4+Alt+Shif+{H,J,K,L} to resize views
+# riverctl map normal Mod4+Alt+Shift H resize horizontal -100
+# riverctl map normal Mod4+Alt+Shift J resize vertical 100
+# riverctl map normal Mod4+Alt+Shift K resize vertical -100
+# riverctl map normal Mod4+Alt+Shift L resize horizontal 100
+
+# Mod4 + Left Mouse Button to move views
+riverctl map-pointer normal Mod4 BTN_LEFT move-view
+
+# Mod4 + Right Mouse Button to resize views
+riverctl map-pointer normal Mod4 BTN_RIGHT resize-view
+
+riverctl focus-follows-cursor normal
+
+for i in $(seq 1 9); do
+	tags=$((1 << (i - 1)))
+
+	# focus tag [0-8]
+	riverctl map normal Mod4 "$i" set-focused-tags "$tags"
+	# tag focused view with tag [0-8]
+	riverctl map normal Mod4+Shift "$i" set-view-tags "$tags"
+	# toggle focus of tag [0-8]
+	riverctl map normal Mod4+Control "$i" toggle-focused-tags "$tags"
+	# toggle tag [0-8] of focused view
+	riverctl map normal Mod4+Shift+Control "$i" toggle-view-tags "$tags"
+done
+
+# Mod4+0 to focus all tags
+# Mod4+Shift+0 to tag focused view with all tags
+all_tags=$(((1 << 32) - 1))
+riverctl map normal Mod4 0 set-focused-tags $all_tags
+riverctl map normal Mod4+Shift 0 set-view-tags $all_tags
+riverctl map normal Mod4+Control+Shift 0 toggle-view-tags $all_tags
+
+# Mod4+Space to toggle float
+riverctl map normal Mod4+Control Space toggle-float
+
+# Mod4+F to toggle fullscreen
+riverctl map normal Mod4 F toggle-fullscreen
+# Mod4+{Up,Right,Down,Left} to change layout orientation
+riverctl map normal Mod4 Up send-layout-cmd rivertile "main-location top"
+riverctl map normal Mod4 Right send-layout-cmd rivertile "main-location right"
+riverctl map normal Mod4 Down send-layout-cmd rivertile "main-location bottom"
+riverctl map normal Mod4 Left send-layout-cmd rivertile "main-location left"
+
+# Declare a passthrough mode. This mode has only a single mapping to return to
+# normal mode. This makes it useful for testing a nested wayland compositor
+riverctl declare-mode passthrough
+# enter passthrough mode
+riverctl map normal Mod4 F11 enter-mode passthrough
+# return to normal mode
+riverctl map passthrough Mod4 F11 enter-mode normal
+
+# bindsym Return mode "default"
+# bindsym Escape mode "default"
+# bindsym q mode "default"
+riverctl declare-mode menu
+riverctl map normal Mod4 M enter-mode menu
+riverctl map menu None A spawn 'riverctl spawn soundswitch; riverctl enter mode normal'
+riverctl map menu None M spawn 'riverctl spawn mnts; riverctl enter mode normal'
+riverctl map menu None N spawn 'riverctl spawn notifmenu; riverctl enter mode normal'
+riverctl map menu None P spawn 'riverctl spawn passmenu; riverctl enter mode normal'
+riverctl map menu None R spawn 'riverctl spawn rcmenu; riverctl enter mode normal'
+riverctl map menu None X spawn 'riverctl spawn "menu -drun"; riverctl enter mode normal'
+riverctl map menu None Return enter-mode normal
+riverctl map menu None Escape enter-mode normal
+riverctl map menu None Q enter-mode normal
+
+# Various media key mapping examples for both normal and locked mode which do
+# not have a modifier
+for mode in normal locked; do
+	riverctl map $mode None XF86AudioRaiseVolume spawn 'soundswitch -V'
+	riverctl map $mode None XF86AudioLowerVolume spawn 'soundswitch -v'
+	riverctl map $mode None XF86AudioMute spawn 'soundswitch -m'
+
+	# Control MPRIS aware media players with playerctl (https://github.com/altdesktop/playerctl)
+	riverctl map $mode None XF86AudioMedia spawn 'playerctl -p playerctld play-pause'
+	riverctl map $mode None XF86AudioPlay spawn 'playerctl -p playerctld play-pause'
+	riverctl map $mode None XF86AudioPrev spawn 'playerctl -p playerctld previous'
+	riverctl map $mode None XF86AudioNext spawn 'playerctl -p playerctld next'
+
+	# Control screen backlight brighness with light (https://github.com/haikarainen/light)
+	riverctl map $mode None XF86MonBrightnessUp spawn 'light -A 5'
+	riverctl map $mode None XF86MonBrightnessDown spawn 'light -U 5'
+
+	riverctl map $mode None XF86Display spawn 'kanshictl reload'
+	riverctl map $mode None XF86Keyboard spawn 'light -S 0'
+	riverctl map $mode None XF86Favorites spawn 'light -S 100'
+done
+
+# Set background and border color
+riverctl background-color 0x002b36
+riverctl border-color-focused 0x70649a
+riverctl border-color-unfocused 0x1c1c1c
+riverctl border-color-urgent 0x9f353a
+riverctl border-width 2
+
+# Set keyboard repeat rate
+riverctl set-repeat 70 200
+
+# Make certain views start floating
+# riverctl float-filter-add app-id float
+# riverctl float-filter-add title "popup title with spaces"
+
+# Set app-ids and titles of views which should use client side decorations
+# riverctl csd-filter-add app-id "gedit"
+
+riverctl spawn 'once -- s6-svscan ~/.local/share/s6'
+riverctl spawn 'dbus-update-activation-environment DISPLAY WAYLAND_DISPLAY XDG_CURRENT_DESKTOP'
+riverctl spawn 'light -S 80'
+riverctl spawn 'sleep 1.4 && kanshictl reload'
+
+# Set and exec into the default layout generator, rivertile.
+# River will send the process group of the init executable SIGTERM on exit.
+riverctl default-layout rivertile
+exec rivertile -view-padding 5 -outer-padding 0
diff --git a/.config/waybar/config.jsonc b/.config/waybar/config.jsonc
index bd38898..7c7c29c 100644
--- a/.config/waybar/config.jsonc
+++ b/.config/waybar/config.jsonc
@@ -10,6 +10,20 @@
       "__vnc": "󱒃"
     }
   },
+  // "wlr/workspaces": {
+  //   "format": "{icon}",
+  //   "format-icons": {
+  //     "m": "󰎇",
+  //     "v": "󰿏",
+  //     "g": "󰺵",
+  //     "__vnc": "󱒃"
+  //   }
+  // },
+
+  "river/tags": {
+    "format": ":{}",
+    "num-tags": 9
+  },
 
   "custom/mpris": {
     "max-width": 60,
diff --git a/.config/waybar/style.css b/.config/waybar/style.css
index dec6cb8..2d6a36c 100644
--- a/.config/waybar/style.css
+++ b/.config/waybar/style.css
@@ -81,12 +81,20 @@ window#waybar.hidden {
   transition-duration: 0.1s;
 }
 
+#tags button,
 #workspaces button {
   padding: 0 5px;
   background: transparent;
   color: @dimmed;
   /* border-bottom: 3px solid transparent; */
 }
+#tags button {
+  color: @dimmeddarker;
+}
+#tags button.occupied {
+  color: @dimmed;
+}
+#tags button.focused,
 #workspaces button.focused {
   font-weight: bold;
   color: @foreground;
@@ -94,10 +102,13 @@ window#waybar.hidden {
   transition-property: background;
   transition-duration: 0.01s;
 }
+#tags button.urgent,
 #workspaces button.urgent {
   color: @background;
   background: @urgent;
 }
+#tags button:hover,
+#tags button.focused:hover,
 #workspaces button:hover,
 #workspaces button.focused:hover {
   background: @accent;
@@ -109,6 +120,7 @@ window#waybar.hidden {
   box-shadow: inherit;
   text-shadow: inherit;
 }
+#tags button.urgent:hover,
 #workspaces button.urgent:hover {
   background: @foreground;
   transition-property: background;
diff --git a/.config/waybar/style.css.in b/.config/waybar/style.css.in
index e4072bb..67a1001 100644
--- a/.config/waybar/style.css.in
+++ b/.config/waybar/style.css.in
@@ -81,12 +81,20 @@ window#waybar.hidden {
   transition-duration: 0.1s;
 }
 
+#tags button,
 #workspaces button {
   padding: 0 5px;
   background: transparent;
   color: @dimmed;
   /* border-bottom: 3px solid transparent; */
 }
+#tags button {
+  color: @dimmeddarker;
+}
+#tags button.occupied {
+  color: @dimmed;
+}
+#tags button.focused,
 #workspaces button.focused {
   font-weight: bold;
   color: @foreground;
@@ -94,10 +102,13 @@ window#waybar.hidden {
   transition-property: background;
   transition-duration: 0.01s;
 }
+#tags button.urgent,
 #workspaces button.urgent {
   color: @background;
   background: @urgent;
 }
+#tags button:hover,
+#tags button.focused:hover,
 #workspaces button:hover,
 #workspaces button.focused:hover {
   background: @accent;
@@ -109,6 +120,7 @@ window#waybar.hidden {
   box-shadow: inherit;
   text-shadow: inherit;
 }
+#tags button.urgent:hover,
 #workspaces button.urgent:hover {
   background: @foreground;
   transition-property: background;
diff --git a/bin/firefox b/bin/firefox
index 9a05b9e..d49d9af 100755
--- a/bin/firefox
+++ b/bin/firefox
@@ -28,6 +28,11 @@ firefox-clean)
 	;;
 
 workfox)
-	swx -M work -- "${bin}" --profile $HOME/.mozilla/firefox/d2ps1x6l.work $@
+	set -- "${bin}" --profile "$HOME"/.mozilla/firefox/d2ps1x6l.work "$@"
+	if swaymsg -t get_version >/dev/null 2>&1; then
+		exec swx -M work -- "$@"
+	else
+		exec "$@"
+	fi
 	;;
 esac
diff --git a/bin/sway-run b/bin/sway-run
index dbc1ec3..7cebf28 100755
--- a/bin/sway-run
+++ b/bin/sway-run
@@ -3,27 +3,22 @@ set -e
 
 SWAY_BIN=${SWAY_BIN:-sway}
 SWAY_ARGS=${SWAY_ARGS:-}
-LOGFILE=/var/log/sway.log
-
-(
-	doas touch ${LOGFILE}
-	doas chown robert:robert ${LOGFILE}
-)
 
 (
 	printf -- "\n--- sway ---\n"
-	printf "DATE: $(date)\n"
-	printf "EXEC: ${SWAY_BIN} ${SWAY_ARGS}\n"
-	printf "USER: $(id -u)\n"
-	[ -n "${DBUS_SESSION_BUS_ADDRESS}" ] && printf "DBUS: ${DBUS_SESSION_BUS_ADDRESS}\n"
+	printf "Date: %s\n" "$(date)"
+	printf "User: %s\n" "$(id -u)"
+	printf "Bin:  %s\n" "${SWAY_BIN}"
+	printf "Args: %s\n" "${SWAY_ARGS}"
+	printf "Dbus: %s\n" "${DBUS_SESSION_BUS_ADDRESS}"
 	printf -- "---\n"
-) >>${LOGFILE}
+)
 
 # wlroots env vars should be set here
 # export WLR_DRM_DEVICES="/dev/dri/card1:/dev/dri/card0"
 # export WLR_DRM_DEVICES="/dev/dri/card0"
 export WLR_DRM_NO_MODIFIERS=1
 
-# exec ${SWAY_BIN} ${SWAY_ARGS} 1>&2 2>>${LOGFILE}
-# exec dbus-launch --exit-with-session ${SWAY_BIN} ${SWAY_ARGS} 1>&2 2>>${LOGFILE}
-exec dbus-run-session -- ${SWAY_BIN} ${SWAY_ARGS} 1>&2 2>>${LOGFILE}
+# exec ${SWAY_BIN} ${SWAY_ARGS}
+# exec dbus-launch --exit-with-session ${SWAY_BIN} ${SWAY_ARGS}
+exec dbus-run-session -- ${SWAY_BIN} ${SWAY_ARGS}