Browse Source

New setup with sway

master
Albakham 2 months ago
parent
commit
16dddc143c
Signed by: albakham <dev@geber.ga> GPG Key ID: 6CE390277A579221
11 changed files with 565 additions and 3 deletions
  1. 3
    0
      .gitmodules
  2. 2
    1
      bin/kolours
  3. 1
    0
      dotbot
  4. 1
    1
      i3/.config/i3/config
  5. 15
    0
      install
  6. 0
    0
      install.conf.yaml
  7. 302
    0
      sway/.config/sway/config
  8. 101
    0
      waybar/.config/waybar/config
  9. 47
    0
      waybar/.config/waybar/pub-ip.sh
  10. 84
    0
      waybar/.config/waybar/style.css
  11. 9
    1
      zsh/.zshrc

+ 3
- 0
.gitmodules View File

@@ -0,0 +1,3 @@
[submodule "dotbot"]
path = dotbot
url = https://github.com/anishathalye/dotbot

+ 2
- 1
bin/kolours View File

@@ -10,7 +10,8 @@ WP="$(find ~/Images/Wallpapers -not -path '*/\.*' -type f | shuf | head -n1 )"
# Apply the colour scheme to terminals
#wal -i "$WP"
#wal --theme random
wal --theme sexy-tartan

#wal --theme sexy-tartan

# Scale the wallpaper (fixes multi-monitor setups)
feh --bg-center "$WP"

+ 1
- 0
dotbot

@@ -0,0 +1 @@
Subproject commit 9a8d292681ac540894dce3fe998be0068dfa2df5

+ 1
- 1
i3/.config/i3/config View File

@@ -174,7 +174,7 @@ assign [class="Rhythmbox"] $ws10

# run with reload
exec_always --no-startup-id "setxkbmap fr,fr oss,bepo grp:alt_caps_toggle,grp_led:scroll"
exec_always --no-startup-id "xrandr --auto --output HDMI1 --mode 1280x1024 --right-of eDP1"
exec_always --no-startup-id "xrandr --auto --output HDMI1 --mode 1280x1024 --left-of eDP1"
exec_always --no-startup-id kolours
exec_always --no-startup-id xrdb -load ~/.Xresources
exec_always --no-startup-id xinput set-prop 12 280 1

+ 15
- 0
install View File

@@ -0,0 +1,15 @@
#!/usr/bin/env bash

set -e

CONFIG="install.conf.yaml"
DOTBOT_DIR="dotbot"

DOTBOT_BIN="bin/dotbot"
BASEDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

cd "${BASEDIR}"
git -C "${DOTBOT_DIR}" submodule sync --quiet --recursive
git submodule update --init --recursive "${DOTBOT_DIR}"

"${BASEDIR}/${DOTBOT_DIR}/${DOTBOT_BIN}" -d "${BASEDIR}" -c "${CONFIG}" "${@}"

+ 0
- 0
install.conf.yaml View File


+ 302
- 0
sway/.config/sway/config View File

@@ -0,0 +1,302 @@
# Default config for sway
#
# Copy this to ~/.config/sway/config and edit it to your liking.
#
# Read `man 5 sway` for a complete reference.

### Variables
#
# Logo key. Use Mod1 for Alt.
set $mod Mod4
# Home row direction keys, like vim
set $left h
set $down j
set $up k
set $right l
# Your preferred terminal emulator
set $term kitty
# Your preferred application launcher
# Note: it's recommended that you pass the final command to sway
set $menu dmenu_path | rofi | xargs swaymsg exec --

### Output configuration

set $WP "$(find ~/Images/Wallpapers -not -path '*/\.*' -type f | shuf | head -n1 )"
output * bg $WP fill

# Example configuration:

# output HDMI-A-1 resolution 1920x1080 position 1920,0

# You can get the names of your outputs by running: swaymsg -t get_outputs

### Idle configuration
#
# Example configuration:
#
# exec swayidle -w \
# timeout 300 'swaylock -f -c 000000' \
# timeout 600 'swaymsg "output * dpms off"' \
# resume 'swaymsg "output * dpms on"' \
# before-sleep 'swaylock -f -c 000000'
#
# This will lock your screen after 300 seconds of inactivity, then turn off
# your displays after another 300 seconds, and turn your screens back on when
# resumed. It will also lock your screen before your computer goes to sleep.

### Input configuration
#
#
#
input "2:7:SynPS/2_Synaptics_TouchPad" {
dwt enabled
tap enabled
natural_scroll enabled
middle_emulation enabled
}
input "1:1:AT_Translated_Set_2_keyboard" {
xkb_layout fr,fr
xkb_variant oss,bepo
xkb_options grp:alt_caps_toggle,grp_led:scroll"
}
#
# You can get the names of your inputs by running: swaymsg -t get_inputs
# Read `man 5 sway-input` for more information about this section.

### Key bindings
#
# Basics:
#
# start a terminal
bindsym $mod+Return exec $term

# kill focused window
bindsym $mod+Shift+q kill

#copy keys
bindsym $mod+shift+a exec anon
bindsym $mod+shift+p exec pers

# start your launcher
bindsym $mod+d exec rofi -show run
bindsym $mod+t exec rofimoji
bindsym $mod+m exec rofi-mpd -a
bindsym $mod+shift+m exec mansplain
bindsym $mod+shift+i exec ~/repos/kaomoji-rofi/kaomoji.sh
bindsym $mod+shift+d exec passmenu --type
bindsym $mod+shift+z exec rofi -show drun
bindsym $mod+shift+w exec networkmanager_dmenu
bindsym $mod+c exec rofi-calc
bindsym $mod+p exec rofi-pass

# Drag floating windows by holding down $mod and left mouse button.
# Resize them with right mouse button + $mod.
# Despite the name, also works for non-floating windows.
# Change normal to inverse to use left mouse button for resizing and right
# mouse button for dragging.
floating_modifier $mod normal

# reload the configuration file
bindsym $mod+Shift+c reload

# exit sway (logs you out of your Wayland session)
bindsym $mod+Shift+e exec swaynag -t warning -m 'Voulez-vous vraiment quitter votre session Wayland ?' -b 'Quitter sway' 'swaymsg exit'
#
# Moving around:
#
# Move your focus around
bindsym $mod+$left focus left
bindsym $mod+$down focus down
bindsym $mod+$up focus up
bindsym $mod+$right focus right
# or use $mod+[up|down|left|right]
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right

# _move_ the focused window with the same, but add Shift
bindsym $mod+Shift+$left move left
bindsym $mod+Shift+$down move down
bindsym $mod+Shift+$up move up
bindsym $mod+Shift+$right move right
# ditto, with arrow keys
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right

# Pulse Audio controls
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume 0 +5% #increase sound volume
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume 0 -5% #decrease sound volume
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute 0 toggle # mute sound

# Sreen brightness controls
bindsym XF86MonBrightnessUp exec xbacklight -inc 10
bindsym XF86MonBrightnessDown exec xbacklight -dec 10
bindsym XF86KbdBrightnessUp exec ~/.config/i3/scripts/kbdbacklight.py + 1
bindsym XF86KbdBrightnessDown exec ~/.config/i3/scripts/kbdbacklight.py - 1
# Media player controls
bindsym XF86AudioPlay exec playerctl play-pause
bindsym XF86AudioNext exec playerctl next
bindsym XF86AudioPrev exec playerctl previous<Paste>


#
# Workspaces:
#

set $ws1 "1: "
set $ws2 "2: "
set $ws3 "3: "
set $ws4 "4: "
set $ws5 "5: "
set $ws6 "6: "
set $ws7 "7: "
set $ws8 "8: "
set $ws9 "9: "
set $ws10 "10: "

# switch to workspace
bindsym $mod+1 workspace $ws1
bindsym $mod+2 workspace $ws2
bindsym $mod+3 workspace $ws3
bindsym $mod+4 workspace $ws4
bindsym $mod+5 workspace $ws5
bindsym $mod+6 workspace $ws6
bindsym $mod+7 workspace $ws7
bindsym $mod+8 workspace $ws8
bindsym $mod+9 workspace $ws9
bindsym $mod+0 workspace $ws10

# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace $ws1
bindsym $mod+Shift+2 move container to workspace $ws2
bindsym $mod+Shift+3 move container to workspace $ws3
bindsym $mod+Shift+4 move container to workspace $ws4
bindsym $mod+Shift+5 move container to workspace $ws5
bindsym $mod+Shift+6 move container to workspace $ws6
bindsym $mod+Shift+7 move container to workspace $ws7
bindsym $mod+Shift+8 move container to workspace $ws8
bindsym $mod+Shift+9 move container to workspace $ws9
bindsym $mod+Shift+0 move container to workspace $ws10

assign [class="Firefox"] $ws1
assign [class="QOwnNotes"] $ws2
assign [class="code-oss"] $ws2
assign [class="termite"] $ws3
assign [class="Steam"] $ws4
assign [class="vlc"] $ws5
assign [class="Nautilus"] $ws6
assign [class="discord"] $ws7
assign [class="Keybase"] $ws7
assign [class="Riot"] $ws7
assign [class="Gimp-2.10"] $ws8
assign [class="Thunderbird"] $ws9
assign [class="Claws Mail"] $ws9
assign [class="Rhythmbox"] $ws10

#
# Layout stuff:
#
# You can "split" the current object of your focus with
# $mod+b or $mod+v, for horizontal and vertical splits
# respectively.
bindsym $mod+b splith
bindsym $mod+v splitv

# Switch the current container between different layout styles
bindsym $mod+s layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split

# Make the current focus fullscreen
bindsym $mod+f fullscreen

# Toggle the current focus between tiling and floating mode
bindsym $mod+Shift+space floating toggle

# Swap focus between the tiling area and the floating area
bindsym $mod+space focus mode_toggle

# move focus to the parent container
bindsym $mod+a focus parent
#
# Scratchpad:
#
# Sway has a "scratchpad", which is a bag of holding for windows.
# You can send windows there and get them back later.

# Move the currently focused window to the scratchpad
bindsym $mod+Shift+minus move scratchpad

# Show the next scratchpad window or hide the focused scratchpad window.
# If there are multiple scratchpad windows, this command cycles through them.
bindsym $mod+minus scratchpad show
#
# Resizing containers:
#
mode "resize" {
# left will shrink the containers width
# right will grow the containers width
# up will shrink the containers height
# down will grow the containers height
bindsym $left resize shrink width 10px
bindsym $down resize grow height 10px
bindsym $up resize shrink height 10px
bindsym $right resize grow width 10px

# ditto, with arrow keys
bindsym Left resize shrink width 10px
bindsym Down resize grow height 10px
bindsym Up resize shrink height 10px
bindsym Right resize grow width 10px

# return to default mode
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+r mode "resize"

#
# Status Bar:
#
# Read `man 5 sway-bar` for more information about this section.
bar {
swaybar_command waybar
}

# Remove title bars
default_border none

# Don't focus moused over windows
# focus_follows_mouse no

# Gaps
gaps outer 10
gaps inner 5


set $gnome-schema org.gnome.desktop.interface

################# Autostart ##################
####################################################################################################

# run with reload
exec_always --no-startup-id mpDris2
exec_always --no-startup-id anon
exec_always --no-startup-id mako
exec_always --no-startup-id nm-applet
exec_always {
gsettings set $gnome-schema gtk-theme 'Mojave-dark'
gsettings set $gnome-schema icon-theme 'Sardi-Orb-Colora'
gsettings set $gnome-schema cursor-theme 'Adwaita'
}

# run on startup only
exec --no-startup-id ksuperkey -e 'Super_L=Alt_L|F1'
exec --no-startup-id playerctl pause
exec --no-startup-id "eval $(/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1)"
exec --no-startup-id "eval $(/usr/bin/gnome-keyring-daemon --start --components=pkcs11,secrets,ssh) && export SSH_AUTH_SOCK"
exec --no-startup-id "eval $(gpg-agent --daemon)"

+ 101
- 0
waybar/.config/waybar/config View File

@@ -0,0 +1,101 @@
[{
"layer": "top",
"position": "top",
"output": "eDP-1",
"height": 24,
"modules-left": ["sway/workspaces", "sway/mode", "sway/window"],
"modules-center": ["custom/nsu", "network"],
"modules-right": ["backlight", "battery", "pulseaudio", "clock"],
"sway/mode": {
"tooltip": false,
"format": "<span weight=\"bold\">{}</span>"
},
"custom/pub-ip": {
"interval": 1,
"tooltip": false,
"format": "{}",
"exec": "bash $HOME/.config/waybar/pub-ip.sh"
},
"network": {
"tooltip": false,
"format-wifi": "<span color=\"#FE522C\"></span> {bandwidthUpBits} <span color=\"#52FE2C\"></span> {bandwidthDownBits}",
"format-ethernet": "{ifname}: {bandwidthUpBits} {bandwidthDownBits}",
"format-disconnected": "Internot"
},
"backlight": {
"device": "intel_backlight",
"format": "{icon} {percent}%",
"format-icons": ["🌑", "🌒", "🌓", "🌔", "🌕"]
},
"battery": {
"tooltip": false,
"states": {
"good": 95,
"warning": 30,
"critical": 15
},
"format": "{icon} {capacity}%",
"format-icons": ["", "", "", "", ""],
"max-length": 25
},
"pulseaudio": {
"format": "{icon} {volume}%",
"format-bluetooth": "{volume}% {icon}",
"format-muted": "",
"format-icons": {
"headphones": "",
"phone": "",
"portable": "",
"car": "",
"default": ["", ""]
},
"scroll-step": 5,
"on-click": "pavucontrol"
},
"clock": {
"tooltip": false,
"format": " {:%a %d %b  :%H:%M}"
}
}, {
"layer": "top",
"position": "bottom",
"output": "eDP-1",
"height": 24,
"modules-center": ["mpd"],
"modules-right": ["tray"],
"mpd": {
"format": "{stateIcon} {consumeIcon}{randomIcon}{repeatIcon}{singleIcon}{artist} - {title} ({elapsedTime:%M:%S}/{totalTime:%M:%S})",
"format-disconnected": "Déconnecté",
"format-stopped": "{consumeIcon}{randomIcon}{repeatIcon}{singleIcon}Arrêté",
"interval": 2,
"consume-icons": {
"on": " " // Icon shows only when "consume" is on
},
"random-icons": {
"off": "<span color=\"#f53c3c\"></span> ",
"on": " "
},
"repeat-icons": {
"on": " "
},
"single-icons": {
"on": "1 "
},
"state-icons": {
"paused": "",
"playing": ""
},
"tooltip-format": "MPD (connected)",
"tooltip-format-disconnected": "MPD (disconnected)"
},
"tray": {
"icon-size": 21,
"spacing": 10
}
}, {
"layer": "top",
"position": "top",
"output": "HDMI-A-1",
"height": 24,
"modules-left": ["sway/workspaces", "sway/mode", "sway/window"]
}]

+ 47
- 0
waybar/.config/waybar/pub-ip.sh View File

@@ -0,0 +1,47 @@
#! /bin/bash

function is_openvpn_running() {
if [[ $(pgrep openvpn) == "" ]]; then
echo false
else
echo true
fi
}

function is_wireguard_running() {
if [[ $(ls /sys/class/net | grep wg0) != "" ]]; then
echo true
else
echo false
fi
}

for interface in $(ls /sys/class/net/ | grep wlp2s0 || grep eth0);
do
if [[ $(cat /sys/class/net/$interface/carrier) = 1 ]]; then OnLine=1; fi
done
if ! [ $OnLine ]; then
# echo "" > /dev/stderr;
echo "Pas de connexion"
exit;
else
ip=$(wget --header 'x-pm-appversion: Other' \
--header 'x-pm-apiversion: 3' \
--header 'Accept: application/vnd.protonmail.v1+json' \
-o /dev/null \
--timeout 6 --tries 1 -q -O - 'https://api.protonmail.ch/vpn/location' \
| python -c 'import json; _ = open("/dev/stdin", "r").read(); print(json.loads(_)["IP"])' 2> /dev/null)
if [[ "$(is_openvpn_running)" == true ]]; then
if [[ "$(is_wireguard_running)" == true ]]; then
echo   $ip
else
echo  $ip
fi
else
if [[ "$(is_wireguard_running)" == true ]]; then
echo  $ip
else
echo  $ip
fi
fi
fi

+ 84
- 0
waybar/.config/waybar/style.css View File

@@ -0,0 +1,84 @@
* {
border: none;
border-radius: 0;
font-family: DejaVu Sans, unifont, siji, Font Awesome;
font-size: 13px;
min-height: 0;
}

window#waybar {
background-color: rgba(11, 11, 11, 0.8);
color: #ffffff;
transition-property: background-color;
transition-duration: .5s;
}

window#waybar.hidden {
opacity: 0.2;
}

#window {
padding: 0 15px;
}

/*
window#waybar.empty {
background-color: transparent;
}
window#waybar.solo {
background-color: #FFFFFF;
}
*/

/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
#workspaces button {
padding: 0 5px;
background-color: #4e9a06;
color: #ffffff;
}

#workspaces button.focused {
color: #ffffff;
background-color: #3d8905;
}

#workspaces button.urgent {
background-color: #eb4d4b;
}

#clock,
#battery,
#cpu,
#memory,
#backlight,
#network,
#pulseaudio,
#mode,
#pulseaudio,
#clock,
#tray,
#cpu,
#idle_inhibitor {
padding: 0 5px;
margin: 0 4px;
background-color: transparent;
border-bottom: 3px solid #4e9a06;
color: #ffffff;
}

#mode {
background-color: #00ff96;
color: #000000;
}

#battery.charging {
border-bottom: 2px solid #00ff96;
}

#battery.critical:not(.charging) {
border-bottom: 2px solid #dd2241;
}

label:focus {
background-color: #000000;
}

+ 9
- 1
zsh/.zshrc View File

@@ -1,3 +1,8 @@
# If running from tty2 start sway
if [ "$(tty)" = "/dev/tty2" ]; then
exec sway
fi

export TERM=xterm-256color
ZSH_DISABLE_COMPFIX="true"
ZSH="/home/titouan/.oh-my-zsh"
@@ -12,9 +17,12 @@ export GEM_HOME="$HOME/gems"
export PATH="$HOME/.gem/ruby/2.6.0/bin:$PATH"
export CHROOT="$HOME/chroot"
export EDITOR="nvim"
export QT_QPA_PLATFORMTHEME="qt5ct"
export QT_QPA_PLATFORM=wayland
export QT_WAYLAND_DISABLE_WINDOWDECORATION="1"
export LC_TIME=fr_FR.UTF-8
export MOZ_USE_XINPUT2=1
export XDG_CURRENT_DESKTOP=Unity
export MOZ_ENABLE_WAYLAND=1

[[ -r "/usr/share/z/z.sh" ]] && source /usr/share/z/z.sh


Loading…
Cancel
Save