Sway and river

This commit is contained in:
Daan Vanoverloop 2021-09-22 16:44:31 +02:00
parent 5169f2e9dc
commit 8696566273
15 changed files with 560 additions and 21 deletions

View File

@ -338,7 +338,7 @@ bell:
#
# Window opacity as a floating point number from `0.0` to `1.0`.
# The value `0.0` is completely transparent and `1.0` is opaque.
background_opacity: 0.7
background_opacity: 0.9
#selection:
#semantic_escape_chars: ",│`|:\"' ()[]{}<>\t"

11
.config/river/exit.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
ANSWER=$(echo -e "suspend\nlock\nlogout\nshutdown\nreboot" | rofi -dmenu)
case $ANSWER in
"suspend") systemctl suspend;;
"lock") xset s activate;;
"logout") riverctl exit;;
"shutdown") shutdown now;;
"reboot") reboot;;
esac

18
.config/river/float_hack Normal file
View File

@ -0,0 +1,18 @@
function float_hack {
scratch_tag=$((1 << $1))
riverctl spawn "$4"
sleep 0.2
riverctl resize horizontal -$2
riverctl resize vertical -$3
riverctl snap down
riverctl set-view-tags ${scratch_tag}
# Set spawn tagmask to ensure new windows don't have the scratchpad tag unless
# explicitly set.
all_but_scratch_tag=$(( ((1 << 32) - 1) ^ $scratch_tag ))
riverctl spawn-tagmask ${all_but_scratch_tag}
}

View File

@ -14,13 +14,13 @@ mod="Mod4"
# Mod+Shift+Return to start an instance of foot (https://codeberg.org/dnkl/foot)
riverctl map normal $mod Return spawn alacritty
riverctl map normal $mod D spawn rofi -show drun
riverctl map normal $mod D spawn "rofi -show drun"
# Mod+Q to close the focused view
riverctl map normal $mod+Shift Q close
# Mod+E to exit river
riverctl map normal $mod+Shift E exit
riverctl map normal $mod+Shift E spawn "~/.config/river/exit.sh"
# Mod+J and Mod+K to focus the next/previous view in the layout stack
riverctl map normal $mod J focus-view next
@ -124,17 +124,23 @@ riverctl map passthrough $mod F11 enter-mode normal
for mode in normal locked
do
# Control pulse audio volume with pamixer (https://github.com/cdemoulins/pamixer)
riverctl map $mode None XF86AudioRaiseVolume spawn pamixer -i 5
riverctl map $mode None XF86AudioLowerVolume spawn pamixer -d 5
riverctl map $mode None XF86AudioMute spawn pamixer --toggle-mute
riverctl map $mode None XF86AudioRaiseVolume spawn "pamixer -i 5"
riverctl map $mode None XF86AudioLowerVolume spawn "pamixer -d 5"
riverctl map $mode None XF86AudioMute spawn "pamixer --toggle-mute"
# Control screen backlight brighness with light (https://github.com/haikarainen/light)
riverctl map $mode None XF86MonBrightnessUp spawn xbacklight -inc 5
riverctl map $mode None XF86MonBrightnessDown spawn xbacklight -dec 5
riverctl map $mode None XF86MonBrightnessUp spawn "light -A 5"
riverctl map $mode None XF86MonBrightnessDown spawn "light -U 5"
done
riverctl map normal $mod m spawn "mpc toggle"
riverctl map normal $mod c spawn "rofi-pass-wl"
riverctl map normal $mod+Shift g spawn "dmenu_script game.sh"
riverctl focus-follows-cursor normal
# Set repeat rate
riverctl set-repeat 50 300
riverctl set-repeat 50 400
# Set app-ids of views which should float
riverctl float-filter-add "float"
@ -149,11 +155,58 @@ riverctl csd-filter-add "gedit"
riverctl input 7847:4102:BTL_Gaming_Mouse pointer-accel 0
riverctl input 7847:4102:BTL_Gaming_Mouse accel-profile flat
riverctl input 1356:2508:Wireless_Controller_Touchpad natural-scroll enabled
riverctl input 1356:2508:Wireless_Controller_Touchpad tap enabled
# The scratchpad will live on an unused tag. Which tags are used depends on your
# config, but rivers default uses the first 9 tags.
scratch_tag=$((1 << 20 ))
mpc_tag=$((1 << 21 ))
riverctl map normal Mod4 W toggle-focused-tags ${scratch_tag}
riverctl map normal Mod4+Shift M toggle-focused-tags ${mpc_tag}
# Send windows to the scratchpad with Super+Shift+P
#riverctl map normal Mod4+Shift P set-view-tags ${scratch_tag}
riverctl set-focused-tags ${scratch_tag}
riverctl spawn "alacritty"
sleep 0.1
riverctl toggle-float
riverctl resize horizontal 200
riverctl resize vertical 200
riverctl set-focused-tags ${mpc_tag}
riverctl spawn "alacritty -e mpc-rs"
sleep 0.1
riverctl toggle-float
riverctl resize horizontal -100
riverctl resize vertical -200
riverctl snap down
riverctl set-focused-tags 1
# Set spawn tagmask to ensure new windows don't have the scratchpad tag unless
# explicitly set.
all_but_scratch_tag=$(( ((1 << 32) - 1) ^ $scratch_tag))
riverctl spawn-tagmask ${all_but_scratch_tag}
all_but_mpc_tag=$(( ((1 << 32) - 1) ^ $mpc_tag))
riverctl spawn-tagmask ${all_but_mpc_tag}
exec mako &
exec ~/Scripts/setbg_wl.sh &
exec waybar &
riverctl default-layout kile
exec kile &
riverctl send-layout-cmd kile "all (v: h h)"
riverctl send-layout-cmd kile "view_padding 5"
riverctl send-layout-cmd kile "outer_padding 7"
# 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
#riverctl default-layout rivertile
#exec rivertile

17
.config/river/layout Normal file
View File

@ -0,0 +1,17 @@
#!/bin/sh
# These are fairly simple layout that serves as
# both example of what can be done and also bulding blocks for your own layouts
ROW="((h: h d) 2 0.65 0)"
JUMP="(2 >
$ROW
? (h 1 0.65 0)
)"
HOR="((h:
v (
(v: f d) 1 0.5 0
)
) 1 0.63 0)"

0
.config/river/mpc Executable file
View File

View File

@ -7,14 +7,14 @@ configuration {
/* lines: 15;*/
font: "Open Sans 10";
/*theme: "sidetab";*/
theme: "~/.config/rofi/sidetab.rasi";
theme: "~/.config/rofi/sidebar.rasi";
/* bw: 1;*/
/* location: 0;*/
/* padding: 5;*/
/* yoffset: 0;*/
/* xoffset: 0;*/
/* fixed-num-lines: true;*/
/* show-icons: false;*/
show-icons: true;
/* terminal: "rofi-sensible-terminal";*/
/* ssh-client: "ssh";*/
/* ssh-command: "{terminal} -e {ssh-client} {host}";*/

122
.config/rofi/sidebar.rasi Normal file
View File

@ -0,0 +1,122 @@
/* vim:ft=css
*/
/**
* ROFI Color theme
* User: Qball
* Copyright: Dave Davenport
*/
* {
text-color: #ffeedd;
background-color: rgba(0,0,0,0);
dark: #1c1c1c;
// Black
black: #3d352a;
lightblack: #554444;
//
// Red
red: #cd5c5c;
lightred: #cc5533;
//
// Green
green: #86af80;
lightgreen: #88cc22;
//
// Yellow
yellow: #e8ae5b;
lightyellow: #ffa75d;
//
// Blue
blue: #6495ed;
lightblue: #87ceeb;
//
// Magenta
magenta: #deb887;
lightmagenta: #996600;
//
// Cyan
cyan: #b0c4de;
lightcyan: #b0c4de;
//
// White
white: #bbaa99;
lightwhite: #ddccbb;
//
// Bold, Italic, Underline
highlight: bold #ffffff;
}
window {
height: 100%;
width: 20em;
location: east;
anchor: east;
border: 0px 2px 0px 0px;
text-color: @lightwhite;
}
mode-switcher {
border: 2px 0px 0px 0px;
background-color: @lightblack;
padding: 4px;
}
button selected {
border-color: @lightgreen;
text-color: @lightgreen;
}
inputbar {
background-color: #1c1c1c77;
text-color: @lightgreen;
padding: 4px;
border: 0px 0px 2px 0px;
}
mainbox {
expand: true;
background-color: #1c1c1c77;
spacing: 1em;
}
listview {
padding: 0em 0.4em 0em 0.9em;
dynamic: false;
lines: 0;
}
element-text {
background-color: inherit;
text-color: inherit;
}
element {
padding: 5px;
margin: 5px;
}
element selected normal {
background-color: @blue;
}
element normal active {
text-color: @lightblue;
}
element normal urgent {
text-color: @lightred;
}
element alternate normal {
}
element alternate active {
text-color: @lightblue;
}
element alternate urgent {
text-color: @lightred;
}
element selected active {
background-color: @lightblue;
text-color: @dark;
}
element selected urgent {
background-color: @lightred;
text-color: @dark;
}
error-message {
expand: true;
background-color: red;
border-color: darkred;
border: 2px;
padding: 1em;
}

View File

@ -1,11 +1,6 @@
/* vim:ft=css
*/
/**
* User: deadguy
* Copyright: deadguy
*/
configuration {
display-drun: "Activate";
display-run: "Execute";
@ -111,7 +106,8 @@ element normal.active {
element selected.normal {
background-color: @selected-normal-background;
text-color: @selected-normal-foreground;
/*text-color: @selected-normal-foreground;*/
text-color: #ffffff;
border: 0 0 0 0;
border-color: @active-background;
}

266
.config/sway/config Normal file
View File

@ -0,0 +1,266 @@
# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
# Should you change your keyboard layout some time, delete
# this file and re-run i3-config-wizard(1).
#
# i3 config file (v4)
#
# Please see https://i3wm.org/docs/userguide.html for a complete reference!
set $mod Mod4
#set_from_resource $bright i3wm.color2 #ff0000
#set_from_resource $bg i3wm.color7 #ff0000
#set_from_resource $light i3wm.color4 #ff0000
#set_from_resource $fg i3wm.color4 #ff0000
#set_from_resource $bg i3wm.color3 #ff0000
set $bg-color #000000
set $inactive-bg-color #2f343f
set $text-color #FFFFFF
set $inactive-text-color #676E7D
set $urgent-bg-color #E53935
set $bordercolor #c5cbd6
set $bg-highlight #556177
gaps inner 10
gaps outer 7
gaps top -5
smart_gaps on
set $mode_gaps Toggle gaps: (1) on (2) off
bindsym $mod+g mode "$mode_gaps"
mode "$mode_gaps" {
bindsym 1 mode "default", gaps inner all set 10, gaps outer all set 4, gaps top all set -5
bindsym 2 mode "default", gaps inner all set 0, gaps outer all set 0
bindsym Return mode "default"
bindsym Escape mode "default"
}
# Brightness
bindsym XF86MonBrightnessUp exec --no-startup-id xbacklight -inc 5
bindsym XF86MonBrightnessDown exec --no-startup-id xbacklight -dec 5
bindsym Ctrl+XF86MonBrightnessUp exec --no-startup-id xbacklight -inc 1
bindsym Ctrl+XF86MonBrightnessDown exec --no-startup-id xbacklight -dec 1
# Auto startup
exec_always --no-startup-id xsetwacom set "Wacom HID 50DB Finger touch" Gesture off
#exec_always --no-startup-id export QT_QPA_PLATFORMTHEME="qt5ct"
exec_always --no-startup-id /usr/lib/kdeconnectd &
exec_always --no-startup-id indicator-kdeconnect
#exec_always --no-startup-id nm-applet --agent
#exec_always --no-startup-id ~/.config/i3/auto-xrandr
#
#exec_always --no-startup-id ~/.config/picom/launch.sh
exec_always --no-startup-id waybar
#exec_always --no-startup-id /home/daan/.screenlayout/HDMI.sh
exec_always --no-startup-id ~/Scripts/setbg_wl.sh &
#exec_always --no-startup-id hsetroot -solid "#ffffff"
exec_always --no-startup-id mako &
#exec_always --no-startup-id ~/.config/i3/oneko.sh
#bindsym $mod+w exec --no-startup-id guake-toggle &
# Application
bindsym $mod+Shift+e exec --no-startup-id ~/.config/sway/exit.sh
bindsym $mod+Shift+g exec --no-startup-id dmenu_script game.sh
bindsym $mod+m exec --no-startup-id mpc toggle
# window border size
default_border pixel 0
default_floating_border pixel 0
# default font
font pango:Open Sans 10
# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod
# start a terminal
bindsym $mod+Return exec alacritty
# kill focused window
bindsym $mod+Shift+q kill
# start rofi
bindsym $mod+d exec rofi -show drun --no-startup-id
# workspaces
# change focus
bindsym $mod+h focus left
bindsym $mod+j focus down
bindsym $mod+k focus up
bindsym $mod+l focus right
# alternatively, you can use the cursor keys:
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right
# move focused window
bindsym $mod+Shift+h move left
bindsym $mod+Shift+j move down
bindsym $mod+Shift+k move up
bindsym $mod+Shift+l move right
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right
bindsym $mod+Control+Left workspace prev
bindsym $mod+Control+Right workspace next
# split in horizontal orientation
bindsym $mod+b split h
# split in vertical orientation
bindsym $mod+v split v
# enter fullscreen mode for the focused container
bindsym $mod+f fullscreen toggle
# toggle tiling / floating
bindsym $mod+Shift+space floating toggle
# change focus between tiling / floating windows
bindsym $mod+space focus mode_toggle
# focus the parent container
bindsym $mod+q focus parent
# focus the child container
#bindsym $mod+d focus child
# switch to workspace
bindsym $mod+1 workspace 1
bindsym $mod+2 workspace 2
bindsym $mod+3 workspace 3
bindsym $mod+4 workspace 4
bindsym $mod+5 workspace 5
bindsym $mod+6 workspace 6
bindsym $mod+7 workspace 7
bindsym $mod+8 workspace 8
bindsym $mod+9 workspace 9
bindsym $mod+0 workspace 10
# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace 1
bindsym $mod+Shift+2 move container to workspace 2
bindsym $mod+Shift+3 move container to workspace 3
bindsym $mod+Shift+4 move container to workspace 4
bindsym $mod+Shift+5 move container to workspace 5
bindsym $mod+Shift+6 move container to workspace 6
bindsym $mod+Shift+7 move container to workspace 7
bindsym $mod+Shift+8 move container to workspace 8
bindsym $mod+Shift+9 move container to workspace 9
bindsym $mod+Shift+0 move container to workspace 10
bindsym $mod+Shift+greater move workspace to output up
bindsym $mod+Shift+less move workspace to output down
# reload the configuration file
bindsym $mod+Shift+c reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym $mod+Shift+r swaymsg restart
# exit i3 (logs you out of your X session)
#bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'"
# resize window (you can also use the mouse for that)
mode "resize" {
# These bindings trigger as soon as you enter the resize mode
# Pressing left will shrink the windows width.
# Pressing right will grow the windows width.
# Pressing up will shrink the windows height.
# Pressing down will grow the windows height.
bindsym j resize shrink width 10 px or 10 ppt
bindsym k resize grow height 10 px or 10 ppt
bindsym l resize shrink height 10 px or 10 ppt
bindsym m resize grow width 10 px or 10 ppt
# same bindings, but for the arrow keys
bindsym Left resize shrink width 10 px or 10 ppt
bindsym Down resize grow height 10 px or 10 ppt
bindsym Up resize shrink height 10 px or 10 ppt
bindsym Right resize grow width 10 px or 10 ppt
# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+r mode "resize"
# Pulse Audio controls
bindsym XF86AudioRaiseVolume exec --no-startup-id sh -c "pamixer -i 5"
bindsym XF86AudioLowerVolume exec --no-startup-id sh -c "pamixer -d 5"
bindsym XF86AudioMute exec --no-startup-id sh -c "pamixer -m"
input type:pointer {
accel_profile flat
pointer_accel 0
}
input type:touchpad {
tap enabled
natural_scroll enabled
}
# Workspace assignment
assign [class="^code-oss$"] 3
for_window [class="^code-oss$"] focus
assign [window_role="browser"] 2
for_window [window_role="browser"] focus
## Plasma Integration
# Try to kill the wallpaper set by Plasma (it takes up the entire workspace and hides everythiing)
exec --no-startup-id wmctrl -c Plasma
for_window [title="Desktop — Plasma"] kill; floating enable; border none
## Avoid tiling popups, dropdown windows from plasma
# for the first time, manually resize them, i3 will remember the setting for floating windows
for_window [class="plasmashell"] floating enable;
for_window [class="Plasma"] floating enable; border none
for_window [title="plasma-desktop"] floating enable; border none
for_window [title="win7"] floating enable; border none
for_window [class="krunner"] floating enable; border none
for_window [class="Kmix"] floating enable; border none
for_window [class="Klipper"] floating enable; border none
for_window [class="Plasmoidviewer"] floating enable; border none
#for_window [class="mpc"] mark "mpc", move scratchpad
#bindsym $mod+Shift+m [con_mark="mpc"] scratchpad show
#exec --no-startup-id sh -c "alacritty --class mpc --title mpc --command mpc-rs"
for_window [app_id="mpc"] move scratchpad
bindsym $mod+Shift+m [app_id="mpc"] scratchpad show
exec_always --no-startup-id alacritty --class mpc --title mpc --command mpc-rs
for_window [app_id="scratch"] move scratchpad
bindsym $mod+w [app_id="scratch"] scratchpad show
exec_always --no-startup-id alacritty --class scratch --title scratchpad
exec swayidle -w \
timeout 900 'swaylock' \
timeout 905 'swaymsg "output * dpms off"' \
resume 'swaymsg "output * dpms on"'
#focus Pavucontrol or create it, if it did not already exist.
#bindsym $mod+w exec swaymsg [app_id="scratchpad"] scratchpad show || exec alacritty --class scratchpad --title scratchpad , resize set 1800 1000
#focus Vimpc or create it, if it did not already exist.
#bindsym $mod+Shift+m exec swaymsg [app_id="mpc"] scratchpad show || exec alacritty --class mpc --title mpc --command mpc-rs , resize set 1800 1000

11
.config/sway/exit.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
ANSWER=$(echo -e "suspend\nlock\nlogout\nshutdown\nreboot" | rofi -dmenu)
case $ANSWER in
"suspend") systemctl suspend;;
"lock") xset s activate;;
"logout") swaymsg exit;;
"shutdown") shutdown now;;
"reboot") reboot;;
esac

1
.config/sway/out.log Normal file
View File

@ -0,0 +1 @@
1632317702.899765291s> Handling message: Update(All)

View File

@ -19,7 +19,8 @@
"height": 30,
"modules-left": [
"river/tags"
"sway/workspaces",
"sway/mode"
],
"modules-center": [
],
@ -100,7 +101,28 @@
},
"river/tags": {
"num-tags": 5
"num-tags": 9
},
"sway/window": {
"format": "{}",
"max-length": 120
},
"sway/workspaces": {
"all-outputs": false,
"disable-scroll": true,
"format": "{icon} {name}",
"format-icons": {
"1:www": "龜", // Icon: firefox-browser
"2:mail": "", // Icon: mail
"3:editor": "", // Icon: code
"4:terminals": "", // Icon: terminal
"5:portal": "", // Icon: terminal
"urgent": "",
"focused": "",
"default": ""
}
},
"pulseaudio": {

1
.config/waybar/out.log Normal file
View File

@ -0,0 +1 @@
1632315830.524646043s> Handling message: Update(All)

View File

@ -193,3 +193,24 @@
color: #c9545d;
}
#workspaces button {
border-top: 2px solid transparent;
/* To compensate for the top border and still have vertical centering */
padding-bottom: 2px;
padding-left: 10px;
padding-right: 10px;
color: #888888;
}
#workspaces button.focused {
border-color: #4c7899;
color: white;
background-color: #285577;
}
#workspaces button.urgent {
border-color: #c9545d;
color: #c9545d;
}