Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
flatpak remote-add --user --if-not-exists gnome-nightly \
https://nightly.gnome.org/gnome-nightly.flatpakrepo

- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: Build the flatpak package
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: Install required packages
run: pip install -Iv flake8 yamllint black
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.37.1
rev: v1.38.0
hooks:
- id: yamllint
types:
- yaml
- repo: https://github.com/psf/black
rev: 25.11.0
rev: 26.3.1
hooks:
- id: black
name: black
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ Length Release Notes

.. contents:: Topics

v0.10.2
======

Bugfixes
--------

- Add the vertical or horizontal CSS class to the application window [`#59`_].

.. _#59: https://github.com/herve4m/length/issues/59

v0.10.1
======

Expand Down
12 changes: 1 addition & 11 deletions build-aux/flatpak/io.github.herve4m.Length.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,14 @@
---
id: io.github.herve4m.Length
runtime: org.gnome.Platform
runtime-version: "49"
runtime-version: "50"
sdk: org.gnome.Sdk
command: length
finish-args:
- --socket=wayland
- --socket=fallback-x11
- --share=ipc
- --device=dri
cleanup:
- /include
- /lib/pkgconfig
- /man
- /share/doc
- /share/gtk-doc
- /share/man
- /share/pkgconfig
- "*.la"
- "*.a"
modules:
- name: length
builddir: true
Expand Down
6 changes: 6 additions & 0 deletions data/io.github.herve4m.Length.metainfo.xml.in.in
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@
</screenshots>

<releases>
<release version="0.10.2" date="2026-05-16">
<url type="details">https://github.com/herve4m/length/blob/main/CHANGELOG.rst#v0102</url>
<description translate="no">
<p>Add the vertical or horizontal CSS class to the application window</p>
</description>
</release>
<release version="0.10.1" date="2025-09-29">
<url type="details">https://github.com/herve4m/length/blob/main/CHANGELOG.rst#v0101</url>
<description translate="no">
Expand Down
10 changes: 0 additions & 10 deletions io.github.herve4m.Length.Devel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,6 @@ finish-args:
- --socket=fallback-x11
- --share=ipc
- --device=dri
cleanup:
- /include
- /lib/pkgconfig
- /man
- /share/doc
- /share/gtk-doc
- /share/man
- /share/pkgconfig
- "*.la"
- "*.a"
modules:
- name: length
builddir: true
Expand Down
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
project('length',
version: '0.10.1',
version: '0.10.2',
meson_version: '>= 1.1.0',
default_options: [ 'warning_level=2', 'werror=false', ],
)
Expand Down
12 changes: 5 additions & 7 deletions src/main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# main.py
#
# Copyright 2025 Hervé Quatremain
# Copyright 2025, 2026 Hervé Quatremain
#
# This file is part of Length.
#
Expand Down Expand Up @@ -83,13 +83,11 @@ def do_command_line(self, command_line) -> int:
options = options.end().unpack()

if "version" in options:
print(
f"""Length {self.version}
Copyright (C) 2025 Hervé Quatremain
print(f"""Length {self.version}
Copyright (C) 2025, 2026 Hervé Quatremain
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law."""
)
There is NO WARRANTY, to the extent permitted by law.""")
return 0
if "debug" in options:
logging.basicConfig(level=logging.DEBUG)
Expand Down Expand Up @@ -143,7 +141,7 @@ def on_about_action(self, *args) -> None:
developer_name="Hervé Quatremain",
version=self.version,
developers=["Hervé Quatremain"],
copyright="© 2025 Hervé Quatremain",
copyright="© 2025, 2026 Hervé Quatremain",
issue_url="https://github.com/herve4m/length/issues",
license_type=Gtk.License.GPL_3_0,
website="https://github.com/herve4m/length",
Expand Down
13 changes: 12 additions & 1 deletion src/orientation.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# orientation.py
#
# Copyright 2025 Hervé Quatremain
# Copyright 2025, 2026 Hervé Quatremain
#
# This file is part of Length.
#
Expand Down Expand Up @@ -42,6 +42,7 @@ def update_orientation(self) -> None:
w, h = self.application_window.get_default_size()
self.h_toggle.set_active(w > h)
self.v_toggle.set_active(w <= h)
self._set_class(w, h)

def rotate(self, w: int = 0, h: int = 0) -> None:
if w == 0 or h == 0:
Expand All @@ -55,6 +56,7 @@ def rotate(self, w: int = 0, h: int = 0) -> None:
self.application_window.maximize()
self.application_window.unmaximize()
self.application_window.present()
self._set_class(h, w)

if (
self.application_window.context.track_pointer
Expand All @@ -68,6 +70,15 @@ def rotate(self, w: int = 0, h: int = 0) -> None:
self.application_window.context.track_pos_x,
)

def _set_class(self, w: int, h: int):
"""Add the horizontal or vertical CSS class to the application window."""
if w > h:
self.application_window.remove_css_class("vertical")
self.application_window.add_css_class("horizontal")
else:
self.application_window.remove_css_class("horizontal")
self.application_window.add_css_class("vertical")

@Gtk.Template.Callback()
def _orientation_toggled(self, toggle) -> None:
w, h = self.application_window.get_default_size()
Expand Down
Loading