diff --git a/install.yml b/install.yml index bde9258..5204fef 100644 --- a/install.yml +++ b/install.yml @@ -6,15 +6,15 @@ egpu: false theme: "blue" workspaces: - - "1:" - - "2:" - - "3:" - - "4:" - - "5:" - - "6:" - - "7" - - "8" - - "9" + - "1:Mail:" + - "2:Browser:" + - "3:Dev:" + - "4:Misc.1:" + - "5:Misc.2:" + - "6:Misc.3:" + - "7:Misc.4:" + - "8:Misc.5:" + - "9:Spotify:" roles: - core vars_files: diff --git a/roles/core/templates/.bin/switch_display.sh b/roles/core/templates/.bin/switch_display.sh new file mode 100755 index 0000000..bdd24e5 --- /dev/null +++ b/roles/core/templates/.bin/switch_display.sh @@ -0,0 +1,55 @@ +#!/bin/bash + +getBashVersion() { + echo $(echo ${BASH_VERSION} | sed -E 's|([0-9])\..*|\1|') +} + +bash_version="$(getBashVersion)" + +switchDisplay() { + if [ $bash_version -ge 4 ] #$1 contains bash version, we check that it is >=4 to use mapfile + then + mapfile -t activeOutputs < <(xrandr | grep -E " connected (primary )?[1-9]+" | sed -e "s/\([A-Z0-9]\+\) connected.*/\1/") + mapfile -t connectedOutputs < <(xrandr | grep " connected" | sed -e "s/\([A-Z0-9]\+\) connected.*/\1/") + else + IFS=$'\n' read -r -d '' -a activeOutputs < <(xrandr | grep -E " connected (primary )?[1-9]+" | sed -e "s/\([A-Z0-9]\+\) connected.*/\1/") + IFS=$'\n' read -r -d '' -a connectedOutputs < <(xrandr | grep " connected" | sed -e "s/\([A-Z0-9]\+\) connected.*/\1/") + fi + + outputToActivate=$(echo ${activeOutputs[@]} ${activeOutputs[@]} ${connectedOutputs[@]} | tr ' ' '\n' | sort | uniq -u) + + if [ ! -z "$outputToActivate" ] + then + xrandr --output "${activeOutputs[0]}" --off --output "$outputToActivate" --auto + else + xrandr --output "${activeOutputs[1]}" --off --output "${activeOutputs[0]}" --auto + fi +} + +activeAll() { + if [ $bash_version -ge 4 ] #$1 contains bash version, we check that it is >=4 to use mapfile + then + mapfile -t connectedOutputs < <(xrandr | grep " connected" | sed -e "s/\([A-Z0-9]\+\) connected.*/\1/") + else + IFS=$'\n' read -r -d '' -a connectedOutputs < <(xrandr | grep " connected" | sed -e "s/\([A-Z0-9]\+\) connected.*/\1/") + fi + execute="xrandr " + for display in ${connectedOutputs[@]} + do + execute=$execute"--output $display --auto " + done + `$execute` +} + +if [ -z "$1" ] +then + switchDisplay "${activeOutputs[@]}" "${connectedOutputs[@]}" +elif [ "$1" == "-a" ] || [ "$1" == "--all" ] +then + activeAll $connectedOutputs +else + echo "Unknow given argument \"$1\"" + echo "How to use this script =>" + echo "\"switch_display\" will swap your displays" + echo "\"switch_display -a\" or \"switch_display --all\" will switch all your displays on" +fi \ No newline at end of file diff --git a/roles/core/templates/.bin/touchpad.sh b/roles/core/templates/.bin/touchpad.sh new file mode 100755 index 0000000..43158d8 --- /dev/null +++ b/roles/core/templates/.bin/touchpad.sh @@ -0,0 +1,8 @@ +#!/bin/bash +id=$(xinput | sed '/Touchpad/s/.*id=\([0-9]*\).*/\1/;t;d') +status=$(xinput --list-props $id | grep "Device Enabled" | cut -f 3) +if [ $status -eq 1 ]; then + xinput --disable $id +else + xinput --enable $id +fi \ No newline at end of file diff --git a/roles/core/templates/.i3/config b/roles/core/templates/.i3/config index 5bfe529..c5c0304 100644 --- a/roles/core/templates/.i3/config +++ b/roles/core/templates/.i3/config @@ -42,16 +42,18 @@ bindsym $mod+z exec --no-startup-id morc_menu ## sound-section - DO NOT EDIT if you wish to automatically upgrade Alsa -> Pulseaudio later! ## ################################################################################################ -exec --no-startup-id volumeicon -##bindsym $mod+Ctrl+m exec terminal -e 'alsamixer' +#exec --no-startup-id volumeicon +#bindsym $mod+Ctrl+m exec terminal -e 'alsamixer' #exec --no-startup-id "pulseaudio --start" #exec --no-startup-id pa-applet bindsym $mod+Ctrl+m exec pavucontrol -# Pulse Audio controls -bindsym XF86AudioRaiseVolume exec --no-startup-id "~/.i3/vol.sh up" -bindsym XF86AudioLowerVolume exec --no-startup-id "~/.i3/vol.sh down" -bindsym XF86AudioMute exec "~/.i3/vol.sh toggle" +# Use pactl to adjust volume in PulseAudio. +set $refresh_i3status killall -SIGUSR1 i3status +bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $refresh_i3status +bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10% && $refresh_i3status +bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status +bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3status # Media player controls bindsym XF86AudioPlay exec playerctl play-pause @@ -67,7 +69,7 @@ bindsym XF86AudioPrev exec playerctl previous # Start Applications bindsym $mod+Ctrl+b exec terminal -e 'bmenu' -bindsym $mod+F2 exec palemoon +bindsym $mod+F2 exec firefox bindsym $mod+F3 exec pcmanfm # bindsym $mod+F3 exec ranger bindsym $mod+Shift+F3 exec gksu pcmanfm @@ -75,13 +77,13 @@ bindsym $mod+F5 exec terminal -e 'mocp' bindsym $mod+t exec --no-startup-id pkill compton bindsym $mod+Ctrl+t exec --no-startup-id compton -b bindsym $mod+Shift+d --release exec "killall dunst; exec notify-send 'restart dunst'" -bindsym Print exec --no-startup-id flameshot gui +bindsym Print exec --no-startup-id i3-scrot bindsym $mod+Print --release exec --no-startup-id i3-scrot -w bindsym $mod+Shift+Print --release exec --no-startup-id i3-scrot -s bindsym $mod+Shift+h exec xdg-open /usr/share/doc/manjaro/i3_help.pdf bindsym $mod+Ctrl+x --release exec --no-startup-id xkill -# focus_follows_mouse no +focus_follows_mouse no # change focus bindsym $mod+j focus left @@ -190,15 +192,15 @@ bindsym $mod+Shift+2 move container to workspace $ws2; workspace $ws2 bindsym $mod+Shift+3 move container to workspace $ws3; workspace $ws3 bindsym $mod+Shift+4 move container to workspace $ws4; workspace $ws4 bindsym $mod+Shift+5 move container to workspace $ws5; workspace $ws5 -bindsym $mod+Shift+- move container to workspace $ws6; workspace $ws6 +bindsym $mod+Shift+6 move container to workspace $ws6; workspace $ws6 bindsym $mod+Shift+7 move container to workspace $ws7; workspace $ws7 bindsym $mod+Shift+8 move container to workspace $ws8; workspace $ws8 bindsym $mod+Shift+9 move container to workspace $ws9; workspace $ws9 # Open applications on specific workspaces -# assign [class="Thunderbird"] $ws1 -# assign [class="Pale moon"] $ws2 -# assign [class="Pcmanfm"] $ws3 +assign [class="Thunderbird"] $ws1 +assign [class="firefox"] $ws2 +assign [class="Pcmanfm"] $ws8 # assign [class="Skype"] $ws5 # Open specific applications in floating mode @@ -225,7 +227,7 @@ for_window [class="qt5ct"] floating enable sticky enable border normal for_window [class="Qtconfig-qt4"] floating enable sticky enable border normal for_window [class="Simple-scan"] floating enable border normal for_window [class="(?i)System-config-printer.py"] floating enable border normal -for_window [class="Skype"] floating enable border normal +#for_window [class="Skype"] floating enable border normal for_window [class="Timeset-gui"] floating enable border normal for_window [class="Oracle VM Virtualbox Manager"] floating enable border normal for_window [class="Xfburn"] floating enable @@ -248,7 +250,7 @@ bindsym $mod+Shift+s exec "~/.bin/switch_mono_screen.sh; nitrogen --restore && i 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'" # Set shut down, restart and locking features -bindsym $mod+0 mode "$mode_system" +bindsym $mod+Delete mode "$mode_system" set $mode_system (l)ock, (e)xit, switch_(u)ser, (s)uspend, (h)ibernate, (r)eboot, (Shift+s)hutdown mode "$mode_system" { bindsym l exec --no-startup-id i3exit lock, mode "default" @@ -295,11 +297,11 @@ exec --no-startup-id /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 exec --no-startup-id nitrogen --restore; #exec --no-startup-id nitrogen --restore; sleep 1; compton -b #exec --no-startup-id manjaro-hello -exec --no-startup-id nm-applet +#exec --no-startup-id nm-applet exec --no-startup-id xfce4-power-manager -exec --no-startup-id pamac-tray +# exec --no-startup-id pamac-tray # exec --no-startup-id blueman-applet -# exec_always --no-startup-id sbxkb +# exec_alwa#ys --no-startup-id sbxkb exec --no-startup-id start_conky_maia # exec --no-startup-id start_conky_green # exec --no-startup-id xautolock -time 10 -locker blurlock @@ -352,27 +354,41 @@ bar { padding 2 - colors { - background #222D31 - statusline #F9FAF9 - separator #454947 - focused_workspace {{ theme.color.normal.highlight }} {{ theme.color.normal.highlight }} #292F34 - active_workspace #595B5B #353836 #FDF6E3 - inactive_workspace #595B5B #222D31 #EEE8D5 - binding_mode {{ theme.color.normal.highlight }} #2C2C2C #F9FAF9 - urgent_workspace {{ theme.color.normal.highlight }} #FDF6E3 #E5201D - } + colors { + background #222D31 + statusline #F9FAF9 + separator #454947 + focused_workspace {{ theme.color.normal.highlight }} {{ theme.color.normal.highlight }} #292F34 + active_workspace #595B5B #353836 #FDF6E3 + inactive_workspace #595B5B #222D31 #EEE8D5 + binding_mode {{ theme.color.normal.highlight }} #2C2C2C #F9FAF9 + urgent_workspace {{ theme.color.normal.highlight }} #FDF6E3 #E5201D + } } +# Start i3bar to display a workspace bar (plus the system information i3status if available) +# bar { +# font pango:Inconsolata, Font Awesome 6 Free 14px +# position bottom +# status_command i3status-rs ~/.i3/config.toml +# strip_workspace_numbers yes +# colors { +# background #2e3440 +# focused_workspace #0088CC #0088CC #ffffff +# active_workspace #333333 #333333 #ffffff +# inactive_workspace #333333 #2e3440 #888888 +# urgent_workspace #2f343a #900000 #ffffff +# } +# } # hide/unhide i3status bar # bindsym $mod+m bar mode toggle # Theme colors # class border backgr. text indic. child_border - client.focused {{ theme.color.focus.background }} {{ theme.color.focus.background }} {{ theme.color.focus.highlight }} #FDF6E3 - client.focused_inactive {{ theme.color.normal.background }} {{ theme.color.normal.background }} {{ theme.color.normal.highlight }} #454948 - client.unfocused {{ theme.color.normal.background }} {{ theme.color.normal.background }} {{ theme.color.normal.highlight }} #454948 - client.urgent #CB4B16 #FDF6E3 {{ theme.color.normal.highlight }} #268BD2 + client.focused #496d86 #496d86 #FDF6E3 #FDF6E3 + client.focused_inactive #2F3D44 #2F3D44 #3498db #454948 + client.unfocused #2F3D44 #2F3D44 #3498db #454948 + client.urgent #CB4B16 #FDF6E3 #3498db #268BD2 client.placeholder #000000 #0c0c0c #ffffff #000000 client.background #2B2C2B @@ -432,4 +448,4 @@ mode "$mode_gaps_outer" { bindsym Return mode "default" bindsym Escape mode "default" -} +} \ No newline at end of file diff --git a/roles/core/templates/.i3/config.toml b/roles/core/templates/.i3/config.toml index fe7f35f..1278ce1 100644 --- a/roles/core/templates/.i3/config.toml +++ b/roles/core/templates/.i3/config.toml @@ -1,27 +1,159 @@ -icons_format = "{icon}" - [theme] -theme = "semi-native" +#theme = "nord-dark" +theme = "dracula" [icons] -icons = "awesome5" +icons = "awesome6" + +[[block]] +block = "memory" +format = " $icon $mem_used.eng(prefix:M)/$mem_total.eng(prefix:M) " +format_alt = " $icon_swap $swap_used.eng(prefix:M)/$swap_total.eng(prefix:M) " +interval = 5 +warning_mem = 80 +warning_swap = 80 +critical_mem = 95 +critical_swap = 95 [[block]] block = "cpu" +interval = 1 +format = " $icon $utilization " [[block]] -block = "memory" -format = " $icon $mem_total_used_percents.eng(w:2) " -format_alt = " $icon_swap $swap_used_percents.eng(w:2) " +block = "temperature" +format_alt = "$icon " +interval = 10 +format = " $icon $average " [[block]] -block = "battery" +block = "weather" +format = " $icon $weather (Mende) $temp " +[block.service] +name = "openweathermap" +api_key = "1ee37fef2e1668e418c3cebd62e6ccd2" +city_id = "2994617" +units = "metric" + +[[block]] +block = "weather" +format = " $icon $weather (Cocurès) $temp " +[block.service] +name = "openweathermap" +api_key = "1ee37fef2e1668e418c3cebd62e6ccd2" +city_id = "2997288" +units = "metric" + +[[block]] +block = "pacman" +interval = 600 +format = " $icon $aur updates available " +format_singular = " $icon $aur update available " +format_up_to_date = " $icon System up-to-date " +critical_updates_regex = "(linux |linux-lts|linux-zen)" +# aur_command should output available updates to stdout (ie behave as echo -ne "update\n") +aur_command = "pamac checkupdates -qa" +signal = 1 +[[block.click]] +button = "left" +cmd = "pamac-manager --updates" +[[block.click]] +button = "right" +update = true [[block]] block = "music" -format = " $icon {$combo.str(max_w:20) $play $next |}" +format = " $icon {$combo.str(max_w:25,rot_interval:0.5) $play $next |}" +[[block.click]] +button = "left" +action = "play_pause" +[[block.click]] +button = "up" +action = "volume_up" +[[block.click]] +button = "down" +action = "volume_down" +[[block.click]] +button = "forward" +action = "seek_forward" +[[block.click]] +button = "back" +action = "seek_backward" + +[[block]] +block = "sound" +step_width = 3 +[[block.click]] +button = "left" +cmd = "pavucontrol" + +[[block]] +block = "bluetooth" +mac = "00:00:AB:BD:8E:8B" +disconnected_format = " $icon Not connected " +format = " $icon $name{ $percentage|} " +[block.battery_state] +"0..20" = "critical" +"21..70" = "warning" +"71..100" = "good" +[[block.click]] +button = "left" +cmd = "~/.i3/scripts/switch_bluetooth_device.sh bluez_card.00_00_AB_BD_8E_8B" +[[block.click]] +button = "double_left" +cmd = "~/.i3/scripts/connect.sh 00_00_AB_BD_8E_8B" + +[[block]] +block = "net" +format = " $icon $ssid $ip " +inactive_format = "" +missing_format = "" +device = "wlo1" +[[block.click]] +button = "left" +cmd = "alacritty -e nmtui" +[[block.click]] +button = "right" +cmd = "protonvpn" + +[[block]] +block = "net" +format = " $icon $ip " +inactive_format = "" +missing_format = "" +device = "eno2" +[[block.click]] +button = "left" +cmd = "alacritty -e nmtui" +[[block.click]] +button = "right" +cmd = "protonvpn" + +[[block]] +block = "net" +format = " $icon $ip " +missing_format = "" +device = "tun0" +[[block.click]] +button = "left" +cmd = "alacritty -e nmtui" + +[[block]] +block = "net" +format = " $icon $ip " +missing_format = "" +device = "proton0" +[[block.click]] +button = "left" +cmd = "protonvpn" [[block]] block = "time" -interval = 5 -format = " $timestamp.datetime(f:'%a %d/%m %R') " \ No newline at end of file +interval = 1 +format = " $icon $timestamp.datetime(f:'%d/%m/%Y %T %Z') " +timezone = "Europe/Paris" + +[[block]] +block = "battery" +interval = 10 +format = " $icon $percentage {$time |} " \ No newline at end of file diff --git a/roles/core/templates/.i3/scripts/connect.sh b/roles/core/templates/.i3/scripts/connect.sh new file mode 100755 index 0000000..b6cdb58 --- /dev/null +++ b/roles/core/templates/.i3/scripts/connect.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +device_mac_address=$1 + +bluetoothctl -- pair ${device_mac_address} && sleep 5 +bluetoothctl -- trust ${device_mac_address} +bluetoothctl -- connect ${device_mac_address} \ No newline at end of file diff --git a/roles/core/templates/.i3/scripts/switch_bluetooth_device.sh b/roles/core/templates/.i3/scripts/switch_bluetooth_device.sh new file mode 100755 index 0000000..7b0357f --- /dev/null +++ b/roles/core/templates/.i3/scripts/switch_bluetooth_device.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +device_mac_address=$1 + +if [[ $(pacmd list-cards | grep -c "name: <${device_mac_address}>") -eq 0 ]]; then + exit 0; +elif [[ $(pacmd list-cards | grep -c "active profile: ") -eq 1 ]]; then + echo "Enable \"handsfree_head_unit\" profile for device \"${device_mac_address}\""; + pacmd set-card-profile ${device_mac_address} handsfree_head_unit; +else + echo "Enable \"a2dp_sink\" profile for device \"${device_mac_address}\""; + pacmd set-card-profile ${device_mac_address} a2dp_sink; +fi \ No newline at end of file diff --git a/roles/core/templates/.i3/vol.sh b/roles/core/templates/.i3/vol.sh deleted file mode 100755 index f6d7f33..0000000 --- a/roles/core/templates/.i3/vol.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/sh - -VOL_STEPS=5 - -vol() { - pamixer --get-volume -} - -inc() { - [[ -n "$1" ]] && VOL_STEPS=$1 - pamixer --unmute --allow-boost --increase $VOL_STEPS - [[ -z "$2" ]] && notifyVolume -} - -dec() { - [[ -n "$1" ]] && VOL_STEPS=$1 - pamixer --unmute --allow-boost --decrease $VOL_STEPS - [[ -z "$2" ]] && notifyVolume -} - -mute() { - pamixer -t - - local m=$(pamixer --get-mute) - if [[ "$m" == "true" ]] - then - notify-send "Mute" -i "audio-subwoofer" -t 2000 -h string:synchronous:"─" - else - notify-send "Unmute" -i "audio-subwoofer-testing" -t 2000 -h string:synchronous:"─" - fi; -} - -notifyVolume() { - local v=$(pamixer --get-volume) - [[ "$v" -gt 100 ]] && v=100 # max value - - notify-send "Volume $v" -i "audio-subwoofer-testing" -t 2000 -h int:value:"$v" -h string:synchronous:"─" -} - -case "$1" in - up) - inc "$2" "$3" - ;; - down) - dec "$2" "$3" - ;; - toggle) - mute - ;; - n|noti|notify) - noti - ;; - *) - vol - ;; -esac \ No newline at end of file