From 4c7aaef74b7c1507ae79f7794eeef80f01dd40e9 Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Sun, 21 Apr 2019 15:07:23 +0200 Subject: Added script for i3 workspace env --- i3/.config/i3/config | 9 ++-- i3/.config/i3/workspaces/0:code-pdf.json | 88 ++++++++++++++++++++++++++++++++ polybar/.config/polybar/config | 40 +++++++-------- rofi/workspaces.sh | 24 +++++++++ 4 files changed, 137 insertions(+), 24 deletions(-) create mode 100644 i3/.config/i3/workspaces/0:code-pdf.json create mode 100755 rofi/workspaces.sh diff --git a/i3/.config/i3/config b/i3/.config/i3/config index 34fb1a2..e8f6d73 100644 --- a/i3/.config/i3/config +++ b/i3/.config/i3/config @@ -98,6 +98,7 @@ bindsym $modAltkey+Tab exec rofi -show window # shipping a .desktop file. It is a wrapper around dmenu, so you need that # installed. bindsym $mod+d exec --no-startup-id i3-dmenu-desktop --dmenu="rofi -dmenu -p run" +bindsym $mod+W exec --no-startup-id "rofi -modi \\"window,Workspaces:/home/sebastien/dotfiles/rofi/workspaces.sh\\" -show Workspaces" # change focus bindsym $mod+t focus left @@ -194,7 +195,8 @@ bindsym $mod+Shift+o restart #bindsym $mod+Shift+p 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'" # resize window (you can also use the mouse for that) -mode "resize" { +set $mode_resize "Resize" +mode $mode_resize { # These bindings trigger as soon as you enter the resize mode # Pressing left will shrink the window’s width. @@ -217,7 +219,7 @@ mode "resize" { bindsym Escape mode "default" } -bindsym $mod+o mode "resize" +bindsym $mod+o mode $mode_resize bindsym $modAltkey+Escape workspace back_and_forth bindsym shift+XF86HomePage exec pcmanfm @@ -235,7 +237,8 @@ for_window [class="crimson"] floating enable # Add background, with a gradient on top exec_always --no-startup-id hsetroot -fill ~/wallpaper/current.jpg -add "#ffffffff" -add "#ffffff00" -add "#00000000" -gradient 0 -exec_always --no-startup-id polybar i3 exec_always --no-startup-id xrdb .Xdefaults +exec_always --no-startup-id compton -i .8 --focus-exclude '_NET_WM_NAME@:s = "rofi"' --blur-background --blur-kern '3,3,0.1,1,1,1,1,1,1,1' +exec --no-startup-id "xrdb .Xdefaults; polybar i3" # for_window [class="URxvt"] layout tabbed diff --git a/i3/.config/i3/workspaces/0:code-pdf.json b/i3/.config/i3/workspaces/0:code-pdf.json new file mode 100644 index 0000000..19c9c96 --- /dev/null +++ b/i3/.config/i3/workspaces/0:code-pdf.json @@ -0,0 +1,88 @@ +// vim:ts=4:sw=4:et +{ + // splitv split container with 2 children + "border": "pixel", + "floating": "auto_off", + "layout": "splitv", + "percent": 0.55, + "type": "con", + "nodes": [ + { + // splith split container with 1 children + "border": "pixel", + "floating": "auto_off", + "layout": "splith", + "percent": 0.8, + "type": "con", + "nodes": [ + { + "border": "pixel", + "current_border_width": 2, + "floating": "auto_off", + "geometry": { + "height": 945, + "width": 745, + "x": 10, + "y": 10 + }, + //"name": "notes_arduino.pdf - 1/27 (90 dpi)", + "percent": 1, + "swallows": [ + { + "class": "^MuPDF$", + "instance": "^mupdf$" + // "title": "^notes_arduino\\.pdf\\ \\-\\ 1\\/27\\ \\(90\\ dpi\\)$" + } + ], + "type": "con" + } + ] + }, + { + "border": "pixel", + "current_border_width": 2, + "floating": "auto_off", + "geometry": { + "height": 408, + "width": 720, + "x": 0, + "y": 0 + }, + // "name": "sebastien@trunk: ~/sync/arduino", + "percent": 0.202941176470588, + "swallows": [ + { + "class": "^URxvt$", + "instance": "^urxvt$", + // Prevent vim to be here + "title": "^((?!vim).)*$" + // "title": "^sebastien\\@trunk\\:\\ \\~\\/sync\\/arduino$" + } + ], + "type": "con" + } + ] +} + +{ + "border": "pixel", + "current_border_width": 2, + "floating": "auto_off", + "geometry": { + "height": 408, + "width": 720, + "x": 0, + "y": 0 + }, + "name": "vim", + "percent": 0.5, + "swallows": [ + { + "class": "^URxvt$", + "instance": "^urxvt$", + "title": "^vim$" + } + ], + "type": "con" +} + diff --git a/polybar/.config/polybar/config b/polybar/.config/polybar/config index 255d80d..2d2c26b 100644 --- a/polybar/.config/polybar/config +++ b/polybar/.config/polybar/config @@ -8,14 +8,14 @@ ;===================================================== [colors] -background = ${xrdb:color4} -background-alt = ${xrdb:color15} -#foreground = #dfdfdf +pseudo-transparency = true +background = #fffffff +background-alt = #fffffff foreground = ${xrdb:color7} foreground-alt = ${xrdb:color4} primary = #ffb52a secondary = #e60053 -alert = ${xrdb:color1} +alert = ${xrdb:color9} [global/wm] margin-top = 0 @@ -34,7 +34,7 @@ offset-y = 0 fixed-center = true background = ${colors.background} -foreground = ${colors.foreground} +foreground = ${colors.foreground-alt} overline-size = 2 overline-color = #f00 @@ -67,9 +67,6 @@ tray-padding = 2 ;override-redirect = true -;scroll-up = bspwm-desknext -;scroll-down = bspwm-deskprev - scroll-up = i3wm-wsnext scroll-down = i3wm-wsprev @@ -103,25 +100,24 @@ format = index-sort = true wrapping-scroll = false +label-mode = %mode% label-mode-padding = 2 -label-mode-foreground = #000 -label-mode-background = ${colors.primary} +#label-mode-foreground = #000000 +#label-mode-background = ${colors.primary} -border-size = 1 -border-colol = #000 -pseudo-transparency = true +#border-size = 1 +#border-colol = #000 #label-focused = %name% label-focused = %icon% -#label-focused-background = ${module/bspwm.label-focused-background} -label-focused-background = ${colors.background-alt} -#label-focused-underline = ${colors.foreground} +label-focused-background = ${colors.foreground-alt} label-focused-padding = ${module/bspwm.label-focused-padding} -label-focused-foreground = ${colors.foreground-alt} +label-focused-foreground = ${colors.foreground} label-unfocused = %icon% label-unfocused-padding = ${module/bspwm.label-occupied-padding} -label-unfocused-background = ${colors.background} +label-unfocused-background = ${colors.background-alt} +label-unfocused-foreground = ${colors.foreground-alt} label-urgent = %icon% label-urgent-background = ${colors.background} @@ -139,6 +135,7 @@ strip-wsnumbers = true ws-icon-0 = 101:Web; ws-icon-1 = 100:Mail; +# All the characters comes from materialdesignicons. ws-icon-2 = 102:Musique; ws-icon-3 = 1; ws-icon-4 = 2; @@ -152,11 +149,12 @@ ws-icon-11 = 9; ws-icon-12 = 10; ws-icon-13 = 11; ws-icon-14 = 12; +ws-icon-15 = 0:code-pdf;︹ ws-icon-default = ○ ; Separator in between workspaces -#label-separator = " " -#label-separator-padding = 0 +label-separator = " " +label-separator-padding = 0 #label-separator-foreground = #ffb52a [module/date] @@ -170,7 +168,7 @@ time = " %H:%M" time-alt =  %d %b %H:%M format-prefix = -format-prefix-foreground = ${colors.foreground-alt} +format-foreground = ${colors.foreground-alt} #format-underline = #0a6cf5 #label = %date% %time% diff --git a/rofi/workspaces.sh b/rofi/workspaces.sh new file mode 100755 index 0000000..4bff293 --- /dev/null +++ b/rofi/workspaces.sh @@ -0,0 +1,24 @@ +#!/bin/sh +WORKSPACES=~/.config/i3/workspaces + +if [ -z $1 ]; then + for fic in ~/.config/i3/workspaces/*.json; do + echo $(basename "$fic" .json) + done + exit 0 +else + i3-msg "workspace $1; append_layout ${WORKSPACES}/${1}.json; workspace back_and_forth" > /dev/null + # get the list of windows on the current workspace + WINDOWS=$(xdotool search --all --onlyvisible --desktop $(xprop -notype -root _NET_CURRENT_DESKTOP | cut -c 24-) "" 2>/dev/null) + for window in $WINDOWS; do + HAS_PID=$(xdotool getwindowpid $window 2>&1 | grep "pid" | wc -l) + + #if [ ! $HAS_PID -eq 0 ]; then + # echo "$window does not have a process" + #else + xdotool windowunmap $window + xdotool windowmap $window + #fi +done + exit 1 +fi -- cgit v1.2.3