From 64b84b7626f12e58913b890f3e7936eec6d9a620 Mon Sep 17 00:00:00 2001 From: Ryan Date: Wed, 4 Apr 2018 20:07:10 +0200 Subject: [PATCH] use polybar --- i3/.Xresources.thinkpad | 107 --------- i3/.config/i3/config.desktop | 11 +- i3/.config/i3/config.thinkpad | 268 +++++++++-------------- polybar/.config/polybar/config | 71 +++++- polybar/.config/polybar/launch-laptop.sh | 12 + 5 files changed, 187 insertions(+), 282 deletions(-) create mode 100755 polybar/.config/polybar/launch-laptop.sh diff --git a/i3/.Xresources.thinkpad b/i3/.Xresources.thinkpad index 03578a0..e12f9e6 100644 --- a/i3/.Xresources.thinkpad +++ b/i3/.Xresources.thinkpad @@ -24,110 +24,3 @@ Xft.antialias: false Xft.rgba: rgb Xft.hinting: true Xft.hintstyle: hintslight - -!------------------------------------------------------------------------------- -! URxvt settings -! Colours lifted from Solarized (http://ethanschoonover.com/solarized) -! More info at: -! http://pod.tst.eu/http://cvs.schmorp.de/rxvt-unicode/doc/rxvt.1.pod -!------------------------------------------------------------------------------- - -URxvt.depth: 32 -URxvt.geometry: 90x30 -URxvt.transparent: true -URxvt.fading: 0 -URxvt.loginShell: true -URxvt.saveLines: 200 -URxvt.internalBorder: 3 -URxvt.lineSpace: 0 - -! Fonts -URxvt*font: xft:DejaVuSansMonoForPowerline Nerd Font:size=10 -URxvt*boldFont: xft:DejaVuSansMonoForPowerline Nerd Font:size=10 -!URxvt*boldFont: xft:Dejavu Sans Mono Bold for Powerline Nerd Font:size=10 - -! Fix font space -! URxvt*letterSpace: -1 - -! Scrollbar -URxvt.scrollStyle: rxvt -URxvt.scrollBar: false - -! URL handling -URxvt.matcher.button: 1 -URxvt.urlLauncher: qutebrowser -URxvt.keysym.C-Delete: perl:matcher:last -URxvt.keysym.M-Delete: perl:matcher:list - - -! Cursor -URxvt.cursorBlink: true -URxvt.cursorUnderline: false - -! Pointer -URxvt.pointerBlank: true - -! Enable paste support -URxvt.perl-lib: /home/alrayyes/bin/urxvt/perl -URxvt.keysym.Shift-Control-V: perl:clipboard:paste -URxvt.iso14755: False -URxvt.perl-ext-common: default,matcher,clipboard - -*shading: 20 - -#define S_base03 #002b36 -#define S_base02 #073642 -#define S_base01 #586e75 -#define S_base00 #657b83 -#define S_base0 #839496 -#define S_base1 #93a1a1 -#define S_base2 #eee8d5 -#define S_base3 #fdf6e3 - -*background: S_base03 -*foreground: S_base0 -*fadeColor: S_base03 -*cursorColor: S_base1 -*pointerColorBackground:S_base01 -*pointerColorForeground:S_base1 - -#define S_yellow #b58900 -#define S_orange #cb4b16 -#define S_red #dc322f -#define S_magenta #d33682 -#define S_violet #6c71c4 -#define S_blue #268bd2 -#define S_cyan #2aa198 -#define S_green #859900 - -!! black dark/light -*color0: S_base02 -*color8: S_base03 - -!! red dark/light -*color1: S_red -*color9: S_orange - -!! green dark/light -*color2: S_green -*color10: S_base01 - -!! yellow dark/light -*color3: S_yellow -*color11: S_base00 - -!! blue dark/light -*color4: S_blue -*color12: S_base0 - -!! magenta dark/light -*color5: S_magenta -*color13: S_violet - -!! cyan dark/light -*color6: S_cyan -*color14: S_base1 - -!! white dark/light -*color7: S_base2 -*color15: S_base3 diff --git a/i3/.config/i3/config.desktop b/i3/.config/i3/config.desktop index 466a75b..ccf7e66 100644 --- a/i3/.config/i3/config.desktop +++ b/i3/.config/i3/config.desktop @@ -100,6 +100,8 @@ bindsym $mod+Shift+r restart bindsym $mod+u [instance="dropdown"] scratchpad show bindsym $mod+d exec rofi -show run -eh 2 -font "System San Francisco Display 18" -fullscreen bindsym Control+$mod+l exec i3lock-fancy + +# Screenshots bindsym Print exec --no-startup-id scrot -e 'mv $f ~/Pictures/Screenshots/' bindsym Shift+Print exec --no-startup-id scrot -u -e 'mv $f ~/Pictures/Screenshots/' @@ -141,16 +143,7 @@ bindsym $mod+Shift+8 move container to workspace $workspace8 bindsym $mod+Shift+9 move container to workspace $workspace9 bindsym $mod+Shift+0 move container to workspace $workspace10 -workspace $workspace1 output DP-1 -workspace $workspace2 output DP-1 -workspace $workspace3 output DP-1 -workspace $workspace4 output DP-1 -workspace $workspace5 output DP-1 -workspace $workspace6 output DP-1 workspace $workspace7 output HDMI-1 -workspace $workspace8 output DP-1 -workspace $workspace9 output DP-1 -workspace $workspace10 output DP-1 # enable floating for apps for_window [title="Screen Layout Editor"] floating enable diff --git a/i3/.config/i3/config.thinkpad b/i3/.config/i3/config.thinkpad index 3665cb5..b553334 100644 --- a/i3/.config/i3/config.thinkpad +++ b/i3/.config/i3/config.thinkpad @@ -1,156 +1,56 @@ # vim: filetype=i3 -set $mod Mod4 -set $screencast ffmpeg -y -f x11grab -video_size 2560x1440 -i :0.0 -f alsa -i default -c:v ffvhuff -r 30 -c:a flac output.mkv -set $audio ffmpeg -f alsa -i default -c:a flac -y output.flac -set $browser firefox -set $term=st - +# #---Basic Definitions ---# # # i3-gaps hide_edge_borders both for_window [class="^.*"] border pixel 0 gaps inner 15 gaps outer 15 - -# Colours -set $base00 #101218 -set $base01 #1f222d -set $base02 #252936 -set $base03 #7780a1 -set $base04 #C0C5CE -set $base05 #d1d4e0 -set $base06 #C9CCDB -set $base07 #ffffff -set $base08 #ee829f -set $base09 #f99170 -set $base0A #ffefcc -set $base0B #a5ffe1 -set $base0C #97e0ff -set $base0D #97bbf7 -set $base0E #c0b7f9 -set $base0F #fcc09e - -# Name the workspaces -set $workspace1 "1: " -set $workspace2 "2: " -set $workspace3 "3: " -set $workspace4 "4: " -set $workspace5 "5: " -set $workspace6 "6: " -set $workspace7 "7: " -set $workspace8 "8: " - font pango:DejaVuSansMonoForPowerline Nerd Font 8 -floating_modifier $mod +set $mod Mod4 -assign [class="Google-chrome"] $workspace2 -assign [class="Firefox"] $workspace2 -assign [class="Gpodder"] $workspace4 -assign [class="ncmpcpp"] $workspace4 -assign [class="mutt"] $workspace6 -assign [class="Slack"] $workspace7 -assign [class="weechat"] $workspace7 -assign [class="retroarch"] $workspace8 - -workspace $workspace8 output HDMI2 - -# arandr -for_window [title="Screen Layout Editor"] floating enable -# Thunderbird write new message, floating -for_window [title="Write:"] floating enable -# Hide title bar -for_window [class="^.*"] border pixel 1 -new_window 1pixel -# Gimp -for_window [window_role="gimp-dock"] floating disable; move left; resize shrink width 50 px or 50ppt -for_window [window_role="gimp-toolbox"] floating disable; move right; resize grow width 30 px or 30ppt -# Pulseaudio tools -for_window [title="PulseAudio Manager"] floating enable -for_window [title="PulseAudio Volume Meter"] floating enable -for_window [title="Volume Control"] floating enable -# Toggl -for_window [title="Toggl Desktop"] floating enable -# Syncthing -for_window [title="Syncthing"] floating enable -# Qtpass -for_window [title="QtPass"] floating enable - -# Widow Colours -# border background text indicator -client.focused $base01 $base01 $base07 $base0F -client.focused_inactive $base02 $base02 $base03 $base0F -client.unfocused $base02 $base02 $base03 $base0F -client.urgent $base02 $base08 $base00 $base0F - -# Start i3bar to display a workspace bar (plus the system information i3status -# finds out, if available) -bar { - colors { - separator $base03 - background $base01 - statusline $base05 -# border background text - focused_workspace $base01 $base01 $base07 - active_workspace $base01 $base02 $base03 - inactive_workspace $base01 $base01 $base03 - urgent_workspace $base01 $base01 $base08 - } - - output eDP1 - position top - status_command ~/bin/bumblebee-status/bumblebee-status -m brightness battery nic pacman github load sensors datetime caffeine -p datetime.format="%Y-%m-%d %H:%M:%S" nic.states=^down nic.exclude=br,lo,docker0 disk.path=/home disk.open="st -e ranger" disk.showUsed=false disk.showSize=false battery.device=BAT0 -t solarized-powerline -} -bar { - output eDP1 - position bottom - tray_output none - workspace_buttons no - mode hide - status_command ~/bin/bumblebee-status/bumblebee-status -m xrandr spotify mpd pasink pasource -t solarized-powerline -} -bar { - output HDMI2 - position top - tray_output none -} - - -# Startup programs +# #---Start External Scripts---# # +# Align monitors exec_always --no-startup-id xrandr --dpi 150 -exec_always --no-startup-id compton -b -exec_always --no-startup-id dunst +# Polybar +exec_always --no-startup-id $HOME/.config/polybar/launch-laptop.sh +# Composite manager +exec --no-startup-id compton --xrender-sync-fence +# Wallpaper exec_always --no-startup-id feh --bg-scale ~/.config/wall.png - -exec --no-startup-id pulseaudio +# Makes mouse invisible after a brief period +exec --no-startup-id unclutter +# Applet to control pulseaudio exec --no-startup-id pasystray +# Network manager applet exec --no-startup-id nm-applet +# Redhift for better sleep exec --no-startup-id redshift-gtk +# Syncthing exec --no-startup-id syncthing-gtk -m -exec --no-startup-id xautolock -corners ---- -cornersize 30 -detectsleep -time 10 -locker "i3lock-fancy" -exec --no-startup-id offlineimap -exec firefox +## --- Start Apps ---# # +# Browser +exec iceweasel exec slack -exec i3-sensible-terminal --class=weechat -e weechat -exec i3-sensible-terminal --class=ncmpcpp -e ncmpcpp -exec i3-sensible-terminal --class=mutt -e neomutt +exec i3-sensible-terminal -c weechat -e weechat +exec i3-sensible-terminal -c mutt -e neomutt +exec spotify exec gpodder -# Start dropdown shell -exec --no-startup-id i3-sensible-terminal --name=dropdown -e tmux -for_window [instance="dropdown"] floating enable; -for_window [instance="dropdown"] move scratchpad; [instance="dropdown"] scratchpad show; move scratchpad -bindsym $mod+u [instance="dropdown"] scratchpad show - -# start a terminal +# #---Basic Bindings---# # bindsym $mod+Return exec i3-sensible-terminal bindsym $mod+shift+Return exec i3-sensible-terminal -e tmux -# kill focused window -bindsym $mod+Shift+q kill +bindsym $mod+Shift+space floating toggle +bindsym $mod+space focus mode_toggle -# rofi -bindsym $mod+d exec rofi -show run -eh 2 -font "System San Francisco Display 18" -fullscreen +bindsym $mod+Escape workspace prev +bindsym $mod+Shift+e exec i3-msg exit + +bindsym $mod+Shift+BackSpace exec sudo reboot + +bindsym $mod+Shift+q kill # change focus bindsym $mod+j focus left @@ -190,17 +90,43 @@ 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 +# reload the configuration file +bindsym $mod+Shift+c reload +# restart i3 inplace (preserves your layout/session, can be used to upgrade i3) +bindsym $mod+Shift+r restart -# change focus between tiling / floating windows -bindsym $mod+space focus mode_toggle -# switch workspace -bindsym $mod+Escape workspace prev +# my keybindings +bindsym $mod+u [instance="dropdown"] scratchpad show +bindsym $mod+d exec rofi -show run -eh 2 -font "System San Francisco Display 18" -fullscreen +bindsym Control+$mod+l exec i3lock-fancy -# Reboot -bindsym $mod+Shift+BackSpace exec sudo reboot +# Screenshots +bindsym Print exec --no-startup-id scrot -e 'mv $f ~/Pictures/Screenshots/' +bindsym Shift+Print exec --no-startup-id scrot -u -e 'mv $f ~/Pictures/Screenshots/' + +# 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 + +# #---Workspace Bindings--# # + +# name workspaces +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" # switch to workspace bindsym $mod+1 workspace $workspace1 @@ -211,8 +137,8 @@ bindsym $mod+5 workspace $workspace5 bindsym $mod+6 workspace $workspace6 bindsym $mod+7 workspace $workspace7 bindsym $mod+8 workspace $workspace8 -bindsym $mod+9 workspace 9 -bindsym $mod+0 workspace 10 +bindsym $mod+9 workspace $workspace9 +bindsym $mod+0 workspace $workspace10 # move focused container to workspace bindsym $mod+Shift+1 move container to workspace $workspace1 @@ -223,15 +149,45 @@ bindsym $mod+Shift+5 move container to workspace $workspace5 bindsym $mod+Shift+6 move container to workspace $workspace6 bindsym $mod+Shift+7 move container to workspace $workspace7 bindsym $mod+Shift+8 move container to workspace $workspace8 -bindsym $mod+Shift+9 move container to workspace 9 -bindsym $mod+Shift+0 move container to workspace 10 +bindsym $mod+Shift+9 move container to workspace $workspace9 +bindsym $mod+Shift+0 move container to workspace $workspace10 -# reload the configuration file -bindsym $mod+Shift+c reload -# restart i3 inplace (preserves your layout/session, can be used to upgrade i3) -bindsym $mod+Shift+r restart -# exit i3 (logs you out of your X session) -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'" +workspace $workspace8 output HDMI2 + +# enable floating for apps +for_window [title="Screen Layout Editor"] floating enable +for_window [window_role="gimp-dock"] floating disable; move left; resize shrink width 50 px or 50ppt +for_window [window_role="gimp-toolbox"] floating disable; move right; resize grow width 30 px or 30ppt +for_window [title="PulseAudio Manager"] floating enable +for_window [title="PulseAudio Volume Meter"] floating enable +for_window [title="Volume Control"] floating enable +for_window [title="Toggl Desktop"] floating enable +for_window [title="Syncthing"] floating enable for_window [title="QtPass"] floating enable + +# make sure all apps start where they're supposed to +assign [class="Google-chrome"] $workspace2 +assign [class="Firefox"] $workspace2 +assign [class="Gpodder"] $workspace4 +assign [class="ncmpcpp"] $workspace4 +for_window [class="Spotify"] move to workspace $workspace4 +assign [class="Slack"] $workspace7 +assign [class="weechat"] $workspace7 +assign [class="retroarch"] $workspace8 +assign [class="mutt"] $workspace6 + +# First I have a tmux window used for background scripts. +# I'll later bind this to mod+u. +for_window [instance="dropdown"] floating enable +for_window [instance="dropdown"] resize set 625 400 +for_window [instance="dropdown"] move scratchpad +for_window [instance="dropdown"] border pixel 5 +# Runs the tmuxinit script, which searches for an earlier tmux instance, +# otherwise starts a new one (to prevent multiple dropdown sessions). +exec --no-startup-id $term -n dropdown -e tmux +# Runs neofetch on first tmux screen if installed. +exec_always --no-startup-id "tmux send-keys -t 0:0 'clear && neofetch 2>/dev/null' Enter" + +floating_modifier $mod # resize window (you can also use the mouse for that) mode "resize" { @@ -256,19 +212,3 @@ mode "resize" { bindsym Return mode "default" bindsym Escape mode "default" } bindsym $mod+r mode "resize" - -# Custom KeyBinds -bindsym Control+$mod+l exec i3lock-fancy - -# Screenshots -bindsym Print exec --no-startup-id scrot -e 'mv $f ~/Pictures/Screenshots/' -bindsym Shift+Print exec --no-startup-id scrot -u -e 'mv $f ~/Pictures/Screenshots/' - -# 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 diff --git a/polybar/.config/polybar/config b/polybar/.config/polybar/config index 5d43abe..908d9ee 100644 --- a/polybar/.config/polybar/config +++ b/polybar/.config/polybar/config @@ -18,6 +18,56 @@ primary = #ffb52a secondary = #e60053 alert = #bd2c40 +[bar/laptop] +monitor = ${env:MONITOR:e-DP1} +width = 100% +height = 27 +;offset-x = 1% +;offset-y = 1% +radius = 6.0 +fixed-center = false + +background = ${colors.background} +foreground = ${colors.foreground} + +line-size = 3 +line-color = #f00 + +border-size = 0 +border-color = #00000000 + +padding-left = 0 +padding-right = 2 + +module-margin-left = 1 +module-margin-right = 2 + +font-0 = DejaVuSansMono Nerd Font Mono:pixelsize=14 +font-1 = "Wuncon Siji:pixelsize=14;1" + +modules-left = i3 +modules-center = player-mpris-tail +modules-right = github updates-arch-combined battery xbacklight bluetooth wlan enp0s31f6 filesystem volume memory cpu temperature date + +tray-position = right +tray-padding = 0 +;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 + +scroll-up = i3wm-wsnext +scroll-down = i3wm-wsprev + [bar/monitor1] monitor = ${env:MONITOR:DP-1} width = 100% @@ -224,12 +274,12 @@ ramp-used-7 = █ [module/wlan] type = internal/network -interface = +interface = wlp4s0 interval = 3.0 format-connected = format-connected-underline = #9f78e1 -label-connected = %essid% +label-connected = "%essid% %local_ip% %downspeed% %upspeed%" format-disconnected = ;format-disconnected = @@ -259,6 +309,23 @@ format-disconnected = ;format-disconnected-underline = ${self.format-connected-underline} ;label-disconnected = %ifname% disconnected ;label-disconnected-foreground = ${colors.foreground-alt} +; +[module/enp0s31f6] +type = internal/network +interface = enp0s31f6 +interval = 3.0 + +format-connected-underline = #55aa55 +format-connected-prefix = " " +format-connected-prefix-foreground = ${colors.foreground-alt} +label-connected = "%local_ip% %downspeed% %upspeed%" + +format-disconnected = +;format-disconnected = +;format-disconnected-underline = ${self.format-connected-underline} +;label-disconnected = %ifname% disconnected +;label-disconnected-foreground = ${colors.foreground-alt} + [module/date] type = internal/date diff --git a/polybar/.config/polybar/launch-laptop.sh b/polybar/.config/polybar/launch-laptop.sh new file mode 100755 index 0000000..217dc24 --- /dev/null +++ b/polybar/.config/polybar/launch-laptop.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env sh + +# Terminate already running bar instances +killall -q polybar + +# Wait until the processes have been shut down +while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done + +# Launch bar1 and bar2 +polybar laptop & + +echo "Bars launched..."