added jupyter-calculator
This commit is contained in:
@ -241,7 +241,7 @@ bindsym $mod+Print mode "$mode_screenshot"
|
|||||||
bindsym $mod+Ctrl+Right move workspace to output right
|
bindsym $mod+Ctrl+Right move workspace to output right
|
||||||
bindsym $mod+Ctrl+Left move workspace to output right
|
bindsym $mod+Ctrl+Left move workspace to output right
|
||||||
|
|
||||||
bindsym $mod+c exec xfce4-terminal -e qalc
|
bindsym $mod+c exec jupyter-calculator
|
||||||
bindsym $mod+p exec xwacomcalibrate
|
bindsym $mod+p exec xwacomcalibrate
|
||||||
|
|
||||||
workspace_auto_back_and_forth yes
|
workspace_auto_back_and_forth yes
|
||||||
@ -277,8 +277,8 @@ exec --no-startup-id "i3-msg 'workspace 9: Chat; append_layout ~/.config/i3/work
|
|||||||
|
|
||||||
exec firefox
|
exec firefox
|
||||||
exec thunderbird
|
exec thunderbird
|
||||||
exec chat.rocket.RocketChat no_focus
|
#exec chat.rocket.RocketChat no_focus
|
||||||
exec element-desktop no_focus
|
exec im.riot.Riot no_focus
|
||||||
exec telegram-desktop no_focus
|
exec telegram-desktop no_focus
|
||||||
|
|
||||||
exec --no-startup-id nm-applet
|
exec --no-startup-id nm-applet
|
||||||
|
71
i3/jupyter-calculator
Executable file
71
i3/jupyter-calculator
Executable file
@ -0,0 +1,71 @@
|
|||||||
|
#!/bin/python3
|
||||||
|
|
||||||
|
import subprocess
|
||||||
|
import time
|
||||||
|
import psutil
|
||||||
|
|
||||||
|
NOTEBOOK_DIR = "/home/julian/jupyter-notebooks/"
|
||||||
|
PORT = "8988"
|
||||||
|
|
||||||
|
def isOtherProcessRunning():
|
||||||
|
process_count = 0
|
||||||
|
for proc in psutil.process_iter():
|
||||||
|
try:
|
||||||
|
pinfo = proc.as_dict(attrs=['pid', 'name', 'create_time'])
|
||||||
|
if "jupyter-calc" in pinfo['name'].lower():
|
||||||
|
process_count += 1
|
||||||
|
except (psutil.NoSuchProcess, psutil.AccessDenied , psutil.ZombieProcess) :
|
||||||
|
pass
|
||||||
|
return process_count > 1
|
||||||
|
|
||||||
|
def getNotebookPort(line):
|
||||||
|
url = line.split(" :: ")[0]
|
||||||
|
return url.split("localhost:")[1].split("/")[0]
|
||||||
|
|
||||||
|
def getNotebookToken(line):
|
||||||
|
url = line.split(" :: ")[0]
|
||||||
|
return url.split("token=")[1]
|
||||||
|
|
||||||
|
|
||||||
|
def isNotebookRunning():
|
||||||
|
answer = subprocess.check_output("jupyter notebook list", shell=True)
|
||||||
|
lines = answer.decode("utf-8").split("\n")
|
||||||
|
if lines[0] != "Currently running servers:":
|
||||||
|
raise Exception("Invalid jupyter status message")
|
||||||
|
|
||||||
|
for i in range(1, len(lines) -1):
|
||||||
|
if getNotebookPort(lines[i]) == PORT:
|
||||||
|
return getNotebookToken(lines[i])
|
||||||
|
return None
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
try:
|
||||||
|
if not isNotebookRunning():
|
||||||
|
subprocess.Popen(f"jupyter notebook --notebook-dir={NOTEBOOK_DIR} --port={PORT} --no-browser", shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||||
|
|
||||||
|
max_wait_seconds = 3
|
||||||
|
delta_t_seconds = 0.1
|
||||||
|
|
||||||
|
current_wait_seconds = 0
|
||||||
|
|
||||||
|
token = ""
|
||||||
|
while True:
|
||||||
|
token = isNotebookRunning()
|
||||||
|
if token:
|
||||||
|
break
|
||||||
|
|
||||||
|
time.sleep(delta_t_seconds)
|
||||||
|
current_wait_seconds += delta_t_seconds
|
||||||
|
if current_wait_seconds >= max_wait_seconds:
|
||||||
|
raise Exception(f"Maximum wait time of {max_wait_seconds} exceeded!")
|
||||||
|
|
||||||
|
subprocess.call(f"cp {NOTEBOOK_DIR}calculator_template.ipynb {NOTEBOOK_DIR}calculator.ipynb", shell=True, stdout=None)
|
||||||
|
subprocess.call(f"electron 'http://localhost:{PORT}/notebooks/calculator.ipynb?token={token}'", shell=True, stdout=None)
|
||||||
|
|
||||||
|
finally:
|
||||||
|
# TODO: not reliably working
|
||||||
|
if not isOtherProcessRunning():
|
||||||
|
try:
|
||||||
|
subprocess.run(f"jupyter notebook stop {PORT}", shell=True)
|
||||||
|
except Exception:
|
||||||
|
pass
|
@ -2,5 +2,5 @@
|
|||||||
|
|
||||||
zoom &
|
zoom &
|
||||||
|
|
||||||
i3-msg "workspace --no-auto-back-and-forth 5; exec mousepad /home/julian/jhome/nextcloud/studium/zoom.txt"
|
i3-msg "workspace --no-auto-back-and-forth 5; exec mousepad /home/julian/Nextcloud/studium/zoom.txt"
|
||||||
i3-msg "workspace --no-auto-back-and-forth 5; append_layout ~/.config/i3/workspace-zoom.json"
|
i3-msg "workspace --no-auto-back-and-forth 5; append_layout ~/.config/i3/workspace-zoom.json"
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
// vim:ts=4:sw=4:et
|
// vim:ts=4:sw=4:et
|
||||||
{
|
{
|
||||||
// tabbed split container with 3 children
|
// splith split container with 2 children
|
||||||
"border": "normal",
|
"border": "normal",
|
||||||
"floating": "auto_off",
|
"floating": "auto_off",
|
||||||
"layout": "tabbed",
|
"layout": "splith",
|
||||||
"percent": null,
|
"marks": [],
|
||||||
|
"percent": 1,
|
||||||
"type": "con",
|
"type": "con",
|
||||||
"nodes": [
|
"nodes": [
|
||||||
{
|
{
|
||||||
@ -17,12 +18,14 @@
|
|||||||
"x": 1680,
|
"x": 1680,
|
||||||
"y": 24
|
"y": 24
|
||||||
},
|
},
|
||||||
|
"marks": [],
|
||||||
"name": "Telegram",
|
"name": "Telegram",
|
||||||
"percent": 0.333333333333333,
|
"percent": 0.5,
|
||||||
"swallows": [
|
"swallows": [
|
||||||
{
|
{
|
||||||
"class": "^TelegramDesktop$",
|
"class": "^TelegramDesktop$",
|
||||||
"instance": "^telegram\\-desktop$"
|
"instance": "^telegram\\-desktop$"
|
||||||
|
// "title": "^Telegram\\ \\(18\\)$"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"type": "con"
|
"type": "con"
|
||||||
@ -37,37 +40,19 @@
|
|||||||
"x": 2242,
|
"x": 2242,
|
||||||
"y": 46
|
"y": 46
|
||||||
},
|
},
|
||||||
|
"marks": [],
|
||||||
"name": "Element",
|
"name": "Element",
|
||||||
"percent": 0.333333333333333,
|
"percent": 0.5,
|
||||||
"swallows": [
|
"swallows": [
|
||||||
{
|
{
|
||||||
"class": "^Element$",
|
"class": "^Element$",
|
||||||
"instance": "^element$"
|
"instance": "^element$"
|
||||||
}
|
// "title": "^Element\\ \\|\\ wmutter$",
|
||||||
],
|
// "window_role": "^browser\\-window$"
|
||||||
"type": "con"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"border": "normal",
|
|
||||||
"current_border_width": 2,
|
|
||||||
"floating": "auto_off",
|
|
||||||
"geometry": {
|
|
||||||
"height": 1002,
|
|
||||||
"width": 556,
|
|
||||||
"x": 2802,
|
|
||||||
"y": 46
|
|
||||||
},
|
|
||||||
"name": "Rocket Chat",
|
|
||||||
"percent": 0.333333333333333,
|
|
||||||
"swallows": [
|
|
||||||
{
|
|
||||||
"class": "^Rocket\\.Chat$",
|
|
||||||
"instance": "^rocket\\.chat$"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"type": "con"
|
"type": "con"
|
||||||
}
|
}
|
||||||
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
30
i3blocks/activity
Executable file
30
i3blocks/activity
Executable file
@ -0,0 +1,30 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
NONE="None"
|
||||||
|
|
||||||
|
get_current_activity() {
|
||||||
|
activity=$(hamster current)
|
||||||
|
if [ "$activity" = "No activity" ]; then
|
||||||
|
echo $NONE
|
||||||
|
else
|
||||||
|
IFS=' '
|
||||||
|
read -ra ADDR <<< "$activity"
|
||||||
|
echo "${ADDR[2]}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
case "$BLOCK_BUTTON" in
|
||||||
|
1|2|3)
|
||||||
|
current_activity=$(get_current_activity)
|
||||||
|
if [ "$current_activity" = "$NONE" ]; then
|
||||||
|
hamster start "Comu@Work#Flexibill App"
|
||||||
|
else
|
||||||
|
hamster stop
|
||||||
|
fi
|
||||||
|
esac
|
||||||
|
|
||||||
|
current_activity=$(get_current_activity)
|
||||||
|
|
||||||
|
echo "$LABEL $current_activity"
|
||||||
|
echo "$LABEL $current_activity"
|
@ -10,6 +10,11 @@
|
|||||||
separator=true
|
separator=true
|
||||||
separator_block_width=15
|
separator_block_width=15
|
||||||
|
|
||||||
|
[activity]
|
||||||
|
command=./activity
|
||||||
|
interval=10
|
||||||
|
LABEL=
|
||||||
|
|
||||||
[volume]
|
[volume]
|
||||||
command=./volume
|
command=./volume
|
||||||
LABEL=
|
LABEL=
|
||||||
@ -24,4 +29,4 @@ LABEL=
|
|||||||
[calendar]
|
[calendar]
|
||||||
command=./calendar
|
command=./calendar
|
||||||
interval=1
|
interval=1
|
||||||
LABEL=
|
|
||||||
|
Reference in New Issue
Block a user