From 093fc5ae7733f4468139382de2ce99ecfada9920 Mon Sep 17 00:00:00 2001 From: bvn13 Date: Tue, 4 Aug 2020 14:51:05 +0300 Subject: [PATCH] updated i3status-rust config --- config | 61 ++++--- dunstrc | 54 ++++++ i3lock-fancy-dualmonitor | 6 + i3status-rust.toml | 63 ++++++- kbd-layout.c | 38 ++++ polybar.conf | 380 +++++++++++++++++++++++++++++++++++++++ polybar.conf~ | 374 ++++++++++++++++++++++++++++++++++++++ 7 files changed, 946 insertions(+), 30 deletions(-) create mode 100644 dunstrc create mode 100644 kbd-layout.c create mode 100644 polybar.conf create mode 100644 polybar.conf~ diff --git a/config b/config index d6aae11..4364421 100644 --- a/config +++ b/config @@ -11,11 +11,11 @@ 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:Iosevka Medium 8 +font pango:Iosevka Medium 8 # This font is widely installed, provides lots of unicode glyphs, right-to-left # text rendering and scalability on retina/hidpi displays (thanks to pango). -font pango:DejaVu Sans Mono 8 +#font pango:DejaVu Sans Mono 8 # Before i3 v4.8, we used to recommend this one as the default: # font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1 @@ -27,6 +27,15 @@ font pango:DejaVu Sans Mono 8 # Use Mouse+$mod to drag floating windows to their wanted position floating_modifier $mod +# Mouse warping +mouse_warping none + +# PopUps during fullscreen mode +popup_during_fullscreen smart + +# Focus on window activation +focus_on_window_activation urgent + # start a terminal #bindsym $mod+Return exec i3-sensible-terminal bindsym $mod+Return exec terminator @@ -35,8 +44,13 @@ bindsym $mod+Return exec terminator bindsym $mod+Shift+q kill # start dmenu (a program launcher) -bindsym $mod+Shift+d exec dmenu_run -bindsym $mod+d exec j4-dmenu-desktop +#bindsym $mod+Shift+d exec dmenu_run +#bindsym $mod+d exec j4-dmenu-desktop + +bindsym --release $mod+Shift+d exec "rofi -show run" +bindsym --release $mod+d exec "rofi -show drun" +bindsym --release $mod+Control+d exec "rofi -show window" + # There also is the (new) i3-dmenu-desktop which only displays applications # shipping a .desktop file. It is a wrapper around dmenu, so you need that # installed. @@ -66,6 +80,10 @@ bindsym $mod+Shift+Down move down bindsym $mod+Shift+Up move up bindsym $mod+Shift+Right move right +# Moving workspaces between screens +bindsym $mod+period move workspace to output right +bindsym $mod+comma move workspace to output left + # split in horizontal orientation bindsym $mod+h split h @@ -176,13 +194,6 @@ bindsym --release Print exec --no-startup-id scrot -m '%Y%m%d- bindsym --release $mod+Print exec --no-startup-id scrot -s '/tmp/%F_%T_$wx$h.png' -e 'xclip -selection clipboard -target image/png -i $f' ### Audio volume -#bindsym --release XF86AudioMute exec --no-startup-id "pactl set-sink-mute 1 toggle" -#bindsym --release XF86AudioRaiseVolume exec --no-startup-id "pactl set-sink-mute 1 false ; pactl set-sink-volume 1 +5%" -#bindsym --release Shift+XF86AudioRaiseVolume exec --no-startup-id "pactl set-sink-mute 1 false ; pactl set-sink-volume 1 +1%" -#bindsym --release XF86AudioLowerVolume exec --no-startup-id "pactl set-sink-mute 1 false ; pactl -- set-sink-volume 1 -5%" -#bindsym --release Shift+XF86AudioLowerVolume exec --no-startup-id "pactl set-sink-mute 1 false ; pactl -- set-sink-volume 1 -1%" -#bindsym --release XF86AudioMicMute exec --no-startup-id "pactl set-source-mute 1 toggle" - bindsym XF86AudioMute exec --no-startup-id "amixer -D pulse sset Master toggle" bindsym XF86AudioRaiseVolume exec --no-startup-id "amixer -D pulse sset Master 10%+" bindsym Shift+XF86AudioRaiseVolume exec --no-startup-id "amixer -D pulse sset Master 5%+" @@ -192,11 +203,6 @@ bindsym XF86AudioMicMute exec --no-startup-id "amixer -D pulse ss mode "mode_mic" { -# bindsym Up exec --no-startup-id "pactl set-source-mute 1 false ; pactl set-source-volume 1 +5%" -# bindsym Shift+Up exec --no-startup-id "pactl set-source-mute 1 false ; pactl set-source-volume 1 +1%" -# bindsym Down exec --no-startup-id "pactl set-source-mute 1 false ; pactl -- set-source-volume 1 -5%" -# bindsym Shift+Down exec --no-startup-id "pactl set-source-mute 1 false ; pactl -- set-source-volume 1 -1%" - bindsym Up exec --no-startup-id "amixer -D pulse sset Capture 10%+" bindsym Shift+Up exec --no-startup-id "amixer -D pulse sset Capture 5%+" bindsym Down exec --no-startup-id "amixer -D pulse sset Capture 10%-" @@ -209,7 +215,7 @@ mode "mode_mic" { bindsym $mod+m mode "mode_mic" # lock screen -bindsym Mod4+l exec --no-startup-id ~/.config/i3/i3lock-fancy-dualmonitor +bindsym $mod+l exec --no-startup-id ~/.config/i3/i3lock-fancy-dualmonitor # Start i3bar to display a workspace bar (plus the system information i3status # finds out, if available) @@ -217,7 +223,8 @@ bar { # status_command i3status # status_command i3status --config ~/.config/i3/i3status.conf - font pango:FontAwesome, DejaVu Sans Mono 9 +# font pango:FontAwesome, DejaVu Sans Mono 9 + font pango: Iosevka 9 position top status_command i3status-rs ~/.config/i3/i3status-rust.toml colors { @@ -233,13 +240,17 @@ bar { ## my +exec --no-startup-id 'xset -b' -exec --no-startup-id setxkbmap -layout us,ru -exec --no-startup-id setxkbmap -option 'grp:caps_toggle' -exec "compton -c -r4 -l-6 -t-4 -z -b -G -C -e0.85 -f -D30 -I0.45 -O0.45 --paint-on-overlay --unredir-if-possible --backend glx --glx-no-stencil --glx-no-rebind-pixmap --inactive-dim 0.1 --no-fading-openclose --inactive-dim-fixed --config /dev/null" -exec --no-startup-id hsetroot -solid '#000000' -exec --no-startup-id dunst -exec --no-startup-id nm-applet +exec --no-startup-id "setxkbmap -layout us,ru -option grp:caps_toggle" + +#exec "compton -c -r4 -l-6 -t-4 -z -b -G -C -e0.85 -f -D30 -I0.45 -O0.45 --paint-on-overlay --unredir-if-possible --backend glx --glx-no-stencil --glx-no-rebind-pixmap --inactive-dim 0.1 --no-fading-openclose --inactive-dim-fixed --config /dev/null" + +exec "compton -b -G -C -f -D30 -I0.45 -O0.45 --paint-on-overlay --unredir-if-possible --backend glx --glx-no-stencil --glx-no-rebind-pixmap --no-fading-openclose --inactive-dim-fixed --config /dev/null" + +exec --no-startup-id "hsetroot -solid '#000000'" +exec --no-startup-id "dunst" +exec nm-applet # windows managing @@ -248,3 +259,5 @@ bindsym $mod+x [urgent=latest] focus bindsym $mod+p exec pavucontrol for_window [class="(?i)pavucontrol"] floating enable +for_window [class="(?i)gnome-calculator"] floating enable +for_window [class="(?i)gnome-calendar"] floating enable diff --git a/dunstrc b/dunstrc new file mode 100644 index 0000000..3340ddc --- /dev/null +++ b/dunstrc @@ -0,0 +1,54 @@ +[global] +monitor = 0 +follow = mouse +geometry = "300x60-20+48" +indicate_hidden = yes +shrink = no +separator_height = 0 +padding = 32 +horizontal_padding = 32 +frame_width = 2 +sort = no +idle_threshold = 120 +font = rissole 8 +line_height = 4 +markup = full +format = "%s\n%b" +alignment = left +show_age_threshold = 60 +word_wrap = yes +ignore_newline = no +stack_duplicates = false +hide_duplicate_count = yes +show_indicators = no +icon_position = off +sticky_history = yes +history_length = 20 +browser = /usr/bin/firefox -new-tab +always_run_script = true +title = Dunst +class = Dunst + +[shortcuts] +close = ctrl+space +close_all = ctrl+shift+space +history = ctrl+grave +context = ctrl+shift+period + +[urgency_low] +timeout = 4 +background = "#141c21" +foreground = "#93a1a1" +frame_color = "#8bc34a" + +[urgency_normal] +timeout = 8 +background = "#141c21" +foreground = "#93a1a1" +frame_color = "#ba68c8" + +[urgency_critical] +timeout = 0 +background = "#141c21" +foreground = "#93a1a1" +frame_color = "#ff7043" diff --git a/i3lock-fancy-dualmonitor b/i3lock-fancy-dualmonitor index d35c2d5..ee51342 100755 --- a/i3lock-fancy-dualmonitor +++ b/i3lock-fancy-dualmonitor @@ -221,6 +221,8 @@ else # Bright colors "--ringwrongcolor=00000055" "--insidewrongcolor=0000001c") fi +xkb-switch -s us + # If invoked with -d/--desktop, we'll attempt to minimize all windows (ie. show # the desktop) before locking. ${desktop} ${desktop:+-k on} @@ -234,3 +236,7 @@ fi # As above, if we were passed -d/--desktop, we'll attempt to restore all windows # after unlocking. ${desktop} ${desktop:+-k off} + +sleep 10 +#xset dpms force suspend +xset dpms force off diff --git a/i3status-rust.toml b/i3status-rust.toml index 2f6979f..062e1e9 100644 --- a/i3status-rust.toml +++ b/i3status-rust.toml @@ -1,5 +1,55 @@ -theme = "solarized-dark" -icons = "awesome" +#theme = "solarized-dark" +[[theme]] +name = "modern" +[theme.overrides] +idle_bg = "#123456" +idle_fg = "#abcdef" +[[icons]] +name = "awesome" + +[[block]] +block = "toggle" +interval = 3 +text = "NO BLANK" +command_state = "xset q | grep 'DPMS is Disabled'" +#command_on = "xset s off -dpms; xset s 300 300" +#command_off = "xset s on +dpms" +command_on = "xset dpms force on" +command_off = "xset reset" + +[[block]] +block = "toggle" +interval = 1 +text = "ZOOM" +command_state = "pactl list short | grep bluez_sink.2C_4D_79_47_42_9F.headset_head_unit" +command_on = "pactl set-card-profile bluez_card.2C_4D_79_47_42_9F headset_head_unit" +command_off = "pactl set-card-profile bluez_card.2C_4D_79_47_42_9F a2dp_sink" + +[[block]] +block = "custom" +command = ''' +case "$(xset -q|grep LED| awk '{ print $10 }')" in + "00000002") KBD="En" ;; + "00000000") KBD="En" ;; + "00001002") KBD="Ru" ;; + "00001000") KBD="Ru" ;; + *) KBD="unknown" ;; +esac; echo $KBD +''' +interval = 0.5 +on_click = ''' +case "$(xset -q|grep LED| awk '{ print $10 }')" in + "00000002") NEXT_KBD="ru" ;; + "00000000") NEXT_KBD="ru" ;; + "00001002") NEXT_KBD="us" ;; + "00001000") NEXT_KBD="us" ;; + *) NEXT_KBD="unknown" ;; +esac; xkb-switch -s $NEXT_KBD +''' + +[[block]] +block = "backlight" +device = "intel_backlight" [[block]] block = "disk_space" @@ -22,12 +72,13 @@ block = "cpu" interval = 1 [[block]] -block = "load" -interval = 1 -format = "{1m}" +block = "sound" +on_click = "amixer -D pulse sset Master toggle" [[block]] -block = "sound" +block = "bluetooth" +mac = "2C:4D:79:47:42:9F" +label = " BT" [[block]] block = "time" diff --git a/kbd-layout.c b/kbd-layout.c new file mode 100644 index 0000000..6e02b94 --- /dev/null +++ b/kbd-layout.c @@ -0,0 +1,38 @@ +#include +#include +#include + +#include +#include + +int main(int argc, char **argv) { + Display *dpy = XOpenDisplay(NULL); + + if (dpy == NULL) { + fprintf(stderr, "Cannot open display\n"); + exit(1); + } + + XkbStateRec state; + XkbGetState(dpy, XkbUseCoreKbd, &state); + + XkbDescPtr desc = XkbGetKeyboard(dpy, XkbAllComponentsMask, XkbUseCoreKbd); + char *group = XGetAtomName(dpy, desc->names->groups[state.group]); + printf("Full name: %s\n", group); + + XkbRF_VarDefsRec vd; + XkbRF_GetNamesProp(dpy, NULL, &vd); + + char *tok = strtok(vd.layout, ","); + + for (int i = 0; i < state.group; i++) { + tok = strtok(NULL, ","); + if (tok == NULL) { + return 1; + } + } + + printf("Layout name: %s\n", tok); + + return 0; +} diff --git a/polybar.conf b/polybar.conf new file mode 100644 index 0000000..8fd6a00 --- /dev/null +++ b/polybar.conf @@ -0,0 +1,380 @@ +;===================================================== +; +; To learn more about how to configure Polybar +; go to https://github.com/jaagr/polybar +; +; The README contains alot of information +; +;===================================================== + +[settings] +screenchange-reload = true + +[colors] +background = #222 +background-alt = #444 +foreground = #dfdfdf +foreground-alt = #55 +primary = #ffb52a +secondary = #e60053 +alert = #bd2c40 + +[global/wm] +margin-top = 5 +margin-bottom = 5 + +[bar/example] +bottom = false +separator = "" + +;monitor = ${env:MONITOR:HDMI-1} +width = 100% +height = 27 +offset-x = 0 +offset-y = 0 + +;background = ${xrdb:color9} +background = ${colors.background} +foreground = ${colors.foreground} + +overline-size = 2 +overline-color = #f00 +underline-size = 2 +underline-color = #00f + +border-bottom-size = 2 +border-bottom-color = #333 + +padding-left = 0 +padding-right = 2 +module-margin-left = 1 +module-margin-right = 2 + +font-0 = FontAwesome:style=Regular +font-1 = Iosevka:style=Regular +font-2 = Roboto:style=Regular +font-3 = Cantarell:style=Regular + +;font-0 = System San Francisco Display:pixelsize=12 +;font-1 = unifont:fontformat=truetype:size=6:heavy;-2 +;font-2 = siji:pixelsize=10 +;font-3 = FontAwesome:pixelsize=12;0 +;font-4 = fixed:pixelsize=10 +;font-5 = TakaoPGothic:pixelsize=12 + +modules-left = i3 xwindow +modules-center = +modules-right = xbacklight-acpi volume xkeyboard memory cpu wlan battery temperature date powermenu + +tray-position = right +tray-padding = 2 +;tray-transparent = true +;tray-background = #0063ff + +;wm-restack = bspwm +;wm-restack = i3 + +override-redirect = true + +;scroll-up = bspwm-desknext +;scroll-down = bspwm-deskprev + +scroll-up = i3wm-wsnext +scroll-down = i3wm-wsprev + + +[module/xwindow] +type = internal/xwindow +label = %title:0:30:...% + +[module/xkeyboard] +type = internal/xkeyboard +blacklist-0 = num lock +label-layout = %{F#55}%{F-} %layout% +label-layout-underline = ${colors.secondary} +label-indicator-padding = 2 +label-indicator-margin = 1 +label-indicator-background = ${colors.secondary} +label-indicator-underline = ${colors.secondary} + +[module/filesystem] +type = internal/fs +interval = 25 + +mount-0 = / +mount-1 = /home +mount-2 = /invalid/mountpoint + +label-mounted = %mountpoint%: %percentage_free%% + +label-unmounted = %mountpoint%: not mounted +label-unmounted-foreground = ${colors.foreground-alt} + +[module/bspwm] +type = internal/bspwm + +label-focused = %index% +label-focused-background = ${colors.background-alt} +label-focused-underline= ${colors.primary} +label-focused-padding = 2 + +label-occupied = %index% +label-occupied-padding = 2 + +label-urgent = %index%! +label-urgent-background = ${colors.alert} +label-urgent-padding = 2 + +label-empty = %index% +label-empty-foreground = ${colors.foreground-alt} +label-empty-padding = 2 + +[module/i3] +type = internal/i3 +;fuzzy-match = true +format = +index-sort = true +wrapping-scroll = false + +strip-wsnumbers = true + +label-mode-padding = 2 +label-mode-foreground = #000 +label-mode-background = ${colors.primary} + +label-focused = %name% +label-focused-background = ${module/bspwm.label-focused-background} +label-focused-underline = ${module/bspwm.label-focused-underline} +label-focused-padding = ${module/bspwm.label-focused-padding} + +label-unfocused = %name% +label-unfocused-padding = ${module/bspwm.label-occupied-padding} + +label-urgent = %name%! +label-urgent-background = ${module/bspwm.label-urgent-background} +label-urgent-padding = ${module/bspwm.label-urgent-padding} + +label-visible = %name% +label-visible-background = ${self.label-focused-background} +label-visible-underline = ${self.label-focused-underline} +label-visible-padding = ${self.label-focused-padding} + +; ws-icon-0 = "1;a" +; ws-icon-1 = "2;a" +; ws-icon-2 = "3;a" +; ws-icon-3 = "4;四" +; ws-icon-default = k + +[module/mpd] +type = internal/mpd + +format-online = + +label-song-maxlen = 25 +label-song-ellipsis = true + +icon-prev =  +icon-seekb =  +icon-stop =  +icon-play =  +icon-pause =  +icon-next =  +icon-seekf =  + +icon-random =  +icon-repeat =  + +toggle-on-foreground = ${colors.primary} +toggle-off-foreground = #66 + +[module/xbacklight] +type = internal/xbacklight + +format =