From 04965032acc85e12024bae03657444ef19c9401b Mon Sep 17 00:00:00 2001 From: Midgard <2885-Midgard@users.noreply.framagit.org> Date: Wed, 3 Jul 2024 15:23:57 +0200 Subject: [PATCH] [river] Add river configuration --- river/init | 180 ++++++++++++++++++++++++++++++++++++++++++++++ yambar/config.yml | 44 ++++++++++++ 2 files changed, 224 insertions(+) create mode 100755 river/init diff --git a/river/init b/river/init new file mode 100755 index 0000000..3c6afcd --- /dev/null +++ b/river/init @@ -0,0 +1,180 @@ +#!/bin/sh + +in_sway=false +if [ -n "$SWAYSOCK" ]; then + in_sway=true +fi + +riverctl focus-output DP-1 +SWAYSOCK="" yambar >/dev/null 2>&1 & + +if ! $in_sway; then + swaybg -i $HOME/img/bg/vallei_la_roche_less_contrast.jpg -m fill & +fi + +riverctl keyboard-layout -options 'compose:menu,shift:both_capslock,altwin:swap_lalt_lwin' be_custom +riverctl keyboard-layout -options 'compose:menu,shift:both_capslock,caps:none' be +riverctl set-repeat 70 170 + +riverctl hide-cursor timeout 3000 + +xrdb -merge "$HOME/.Xresources" + +DOTOOL_XKB_LAYOUT=be dotoold & + +wl-paste --watch clipman store & +riverctl map normal $mod c spawn "clipman pick --tool rofi" + +if $in_sway; then + mod=Alt +else + mod=Super +fi + + +riverctl default-attach-mode above + +riverctl border-width 1 +riverctl border-color-focused 0xffffff88 +riverctl border-color-unfocused 0xffffff00 + +riverctl focus-follows-cursor normal +riverctl set-cursor-warp on-output-change + + +riverctl map normal $mod Return spawn foot + +riverctl map normal $mod O spawn swaylock -c 000000 -l -f -i ~/img/bg/amy_sunflowers_painted_lock.png + +riverctl map normal $mod D spawn "killall rofi || rofi -show combi" + + +riverctl map normal $mod K focus-view previous +riverctl map normal $mod J focus-view next +riverctl map normal $mod H focus-output previous +riverctl map normal $mod L focus-output next + +riverctl map normal $mod+Shift K swap previous +riverctl map normal $mod+Shift J swap next +riverctl map normal $mod+Shift H send-to-output -current-tags previous +riverctl map normal $mod+Shift L send-to-output -current-tags next + +riverctl map normal $mod+Control K focus-view up +riverctl map normal $mod+Control J focus-view down +riverctl map normal $mod+Control H focus-view left +riverctl map normal $mod+Control L focus-view right + +riverctl map normal $mod+Control+Shift K swap up +riverctl map normal $mod+Control+Shift J swap down +riverctl map normal $mod+Control+Shift H swap left +riverctl map normal $mod+Control+Shift L swap right + +#riverctl map normal $mod X focus-output next +#riverctl map normal $mod+Shift X send-to-output -current-tags next +riverctl map normal $mod Z zoom + + + +riverctl map normal $mod+Shift Q close +riverctl map normal $mod space toggle-float +riverctl map normal $mod F toggle-fullscreen + +riverctl map-pointer normal $mod BTN_RIGHT resize-view +riverctl map-pointer normal $mod BTN_LEFT move-view + +riverctl map normal $mod twosuperior focus-previous-tags +riverctl map normal $mod+Shift twosuperior send-to-previous-tags +map_tags() { + local tag=$((1 << ($2 - 1))) + riverctl map normal $mod "$1" set-focused-tags "$tag" + riverctl map normal $mod+Control "$1" toggle-focused-tags "$tag" + riverctl map normal $mod+Shift "$1" set-view-tags "$tag" + riverctl map normal $mod+Shift+Control "$1" toggle-view-tags "$tag" + +} +map_tags ampersand 1 +map_tags eacute 2 +map_tags quotedbl 3 +map_tags apostrophe 4 +map_tags parenleft 5 +map_tags section 6 +map_tags egrave 7 +map_tags exclam 8 +map_tags ccedilla 9 +map_tags agrave 10 +map_tags parenright 11 + +riverctl map normal $mod T set-view-tags $(((1 << 11) - 1)) + + +# Set the default layout generator to be river-ultitile and start it. +# River will send the process group of the init executable SIGTERM on exit. +riverctl default-layout river-ultitile +if $in_sway; then + ~/dev/river-ultitile/zig-out/bin/river-ultitile & + + # Mod+U and Mod+I to increase/decrease the main size + riverctl map normal $mod U send-layout-cmd river-ultitile "set integer main-size += 5" + riverctl map normal $mod I send-layout-cmd river-ultitile "set integer main-size -= 5" + + # Mod+Shift+U and Mod+Shift+I to decrease/increase the main count + riverctl map normal $mod+Shift U send-layout-cmd river-ultitile "set integer main-count -= 1" + riverctl map normal $mod+Shift I send-layout-cmd river-ultitile "set integer main-count += 1" + + # Mod+{Up,Right,Down,Left} to change layout + riverctl map normal $mod Up send-layout-cmd river-ultitile "set string layout = vstack" + riverctl map normal $mod Right send-layout-cmd river-ultitile "set string layout = hstack" + riverctl map normal $mod Down send-layout-cmd river-ultitile "set string layout = monocle" + riverctl map normal $mod Left send-layout-cmd river-ultitile "set string layout = main" + +else + ~/.local/bin/river-ultitile & + + # Mod+U and Mod+I to increase/decrease the main size + riverctl map normal $mod U send-layout-cmd river-ultitile "edit main-center.main stretch+5" + riverctl map normal $mod I send-layout-cmd river-ultitile "edit main-center.main stretch-5" + + # Mod+Shift+U and Mod+Shift+I to decrease/increase the main count + riverctl map normal $mod+Shift U send-layout-cmd river-ultitile "edit main-center.main max-views-1" + riverctl map normal $mod+Shift I send-layout-cmd river-ultitile "edit main-center.main max-views+1" + + # Mod+{Up,Right,Down,Left} to change layout orientation + riverctl map normal $mod Up send-layout-cmd river-ultitile "default layout vstack" + riverctl map normal $mod Right send-layout-cmd river-ultitile "default layout hstack" + riverctl map normal $mod Down send-layout-cmd river-ultitile "default layout main-center" + riverctl map normal $mod Left send-layout-cmd river-ultitile "default layout main-left" + # And for monocle + riverctl map normal $mod M send-layout-cmd river-ultitile "default layout monocle" + # Cycle through layout + #riverctl map normal $mod W send-layout-cmd river-ultitile "main-location-cycle left,monocle" + + ultitile() { + riverctl send-layout-cmd river-ultitile "$*" + } + ultitile new layout hstack type=hsplit padding=5 margin=5 max-views=unlimited + + ultitile new layout vstack type=vsplit padding=5 margin=5 max-views=unlimited + + ultitile new layout main-left type=hsplit padding=5 margin=5 + ultitile new tile main-left.left type=vsplit stretch=40 order=2 + ultitile new tile main-left.main type=vsplit stretch=60 order=1 max-views=1 + + ultitile new layout main-center type=hsplit padding=5 margin=5 + ultitile new tile main-center.left type=vsplit stretch=25 order=2 suborder=0 + ultitile new tile main-center.main type=vsplit stretch=50 order=1 max-views=1 + ultitile new tile main-center.right type=vsplit stretch=25 order=2 suborder=1 + + ultitile new layout monocle type=overlay max-views=unlimited + + ultitile default layout main-center + + riverctl spawn 'foot sh -c "vi ~/todo2.txt; bash"' + riverctl spawn 'foot sh -c "vi ~/todo.txt; bash"' + sleep 0.2 + riverctl set-view-tags $((1 << (10 - 1))) + riverctl set-view-tags $((1 << (10 - 1))) + sleep 0.2 + riverctl spawn 'foot sh -c "toxic; bash"' + sleep 0.2 + riverctl set-view-tags $((1 << (11 - 1))) +fi diff --git a/yambar/config.yml b/yambar/config.yml index 2e9c305..427d024 100644 --- a/yambar/config.yml +++ b/yambar/config.yml @@ -84,6 +84,50 @@ bar: #default: {string: {text: "{name}", foreground: *col_fg_alt, margin: 7}} #conditions: #state == focused: {string: {text: "{name}", margin: 7}} + # + - river: + content: + map: + margin: 7 + default: + string: + foreground: *col_fg + text: "{id}: {state}" + conditions: + state == focused: + string: + foreground: *col_fg + text: "{id}" + state == unfocused: + string: + foreground: *col_visible_ws + text: "{id}" + state == urgent: + string: + foreground: *col_fg_alert + text: "{id}" + ~occupied: {empty: {}} + state == invisible: + string: + foreground: *col_fg_alt + text: "{id}" + title: + - map: + default: {empty: {}} + conditions: + seat != default: {string: { text: "{seat}" }} + - map: + default: {empty: {}} + conditions: + mode != normal: {string: { text: "{mode}" }} + - map: + default: + string: + text: "{title}" + left-margin: 10 + foreground: *col_fg_alt + conditions: + title == "": {empty: {}} - script: path: /home/midgard/.config/yambar/sway.py