cleanup and updating scripts

This commit is contained in:
killajoe
2021-11-20 20:24:37 +01:00
parent b1b6f16672
commit 2bef034a14
13 changed files with 294 additions and 45 deletions
+28 -25
View File
@@ -3,7 +3,7 @@ exec --no-startup-id ~/set_once.sh
# This file is a modified version based on default i3-config-wizard config
# source is available here:
# https://raw.githubusercontent.com/endeavouros-team/endeavouros-i3wm-setup/master/.config/i3/config
# Maintainer: joekamprad [joekamprad@endeavouros.com]
# Maintainer: joekamprad [joekamprad@endeavouros.com]
# https://endeavouros.com
#
# iconic font icon search: https://fontawesome.com/v4.7/cheatsheet/
@@ -48,7 +48,7 @@ workspace_layout default
# extra options for windows: #
##############################
#border indicator on windows:
#border indicator on windows:
new_window pixel 1
# thin borders
@@ -179,16 +179,19 @@ bindsym $mod+Shift+e exec ~/.config/i3/scripts/powermenu
# lock with a picture:
#bindsym $mod+l exec i3lock -i ~/.config/i3/i3-lock-screen.png -p default|win -t
# lock by blurring the screen:
bindsym $mod+l exec ~/.config/i3/scripts/blur-lock.sh
bindsym $mod+l exec ~/.config/i3/scripts/blur-lock
# reload the configuration file
bindsym $mod+Shift+c reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
# restart i3 inplace (preserves your layout/session, can be used to update i3)
bindsym $mod+Shift+r restart
# keybinding in fancy rofi (automated):
bindsym F1 exec ~/.config/i3/scripts/keyhint-2
# alternative
# keybinding list in editor:
bindsym $mod+F1 exec xed ~/.config/i3/keybindings
# bindsym $mod+F1 exec xed ~/.config/i3/keybindings
# Backlight control
bindsym XF86MonBrightnessUp exec xbacklight +10
@@ -242,7 +245,7 @@ bindsym $mod+space focus mode_toggle
bindsym $mod+a focus parent
# open new empty workspace
bindsym $mod+Shift+n exec ~/.config/i3/scripts/empty_workspace.sh
bindsym $mod+Shift+n exec ~/.config/i3/scripts/empty_workspace
## Multimedia Keys
@@ -300,7 +303,7 @@ set $ws9 "9"
set $ws10 "10"
# use workspaces on different displays:
# where you have to replace VGA-0/HDMI-0 with the names for your displays
# where you have to replace VGA-0/HDMI-0 with the names for your displays
# you can get from xrandr command
#workspace $ws1 output VGA-0
#workspace $ws2 output VGA-0
@@ -331,7 +334,7 @@ for_window [class=TelegramDesktop] focus
exec --no-startup-id /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
# dex execute .desktop files
# keep in mind that it can cause issues
# keep in mind that it can cause issues
# when second to i3 a DE is installed or mixed usage of i3 + xfce4 or GNOME
# in this cases better disable dex and use manual starting apps using xdg/autostart
#exec --no-startup-id dex -a -s /etc/xdg/autostart/:~/.config/autostart/
@@ -341,7 +344,7 @@ exec --no-startup-id /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
# configure multiple keyboard layouts and hotkey to switch (Alt+CAPSLOCK in this example)
#exec --no-startup-id setxkbmap -layout 'us,sk' -variant altgr-intl,qwerty -option 'grp:alt_caps_toggle'
# start conky:
# start conky:
#exec_always --no-startup-id conky
# start a script to setup displays
@@ -351,7 +354,7 @@ exec --no-startup-id ~/.screenlayout/monitor.sh
# start blueberry app for managing bluetooth devices from tray:
exec --no-startup-id blueberry-tray
# transparency
# transparency
# uncomment one of them to be used (picom package is installed per default)
# options could need changes, related to used GPU and drivers.
# to find the right setting consult the archwiki or ask at the forum.
@@ -397,8 +400,8 @@ for_window [class="Pamac-manager"] floating enable
######################################
# color settings for bar and windows #
######################################
# Define colors variables:
# Define colors variables:
set $darkbluetrans #08052be6
set $darkblue #08052b
set $lightblue #5294e2
@@ -423,20 +426,20 @@ client.urgent $urgentred $urgentred $white $purple $yellowbrown
# bar settings (input comes from i3blocks) #
############################################
# Start i3bar to display a workspace bar
# Start i3bar to display a workspace bar
# (plus the system information i3status finds out, if available)
bar {
font pango:Noto Sans Regular 10, FontAwesome 10
status_command i3blocks -c ~/.config/i3/i3blocks.conf
position bottom
position bottom
# i3bar_command i3bar --transparency
# it could be that you have no primary display set: set one (xrandr --output <output> --primary)
# reference: https://i3wm.org/docs/userguide.html#_tray_output
tray_output primary
tray_padding 0
# When strip_workspace_numbers is set to yes,
# any workspace that has a name of the form
# When strip_workspace_numbers is set to yes,
# any workspace that has a name of the form
# “[n][:][NAME]” will display only the name.
strip_workspace_numbers yes
##strip_workspace_name no
@@ -449,7 +452,7 @@ strip_workspace_numbers yes
focused_workspace $mediumgrey $grey $darkgrey $purple
active_workspace $lightblue $mediumgrey $darkgrey $purple
inactive_workspace $darkgrey $darkgrey $grey $purple
urgent_workspace $urgentred $urgentred $white $purple
urgent_workspace $urgentred $urgentred $white $purple
}
}
@@ -459,15 +462,15 @@ strip_workspace_numbers yes
# https://gist.github.com/lopspower/03fb1cc0ac9f32ef38f4
# #08052be6 --> e6=90%
# bar {
# bar {
# font pango:Noto Sans Regular 9, FontAwesome 9
# status_command i3blocks -c ~/.config/i3/i3blocks-2.conf
# i3bar_command i3bar --transparency
# output HDMI-0
# position bottom
#
# When strip_workspace_numbers is set to yes,
# any workspace that has a name of the form
# When strip_workspace_numbers is set to yes,
# any workspace that has a name of the form
# “[n][:][NAME]” will display only the name.
#strip_workspace_numbers yes
##strip_workspace_name no
@@ -480,7 +483,7 @@ strip_workspace_numbers yes
# focused_workspace $lighterblue $lighterblue $darkblue $purple
# active_workspace $lightdblue $lightdblue $darkblue $purple
# inactive_workspace $darkblue $darkblue $lightdblue $purple
# urgent_workspace $urgentred $urgentred $white $purple
# urgent_workspace $urgentred $urgentred $white $purple
# }
#}
@@ -492,14 +495,14 @@ strip_workspace_numbers yes
bindsym $mod+d exec rofi -modi drun -show drun \
-config ~/.config/rofi/rofidmenu.rasi
#bindsym F9 exec rofi -modi drun -show drun \
# -config ~/.config/rofi/rofidmenu.rasi
## rofi bindings for window menu ($mod+t /F10 optional disabled)
bindsym $mod+t exec rofi -show window \
-config ~/.config/rofi/rofidmenu.rasi
-config ~/.config/rofi/rofidmenu.rasi
#bindsym F10 exec rofi -show window \
# -config ~/.config/rofi/rofidmenu.rasi
# -config ~/.config/rofi/rofidmenu.rasi
+16 -16
View File
@@ -70,7 +70,7 @@ color=#717171
# The script may be called with a optional argument to set the alert
# (defaults to 10 for 10%).
[disk]
label=
label=
instance=/
command=~/.config/i3/scripts/disk
interval=30
@@ -79,12 +79,12 @@ interval=30
#
# The type defaults to "mem" if the instance is not specified.
[memory]
label=
label=
command=~/.config/i3/scripts/memory
interval=2
[cpu_usage]
label=
label=
command=~/.config/i3/scripts/cpu_usage
#min_width=CPU: 100.00%
interval=2
@@ -110,13 +110,11 @@ command=~/.config/i3/scripts/bandwidth2
interval=persist
# Battery indicator
#
# The battery instance defaults to 0.
[battery]
command=~/.config/i3/scripts/battery.sh
# change this to battery-pinebook-pro.sh if you are running on pinebook-pro
label=
#instance=1
command=~/.config/i3/scripts/battery2
# for alternative battery script change to battery1
# change this to battery-pinebook-pro if you are running on pinebook-pro
label=
interval=30
[simple-2]
@@ -132,22 +130,24 @@ command=~/.config/i3/scripts/volume
instance=Master
interval=1
[keybindings]
full_text=
command=~/.config/i3/scripts/keyhint.sh
# display keyboard layout name
# for keyboard layouts switcher
# see i3 config file
#[keyboard-layout]
#command=~/.config/i3/scripts/keyboard-layout.sh
#command=~/.config/i3/scripts/keyboard-layout
#interval=2
[keybindings]
full_text=
command=~/.config/i3/scripts/keyhint
[time]
#label=
#label=
command=date '+%a %d %b %H:%M:%S'
interval=1
[shutdown_menu]
full_text=
full_text=
command=~/.config/i3/scripts/powermenu
[simple-2]
+106
View File
@@ -0,0 +1,106 @@
#!/usr/bin/env python3
#
# Copyright (C) 2016 James Murphy
# Licensed under the GPL version 2 only
#
# A battery indicator blocklet script for i3blocks
from subprocess import check_output
import os
import re
config = dict(os.environ)
status = check_output(['acpi'], universal_newlines=True)
if not status:
# stands for no battery found
color = config.get("color_10", "red")
fulltext = "<span color='{}'><span font='FontAwesome'>\uf00d \uf240</span></span>".format(color)
percentleft = 100
else:
# if there is more than one battery in one laptop, the percentage left is
# available for each battery separately, although state and remaining
# time for overall block is shown in the status of the first battery
batteries = status.split("\n")
state_batteries=[]
commasplitstatus_batteries=[]
percentleft_batteries=[]
time = ""
for battery in batteries:
if battery!='':
state_batteries.append(battery.split(": ")[1].split(", ")[0])
commasplitstatus = battery.split(", ")
if not time:
time = commasplitstatus[-1].strip()
# check if it matches a time
time = re.match(r"(\d+):(\d+)", time)
if time:
time = ":".join(time.groups())
timeleft = " ({})".format(time)
else:
timeleft = ""
p = int(commasplitstatus[1].rstrip("%\n"))
if p>0:
percentleft_batteries.append(p)
commasplitstatus_batteries.append(commasplitstatus)
state = state_batteries[0]
commasplitstatus = commasplitstatus_batteries[0]
if percentleft_batteries:
percentleft = int(sum(percentleft_batteries)/len(percentleft_batteries))
else:
percentleft = 0
# stands for charging
color = config.get("color_charging", "yellow")
FA_LIGHTNING = "<span color='{}'><span font='FontAwesome'>\uf0e7</span></span>".format(color)
# stands for plugged in
FA_PLUG = "<span font='FontAwesome'>\uf1e6</span>"
# stands for using battery
FA_BATTERY = "<span font='FontAwesome'>\uf240</span>"
# stands for unknown status of battery
FA_QUESTION = "<span font='FontAwesome'>\uf128</span>"
if state == "Discharging":
fulltext = FA_BATTERY + " "
elif state == "Full":
fulltext = FA_PLUG + " "
timeleft = ""
elif state == "Unknown":
fulltext = FA_QUESTION + " " + FA_BATTERY + " "
timeleft = ""
else:
fulltext = FA_LIGHTNING + " " + FA_PLUG + " "
def color(percent):
if percent < 10:
# exit code 33 will turn background red
return config.get("color_10", "#FFFFFF")
if percent < 20:
return config.get("color_20", "#FF3300")
if percent < 30:
return config.get("color_30", "#FF6600")
if percent < 40:
return config.get("color_40", "#FF9900")
if percent < 50:
return config.get("color_50", "#FFCC00")
if percent < 60:
return config.get("color_60", "#FFFF00")
if percent < 70:
return config.get("color_70", "#FFFF33")
if percent < 80:
return config.get("color_80", "#FFFF66")
return config.get("color_full", "#FFFFFF")
form = '<span color="{}">{}%</span>'
fulltext += form.format(color(percentleft), percentleft)
#fulltext += timeleft
print(fulltext)
print(fulltext)
if percentleft < 10:
exit(33)
+6
View File
@@ -0,0 +1,6 @@
I3_CONFIG=$HOME/.config/i3/config
mod_key=$(sed -nre 's/^set \$mod (.*)/\1/p' ${I3_CONFIG})
grep "^bindsym" ${I3_CONFIG} \
| sed "s/-\(-\w\+\)\+//g;s/\$mod/${mod_key}/g;s/Mod1/Alt/g;s/exec //;s/bindsym //;s/^\s\+//;s/^\([^ ]\+\) \(.\+\)$/\2: \1/;s/^\s\+//" \
| tr -s ' ' \
| rofi -dmenu -theme ~/.config/rofi/rofikeyhint.rasi
+1 -4
View File
@@ -1,8 +1,5 @@
# Weather
[Weather]
command=~/.config/i3/scripts/openweather.sh
command=~/.config/i3/scripts/openweather
interval=1800
color=#7275b3
+137
View File
@@ -0,0 +1,137 @@
/*******************************************************
* ROFI configs i3 Apps menu for EndeavourOS
* Maintainer: joekamprad <joekamprad@endeavouros.com>
*******************************************************/
configuration {
font: "Sourcecode Pro Regular 10";
show-icons: false;
icon-theme: "Arc-X-D";
display-drun: "KeyHint";
drun-display-format: "{name}";
scroll-method: 0;
disable-history: false;
fullscreen: false;
hide-scrollbar: true;
sidebar-mode: false;
}
@import "~/.config/rofi/arc_dark_colors.rasi"
window {
background-color: @background;
border: 0;
padding: 30;
}
listview {
lines: 10;
columns: 1;
}
mainbox {
border: 0;
padding: 0;
}
message {
border: 2px 0px 0px ;
border-color: @separatorcolor;
padding: 1px ;
}
textbox {
text-color: @foreground;
}
listview {
fixed-height: 0;
border: 8px 0px 0px ;
border-color: @separatorcolor;
spacing: 8px ;
scrollbar: false;
padding: 2px 0px 0px ;
}
element {
border: 0;
padding: 1px ;
}
element-text {
background-color: inherit;
text-color: inherit;
}
element.normal.normal {
background-color: @normal-background;
text-color: @normal-foreground;
}
element.normal.urgent {
background-color: @urgent-background;
text-color: @urgent-foreground;
}
element.normal.active {
background-color: @active-background;
text-color: @active-foreground;
}
element.selected.normal {
background-color: @selected-normal-background;
text-color: @selected-normal-foreground;
}
element.selected.urgent {
background-color: @selected-urgent-background;
text-color: @selected-urgent-foreground;
}
element.selected.active {
background-color: @selected-active-background;
text-color: @selected-active-foreground;
}
element.alternate.normal {
background-color: @alternate-normal-background;
text-color: @alternate-normal-foreground;
}
element.alternate.urgent {
background-color: @alternate-urgent-background;
text-color: @alternate-urgent-foreground;
}
element.alternate.active {
background-color: @alternate-active-background;
text-color: @alternate-active-foreground;
}
scrollbar {
width: 4px ;
border: 0;
handle-color: @normal-foreground;
handle-width: 8px ;
padding: 0;
}
mode-switcher {
border: 2px 0px 0px ;
border-color: @separatorcolor;
}
button {
spacing: 0;
text-color: @normal-foreground;
}
button.selected {
background-color: @selected-normal-background;
text-color: @selected-normal-foreground;
}
inputbar {
spacing: 0;
text-color: @normal-foreground;
padding: 1px ;
}
case-indicator {
spacing: 0;
text-color: @normal-foreground;
}
entry {
spacing: 0;
text-color: @normal-foreground;
}
prompt {
spacing: 0;
text-color: @normal-foreground;
}
inputbar {
children: [ prompt,textbox-prompt-colon,entry,case-indicator ];
}
textbox-prompt-colon {
expand: false;
str: ":";
margin: 0px 0.3em 0em 0em ;
text-color: @normal-foreground;
}