Add .config/sway/bin/brightness.sh

Add .config/sway/bin/i3blocks-battery
Add .config/sway/bin/toggletouchpad.sh
Add .config/sway/blocks.conf
Add .config/sway/config
Add .config/sway/wallpaper.jpg
This commit is contained in:
Felix Delattre 2023-11-02 18:52:44 +00:00
parent bad55fc285
commit ef9efc1fd2
6 changed files with 496 additions and 0 deletions

View File

@ -0,0 +1,15 @@
#!/bin/bash
case "$1" in
increase)
CURRENT=`cat /sys/class/backlight/intel_backlight/brightness`
((FOO=CURRENT+500))
exec echo $FOO | tee /sys/class/backlight/intel_backlight/brightness
;;
decrease)
CURRENT=`cat /sys/class/backlight/intel_backlight/brightness`
((FOO=CURRENT-500))
exec echo $FOO | tee /sys/class/backlight/intel_backlight/brightness
;;
esac
exit 0

View File

@ -0,0 +1,61 @@
#!/usr/bin/perl
use strict;
use warnings;
use utf8;
my $acpi;
my $status;
my $percent;
my $full_text;
my $short_text;
my $bat_number = $ENV{BLOCK_INSTANCE} || 0;
# read the first line of the "acpi" command output
open (ACPI, "acpi -b | grep 'Battery $bat_number' |") or die;
$acpi = <ACPI>;
close(ACPI);
# fail on unexpected output
if ($acpi !~ /: (\w+), (\d+)%/) {
die "$acpi\n";
}
$status = $1;
$percent = $2;
$full_text = "";
if ($status eq 'Discharging') {
$full_text .= "⚡ $percent%";
if ($acpi =~ /(\d\d:\d\d):/) {
$full_text .= " ($1)";
}
} elsif ($status eq 'Charging') {
$full_text .= " $percent%";
}
elsif ($status eq 'Unknown' || $status eq 'Full') {
$full_text .= "⚡ $percent%";
}
# print text
print "$full_text\n";
print "$short_text\n";
# consider color and urgent flag only on discharge
if ($status eq 'Discharging') {
if ($percent < 20) {
print "#FF0000\n";
} elsif ($percent < 40) {
print "#FFAE00\n";
} elsif ($percent < 60) {
print "#FFF600\n";
} elsif ($percent < 85) {
print "#A8FF00\n";
}
if ($percent < 5) {
exit(33);
}
}
exit(0);

View File

@ -0,0 +1,5 @@
if synclient -l | grep "TouchpadOff .*=.*0" ; then
synclient TouchpadOff=1 ;
else
synclient TouchpadOff=0 ;
fi

158
dot_config/sway/blocks.conf Normal file
View File

@ -0,0 +1,158 @@
# i3blocks config file
#
# Please see man i3blocks for a complete reference!
# The man page is also hosted at http://vivien.github.io/i3blocks
#
# List of valid properties:
#
# align
# color
# command
# full_text
# instance
# interval
# label
# min_width
# name
# separator
# separator_block_width
# short_text
# signal
# urgent
# Global properties
#
# The top properties below are applied to every block, but can be overridden.
# Each block command defaults to the script name to avoid boilerplate.
command=/usr/share/i3blocks/$BLOCK_NAME
separator_block_width=15
markup=none
# Mail notifications
[mails]
label=
command= ~/.mail/bin/mail-status.sh
color=#666666
interval=10
signal=12
# CPU usage
#
# The script may be called with -w and -c switches to specify thresholds,
# see the script for details.
[cpu_usage]
label=
interval=10
#min_width=CPU: 100.00%
separator=false
color=#666666
# Memory usage
#
# The type defaults to "mem" if the instance is not specified.
[memory]
#label=M:
interval=30
#separator=false
color=#666666
#[memory]
#label=S:
#instance=swap
#interval=30
# Disk usage
#
# The directory defaults to $HOME if the instance is not specified.
# The script may be called with a optional argument to set the alert
# (defaults to 10 for 10%).
[disk]
label=
instance=/
interval=30
color=#666666
# Network interface monitoring
#
# If the instance is not specified, use the interface used for default route.
# The address can be forced to IPv4 or IPv6 with -4 or -6 switches.
#[iface]
#instance=wlp3s0
#color=#666666
#interval=10
#separator=false
#[ssid]
#label=
#command=echo "$(iw dev wlp3s0 link | grep SSID | cut -d " " -f 2-)"
#color=#d33682
#interval=5
#separator=false
#[strength]
#label=E
#command=echo "$(iw dev wlp3s0 link | grep signal | cut -d " " -f 2-)"
#interval=10
#color=#cb4b16
#[wifi]
#color=#666666
#label=Wi
#instance=wlp3s0
#interval=10
#[bandwidth]
#instance=eth0
#interval=5
#[load_average]
#interval=10
# Battery indicator
#
# The battery instance defaults to 0.
[battery]
command=~/.config/i3/bin/i3blocks-battery BAT0
interval=5
color=#666666
# Date Time
#
[time]
command=date '+%H:%M %Y-%m-%d'
interval=5
color=#666666
# Generic media player support
#
# This displays "ARTIST - SONG" if a music is playing.
# Supported players are: spotify, vlc, audacious, xmms2, mplayer, and others.
#[mediaplayer]
#instance=spotify
#interval=5
#signal=10
# OpenVPN support
#
# Support multiple VPN, with colors.
#[openvpn]
#interval=20
# Key indicators
#
# Add the following bindings to i3 config file:
#
# bindsym --release Caps_Lock exec pkill -SIGRTMIN+11 i3blocks
# bindsym --release Num_Lock exec pkill -SIGRTMIN+11 i3blocks
#[keyindicator]
#instance=CAPS
#interval=once
#signal=11
#[keyindicator]
#instance=NUM
#interval=once
#signal=11

257
dot_config/sway/config Normal file
View File

@ -0,0 +1,257 @@
# sway config file (v4)
set $mod Mod4
# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
#font pango:monospace 8
font pango:DejaVu Sans Mono 8
for_window [class="^."] border pixel 2
for_window [app_id="x-terminal-emulator"] border pixel 2
for_window [app_id="org.gnome.Nautilus"] border pixel 2
hide_edge_borders smart
titlebar_padding 1
titlebar_border_thickness 0
# Window border
set $bo #00adee
set $se #363636
set $ur #f7003a
set $dr #bb0020
set $t1 #888888
set $t2 #ffffff
set $bl #000001
client.focused $bl $bo $bl $t2
client.unfocused $bl $se $t1 $se
client.focused_inactive $bl $bl $bo $se
client.urgent $ur $ur $bl $ur
client.background $bl
# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod
# kill focused window
bindsym $mod+Shift+q kill
# rofi is a nice programm launcher
bindsym $mod+d exec rofi -show run
# Terminal shortcut
bindsym $mod+Return exec i3-sensible-terminal
# change focus
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right
bindsym $mod+j focus left
bindsym $mod+k focus down
bindsym $mod+l focus up
bindsym $mod+semicolon focus right
# move focused window
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+Shift+j move left
bindsym $mod+Shift+k move down
bindsym $mod+Shift+l move up
bindsym $mod+Shift+semicolon move right
bindsym $mod+Shift+1 move workspace $workspace1
bindsym $mod+Shift+2 move workspace $workspace2
bindsym $mod+Shift+3 move workspace $workspace3
bindsym $mod+Shift+4 move workspace $workspace4
bindsym $mod+Shift+5 move workspace $workspace5
bindsym $mod+Shift+6 move workspace $workspace6
bindsym $mod+Shift+7 move workspace $workspace7
bindsym $mod+Shift+8 move workspace $workspace8
bindsym $mod+Shift+9 move workspace $workspace9
bindsym $mod+Shift+0 move workspace $workspace10
# split in horizontal orientation
# bindsym $mod+h split h
# split in vertical orientation
# bindsym $mod+v split v
# enter fullscreen mode for the focused container
bindsym $mod+f fullscreen toggle
# change container layout (stacked, tabbed, toggle split)
bindsym $mod+s layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split
# 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+a focus parent
# focus the child container
#bindsym $mod+d focus child
set $workspace1 1
set $workspace2 2
set $workspace3 3
set $workspace4 4
set $workspace5 5
set $workspace6 6
set $workspace7 7
set $workspace8 8
set $workspace9 9
set $workspace10 10
workspace $workspace1 output LVDS-1
workspace $workspace2 output LVDS-1
workspace $workspace3 output LVDS-1
workspace $workspace4 output LVDS-1
workspace $workspace5 output LVDS-1
workspace $workspace6 output LVDS-1
workspace $workspace7 output LVDS-1
workspace $workspace8 output LVDS-1
workspace $workspace9 output LVDS-1
workspace $workspace10 output LVDS-1
# switch to workspace
bindsym $mod+1 workspace $workspace1
bindsym $mod+2 workspace $workspace2
bindsym $mod+3 workspace $workspace3
bindsym $mod+4 workspace $workspace4
bindsym $mod+5 workspace $workspace5
bindsym $mod+6 workspace $workspace6
bindsym $mod+7 workspace $workspace7
bindsym $mod+8 workspace $workspace8
bindsym $mod+9 workspace $workspace9
bindsym $mod+0 workspace $workspace10
# reload the configuration file
bindsym $mod+Shift+c reload
# 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 semicolon 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"
bindsym $mod+Tab workspace next
bindsym $mod+Shift+Tab workspace prev
# bindsym $mod+Shift+n exec --no-startup-id ~/.config/sway/bin/monitors.sh one
# bindsym $mod+Shift+m exec --no-startup-id ~/.config/sway/bin/monitors.sh two
# Move workspaces on monitors
bindsym Shift+$mod+bracketright move workspace to output right
bindsym Shift+$mod+bracketleft move workspace to output left
# 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 20 # increase screen brightness
bindsym XF86MonBrightnessDown exec xbacklight -dec 20 # decrease screen brightness
#bindsym XF86MonBrightnessUp exec ~/.config/sway/bin/brightness.sh increase # increase screen brightness
#bindsym XF86MonBrightnessDown exec ~/.config/sway/bin/brightness.sh decrease # decrease screen brightness
# Touchpad controls
# bindsym XF86TouchpadToggle exec /some/path/toggletouchpad.sh # toggle touchpad
# Media player controls
bindsym XF86AudioPlay exec playerctl play
bindsym XF86AudioPause exec playerctl pause
bindsym XF86AudioNext exec playerctl next
bindsym XF86AudioPrev exec playerctl previous
# Set background wallpaper
exec --no-startup-id nm-applet --indicator
exec --no-startup-id blueman-applet
exec --no-startup-id volumeicon
exec_always --no-startup-id feh --bg-scale ~/.config/sway/personal/wallpaper.jpg
set $locker swaylock -c 000000 --daemonize --ignore-empty-password --show-failed-attempts
exec swayidle -w \
timeout 300 'swaymsg "output * dpms off"' \
timeout 305 "$lock_command" \
timeout 5 'if pgrep -x swaylock; then swaymsg "output * dpms off"; fi' \
resume 'swaymsg "output * dpms on"' \
before-sleep "$lock_command"
# Logout commands
set $mode_system System (l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (Shift+s) shutdown
mode "$mode_system" {
bindsym l exec --no-startup-id $locker, mode "default"
bindsym e exec --no-startup-id swaymsg exit, mode "default"
bindsym s exec --no-startup-id $locker && systemctl suspend, mode "default"
bindsym h exec --no-startup-id $locker && systemctl hibernate, mode "default"
bindsym r exec --no-startup-id systemctl reboot, mode "default"
bindsym Shift+s exec --no-startup-id systemctl poweroff -i, mode "default"
# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+Escape mode "$mode_system"
# Start swaybar to display a workspace bar
bar {
colors {
# Whole color settings
background #000000
statusline #ffffff
separator #666666
# Type border background font
focused_workspace #000000 #000000 #007fff
active_workspace #333333 #000000 #5f676a
inactive_workspace #000000 #000000 #888888
urgent_workspace #aa0000 #990000 #ffffff
}
position top
status_command i3blocks -c ~/.config/sway/blocks.conf
}
# Use XFCE services
exec --no-startup-id xfsettingsd --sm-client-disable &
# Use compose key for more characters
exec --no-startup-id setxkbmap -option compose:ralt
input type:keyboard {
xkb_layout us
xkb_variant intl
}
output "*" bg ~/.config/sway/wallpaper.jpg fill

Binary file not shown.

After

Width:  |  Height:  |  Size: 311 KiB