From ebb4a0182db4572cf795f50cb2de9612f1285254 Mon Sep 17 00:00:00 2001 From: Nicolas Beaussart Date: Sun, 2 May 2021 23:20:19 +0200 Subject: [PATCH] General work --- general/espanso/default.yml | 1 + general/i3config | 4 +++- general/polybar.config | 11 ++++++++++- general/scripts/keyboard_switch.sh | 20 ++++++++++++++++++++ general/starship.toml | 12 +++--------- 5 files changed, 37 insertions(+), 11 deletions(-) create mode 100755 general/scripts/keyboard_switch.sh diff --git a/general/espanso/default.yml b/general/espanso/default.yml index 8362e3b..f5eea54 100644 --- a/general/espanso/default.yml +++ b/general/espanso/default.yml @@ -4,6 +4,7 @@ # You can refer to the official documentation: # https://espanso.org/docs/ toggle_key: OFF +backend: Auto # Matches are the substitution rules, when you type the "trigger" string # it gets replaced by the "replace" string. matches: diff --git a/general/i3config b/general/i3config index d6407b6..984109e 100644 --- a/general/i3config +++ b/general/i3config @@ -232,12 +232,14 @@ new_window 1pixel #gaps inner all set 20 -gaps inner 5 +gaps inner 8 # toggle tiling / floating bindsym $mod+Shift+space floating toggle +bindsym $mod+O exec ~/scripts/keyboard_switch.sh --toggle & + exec --no-startup-id feh --bg-scale ~/.dotfiles/wall.jpg exec --no-startup-id xautolock -time 10 -locker ~/scripts/lock.sh -secure exec --no-startup-id exec picom -cb --config .compton.conf diff --git a/general/polybar.config b/general/polybar.config index 478ebd9..37278e7 100644 --- a/general/polybar.config +++ b/general/polybar.config @@ -66,7 +66,7 @@ inherit = bar/shared monitor = ${env:MONITOR:} bottom = true -modules-left = bluetooth-controll spotify vpncheck vpn-proton-status +modules-left = bluetooth-controll keyboard_switch spotify vpncheck vpn-proton-status modules-center = modules-right = ${env:MODULE_RIGHT:} @@ -135,6 +135,15 @@ tail = true click-left = ~/scripts/bluetooth.sh --toggle & format-underline = ${colors.blue} + +[module/keyboard_switch] +type = custom/script +exec = ~/scripts/keyboard_switch.sh +interval = 1 +click-left = ~/scripts/keyboard_switch.sh --toggle & +format-underline = ${colors.indigo} + + [module/filesystem] type = internal/fs interval = 25 diff --git a/general/scripts/keyboard_switch.sh b/general/scripts/keyboard_switch.sh new file mode 100755 index 0000000..be3e5a5 --- /dev/null +++ b/general/scripts/keyboard_switch.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +CURRENT_LANG=$(setxkbmap -print -verbose 10 | grep layout | rev | cut -d ' ' -f 1 | rev) + +case "$1" in + --toggle) + if [[ "$CURRENT_LANG" == "fr" ]]; then + setxkbmap us + else + setxkbmap fr + fi + espanso restart + exit 0 + + ;; + *) + echo " $CURRENT_LANG" + exit 0 + ;; +esac \ No newline at end of file diff --git a/general/starship.toml b/general/starship.toml index a04a92a..54c0636 100644 --- a/general/starship.toml +++ b/general/starship.toml @@ -1,5 +1,5 @@ -format = """ -$username\ +add_newline = false +format = """$username\ $hostname\ $shlvl\ $kubernetes\ @@ -72,7 +72,7 @@ symbol = " " [directory] read_only = " " -[docker] +[docker_context] symbol = " " [elixir] @@ -87,9 +87,6 @@ symbol = " " [golang] symbol = " " -[haskell] -symbol = " " - [hg_branch] symbol = " " @@ -108,9 +105,6 @@ symbol = " " [nix_shell] symbol = " " -[nodejs] -symbol = " " - [package] symbol = " "