aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.config/XMonad/lib/Defaults.hs34
-rw-r--r--.config/XMonad/xmonad.hs9
-rw-r--r--.config/lemon.go125
-rw-r--r--.config/polybar/config.ini44
-rwxr-xr-x.scripts/battery_level.sh3
-rwxr-xr-x.scripts/battery_status.sh2
-rwxr-xr-x.scripts/charging_status.sh3
-rwxr-xr-x.scripts/notify_battery_status.sh2
-rwxr-xr-x.scripts/secondmonitor.sh2
-rwxr-xr-x.scripts/volume_level.sh3
-rwxr-xr-x.xprofile1
11 files changed, 155 insertions, 73 deletions
diff --git a/.config/XMonad/lib/Defaults.hs b/.config/XMonad/lib/Defaults.hs
index f4779d1..9c83de6 100644
--- a/.config/XMonad/lib/Defaults.hs
+++ b/.config/XMonad/lib/Defaults.hs
@@ -6,8 +6,9 @@ import XMonad.Layout.Tabbed
import XMonad.Actions.GridSelect
import XMonad.Util.Loggers
-import XMonad.Hooks.StatusBar
-import XMonad.Hooks.StatusBar.PP
+-- import XMonad.Hooks.StatusBar
+-- import XMonad.Hooks.StatusBar.PP
+
myBorder = "#120F23"
myBorder' = "#C44CF2"
@@ -98,18 +99,17 @@ myGSConfig colorizer = (buildDefaultGSConfig myGSColorizer)
myGridSelect = myGSConfig myGSColorizer
-myLemonbarCmd = "lemon | lemonbar -g 1920x28+1920+0 -o -2 -f 'Source Han Sans JP Normal:size=12' -B '#e6100b13' -F '#9d00ff'"
-myLemonbarPP = def {
- ppCurrent = wrap "%{B#ff0aa3} %{F#FFFFFF}" " %{F-}%{B-}"
- , ppVisible = wrap "%{B#28c78f} %{F#FFFFFF}" " %{F-}%{B-}"
- , ppHidden = wrap "%{B#9b1bed} %{F#FFFFFF}" " %{F-}%{B-}"
- , ppHiddenNoWindows = wrap " " " "
- --, ppVisibleNoWindows = wrap "%{B#ffffff} %{F#9b1bed}" " %{F-}%{B-}"
- , ppWsSep = ""
- , ppSep = ""
- , ppTitle = wrap " " "%{r}" . shorten 60
- , ppOrder = \(ws:l:t:ex) -> [t]++[ws]
- }
-
-myLemonbarCmd' = "lemon | lemonbar -g 1920x20+0+0 -o 0 -f 'Source Han Sans JP Normal:size=9' -B '#e6100b13' -F '#9d00ff'"
-myLemonbarPP' = myLemonbarPP
+-- myLemonbarCmd = "lemon | lemonbar -d -g 1920x28+1920+0 -o -2 -f 'Source Han Sans JP Normal:size=12' -B '#e6100b13' -F '#9d00ff'"
+-- myLemonbarCmd' = "lemon | lemonbar -d -g 1920x20+0+0 -o 0 -f 'Source Han Sans JP Normal:size=9' -B '#e6100b13' -F '#9d00ff'"
+--
+-- myLemonbarPP = def {
+-- ppCurrent = wrap "%{B#ff0aa3} %{F#FFFFFF}" " %{F-}%{B-}"
+-- , ppVisible = wrap "%{B#28c78f} %{F#FFFFFF}" " %{F-}%{B-}"
+-- , ppHidden = wrap "%{B#9b1bed} %{F#FFFFFF}" " %{F-}%{B-}"
+-- , ppHiddenNoWindows = wrap " " " "
+-- --, ppVisibleNoWindows = wrap "%{B#ffffff} %{F#9b1bed}" " %{F-}%{B-}"
+-- , ppWsSep = ""
+-- , ppSep = ""
+-- , ppTitle = wrap " " "" . shorten 60
+-- , ppOrder = \(ws:l:t:ex) -> [t]++["%{r}",ws]
+-- }
diff --git a/.config/XMonad/xmonad.hs b/.config/XMonad/xmonad.hs
index c7f3ac0..6a4626d 100644
--- a/.config/XMonad/xmonad.hs
+++ b/.config/XMonad/xmonad.hs
@@ -4,11 +4,11 @@ import XMonad
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.EwmhDesktops
+-- import XMonad.Hooks.StatusBar
import XMonad.Util.EZConfig
import XMonad.Util.Run
-import XMonad.Hooks.StatusBar
import Keybindings
import Defaults
@@ -16,9 +16,10 @@ import Hooks
main :: IO ()
main = do
- myLemonbar <- statusBarPipe myLemonbarCmd (pure myLemonbarPP )
- myLemonbar' <- statusBarPipe myLemonbarCmd' (pure myLemonbarPP')
- xmonad $ withSB myLemonbar $ withSB myLemonbar' $ ewmhFullscreen $ ewmh $ docks def {
+ -- myLemonbar <- statusBarPipe myLemonbarCmd (pure myLemonbarPP)
+ -- myLemonbar' <- statusBarPipe myLemonbarCmd' (pure myLemonbarPP)
+ -- xmonad $ withSB (myLemonbar <> myLemonbar') $ ewmhFullscreen $ docks def {
+ xmonad $ ewmhFullscreen $ ewmh $ docks def {
focusFollowsMouse = True
, terminal = myTerminal
, borderWidth = myBorderWidth
diff --git a/.config/lemon.go b/.config/lemon.go
index 17471e9..f873d2b 100644
--- a/.config/lemon.go
+++ b/.config/lemon.go
@@ -13,7 +13,8 @@ import (
)
var (
- data, connectedWiFi, memPercentage, cpuTemp, cpuPercentage string
+ data, connectedWiFi, memPercentage, cpuTemp, cpuPercentage, volumeLevel string
+ batteryLevel, chargingStatus string
text string = "\n"
moduleColor0, moduleColor1 string = "#9b1bed", "#ff0aa3"
)
@@ -32,13 +33,43 @@ func stdinLoop() {
}
}
+// to update modules every 5 seconds
+func fiveSecLoop() {
+ for {
+ memPercentage = getMemUsage()
+ cpuTemp = getCPUTemp()
+ cpuPercentage = getCPUUsage()
+
+ time.Sleep(time.Second * 5)
+ }
+}
+
+// to update modules every 10 seconds
+func tenSecLoop() {
+ for {
+ connectedWiFi = getWiFiName()
+ chargingStatus, batteryLevel = getBatteryInfo()
+
+ time.Sleep(time.Second * 10)
+ }
+}
+
+// very creative name
+// used to update modules like volume, etc
+// don't want lag on those modules!
+func veryFastLoop() {
+ for {
+ volumeLevel = getVolumeLevel()
+ time.Sleep(time.Second / 10)
+ }
+}
+
func main() {
go dataLoop()
go stdinLoop()
- go cpuUsageLoop()
- go connectedWiFiLoop()
- go memUsageLoop()
- go cpuTempLoop()
+ go fiveSecLoop()
+ go tenSecLoop()
+ go veryFastLoop()
for {
fmt.Print(data + text)
@@ -46,22 +77,36 @@ func main() {
}
}
-// TODO
-// volume
-// brightness (new)
-// battery
-
func getData() string {
time := "%{F" + moduleColor0 + "} " + getTime() + "%{F-} "
wifiName := "%{F" + moduleColor1 + "} WiFI: " + connectedWiFi + "%{F-} "
- rootFree := "%{F" + moduleColor0 + "} / " + getDisk("/") + "%%%{F-} "
- homeFree := "%{F" + moduleColor1 + "} /home " + getDisk("/home") + "%%%{F-} "
- hddFree := "%{F" + moduleColor0 + "} /hdd " + getDisk("/hdd") + "%%%{F-} "
- cpuUsage := "%{F" + moduleColor1 + "} CPU: " + cpuPercentage + "%%%{F-} "
- cpuTemp := "%{F" + moduleColor0 + "} TEMP: " + cpuTemp + "%%{F-} "
- memUsage := "%{F" + moduleColor1 + "} MEM: " + memPercentage + "%%{F-} "
+ rootFree := "%{F" + moduleColor0 + "} / " + getDisk("/") + "%%{F-} "
+ homeFree := "%{F" + moduleColor1 + "} /home " + getDisk("/home") + "%%{F-} "
+ hddFree := "%{F" + moduleColor0 + "} /hdd " + getDisk("/hdd") + "%%{F-} "
+ cpuUsage := "%{F" + moduleColor1 + "} CPU: " + cpuPercentage + "%%{F-} "
+ cpuTemp := "%{F" + moduleColor0 + "} TEMP: " + cpuTemp + "%{F-} "
+ memUsage := "%{F" + moduleColor1 + "} MEM: " + memPercentage + "%{F-} "
+
+ volume := "%{F" + moduleColor0 + "}"
+ if volumeLevel != "muted" {
+ volume = volume + "} VOL: " + volumeLevel + "%{F-} "
+ } else {
+ volume = volume + "} MUTED%{F-} "
+ }
- return time + wifiName + rootFree + homeFree + hddFree + cpuUsage + cpuTemp + memUsage
+ // shows battery level in different color
+ // depending on charging status
+ // hidden when full
+ var battery string
+ btlvl, _ := strconv.Atoi(batteryLevel)
+ if btlvl < 100 {
+ col := moduleColor1
+ if chargingStatus == "Charging" { col = moduleColor0 }
+ battery = fmt.Sprintf("%%{F%s} BATT: %s%%{F-} ", col, batteryLevel)
+ }
+
+ // TODO add brightness (new)
+ return time + wifiName + rootFree + homeFree + hddFree + cpuUsage + cpuTemp + "%{r}" + memUsage + battery
}
func getWiFiName() string {
@@ -72,13 +117,6 @@ func getWiFiName() string {
return string(name)
}
-func connectedWiFiLoop() {
- for {
- connectedWiFi = getWiFiName()
- time.Sleep(time.Second * 15)
- }
-}
-
func getMemUsage() string {
// script located in ~/.scripts/
// look at github.com/MikunoNaka/dots
@@ -87,12 +125,6 @@ func getMemUsage() string {
return string(usage)
}
-func memUsageLoop() {
- for {
- memPercentage = getMemUsage()
- time.Sleep(time.Second * 5)
- }
-}
func getCPUTemp() string {
// script located in ~/.scripts/
@@ -102,11 +134,24 @@ func getCPUTemp() string {
return string(temp)
}
-func cpuTempLoop() {
- for {
- cpuTemp = getCPUTemp()
- time.Sleep(time.Second * 5)
- }
+func getVolumeLevel() string {
+ // script located in ~/.scripts/
+ // look at github.com/MikunoNaka/dots
+ cmd := exec.Command("volume_level.sh")
+ level, _ := cmd.Output()
+ return string(level)
+}
+
+func getBatteryInfo() (string, string) {
+ // scripts located in ~/.scripts/
+ // look at github.com/MikunoNaka/dots
+ statCmd := exec.Command("charging_status.sh")
+ stat, _ := statCmd.Output()
+
+ levelCmd := exec.Command("battery_level.sh")
+ level, _ := levelCmd.Output()
+
+ return string(stat), string(level)
}
// TODO: maybe add dates on click
@@ -153,7 +198,7 @@ func getCPUSample() (idle, total uint64) {
return
}
-func getCPUUsage() {
+func getCPUUsage() string {
idle0, total0 := getCPUSample()
time.Sleep(3 * time.Second)
idle1, total1 := getCPUSample()
@@ -162,12 +207,6 @@ func getCPUUsage() {
totalTicks := float64(total1 - total0)
cpuUsage := 100 * (totalTicks - idleTicks) / totalTicks
- cpuPercentage = strconv.Itoa(int(cpuUsage))
+ return strconv.Itoa(int(cpuUsage))
}
-func cpuUsageLoop() {
- for {
- getCPUUsage()
- time.Sleep(5 * time.Second)
- }
-}
diff --git a/.config/polybar/config.ini b/.config/polybar/config.ini
index 27f5e00..4dc7b04 100644
--- a/.config/polybar/config.ini
+++ b/.config/polybar/config.ini
@@ -91,7 +91,7 @@ batt-full-fg = ${colors.module-color-0}
[bar/mybar2]
monitor = ${env:MONITOR:HDMI-0}
enable-ipc = true
-width = 1577
+width = 1920
height = 20
offset-x = 0
offset-y = 0
@@ -122,7 +122,7 @@ font-3 = fixed:pixelsize=10;1
;font-5 = siji:pixelsize=10;1
modules-left = date uptime wlan eth filesystem-root filesystem-home filesystem-hdd cpu temperature memory xwindow
-modules-right = battery pulseaudio
+modules-right = battery pulseaudio ewmh
tray-position = right
tray-padding = 2
@@ -136,7 +136,7 @@ cursor-scroll = ns-resize
[bar/mybar]
;monitor = ${env:MONITOR:eDP-1}
enable-ipc = true
-width = 1475
+width = 1920
height = 28
offset-x = 0
offset-y = 0
@@ -167,7 +167,7 @@ font-3 = fixed:pixelsize=10;1
;font-5 = siji:pixelsize=10;1
modules-left = date uptime wlan eth filesystem-root filesystem-home filesystem-hdd cpu temperature memory xwindow
-modules-right = battery pulseaudio
+modules-right = battery pulseaudio ewmh
override-redirect = true
@@ -351,3 +351,39 @@ label-discharging-foreground = ${colors.batt-discharging-fg}
label-full-background = ${colors.batt-full-bg}
label-full-foreground = ${colors.batt-full-fg}
+[module/ewmh]
+type = internal/xworkspaces
+
+pin-workspaces = false
+enable-click = true
+enable-scroll = false
+format = <label-state>
+index-sort = true
+
+label-monitor = %name%
+
+label-active = %name%
+label-active-foreground = ${colors.ws-active-fg}
+label-active-background = ${colors.ws-active-bg}
+label-active-underline = ${colors.ws-active-ul}
+label-active-padding = 3
+
+label-occupied = %name%
+label-occupied-foreground = ${colors.ws-occupied-fg}
+label-occupied-background = ${colors.ws-occupied-bg}
+label-occupied-underline = ${colors.ws-occupied-ul}
+label-occupied-padding = 3
+
+label-empty = %name%
+label-empty-foreground = ${colors.ws-empty-fg}
+label-empty-background = ${colors.ws-empty-bg}
+label-empty-underline = ${colors.ws-empty-ul}
+label-empty-padding = 3
+
+label-background = #FFFFFF
+
+label-urgent = %name%
+label-urgent-foreground = #000000
+label-urgent-background = #bd2c40
+label-urgent-underline = #9b0a20
+label-urgent-padding = 0
diff --git a/.scripts/battery_level.sh b/.scripts/battery_level.sh
new file mode 100755
index 0000000..a1b1b48
--- /dev/null
+++ b/.scripts/battery_level.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+acpi -b | awk '{print $4}' | sed 's/,//' | tr -d '\n'
diff --git a/.scripts/battery_status.sh b/.scripts/battery_status.sh
deleted file mode 100755
index a66bd70..0000000
--- a/.scripts/battery_status.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-acpi -b | awk '{print substr($4, 0, length($2) + 1) ", " substr($3, 0, length($3) - 1)}'
diff --git a/.scripts/charging_status.sh b/.scripts/charging_status.sh
new file mode 100755
index 0000000..24c09e7
--- /dev/null
+++ b/.scripts/charging_status.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+acpi -b | awk '{print $3}' | sed 's/,//' | tr -d '\n'
diff --git a/.scripts/notify_battery_status.sh b/.scripts/notify_battery_status.sh
deleted file mode 100755
index a9ccee4..0000000
--- a/.scripts/notify_battery_status.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-notify-send "Battery:" "$(battery_status.sh)"
diff --git a/.scripts/secondmonitor.sh b/.scripts/secondmonitor.sh
index 84a5960..cc379c0 100755
--- a/.scripts/secondmonitor.sh
+++ b/.scripts/secondmonitor.sh
@@ -1,2 +1,2 @@
#!/bin/sh
-xrandr --output HDMI-0 --mode 1920x1080 --pos 0x0 --rotate normal --output eDP-1-1 --primary --mode 1920x1080 --pos 1920x673 --rotate normal
+xrandr --output HDMI-0 --mode 1920x1080 --pos 0x0 --rotate normal --output eDP-1-1 --primary --mode 1920x1080 --pos 1920x0 --rotate normal
diff --git a/.scripts/volume_level.sh b/.scripts/volume_level.sh
new file mode 100755
index 0000000..5aeba95
--- /dev/null
+++ b/.scripts/volume_level.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+pamixer --get-volume-human | tr -d '\n'
diff --git a/.xprofile b/.xprofile
index 3df28de..7853985 100755
--- a/.xprofile
+++ b/.xprofile
@@ -25,3 +25,4 @@ dunst &
emacs --daemon &
udiskie &
nitrogen --restore &
+polystart &