-
I tried at reddit, but it seems this is the correct place =) So I teach at a university, and the teaching is done online from my office. Here I often like to maximize a calculator to quickly show my students how to compute something. It is there extremely important that the calculator is transparent so the maths behind it is visible, fullscreen fails to do so, In my config I have this exec --no-startup-id alacritty --class "qalc" --config-file /home/oisov/.config/alacritty/alacritty_xxl.yml -e qalc
for_window [instance="qalc"] floating enable
for_window [instance="qalc"] move to scratchpad
for_window [instance="qalc"] resize set 100 ppt 100ppt
bindsym $mod+u exec ~/.config/i3/scratchpad_qalc.sh The bash script is implemented as #!/bin/bash
if [ -z "$(xdotool search --classname 'qalc')" ]; then
alacritty --class "qalc" --config-file /home/oisov/.config/alacritty/alacritty_xxl.yml -e qalc & sleep 0.5
fi
i3-msg "[instance=\"qalc\"] scratchpad show, resize set 100 ppt 100 ppt, move position 0 0" Where the alacritty config file is nothing more than a much bigger fontsize. How it looks maximized is something like this My issue is that Any ideas how to fix this? I use a laptop with 3 monitors docked with different screen sizes, so forcing the calculator to open on one specific monitor is not a viable solution. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Why? If you're using compton/picom, you might try setting
From quickly scanning the code, this may be a bug (but one that is hard to fix in a non-breaking way now); That means the only way for you right now would probably be to use the IPC to figure out the position of the output and plug in those numbers into |
Beta Was this translation helpful? Give feedback.
-
I was able to solve my issue using the following Python code for_window [instance="qalc"] floating enable
for_window [instance="qalc"] move to scratchpad
for_window [instance="qalc"] resize set 100 ppt 100ppt
exec --no-startup-id alacritty --class "qalc" --config-file /home/oisov/.config/alacritty/alacritty_xxl.yml -e qalc
bindsym $mod+u exec python ~/.config/i3/qalc.py Where #!/usr/bin/env python3
import i3ipc
import subprocess
from collections import namedtuple
Pos = namedtuple("Pos", "x y")
i3 = i3ipc.Connection()
def current_output():
workspaces = i3.get_workspaces()
focused_workspace = [w for w in workspaces if w.focused][0]
focused_output = i3.get_outputs()[0]
for output in i3.get_outputs():
if output.name == focused_workspace.output:
return output
def get_output_pos(output):
return Pos(output.rect.x, output.rect.y)
def calculator_running():
return (
subprocess.run(
"xdotool search --classname 'qalc'",
shell=True,
universal_newlines=True,
).returncode
== 0
)
def run_calculator():
subprocess.Popen(
[
"alacritty",
"--class",
"qalc",
"--config-file",
ALACRITTY_CONFIG,
"-e",
"qalc",
]
)
subprocess.run(["sleep 0.5"], shell=True)
def open_calculator(monitor):
pos_monitor = get_output_pos(monitor)
i3_message = f'i3-msg "[instance="qalc"] scratchpad show, resize set 100 ppt 100 ppt, move position {pos_monitor.x} {pos_monitor.y}"'
subprocess.run([i3_message], shell=True)
ALACRITTY_CONFIG = "/home/oisov/.config/alacritty/alacritty_xxl.yml"
if __name__ == "__main__":
print("hello")
monitor = current_output()
print(calculator_running())
if not calculator_running():
run_calculator()
open_calculator(monitor) This issue can be closed, but I feel like there should be a cleaner way than using IPC to figure out the position of the output and plug in those numbers into move position. |
Beta Was this translation helpful? Give feedback.
I was able to solve my issue using the following Python code
Where
calc.py
is implemented as follows