Compare commits

..

2 commits

8 changed files with 84 additions and 89 deletions

View file

@ -1,10 +1,17 @@
Sway sesktop configuration
Sway desktop configuration
--------------------------
This repository contain all configuration for my desktop : [sway][l_sway] (and
swaylock, swayidle), [mako][l_mako] and [waybar][l_waybar]. Execute
This repository contain all configurations for my desktop : [sway][l_sway] (and
swaylock, swayidle), [mako][l_mako] and [waybar][l_waybar]. Execute
`install.sh` install it properly.
## Launcher
I use a custom launcher based on fzf with a script taken from
[FlyingWombat][l_won] with some light modifications.
[l_sway]:https://swayvm.org
[l_mako]:https://wayland.emersion.fr/mako/
[l_waybar]:https://github.com/Alexays/Waybar
[l_fzf]: https://gitlab.com/FlyingWombat/my-scripts/blob/master/sway-launcher
[l_won]: https://gitlab.com/FlyingWombat/my-scripts/blob/master/sway-launcher

64
bin/launcher.sh Executable file
View file

@ -0,0 +1,64 @@
#!/bin/sh
# terminal application launcher for sway, using fzf
# original command:
# Based on: https://github.com/swaywm/sway/issues/1367
# bindsym $altkey+space exec termite --name=launcher -e \
# "bash -c 'compgen -c | sort -u | fzf --no-extended --print-query | \
# tail -n1 | xargs -r swaymsg -t command exec'"
HIST_FILE="${XDG_CACHE_HOME:-$HOME/.cache}/sway-launcher-history.txt"
FZF_OPTIONS="--layout=reverse --no-extended --print-query --no-sort"
# Get shell command list
# This may include the occasional non-executable file
# command_list=$({ IFS=:; ls -H $PATH; } | grep -v '/.*' | sort -u)
command_list=$(find $(echo $PATH | tr ':' ' ') -type f -executable -printf "\n%f")
# read existing command history
if [ -f "$HIST_FILE" ]; then
command_history=$(cat "$HIST_FILE")
else
command_history=""
fi
# search command list
command_str=$(printf "%s\n" "${command_history}" "${command_list}" | \
sed -E 's/^[0-9]+ (.+)$/\1/' | \
fzf $FZF_OPTIONS | \
tail -n1) || exit 1
if [ "$command_str" = "" ]; then
exit 1
fi
# echo "Command: $command_str"
# using \E flag from perl regex
test "${command_str#*\\E}" != "$command_str" && echo "command can't contain '\E'"
test "${command_str#*\\E}" != "$command_str" && exit 1
# get full line from history (with count number)
hist_line=$(echo "$command_history" | grep -Pe "^[0-9]+ \Q$command_str\E$")
# echo "Hist Line: $hist_line"
if [ "$hist_line" = "" ]; then
hist_count=1
else
# Increment usage count
hist_count=$(echo "$hist_line" | sed -E 's/^([0-9]+) .+$/\1/')
hist_count=$((hist_count + 1))
# delete line, to add updated later
# echo "Hist Before: $command_history"
command_history=$(echo "$command_history" | \
grep --invert-match -Pe "^[0-9]+ \Q$command_str\E$")
# echo "Hist After: $command_history"
fi
# update history
update_line="${hist_count} ${command_str}"
printf "%s\n" "${update_line}" "${command_history}" | \
sort --numeric-sort --reverse > "$HIST_FILE"
# echo "$update_line"
# execute command
echo "$command_str"
swaymsg -t command exec "$command_str"

View file

@ -2,10 +2,10 @@
LocationMode=filename-entry
ShowHidden=false
ShowSizeColumn=true
GeometryX=0
GeometryY=0
GeometryWidth=640
GeometryHeight=516
GeometryX=282
GeometryY=194
GeometryWidth=876
GeometryHeight=538
SortColumn=name
SortOrder=descending
StartupMode=recent

View file

@ -1,3 +1,4 @@
set $term termite
output * bg ~/Documents/ressources/wallpapers/building_cyberpunk.jpg fill
set $menu exec $term --name=launcher -e launcher.sh
output * bg ~/Documents/ressources/wallpapers/building_cyberpunk.jpg fill

View file

@ -3,7 +3,7 @@ set $left h
set $down j
set $up k
set $right l
set $menu rofi -location 0 -show combi ~/.config/i3/rofi.config
gaps inner 5
@ -60,6 +60,8 @@ assign [app_id="^firefox$"] $ws3
assign [class="keepassxc"] $ws3
assign [app_id="org.remmina.*"] $ws5
for_window [app_id="^launcher$"] floating enable, border none<Paste>
# switch to workspace
bindsym $mod+1 workspace $ws1
bindsym $mod+2 workspace $ws2

View file

@ -1,76 +0,0 @@
# i3status configuration file.
# see "man i3status" for documentation.
# It is important that this file is edited as UTF-8.
# The following line should contain a sharp s:
# ß
# If the above line is not correctly displayed, fix your editor first!
general {
output_format = "i3bar"
colors = true
interval = 3
color_bad = "#cf6a4c"
color_degraded = "#f9ee98"
color_good = "#8f9d6a"
}
#order += "disk /"
order += "cpu_usage"
#order += "cpu_temperature 0"
order += "wireless _first_"
order += "battery 0"
order += "volume master"
order += "tztime local"
wireless _first_ {
format_up = " %essid:%quality"
format_down = " ---"
}
ethernet _first_ {
# if you use %speed, i3status requires root privileges
format_up = " %ip"
format_down = " ---"
}
battery 0 {
hide_seconds = true
integer_battery_capacity = true
low_threshold = 15
threshold_type = "percentage"
format = "%status %percentage %remaining"
status_chr = ""
status_bat = ""
status_full = ""
}
tztime local {
format = " %a %d %b  %I:%M %p"
}
disk "/" {
format = "%used/%total"
threshold_type = "percentage"
low_threshold = 10
}
cpu_usage {
format = " %usage"
}
volume master {
format = " %volume"
format_muted = " (%volume)"
device = "default"
mixer = "Master"
mixer_idx = 0
}
cpu_temperature 0 {
format = "%degrees°C"
max_threshold = 65
}

View file

@ -1,3 +0,0 @@
#!/bin/bash
swaylock -i ~/Documents/ressources/wallpapers/morty.jpg

View file

@ -1,6 +1,6 @@
#!/bin/bash
required="sway swayidle swaylock waybar"
required="sway swayidle swaylock waybar fzf"
BIN_FOLDER="$HOME/.local/bin"
printf "Checking required programs :\n"