space out options a bit more

This commit is contained in:
nihilazo 2020-09-12 19:27:11 +00:00
parent 0cacfda5d5
commit 366cdcd58a
1 changed files with 33 additions and 29 deletions

62
main.py Normal file → Executable file
View File

@ -1,8 +1,12 @@
#!/usr/bin/env python
import gi
import math
import cairo
import subprocess as sp
import sys
import os
from os.path import expanduser
import toml
gi.require_version("Gtk","3.0")
gi.require_version("Gdk","3.0")
@ -142,41 +146,41 @@ class MenuWindow(Gtk.Window):
cr.select_font_face(self.config["font"],cairo.FontSlant.NORMAL,cairo.FontWeight.BOLD)
cr.set_line_width(4)
cr.set_font_size(20)
start_angle = (-math.pi/16)*(len(self.options)/2)
start_angle = (-math.pi/12)*(len(self.options)/2)
cr.rotate(start_angle)
angle = start_angle
cr.set_source_rgb(1,1,1)
for i, o in enumerate(self.options):
self.draw_option(cr, i, o)
cr.rotate(math.pi/16)
cr.rotate(math.pi/12)
self.lines.append(angle)
angle += math.pi/16
angle += math.pi/12
config_home = os.getenv("XDG_CONFIG_HOME", expanduser("~/.config"))
if len(sys.argv) < 2:
print("please supply an options file!")
config_file = toml.load(open(config_home + "/sike/config.toml"))
if config_file["config"]["use_i3"] == True:
from i3ipc import Connection
i3 = Connection()
focused = i3.get_tree().find_focused()
else:
config_file = toml.load(open(sys.argv[1],"r"))
if config_file["config"]["use_i3"] == True:
from i3ipc import Connection
i3 = Connection()
focused = i3.get_tree().find_focused()
else:
i3 = None
win = MenuWindow(config_file["options"],config_file["colors"],config_file["config"])
screen = win.get_screen()
disp = screen.get_display()
monitor_count = disp.get_n_monitors()
if monitor_count == 1:
mon = disp.get_monitor(0)
else:
mon = disp.get_default_monitor()
g = mon.get_geometry()
win.scale(g.width,g.height)
GtkLayerShell.init_for_window(win)
GtkLayerShell.set_layer(win, GtkLayerShell.Layer.OVERLAY)
GtkLayerShell.set_anchor(win, GtkLayerShell.Edge.RIGHT, 1)
GtkLayerShell.set_anchor(win, GtkLayerShell.Edge.BOTTOM, 1)
GtkLayerShell.set_anchor(win, GtkLayerShell.Edge.TOP, 1)
win.show_all()
Gtk.main()
i3 = None
win = MenuWindow(config_file["options"],config_file["colors"],config_file["config"])
screen = win.get_screen()
disp = screen.get_display()
monitor_count = disp.get_n_monitors()
if monitor_count == 1:
mon = disp.get_monitor(0)
else:
mon = disp.get_default_monitor()
g = mon.get_geometry()
win.scale(g.width,g.height)
GtkLayerShell.init_for_window(win)
GtkLayerShell.set_layer(win, GtkLayerShell.Layer.OVERLAY)
GtkLayerShell.set_anchor(win, GtkLayerShell.Edge.RIGHT, 1)
GtkLayerShell.set_anchor(win, GtkLayerShell.Edge.BOTTOM, 1)
GtkLayerShell.set_anchor(win, GtkLayerShell.Edge.TOP, 1)
win.show_all()
Gtk.main()