feat(config): Try to guess interface names

This commit is contained in:
Michael Carlberg 2016-11-20 04:11:02 +01:00
parent 74c7f5f617
commit 4b576bd23b
2 changed files with 39 additions and 50 deletions

View File

@ -45,6 +45,34 @@ else()
set(ADAPTER ADP1) set(ADAPTER ADP1)
endif() endif()
# }}}
# Get network interfaces {{{
if(ENABLE_NETWORK)
string(REGEX REPLACE /%battery%.* "" PATH_BAT ${SETTING_PATH_BATTERY_CAPACITY})
string(REGEX REPLACE /%adapter%.* "" PATH_ADP ${SETTING_PATH_ADAPTER_STATUS})
file(GLOB IFLIST RELATIVE /sys/class/net /sys/class/net/*)
foreach(INTERFACE ${IFLIST})
if(NOT ${INTERFACE} STREQUAL "lo")
file(GLOB IS_WIRELESS /sys/class/net/${INTERFACE}/wireless)
if(IS_WIRELESS)
set(INTERFACE_WLAN ${INTERFACE})
else()
set(INTERFACE_ETH ${INTERFACE})
endif()
endif()
endforeach()
if(NOT INTERFACE_ETH)
set(INTERFACE_ETH net0)
endif()
if(NOT INTERFACE_WLAN)
set(INTERFACE_WLAN net1)
endif()
endif()
# }}} # }}}
# Configure and install {{{ # Configure and install {{{

View File

@ -10,18 +10,17 @@
[global/wm] [global/wm]
margin-top = 5 margin-top = 5
margin-bottom = 5 margin-bottom = 5
margin-left = 5
margin-right = 5
[bar/example] [bar/example]
;monitor = HDMI-1 ;monitor = ${env:MONITOR:HDMI-1}
dock = false dock = false
width = 100% width = 100%
height = 27 height = 27
offset-x = 0 offset-x = 0
offset-y = 0 offset-y = 0
;background = ${xrdb:color9}
background = #ee222222 background = #ee222222
foreground = #dfdfdf foreground = #dfdfdf
linecolor = #555 linecolor = #555
@ -45,7 +44,7 @@ modules-center = @MODULES_CENTER@
modules-right = @MODULES_RIGHT@ modules-right = @MODULES_RIGHT@
tray-position = right tray-position = right
tray-padding = 4 tray-padding = 2
;tray-transparent = true ;tray-transparent = true
;tray-background = #0063ff ;tray-background = #0063ff
@ -66,9 +65,6 @@ mount-0 = /
mount-1 = /home mount-1 = /home
mount-2 = /invalid/mountpoint mount-2 = /invalid/mountpoint
;fixed-values = true
;spacing = 4
label-mounted = %mountpoint%: %percentage_free% label-mounted = %mountpoint%: %percentage_free%
label-unmounted = %mountpoint%: not mounted label-unmounted = %mountpoint%: not mounted
@ -163,52 +159,20 @@ bar-empty-foreground = #55
[module/cpu] [module/cpu]
type = internal/cpu type = internal/cpu
interval = 2 interval = 2
label = %{F#666}%{F#cc} %percentage%
format = <label> <bar-load> label-underline = #f90000
label = CPU
bar-load-width = 10
bar-load-foreground-0 = #55aa55
bar-load-foreground-1 = #55aa55
bar-load-foreground-2 = #f5a70a
bar-load-foreground-3 = #ff5555
bar-load-gradient = false
bar-load-indicator =
bar-load-indicator-font = 2
bar-load-indicator-foreground = #ff
bar-load-fill =
bar-load-fill-font = 2
bar-load-empty =
bar-load-empty-font = 2
bar-load-empty-foreground = #55
[module/memory] [module/memory]
type = internal/memory type = internal/memory
interval = 2 interval = 2
label = %{F#665}%{F#cc} %percentage_used%
format = <label> <bar-used> label-underline = #4bffdc
label = RAM
bar-used-width = 10
bar-used-foreground-0 = #55aa55
bar-used-foreground-1 = #55aa55
bar-used-foreground-2 = #f5a70a
bar-used-foreground-3 = #ff5555
bar-used-gradient = false
bar-used-indicator =
bar-used-indicator-font = 2
bar-used-indicator-foreground = #ff
bar-used-fill =
bar-used-fill-font = 2
bar-used-empty =
bar-used-empty-font = 2
bar-used-empty-foreground = #55
[module/wlan] [module/wlan]
type = internal/network type = internal/network
interface = net1 interface = @INTERFACE_WLAN@
interval = 3.0 interval = 3.0
format-connected = <ramp-signal> <label-connected> format-connected = <ramp-signal> <label-connected>
@ -229,7 +193,7 @@ ramp-signal-foreground = #55
[module/eth] [module/eth]
type = internal/network type = internal/network
interface = net0 interface = @INTERFACE_ETH@
interval = 3.0 interval = 3.0
format-connected-underline = #55aa55 format-connected-underline = #55aa55
@ -242,17 +206,14 @@ label-disconnected-foreground = #55
[module/date] [module/date]
type = internal/date type = internal/date
date = %%{F#55}%{F#ff} %Y-%m-%d %%{F#55}%%{F#ff} %H:%M date = %%{F#55}%%{F#ff} %H:%M
date-alt = %%{F#55}%{F#ff} %Y-%m-%d %%{F#55}%%{F#ff} %H:%M:%S date-alt = %%{F#55}%{F#ff} %Y-%m-%d %%{F#55}%%{F#ff} %H:%M
interval = 5 interval = 5
format-underline = #0a6cf5 format-underline = #0a6cf5
[module/volume] [module/volume]
type = internal/volume type = internal/volume
;speaker-mixer = Speaker
;headphone-mixer = Headphone
;headphone-id = 9
format-volume = <label-volume> <bar-volume> format-volume = <label-volume> <bar-volume>