dot-files

Dot files managed with stow
git clone http://milesalan.com/git/dot-files
Log | Files | Refs | Mirror | README

commit a411b041837f936ae66541281740be9a0b532fbc
parent f9074f571408c4f18e6355dc0f76394a8e1b8163
Author: mil <miles.sandlar@gmail.com>
Date:   Sat,  7 Mar 2015 18:46:40 -0500

i like pango

Diffstat:
M.i3/config | 13+++++++------
M.xinitrc | 10++--------
MScripts/Utilities/json-bar | 166+++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------
MScripts/Wm/foo-zoom-level | 1+
MScripts/X/mdmenu | 3++-
MScripts/X/status-bar | 110+++++++++++++++----------------------------------------------------------------
6 files changed, 149 insertions(+), 154 deletions(-)

diff --git a/.i3/config b/.i3/config @@ -190,15 +190,15 @@ bar { status_command json-bar font pango:Envy Code R, Stlarch 10 colors { - background #e7e7e7 - statusline #888888 - separator #000000 + background #dadada + statusline #cfcfcf + separator #6b6b6b #border bg text #client.focused #000000 ##000000 #000000 - focused_workspace #888888 #1d1d1d #ffffff - active_workspace #000000 #999999 #ffffff - inactive_workspace #e7e7e7 #dddddd #757575 + focused_workspace #000000 #e9ffe1 #000000 + active_workspace #000000 #999999 #000000 + inactive_workspace #000000 #dddddd #000000 urgent_workspace #000000 #ffffff } } @@ -210,3 +210,4 @@ client.focused #000000 #d5ffca #000000 #000000 client.focused_inactive #000000 #dde9ff #404040 #000000 client.unfocused #4a4a4a #d4d4d4 #696969 #000000 client.urgent #000000 #000000 #ffffff #000000 + diff --git a/.xinitrc b/.xinitrc @@ -12,12 +12,6 @@ xmodmap ~/.xmodmap & feh --bg-scale ~/.wallpaper.jpg & # setwm -if [ -f "/usr/bin/tpb" ]; -then -sudo tpb & -fi & -bar-start & -sxhkd -c ~/.sxhkd-foo & -dunst & keynav & -exec foo-wm +dunst & +exec i3 diff --git a/Scripts/Utilities/json-bar b/Scripts/Utilities/json-bar @@ -1,74 +1,140 @@ #!/usr/bin/env ruby require 'json' -def battery - buff = %x[battery].chomp!.split(' ') - " " + buff[1] + " " -end -def temp - n = File.read("/sys/class/thermal/thermal_zone0/temp").chomp!.to_i / 1000 - #return "" + - return " " + n.to_s + "°C " +class String + def fg(c) + "<span fgcolor='#{c}'>#{self}</span>" + end + def bg(c) + "<span bgcolor='#{c}'>#{self}</span>" + end + def underline + "<span rise='3000' underline='single' font_weight='ultrabold'>#{self}</span>" + end + def size(c) + "<span size='#{c}'>#{self}</span>" + end end -def network - l = %x[netctl list].split("\n").select { - |n| n if n[0] == "*" - } - l.first.gsub!("* ", "") - " " + l.first + " " +class Info_Fetchers + def weather + "Raining 57°C" + end + def battery + %x[acpi -V|head -n 1].scan(/\d+%/)[0] + end + def processor_temp + n = File.read("/sys/class/thermal/thermal_zone0/temp").chomp!.to_i / 1000 + #return "" + + return n.to_s + "°C" + end + + def network + l = %x[netctl list].split("\n").select { + |n| n if n[0] == "*" + } + l.first.gsub!("* ", "") + "" + l.first + " " + end + def volume_level + "#{%x[amixer get Master | grep -woE '([0-9]+)\%' | head -1].chomp!}" + end + def time + date = Time.now + " #{date.strftime('%m/%d/%l:%M%p').gsub!(' ', '')}" + end + def email + "✉" + end end -def information + +def generate_bar_json(fetchers) [ - # { - # "name" => "time", - # "full_text" => %x[date].chomp!, - # "color" => "#171717" - # }, - # - # { - "name" => "temp", - "full_text" => temp, - "color" => "#171717" + :symbol => "♫", + :fg => "#5200fd", + :bg => "#ffffff", + :text => fetchers.volume_level }, + { - "name" => "network", - "full_text" => network, - "color" => "#171717" + :symbol => "⧗", + :fg => "#680018", + :bg => "#ffffff", + :text => fetchers.processor_temp }, - { - "name" => "battery", - "full_text" => battery, - "color" => "#171717" - } - + { + :symbol => "⌁ ", + :fg => "#530067", + :bg => "#ffffff", + :text => fetchers.network + }, + { + :symbol => "⌥", + :fg => "#188200", + :bg => "#ffffff", + :text => fetchers.battery + }, + { + :symbol => "⧗", + :fg => "#a1a700", + :bg => "#ffffff", + :text => fetchers.time + }, + { + :symbol => "☂", + :fg => "#005e61", + :bg => "#ffffff", + :text => fetchers.weather + } - # { - # "name" => "bus", - # "full_text" => %x[bt 2> /tmp/err].chomp!, - # "separator" => true, - # "color" => "#171717" - # } - ].to_json + #{ + # "name" => "time", + # "full_text" => time, + # "color" => "#2c4000" + #}, + #{ + # "name" => "email", + # "full_text" => email, + # "color" => "#171717" + #} + ].map do |f| + text = [ + "<span underline='single' underline_color='#cfcfcf'>", + "#{" #{f[:symbol]} ".size("larger").fg(f[:bg]).bg(f[:fg]).underline}", + "#{" #{f[:text]} ".fg(f[:fg]).bg(f[:bg])}", + "</span>" + ].join + + f.merge({ + :separator => false, + :separator_block_width => 10, + :align => 'center', + :full_text => text + }) + end.to_json end -puts '{ "version": 1 }' -puts "[" -puts "[]" - - -loop do - puts "," + information - STDOUT.flush - sleep 40 +def init + puts '{ "version": 1 }' + puts "[" + puts "[]" + fetchers = Info_Fetchers.new + + loop do + puts "," + generate_bar_json(fetchers) + STDOUT.flush + sleep 40 + end end + +init diff --git a/Scripts/Wm/foo-zoom-level b/Scripts/Wm/foo-zoom-level @@ -12,6 +12,7 @@ def crawl(x, count, id) crawl(y, count + 1, id) end end + puts "#{x["node"]} vs #{id}" if (x["node"] == id) then puts count exit diff --git a/Scripts/X/mdmenu b/Scripts/X/mdmenu @@ -7,7 +7,8 @@ require 'json' # Setup Screen Dimensions Info if (!File.exists?('#{Dir.home}/.screen_dimensions')) then - %x[write_dimensions] + #%x[write_dimensions] + %x[echo '1440x900' > #{Dir.home}/.screen_dimensions] end dimensions = IO.read("#{Dir.home}/.screen_dimensions").to_s.chomp!.split('x') $screen = { diff --git a/Scripts/X/status-bar b/Scripts/X/status-bar @@ -10,17 +10,29 @@ end class String def fg(i) - return "\\f#{i}#{self}\\fr" + return "%{F#{i}}#{self}%{F#{i}}" end def bg(i) - return "\\b#{i}#{self}\\br" + return "%{B#{i}}#{self}%{B#{i}}" end def ul(i) - return "\\u#{i}#{self}\\ur" + return "%{U#{i}}#{self}%{U#{i}}" + end + + def center + return "%{c}#{self}%{c}" + end + def right + return "%{r}#{self}%{r}" + end + + def capFirst + return self.slice(0,1).capitalize + self.slice(1..-1) end end + def foo(x) a = %x[foo-wm-c /tmp/foo-wm.socket \'#{x}'] if (a.chomp! == "Foo") then @@ -35,46 +47,25 @@ def foo(x) end -def capFirst(a) - return a.slice(0,1).capitalize + a.slice(1..-1) -end - count = 0 loop do # Battery batteryStatus = `battery status`.chomp! - f = 3 + f = "#cfcfcf" f = 4 if batteryStatus == "Charging" batteryStatus = " #{batteryStatus} ".fg(1).bg(2) batteryValue = " #{`battery percentage`.chomp!} ".fg(f) battery = "#{batteryStatus}#{batteryValue}" - # Network - networkLabel = " Netcfg ".fg(1).bg(2) - networkValue = "" - if (%x[which netcfg 2>&1].include? "no netcfg") then - networkValue = "" - else - networkValue = " #{%x[netcfg current].chomp!} ".fg(5) - end - - network = "#{networkLabel}#{networkValue}" - #Volume + #Volume volumeLabel = " Vol ".fg(1).bg(2) volumeValue = " #{%x[amixer get Master | grep -woE '([0-9]+)\%' | head -1].chomp!} ".fg(6) volume = "#{volumeLabel}#{volumeValue}" - time = Time.now.to_s.gsub!(/:\d{2}\s.+/, '').gsub!(/(\d{2}:\d{2})/, "\\f3| \\f6\\1") - time = "\\fr\\br #{time}\\br\\fr" - - - #m = JSON %x[foo-wm-c "/tmp/foo-wm.socket" "get marks"] - #marks = m["marks"].join(" // \\f4".fg(4)) - marks = "" + time = Time.now.to_s.gsub!(/:\d{2}\s.+/, '').fg("#cfcfcf").center - marks = "\\f5 #{marks} \\br\\fr" z_icons = "" zoom = %x[foo-zoom-level].chomp! @@ -82,74 +73,15 @@ loop do z_icons = " #{z_icons}" if (i == 1) z_icons = z_icons + "+" z_icons = "#{z_icons} " if (i == zoom.to_i) - end z_icons = z_icons.fg(3).bg(2).ul(5) - #s = "\\u8#{wifi} #{battery} #{volume}\\c#{marks}\\r#{time} #{subway} #{weather}l" - f = %x[foo-wm-c /tmp/foo-wm.socket 'get focus'].chomp! - container = "Foo Window Manger" - if (f == "Foo") then - right = "Foo Window Manager" - else - c = JSON.parse %x[foo-focus-child-json] - - begin - d = JSON.parse %x[foo-focus-parent-json] - rescue - d = { - "layout" => "?", - "children" => "?" - } - end - - layout = " " + capFirst(d["layout"].to_s.downcase) + " " - children = d["children"].size.to_s - - maxWidth = 50 - layout_type = " #{layout} ".bg(2).fg(4).ul(6) - number_children = " #{children} ".bg(9).ul(3).fg(2) - right = "#{number_children}#{layout_type}" - center = "" - #right = "#{client}" - begin - stack = JSON.parse(%x[foo-focus-parent-json])["children"] - rescue - stack = [] - end - - # Bar Colors - focus = 6 - surrounding = 4 - unfocus = 3 - last = "" - stack.each_with_index do |c, i| - if c["type"] == "client" then - name = %x[xptr-to-title #{c["id"]}].chomp! - - - foc = foo("get focus")["node"] - if (c["node"] == foc) then - icon = " > ".bg(2).fg(4).ul(3) - last = "#{icon}#{(" " + name[0..50] + " ").ul(5)}" - end - - else - chil = " #{c["children"].size.to_s} ".fg(3).bg(4) - name = - name = "#{chil}#{c["layout"][0].upcase}-Set #{c["children"].size}" - - - end - end - right = "#{right}#{last}#{z_icons}" - - end - center = marks + focus = %x[foo-wm-c /tmp/foo-wm.socket 'get focus'].chomp! + foo_status = focus.right - s = "#{battery}#{network}#{volume}#{time}\\c#{center}\\r#{right}" + s = "#{battery}#{volume}#{time}#{foo_status}" STDOUT.puts s