Split waybar into two menus plus improvements

This commit is contained in:
Dejvino 2021-01-09 00:46:12 +01:00
parent 5c1abaf4da
commit d14b331a6d
7 changed files with 288 additions and 22 deletions

View File

@ -3,6 +3,8 @@
Linux UI customized to resemble a Fallout Pip-Boy. To be used with the PINE64 PinePhone running Arch Linux ARM, enclosed in the PinePhoneBoy harness. Linux UI customized to resemble a Fallout Pip-Boy. To be used with the PINE64 PinePhone running Arch Linux ARM, enclosed in the PinePhoneBoy harness.
## Screenshots ## Screenshots
![Main screen](screenshot.jpg)
### Radio tab ### Radio tab
![Radio](screenshots/radio.jpg) ![Radio](screenshots/radio.jpg)

113
config/sway/config Normal file
View File

@ -0,0 +1,113 @@
### Output configuration
#
# Default wallpaper (more resolutions are available in /usr/share/backgrounds/sway/)
#output * bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill
output * bg ~/Desktop/background.png fill
set $GREEN "#00AA00FF"
set $LGREEN "#00FF00FF"
set $DGREEN "#006600FF"
set $BLACK "#000000FF"
client.focused $GREEN $BLACK $GREEN $LGREEN $DGREEN
client.unfocused $DGREEN $BLACK $DGREEN $DGREEN $DGREEN
#
# Workspaces:
#
set $W1 '1:STAT'
set $W2 '2:INV'
set $W3 '3:DATA'
set $W4 '4:MAP'
set $W5 '5:RADIO'
set $W6 '6:6'
set $W7 '7:7'
set $W8 '8:8'
set $W9 '9:9'
set $WSTAT $W1
set $WINV $W2
set $WDATA $W3
set $WMAP $W4
set $WRADIO $W5
# Switch to workspace
bindsym $mod+1 workspace $W1
bindsym $mod+2 workspace $W2
bindsym $mod+3 workspace $W3
bindsym $mod+4 workspace $W4
bindsym $mod+5 workspace $W5
bindsym $mod+6 workspace $W6
bindsym $mod+7 workspace $W7
bindsym $mod+8 workspace $W8
bindsym $mod+9 workspace $W9
bindsym $mod+0 workspace $W10
# Move focused container to workspace
bindsym $mod+Shift+1 move container to workspace $W1
bindsym $mod+Shift+2 move container to workspace $W2
bindsym $mod+Shift+3 move container to workspace $W3
bindsym $mod+Shift+4 move container to workspace $W4
bindsym $mod+Shift+5 move container to workspace $W5
bindsym $mod+Shift+6 move container to workspace $W6
bindsym $mod+Shift+7 move container to workspace $W7
bindsym $mod+Shift+8 move container to workspace $W8
bindsym $mod+Shift+9 move container to workspace $W9
bindsym $mod+Shift+0 move container to workspace $W10
# Note: workspaces can have any name you want, not just numbers.
# We just use 1-10 as the default.
#
# Power Button
#
set $pplock 'swayphone_power_sleep'
set $ppunlock 'swayphone_power_wakeup'
set $lockapp swaylock
set $lock '$lockapp -f -c 000000'
set $unlock 'killall $lockapp'
## wish this worked...
#bindsym XF86PowerOff exec $lock
#bindsym --locked XF86PowerOff exec $unlock
# alternative:
bindcode 124 exec $lock; exec $pplock
bindcode --locked 124 exec $unlock; exec $ppunlock
exec swayidle -w \
timeout 15 'swaymsg exec $lock; $pplock' \
resume 'swaymsg exec $unlock; $ppunlock' \
before-sleep 'swaymsg exec $lock; $pplock'
# Scale the touchscreen LCD UI
output DSI-1 scale 2
# Bind input and output for correct rotation support
input 1046:4097:Goodix_Capacitive_TouchScreen map_to_output DSI-1
#output DSI-1 transform 0
#output DSI-1 transform 90
output DSI-1 transform 270
# Keyboard
exec "squeekboard"
# Status Bar
exec "waybar -c ~/.config/waybar/config -b side"
exec "waybar -c ~/.config/waybar/config_left -b side_left"
# Restore backlight
exec 'swayphone_power_wakeup'
# INV
exec "portfolio-fm"
for_window [app_id="portfolio-fm"] move workspace $WINV; border none
# DATA
exec "epiphany"
for_window [app_id="epiphany"] move workspace $WDATA; border none
# RADIO
exec "killall mpd ; mpd"
exec "xfmpc"
for_window [app_id="xfmpc"] move workspace $WRADIO; border none
# Welcome message
exec "mako" # notify daemon
exec "sleep 2; notify-send 'Welcome!' 'Your Pip-Boy is ready to be used.' --icon=dialog-information"

View File

@ -11,8 +11,7 @@
"modules-left": [ "modules-left": [
"clock#time", "clock#time",
"clock#date", "clock#date",
"battery", //"battery", // broken for some reason...
"custom/terminal",
"sway/workspaces" "sway/workspaces"
], ],
@ -20,12 +19,13 @@
], ],
"modules-right": [ "modules-right": [
"cpu", // "cpu",
"memory", // "memory",
// "disk", // "disk",
"network", // "network",
"backlight", // "backlight",
"pulseaudio", // "pulseaudio",
"custom/terminal",
"custom/kill", "custom/kill",
"tray" "tray"
], ],
@ -119,12 +119,12 @@
"custom/kill": { "custom/kill": {
"on-click": "swaymsg kill", "on-click": "swaymsg kill",
"format": "[KILL]" "format": "💀"
}, },
"custom/terminal": { "custom/terminal": {
"on-click": "termite", "on-click": "termite",
"format": "[TERM]" "format": "#>_"
}, },

129
config/waybar/config_left Executable file
View File

@ -0,0 +1,129 @@
{
// ☢
//GLOBAL
"layer": "top",
"position": "left",
"width": 15,
"modules-left": [
"cpu",
"memory",
//"battery", // broken for some reason...
"custom/battery",
"temperature",
"disk",
"backlight",
"pulseaudio",
],
"modules-center": [
],
"modules-right": [
//"custom/terminal",
"custom/keyshow",
"custom/keyhide"
],
//MODULES
"custom/battery": {
"exec": "waybar_battery",
"interval": "2",
"return-type": "json",
"format": "⚛ {}"
},
"custom/kill": {
"on-click": "swaymsg kill",
"format": "☠"
},
"custom/keyshow": {
"on-click": "swayphone_keyboard_show",
"format": "K↥"
},
"custom/keyhide": {
"on-click": "swayphone_keyboard_hide",
"format": "K↧"
},
"custom/terminal": {
"on-click": "termite",
"format": ">_"
},
"cpu": {
"interval": 5,
"tooltip": false,
"format": " {usage}%", //Icon: microchip
"states": {
"warning": 70,
"critical": 90
},
"on-click": "termite -e \"htop --sort-key=PERCENT_CPU\""
},
"memory": {
"interval": 5,
"format": " {}%", // Icon: memory
"states": {
"warning": 70,
"critical": 90
},
"on-click": "termite -e \"htop --sort-key=PERCENT_MEM\""
},
"temperature": {
// "thermal-zone": 2,
// "hwmon-path": "/sys/class/hwmon/hwmon2/temp1_input",
"critical-threshold": 60,
"format-critical": " {temperatureC}°C",
"format": " {temperatureC}°C"
},
"network": {
"interval": 5,
"format-wifi": "  {essid}", // Icon: wifi
"format-ethernet": " {ifname}", // Icon: ethernet
"format-disconnected": "Disconnected",
"tooltip-format": "{ifname}: {ipaddr}",
"on-click": "swaymsg exec \"termite -e nmtui\""
},
"pulseaudio": {
"scroll-step": 1,
"format": "{icon} {volume}%",
"format-bluetooth": "{icon} {volume}%",
"format-muted": "",
"format-icons": {
"headphones": "",
"handsfree": "",
"headset": "",
"phone": "",
"portable": "",
"car": "",
"default": ["", ""]
},
"on-click": "pavucontrol"
},
"disk": {
"interval": 5,
"format": "✇ {percentage_used:2}%", // alt: 
"path": "/"
},
"backlight": {
// "device": "acpi_video1",
"format": "{icon} {percent}% ",
"states": [0,50],
"format-icons": ["", ""],
"on-click": "termite -e swayphone_backlightselect"
},
}

View File

@ -26,9 +26,13 @@
#mode, #mode,
#network, #network,
#pulseaudio, #pulseaudio,
#temperature,
#custom-battery,
#custom-alsa, #custom-alsa,
#custom-kill, #custom-kill,
#custom-terminal, #custom-terminal,
#custom-keyshow,
#custom-keyhide,
#tray { #tray {
padding-left: 8px; padding-left: 8px;
padding-right: 8px; padding-right: 8px;
@ -57,16 +61,30 @@
#backlight { #backlight {
} }
#custom-battery.charging {
}
#custom-battery.discharging {
color: green;
}
#battery { #battery {
animation-timing-function: linear; animation-timing-function: linear;
animation-iteration-count: infinite; animation-iteration-count: infinite;
animation-direction: alternate; animation-direction: alternate;
} }
#battery.warning { #battery.warning,
#temperature.warning,
#cpu.warning {
color: orange; color: orange;
} }
#battery.critical,
#cpu.critical,
#temperature.critical {
color: red;
}
#clock.date { #clock.date {
font-weight: bold; font-weight: bold;
} }
@ -76,17 +94,6 @@
font-size: 12px; font-size: 12px;
} }
#cpu {
}
#cpu.warning {
color: orange;
}
#cpu.critical {
color: orange;
}
#memory { #memory {
animation-timing-function: linear; animation-timing-function: linear;
animation-iteration-count: infinite; animation-iteration-count: infinite;
@ -107,7 +114,7 @@
} }
#network.disconnected { #network.disconnected {
color: orange; color: gray;
} }
#pulseaudio { #pulseaudio {

BIN
screenshot.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

View File

@ -0,0 +1,15 @@
#!/bin/bash
READBAT="cat /sys/class/power_supply/axp20x-battery/uevent"
GETVAL="cut -d= -f2"
LOWERCASE="tr '[:upper:]' '[:lower:]'"
STATUS=`$READBAT | grep STATUS | $GETVAL | $LOWERCASE`
CHARGE=`$READBAT | grep CAPACITY | $GETVAL`
TEXT="$CHARGE%"
CLASS=$STATUS
echo {\"text\": \"$TEXT\", \"class\": \"$CLASS\"}