space out options a bit more
This commit is contained in:
parent
0cacfda5d5
commit
366cdcd58a
|
@ -1,8 +1,12 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
import gi
|
import gi
|
||||||
import math
|
import math
|
||||||
import cairo
|
import cairo
|
||||||
import subprocess as sp
|
import subprocess as sp
|
||||||
import sys
|
import sys
|
||||||
|
import os
|
||||||
|
from os.path import expanduser
|
||||||
import toml
|
import toml
|
||||||
gi.require_version("Gtk","3.0")
|
gi.require_version("Gtk","3.0")
|
||||||
gi.require_version("Gdk","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.select_font_face(self.config["font"],cairo.FontSlant.NORMAL,cairo.FontWeight.BOLD)
|
||||||
cr.set_line_width(4)
|
cr.set_line_width(4)
|
||||||
cr.set_font_size(20)
|
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)
|
cr.rotate(start_angle)
|
||||||
angle = start_angle
|
angle = start_angle
|
||||||
cr.set_source_rgb(1,1,1)
|
cr.set_source_rgb(1,1,1)
|
||||||
for i, o in enumerate(self.options):
|
for i, o in enumerate(self.options):
|
||||||
self.draw_option(cr, i, o)
|
self.draw_option(cr, i, o)
|
||||||
cr.rotate(math.pi/16)
|
cr.rotate(math.pi/12)
|
||||||
self.lines.append(angle)
|
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:
|
config_file = toml.load(open(config_home + "/sike/config.toml"))
|
||||||
print("please supply an options file!")
|
|
||||||
|
if config_file["config"]["use_i3"] == True:
|
||||||
|
from i3ipc import Connection
|
||||||
|
i3 = Connection()
|
||||||
|
focused = i3.get_tree().find_focused()
|
||||||
else:
|
else:
|
||||||
config_file = toml.load(open(sys.argv[1],"r"))
|
i3 = None
|
||||||
if config_file["config"]["use_i3"] == True:
|
|
||||||
from i3ipc import Connection
|
win = MenuWindow(config_file["options"],config_file["colors"],config_file["config"])
|
||||||
i3 = Connection()
|
screen = win.get_screen()
|
||||||
focused = i3.get_tree().find_focused()
|
disp = screen.get_display()
|
||||||
else:
|
monitor_count = disp.get_n_monitors()
|
||||||
i3 = None
|
if monitor_count == 1:
|
||||||
win = MenuWindow(config_file["options"],config_file["colors"],config_file["config"])
|
mon = disp.get_monitor(0)
|
||||||
screen = win.get_screen()
|
else:
|
||||||
disp = screen.get_display()
|
mon = disp.get_default_monitor()
|
||||||
monitor_count = disp.get_n_monitors()
|
g = mon.get_geometry()
|
||||||
if monitor_count == 1:
|
win.scale(g.width,g.height)
|
||||||
mon = disp.get_monitor(0)
|
GtkLayerShell.init_for_window(win)
|
||||||
else:
|
GtkLayerShell.set_layer(win, GtkLayerShell.Layer.OVERLAY)
|
||||||
mon = disp.get_default_monitor()
|
GtkLayerShell.set_anchor(win, GtkLayerShell.Edge.RIGHT, 1)
|
||||||
g = mon.get_geometry()
|
GtkLayerShell.set_anchor(win, GtkLayerShell.Edge.BOTTOM, 1)
|
||||||
win.scale(g.width,g.height)
|
GtkLayerShell.set_anchor(win, GtkLayerShell.Edge.TOP, 1)
|
||||||
GtkLayerShell.init_for_window(win)
|
win.show_all()
|
||||||
GtkLayerShell.set_layer(win, GtkLayerShell.Layer.OVERLAY)
|
Gtk.main()
|
||||||
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()
|
|
||||||
|
|
Reference in New Issue